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
cf431a514bf89a1c9ac68adebffdbadde549fe6e
230
py
Python
1701-1800/1799-Sequence summation/1799-Sequence summation.py
jiadaizhao/LintCode
a8aecc65c47a944e9debad1971a7bc6b8776e48b
[ "MIT" ]
77
2017-12-30T13:33:37.000Z
2022-01-16T23:47:08.000Z
1701-1800/1799-Sequence summation/1799-Sequence summation.py
jxhangithub/LintCode-1
a8aecc65c47a944e9debad1971a7bc6b8776e48b
[ "MIT" ]
1
2018-05-14T14:15:40.000Z
2018-05-14T14:15:40.000Z
1701-1800/1799-Sequence summation/1799-Sequence summation.py
jxhangithub/LintCode-1
a8aecc65c47a944e9debad1971a7bc6b8776e48b
[ "MIT" ]
39
2017-12-07T14:36:25.000Z
2022-03-10T23:05:37.000Z
class Solution: """ @param i: @param j: @param k: @return: nothing """ def equlSum(self, i, j, k): # Write your code here return (i + j)*(j - i + 1) // 2 + (j - 1 + k) * (j - k) // 2
20.909091
68
0.417391
33
230
2.909091
0.515152
0.041667
0
0
0
0
0
0
0
0
0
0.028777
0.395652
230
10
69
23
0.661871
0.308696
0
0
0
0
0
0
0
0
0
0.1
0
1
0.333333
false
0
0
0.333333
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
1
1
0
0
4
cf443c14153c4633812703db6939706fb84c4378
18
py
Python
python/testData/codeInsight/smartEnter/unclosedParametersListAndTrailingEmptyLines.py
truthiswill/intellij-community
fff88cfb0dc168eea18ecb745d3e5b93f57b0b95
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/codeInsight/smartEnter/unclosedParametersListAndTrailingEmptyLines.py
truthiswill/intellij-community
fff88cfb0dc168eea18ecb745d3e5b93f57b0b95
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
python/testData/codeInsight/smartEnter/unclosedParametersListAndTrailingEmptyLines.py
truthiswill/intellij-community
fff88cfb0dc168eea18ecb745d3e5b93f57b0b95
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
def fun<caret>c(
6
16
0.666667
4
18
3
1
0
0
0
0
0
0
0
0
0
0
0
0.166667
18
2
17
9
0.8
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
cf83ff695de19d349be90840ff45fe52311746fe
93
py
Python
stagedoor/apps.py
galaxybrainco/django-stagedoor
f9e555e1c0ee95edee25a71947304872f1353f36
[ "Apache-2.0" ]
1
2020-05-25T22:09:40.000Z
2020-05-25T22:09:40.000Z
stagedoor/apps.py
galaxybrainco/django-stagedoor
f9e555e1c0ee95edee25a71947304872f1353f36
[ "Apache-2.0" ]
null
null
null
stagedoor/apps.py
galaxybrainco/django-stagedoor
f9e555e1c0ee95edee25a71947304872f1353f36
[ "Apache-2.0" ]
null
null
null
from django.apps import AppConfig class StagedoorConfig(AppConfig): name = "stagedoor"
15.5
33
0.763441
10
93
7.1
0.9
0
0
0
0
0
0
0
0
0
0
0
0.16129
93
5
34
18.6
0.910256
0
0
0
0
0
0.096774
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
d85bd7649487857211869afa0eb5a34627e4e1eb
220
py
Python
sharing_portal/tests/test_label.py
msherman64/portal
e5399ef2ed3051d7c9a46c660f028c666ae22ca6
[ "Apache-2.0" ]
3
2015-08-04T20:53:41.000Z
2020-02-14T22:58:20.000Z
sharing_portal/tests/test_label.py
msherman64/portal
e5399ef2ed3051d7c9a46c660f028c666ae22ca6
[ "Apache-2.0" ]
103
2015-01-15T14:21:00.000Z
2022-03-31T19:14:20.000Z
sharing_portal/tests/test_label.py
msherman64/portal
e5399ef2ed3051d7c9a46c660f028c666ae22ca6
[ "Apache-2.0" ]
4
2016-02-22T16:48:20.000Z
2021-01-08T17:13:21.000Z
from django.test import TestCase from ..models import Label class LabelStringTest(TestCase): def test_to_string(self): l1 = Label.objects.create(label='label1') self.assertEqual(str(l1), l1.label)
22
49
0.709091
29
220
5.310345
0.655172
0.090909
0
0
0
0
0
0
0
0
0
0.022222
0.181818
220
9
50
24.444444
0.833333
0
0
0
0
0
0.027273
0
0
0
0
0
0.166667
1
0.166667
false
0
0.333333
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
d872262fc29cde6eb0de85ab947bb55ddd9bf444
50
py
Python
src/explode_view/__init__.py
jni/explode-view
b30d5c4cd1d7cd553d8c04f9753693af1a68383c
[ "BSD-3-Clause" ]
2
2021-11-17T08:16:11.000Z
2021-11-17T11:05:34.000Z
src/explode_view/__init__.py
jni/explode-view
b30d5c4cd1d7cd553d8c04f9753693af1a68383c
[ "BSD-3-Clause" ]
4
2021-11-01T07:19:10.000Z
2021-11-18T08:17:47.000Z
src/explode_view/__init__.py
jni/explode-view
b30d5c4cd1d7cd553d8c04f9753693af1a68383c
[ "BSD-3-Clause" ]
null
null
null
from ._explode_view import get_exploded_view_func
25
49
0.9
8
50
5
0.875
0
0
0
0
0
0
0
0
0
0
0
0.08
50
1
50
50
0.869565
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
d888dec4c4dd0698a0e097f68ce4b296b1c0dc4d
66
py
Python
secrets.py
thekip137/NBN-TwitterShadeThrower
16a5bd4a81fab8dc3cfdb172e1bc9bc0d00967e7
[ "MIT" ]
null
null
null
secrets.py
thekip137/NBN-TwitterShadeThrower
16a5bd4a81fab8dc3cfdb172e1bc9bc0d00967e7
[ "MIT" ]
null
null
null
secrets.py
thekip137/NBN-TwitterShadeThrower
16a5bd4a81fab8dc3cfdb172e1bc9bc0d00967e7
[ "MIT" ]
null
null
null
consumer_key= consumer_secret= access_token= access_token_secret=
13.2
20
0.878788
9
66
5.888889
0.555556
0.415094
0
0
0
0
0
0
0
0
0
0
0.060606
66
4
21
16.5
0.854839
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
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
1
0
0
0
0
0
0
0
0
4
d8b2f8c54e86140ad39712076df55cd0eb8bf581
83
py
Python
typepigeon/__init__.py
zacharyburnett/TypePigeon
1e0b50c24f4bf3450b34c2d5afd5c628498df7bb
[ "MIT" ]
null
null
null
typepigeon/__init__.py
zacharyburnett/TypePigeon
1e0b50c24f4bf3450b34c2d5afd5c628498df7bb
[ "MIT" ]
null
null
null
typepigeon/__init__.py
zacharyburnett/TypePigeon
1e0b50c24f4bf3450b34c2d5afd5c628498df7bb
[ "MIT" ]
null
null
null
from typepigeon.convert import convert_to_json, convert_value, guard_generic_alias
41.5
82
0.891566
12
83
5.75
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.072289
83
1
83
83
0.896104
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
d8bb8209aafdb2257a903f3b45f0e2f13dcf21a9
107
py
Python
packages/infrastructure/lib/authtest/emailReceiver.py
chessdbai/Hercules
b9edf053f45039b9560e11791b3e19a67023c3b1
[ "MIT" ]
null
null
null
packages/infrastructure/lib/authtest/emailReceiver.py
chessdbai/Hercules
b9edf053f45039b9560e11791b3e19a67023c3b1
[ "MIT" ]
null
null
null
packages/infrastructure/lib/authtest/emailReceiver.py
chessdbai/Hercules
b9edf053f45039b9560e11791b3e19a67023c3b1
[ "MIT" ]
null
null
null
import boto3 import json def handle(event, context): print('Received event:') print(json.dumps(event))
17.833333
27
0.738318
15
107
5.266667
0.666667
0
0
0
0
0
0
0
0
0
0
0.010753
0.130841
107
6
28
17.833333
0.83871
0
0
0
0
0
0.138889
0
0
0
0
0
0
1
0.2
false
0
0.4
0
0.6
0.4
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
d8f136f5a11ff6849a4a940494adfc5dc64f570d
4,949
py
Python
CPP-PyTorch-Ext/YOLO_Lite_compare.py
AmirOfir/GCK3x3ConvLayer
adf6ddefb01888fb247edaa0d87e2da546781584
[ "BSD-3-Clause" ]
null
null
null
CPP-PyTorch-Ext/YOLO_Lite_compare.py
AmirOfir/GCK3x3ConvLayer
adf6ddefb01888fb247edaa0d87e2da546781584
[ "BSD-3-Clause" ]
null
null
null
CPP-PyTorch-Ext/YOLO_Lite_compare.py
AmirOfir/GCK3x3ConvLayer
adf6ddefb01888fb247edaa0d87e2da546781584
[ "BSD-3-Clause" ]
null
null
null
import sys import gc import timeit import time import numpy as np import numpy.linalg as l import torch import torch.nn as nn import torch.nn.functional as F from gck_cpu_cpp import conv_fwd_3x3 from gck_layer import GCK3x3Layer repeat_count = 100 # Compare YOLO_Lite input = torch.randn(1,3,224,224, dtype=torch.float32) YOLO_Lite_Model_Paper = nn.Sequential(#nn.ZeroPad2d((1, 1, 1, 1)), #torch.Size([1, 3, 226, 226]) nn.Conv2d(3,16,kernel_size=3, bias=False, padding=1), #torch.Size([1, 16, 224, 224]) nn.BatchNorm2d(16, momentum=0.9, eps=1e-5), #torch.Size([1, 16, 224, 224]) nn.LeakyReLU(0.1), #torch.Size([1, 16, 224, 224]) nn.MaxPool2d(kernel_size=2, stride=2, padding=int((2 - 1) // 2)), #torch.Size([1, 16, 112, 112]) #n.ZeroPad2d((1, 1, 1, 1)), #torch.Size([1, 16, 114, 114]) nn.Conv2d(16,32,kernel_size=3, bias=False, padding=1), #torch.Size([1, 32, 112, 112]) nn.BatchNorm2d(32, momentum=0.9, eps=1e-5), #torch.Size([1, 32, 112, 112]) nn.LeakyReLU(0.1), #torch.Size([1, 32, 112, 112]) nn.MaxPool2d(kernel_size=2, stride=2, padding=int((2 - 1) // 2)), #torch.Size([1, 32, 56, 56]) # nn.ZeroPad2d((1, 1, 1, 1)), #torch.Size([1, 32, 58, 58]) nn.Conv2d(32, 64, kernel_size=3, bias=False, padding=1), #torch.Size([1, 64, 56, 56]) nn.BatchNorm2d(64, momentum=0.9, eps=1e-5), #torch.Size([1, 64, 56, 56]) nn.LeakyReLU(0.1), #torch.Size([1, 64, 56, 56]) nn.MaxPool2d(kernel_size=2, stride=2, padding=int((2 - 1) // 2)), #torch.Size([1, 64, 28, 28]) # nn.ZeroPad2d((1, 1, 1, 1)), #torch.Size([1, 64, 30, 30]) nn.Conv2d(64, 128, kernel_size=3, bias=False, padding=1), #torch.Size([1, 128, 28, 28]) nn.BatchNorm2d(128, momentum=0.9, eps=1e-5), #torch.Size([1, 128, 28, 28]) nn.LeakyReLU(0.1), #torch.Size([1, 128, 28, 28]) nn.MaxPool2d(kernel_size=2, stride=2, padding=int((2 - 1) // 2)), #torch.Size([1, 128, 14, 14]) # nn.ZeroPad2d((1, 1, 1, 1)), #torch.Size([1, 128, 16, 16]) nn.Conv2d(128, 128, kernel_size=3, bias=False, padding=1), #torch.Size([1, 128, 14, 14]) nn.BatchNorm2d(128, momentum=0.9, eps=1e-5), #torch.Size([1, 128, 14, 14]) nn.LeakyReLU(0.1), #torch.Size([1, 128, 14, 14]) nn.MaxPool2d(kernel_size=2, stride=2, padding=int((2 - 1) // 2)), #torch.Size([1, 128, 7, 7]) # nn.ZeroPad2d((1, 1, 1, 1)), #torch.Size([1, 128, 9, 9]) nn.Conv2d(128, 256, kernel_size=3, bias=False, padding=1), #torch.Size([1, 256, 7, 7]) nn.BatchNorm2d(256, momentum=0.9, eps=1e-5), #torch.Size([1, 256, 7, 7]) nn.LeakyReLU(0.1), #torch.Size([1, 256, 7, 7]) nn.ZeroPad2d((1, 1, 1, 1)), nn.Conv2d(256, 125, kernel_size=1, bias=False)) YOLO_Lite_Model_Paper.eval() Our_Layer_Model = nn.Sequential(#nn.ZeroPad2d((1, 1, 1, 1)), GCK3x3Layer(3,16,kernel_size=3, bias=False, result_dim=224, padding=1), nn.BatchNorm2d(16, momentum=0.9, eps=1e-5), nn.LeakyReLU(0.1), nn.MaxPool2d(kernel_size=2, stride=2, padding=int((2 - 1) // 2)), # nn.ZeroPad2d((1, 1, 1, 1)), nn.Conv2d(16,32,kernel_size=3, bias=False, padding=1), #torch.Size([1, 32, 112, 112]) nn.BatchNorm2d(32, momentum=0.9, eps=1e-5), nn.LeakyReLU(0.1), nn.MaxPool2d(kernel_size=2, stride=2, padding=int((2 - 1) // 2)), # nn.ZeroPad2d((1, 1, 1, 1)), nn.Conv2d(32, 64, kernel_size=3, bias=False, padding=1), #torch.Size([1, 64, 56, 56]) nn.BatchNorm2d(64, momentum=0.9, eps=1e-5), nn.LeakyReLU(0.1), nn.MaxPool2d(kernel_size=2, stride=2, padding=int((2 - 1) // 2)), # nn.ZeroPad2d((1, 1, 1, 1)), GCK3x3Layer(64, 128, kernel_size=3, bias=False, result_dim=28, padding=1), nn.BatchNorm2d(128, momentum=0.9, eps=1e-5), nn.LeakyReLU(0.1), nn.MaxPool2d(kernel_size=2, stride=2, padding=int((2 - 1) // 2)), # nn.ZeroPad2d((1, 1, 1, 1)), GCK3x3Layer(128, 128, kernel_size=3, bias=False, result_dim=14, padding=1), nn.BatchNorm2d(128, momentum=0.9, eps=1e-5), nn.LeakyReLU(0.1), nn.MaxPool2d(kernel_size=2, stride=2, padding=int((2 - 1) // 2)), # nn.ZeroPad2d((1, 1, 1, 1)), GCK3x3Layer(128, 256, kernel_size=3, bias=False, result_dim=7, padding=1), nn.BatchNorm2d(256, momentum=0.9, eps=1e-5), nn.LeakyReLU(0.1), nn.ZeroPad2d((1, 1, 1, 1)), nn.Conv2d(256, 125, kernel_size=1, bias=False)) Our_Layer_Model.eval() x = YOLO_Lite_Model_Paper(input); del x def func_to_measure(): x = YOLO_Lite_Model_Paper(input) del x duration = timeit.repeat(func_to_measure, repeat=repeat_count, number=1) duration = round(np.mean(duration[1:]),4) print('YOLO_Lite_Model_Paper', duration) x = Our_Layer_Model(input); del x def func_to_measure(): x = Our_Layer_Model(input) del x duration = timeit.repeat(func_to_measure, repeat=repeat_count, number=1) duration = round(np.mean(duration[1:]),4) gc.collect() print('Our_Layer_Model', duration)
40.900826
102
0.623156
870
4,949
3.464368
0.104598
0.02787
0.102853
0.072993
0.835766
0.833776
0.833776
0.76576
0.643331
0.573988
0
0.152981
0.173166
4,949
121
103
40.900826
0.583578
0.245302
0
0.609756
0
0
0.009753
0.00569
0
0
0
0
0
1
0.02439
false
0
0.134146
0
0.158537
0.02439
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
2b2c6d15d91cb5e356cec54115308cc669c8d757
106
py
Python
wolff/accounting/admin.py
hanztura/wolff
d1fc568cd54453714f2ea61f5e99a58cc109ef65
[ "MIT" ]
2
2022-01-21T15:29:20.000Z
2022-01-21T17:42:30.000Z
wolff/accounting/admin.py
hanztura/wolff
d1fc568cd54453714f2ea61f5e99a58cc109ef65
[ "MIT" ]
null
null
null
wolff/accounting/admin.py
hanztura/wolff
d1fc568cd54453714f2ea61f5e99a58cc109ef65
[ "MIT" ]
1
2020-04-14T09:36:25.000Z
2020-04-14T09:36:25.000Z
from django.contrib import admin from .models import Account, AccountType admin.site.register(Account)
15.142857
40
0.811321
14
106
6.142857
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.122642
106
6
41
17.666667
0.924731
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
2b591ca5ac07aacfaff481799862ee10e2fff982
105
py
Python
pyhaystack/__init__.py
lixs74/pyhaystack
e5ce87f25fd42fdc3bbeab98a1ea1c673e88cdcb
[ "Apache-2.0" ]
null
null
null
pyhaystack/__init__.py
lixs74/pyhaystack
e5ce87f25fd42fdc3bbeab98a1ea1c673e88cdcb
[ "Apache-2.0" ]
null
null
null
pyhaystack/__init__.py
lixs74/pyhaystack
e5ce87f25fd42fdc3bbeab98a1ea1c673e88cdcb
[ "Apache-2.0" ]
null
null
null
try: from hszinc import Quantity, use_pint Q_ = Quantity except ImportError: pass
15
42
0.628571
12
105
5.333333
0.916667
0
0
0
0
0
0
0
0
0
0
0
0.333333
105
6
43
17.5
0.914286
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.2
0.4
0
0.4
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
9939b3adcc779622cba57f9b0778a3958c4c4192
172
py
Python
8KYU/authenticate.py
yaznasivasai/python_codewars
25493591dde4649dc9c1ec3bece8191a3bed6818
[ "MIT" ]
4
2021-07-17T22:48:03.000Z
2022-03-25T14:10:58.000Z
8KYU/authenticate.py
yaznasivasai/python_codewars
25493591dde4649dc9c1ec3bece8191a3bed6818
[ "MIT" ]
null
null
null
8KYU/authenticate.py
yaznasivasai/python_codewars
25493591dde4649dc9c1ec3bece8191a3bed6818
[ "MIT" ]
3
2021-06-14T14:18:16.000Z
2022-03-16T06:02:02.000Z
class Sleigh(object): def authenticate(self, name, password): if name == 'Santa Claus' and password == 'Ho Ho Ho!': return True return False
34.4
61
0.593023
21
172
4.857143
0.761905
0.078431
0
0
0
0
0
0
0
0
0
0
0.302326
172
5
62
34.4
0.85
0
0
0
0
0
0.115607
0
0
0
0
0
0
1
0.2
false
0.4
0
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
1
0
0
1
0
0
4
994f664822ebaadf8e1a7fdb4f885b4c16777792
5,142
py
Python
testData/typeinspectionv18/dataclass.py
alek-sun/pydantic-pycharm-plugin
6b07519aadf0ff8b8a644c1f9ede88e09c687c80
[ "Apache-2.0", "MIT" ]
238
2019-08-05T12:46:09.000Z
2022-03-25T08:53:25.000Z
testData/typeinspectionv18/dataclass.py
alek-sun/pydantic-pycharm-plugin
6b07519aadf0ff8b8a644c1f9ede88e09c687c80
[ "Apache-2.0", "MIT" ]
415
2019-07-15T17:39:35.000Z
2022-03-31T01:18:38.000Z
testData/typeinspectionv18/dataclass.py
collerek/pydantic-pycharm-plugin
7068ece42334cc9fbe927d779d199c86d5139888
[ "Apache-2.0", "MIT" ]
7
2019-08-09T01:03:16.000Z
2022-02-08T03:28:19.000Z
from typing import * import pydantic @pydantic.dataclasses.dataclass class MyDataclass: a: str b: int def func_a(self) -> str: return self.a def func_b(self) -> int: return self.b def func_c(self) -> int: return <warning descr="Expected type 'int', got 'str' instead">self.a</warning> def func_d(self) -> str: return <warning descr="Expected type 'str', got 'int' instead">self.b</warning> @pydantic.dataclasses.dataclass class ChildDataclass(MyDataclass): c: str d: int MyDataclass(a='apple', b=1) MyDataclass(<warning descr="Expected type 'str', got 'int' instead">a=2</warning>, <warning descr="Expected type 'int', got 'str' instead">b='orange'</warning>) ChildDataclass(a='apple', b=1, c='berry', d=3) ChildDataclass(<warning descr="Expected type 'str', got 'int' instead">a=2</warning>, <warning descr="Expected type 'int', got 'str' instead">b='orange'</warning>, <warning descr="Expected type 'str', got 'int' instead">c=4</warning>, <warning descr="Expected type 'int', got 'str' instead">d='cherry'</warning>) a: MyDataclass = MyDataclass() b: Type[MyDataclass] = MyDataclass c: MyDataclass = <warning descr="Expected type 'MyDataclass', got 'Type[MyDataclass]' instead">MyDataclass</warning> d: Type[MyDataclass] = <warning descr="Expected type 'Type[MyDataclass]', got 'MyDataclass' instead">MyDataclass()</warning> aa: Union[str, MyDataclass] = MyDataclass() bb: Union[str, Type[MyDataclass]] = MyDataclass cc: Union[str, MyDataclass] = <warning descr="Expected type 'Union[str, MyDataclass]', got 'Type[MyDataclass]' instead">MyDataclass</warning> dd: Union[str, Type[MyDataclass]] = <warning descr="Expected type 'Union[str, Type[MyDataclass]]', got 'MyDataclass' instead">MyDataclass()</warning> aaa: ChildDataclass = ChildDataclass() bbb: Type[ChildDataclass] = ChildDataclass ccc: ChildDataclass = <warning descr="Expected type 'ChildDataclass', got 'Type[ChildDataclass]' instead">ChildDataclass</warning> ddd: Type[ChildDataclass] = <warning descr="Expected type 'Type[ChildDataclass]', got 'ChildDataclass' instead">ChildDataclass()</warning> e: str = MyDataclass(a='apple', b=1).a f: int = MyDataclass(a='apple', b=1).b g: int = <warning descr="Expected type 'int', got 'str' instead">MyDataclass(a='apple', b=1).a</warning> h: str = <warning descr="Expected type 'str', got 'int' instead">MyDataclass(a='apple', b=1).b</warning> ee: str = ChildDataclass(a='apple', b=1, c='orange', d=2).a ff: int = ChildDataclass(a='apple', b=1, c='orange', d=2).d gg: int = <warning descr="Expected type 'int', got 'str' instead">ChildDataclass(a='apple', b=1, c='orange', d=2).a</warning> hh: str = <warning descr="Expected type 'str', got 'int' instead">ChildDataclass(a='apple', b=1, c='orange', d=2).d</warning> i: MyDataclass = MyDataclass(a='apple', b=1) j: str = i.a k: int = i.b l: int = <warning descr="Expected type 'int', got 'str' instead">i.a</warning> m: str = <warning descr="Expected type 'str', got 'int' instead">i.b</warning> ii: ChildDataclass = ChildDataclass(a='apple', b=1, c='orange', d=2) jj: str = i.a kk: int = i.d ll: int = <warning descr="Expected type 'int', got 'str' instead">ii.a</warning> mm: str = <warning descr="Expected type 'str', got 'int' instead">ii.d</warning> def my_fn_1() -> MyDataclass: return MyDataclass() def my_fn_2() -> Type[MyDataclass]: return MyDataclass def my_fn_3() -> MyDataclass: return <warning descr="Expected type 'MyDataclass', got 'Type[MyDataclass]' instead">MyDataclass</warning> def my_fn_4() -> Type[MyDataclass]: return <warning descr="Expected type 'Type[MyDataclass]', got 'MyDataclass' instead">MyDataclass()</warning> def my_fn_5() -> Union[str, MyDataclass]: return MyDataclass() def my_fn_6() -> Type[str, MyDataclass]: return MyDataclass def my_fn_7() -> Union[str, MyDataclass]: return <warning descr="Expected type 'Union[str, MyDataclass]', got 'Type[MyDataclass]' instead">MyDataclass</warning> def my_fn_8() -> Union[str, Type[MyDataclass]]: return <warning descr="Expected type 'Union[str, Type[MyDataclass]]', got 'MyDataclass' instead">MyDataclass()</warning> def my_fn_9() -> ChildDataclass: return ChildDataclass() def my_fn_10() -> Type[ChildDataclass]: return ChildDataclass def my_fn_11() -> ChildDataclass: return <warning descr="Expected type 'ChildDataclass', got 'Type[ChildDataclass]' instead">ChildDataclass</warning> def my_fn_12() -> Type[ChildDataclass]: return <warning descr="Expected type 'Type[ChildDataclass]', got 'ChildDataclass' instead">ChildDataclass()</warning> def my_fn_13() -> Union[str, ChildDataclass]: return ChildDataclass() def my_fn_14() -> Type[str, ChildDataclass]: return ChildDataclass def my_fn_7() -> Union[str, ChildDataclass]: return <warning descr="Expected type 'Union[str, ChildDataclass]', got 'Type[ChildDataclass]' instead">ChildDataclass</warning> def my_fn_8() -> Union[str, Type[ChildDataclass]]: return <warning descr="Expected type 'Union[str, Type[ChildDataclass]]', got 'ChildDataclass' instead">ChildDataclass()</warning>
40.171875
312
0.704395
694
5,142
5.167147
0.103746
0.10039
0.167317
0.200781
0.808422
0.78193
0.683212
0.60039
0.520078
0.406302
0
0.009373
0.128549
5,142
127
313
40.488189
0.790895
0
0
0.119048
0
0
0.324582
0.026254
0
0
0
0
0
0
null
null
0
0.02381
null
null
0
0
0
0
null
0
0
1
1
1
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
9950362abd37603d3c0078756bf70e8642f0be4d
306
py
Python
conf/signature.py
uktrade/sso
f4fb527cfe12955c079251031261f2407956bad3
[ "MIT" ]
1
2017-06-02T09:09:02.000Z
2017-06-02T09:09:02.000Z
conf/signature.py
uktrade/sso
f4fb527cfe12955c079251031261f2407956bad3
[ "MIT" ]
372
2016-10-25T17:10:18.000Z
2022-03-30T14:53:55.000Z
conf/signature.py
uktrade/sso
f4fb527cfe12955c079251031261f2407956bad3
[ "MIT" ]
3
2016-11-10T17:13:39.000Z
2019-12-06T16:54:46.000Z
from django.conf import settings from sigauth import middleware, permissions class SignatureCheckMiddleware(middleware.SignatureCheckMiddlewareBase): secret = settings.SIGNATURE_SECRET class SignatureCheckPermission(permissions.SignatureCheckPermissionBase): secret = settings.SIGNATURE_SECRET
27.818182
73
0.852941
26
306
9.961538
0.576923
0.108108
0.177606
0.223938
0
0
0
0
0
0
0
0
0.101307
306
10
74
30.6
0.941818
0
0
0.333333
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
9951166ebba8ffe66b328faffb8df633dd700aeb
178
py
Python
recipes/site_listers/theclevercarrot.py
cfeenstra67/recipes
a2d296500b4ff70e11ff3177a1092a033498f82a
[ "MIT" ]
null
null
null
recipes/site_listers/theclevercarrot.py
cfeenstra67/recipes
a2d296500b4ff70e11ff3177a1092a033498f82a
[ "MIT" ]
null
null
null
recipes/site_listers/theclevercarrot.py
cfeenstra67/recipes
a2d296500b4ff70e11ff3177a1092a033498f82a
[ "MIT" ]
null
null
null
from recipes.site_listers.base import SitemapLister class TheCleverCarrotLister(SitemapLister): """ """ start_url = "https://www.theclevercarrot.com/post-sitemap.xml"
22.25
66
0.752809
19
178
6.947368
0.947368
0
0
0
0
0
0
0
0
0
0
0
0.123596
178
7
67
25.428571
0.846154
0
0
0
0
0
0.280702
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
996648fbfecfc2d88b1df4a1f34bb13531f78399
130
py
Python
snavlogger.py
Snavellet/snavlogger
c438fa7827471f54ee7017996667495e39f7bea8
[ "MIT" ]
2
2019-11-17T08:36:45.000Z
2020-02-06T14:27:12.000Z
snavlogger.py
Snavellet/snavlogger
c438fa7827471f54ee7017996667495e39f7bea8
[ "MIT" ]
null
null
null
snavlogger.py
Snavellet/snavlogger
c438fa7827471f54ee7017996667495e39f7bea8
[ "MIT" ]
null
null
null
from keylogger import Keylogger stealer = Keylogger(120, 'EMAIL_FOR_SENDING', 'PASSWORD', 'EMAIL_FOR_RECEIVING') stealer.start()
26
80
0.792308
16
130
6.1875
0.6875
0.161616
0
0
0
0
0
0
0
0
0
0.025424
0.092308
130
4
81
32.5
0.813559
0
0
0
0
0
0.338462
0
0
0
0
0
0
1
0
false
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
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
997edc66dce3e953b71aecc906c0cbe5c9d2d561
188
py
Python
tests/execution/test_module.py
asyncee/pycamunda
f4834d224ff99fcf80874efeaedf68a8a2efa926
[ "MIT" ]
null
null
null
tests/execution/test_module.py
asyncee/pycamunda
f4834d224ff99fcf80874efeaedf68a8a2efa926
[ "MIT" ]
null
null
null
tests/execution/test_module.py
asyncee/pycamunda
f4834d224ff99fcf80874efeaedf68a8a2efa926
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- def test_all_contains_only_valid_names(): import pycamunda.execution for name in pycamunda.execution.__all__: getattr(pycamunda.execution, name)
20.888889
44
0.712766
23
188
5.434783
0.73913
0.432
0
0
0
0
0
0
0
0
0
0.006494
0.180851
188
8
45
23.5
0.805195
0.111702
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
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
5a9fcb627fcb48f373447672a974b3e0db258ebb
83
py
Python
zone/apps.py
zizoubrown/Hood
2cd23bb3cde799d97032d181a399d5163db033ec
[ "Unlicense" ]
null
null
null
zone/apps.py
zizoubrown/Hood
2cd23bb3cde799d97032d181a399d5163db033ec
[ "Unlicense" ]
null
null
null
zone/apps.py
zizoubrown/Hood
2cd23bb3cde799d97032d181a399d5163db033ec
[ "Unlicense" ]
2
2018-12-16T15:39:04.000Z
2018-12-17T15:03:01.000Z
from django.apps import AppConfig class ZoneConfig(AppConfig): name = 'zone'
13.833333
33
0.73494
10
83
6.1
0.9
0
0
0
0
0
0
0
0
0
0
0
0.180723
83
5
34
16.6
0.897059
0
0
0
0
0
0.048193
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
5aa7ee22a367ed96c379602cf9552f2b3f0b1793
239
py
Python
python/leap/Year.py
SamuelDoud/exercism
ced482a46cc113f09f99446c98bc10c140e8c9c4
[ "MIT" ]
null
null
null
python/leap/Year.py
SamuelDoud/exercism
ced482a46cc113f09f99446c98bc10c140e8c9c4
[ "MIT" ]
null
null
null
python/leap/Year.py
SamuelDoud/exercism
ced482a46cc113f09f99446c98bc10c140e8c9c4
[ "MIT" ]
null
null
null
#checks if a year passed is a leap year #all years diisible by 400 are leap years #then all years divisible by 4 but not by 100 are also leap years def is_leap_year(year): return year % 400 == 0 or (year % 4 == 0 and year % 100 != 0)
34.142857
65
0.694561
48
239
3.416667
0.520833
0.097561
0
0
0
0
0
0
0
0
0
0.092896
0.23431
239
7
66
34.142857
0.803279
0.594142
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0.5
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
1
0
0
0
1
1
0
0
4
5ac663a410f7d1d96f98a438a942879d2c635bad
382
py
Python
apsuite/optics_analysis/__init__.py
carneirofc/apsuite
1bbaa44ec6b89f50201790d6fab05c32729db6e1
[ "MIT" ]
1
2016-02-25T01:48:49.000Z
2016-02-25T01:48:49.000Z
apsuite/optics_analysis/__init__.py
carneirofc/apsuite
1bbaa44ec6b89f50201790d6fab05c32729db6e1
[ "MIT" ]
12
2015-09-25T12:46:41.000Z
2022-03-22T12:04:03.000Z
apsuite/optics_analysis/__init__.py
carneirofc/apsuite
1bbaa44ec6b89f50201790d6fab05c32729db6e1
[ "MIT" ]
2
2022-02-08T13:12:26.000Z
2022-03-15T17:38:11.000Z
""".""" from .chromaticity_correction import ChromCorr from .coupling_correction import CouplingCorr from .optics_correction import OpticsCorr from .tune_correction import TuneCorr del chromaticity_correction, coupling_correction, optics_correction del tune_correction __all__ = ( 'chromaticity_correction', 'coupling_correction', 'optics_correction', 'tune_correction')
27.285714
74
0.82199
39
382
7.641026
0.333333
0.214765
0.201342
0.268456
0.375839
0.375839
0
0
0
0
0
0
0.10733
382
13
75
29.384615
0.8739
0.002618
0
0
0
0
0.197333
0.061333
0
0
0
0
0
1
0
false
0
0.444444
0
0.444444
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
0
0
0
0
1
0
0
0
0
4
5aca3f4954968a41c5a90d2a9964161431b139c9
15,985
py
Python
nn.py
elvisyjlin/eval-gans
ac1451c7d37fa81f0a036bba54b090965c0187f0
[ "MIT" ]
null
null
null
nn.py
elvisyjlin/eval-gans
ac1451c7d37fa81f0a036bba54b090965c0187f0
[ "MIT" ]
null
null
null
nn.py
elvisyjlin/eval-gans
ac1451c7d37fa81f0a036bba54b090965c0187f0
[ "MIT" ]
null
null
null
import torch import torch.autograd as autograd import torch.optim as optim import torch.nn as nn import torch.nn.functional as F from torchsummary import summary def clip_weights(net, value=0.01): for p in net.parameters(): p.data.clamp_(-value, value) def gradient_penalty(f, device, real, fake=None): def interpolate(a, b=None): if type(b) is str and b == 'dragan': # interpolation in DRAGAN b = a + 0.5 * a.std() * torch.rand_like(a).to(device) if type(b) is str and b == 'lsgan-gp': # interpolation in LSGAN-GP (improved LSGAN) b = a + 30 * torch.rand_like(a).to(device) alpha = torch.rand(a.size(0), 1, 1, 1).to(device) inter = a + alpha * (b - a) return inter x = interpolate(real, fake).requires_grad_(True) pred = f(x) if isinstance(pred, tuple): pred = pred[0] grad = autograd.grad( outputs=pred, inputs=x, grad_outputs=torch.ones_like(pred), create_graph=True, retain_graph=True, only_inputs=True )[0] grad = grad.view(grad.size(0), -1) norm = grad.norm(2, dim=1) gp = ((norm - 1.0) ** 2).mean() return gp class Generator_32(nn.Module): def __init__(self): super(Generator_32, self).__init__() self.layers = nn.Sequential( nn.ConvTranspose2d(100, 256, 4, 1, bias=False), nn.BatchNorm2d(256), nn.ReLU(inplace=True), nn.ConvTranspose2d(256, 128, 4, 2, padding=1, bias=False), nn.BatchNorm2d(128), nn.ReLU(inplace=True), nn.ConvTranspose2d(128, 64, 4, 2, padding=1, bias=False), nn.BatchNorm2d(64), nn.ReLU(inplace=True), nn.ConvTranspose2d(64, 64, 3, 1, padding=1, bias=False), nn.BatchNorm2d(64), nn.ReLU(inplace=True), nn.ConvTranspose2d(64, 3, 4, 2, padding=1, bias=False), nn.Tanh(), ) def forward(self, z): z = z.view(z.size(0), z.size(1), 1, 1) return self.layers(z) class Discriminator_32(nn.Module): def __init__(self): super(Discriminator_32, self).__init__() self.layers = nn.Sequential( nn.Conv2d(3, 64, 4, 2, padding=1, bias=False), nn.BatchNorm2d(64), nn.LeakyReLU(0.2, inplace=True), nn.Conv2d(64, 64, 3, 1, padding=1, bias=False), nn.BatchNorm2d(64), nn.LeakyReLU(0.2, inplace=True), nn.Conv2d(64, 128, 4, 2, padding=1, bias=False), nn.BatchNorm2d(128), nn.LeakyReLU(0.2, inplace=True), nn.Conv2d(128, 256, 4, 2, padding=1, bias=False), nn.BatchNorm2d(256), nn.LeakyReLU(0.2, inplace=True), nn.Conv2d(256, 1, 4, 1, bias=False), ) def forward(self, x): return self.layers(x).view(-1, ) class Generator_64(nn.Module): def __init__(self): super(Generator_64, self).__init__() self.layers = nn.Sequential( nn.ConvTranspose2d(100, 512, 4, 1, bias=False), nn.BatchNorm2d(512), nn.ReLU(inplace=True), nn.ConvTranspose2d(512, 256, 4, 2, padding=1, bias=False), nn.BatchNorm2d(256), nn.ReLU(inplace=True), nn.ConvTranspose2d(256, 128, 4, 2, padding=1, bias=False), nn.BatchNorm2d(128), nn.ReLU(inplace=True), nn.ConvTranspose2d(128, 64, 4, 2, padding=1, bias=False), nn.BatchNorm2d(64), nn.ReLU(inplace=True), nn.ConvTranspose2d(64, 64, 3, 1, padding=1, bias=False), nn.BatchNorm2d(64), nn.ReLU(inplace=True), nn.ConvTranspose2d(64, 3, 4, 2, padding=1, bias=False), nn.Tanh(), ) def forward(self, z): z = z.view(z.size(0), z.size(1), 1, 1) return self.layers(z) class Discriminator_64(nn.Module): def __init__(self): super(Discriminator_64, self).__init__() self.layers = nn.Sequential( nn.Conv2d(3, 64, 4, 2, padding=1, bias=False), nn.BatchNorm2d(64), nn.LeakyReLU(0.2, inplace=True), nn.Conv2d(64, 64, 3, 1, padding=1, bias=False), nn.BatchNorm2d(64), nn.LeakyReLU(0.2, inplace=True), nn.Conv2d(64, 128, 4, 2, padding=1, bias=False), nn.BatchNorm2d(128), nn.LeakyReLU(0.2, inplace=True), nn.Conv2d(128, 256, 4, 2, padding=1, bias=False), nn.BatchNorm2d(256), nn.LeakyReLU(0.2, inplace=True), nn.Conv2d(256, 512, 4, 2, padding=1, bias=False), nn.BatchNorm2d(512), nn.LeakyReLU(0.2, inplace=True), nn.Conv2d(512, 1, 4, 1, bias=False), ) def forward(self, x): return self.layers(x).view(-1, ) class Generator_96(nn.Module): def __init__(self): super(Generator_96, self).__init__() self.layers = nn.Sequential( nn.ConvTranspose2d(100, 512, 6, 1, bias=False), nn.BatchNorm2d(512), nn.ReLU(inplace=True), nn.ConvTranspose2d(512, 256, 4, 2, padding=1, bias=False), nn.BatchNorm2d(256), nn.ReLU(inplace=True), nn.ConvTranspose2d(256, 128, 4, 2, padding=1, bias=False), nn.BatchNorm2d(128), nn.ReLU(inplace=True), nn.ConvTranspose2d(128, 64, 4, 2, padding=1, bias=False), nn.BatchNorm2d(64), nn.ReLU(inplace=True), nn.ConvTranspose2d(64, 64, 3, 1, padding=1, bias=False), nn.BatchNorm2d(64), nn.ReLU(inplace=True), nn.ConvTranspose2d(64, 3, 4, 2, padding=1, bias=False), nn.Tanh(), ) def forward(self, z): z = z.view(z.size(0), z.size(1), 1, 1) return self.layers(z) class Discriminator_96(nn.Module): def __init__(self): super(Discriminator_96, self).__init__() self.layers = nn.Sequential( nn.Conv2d(3, 64, 4, 2, padding=1, bias=False), nn.BatchNorm2d(64), nn.LeakyReLU(0.2, inplace=True), nn.Conv2d(64, 64, 3, 1, padding=1, bias=False), nn.BatchNorm2d(64), nn.LeakyReLU(0.2, inplace=True), nn.Conv2d(64, 128, 4, 2, padding=1, bias=False), nn.BatchNorm2d(128), nn.LeakyReLU(0.2, inplace=True), nn.Conv2d(128, 256, 4, 2, padding=1, bias=False), nn.BatchNorm2d(256), nn.LeakyReLU(0.2, inplace=True), nn.Conv2d(256, 512, 4, 2, padding=1, bias=False), nn.BatchNorm2d(512), nn.LeakyReLU(0.2, inplace=True), nn.Conv2d(512, 1, 6, 1, bias=False), ) def forward(self, x): return self.layers(x).view(-1, ) class GAN(): def __init__(self, args): self.device = args.device self.mode = args.mode if args.img_size == 32: self.netG = Generator_32() self.netD = Discriminator_32() if args.img_size == 64: self.netG = Generator_64() self.netD = Discriminator_64() if args.img_size == 96: self.netG = Generator_96() self.netD = Discriminator_96() self.netG.to(self.device) self.netD.to(self.device) self.optimG = None if hasattr(args, 'g_lr'): self.optimG = optim.Adam(self.netG.parameters(), lr=args.g_lr, betas=args.g_betas) self.optimD = None if hasattr(args, 'd_lr'): self.optimD = optim.Adam(self.netD.parameters(), lr=args.d_lr, betas=args.d_betas) self.vardict = { 'netG': self.netG, 'netD': self.netD, 'optimG': self.optimG, 'optimD': self.optimD } print('netG') summary(self.netG, (args.z_dim, ), use_gpu=args.gpu) print('netD') summary(self.netD, (3, args.img_size, args.img_size), use_gpu=args.gpu) def init(self, init_fn): self.netG.apply(init_fn) self.netD.apply(init_fn) def trainG(self, x_real, z): x_fake = self.netG(z) d_real = self.netD(x_real) d_fake = self.netD(x_fake) errG = {} if self.mode == 'mmgan': g_loss = -F.binary_cross_entropy_with_logits(d_fake, torch.zeros_like(d_fake).to(self.device)) errG['g_loss'] = g_loss.item() if self.mode == 'nsgan': g_loss = F.binary_cross_entropy_with_logits(d_fake, torch.ones_like(d_fake).to(self.device)) errG['g_loss'] = g_loss.item() if self.mode == 'wgan': g_loss = -d_fake.mean() errG['g_loss'] = g_loss.item() if self.mode == 'lsgan': # g_loss = 0.5 * F.mse_loss(d_fake, torch.ones_like(d_fake).to(self.device)) g_loss = F.mse_loss(d_fake, torch.ones_like(d_fake).to(self.device)) errG['g_loss'] = g_loss.item() if self.mode == 'wgan-gp': g_loss = -d_fake.mean() errG['g_loss'] = g_loss.item() if self.mode == 'lsgan-gp': g_loss = F.mse_loss(d_fake, torch.ones_like(d_fake).to(self.device)) errG['g_loss'] = g_loss.item() if self.mode == 'dragan': g_loss = F.binary_cross_entropy_with_logits(d_fake, torch.ones_like(d_fake).to(self.device)) errG['g_loss'] = g_loss.item() if self.mode == 'gan-qp-l1': g_loss = (d_real - d_fake).mean() errG['g_loss'] = g_loss.item() if self.mode == 'gan-qp-l2': g_loss = (d_real - d_fake).mean() errG['g_loss'] = g_loss.item() if self.mode == 'rsgan': g_loss = F.binary_cross_entropy_with_logits(d_fake-d_real, torch.ones_like(d_fake).to(self.device)) errG['g_loss'] = g_loss.item() self.optimG.zero_grad() g_loss.backward() self.optimG.step() return errG def trainD(self, x_real, z): if self.mode == 'wgan': clip_weights(self.netD, 0.01) x_fake = self.netG(z).detach() d_real = self.netD(x_real) d_fake = self.netD(x_fake) errD = {} if self.mode == 'mmgan': d_loss_real = F.binary_cross_entropy_with_logits(d_real, torch.ones_like(d_real).to(self.device)) d_loss_fake = F.binary_cross_entropy_with_logits(d_fake, torch.zeros_like(d_fake).to(self.device)) d_loss = d_loss_real + d_loss_fake errD['d_loss_real'] = d_loss_real.item() errD['d_loss_fake'] = d_loss_fake.item() errD['d_loss'] = d_loss.item() if self.mode == 'nsgan': d_loss_real = F.binary_cross_entropy_with_logits(d_real, torch.ones_like(d_real).to(self.device)) d_loss_fake = F.binary_cross_entropy_with_logits(d_fake, torch.zeros_like(d_fake).to(self.device)) d_loss = d_loss_real + d_loss_fake errD['d_loss_real'] = d_loss_real.item() errD['d_loss_fake'] = d_loss_fake.item() errD['d_loss'] = d_loss.item() if self.mode == 'wgan': d_loss_real = d_real.mean() d_loss_fake = d_fake.mean() wd = d_loss_real - d_loss_fake d_loss = -wd errD['d_loss_real'] = d_loss_real.item() errD['d_loss_fake'] = d_loss_fake.item() errD['d_loss'] = d_loss.item() if self.mode == 'lsgan': d_loss_real = F.mse_loss(d_real, torch.ones_like(d_real).to(self.device)) d_loss_fake = F.mse_loss(d_fake, torch.zeros_like(d_fake).to(self.device)) # d_loss = 0.5 * (d_loss_real + d_loss_fake) d_loss = d_loss_real + d_loss_fake errD['d_loss_real'] = d_loss_real.item() errD['d_loss_fake'] = d_loss_fake.item() errD['d_loss'] = d_loss.item() if self.mode == 'wgan-gp': d_loss_real = d_real.mean() d_loss_fake = d_fake.mean() wd = d_loss_real - d_loss_fake d_loss = -wd d_gp = gradient_penalty(self.netD, self.device, x_real, x_fake) d_loss = d_loss + 10 * d_gp errD['d_loss_real'] = d_loss_real.item() errD['d_loss_fake'] = d_loss_fake.item() errD['d_gp'] = d_loss.item() errD['d_loss'] = d_loss.item() if self.mode == 'lsgan-gp': d_loss_real = F.mse_loss(d_real, torch.ones_like(d_real).to(self.device)) d_loss_fake = F.mse_loss(d_fake, torch.zeros_like(d_fake).to(self.device)) d_gp = gradient_penalty(self.netD, self.device, x_real, 'lsgan-gp') d_loss = d_loss_real + d_loss_fake + 150 * d_gp errD['d_loss_real'] = d_loss_real.item() errD['d_loss_fake'] = d_loss_fake.item() errD['d_gp'] = d_loss.item() errD['d_loss'] = d_loss.item() if self.mode == 'dragan': d_loss_real = F.binary_cross_entropy_with_logits(d_real, torch.ones_like(d_real).to(self.device)) d_loss_fake = F.binary_cross_entropy_with_logits(d_fake, torch.zeros_like(d_fake).to(self.device)) d_gp = gradient_penalty(self.netD, self.device, x_real, 'dragan') d_loss = d_loss_real + d_loss_fake errD['d_loss_real'] = d_loss_real.item() errD['d_loss_fake'] = d_loss_fake.item() errD['d_gp'] = d_loss.item() errD['d_loss'] = d_loss.item() if self.mode == 'gan-qp-l1': d_loss_ = d_real - d_fake d_norm = 10 * (x_real - x_fake).abs().view(x_real.size(0), -1).mean(dim=1, keepdim=True) d_loss = (-d_loss_ + 0.5 * d_loss_**2 / d_norm).mean() errD['mean d_loss_'] = d_loss_.mean().item() errD['mean d_norm'] = d_norm.mean().item() errD['d_loss'] = d_loss.item() if self.mode == 'gan-qp-l2': d_loss_ = d_real - d_fake d_norm = 10 * (x_real - x_fake).pow(2).view(x_real.size(0), -1).mean(dim=1, keepdim=True).sqrt() d_loss = (-d_loss_ + 0.5 * d_loss_**2 / d_norm).mean() errD['mean d_loss_'] = d_loss_.mean().item() errD['mean d_norm'] = d_norm.mean().item() errD['d_loss'] = d_loss.item() if self.mode == 'rsgan': d_loss = F.binary_cross_entropy_with_logits(d_real-d_fake, torch.ones_like(d_real).to(self.device)) errD['d_loss'] = d_loss.item() self.optimD.zero_grad() d_loss.backward() self.optimD.step() return errD def save_old(self, file, options=['netG', 'netD', 'optimG', 'optimD']): states = {} for name in options: states[name] = self.vardict[name].state_dict() torch.save(states, file) def load_old(self, file): states = torch.load(file) for name in states: if self.vardict[name] is not None: self.vardict[name].load_state_dict(states[name]) def save(self, file, options=['netG', 'netD', 'optimG', 'optimD'], data=None): checkpoint = { 'weights': {}, 'data': data } for name in options: checkpoint['weights'][name] = self.vardict[name].state_dict() torch.save(checkpoint, file) def load(self, file): checkpoint = torch.load(file) for name in checkpoint['weights']: if self.vardict[name] is not None: self.vardict[name].load_state_dict(checkpoint['weights'][name]) return checkpoint['data'] def train(self): self.netG.train() self.netD.train() def eval(self): self.netG.eval() self.netD.eval()
41.198454
111
0.551267
2,246
15,985
3.711042
0.0748
0.062987
0.040792
0.044631
0.769526
0.764487
0.746251
0.706419
0.682064
0.676065
0
0.047795
0.304973
15,985
388
112
41.198454
0.70243
0.011511
0
0.608939
0
0
0.038109
0
0
0
0
0
0
1
0.069832
false
0
0.01676
0.00838
0.136872
0.005587
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
5ad6985f9fad733558cb9b3596fffe0331ab2f5c
100
py
Python
util/error.py
DarkNinja3141/Mover-Bot
0045ab2f143824ad5a914ed2b3817c17d1602e39
[ "Naumen", "Condor-1.1", "MS-PL" ]
null
null
null
util/error.py
DarkNinja3141/Mover-Bot
0045ab2f143824ad5a914ed2b3817c17d1602e39
[ "Naumen", "Condor-1.1", "MS-PL" ]
null
null
null
util/error.py
DarkNinja3141/Mover-Bot
0045ab2f143824ad5a914ed2b3817c17d1602e39
[ "Naumen", "Condor-1.1", "MS-PL" ]
null
null
null
from dataclasses import dataclass @dataclass class CommandUseFailure(Exception): message: str
14.285714
35
0.8
10
100
8
0.9
0
0
0
0
0
0
0
0
0
0
0
0.15
100
6
36
16.666667
0.941176
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
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
0
1
0
0
0
1
0
0
4
5ada9d6a46c8df470ae346f152310c66b63194a3
749
py
Python
tests/kyu_8_tests/test_regex_count_lowercase_letters.py
the-zebulan/CodeWars
1eafd1247d60955a5dfb63e4882e8ce86019f43a
[ "MIT" ]
40
2016-03-09T12:26:20.000Z
2022-03-23T08:44:51.000Z
tests/kyu_8_tests/test_regex_count_lowercase_letters.py
akalynych/CodeWars
1eafd1247d60955a5dfb63e4882e8ce86019f43a
[ "MIT" ]
null
null
null
tests/kyu_8_tests/test_regex_count_lowercase_letters.py
akalynych/CodeWars
1eafd1247d60955a5dfb63e4882e8ce86019f43a
[ "MIT" ]
36
2016-11-07T19:59:58.000Z
2022-03-31T11:18:27.000Z
import unittest from katas.kyu_8.regex_count_lowercase_letters import lowercase_count class LowercaseCountTestCase(unittest.TestCase): def test_equals(self): self.assertEqual(lowercase_count('abc'), 3) def test_equals_2(self): self.assertEqual(lowercase_count('abcABC123'), 3) def test_equals_3(self): self.assertEqual(lowercase_count( 'abcABC123!@#$%^&*()_-+=}{[]|\':;?/>.<,~'), 3) def test_equals_4(self): self.assertEqual(lowercase_count(''), 0) def test_equals_5(self): self.assertEqual(lowercase_count( 'ABC123!@#$%^&*()_-+=}{[]|\':;?/>.<,~'), 0) def test_equals_6(self): self.assertEqual(lowercase_count('abcdefghijklmnopqrstuvwxyz'), 26)
28.807692
75
0.64219
81
749
5.641975
0.358025
0.214442
0.170678
0.367615
0.533917
0.245077
0.245077
0.245077
0.245077
0.245077
0
0.036007
0.184246
749
25
76
29.96
0.711948
0
0
0.117647
0
0
0.124166
0.108144
0
0
0
0
0.352941
1
0.352941
false
0
0.117647
0
0.529412
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
5171d205cf3992f70c3187eea595504215560ef2
475
py
Python
dygraph/ppdet/modeling/__init__.py
heavengate/PaddleDetection
84e79e8760ba2ef7fbc3972d865316af9aade014
[ "Apache-2.0" ]
7
2021-03-18T12:13:20.000Z
2021-05-13T12:03:52.000Z
dygraph/ppdet/modeling/__init__.py
heavengate/PaddleDetection
84e79e8760ba2ef7fbc3972d865316af9aade014
[ "Apache-2.0" ]
null
null
null
dygraph/ppdet/modeling/__init__.py
heavengate/PaddleDetection
84e79e8760ba2ef7fbc3972d865316af9aade014
[ "Apache-2.0" ]
null
null
null
from . import ops from . import backbones from . import necks from . import proposal_generator from . import heads from . import losses from . import architectures from . import post_process from . import layers from . import utils from .ops import * from .backbones import * from .necks import * from .proposal_generator import * from .heads import * from .losses import * from .architectures import * from .post_process import * from .layers import * from .utils import *
21.590909
33
0.766316
64
475
5.625
0.21875
0.277778
0
0
0
0
0
0
0
0
0
0
0.170526
475
21
34
22.619048
0.913706
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
519fb45ebcecac91b5c0a1046de5d814537c2681
168
py
Python
src/neuralspace_examples/dataset_formatters/telungu.py
Neural-Space/neuralspace-examples
ca459b111f47cab8697fca9d82d2cd4f609f86b1
[ "Apache-2.0" ]
null
null
null
src/neuralspace_examples/dataset_formatters/telungu.py
Neural-Space/neuralspace-examples
ca459b111f47cab8697fca9d82d2cd4f609f86b1
[ "Apache-2.0" ]
1
2022-02-14T07:37:36.000Z
2022-02-14T07:37:36.000Z
src/neuralspace_examples/dataset_formatters/telungu.py
Neural-Space/neuralspace-examples
ca459b111f47cab8697fca9d82d2cd4f609f86b1
[ "Apache-2.0" ]
null
null
null
import pandas as pd df = pd.read_csv(r'/Users/prakashramesh/others/dataset_for_text_classification/dataset/telugu_news/train.csv', encoding='UTF-8') print(df['body'])
33.6
128
0.791667
27
168
4.740741
0.851852
0
0
0
0
0
0
0
0
0
0
0.006329
0.059524
168
5
129
33.6
0.803797
0
0
0
0
0
0.579882
0.526627
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
51b2f5272d3f10bb366c84e253ae144394c882b1
278
py
Python
examples/python/cpu/numpy/example_16.py
kant/ocean-tensor-package
fb3fcff8bba7f4ef6cd8b8d02f0e1be1258da02d
[ "Apache-2.0" ]
27
2018-08-16T21:32:49.000Z
2021-11-30T10:31:08.000Z
examples/python/cpu/numpy/example_16.py
kant/ocean-tensor-package
fb3fcff8bba7f4ef6cd8b8d02f0e1be1258da02d
[ "Apache-2.0" ]
null
null
null
examples/python/cpu/numpy/example_16.py
kant/ocean-tensor-package
fb3fcff8bba7f4ef6cd8b8d02f0e1be1258da02d
[ "Apache-2.0" ]
13
2018-08-17T17:33:16.000Z
2021-11-30T10:31:09.000Z
import pyOcean_cpu as ocean import numpy as np import pyOceanNumpy t = np.asarray([[1,2],[3,4],[5,6]],np.int32) print(t) print("====== ocean.asTensor(t) ======") a = ocean.asTensor(t); print(a) print("====== ocean.asTensor([t,a]) ======") b = ocean.asTensor([t,a]) print(b)
17.375
44
0.604317
46
278
3.630435
0.456522
0.311377
0.335329
0.269461
0.239521
0
0
0
0
0
0
0.03252
0.115108
278
15
45
18.533333
0.646341
0
0
0
0
0
0.238267
0.075812
0
0
0
0
0
1
0
false
0
0.272727
0
0.272727
0.454545
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
0
0
0
0
0
0
0
1
0
4
51e0b92b573774f8fb118b386fdf576fa1305782
1,377
py
Python
backend/src/common/migrations/0007_auto_20190922_0356.py
pavan168/IncidentManagement
7fbf111922a735d4cbe75969159858d6605a1e0b
[ "MIT" ]
17
2019-01-16T13:10:25.000Z
2021-02-07T02:04:11.000Z
backend/src/common/migrations/0007_auto_20190922_0356.py
pavan168/IncidentManagement
7fbf111922a735d4cbe75969159858d6605a1e0b
[ "MIT" ]
360
2019-02-13T15:24:44.000Z
2022-02-26T17:42:33.000Z
backend/src/common/migrations/0007_auto_20190922_0356.py
mohamednizar/request-management
a88a2ce35a7a1a98630ffd14c1a31a5173b662c8
[ "MIT" ]
46
2019-01-16T13:10:25.000Z
2021-06-23T02:44:18.000Z
# Generated by Django 2.2.1 on 2019-09-22 03:56 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('common', '0006_auto_20190921_1838'), ] operations = [ migrations.AlterField( model_name='district', name='code', field=models.CharField(blank=True, max_length=36, null=True, unique=True), ), migrations.AlterField( model_name='dsdivision', name='code', field=models.CharField(blank=True, max_length=36, null=True, unique=True), ), migrations.AlterField( model_name='gndivision', name='code', field=models.CharField(blank=True, max_length=36, null=True, unique=True), ), migrations.AlterField( model_name='policestation', name='code', field=models.CharField(blank=True, max_length=36, null=True, unique=True), ), migrations.AlterField( model_name='pollingstation', name='code', field=models.CharField(blank=True, max_length=36, null=True, unique=True), ), migrations.AlterField( model_name='ward', name='code', field=models.CharField(blank=True, max_length=36, null=True, unique=True), ), ]
31.295455
86
0.57589
143
1,377
5.440559
0.307692
0.154242
0.192802
0.22365
0.695373
0.695373
0.695373
0.695373
0.695373
0.695373
0
0.044652
0.300654
1,377
43
87
32.023256
0.76324
0.03268
0
0.648649
1
0
0.084211
0.017293
0
0
0
0
0
1
0
false
0
0.027027
0
0.108108
0
0
0
0
null
0
1
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
51f49434b72bf30b02042d658c8777e8e03fdea0
66
py
Python
homebrain/agents/devicemanager/__init__.py
ErikBjare/Homebrain
7e4dcc9d0e5f5ef6bde3d2cf31639527166ab124
[ "MIT" ]
1
2015-12-03T18:42:54.000Z
2015-12-03T18:42:54.000Z
homebrain/agents/devicemanager/__init__.py
ErikBjare/Homebrain
7e4dcc9d0e5f5ef6bde3d2cf31639527166ab124
[ "MIT" ]
14
2015-12-02T22:21:12.000Z
2019-11-06T10:26:08.000Z
homebrain/agents/devicemanager/__init__.py
ErikBjare/Homebrain
7e4dcc9d0e5f5ef6bde3d2cf31639527166ab124
[ "MIT" ]
null
null
null
# Import the agent class from .devicemanager import DeviceManager
22
40
0.833333
8
66
6.875
0.75
0
0
0
0
0
0
0
0
0
0
0
0.136364
66
2
41
33
0.964912
0.333333
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
51fa491c02ed2560028d9f917a56e03f4b45a33d
108
py
Python
sphericalharmonics/__init__.py
Magicdietz/MixedCrystalSignature
8423c0cfac24270333f7ea29199b9213ece14f7e
[ "MIT" ]
null
null
null
sphericalharmonics/__init__.py
Magicdietz/MixedCrystalSignature
8423c0cfac24270333f7ea29199b9213ece14f7e
[ "MIT" ]
null
null
null
sphericalharmonics/__init__.py
Magicdietz/MixedCrystalSignature
8423c0cfac24270333f7ea29199b9213ece14f7e
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Aug 17 09:03:21 2018 @author: dietz """
12
35
0.592593
18
108
3.555556
1
0
0
0
0
0
0
0
0
0
0
0.159091
0.185185
108
8
36
13.5
0.568182
0.87963
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
cfb17afe5982db64e963a9649bb04bf96f4961c8
281
py
Python
Utilities/Basic.py
WolVesz/Analysis
a67520f60759b2f945cfb8e36c517a2d63064d1a
[ "MIT" ]
null
null
null
Utilities/Basic.py
WolVesz/Analysis
a67520f60759b2f945cfb8e36c517a2d63064d1a
[ "MIT" ]
null
null
null
Utilities/Basic.py
WolVesz/Analysis
a67520f60759b2f945cfb8e36c517a2d63064d1a
[ "MIT" ]
null
null
null
import numbers import collections import numpy as np import pandas as pd from sklearn.datasets import make_blobs def isCollection(item): return isinstance(item, (collections.Sequence, np.ndarray)) def isNumeric(val): return isinstance(val, numbers.Number)
20.071429
64
0.747331
36
281
5.805556
0.638889
0.15311
0
0
0
0
0
0
0
0
0
0
0.185053
281
13
65
21.615385
0.912664
0
0
0
0
0
0
0
0
0
0
0
0
1
0.222222
false
0
0.555556
0.222222
1
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
0
0
1
1
1
0
0
4
cfb4719f447e17a8d1313518790eae0166d4fb81
116
py
Python
moe/library/__init__.py
jtpavlock/moe
6f053c8c53f92686013657bda676b00f97edd230
[ "MIT" ]
14
2021-09-04T11:42:18.000Z
2022-02-04T05:11:46.000Z
moe/library/__init__.py
jtpavlock/Moe
6f053c8c53f92686013657bda676b00f97edd230
[ "MIT" ]
56
2021-05-26T00:00:46.000Z
2021-08-08T17:14:31.000Z
moe/library/__init__.py
jtpavlock/moe
6f053c8c53f92686013657bda676b00f97edd230
[ "MIT" ]
1
2021-07-22T21:55:21.000Z
2021-07-22T21:55:21.000Z
"""Moe database/library functionality.""" from sqlalchemy.orm import declarative_base SABase = declarative_base()
19.333333
43
0.793103
13
116
6.923077
0.846154
0.333333
0
0
0
0
0
0
0
0
0
0
0.103448
116
5
44
23.2
0.865385
0.301724
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
cfde5f2a32116285ee0b2cc1ca7cd806d9b55de4
403
py
Python
model/Logs.py
Videl/absentees-blackboard
35658c14253340c34ef7dac98322306c7c555df1
[ "MIT" ]
null
null
null
model/Logs.py
Videl/absentees-blackboard
35658c14253340c34ef7dac98322306c7c555df1
[ "MIT" ]
null
null
null
model/Logs.py
Videl/absentees-blackboard
35658c14253340c34ef7dac98322306c7c555df1
[ "MIT" ]
null
null
null
__author__ = 'Mael Beuget, Pierre Monnin & Thibaut Smith' from google.appengine.ext import ndb class Logs(ndb.Model): date_time = ndb.DateTimeProperty(required=True) category = ndb.StringProperty(required=True) author = ndb.StringProperty(required=True) description = ndb.StringProperty(required=True) def get_all_logs(): return list(Logs.query().order(-Logs.date_time).fetch())
28.785714
60
0.746898
51
403
5.745098
0.627451
0.163823
0.255973
0.296928
0
0
0
0
0
0
0
0
0.136476
403
14
60
28.785714
0.841954
0
0
0
0
0
0.10396
0
0
0
0
0
0
1
0.111111
false
0
0.111111
0.111111
0.888889
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
4
cff17ace77aaf8d3331a873c6d25266183317512
152
py
Python
backend/underbudget/schemas/common.py
vimofthevine/underbudget4
c90eecf9879f7ce57c77a68b3f83b1d76c4451af
[ "MIT" ]
null
null
null
backend/underbudget/schemas/common.py
vimofthevine/underbudget4
c90eecf9879f7ce57c77a68b3f83b1d76c4451af
[ "MIT" ]
45
2019-12-23T23:45:10.000Z
2022-03-31T05:01:22.000Z
backend/underbudget/schemas/common.py
vimofthevine/underbudget4
c90eecf9879f7ce57c77a68b3f83b1d76c4451af
[ "MIT" ]
1
2020-12-26T17:16:58.000Z
2020-12-26T17:16:58.000Z
""" Generic common schemas """ from marshmallow import Schema, fields class IdSchema(Schema): """ Simple ID schema """ id = fields.Integer()
16.888889
38
0.664474
17
152
5.941176
0.764706
0
0
0
0
0
0
0
0
0
0
0
0.203947
152
8
39
19
0.834711
0.263158
0
0
0
0
0
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
cff48a7e56c3963ebd04e885c2728fcedb9928d5
50
py
Python
application/management/commands/__init__.py
BaggerFast/Simple_votings
843769fa6fd2c04feb542e6b301b7b4810260d4e
[ "MIT" ]
null
null
null
application/management/commands/__init__.py
BaggerFast/Simple_votings
843769fa6fd2c04feb542e6b301b7b4810260d4e
[ "MIT" ]
null
null
null
application/management/commands/__init__.py
BaggerFast/Simple_votings
843769fa6fd2c04feb542e6b301b7b4810260d4e
[ "MIT" ]
null
null
null
""" Custom commands for django terminal usage """
12.5
41
0.72
6
50
6
1
0
0
0
0
0
0
0
0
0
0
0
0.16
50
3
42
16.666667
0.857143
0.82
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
5cd6bc277d010720e207779237708e7e1fb573da
514
py
Python
tests.py
jcol27/rFactor2-championship-setup
a6c1ffe61bde361902adc3fc8ac8ebe05f8ccfd3
[ "MIT" ]
null
null
null
tests.py
jcol27/rFactor2-championship-setup
a6c1ffe61bde361902adc3fc8ac8ebe05f8ccfd3
[ "MIT" ]
null
null
null
tests.py
jcol27/rFactor2-championship-setup
a6c1ffe61bde361902adc3fc8ac8ebe05f8ccfd3
[ "MIT" ]
null
null
null
import unittest import unpack import ai_setup class Test(unittest.TestCase): def test_read_json(self): data = unpack.read_json() print(data) self.AssertTrue(1==1) def test_read_csv(self): pass def test_read_txt(self): pass def test_get_models(self): pass def test_get_lastest_versions(self): pass def test_unpack_mas(self): pass def test_extract_vehicle_info(self): pass def test_get_vehicles(self): pass def test_create_dirs(self): pass def create_rcd_file(self): pass
13.891892
37
0.745136
82
514
4.378049
0.390244
0.175487
0.245125
0.292479
0.150418
0
0
0
0
0
0
0.004673
0.167315
514
37
38
13.891892
0.834112
0
0
0.346154
0
0
0
0
0
0
0
0
0.038462
1
0.384615
false
0.346154
0.115385
0
0.538462
0.038462
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
4
7a24ce2f5e7578164d23afa1244ebd05dfd69fc8
54
py
Python
tests/__init__.py
sfauch1/thebuzz-playlist-scraper
10e9d57bec9f5d444e7036efac4f86beec92ddd7
[ "MIT" ]
null
null
null
tests/__init__.py
sfauch1/thebuzz-playlist-scraper
10e9d57bec9f5d444e7036efac4f86beec92ddd7
[ "MIT" ]
458
2020-07-12T10:10:25.000Z
2022-03-31T23:39:15.000Z
tests/__init__.py
sfauch1/thebuzz-playlist-scraper
10e9d57bec9f5d444e7036efac4f86beec92ddd7
[ "MIT" ]
null
null
null
"""Unit test package for thebuzz_playlist_scraper."""
27
53
0.777778
7
54
5.714286
1
0
0
0
0
0
0
0
0
0
0
0
0.092593
54
1
54
54
0.816327
0.87037
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
7a37773098aade0105ff903f0deeb40e9676be9e
104
bzl
Python
tools/build_defs/fb_python_test.bzl
tjzhou23/profilo
baeea045a00d2403cc3f45778bf9cb69d33801da
[ "Apache-2.0" ]
1,466
2018-03-13T17:13:49.000Z
2022-03-31T07:08:51.000Z
tools/build_defs/fb_python_test.bzl
tjzhou23/profilo
baeea045a00d2403cc3f45778bf9cb69d33801da
[ "Apache-2.0" ]
101
2018-03-13T18:43:34.000Z
2022-03-15T00:44:52.000Z
tools/build_defs/fb_python_test.bzl
tjzhou23/profilo
baeea045a00d2403cc3f45778bf9cb69d33801da
[ "Apache-2.0" ]
160
2018-03-13T18:08:21.000Z
2022-03-14T00:46:34.000Z
def fb_python_test(name, **kwargs): native.python_test( name = name, **kwargs )
17.333333
35
0.557692
12
104
4.583333
0.583333
0.363636
0.509091
0
0
0
0
0
0
0
0
0
0.317308
104
5
36
20.8
0.774648
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0
0.2
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
7a49006fce158d09955b331107bff75c0e5fdf90
150
py
Python
setup.py
openvax/phipkit
267a9b0bb3b79b3ff416e07ce390e43b84a02be4
[ "Apache-2.0" ]
2
2021-03-01T20:09:20.000Z
2021-03-02T05:52:34.000Z
setup.py
timodonnell/yabul
d2ad2fbf934b375f9ef2b6f2d9c2ab9c157260d2
[ "Apache-2.0" ]
null
null
null
setup.py
timodonnell/yabul
d2ad2fbf934b375f9ef2b6f2d9c2ab9c157260d2
[ "Apache-2.0" ]
null
null
null
# Trivial setup.py for backward compatability. # Configuration is in setup.cfg. from setuptools import setup if __name__ == "__main__": setup()
18.75
46
0.74
19
150
5.421053
0.842105
0
0
0
0
0
0
0
0
0
0
0
0.173333
150
7
47
21.428571
0.830645
0.5
0
0
0
0
0.111111
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
7a7888d11cd23d02caf01fbb0b3739e357bfa099
268
py
Python
api/views/speaker_views.py
williamsbdev/code-camp-api
02bb76d7a7cabfc6311e855348afd74baee01305
[ "MIT" ]
1
2015-12-21T02:20:40.000Z
2015-12-21T02:20:40.000Z
api/views/speaker_views.py
williamsbdev/code-camp-api
02bb76d7a7cabfc6311e855348afd74baee01305
[ "MIT" ]
2
2015-05-31T01:54:35.000Z
2015-07-22T02:17:02.000Z
api/views/speaker_views.py
williamsbdev/code-camp-api
02bb76d7a7cabfc6311e855348afd74baee01305
[ "MIT" ]
null
null
null
from rest_framework import generics from api.models.speaker import Speaker from api.serializers.speaker_serializer import SpeakerSerializer class SpeakerList(generics.ListCreateAPIView): queryset = Speaker.objects.all() serializer_class = SpeakerSerializer
26.8
64
0.83209
29
268
7.586207
0.586207
0.063636
0
0
0
0
0
0
0
0
0
0
0.115672
268
9
65
29.777778
0.92827
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
7a89d6c43b1899f5516c8a64304959f0dad6994b
3,973
py
Python
test/service/section/input/test_tag.py
HansBug/pji
449d171cea0c03f4c302da886988f36f70e34ee6
[ "Apache-2.0" ]
null
null
null
test/service/section/input/test_tag.py
HansBug/pji
449d171cea0c03f4c302da886988f36f70e34ee6
[ "Apache-2.0" ]
null
null
null
test/service/section/input/test_tag.py
HansBug/pji
449d171cea0c03f4c302da886988f36f70e34ee6
[ "Apache-2.0" ]
null
null
null
import os import tempfile import pytest from pysyslimit import FilePermission, SystemUser, SystemGroup from pji.service.section.input.tag import TagFileInputTemplate from pji.utils import FilePool @pytest.mark.unittest class TestServiceSectionInputTag: def test_simple(self): tt = TagFileInputTemplate( tag='tag_x', local='./r.md', privilege='r--', ) assert tt.tag == 'tag_x' assert tt.local == './r.md' assert tt.privilege == FilePermission.loads('400') def test_repr(self): tt = TagFileInputTemplate( tag='tag_x', local='./r.md', privilege='r--', ) assert repr(tt) == "<TagFileInputTemplate tag: 'tag_x', local: './r.md', privilege: 'r--------'>" def test_call_simple(self): tt = TagFileInputTemplate( tag='tag_x', local='./r.md', privilege='r--', ) with FilePool({'tag_x': 'README.md'}) as pool, \ tempfile.TemporaryDirectory() as td: fi = tt(workdir=td, pool=pool) assert fi.tag == 'tag_x' assert fi.local == os.path.normpath(os.path.join(td, 'r.md')) assert fi.privilege == FilePermission.loads('400') def test_call_with_env(self): tt = TagFileInputTemplate( tag='tag_${T}_x', local='./${DIR}/r.md', privilege='r--', ) with FilePool({'tag_x': 'README.md'}) as pool, \ tempfile.TemporaryDirectory() as td: fi = tt(workdir=td, pool=pool, environ=dict(T='233', DIR='.')) assert fi.tag == 'tag_233_x' assert fi.local == os.path.normpath(os.path.join(td, 'r.md')) assert fi.privilege == FilePermission.loads('400') def test_call_invalid(self): tt = TagFileInputTemplate( tag='tag_${T}_x', local='./${DIR}/r.md', privilege='r--', ) with FilePool({'tag_x': 'README.md'}) as pool, \ tempfile.TemporaryDirectory() as td: with pytest.raises(KeyError): tt(workdir=td, pool=pool, environ=dict(T='123/s', DIR='.')) with pytest.raises(ValueError): tt(workdir=td, pool=pool, environ=dict(T='123', DIR='..')) def test_call_execute(self): tt = TagFileInputTemplate( tag='tag_x', local='./r.md', privilege='r--', ) with FilePool({'tag_x': 'README.md'}) as pool, \ tempfile.TemporaryDirectory() as td: fi = tt(workdir=td, pool=pool) fi() _target_path = os.path.normpath(os.path.join(td, 'r.md')) assert os.path.exists(_target_path) assert FilePermission.load_from_file(_target_path) == FilePermission.loads('400') with open('README.md', 'rb') as of, \ open(_target_path, 'rb') as tf: assert of.read() == tf.read() def test_call_execute_with_identification(self): tt = TagFileInputTemplate( tag='tag_x', local='./r.md', privilege='r--', identification='nobody', ) with FilePool({'tag_x': 'README.md'}) as pool, \ tempfile.TemporaryDirectory() as td: fi = tt(workdir=td, pool=pool) fi() _target_path = os.path.normpath(os.path.join(td, 'r.md')) assert os.path.exists(_target_path) assert FilePermission.load_from_file(_target_path) == FilePermission.loads('400') assert SystemUser.load_from_file(_target_path) == SystemUser.loads('nobody') assert SystemGroup.load_from_file(_target_path) == SystemGroup.loads('nogroup') with open('README.md', 'rb') as of, \ open(_target_path, 'rb') as tf: assert of.read() == tf.read()
33.957265
105
0.541908
447
3,973
4.677852
0.161074
0.024868
0.095648
0.107126
0.743185
0.722143
0.703969
0.703969
0.698231
0.66571
0
0.009868
0.311352
3,973
116
106
34.25
0.754386
0
0
0.621053
0
0
0.096652
0.005286
0
0
0
0
0.189474
1
0.073684
false
0
0.063158
0
0.147368
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
8fba6087799ca0a3cb64914929bfe4bf6ef2ae2f
1,478
py
Python
aerospike/tests/test_aerospike.py
brentm5/integrations-core
5cac8788c95d8820435ef9c5d32d6a5463cf491d
[ "BSD-3-Clause" ]
2
2019-05-28T03:48:29.000Z
2019-07-05T07:05:58.000Z
aerospike/tests/test_aerospike.py
brentm5/integrations-core
5cac8788c95d8820435ef9c5d32d6a5463cf491d
[ "BSD-3-Clause" ]
4
2019-07-03T02:53:19.000Z
2019-07-10T14:52:14.000Z
aerospike/tests/test_aerospike.py
brentm5/integrations-core
5cac8788c95d8820435ef9c5d32d6a5463cf491d
[ "BSD-3-Clause" ]
1
2020-01-15T16:58:51.000Z
2020-01-15T16:58:51.000Z
# (C) Datadog, Inc. 2019 # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) import pytest from datadog_checks.aerospike import AerospikeCheck @pytest.mark.usefixtures('dd_environment') def test_check(aggregator, instance): check = AerospikeCheck('aerospike', {}, [instance]) check.check(instance) # This hasn't been working # aggregator.assert_metric('aerospike.batch_error', 0) aggregator.assert_metric('aerospike.cluster_size') aggregator.assert_metric('aerospike.namespace.objects') aggregator.assert_metric('aerospike.namespace.hwm_breached') aggregator.assert_metric('aerospike.namespace.client_write_error', 0) aggregator.assert_metric('aerospike.namespace.client_write_success', 1) aggregator.assert_metric('aerospike.namespace.truncate_lut', 0) aggregator.assert_metric('aerospike.namespace.tombstones', 0) aggregator.assert_metric('aerospike.set.tombstones', 0) aggregator.assert_metric('aerospike.set.truncate_lut', 0) aggregator.assert_metric('aerospike.set.memory_data_bytes', 289) aggregator.assert_metric('aerospike.set.objects', 1, tags=['namespace:test', 'set:characters', 'tag:value']) aggregator.assert_metric( 'aerospike.set.stop_writes_count', 0, tags=['namespace:test', 'set:characters', 'tag:value'] ) aggregator.assert_service_check('aerospike.can_connect', check.OK) aggregator.assert_service_check('aerospike.cluster_up', check.OK)
43.470588
112
0.763194
178
1,478
6.140449
0.398876
0.219579
0.261665
0.36871
0.613907
0.403477
0.353156
0.098811
0.098811
0
0
0.012957
0.112314
1,478
33
113
44.787879
0.820122
0.120433
0
0
0
0
0.380216
0.289799
0
0
0
0
0.636364
1
0.045455
false
0
0.090909
0
0.136364
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
8fcdbfcd50bb7fdfb0803bd4562e609af5de298e
811
py
Python
algo/min_stack.py
calfzhou/lazy-lab
dcd67845e4bd1e0c82a05a89f53eec6912d870f8
[ "MIT" ]
null
null
null
algo/min_stack.py
calfzhou/lazy-lab
dcd67845e4bd1e0c82a05a89f53eec6912d870f8
[ "MIT" ]
null
null
null
algo/min_stack.py
calfzhou/lazy-lab
dcd67845e4bd1e0c82a05a89f53eec6912d870f8
[ "MIT" ]
null
null
null
class MinStack: def __init__(self): self._stack = [] def push(self, item): index = len(self._stack) if self._stack: min_item, min_index = self.min() if item >= min_item: index = min_index self._stack.append((item, index)) def pop(self): item, _ = self._stack.pop() return item def __len__(self): return len(self._stack) def __iter__(self): for item, _ in self._stack: yield item def __getitem__(self, i): return self._stack[i][0] def min(self): if len(self) > 0: _, min_index = self._stack[-1] return self._stack[min_index] else: return None def __repr__(self): return repr(self._stack)
21.918919
44
0.52651
98
811
3.94898
0.265306
0.255814
0.093023
0.087855
0
0
0
0
0
0
0
0.005837
0.366215
811
36
45
22.527778
0.747082
0
0
0
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0
0.107143
0.535714
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
8fe45e1fff74443689affba53f09428c1766361b
166
py
Python
client/util/html/tooling/list/UnorderedListElement.py
vincihb/stock-price-predictor
17f46bed7360817835a160ea4f1a6e057de4032d
[ "MIT" ]
null
null
null
client/util/html/tooling/list/UnorderedListElement.py
vincihb/stock-price-predictor
17f46bed7360817835a160ea4f1a6e057de4032d
[ "MIT" ]
1
2021-06-02T03:12:17.000Z
2021-06-02T03:12:17.000Z
client/util/html/tooling/list/UnorderedListElement.py
vincihb/stock-price-predictor
17f46bed7360817835a160ea4f1a6e057de4032d
[ "MIT" ]
null
null
null
from client.util.html.tooling.list.ListElement import ListElement class UnorderedListElement(ListElement): def __init__(self): super().__init__('ul')
18.444444
65
0.740964
18
166
6.388889
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.150602
166
8
66
20.75
0.815603
0
0
0
0
0
0.012195
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
8ffdc8452f6e5133bdb62a17d9be74d8ac563d50
675
py
Python
app/forms.py
luckyharryji/Plask
82508b48cb393a011641ac808cfea7323cd1bdfa
[ "MIT" ]
null
null
null
app/forms.py
luckyharryji/Plask
82508b48cb393a011641ac808cfea7323cd1bdfa
[ "MIT" ]
null
null
null
app/forms.py
luckyharryji/Plask
82508b48cb393a011641ac808cfea7323cd1bdfa
[ "MIT" ]
null
null
null
#coding=utf-8 from flask.ext.wtf import Form from wtforms import TextField from wtforms import PasswordField from wtforms.validators import Required from flask_wtf.html5 import EmailField import sys reload(sys) sys.setdefaultencoding('utf-8') class LoginForm(Form): username = TextField('Userame', validators = [Required()]) password = PasswordField('Password', validators = [Required()]) class RegisterForm(Form): username = TextField('Userame', validators = [Required()]) password = PasswordField('Password', validators = [Required()]) password_again = PasswordField('Password again', validators = [Required()]) mail = TextField('Mail', validators = [Required()])
32.142857
76
0.76
74
675
6.905405
0.364865
0.21135
0.152642
0.109589
0.363992
0.363992
0.363992
0.363992
0.363992
0.363992
0
0.005
0.111111
675
20
77
33.75
0.846667
0.017778
0
0.25
0
0
0.08006
0
0
0
0
0
0
1
0
false
0.25
0.375
0
0.875
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
0
0
1
1
0
1
0
0
4
89174ff3fc25baabfca3d00a168d8cd6089f4b9d
229
py
Python
tests/test_fixture.py
Shiti/h1st
0805452bda2453924663203b11f448e31525d596
[ "Apache-2.0" ]
null
null
null
tests/test_fixture.py
Shiti/h1st
0805452bda2453924663203b11f448e31525d596
[ "Apache-2.0" ]
null
null
null
tests/test_fixture.py
Shiti/h1st
0805452bda2453924663203b11f448e31525d596
[ "Apache-2.0" ]
null
null
null
import pytest from _pytest.monkeypatch import MonkeyPatch @pytest.fixture(scope="class") def mock_env_simple(): monkeypatch = MonkeyPatch() monkeypatch.setenv("H1ST_ENGINE", "h1st.engines.simple.SimpleExecutionEngine")
25.444444
82
0.786026
25
229
7.04
0.64
0.25
0
0
0
0
0
0
0
0
0
0.009756
0.104803
229
8
83
28.625
0.84878
0
0
0
0
0
0.248908
0.179039
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
64e63fa49b34a6b7f1487ebe178879b9f62abf3c
3,976
py
Python
tests/test_hitemp.py
mdhimes/repack
d5f476d3b62a65695de34fa8b66f03c76c6863d2
[ "MIT" ]
4
2017-08-25T06:27:25.000Z
2021-07-07T08:19:14.000Z
tests/test_hitemp.py
mdhimes/repack
d5f476d3b62a65695de34fa8b66f03c76c6863d2
[ "MIT" ]
1
2021-03-01T14:20:46.000Z
2021-03-01T14:20:46.000Z
tests/test_hitemp.py
mdhimes/repack
d5f476d3b62a65695de34fa8b66f03c76c6863d2
[ "MIT" ]
1
2021-02-26T17:25:31.000Z
2021-02-26T17:25:31.000Z
import os import subprocess ROOT = os.path.realpath(os.path.dirname(__file__) + '/..') + '/' os.chdir(ROOT+'tests') def test_hitemp_single_zip(capfd): subprocess.call('repack hitemp_repack_single_zip.cfg'.split()) capfd = capfd.readouterr() assert """Reading: 'data/02_03750-04000_HITEMP2010.zip'. Flagging lines at 500 K: Compression rate: 76.11%, 51,071/ 213,769 lines. Flagging lines at 700 K: Compression rate: 67.97%, 68,468/ 213,769 lines. Total compression rate: 66.26%, 72,118/ 213,769 lines. With a threshold strength factor of 0.01, kept a total of 72,118 line transitions out of 213,769 lines. Successfully rewriten hitran line-transition info into: 'CO2_hitran_2.5-2.6um_500-700K_lbl.dat' and 'CO2_hitran_2.5-2.6um_500-700K_continuum.dat'.""" in capfd.out def test_hitemp_single_unzip(capfd): # Unzip files before repacking: subprocess.call('unzip data/02_03750-04000_HITEMP2010.zip -d data/'.split()) subprocess.call('repack hitemp_repack_single_unzip.cfg'.split()) capfd = capfd.readouterr() assert """Reading: 'data/02_3750-4000_HITEMP2010.par'. Flagging lines at 500 K: Compression rate: 76.11%, 51,071/ 213,769 lines. Flagging lines at 700 K: Compression rate: 67.97%, 68,468/ 213,769 lines. Total compression rate: 66.26%, 72,118/ 213,769 lines. With a threshold strength factor of 0.01, kept a total of 72,118 line transitions out of 213,769 lines. Successfully rewriten hitran line-transition info into: 'CO2_hitran_2.5-2.6um_500-700K_lbl.dat' and 'CO2_hitran_2.5-2.6um_500-700K_continuum.dat'.""" in capfd.out # Teardown: os.remove('data/02_3750-4000_HITEMP2010.par') def test_hitemp_two_files(capfd): subprocess.call(['repack', 'hitemp_repack_two.cfg']) capfd = capfd.readouterr() assert """Reading: 'data/02_03750-04000_HITEMP2010.zip'. Flagging lines at 500 K: Compression rate: 76.11%, 51,071/ 213,769 lines. Flagging lines at 700 K: Compression rate: 67.97%, 68,468/ 213,769 lines. Total compression rate: 66.26%, 72,118/ 213,769 lines. Reading: 'data/02_04000-04500_HITEMP2010.zip'. Flagging lines at 500 K: Compression rate: 46.12%, 74,492/ 138,258 lines. Flagging lines at 700 K: Compression rate: 18.91%, 112,116/ 138,258 lines. Total compression rate: 18.65%, 112,469/ 138,258 lines. With a threshold strength factor of 0.01, kept a total of 184,587 line transitions out of 352,027 lines. Successfully rewriten hitran line-transition info into: 'CO2_hitran_2.2-2.6um_500-700K_lbl.dat' and 'CO2_hitran_2.2-2.6um_500-700K_continuum.dat'.""" in capfd.out def test_hitemp_single_chunks(capfd): subprocess.call('repack hitemp_repack_single_chunks.cfg'.split()) capfd = capfd.readouterr() assert """Reading: 'data/02_03750-04000_HITEMP2010.zip'. Flagging lines at 500 K (chunk 1/3): Compression rate: 83.40%, 11,826/ 71,256 lines. Flagging lines at 700 K: Compression rate: 78.32%, 15,451/ 71,256 lines. Total compression rate: 76.31%, 16,883/ 71,256 lines. Flagging lines at 500 K (chunk 2/3): Compression rate: 77.27%, 16,199/ 71,256 lines. Flagging lines at 700 K: Compression rate: 68.75%, 22,271/ 71,256 lines. Total compression rate: 66.94%, 23,554/ 71,256 lines. Flagging lines at 500 K (chunk 3/3): Compression rate: 67.64%, 23,057/ 71,257 lines. Flagging lines at 700 K: Compression rate: 56.82%, 30,771/ 71,257 lines. Total compression rate: 55.50%, 31,706/ 71,257 lines. With a threshold strength factor of 0.01, kept a total of 72,143 line transitions out of 213,769 lines. Successfully rewriten hitran line-transition info into: 'CO2_hitran_2.5-2.6um_500-700K_lbl.dat' and 'CO2_hitran_2.5-2.6um_500-700K_continuum.dat'.""" in capfd.out
38.980392
80
0.685362
633
3,976
4.189573
0.225908
0.118778
0.079186
0.067873
0.802413
0.801659
0.719834
0.687406
0.65724
0.596154
0
0.191329
0.199447
3,976
101
81
39.366337
0.641847
0.009809
0
0.551282
0
0
0.823544
0.177727
0
0
0
0
0.051282
1
0.051282
false
0
0.025641
0
0.076923
0
0
0
0
null
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
8f2332836347a6f5b456900dd7ac5532904da592
20,403
py
Python
tests/test_FBbasis3D.py
PrincetonUniversity/ASPIRE-Python
1bff8d3884183203bd77695a76bccb1efc909fd3
[ "MIT" ]
7
2018-11-07T16:45:35.000Z
2020-01-10T16:54:26.000Z
tests/test_FBbasis3D.py
PrincetonUniversity/ASPIRE-Python
1bff8d3884183203bd77695a76bccb1efc909fd3
[ "MIT" ]
1
2019-04-05T18:41:39.000Z
2019-04-05T18:41:39.000Z
tests/test_FBbasis3D.py
PrincetonUniversity/ASPIRE-Python
1bff8d3884183203bd77695a76bccb1efc909fd3
[ "MIT" ]
2
2019-06-04T17:01:53.000Z
2019-07-08T19:01:40.000Z
import os.path from unittest import TestCase import numpy as np from aspire.basis import FBBasis3D from aspire.utils import utest_tolerance DATA_DIR = os.path.join(os.path.dirname(__file__), "saved_test_data") class FBBasis3DTestCase(TestCase): def setUp(self): self.dtype = np.float32 self.basis = FBBasis3D((8, 8, 8), dtype=self.dtype) def tearDown(self): pass def testFBBasis3DIndices(self): indices = self.basis.indices() self.assertTrue( np.allclose( indices["ells"], [ 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, ], ) ) self.assertTrue( np.allclose( indices["ms"], [ 0.0, 0.0, 0.0, -1.0, -1.0, -1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, -2.0, -2.0, -2.0, -1.0, -1.0, -1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, -3.0, -3.0, -2.0, -2.0, -1.0, -1.0, 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, -4.0, -4.0, -3.0, -3.0, -2.0, -2.0, -1.0, -1.0, 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, ], ) ) self.assertTrue( np.allclose( indices["ks"], [ 0.0, 1.0, 2.0, 0.0, 1.0, 2.0, 0.0, 1.0, 2.0, 0.0, 1.0, 2.0, 0.0, 1.0, 2.0, 0.0, 1.0, 2.0, 0.0, 1.0, 2.0, 0.0, 1.0, 2.0, 0.0, 1.0, 2.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, ], ) ) def testFBBasis3DNorms(self): norms = self.basis.norms() self.assertTrue( np.allclose( norms, [ 1.80063263231421, 0.900316316157109, 0.600210877438065, 1.22885897287928, 0.726196138639673, 0.516613361675378, 0.936477951517100, 0.610605075148750, 0.454495363516488, 0.756963071176142, 0.527618747123993, 0.635005913075500, 0.464867421846148, 0.546574142892508, 0.479450758110826, 0.426739123914569, ], ) ) def testFBBasis3DEvaluate(self): coeffs = np.array( [ 1.07338590e-01, 1.23690941e-01, 6.44482039e-03, -5.40484306e-02, -4.85304586e-02, 1.09852144e-02, 3.87838396e-02, 3.43796455e-02, -6.43284705e-03, -2.86677145e-02, -1.42313328e-02, -2.25684091e-03, -3.31840727e-02, -2.59706174e-03, -5.91919887e-04, -9.97433028e-03, 9.19123928e-04, 1.19891589e-03, 7.49154982e-03, 6.18865229e-03, -8.13265715e-04, -1.30715655e-02, -1.44160603e-02, 2.90379956e-03, 2.37066082e-02, 4.88805735e-03, 1.47870707e-03, 7.63376018e-03, -5.60619559e-03, 1.05165081e-02, 3.30510143e-03, -3.48652120e-03, -4.23228797e-04, 1.40484061e-02, 1.42914291e-03, -1.28129504e-02, 2.19868825e-03, -6.30835037e-03, 1.18524223e-03, -2.97855052e-02, 1.15491057e-03, -8.27947006e-03, 3.45442781e-03, -4.72868856e-03, 2.66615329e-03, -7.87929790e-03, 8.84126590e-04, 1.59402808e-03, -9.06854048e-05, -8.79119004e-03, 1.76449039e-03, -1.36414673e-02, 1.56793855e-03, 1.44708445e-02, -2.55974802e-03, 5.38506357e-03, -3.24188673e-03, 4.81582945e-04, 7.74260101e-05, 5.48772082e-03, 1.92058500e-03, -4.63538896e-03, -2.02735133e-03, 3.67592386e-03, 7.23486969e-04, 1.81838422e-03, 1.78793284e-03, -8.01474060e-03, -8.54007528e-03, 1.96353845e-03, -2.16254252e-03, -3.64243996e-05, -2.27329863e-03, 1.11424393e-03, -1.39389189e-03, 2.57787159e-04, 3.66918811e-03, 1.31477774e-03, 6.82220128e-04, 1.41822851e-03, -1.89476924e-03, -6.43966255e-05, -7.87888465e-04, -6.99459279e-04, 1.08918981e-03, 2.25264584e-03, -1.43651015e-04, 7.68377620e-04, 5.05955256e-04, 2.66936132e-06, 2.24934884e-03, 6.70529439e-04, 4.81121742e-04, -6.40789745e-05, -3.35915672e-04, -7.98651783e-04, -9.82705453e-04, 6.46337066e-05, ], dtype=self.dtype, ) result = self.basis.evaluate(coeffs) self.assertTrue( np.allclose( result, np.load(os.path.join(DATA_DIR, "hbbasis_evaluation_8_8_8.npy")).T, atol=utest_tolerance(self.dtype), ) ) def testFBBasis3DEvaluate_t(self): v = np.load(os.path.join(DATA_DIR, "hbbasis_coefficients_8_8_8.npy")).T result = self.basis.evaluate_t(v.astype(self.dtype)) self.assertTrue( np.allclose( result, [ 1.07338590e-01, 1.23690941e-01, 6.44482039e-03, -5.40484306e-02, -4.85304586e-02, 1.09852144e-02, 3.87838396e-02, 3.43796455e-02, -6.43284705e-03, -2.86677145e-02, -1.42313328e-02, -2.25684091e-03, -3.31840727e-02, -2.59706174e-03, -5.91919887e-04, -9.97433028e-03, 9.19123928e-04, 1.19891589e-03, 7.49154982e-03, 6.18865229e-03, -8.13265715e-04, -1.30715655e-02, -1.44160603e-02, 2.90379956e-03, 2.37066082e-02, 4.88805735e-03, 1.47870707e-03, 7.63376018e-03, -5.60619559e-03, 1.05165081e-02, 3.30510143e-03, -3.48652120e-03, -4.23228797e-04, 1.40484061e-02, 1.42914291e-03, -1.28129504e-02, 2.19868825e-03, -6.30835037e-03, 1.18524223e-03, -2.97855052e-02, 1.15491057e-03, -8.27947006e-03, 3.45442781e-03, -4.72868856e-03, 2.66615329e-03, -7.87929790e-03, 8.84126590e-04, 1.59402808e-03, -9.06854048e-05, -8.79119004e-03, 1.76449039e-03, -1.36414673e-02, 1.56793855e-03, 1.44708445e-02, -2.55974802e-03, 5.38506357e-03, -3.24188673e-03, 4.81582945e-04, 7.74260101e-05, 5.48772082e-03, 1.92058500e-03, -4.63538896e-03, -2.02735133e-03, 3.67592386e-03, 7.23486969e-04, 1.81838422e-03, 1.78793284e-03, -8.01474060e-03, -8.54007528e-03, 1.96353845e-03, -2.16254252e-03, -3.64243996e-05, -2.27329863e-03, 1.11424393e-03, -1.39389189e-03, 2.57787159e-04, 3.66918811e-03, 1.31477774e-03, 6.82220128e-04, 1.41822851e-03, -1.89476924e-03, -6.43966255e-05, -7.87888465e-04, -6.99459279e-04, 1.08918981e-03, 2.25264584e-03, -1.43651015e-04, 7.68377620e-04, 5.05955256e-04, 2.66936132e-06, 2.24934884e-03, 6.70529439e-04, 4.81121742e-04, -6.40789745e-05, -3.35915672e-04, -7.98651783e-04, -9.82705453e-04, 6.46337066e-05, ], atol=utest_tolerance(self.dtype), ) ) def testFBBasis3DExpand(self): v = np.load(os.path.join(DATA_DIR, "hbbasis_coefficients_8_8_8.npy")).T result = self.basis.expand(v.astype(self.dtype)) self.assertTrue( np.allclose( result, [ +0.10743660, +0.12346847, +0.00684837, -0.05410818, -0.04840195, +0.01071116, +0.03878536, +0.03437083, -0.00638332, -0.02865552, -0.01425294, -0.00223313, -0.03317134, -0.00261654, -0.00056954, -0.00997264, +0.00091569, +0.00123042, +0.00754713, +0.00606669, -0.00043233, -0.01306626, -0.01443522, +0.00301968, +0.02375521, +0.00477979, +0.00166319, +0.00780333, -0.00601982, +0.01052385, +0.00328666, -0.00336805, -0.00070688, +0.01409127, +0.00127259, -0.01289172, +0.00234488, -0.00630249, +0.00117541, -0.02974037, +0.00108834, -0.00823955, +0.00340772, -0.00471875, +0.00266391, -0.00789639, +0.00093529, +0.00160710, -0.00011925, -0.00817443, +0.00046713, -0.01357463, +0.00145920, +0.01452459, -0.00267202, +0.00535952, -0.00322100, +0.00092083, -0.00075300, +0.00509418, +0.00193687, -0.00483399, -0.00204537, +0.00338492, +0.00111248, +0.00194841, +0.00174416, -0.00814324, -0.00839777, +0.00199974, -0.00196156, -0.00014695, -0.00245317, +0.00109957, -0.00146145, +0.00015149, +0.00415232, +0.00121810, +0.00066095, +0.00166167, -0.00231911, -0.00025819, -0.00086808, -0.00074656, +0.00110445, +0.00285573, -0.00014959, +0.00093241, +0.00051144, +0.00004805, +0.00250166, +0.00059104, +0.00066592, +0.00019188, -0.00079074, -0.00068995, -0.00087668, +0.00052913, ], atol=utest_tolerance(self.dtype), ) ) def testInitWithIntSize(self): # make sure we can instantiate with just an int as a shortcut self.assertEqual((8, 8, 8), FBBasis3D(8).sz)
28.981534
82
0.257021
1,632
20,403
3.196078
0.182598
0.062117
0.073044
0.071319
0.655483
0.642446
0.625192
0.625192
0.607554
0.589916
0
0.54875
0.65113
20,403
703
83
29.02276
0.18404
0.002892
0
0.753644
0
0
0.005457
0.004326
0
0
0
0
0.011662
1
0.011662
false
0.001458
0.007289
0
0.020408
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
56ad2453fa5ccad4539cf94804725b72c0120fb4
307
py
Python
python/coding_bat/no_teen_sum/no_teen_sum.py
lmregus/Portfolio
9a751443edbfe5ff2b47cdeacca86761ed03e81f
[ "MIT" ]
null
null
null
python/coding_bat/no_teen_sum/no_teen_sum.py
lmregus/Portfolio
9a751443edbfe5ff2b47cdeacca86761ed03e81f
[ "MIT" ]
1
2021-11-15T17:46:44.000Z
2021-11-15T17:46:44.000Z
python/coding_bat/no_teen_sum/no_teen_sum.py
lmregus/Portfolio
9a751443edbfe5ff2b47cdeacca86761ed03e81f
[ "MIT" ]
null
null
null
######################### # # # Developer: Luis Regus # # # ######################### def no_teen_sum(a, b, c): return fix_teen(a) + fix_teen(b) + fix_teen(c) def fix_teen(n): if n >= 13 and n < 15 or n > 16 and n <= 19: return 0 return n
20.466667
51
0.37785
40
307
2.75
0.525
0.254545
0
0
0
0
0
0
0
0
0
0.045918
0.361564
307
14
52
21.928571
0.515306
0.068404
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.166667
0.833333
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
56cec01d52f11d8f2f3a25691713685b1f184c30
64
py
Python
general_run_functions.py
mpwesthuizen/eng57_factory
3d7b72eeb17538f5d2121bb72dd942826e746735
[ "MIT" ]
null
null
null
general_run_functions.py
mpwesthuizen/eng57_factory
3d7b72eeb17538f5d2121bb72dd942826e746735
[ "MIT" ]
null
null
null
general_run_functions.py
mpwesthuizen/eng57_factory
3d7b72eeb17538f5d2121bb72dd942826e746735
[ "MIT" ]
null
null
null
from general_functions import say_hello, return_formatted_name
21.333333
62
0.890625
9
64
5.888889
1
0
0
0
0
0
0
0
0
0
0
0
0.09375
64
2
63
32
0.913793
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
8537f26e7b7d1d075f4b0a51e7b757f704e31675
1,809
py
Python
server/shserver/Category.py
AsherYang/ThreeLine
351dc8bfd1c0a536ffbf36ce8b1af953cc71f93a
[ "Apache-2.0" ]
1
2017-05-02T10:02:28.000Z
2017-05-02T10:02:28.000Z
server/shserver/Category.py
AsherYang/ThreeLine
351dc8bfd1c0a536ffbf36ce8b1af953cc71f93a
[ "Apache-2.0" ]
null
null
null
server/shserver/Category.py
AsherYang/ThreeLine
351dc8bfd1c0a536ffbf36ce8b1af953cc71f93a
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/python # -*- coding: utf-8 -*- """ Author: AsherYang Email: ouyangfan1991@gmail.com Date: 2017/9/8. Desc: 商品分类 """ class Category(): @property def cate_id(self): return self.cate_id @property def cate_id(self, value): self.cate_id = value @property def cate_name(self): return self.cate_name @property def cate_name(self, value): self.cate_name = value @property def parent_id(self): return self.parent_id @property def parent_id(self, value): self.parent_id = value @property def parent_cate_name(self): return self.parent_cate_name @property def parent_cate_name(self, value): self.parent_cate_name = value @property def sort_num(self): return self.sort_num @property def sort_num(self, value): self.sort_num = value @property def cate_item_num(self): return self.cate_item_num @property def cate_item_num(self, value): self.cate_item_num = value @property def description(self): return self.description @property def description(self, value): self.description = value @property def listUrl(self): return self.listUrl @property def listUrl(self, value): self.listUrl = value @property def shopName(self): return self.shopName @property def shopName(self, value): self.shopName = value @property def shopLogo(self): return self.shopLogo @property def shopLogo(self, value): self.shopLogo = value @property def update_time(self): return self.update_time @property def update_time(self, value): self.update_time = value
18.459184
38
0.616915
221
1,809
4.886878
0.167421
0.224074
0.142593
0.05
0.372222
0.101852
0
0
0
0
0
0.008594
0.292427
1,809
98
39
18.459184
0.835156
0.065782
0
0.328358
0
0
0
0
0
0
0
0
0
1
0.328358
false
0
0
0.164179
0.507463
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
85395d0bb5e57d2d3a9551add4eccac4588af94a
32
py
Python
pySPACE/tests/unittests/nodes/sink/__init__.py
pyspace/pyspace
763e62c0e7fa7cfcb19ccee1a0333c4f7e68ae62
[ "BSD-3-Clause" ]
32
2015-02-20T09:03:09.000Z
2022-02-25T22:32:52.000Z
pySPACE/tests/unittests/nodes/sink/__init__.py
pyspace/pyspace
763e62c0e7fa7cfcb19ccee1a0333c4f7e68ae62
[ "BSD-3-Clause" ]
5
2015-05-18T15:08:40.000Z
2020-03-05T19:18:01.000Z
pySPACE/tests/unittests/nodes/sink/__init__.py
pyspace/pyspace
763e62c0e7fa7cfcb19ccee1a0333c4f7e68ae62
[ "BSD-3-Clause" ]
18
2015-09-28T07:16:38.000Z
2021-01-20T13:52:19.000Z
""" Unittests for nodes.sink """
32
32
0.65625
4
32
5.25
1
0
0
0
0
0
0
0
0
0
0
0
0.125
32
1
32
32
0.75
0.75
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
85589bfc19c372f77afd99179728115c2705d8d7
188
py
Python
chromato/utils.py
vikpe/chromato
fb5b0ee954941967ad7cebbce837efcad07f6128
[ "MIT" ]
null
null
null
chromato/utils.py
vikpe/chromato
fb5b0ee954941967ad7cebbce837efcad07f6128
[ "MIT" ]
null
null
null
chromato/utils.py
vikpe/chromato
fb5b0ee954941967ad7cebbce837efcad07f6128
[ "MIT" ]
null
null
null
def lerp(v1: float, v2: float, factor: float) -> float: return v1 + ((v2 - v1) * factor) def dict_has_keys(_dict: dict, keys: iter) -> bool: return all(k in _dict for k in keys)
26.857143
55
0.632979
32
188
3.59375
0.5
0.052174
0
0
0
0
0
0
0
0
0
0.034247
0.223404
188
6
56
31.333333
0.753425
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0.5
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
1
0
0
0
1
1
0
0
4
85852278279dc5c0c5c920f497f978d6fe469511
3,140
py
Python
tests/test_timed.py
electronhead/whendo
27112834be0935b5b0f7ade4316e35532532e047
[ "MIT" ]
1
2022-03-04T09:25:13.000Z
2022-03-04T09:25:13.000Z
tests/test_timed.py
electronhead/whendo
27112834be0935b5b0f7ade4316e35532532e047
[ "MIT" ]
null
null
null
tests/test_timed.py
electronhead/whendo
27112834be0935b5b0f7ade4316e35532532e047
[ "MIT" ]
null
null
null
import time from whendo.core.timed import Timed from whendo.core.util import TimeUnit, PP from whendo.core.action import Action, Rez pause = 3 def test_timely_callable(tmp_path): """ This test exercises the schedule_timely_callable method. """ class Suite: def __init__(self): self.content = "foobarbaz" self.file = "text.txt" self.path = tmp_path / self.file def callable(self): with self.path.open(mode="a") as fid: fid.write(self.content) fid.write("\n") def gather(self): result = [] with self.path.open(mode="r") as fid: result.append(fid.readlines()) return result def run(self): timed = Timed() timed.schedule_timely_callable("tag", self.callable) timed.run() time.sleep(pause) timed.stop() timed.clear() suite = Suite() suite.run() accumulated_content = suite.gather() assert accumulated_content and len(accumulated_content) > 0 def test_random_callable(tmp_path): """ This test exercises the schedule_timely_callable method. """ class Suite: def __init__(self): self.content = "foobarbaz" self.file = "text.txt" self.path = tmp_path / self.file def callable(self): with self.path.open(mode="a") as fid: fid.write(self.content) fid.write("\n") def gather(self): result = [] with self.path.open(mode="r") as fid: result.append(fid.readlines()) return result def run(self): timed = Timed() timed.schedule_random_callable( "tag", self.callable, time_unit=TimeUnit.second, low=1, high=3 ) timed.run() time.sleep(4) timed.stop() timed.clear() suite = Suite() suite.run() accumulated_content = suite.gather() assert accumulated_content and len(accumulated_content) > 0 def test_file_action(tmp_path): """ This test exercises the schedule_timely_callable method. """ class FileAction(Action): def execute(self, tag: str = None, rez: Rez = None): path = tmp_path / "test.txt" with path.open(mode="a") as fid: fid.write("blee\n") return self.action_result() class Suite: def __init__(self, action): self.action = action def gather(self): path = tmp_path / "test.txt" with path.open(mode="r") as fid: return sum(1 for line in fid) def run(self): timed = Timed() timed.schedule_timely_callable("tag", self.action.execute) timed.run() time.sleep(pause) timed.stop() timed.clear() suite = Suite(FileAction()) suite.run() line_count = suite.gather() assert line_count and line_count >= 2, "no lines written to file"
27.068966
78
0.548408
362
3,140
4.624309
0.218232
0.029271
0.043011
0.038232
0.723417
0.710872
0.707288
0.707288
0.698925
0.658303
0
0.003884
0.343949
3,140
115
79
27.304348
0.808738
0.05414
0
0.690476
0
0
0.033858
0
0
0
0
0
0.035714
1
0.178571
false
0
0.047619
0
0.321429
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
859118771e431af1a9372de256ca7927aa4b2d81
935
py
Python
ui/src/blocks/microbit/DriveBit/DriveBit.py
robli298/EduBlocks
35a574b849f0c8cf32d4999d9de26372f0304db5
[ "MIT" ]
null
null
null
ui/src/blocks/microbit/DriveBit/DriveBit.py
robli298/EduBlocks
35a574b849f0c8cf32d4999d9de26372f0304db5
[ "MIT" ]
null
null
null
ui/src/blocks/microbit/DriveBit/DriveBit.py
robli298/EduBlocks
35a574b849f0c8cf32d4999d9de26372f0304db5
[ "MIT" ]
null
null
null
from microbit import * class DriveBit: def __init__(self): pass class motor: class one: def forward(speed): pin12.write_analog (speed) pin13.write_analog (0) def backward(speed): pin12.write_analog (0) pin13.write_analog (speed) def stop(): pin12.write_analog (0) pin13.write_analog (0) class two: def forward(speed): pin14.write_analog (speed) pin15.write_analog (0) def backward(speed): pin14.write_analog (0) pin15.write_analog (speed) def stop(): pin14.write_analog (0) pin15.write_analog (0)
29.21875
46
0.410695
79
935
4.658228
0.291139
0.358696
0.26087
0.11413
0.576087
0.51087
0.358696
0
0
0
0
0.071749
0.522995
935
32
47
29.21875
0.753363
0
0
0.56
0
0
0
0
0
0
0
0
0
1
0.28
false
0.04
0.04
0
0.48
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
1
0
0
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
85b7f428ad8ffc0fe3df0302f29d963e01f09155
156
py
Python
pliers/external/__init__.py
nickduran/pliers
9b10b27e70c3fbb7647eb1c70e031f55d824f3f6
[ "BSD-3-Clause" ]
229
2016-12-22T22:55:20.000Z
2020-07-13T19:04:46.000Z
pliers/external/__init__.py
nickduran/pliers
9b10b27e70c3fbb7647eb1c70e031f55d824f3f6
[ "BSD-3-Clause" ]
294
2016-12-23T00:23:25.000Z
2020-07-17T19:44:37.000Z
pliers/external/__init__.py
nickduran/pliers
9b10b27e70c3fbb7647eb1c70e031f55d824f3f6
[ "BSD-3-Clause" ]
61
2017-01-10T00:53:26.000Z
2020-04-27T16:25:53.000Z
''' The `external` module houses any third-party code that is required for pliers to function properly and can be bundled without making life difficult. '''
52
77
0.782051
24
156
5.083333
1
0
0
0
0
0
0
0
0
0
0
0
0.153846
156
3
78
52
0.924242
0.948718
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
a40f9223ee1e836e702b05558372ba84275a3fdc
132
py
Python
00_simple_examples/05_string.py
tlananthu/python-learning
cfda5bfa6c613bcbe8bfe00567cd058ce5afc4a2
[ "Apache-2.0" ]
1
2020-05-11T18:39:54.000Z
2020-05-11T18:39:54.000Z
00_simple_examples/05_string.py
tlananthu/python-learning
cfda5bfa6c613bcbe8bfe00567cd058ce5afc4a2
[ "Apache-2.0" ]
null
null
null
00_simple_examples/05_string.py
tlananthu/python-learning
cfda5bfa6c613bcbe8bfe00567cd058ce5afc4a2
[ "Apache-2.0" ]
null
null
null
s="This is string" print(s) print(type(s)) t=s.encode('utf-8') print(t) print(type(t)) u=t.decode('utf-8') print(u) print(type(u))
12
19
0.643939
29
132
2.931034
0.413793
0.317647
0.211765
0
0
0
0
0
0
0
0
0.016667
0.090909
132
11
20
12
0.691667
0
0
0
0
0
0.180451
0
0
0
0
0
0
1
0
false
0
0
0
0
0.666667
1
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
0
0
0
0
0
0
1
0
4
a42a27944c7498b4598dec91727278116eadd2c9
522
py
Python
runner/main.py
makeshmakesh/copper-sdk
c938adb39737822d0bfe17c052ca43898eb2a1c3
[ "MIT" ]
null
null
null
runner/main.py
makeshmakesh/copper-sdk
c938adb39737822d0bfe17c052ca43898eb2a1c3
[ "MIT" ]
1
2021-04-15T00:10:50.000Z
2021-04-15T00:10:50.000Z
runner/main.py
makeshmakesh/copper-sdk
c938adb39737822d0bfe17c052ca43898eb2a1c3
[ "MIT" ]
4
2021-01-07T05:30:49.000Z
2021-09-13T08:08:54.000Z
from copper_sdk import copper from dotenv import dotenv_values import notes.lead import notes.opportunity import notes.task def notes_examples(copper_client, config): notes.lead.run(copper_client, config) notes.opportunity.run(copper_client, config) notes.task.run(copper_client, config) # notes.task.run_old(copper_client, config) if __name__ == "__main__": config = dotenv_values(".env") copper_client = copper.Copper(config["TOKEN"], config["EMAIL"]) notes_examples(copper_client, config)
30.705882
67
0.762452
70
522
5.385714
0.314286
0.222812
0.286472
0.244032
0.400531
0.167109
0.167109
0
0
0
0
0
0.132184
522
16
68
32.625
0.83223
0.078544
0
0
0
0
0.045929
0
0
0
0
0
0
1
0.076923
false
0
0.384615
0
0.461538
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
0
0
0
0
1
0
0
0
0
4
a436b75007a7dd06b47b68b7c18d558330dcdf7a
182
py
Python
app/api/routes/api.py
socylx/fastapi-with-mongo
49fca010f339b9be0ce5f8445c317db60969785d
[ "MIT" ]
null
null
null
app/api/routes/api.py
socylx/fastapi-with-mongo
49fca010f339b9be0ce5f8445c317db60969785d
[ "MIT" ]
null
null
null
app/api/routes/api.py
socylx/fastapi-with-mongo
49fca010f339b9be0ce5f8445c317db60969785d
[ "MIT" ]
null
null
null
from fastapi import APIRouter from app.api.routes import authentication router = APIRouter() router.include_router(authentication.router, tags=["authentication"], prefix="/users")
26
86
0.802198
21
182
6.904762
0.619048
0.275862
0
0
0
0
0
0
0
0
0
0
0.087912
182
7
86
26
0.873494
0
0
0
0
0
0.10929
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
a49dc54e289dc192a3e21779788a86c02215c820
71
py
Python
src/clr_db.py
stormi/tsunami
bdc853229834b52b2ee8ed54a3161a1a3133d926
[ "BSD-3-Clause" ]
14
2015-08-21T19:15:21.000Z
2017-11-26T13:59:17.000Z
src/clr_db.py
stormi/tsunami
bdc853229834b52b2ee8ed54a3161a1a3133d926
[ "BSD-3-Clause" ]
20
2015-09-29T20:50:45.000Z
2018-06-21T12:58:30.000Z
src/clr_db.py
stormi/tsunami
bdc853229834b52b2ee8ed54a3161a1a3133d926
[ "BSD-3-Clause" ]
3
2015-05-02T19:42:03.000Z
2018-09-06T10:55:00.000Z
from pymongo import MongoClient MongoClient().drop_database("tsunami")
23.666667
38
0.830986
8
71
7.25
0.875
0
0
0
0
0
0
0
0
0
0
0
0.070423
71
2
39
35.5
0.878788
0
0
0
0
0
0.098592
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
f10fa07bc91742842e9f1ac5c0e6ce2f4430c7ed
189
py
Python
src/pipeline_step/pipeline_step.py
codefo-O/on-prem_etl_pipeline
986c060e8dfaa649fa0c95dc8bb71999ee7caf11
[ "Apache-2.0" ]
null
null
null
src/pipeline_step/pipeline_step.py
codefo-O/on-prem_etl_pipeline
986c060e8dfaa649fa0c95dc8bb71999ee7caf11
[ "Apache-2.0" ]
null
null
null
src/pipeline_step/pipeline_step.py
codefo-O/on-prem_etl_pipeline
986c060e8dfaa649fa0c95dc8bb71999ee7caf11
[ "Apache-2.0" ]
null
null
null
import abc class PipelineStep(object): __metaclass__ = abc.ABCMeta def __init__(self): print("constructor") @abc.abstractmethod def run(self, *args): pass
17.181818
31
0.640212
20
189
5.65
0.8
0
0
0
0
0
0
0
0
0
0
0
0.259259
189
11
32
17.181818
0.807143
0
0
0
0
0
0.057895
0
0
0
0
0
0
1
0.25
false
0.125
0.125
0
0.625
0.125
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
f1307d23de68374bb5844ec116db3d91ccf623ed
101
py
Python
Python Program for compound interest.py
vasumsv/Python-Basic-Programs-
a92c98dc6b9a266a97e0689238d555c90fe31cab
[ "MIT" ]
null
null
null
Python Program for compound interest.py
vasumsv/Python-Basic-Programs-
a92c98dc6b9a266a97e0689238d555c90fe31cab
[ "MIT" ]
null
null
null
Python Program for compound interest.py
vasumsv/Python-Basic-Programs-
a92c98dc6b9a266a97e0689238d555c90fe31cab
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Sun Jun 21 00:03:53 2020 @author: Vasu """ print(2+5)
12.625
36
0.534653
17
101
3.176471
1
0
0
0
0
0
0
0
0
0
0
0.197368
0.247525
101
8
37
12.625
0.513158
0.722772
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
4
f13a17d241d5fd69ef2c198397e4c3391a375ba2
133
py
Python
python/2 Dive into Python/for.py
shahjalalh/tutorials
16046e02cfaf7c28a614c442bb1e6830280e343e
[ "MIT" ]
8
2015-08-02T16:36:37.000Z
2018-10-04T11:29:33.000Z
python/2 Dive into Python/for.py
shahjalalh/tutorials
16046e02cfaf7c28a614c442bb1e6830280e343e
[ "MIT" ]
null
null
null
python/2 Dive into Python/for.py
shahjalalh/tutorials
16046e02cfaf7c28a614c442bb1e6830280e343e
[ "MIT" ]
19
2015-03-30T09:46:35.000Z
2021-09-17T13:58:42.000Z
dictionary = {"name": "Shahjalal", "ref": "Python", "sys": "Mac"} for key, value in dictionary.items(): print key, " = ", value
26.6
65
0.593985
16
133
4.9375
0.8125
0.202532
0
0
0
0
0
0
0
0
0
0
0.180451
133
4
66
33.25
0.724771
0
0
0
0
0
0.233083
0
0
0
0
0
0
0
null
null
0
0
null
null
0.333333
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
1
0
0
0
0
0
0
0
0
4
f14a0b5aed582806fa841dca225e039caf8291c5
60
py
Python
py/extremamenteBasico.py
Ellian-aragao/URI
e53b9380c5be0e59fdd002553ea33a04a7c35439
[ "Unlicense" ]
null
null
null
py/extremamenteBasico.py
Ellian-aragao/URI
e53b9380c5be0e59fdd002553ea33a04a7c35439
[ "Unlicense" ]
null
null
null
py/extremamenteBasico.py
Ellian-aragao/URI
e53b9380c5be0e59fdd002553ea33a04a7c35439
[ "Unlicense" ]
null
null
null
x = int(input()) x += int(input()) print('X = {}'.format(x))
20
25
0.516667
10
60
3.1
0.5
0.258065
0.580645
0
0
0
0
0
0
0
0
0
0.133333
60
3
25
20
0.596154
0
0
0
0
0
0.098361
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
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
f1732b883b217a61af46e6152e1552568091c42e
89
py
Python
presalytics/story/__init__.py
presalytics/python-client
5d80b78562126feeeb49af4738e2c1aed12dce3a
[ "MIT" ]
4
2020-02-21T16:30:46.000Z
2021-01-12T12:22:03.000Z
presalytics/story/__init__.py
presalytics/python-client
5d80b78562126feeeb49af4738e2c1aed12dce3a
[ "MIT" ]
4
2019-12-28T19:30:08.000Z
2020-03-31T19:27:45.000Z
presalytics/story/__init__.py
presalytics/python-client
5d80b78562126feeeb49af4738e2c1aed12dce3a
[ "MIT" ]
null
null
null
""" Conains base objects for rendering, building, serializing, and view Story objects """
29.666667
81
0.764045
11
89
6.181818
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.134831
89
3
82
29.666667
0.883117
0.910112
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
f17d61813419a245e879dfa296aa24610a69c12e
508
py
Python
Borealis/permissions.py
andeen171/Borealis
c1f4fe891b01a086701a9db92dda59db2e36e095
[ "MIT" ]
null
null
null
Borealis/permissions.py
andeen171/Borealis
c1f4fe891b01a086701a9db92dda59db2e36e095
[ "MIT" ]
null
null
null
Borealis/permissions.py
andeen171/Borealis
c1f4fe891b01a086701a9db92dda59db2e36e095
[ "MIT" ]
null
null
null
from rest_framework import permissions class IsClient(permissions.BasePermission): def has_permission(self, request, view): is_staff = request.user.is_staff return not is_staff class IsTechnician(permissions.BasePermission): def has_permission(self, request, view): is_staff = request.user.is_staff return is_staff class ReadOnly(permissions.BasePermission): def has_permission(self, request, view): return request.method in permissions.SAFE_METHODS
26.736842
57
0.744094
61
508
6.016393
0.409836
0.114441
0.228883
0.253406
0.626703
0.626703
0.626703
0.626703
0.474114
0.474114
0
0
0.187008
508
18
58
28.222222
0.88862
0
0
0.416667
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.083333
0.083333
0.833333
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
74e23da927e86f465421f58df09ed570577fd7a1
109
py
Python
src/db/__init__.py
iulianPeiu6/EncryptedDatabase
127c116cc6ca7389fb0df9eaaa9930447fa5a012
[ "MIT" ]
null
null
null
src/db/__init__.py
iulianPeiu6/EncryptedDatabase
127c116cc6ca7389fb0df9eaaa9930447fa5a012
[ "MIT" ]
null
null
null
src/db/__init__.py
iulianPeiu6/EncryptedDatabase
127c116cc6ca7389fb0df9eaaa9930447fa5a012
[ "MIT" ]
null
null
null
"""Contains implementation database queries and DMLs: get all files, create file, remove file, read file """
27.25
68
0.761468
15
109
5.533333
0.866667
0
0
0
0
0
0
0
0
0
0
0
0.146789
109
3
69
36.333333
0.892473
0.926606
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
74e2e97b3ebd43be5e568c15e642df8a30d5d2ea
81
py
Python
cracking_the_coding_interview_qs/16.1/number_swapper.py
angelusualle/algorithms
86286a49db2a755bc57330cb455bcbd8241ea6be
[ "Apache-2.0" ]
null
null
null
cracking_the_coding_interview_qs/16.1/number_swapper.py
angelusualle/algorithms
86286a49db2a755bc57330cb455bcbd8241ea6be
[ "Apache-2.0" ]
null
null
null
cracking_the_coding_interview_qs/16.1/number_swapper.py
angelusualle/algorithms
86286a49db2a755bc57330cb455bcbd8241ea6be
[ "Apache-2.0" ]
null
null
null
def number_swapper(a,b): a = a - b b = b + a a = b - a return a,b
16.2
24
0.444444
17
81
2.058824
0.352941
0.228571
0.171429
0.228571
0
0
0
0
0
0
0
0
0.419753
81
5
25
16.2
0.744681
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0
0.4
0
1
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
2d00015f734b10c2cc47d1bef023e57ce9e0a3fe
38
py
Python
python/testData/refactoring/introduceVariable/incorrectSelection.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/refactoring/introduceVariable/incorrectSelection.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
python/testData/refactoring/introduceVariable/incorrectSelection.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
a = <selection>b + fu</selection>nc()
19
37
0.631579
6
38
4
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.131579
38
1
38
38
0.727273
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
741ee4b89477f5b97be5953c30f4287794e1a383
164
py
Python
webstr/patternfly/__init__.py
fbalak/webstr
7c7e552fb9943bf664b94ca75a88747c0b243722
[ "Apache-2.0" ]
3
2017-03-01T11:51:12.000Z
2018-04-16T13:09:56.000Z
webstr/patternfly/__init__.py
fbalak/webstr
7c7e552fb9943bf664b94ca75a88747c0b243722
[ "Apache-2.0" ]
null
null
null
webstr/patternfly/__init__.py
fbalak/webstr
7c7e552fb9943bf664b94ca75a88747c0b243722
[ "Apache-2.0" ]
1
2018-04-16T13:09:34.000Z
2018-04-16T13:09:34.000Z
""" Patternfly user interface module. This module contains models and pages classess for UI elements from patternfly library, see: https://www.patternfly.org/ """
23.428571
78
0.77439
22
164
5.772727
0.863636
0
0
0
0
0
0
0
0
0
0
0
0.134146
164
6
79
27.333333
0.894366
0.945122
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
7432a32a647cc2ae7a081e30291ff3f5bb8b2904
111
py
Python
code/11-files.py
Zhang-Jinlei/one-python-craftsman
bceee25c8e1b44b54f6cc7a73ee1353aa59299fa
[ "Apache-2.0" ]
null
null
null
code/11-files.py
Zhang-Jinlei/one-python-craftsman
bceee25c8e1b44b54f6cc7a73ee1353aa59299fa
[ "Apache-2.0" ]
null
null
null
code/11-files.py
Zhang-Jinlei/one-python-craftsman
bceee25c8e1b44b54f6cc7a73ee1353aa59299fa
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Time : 2021-6-1 14:59 # @Author : Jinlei # @Describe :
18.5
28
0.540541
16
111
3.75
1
0
0
0
0
0
0
0
0
0
0
0.139535
0.225225
111
5
29
22.2
0.55814
0.90991
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
7441a8cee2b8b92f4b1fa230dc0b237a7b40ae60
291
py
Python
marsyas-vamp/marsyas/src/django/birdsong/application/birdsong/fabfile.py
jaouahbi/VampPlugins
27c2248d1c717417fe4d448cdfb4cb882a8a336a
[ "Apache-2.0" ]
null
null
null
marsyas-vamp/marsyas/src/django/birdsong/application/birdsong/fabfile.py
jaouahbi/VampPlugins
27c2248d1c717417fe4d448cdfb4cb882a8a336a
[ "Apache-2.0" ]
null
null
null
marsyas-vamp/marsyas/src/django/birdsong/application/birdsong/fabfile.py
jaouahbi/VampPlugins
27c2248d1c717417fe4d448cdfb4cb882a8a336a
[ "Apache-2.0" ]
null
null
null
from fabric.context_managers import cd from fabric.operations import sudo from fabric.api import settings,run from fabric.api import * env.hosts = ['django.venus.orchive.net'] def update(): with cd('/var/www/calls/'): run('svn up') sudo('/usr/sbin/apache2ctl restart')
24.25
44
0.701031
42
291
4.833333
0.690476
0.197044
0.128079
0.187192
0
0
0
0
0
0
0
0.004132
0.168385
291
11
45
26.454545
0.834711
0
0
0
0
0
0.250859
0.082474
0
0
0
0
0
1
0.111111
true
0
0.444444
0
0.555556
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
74423d06512b5929719da203b2f1d566b5e13ce5
204
py
Python
weather/decorators.py
AktanKasymaliev/flask-mini-weather-app
811818ef21e1806cff307a0c8bd27d433074fa39
[ "MIT" ]
null
null
null
weather/decorators.py
AktanKasymaliev/flask-mini-weather-app
811818ef21e1806cff307a0c8bd27d433074fa39
[ "MIT" ]
null
null
null
weather/decorators.py
AktanKasymaliev/flask-mini-weather-app
811818ef21e1806cff307a0c8bd27d433074fa39
[ "MIT" ]
null
null
null
from flask import render_template def city404(func): def wrapper(): try: return func() except KeyError: return render_template('error.html') return wrapper
22.666667
48
0.607843
22
204
5.545455
0.681818
0.229508
0
0
0
0
0
0
0
0
0
0.021583
0.318627
204
9
49
22.666667
0.856115
0
0
0
0
0
0.04878
0
0
0
0
0
0
1
0.25
false
0
0.125
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
7447241e6b3f03a7055e4f95c71cd59e705afa1d
2,316
py
Python
WCPS-python-project/dsl.py
itsayeshanaeem/WCPSAccess
12b7a2f28a0f849a42336357723a57b6cb5905c9
[ "CNRI-Python" ]
null
null
null
WCPS-python-project/dsl.py
itsayeshanaeem/WCPSAccess
12b7a2f28a0f849a42336357723a57b6cb5905c9
[ "CNRI-Python" ]
null
null
null
WCPS-python-project/dsl.py
itsayeshanaeem/WCPSAccess
12b7a2f28a0f849a42336357723a57b6cb5905c9
[ "CNRI-Python" ]
null
null
null
# -*- coding: utf-8 -*- from pprint import pprint from ast_nodes import * def count(child): return ApplyExpr("count", child) def avg(child): return ApplyExpr("avg", child) def add(child): return ApplyExpr("add", child) def arcsin(child): return ApplyExpr("arcsin", child) def arccos(child): return ApplyExpr("arccos", child) def pow(child): return ApplyExpr("pow", child) def re(child): return ApplyExpr("re", child) def im(child): return ApplyExpr("im", child) def cos(child): return ApplyExpr("cos", child) def sin(child): return ApplyExpr("sin", child) def cosh(child): return ApplyExpr("cosh", child) def sinh(child): return ApplyExpr("sinh", child) def clip(child, wkt): return ClipExpr(child, wkt) def cast(totype, child): return CastExpr(totype, child) def quote_str(maybe_str): if isinstance(maybe_str, Expr): return maybe_str.emit() elif isinstance(maybe_str, str) and not maybe_str[0]=='$': return '"%s"'%(maybe_str,) else: return str(maybe_str) def ansi(*args): quoted = ['"%s"'%(x,) for x in args ] return Slice("ansi", quoted) def lon(*args): return Slice("Long", map(str, args)) def lat(*args): return Slice("Lat", map(str, args)) def axis(label, *args, **kwargs): """ Generates a slice over the dimension with name label TODO: add crs capability. Could use kwargs """ return Slice(label, map(quote_str, args), **kwargs) def encode(expr, fmt): """ Return expr as a string TODO: Check for fmt validity """ return EncodeAppExpr(expr, fmt) def switch(*args): """ switch case xxx """ if not all((isinstance(x, Case) or isinstance(x,Default) ) for x in args): raise TypeMismatch("can only contain case or default") return SwitchExpr(args) def case(cond, retval): return Case(cond, retval) def default(retval): """ THe default for the switch statement """ return Default(retval) def struct(**kwargs): return StructExpr(kwargs) def printE(): global _ENVIRONMENTS def wcps(fun): def wrapped(): global _ENVIRONMENTS fun() obj = _ENVIRONMENTS.pop() return obj.emit() return wrapped
28.592593
79
0.62133
300
2,316
4.753333
0.336667
0.100281
0.168303
0.014025
0
0
0
0
0
0
0
0.001145
0.246114
2,316
80
80
28.95
0.815578
0.097582
0
0.037736
0
0
0.049105
0
0
0
0
0.025
0
1
0.509434
false
0
0.037736
0.339623
0.811321
0.037736
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
746734a4533d2ac2c31f3a76edd925511b8ee4c3
3,389
py
Python
apps/dataupload/models.py
Sunbird-Ed/evolve-api
371b39422839762e32401340456c13858cb8e1e9
[ "MIT" ]
1
2019-02-27T15:26:11.000Z
2019-02-27T15:26:11.000Z
apps/dataupload/models.py
Sunbird-Ed/evolve-api
371b39422839762e32401340456c13858cb8e1e9
[ "MIT" ]
9
2019-12-16T10:09:46.000Z
2022-03-11T23:42:12.000Z
apps/dataupload/models.py
Sunbird-Ed/evolve-api
371b39422839762e32401340456c13858cb8e1e9
[ "MIT" ]
null
null
null
from django.db import models from apps.configuration.models import Book class Chapter(models.Model): book = models.ForeignKey(Book, on_delete=models.CASCADE) chapter = models.CharField(max_length=200) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) active=models.BooleanField(default=True) def __str__(self): return self.chapter class Meta: verbose_name='Chapter' verbose_name_plural='Chapter' class Section(models.Model): chapter = models.ForeignKey(Chapter, on_delete=models.CASCADE,null=False) section = models.CharField(max_length=200) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) active=models.BooleanField(default=True) def __str__(self): return self.section class Meta: verbose_name='Section' verbose_name_plural='Sections' class SubSection(models.Model): section = models.ForeignKey(Section, on_delete=models.CASCADE,null=False) sub_section = models.CharField(max_length=200) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) active=models.BooleanField(default=True) def __str__(self): return self.sub_section class Meta: verbose_name='Sub section' verbose_name_plural='Sub sections' class SubSubSection(models.Model): subsection = models.ForeignKey(SubSection, on_delete=models.CASCADE,null=False) sub_sub_section = models.CharField(max_length=200) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) active=models.BooleanField(default=True) def __str__(self): return self.sub_sub_section class Meta: verbose_name='Sub Sub section' verbose_name_plural='Sub Sub sections' class ChapterKeyword(models.Model): chapter = models.ForeignKey(Chapter, on_delete=models.CASCADE) keyword = models.CharField(max_length=200) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) def __str__(self): return self.keyword class Meta: verbose_name='Chapter keyword' verbose_name_plural='Chapter keywords' class SectionKeyword(models.Model): section = models.ForeignKey(Section, on_delete=models.CASCADE,null=False) keyword = models.CharField(max_length=200) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) def __str__(self): return self.keyword class Meta: verbose_name='Section keyword' verbose_name_plural='Section keywords' class SubSectionKeyword(models.Model): sub_section = models.ForeignKey(SubSection, on_delete=models.CASCADE,null=False) keyword = models.CharField(max_length=200) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) def __str__(self): return self.keyword class Meta: verbose_name='Sub section keyword' verbose_name_plural='Sub sections keywords' class SubSubSectionKeyword(models.Model): sub_sub_section = models.ForeignKey(SubSubSection, on_delete=models.CASCADE,null=False) keyword = models.CharField(max_length=200) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) def __str__(self): return self.keyword class Meta: verbose_name='Sub Sub section keyword' verbose_name_plural='Sub Sub sections keywords'
27.330645
53
0.79522
456
3,389
5.644737
0.111842
0.049728
0.130536
0.1554
0.8108
0.766123
0.73582
0.67871
0.67871
0.646853
0
0.007931
0.107111
3,389
124
54
27.330645
0.842697
0
0
0.595745
0
0
0.068732
0
0
0
0
0
0
1
0.085106
false
0
0.021277
0.085106
0.744681
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
74687b7af696af29d5cf402de814c62047159038
65
py
Python
class2/my_func2.py
brutalic/pynet_brutal
2afb94430dc9a19eeaf075460494a44e93fab683
[ "Apache-2.0" ]
null
null
null
class2/my_func2.py
brutalic/pynet_brutal
2afb94430dc9a19eeaf075460494a44e93fab683
[ "Apache-2.0" ]
null
null
null
class2/my_func2.py
brutalic/pynet_brutal
2afb94430dc9a19eeaf075460494a44e93fab683
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/python def hello2(): print "Hello world twice!"
10.833333
30
0.630769
9
65
4.555556
1
0
0
0
0
0
0
0
0
0
0
0.019231
0.2
65
5
31
13
0.769231
0.246154
0
0
0
0
0.382979
0
0
0
0
0
0
0
null
null
0
0
null
null
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
4
7471f95205db9cbdef49adc3c9cd3b4cf675501f
61
py
Python
test/output/069.py
EliRibble/pyfmt
e84a5531a7c06703eddd9dbc2072b0c8deae8c57
[ "MIT" ]
null
null
null
test/output/069.py
EliRibble/pyfmt
e84a5531a7c06703eddd9dbc2072b0c8deae8c57
[ "MIT" ]
null
null
null
test/output/069.py
EliRibble/pyfmt
e84a5531a7c06703eddd9dbc2072b0c8deae8c57
[ "MIT" ]
null
null
null
def hello(a: str, b, *args, c=None, **kwargs) -> None: pass
20.333333
54
0.590164
11
61
3.272727
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.180328
61
2
55
30.5
0.72
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
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
77b7b254930c08c474a0312a5b360180fe009de0
718
py
Python
ex035.py
LucasLCarreira/Python
03bd64837d74315687e567261a149f0176496348
[ "MIT" ]
1
2020-04-21T19:14:50.000Z
2020-04-21T19:14:50.000Z
ex035.py
LucasLCarreira/Python
03bd64837d74315687e567261a149f0176496348
[ "MIT" ]
null
null
null
ex035.py
LucasLCarreira/Python
03bd64837d74315687e567261a149f0176496348
[ "MIT" ]
null
null
null
# Exercício Python 035 # Leia o comprimento de 3 retas e diga se elas podem ou nao formar um triangulo a = int(input('Digite a reta 1: ')) b = int(input('Digite a reta 2: ')) c = int(input('Digite a reta 3: ')) if (b - c) < a and (b + c) > a: if (a - c) < b and (a + c) > b: if (a - b) < c and (a + b) > c: print('É possível formar um triangulo!') else: print('Não é possível formar um triangulo!') # Resolução do professor a = int(input('Digite a reta 1: ')) b = int(input('Digite a reta 2: ')) c = int(input('Digite a reta 3: ')) if a < b + c and b < a + c and c < a + b: print('É possível formar um triangulo!') else: print('Não é possível formar um triangulo!')
35.9
79
0.576602
128
718
3.234375
0.296875
0.115942
0.202899
0.217391
0.681159
0.647343
0.647343
0.647343
0.647343
0.647343
0
0.019194
0.274373
718
20
80
35.9
0.775432
0.168524
0
0.75
0
0
0.393939
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
0
0
0
null
0
1
1
0
0
0
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
77e9bf5e6891c613d43348f2b262a2556b2ad8e5
12,685
py
Python
src/exceptionite/solutions.py
girardinsamuel/exceptionite
583746493e1bdee4bb945b6a4c1a873b4f84fdb4
[ "MIT" ]
null
null
null
src/exceptionite/solutions.py
girardinsamuel/exceptionite
583746493e1bdee4bb945b6a4c1a873b4f84fdb4
[ "MIT" ]
null
null
null
src/exceptionite/solutions.py
girardinsamuel/exceptionite
583746493e1bdee4bb945b6a4c1a873b4f84fdb4
[ "MIT" ]
null
null
null
# flake8: noqa: E501 class DictionaryUpdateSequence: def title(self): return "Updating a dictionary with a set. " def description(self): return ( "Looks like you are trying to update a dictionary but are actually using a set. " "Double check what you are passing into the update method" ) def regex(self): return r"dictionary update sequence element #0 has length 3; 2 is required" class DictionaryUpdateSequenceWithList: def title(self): return "Updating a dictionary with a list. " def description(self): return ( "Looks like you are trying to update a dictionary but are actually using a list. " "Double check what you are passing into the update method" ) def regex(self): return r"cannot convert dictionary update sequence element #0 to a sequence" class ClassMethodExists: def title(self): return "Check the class method exists" def description(self): return ( "Check the :method attribute exists on the ':class' class. If this is a class you made then check the file its in and see if the method exists." "If this is a third party class then refer to the documentation." ) def regex(self): return r"^class \'(?P<class>([\w]*))\' has no attribute (?P<method>(\w+))" class ClassModelMethodExists: def title(self): return "Model method does not exist" def description(self): return "Could not find the ':method' method on the model class. Please check spelling. If this is a method you expect to be on the builder class then check the ORM documentation" def regex(self): return r"^class model \'(?P<class>([\w]*))\' has no attribute (?P<method>(\w+))" class ImportIssueWithController: def title(self): return "Import Error In Controller" def description(self): return ( "The :class controller could not be loaded into the route correctly. Check any recent imports or all imports in the controller. " "Worst case is you can import the controller directly in the route and you should get a python error." ) def regex(self): return r"named (?P<class>([\w]*)) has been found in" class IncorrectControllerName: def title(self): return "Mispelled Controller name" def description(self): return "The :class controller could be mispelled. Check your routes file for :class and make sure that is the correct spelling." def regex(self): return r"named (?P<class>([\w]*)) has been found in" class IncorrectlyDefinedRoute: def title(self): return "Check the controller and action is set correctly on the route." def description(self): return "Check the definition on the controller is correct. If using string controllers it should be in the format of 'Controller@action'" def regex(self): return r"named (?P<class>([\w]*)) has been found in" def documentation_link(self): return "https://docs.masoniteproject.com/the-basics/routing#creating-a-route" class RouteNameNotFound: def title(self): return "Check the the name exists in your routes file" def description(self): return """Check the routes file and make sure there is a route with the ".name(':name')\" method. You can also run `python craft routes:list` to see a table of routes. Check for your named route in that table.""" def regex(self): return r"Could not find route with the name \'(?P<name>([\w]*))\'" def documentation_link(self): return "https://docs.masoniteproject.com/the-basics/routing#name" class IncludedTemplateNotFound: def title(self): return "Check any imported templates inside the :name template." def description(self): return ( "The :name template was found but a template included inside the :name template was not found. " "Check any lines of code that use the extends or include Jinja2 tags inside your template. " "Check the template path is correct. Included templates are absolute from your template directory and should end with '.html'" ) def regex(self): return ( r"One of the included templates in the \'(?P<name>([\w]*))\' view could not be found" ) class UnexpectedEndBlock: def title(self): return "Check the :name was closed correctly." def description(self): return "The error could be difficult to find so check ALL :name tags and make sure the :name tag is opened and closed correctly. " def regex(self): return r"Unexpected end of template. Jinja was looking for the following tags: \'(?P<name>([\w]*))\'." class QueryDefaultValue: def title(self): return "Missing default value for ':field'" def description(self): return ( "Default values are typically set on the database level. " "You can either add a default value on the :field table column in a migration or you should pass a value when creating this record" ) def regex(self): return r"\(1364\, \"Field \'(?P<field>([\w]*))\' doesn't have a default value\"\)" class NoColumnExistsOnWhere: def title(self): return "Check the table for the :field column" def description(self): return "Could not find the :field column. Check your 'where' clauses. Is :field on the table you are trying to query? Did you run the migrations yet? Maybe it was not spelled correctly?" def regex(self): return r"Unknown column \'(?P<field>([\w\.]*))\' in \'where clause\'" class NoColumnExistsOnWhereSQLite: def title(self): return "Check the table for the :field column" def description(self): return "Could not find the :field column. Is :field on the table you are trying to query? Did you run the migrations yet? Maybe it was not spelled correctly?" def regex(self): return r"no such column: (?P<field>([\w\.]*))" class NoColumnExistsOnSelect: def title(self): return "Check the table for the :field column" def description(self): return "Could not find the :field column. Check your 'select' clauses. Is :field on the table you are trying to query? Did you run the migrations yet? Maybe it was not spelled correctly?" def regex(self): return r"Unknown column \'(?P<field>([\w\.]*))\' in \'field list\'" class UnsupportedOperand: def title(self): return "Trying to do math for values that are not of the same type (:type1 and :type2)" def description(self): return "Check the type of the 2 types. One is of type :type1 and the the other is of type :type2. They both need to be the same type" def regex(self): return r"unsupported operand type\(s\) for \+\: '(?P<type1>([\w\.]*))' and '(?P<type2>([\w\.]*))'" class ContainerKeyNotFoundRegister: def title(self): return "Did you register the key in the service provider or Kernel?" def description(self): return ( "Check the key name was correctly registered in a service provider or the Kernel file" ) def regex(self): return r"key was not found in the container" class ContainerKeyNotFoundServiceProvider: def title(self): return "Did you register the service provider?" def description(self): return "If you registered the key in your own service provider, did you register the provider in the config/providers.py file?" def regex(self): return r"key was not found in the container" def documentation_link(self): return "https://docs.masoniteproject.com/architecture/service-providers#registering-the-service-provider" class NotFound404: def title(self): return "The '/:route' route could not be found" def description(self): return "Could not find the '/:route' route. Try checking spelling is correct and the '/:route' is registered correctly in your routes files. You can also run 'python craft routes:list' to make sure the route shows up correctly" def regex(self): return r"(?P<route>([\w]*)) \: 404 Not Found" class InvalidRouteMethodType: def title(self): return "The method type is incorrect" def description(self): return "If this is a GET route, check if the route is actually defined as Route.post(). Or the opposite" def regex(self): return r"(?P<route>([\w]*)) \: 404 Not Found" class GetAttributeObject: def title(self): return "Check the class method exists" def description(self): return """ Double check the object you are using and make sure it has the ':attribute' attribute. If you are using a builtin python type then check Python documentation. If you are using your own class then check the available methods. """ def regex(self): return r"^'(?P<object>(\w+))' object has no attribute '(?P<attribute>(\w+))'" class NoModuleNamed: def title(self): return "Module Not Found Error" def description(self): return "This is an import error. Check the file where you imported the ': module' module. Make sure its spelled right and make sure you pip installed this module correctly if this is supposed to come from a PYPI package." def regex(self): return r"No module named '(?P<module>(\w+))'" class Syntax: def title(self): return "Syntax Error" def description(self): return "Syntax errors are usually simple to fix. Just find the place that has invalid Python syntax and fix it. A good place to look is in your :class file on line :line" def regex(self): return r"^invalid syntax \((?P<class>(\w+\.py))+, line (?P<line>(\w+))" class ImportIssue: def title(self): return "Import Issue" def description(self): return "This is an import error. Check the file where you imported the ':object' class and make sure it exists there." def regex(self): return r"^cannot import name '(?P<object>(\w+))'" class Undefined: def title(self): return "Undefined Variable" def description(self): return "You are trying to use a variable that cannot be found. Check the ':variable' variable and see if it is declared, imported or in the correct scope depending on what the variable is." def regex(self): return r"name '(?P<variable>(\w+))' is not defined" class WrongParameterCount: def title(self): return "Wrong Parameter Count" def description(self): return ( "You have the wrong amount of parameters for the ':object' object. " "It requires :correct parameters but you gave :wrong parameters. If the parameters are stored in a variable try checking the variable to the left. " "If you are passing variables in normally then check the signature of the object" ) def regex(self): return r"^(?P<object>(\w*))\(\) takes (?P<correct>(\d+)) positional (argument|arguments) but (?P<wrong>(\d+)) (were|was) given" class WrongConstructorParameterCount: def title(self): return "Wrong Parameters to a Constructor" def description(self): return ( "The ':object' object doesn't take parameters but you gave some anyway. " "Check the constructor of the ':object' object. It's likely it does not take any parameters. " "If its stored in a variable you can check the value to the left." ) def regex(self): return r"^(?P<object>(\w*))\(\) takes no parameters " class ObjectNotCallable: def title(self): return "Objects Cannot Be Called" def description(self): return ( "You cannot call objects. The ':object' object has already been instiatiated. " "Once an object is instantiated it cannot be called directly anymore. " "Check if the ':object' is instantiated already." ) def regex(self): return r"^'(?P<object>(\w*))' object is not callable" class SubscriptableIssue: def title(self): return "Object Not Subscriptable" def description(self): return "Looks like you expected ':object' to be an iterable but it is not. You can only use subscrptions, like x[0], on iterable type objects (like lists, dicts, and strings) but not ':object' in this case." def regex(self): return r"^'(?P<object>(\w+))' object is not subscriptable"
35.334262
235
0.656129
1,761
12,685
4.724588
0.183419
0.104567
0.040385
0.060577
0.414904
0.344591
0.307933
0.294712
0.265625
0.228365
0
0.003153
0.249901
12,685
358
236
35.432961
0.871256
0.001419
0
0.46473
0
0.099585
0.601816
0.024556
0
0
0
0
0
1
0.360996
false
0.016598
0.045643
0.360996
0.883817
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
1
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
77f9e9496467c8fe2e0822c05db37440f430e5ab
418
py
Python
excel_generator/excel_generator/__init__.py
estuaryoss/test-libs-python
db9d6acd25dce10fb4756ff42562c798c9fe87a0
[ "Apache-2.0" ]
null
null
null
excel_generator/excel_generator/__init__.py
estuaryoss/test-libs-python
db9d6acd25dce10fb4756ff42562c798c9fe87a0
[ "Apache-2.0" ]
null
null
null
excel_generator/excel_generator/__init__.py
estuaryoss/test-libs-python
db9d6acd25dce10fb4756ff42562c798c9fe87a0
[ "Apache-2.0" ]
null
null
null
"""Generate Excel from JSON input file Import the `Generator` to generate the Excel: >>> from excel_generator.generator import Generator >>> json_file = "results.json" >>> excel_file = "Results.xls" >>> generator = Generator(json_file=json_file, excel_file=excel_file) >>> generator.generate() See https://github.com/estuaryoss/test-libs-python/tree/master/excel_generator for more information """
41.8
99
0.732057
54
418
5.518519
0.462963
0.080537
0.114094
0
0
0
0
0
0
0
0
0
0.141148
418
9
100
46.444444
0.830084
0.980861
0
null
1
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
1
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
ae0102e22556c1fbb8d229224fdad54c3f385007
1,721
py
Python
configuration_py/tests/unit/test_get_file_extensions.py
Ferroman/configuration.py
c6fb46685a66d09bb17d76d3ce686ecef21769ac
[ "MIT" ]
5
2017-03-29T23:16:27.000Z
2021-09-02T10:08:57.000Z
configuration_py/tests/unit/test_get_file_extensions.py
Ferroman/configuration.py
c6fb46685a66d09bb17d76d3ce686ecef21769ac
[ "MIT" ]
null
null
null
configuration_py/tests/unit/test_get_file_extensions.py
Ferroman/configuration.py
c6fb46685a66d09bb17d76d3ce686ecef21769ac
[ "MIT" ]
1
2017-04-20T08:55:21.000Z
2017-04-20T08:55:21.000Z
from unittest import TestCase from configuration_py.configuration_load import _get_file_extensions class TestGetFileExtensions(TestCase): def test_should_return_list_of_extensions_for_given_path_to_file(self): file_path = '/path/to/config/file.yaml.tmpl' expected_value = ['yaml', 'tmpl'] actual_value = _get_file_extensions(file_path) self.assertEqual(actual_value, expected_value) def test_should_return_list_of_extensions_for_windows_path(self): file_path = 'C:\\path\\to\\config\\file.yaml.tmpl' expected_value = ['yaml', 'tmpl'] actual_value = _get_file_extensions(file_path) self.assertEqual(actual_value, expected_value) def test_should_return_list_of_extensions_for_file_name(self): file_path = 'config/file.yaml.tmpl' expected_value = ['yaml', 'tmpl'] actual_value = _get_file_extensions(file_path) self.assertEqual(actual_value, expected_value) def test_should_return_list_of_extensions_for_file_name_with_one_extension(self): file_path = 'config/file.yaml' expected_value = ['yaml'] actual_value = _get_file_extensions(file_path) self.assertEqual(actual_value, expected_value) def test_should_return_empty_list_for_file_name_without_extension(self): file_path = 'config/file' expected_value = [] actual_value = _get_file_extensions(file_path) self.assertEqual(actual_value, expected_value) def test_should_return_empty_list_for_empty_file_path(self): file_path = '' expected_value = [] actual_value = _get_file_extensions(file_path) self.assertEqual(actual_value, expected_value)
35.854167
85
0.732132
219
1,721
5.237443
0.173516
0.090671
0.103749
0.09939
0.79599
0.79599
0.727986
0.727986
0.694856
0.694856
0
0
0.186519
1,721
47
86
36.617021
0.819286
0
0
0.515152
0
0
0.08251
0.050552
0
0
0
0
0.181818
1
0.181818
false
0
0.060606
0
0.272727
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
bb281fe5e6d2a63178c70bc0ee71f4bc43e32d59
75
py
Python
A.py
knaik/RpiScratch
db23bc2f48bbe27370cacdb29e9ec564e4b4efa5
[ "MIT" ]
null
null
null
A.py
knaik/RpiScratch
db23bc2f48bbe27370cacdb29e9ec564e4b4efa5
[ "MIT" ]
null
null
null
A.py
knaik/RpiScratch
db23bc2f48bbe27370cacdb29e9ec564e4b4efa5
[ "MIT" ]
null
null
null
print("hello world") # code server works with android but not iPhone jnnmj
18.75
47
0.773333
12
75
4.833333
1
0
0
0
0
0
0
0
0
0
0
0
0.16
75
3
48
25
0.920635
0.6
0
0
0
0
0.392857
0
0
0
0
0
0
1
0
true
0
0
0
0
0.5
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
0
1
0
4
bb33dfde0f6646bfdb624a668661f855a8c29631
577
py
Python
mpk/views.py
Machina123/PythonAssignment
c1fa274810887350735c958c55462d236146ef8f
[ "MIT" ]
null
null
null
mpk/views.py
Machina123/PythonAssignment
c1fa274810887350735c958c55462d236146ef8f
[ "MIT" ]
null
null
null
mpk/views.py
Machina123/PythonAssignment
c1fa274810887350735c958c55462d236146ef8f
[ "MIT" ]
null
null
null
from django.http import HttpResponse import json import requests from . import stops def index(request): return HttpResponse("Hello World") def get_departures(request): if "stop" in request.GET: req = requests.get(stops.MPK_ENDPOINT_DEPARTS + "?stop=" + request.GET["stop"] + "&mode=departure") return HttpResponse(json.dumps(req.json())) else: return HttpResponse(json.dumps({"success": False, "error": "No stop specified"})) def get_stops(request): return HttpResponse(json.dumps({v: k for k, v in stops.MPK_TRAMSTOPS.items()}))
27.47619
107
0.694974
76
577
5.210526
0.486842
0.181818
0.166667
0.204545
0
0
0
0
0
0
0
0
0.169844
577
20
108
28.85
0.826722
0
0
0
0
0
0.119584
0
0
0
0
0
0
1
0.214286
false
0
0.285714
0.142857
0.785714
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
24819c2b6dc08ee2e6c03f518da28f5cb64219e3
71
py
Python
studies/2016-09-05_1205 Context/a02 module-scope variables/mod2.py
friedrichromstedt/upy
4b6b890259fb34bc69265fc400881587157b03a3
[ "MIT" ]
3
2015-06-01T23:09:38.000Z
2015-10-06T13:14:23.000Z
studies/2016-09-05_1205 Context/a02 module-scope variables/mod2.py
friedrichromstedt/upy
4b6b890259fb34bc69265fc400881587157b03a3
[ "MIT" ]
null
null
null
studies/2016-09-05_1205 Context/a02 module-scope variables/mod2.py
friedrichromstedt/upy
4b6b890259fb34bc69265fc400881587157b03a3
[ "MIT" ]
null
null
null
import mod from mod import access mod.registry[1] = 2 print access(1)
11.833333
22
0.746479
13
71
4.076923
0.615385
0
0
0
0
0
0
0
0
0
0
0.050847
0.169014
71
5
23
14.2
0.847458
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.5
null
null
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
4
24896fe979f00306685a61449b075be61afbf254
4,439
py
Python
tests/test_ratio.py
tocoli/tocolib
1ff7080077021a444bb14e3386e579eb1f018d53
[ "MIT" ]
null
null
null
tests/test_ratio.py
tocoli/tocolib
1ff7080077021a444bb14e3386e579eb1f018d53
[ "MIT" ]
null
null
null
tests/test_ratio.py
tocoli/tocolib
1ff7080077021a444bb14e3386e579eb1f018d53
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from tocoli.ratio import * from tocoli import ratio hello = u'Hello' world = u'World' class TestRatios(unittest.TestCase): # @unittest.skip("skip this test") def test_count_equal_chars(self): self.assertRaises(TypeError, count_equal_chars, None, None) res = count_equal_chars('', '') self.assertEqual(res, 0) res = count_equal_chars('a', 'b') self.assertEqual(res, 0) res = count_equal_chars('a', 'a') self.assertEqual(res, 1) res = count_equal_chars(u'a', u'a') self.assertEqual(res, 1) res = count_equal_chars(hello, world) self.assertEqual(res, 2) res = count_equal_chars(world, hello) self.assertEqual(res, 2) # @unittest.skip("skip this test") def test_equal(self): res = equal(hello, world) self.assertEqual(res, 2/float(5)) res = equal(world, hello) self.assertEqual(res, 2/float(5)) # @unittest.skip("skip this test") def test_meta(self): # one function res = meta(hello, world, [equal], [1]) self.assertEqual(res, 0.4) res = meta(world, hello, [equal], [1]) self.assertEqual(res, 0.4) res = meta(hello, world, [equal], [0.5]) self.assertEqual(res, 0.4) res = meta(world, hello, [equal], [0.5]) self.assertEqual(res, 0.4) # two functions (same) res = meta(hello, world, [equal, equal], [1, 1]) self.assertEqual(res, 0.4) res = meta(world, hello, [equal, equal], [1, 1]) self.assertEqual(res, 0.4) res = meta(hello, world, [equal, equal], [0.5, 1]) self.assertEqual(res, 0.4000000000000001) res = meta(world, hello, [equal, equal], [0.5, 1]) self.assertEqual(res, 0.4000000000000001) res = meta(hello, world, [equal, equal], [1, 2]) self.assertEqual(res, 0.4000000000000001) res = meta(world, hello, [equal, equal], [1, 2]) self.assertEqual(res, 0.4000000000000001) # two functions (different) res = meta(hello, world, [equal, levenshtein], [1, 1]) self.assertEqual(res, 0.30000000000000004) res = meta(world, hello, [equal, levenshtein], [1, 1]) self.assertEqual(res, 0.30000000000000004) res = meta(hello, world, [equal, levenshtein], [0.5, 1]) self.assertEqual(res, 0.26666666666666666) res = meta(world, hello, [equal, levenshtein], [0.5, 1]) self.assertEqual(res, 0.26666666666666666) res = meta(hello, world, [equal, levenshtein], [1, 2]) self.assertEqual(res, 0.26666666666666666) res = meta(world, hello, [equal, levenshtein], [1, 2]) self.assertEqual(res, 0.26666666666666666) # @unittest.skip("skip this test") def test_similarity(self): res = similarity(hello, world) self.assertEqual(res, 0.30000000000000004) res = similarity(world, hello) self.assertEqual(res, 0.30000000000000004) res = similarity(hello, u'ello') self.assertEqual(res, 0.7444444444444445) res = similarity(hello, u'bello') self.assertEqual(res, 0.7) res = similarity(hello, u'trello') self.assertEqual(res, 0.6136363636363636) res = similarity(hello, u'resello') self.assertEqual(res, 0.5476190476190476) res = similarity(hello, u'schnello') self.assertEqual(res, 0.4951923076923077) # weights (equal, levenshtein) res = similarity(hello, u'ello', (1,4)) self.assertEqual(res, 0.831111111111111) res = similarity(hello, u'bello', (1,4)) self.assertEqual(res, 0.76) res = similarity(hello, u'trello', (1,4)) self.assertEqual(res, 0.6818181818181819) res = similarity(hello, u'resello', (1,4)) self.assertEqual(res, 0.619047619047619) res = similarity(hello, u'schnello', (1,4)) self.assertEqual(res, 0.5673076923076923) # @unittest.skip("skip this test") def test_median(self): from tocoli.ratio import median res = median([1, 3, 5]) self.assertEqual(res, 3.0) res = median([1, 3, 5, 7]) self.assertEqual(res, 4.0) res = median([7, 12, 3, 1, 6, 9]) self.assertEqual(res, 6.5) if __name__ == '__main__': unittest.main()
27.918239
67
0.594278
551
4,439
4.735027
0.136116
0.224224
0.269069
0.218475
0.719433
0.605213
0.512074
0.390571
0.381372
0.280951
0
0.133374
0.260194
4,439
158
68
28.094937
0.661084
0.066682
0
0.27957
0
0
0.020329
0
0
0
0
0
0.430108
1
0.053763
false
0
0.043011
0
0.107527
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
24bdc09b31c8ce5a2ce7448289fb9645fcbd77cd
246
py
Python
restkit/handlers/http_mrg_handlers/http_report_handlers/collect_modules.py
ppolxda/restkit
eeb6177ccd75f8ba7b2faa252116f1e745d0f91b
[ "MIT" ]
null
null
null
restkit/handlers/http_mrg_handlers/http_report_handlers/collect_modules.py
ppolxda/restkit
eeb6177ccd75f8ba7b2faa252116f1e745d0f91b
[ "MIT" ]
null
null
null
restkit/handlers/http_mrg_handlers/http_report_handlers/collect_modules.py
ppolxda/restkit
eeb6177ccd75f8ba7b2faa252116f1e745d0f91b
[ "MIT" ]
null
null
null
from restkit.handlers.http_mrg_handlers import query_handler as chandler_0 # noqa from restkit.handlers.http_mrg_handlers.http_report_handlers import report_csv_handler as chandler_1 # noqa __all__ = [ 'chandler_0', 'chandler_1', ]
22.363636
108
0.788618
35
246
5.057143
0.457143
0.20339
0.214689
0.259887
0.384181
0.384181
0
0
0
0
0
0.019048
0.146341
246
10
109
24.6
0.82381
0.036585
0
0
0
0
0.086207
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
24c0597ad18cf7e59a8f98085109bfa7f0d4c0f0
23,307
py
Python
SG/pipeline/py/old/pipeline.fromQuPath.py
BiCroLab/WSI-analysis
9f55a7a5296d006f2da8adfb2fe6a22eebe3dc42
[ "MIT" ]
null
null
null
SG/pipeline/py/old/pipeline.fromQuPath.py
BiCroLab/WSI-analysis
9f55a7a5296d006f2da8adfb2fe6a22eebe3dc42
[ "MIT" ]
null
null
null
SG/pipeline/py/old/pipeline.fromQuPath.py
BiCroLab/WSI-analysis
9f55a7a5296d006f2da8adfb2fe6a22eebe3dc42
[ "MIT" ]
null
null
null
#!/usr/bin/env python import networkx as nx import numpy as np from graviti import * import sys from scipy import sparse, linalg import os import copy import seaborn as sns; sns.set() import matplotlib matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! import matplotlib.pyplot as plt filename = sys.argv[1] # name of the morphology mesearements from qupath radius = int(sys.argv[2]) # for smoothing rndsample = int(sys.argv[3]) # for community detection stochasticity basename_graph = os.path.splitext(os.path.basename(filename))[0] if os.path.splitext(os.path.basename(filename))[1] == '.gz': basename = os.path.splitext(os.path.splitext(os.path.basename(filename))[0])[0]+'.r'+str(radius)+'.s'+str(rndsample) dirname = os.path.dirname(filename) #################################################################################################### # Construct the UMAP graph # and save the adjacency matrix # and the degree and clustering coefficient vectors ################################################################################################### print('Prepare the topological graph ...') nn = 10 # this is hardcoded at the moment path = os.path.join(dirname, basename_graph)+'.nn'+str(nn)+'.adj.npz' if os.path.exists(path) and os.path.exists( os.path.join(dirname, basename_graph) + ".graph.pickle" ): print('The graph exists already') A = sparse.load_npz(path) #id...graph.npz pos = np.loadtxt(filename, delimiter="\t",skiprows=True,usecols=(5,6)) # here there is no header G = nx.read_gpickle(os.path.join(dirname, basename_graph) + ".graph.pickle") d = getdegree(G) cc = clusteringCoeff(A) else: print('The graph does not exists yet') pos = np.loadtxt(filename, delimiter="\t",skiprows=True,usecols=(5,6)) # here there is no header A = space2graph(pos,nn) sparse.save_npz(path, A) G = nx.from_scipy_sparse_matrix(A, edge_attribute='weight') d = getdegree(G) cc = clusteringCoeff(A) outfile = os.path.join(dirname, basename_graph)+'.nn'+str(nn)+'.degree.gz' np.savetxt(outfile, d) outfile = os.path.join(dirname, basename_graph)+'.nn'+str(nn)+'.cc.gz' np.savetxt(outfile, cc) nx.write_gpickle(G, os.path.join(dirname, basename_graph) + ".graph.pickle") pos2norm = np.linalg.norm(pos,axis=1).reshape((pos.shape[0],1)) # the modulus of the position vector to preserve translational invariance print('Topological graph ready!') print('The graph has '+str(A.shape[0])+' nodes') #################################################################################################### # Select the morphological features, # and set the min number of nodes per subgraph ################################################################################################### print('Prepare the morphology array') # Features list = Nucleus:_Area Nucleus:_Perimeter Nucleus:_Circularity Nucleus:_Eccentricity Nucleus:_Hematoxylin_OD_mean Nucleus:_Hematoxylin_OD_sum from sklearn.preprocessing import normalize # morphology = np.loadtxt(filename, delimiter="\t", skiprows=True, usecols=(7,8,9,12,13,14)).reshape((A.shape[0],6)) morphology = np.loadtxt(filename, delimiter="\t", skiprows=True, usecols=(7,9,12,14)).reshape((A.shape[0],4)) # morphology = np.loadtxt(filename, delimiter="\t", skiprows=True, usecols=(7,9,12)).reshape((A.shape[0],3)) threshold = max(radius,(morphology.shape[1]+4)*2) # set the min subgraph size based on the dim of the feature matrix # #################################################################################################### # # Smooth the morphology # ################################################################################################### # print('Smooth the morphology') # outfile = os.path.join(dirname, basename)+'.smooth' # if os.path.exists(outfile+'.npy'): # morphology_smooth = np.load(outfile+'.npy', allow_pickle=True) # else: # morphology_smooth = smoothing(A, morphology, radius) # np.save(outfile, morphology_smooth) #################################################################################################### # Reweight the graph ################################################################################################### print('Rescale graph weights by local morphology') print('...use the raw morphology...') morphology_normed = normalize(morphology, norm='l1', axis=0) # normalize features GG = copy.deepcopy(G) for ijw in G.edges(data='weight'): feature = np.asarray([ abs(morphology_normed[ijw[0],f]-morphology_normed[ijw[1],f]) for f in range(morphology_normed.shape[1]) ]) # array of morphology features GG[ijw[0]][ijw[1]]['weight'] = ijw[2]/(1.0+np.sum(feature)) # the new graph weights is the ratio between the current and the sum of the neightbours differences #################################################################################################### # Community detection ################################################################################################### print('Find the communities in GG') from cdlib import algorithms from cdlib import evaluation from cdlib.utils import convert_graph_formats import igraph import leidenalg from networkx.algorithms.community.quality import modularity print('...generate connected components as subgraphs...') graphs = list(nx.connected_component_subgraphs(GG)) print('...convert networkx graph to igraph object...') communities = [] for graph in graphs: nx.write_weighted_edgelist(graph, basename+".edgelist.txt") g = igraph.Graph.Read_Ncol(basename+".edgelist.txt", names=True, weights="if_present", directed=False) os.remove(basename+".edgelist.txt") part = leidenalg.find_partition(g, leidenalg.ModularityVertexPartition,initial_membership=None, weights='weight', seed=rndsample, n_iterations=2) communities.extend([g.vs[x]['name'] for x in part]) print( 'The number of communities is '+str(len(communities)) ) bigcommunities = [g for g in communities if len(g) > threshold] # list of big enough communities outfile = os.path.join(dirname, basename)+'.bigcommunities' np.save(outfile, bigcommunities) print('There are '+str(len(bigcommunities))+' big communities and '+str(len(communities))+' communities in total') #################################################################################################### # Generate the covariance descriptors # this can be done with respect to raw features or smoothed ones ################################################################################################### print('Generate the covariance descriptor') #!!! Should positions be included? !!! # features = np.hstack((pos2norm,morphology)) # this is rotational invariant features = morphology # this is rotational invariant outfile_covd = os.path.join(dirname, basename)+'.covd.npy' if os.path.exists(outfile_covd): print('... loading the descriptors ...') covdata = np.load(outfile_covd,allow_pickle=True) else: print('... creating the descriptors ...') # !!! you can use G or GG here !!! covdata = community_covd(features,G,bigcommunities) # get list of cov matrices and a list of nodes per matrix np.save(outfile_covd,covdata) print('There are '+str(len(covdata))+' covariance descriptors ') #################################################################################################### # Cluster the covariance descriptors ################################################################################################### print('Clustering the descriptors') import umap import hdbscan import sklearn.cluster as cluster from sklearn.cluster import OPTICS from sklearn.metrics import adjusted_rand_score, adjusted_mutual_info_score from sklearn.cluster import AgglomerativeClustering from sklearn.cluster import SpectralClustering print('...prepare the data...') outfile_logvec = os.path.join(dirname, basename)+'.logvec.npy' if os.path.exists(outfile_logvec): print('...load the logvec dataset...') X = np.load(outfile_logvec,allow_pickle=True) else: print('...create the logvec dataset...') logvec = [ linalg.logm(m).reshape((1,covdata[0].shape[0]*covdata[0].shape[1])) for m in covdata] #calculate the logm and vectorize X = np.vstack(logvec) #create the array of vectorized covd data np.save(outfile_logvec,X) print('The vectorized covd array has shape '+str(X.shape)) outfile_clusterable_embedding = os.path.join(dirname, basename)+'.clusterable_embedding.npy' if os.path.exists(outfile_clusterable_embedding): print('...load the clusterable embedding...') clusterable_embedding = np.load(outfile_clusterable_embedding,allow_pickle=True) else: print('...create the clusterable embedding...') clusterable_embedding = umap.UMAP(min_dist=0.0,n_components=3,random_state=42).fit_transform(X) # this is used to identify clusters np.save(outfile_clusterable_embedding,clusterable_embedding) print('The embedding has shape '+str(clusterable_embedding.shape)) # #################################################################################################### # # Free up spaces # ################################################################################################### # del G # G is not needed anymore # del A # A is not needed anymore # del morphology # #################################################################################################### # # Color graph nodes by community label # ################################################################################################### # print('Preparing to color the graph communities') # print('...set up the empty graph...') # g = nx.Graph() # g.add_nodes_from(range(pos.shape[0])) # add all the nodes of the graph, but not all of them are in a covd cluster because of small communities # print('...set up the empty dictionary...') # dictionary = {} # for node in range(pos.shape[0]): # dictionary[int(node)] = -1 # set all node to -1 # print('...set up the full dictionary...') # node_comm_tuples = [(int(node),i) for i, community in enumerate(bigcommunities) for node in community] # dictionary.update(dict(node_comm_tuples)) # node_color = [] # for i in sorted (dictionary) : # determine the color based on the community # node_color.append(dictionary[i]) # print('...draw the graph...') # sns.set(style='white', rc={'figure.figsize':(50,50)}) # nx.draw_networkx_nodes(g, pos, alpha=0.5,node_color=node_color, node_size=1,cmap=plt.cm.Set1) # print('...saving graph...') # plt.axis('off') # plt.savefig(os.path.join(dirname, basename)+'.community_graph.png') # save as png # plt.close() # #################################################################################################### # # Reweight the graph # ################################################################################################### # print('Rescale graph weights by local morphology') # print('...use the raw morphology...') # morphology_normed = normalize(morphology, norm='l1', axis=0) # normalize features # GG = copy.deepcopy(G) # for ijw in G.edges(data='weight'): # feature = np.asarray([ abs(morphology_normed[ijw[0],f]-morphology_normed[ijw[1],f]) for f in range(morphology_normed.shape[1]) ]) # array of morphology features # GG[ijw[0]][ijw[1]]['weight'] = ijw[2]/(1.0+np.sum(feature)) # the new graph weights is the ratio between the current and the sum of the neightbours differences # #################################################################################################### # # Community detection # ################################################################################################### # print('Find the communities in GG') # from cdlib import algorithms # from cdlib import evaluation # from cdlib.utils import convert_graph_formats # import igraph # import leidenalg # from networkx.algorithms.community.quality import modularity # print('...generate connected components as subgraphs...') # graphs = list(nx.connected_component_subgraphs(GG)) # print('...convert networkx graph to igraph object...') # communities = [] # for graph in graphs: # nx.write_weighted_edgelist(graph, basename+".edgelist.txt") # g = igraph.Graph.Read_Ncol(basename+".edgelist.txt", names=True, weights="if_present", directed=False) # os.remove(basename+".edgelist.txt") # part = leidenalg.find_partition(g, leidenalg.ModularityVertexPartition,initial_membership=None, weights='weight', seed=rndsample, n_iterations=2) # communities.extend([g.vs[x]['name'] for x in part]) # print( 'The number of communities is '+str(len(communities)) ) # bigcommunities = [g for g in communities if len(g) > threshold] # list of big enough communities # outfile = os.path.join(dirname, basename)+'.bigcommunities' # np.save(outfile, bigcommunities) # print('There are '+str(len(bigcommunities))+' big communities and '+str(len(communities))+' communities in total') # #################################################################################################### # # Generate the covariance descriptors # # this can be done with respect to raw features or smoothed ones # ################################################################################################### # print('Generate the covariance descriptor') # features = np.hstack((pos2norm,morphology)) # this is rotational invariant # outfile_covd = os.path.join(dirname, basename)+'.covd.npy' # if os.path.exists(outfile_covd): # print('... loading the descriptors ...') # covdata = np.load(outfile_covd,allow_pickle=True) # else: # print('... creating the descriptors ...') # covdata = community_covd(features,G,bigcommunities) # get list of cov matrices and a list of nodes per matrix # np.save(outfile_covd,covdata) # print('There are '+str(len(covdata))+' covariance descriptors ') # #################################################################################################### # # Cluster the covariance descriptors # ################################################################################################### # print('Clustering the descriptors') # import umap # import hdbscan # import sklearn.cluster as cluster # from sklearn.cluster import OPTICS # from sklearn.metrics import adjusted_rand_score, adjusted_mutual_info_score # from sklearn.cluster import AgglomerativeClustering # from sklearn.cluster import SpectralClustering # print('...prepare the data...') # outfile_logvec = os.path.join(dirname, basename)+'.logvec.npy' # if os.path.exists(outfile_logvec): # print('...load the logvec dataset...') # X = np.load(outfile_logvec,allow_pickle=True) # else: # print('...create the logvec dataset...') # logvec = [linalg.logm(m).reshape((1,covdata[0].shape[0]*covdata[0].shape[1])) for m in covdata] #calculate the logm and vectorize # X = np.vstack(logvec) #create the array of vectorized covd data # np.save(outfile_logvec,X) # print('The vectorized covd array has shape '+str(X.shape)) # outfile_clusterable_embedding = os.path.join(dirname, basename)+'.clusterable_embedding.npy' # if os.path.exists(outfile_clusterable_embedding): # print('...load the clusterable embedding...') # clusterable_embedding = np.load(outfile_clusterable_embedding,allow_pickle=True) # else: # print('...create the clusterable embedding...') # clusterable_embedding = umap.UMAP(min_dist=0.0,n_components=3,random_state=42).fit_transform(X) # this is used to identify clusters # np.save(outfile_clusterable_embedding,clusterable_embedding) # print('The embedding has shape '+str(clusterable_embedding.shape)) # #################################################################################################### # # Free up spaces # ################################################################################################### # del G # G is not needed anymore # del A # A is not needed anymore # del morphology # #################################################################################################### # # Color graph nodes by community label # ################################################################################################### # print('Preparing to color the graph communities') # print('...set up the empty graph...') # g = nx.Graph() # g.add_nodes_from(range(pos.shape[0])) # add all the nodes of the graph, but not all of them are in a covd cluster because of small communities # print('...set up the empty dictionary...') # dictionary = {} # for node in range(pos.shape[0]): # dictionary[int(node)] = -1 # set all node to -1 # print('...set up the full dictionary...') # node_comm_tuples = [(int(node),i) for i, community in enumerate(bigcommunities) for node in community] # dictionary.update(dict(node_comm_tuples)) # node_color = [] # for i in sorted (dictionary) : # determine the color based on the community # node_color.append(dictionary[i]) # print('...draw the graph...') # sns.set(style='white', rc={'figure.figsize':(50,50)}) # nx.draw_networkx_nodes(g, pos, alpha=0.5,node_color=node_color, node_size=1,cmap=plt.cm.Set1) # print('...saving graph...') # plt.axis('off') # plt.savefig(os.path.join(dirname, basename)+'.community_graph.png') # save as png # plt.close() # ################################################################################################### # ################################################################################################### # # # print('...cluster the descriptors...') # # # labels = hdbscan.HDBSCAN(min_samples=50,min_cluster_size=100).fit_predict(clusterable_embedding) # # labels = OPTICS(min_samples=50, xi=.01, min_cluster_size=.05).fit_predict(clusterable_embedding) # cluster label vector of covmatrices # # # labels = AgglomerativeClustering(n_clusters=4).fit_predict(clusterable_embedding) # # # labels = SpectralClustering(n_clusters=3,assign_labels="discretize",random_state=42).fit_predict(clusterable_embedding) # mem demanding # # outfile_cluster_labels = os.path.join(dirname, basename)+'.cluster_labels.npy' # # np.save(outfile_cluster_labels, labels) # # print('There are '+str(len(set(labels)))+' clusters:'+str(set(labels))) # # cluster_features = cluster_morphology(morphology_smooth,graph2covd,labels) # # outfile_cluster_features = os.path.join(dirname, basename)+'.cluster_features.npy' # # print('The shape of the cluster feature matrix is ',str(cluster_features.shape)) # # np.save(outfile_cluster_features, cluster_features) # # print('...plot the clusters...') # # clusteredD = (labels >= 0) # # non_clusteredD = (labels < 0) # # print(str(sum(clusteredD))+' descriptors clustered of '+str(labels.shape[0])+' in total') # # print(str(sum(non_clusteredD))+' descriptors NOT clustered of '+str(labels.shape[0])+' in total') # # plt.scatter(clusterable_embedding[:, 0], # # clusterable_embedding[:, 1], # # c='k',#(0.5, 0.5, 0.5), # # s=0.1, # # alpha=0.5) # # plt.scatter(clusterable_embedding[~clusteredD, 0], # # clusterable_embedding[~clusteredD, 1], # # c='k',#(0.5, 0.5, 0.5), # # s=0.1, # # alpha=0.5) # # plt.scatter(clusterable_embedding[clusteredD, 0], # # clusterable_embedding[clusteredD, 1], # # c=labels[clusteredD], # # s=0.1, # # cmap='viridis'); # # outfile = os.path.join(dirname, basename)+'.covd-clustering.png' # # plt.savefig(outfile) # save as png # # plt.close() # # #################################################################################################### # # # Color nodes by labels # # ################################################################################################### # # print('Color the graph by descriptor cluster') # # node_cluster_color = -1.0*np.ones(A.shape[0]) #check # # ind = 0 # this is the subgraph label # # for nodes in graph2covd: # for each subgraph and corresponding covariance matrix # # node_cluster_color[nodes] = labels[ind] # update node_color with cluster labels for each node in the subgraph # # ind += 1 # # clusteredN = (node_cluster_color >= 0) # bolean array with true for clustered nodes and false for the rest # # print(str(sum(clusteredN))+' nodes clustered of '+str(clusteredN.shape[0])+' in total') # # non_clusteredN = (node_cluster_color < 0) # bolean array with true for clustered nodes and false for the rest # # print(str(sum(non_clusteredN))+' nodes NOT clustered of '+str(clusteredN.shape[0])+' in total') # # clustered_nodes = np.asarray(list(G.nodes))[clusteredN] # # clustered_nodes_color = node_cluster_color[clusteredN] # # subG = G.subgraph(clustered_nodes) # # sns.set(style='white', rc={'figure.figsize':(50,50)}) # # nx.draw_networkx_nodes(subG, pos, alpha=0.5,node_color=clustered_nodes_color, node_size=1,cmap='viridis') # # plt.margins(0,0) # # plt.gca().xaxis.set_major_locator(plt.NullLocator()) # # plt.gca().yaxis.set_major_locator(plt.NullLocator()) # # plt.axis('off') # # outfile = os.path.join(dirname, basename)+'.node-clustering.png' # # plt.savefig(outfile, dpi=100) # save as png # # # plt.savefig(outfile, dpi=100,bbox_inches = 'tight', pad_inches = 0.5) # save as png # # plt.close() # # #################################################################################################### # # # Color nodes not clustered before # # ################################################################################################### # # print('Determine the connected components of the non clustered nodes') # # non_clustered_nodes = np.asarray(list(G.nodes))[non_clusteredN] # # subGnot = G.subgraph(non_clustered_nodes) # # graphs = [g for g in list(nx.connected_component_subgraphs(subGnot)) if g.number_of_nodes()>=20] # # print('Determine covariance matrix of the non clustered connected components') # # covdata, graph2covd = covd_multifeature(features,G,graphs) # # logvec = [linalg.logm(m).reshape((1,covdata[0].shape[0]*covdata[0].shape[1])) for m in covdata] #calculate the logm and vectorize # # X_nonclustered = np.vstack(logvec) #create the array of vectorized covd data # # print('Cluster the other connected components by finding the min distance to the clustered subgraphs') # # from scipy import spatial # # reference = X[clusteredD,:] # # tree = spatial.KDTree(reference) # # for row_ind in range(X_nonclustered.shape[0]): # # index = tree.query(X_nonclustered[row_ind,:])[1] # # for nodes in graph2covd: # # node_cluster_color[nodes] = labels[index] # # sns.set(style='white', rc={'figure.figsize':(50,50)}) # # nx.draw_networkx_nodes(G, pos, alpha=0.5,node_color=node_cluster_color, node_size=1,cmap='viridis') # # plt.margins(0,0) # # plt.gca().xaxis.set_major_locator(plt.NullLocator()) # # plt.gca().yaxis.set_major_locator(plt.NullLocator()) # # plt.axis('off') # # outfile = os.path.join(dirname, basename)+'.all-node-clustering.png' # # plt.savefig(outfile, dpi=100) # save as png # # # plt.savefig(outfile, dpi=100,bbox_inches = 'tight', pad_inches = 0.5) # save as png # # plt.close()
50.122581
166
0.598533
2,749
23,307
4.982175
0.14478
0.017085
0.016063
0.027307
0.751898
0.73182
0.71656
0.706411
0.681805
0.673043
0
0.010704
0.126142
23,307
464
167
50.230603
0.661757
0.575621
0
0.086207
0
0
0.1748
0.004421
0
0
0
0
0
1
0
false
0
0.206897
0
0.206897
0.215517
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
24d9c3651d12945dfd5c6b2e2bcb6cddf24ab3d2
143
py
Python
autokey/data/Bspc/node_width_decrease.py
Curiosidad-Racional/.config
af5a8901510e4b87dff1be024d3d29987c148f3f
[ "MIT" ]
2
2021-05-29T18:11:26.000Z
2021-10-21T20:53:16.000Z
autokey/data/Bspc/node_width_decrease.py
Curiosidad-Racional/.config
af5a8901510e4b87dff1be024d3d29987c148f3f
[ "MIT" ]
null
null
null
autokey/data/Bspc/node_width_decrease.py
Curiosidad-Racional/.config
af5a8901510e4b87dff1be024d3d29987c148f3f
[ "MIT" ]
null
null
null
from subprocess import run p = run("bspc node -z left 20 0", shell=True) if p.returncode != 0: run("bspc node -z right -20 0", shell=True)
28.6
47
0.664336
27
143
3.518519
0.592593
0.147368
0.231579
0.252632
0
0
0
0
0
0
0
0.06087
0.195804
143
5
47
28.6
0.765217
0
0
0
0
0
0.319444
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
24df1f4661716e15e9d58d54c5bf448a113f41bf
613
py
Python
examplequeries.py
ConflictGK/CodeCatch-RSSE
b0901a79615653403d09936327f79abfb49114b3
[ "MIT" ]
2
2017-10-18T21:47:52.000Z
2017-10-18T22:13:58.000Z
examplequeries.py
ConflictGK/Codecatch-RSSE
b0901a79615653403d09936327f79abfb49114b3
[ "MIT" ]
null
null
null
examplequeries.py
ConflictGK/Codecatch-RSSE
b0901a79615653403d09936327f79abfb49114b3
[ "MIT" ]
3
2019-01-30T04:34:42.000Z
2019-04-11T04:24:03.000Z
import os class ExampleResults: def __init__(self, cwd): self.example_queries = [] self.EXPERIMENTS_DIR = cwd + os.path.sep + "experiments" + os.path.sep def read_example_queries(self): if not self.example_queries: self.example_queries = [] with open(self.EXPERIMENTS_DIR + "queries.txt") as infile: for line in infile: line = line.strip() if line: self.example_queries.append(line) return self.example_queries def is_example_query(self, query): return query in self.example_queries def get_example_query_index(self, query): return self.example_queries.index(query)
26.652174
72
0.730832
87
613
4.91954
0.367816
0.261682
0.294393
0.102804
0
0
0
0
0
0
0
0
0.169657
613
22
73
27.863636
0.840864
0
0
0.111111
0
0
0.035889
0
0
0
0
0
0
1
0.222222
false
0
0.055556
0.111111
0.5
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
1
0
0
0
4
24edcbadd4ddf34ecea1e24d8833001ac234bace
53
py
Python
src/models/predict_model.py
TuomoKareoja/tj_kaggle_ga
d7df2849897e373e810cd55736b7b00e0f495d2c
[ "MIT" ]
null
null
null
src/models/predict_model.py
TuomoKareoja/tj_kaggle_ga
d7df2849897e373e810cd55736b7b00e0f495d2c
[ "MIT" ]
1
2018-10-01T14:58:22.000Z
2018-10-01T15:17:32.000Z
src/models/predict_model.py
TuomoKareoja/tj_kaggle_ga
d7df2849897e373e810cd55736b7b00e0f495d2c
[ "MIT" ]
null
null
null
""" .. module:: predict_model.py :synopsis: """
8.833333
28
0.54717
5
53
5.6
1
0
0
0
0
0
0
0
0
0
0
0
0.207547
53
5
29
10.6
0.666667
0.811321
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
7001d408958960cf918b3fd8b9dbee5efe55f16b
176
py
Python
notepadproj/notepadapp/forms.py
danieldouglas88/Django-NotePad
aa1f7ca05f84e16fda728abf900501e8f5f85f5d
[ "Apache-2.0" ]
null
null
null
notepadproj/notepadapp/forms.py
danieldouglas88/Django-NotePad
aa1f7ca05f84e16fda728abf900501e8f5f85f5d
[ "Apache-2.0" ]
null
null
null
notepadproj/notepadapp/forms.py
danieldouglas88/Django-NotePad
aa1f7ca05f84e16fda728abf900501e8f5f85f5d
[ "Apache-2.0" ]
null
null
null
from django import forms from .models import NotePad import datetime class NoteForm(forms.ModelForm): class Meta: model = NotePad fields = '__all__'
22
33
0.676136
20
176
5.75
0.7
0
0
0
0
0
0
0
0
0
0
0
0.267045
176
8
34
22
0.891473
0
0
0
0
0
0.041176
0
0
0
0
0
0
1
0
false
0
0.428571
0
0.714286
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
7024dddd195fa82cec0b5a1710c3acfd8d279ee0
708
py
Python
abstractbrain.py
kourgeorge/plus-maze-simulator
6bc8ca5b6f4401fa56d194f4f17707751ba0221e
[ "MIT" ]
null
null
null
abstractbrain.py
kourgeorge/plus-maze-simulator
6bc8ca5b6f4401fa56d194f4f17707751ba0221e
[ "MIT" ]
null
null
null
abstractbrain.py
kourgeorge/plus-maze-simulator
6bc8ca5b6f4401fa56d194f4f17707751ba0221e
[ "MIT" ]
null
null
null
__author__ = 'gkour' class AbstractBrain: def __init__(self, reward_discount): self.reward_discount = reward_discount def think(self, obs, agent): '''Given an observation should return a distribution over the action set''' raise NotImplementedError() def consolidate(self, memory, agent): raise NotImplementedError() def num_trainable_parameters(self): raise NotImplementedError() def get_network(self): raise NotImplementedError() def save_model(self, path): raise NotImplementedError() def load_model(self, path): raise NotImplementedError() def __str__(self): return self.__class__.__name__
23.6
83
0.679379
73
708
6.205479
0.520548
0.317881
0.357616
0.136865
0.1766
0.1766
0
0
0
0
0
0
0.240113
708
29
84
24.413793
0.842007
0.097458
0
0.333333
0
0
0.007899
0
0
0
0
0
0
1
0.444444
false
0
0
0.055556
0.555556
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
7026b81e25b6a58bd6a8530d6b164fc9edd84ca7
448
py
Python
cfw/framework/errors.py
zinic/python-cfw
48d339537cb958c29294eca5fbf81b98e5858fde
[ "MIT" ]
1
2017-07-21T00:34:15.000Z
2017-07-21T00:34:15.000Z
cfw/framework/errors.py
zinic/python-cfw
48d339537cb958c29294eca5fbf81b98e5858fde
[ "MIT" ]
null
null
null
cfw/framework/errors.py
zinic/python-cfw
48d339537cb958c29294eca5fbf81b98e5858fde
[ "MIT" ]
null
null
null
class CommandError(Exception): def __init__(self, msg: str = "") -> None: super(CommandError, self).__init__() self.msg = msg def __str__(self) -> str: return self.msg class CommandArgumentError(CommandError): pass class CommandNotFoundError(CommandError): pass class CommandDependencyError(CommandError): def __str__(self) -> str: return "Command Dependency Error: {}".format(self.msg)
19.478261
62
0.667411
45
448
6.288889
0.422222
0.09894
0.077739
0.091873
0.134276
0
0
0
0
0
0
0
0.220982
448
22
63
20.363636
0.810888
0
0
0.307692
0
0
0.0625
0
0
0
0
0
0
1
0.230769
false
0.153846
0
0.153846
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
0
1
0
1
1
0
0
4
705010b6cdc85b2754b015049694208d40047252
2,140
py
Python
OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GLES2/NV/read_buffer.py
JE-Chen/je_old_repo
a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5
[ "MIT" ]
null
null
null
OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GLES2/NV/read_buffer.py
JE-Chen/je_old_repo
a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5
[ "MIT" ]
null
null
null
OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GLES2/NV/read_buffer.py
JE-Chen/je_old_repo
a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5
[ "MIT" ]
null
null
null
'''OpenGL extension NV.read_buffer This module customises the behaviour of the OpenGL.raw.GLES2.NV.read_buffer to provide a more Python-friendly API Overview (from the spec) Unextended OpenGL ES 2.0 only supports using ReadPixels to read from the default color buffer of the currently-bound framebuffer. However, it is useful for debugging to be able to read from non-default color buffers. Particularly, when the NV_draw_buffers extension is supported, each framebuffer may contain multiple color buffers. This extension provides a mechanism to select which color buffer to read from. This document describes two extensions to allow an implementation to support a subset of the total functionality. The NV_read_buffer extension adds the command ReadBufferNV, which is used to select which color buffer of the currently-bound framebuffer to use as the source for subsequent calls to ReadPixels, CopyTexImage2D, and CopyTexSubImage2D. If the system-provided framebuffer is bound, then ReadBufferNV accepts value BACK. If a user-created FBO is bound, then ReadBufferNV accepts COLOR_ATTACHMENT0. Additionally, if the NV_draw_buffers extension is supported, ReadBufferNV accepts COLOR_ATTACHMENTn_NV (n is 0 to 15). The NV_read_buffer_front extension requires NV_read_buffer and adds the ability to select the system-provided FRONT color buffer as the source for read operations when the system-provided framebuffer is bound and contains both a front and back buffer. The official definition of this extension is available here: http://www.opengl.org/registry/specs/NV/read_buffer.txt ''' from OpenGL import platform, constant, arrays from OpenGL import extensions, wrapper import ctypes from OpenGL.raw.GLES2 import _types, _glgets from OpenGL.raw.GLES2.NV.read_buffer import * from OpenGL.raw.GLES2.NV.read_buffer import _EXTENSION_NAME def glInitReadBufferNV(): '''Return boolean indicating whether this extension is available''' from OpenGL import extensions return extensions.hasGLExtension( _EXTENSION_NAME ) ### END AUTOGENERATED SECTION
42.8
73
0.792056
312
2,140
5.352564
0.419872
0.028743
0.057485
0.028743
0.246707
0.192814
0.135329
0.043114
0
0
0
0.006742
0.168224
2,140
50
74
42.8
0.931461
0.877103
0
0
0
0
0
0
0
0
0
0
0
1
0.111111
true
0
0.777778
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
70556f2a05bab964e7077cc4d8c68566b9119af7
987
py
Python
server-admin/control/usermanagement.py
yafraorg/yapki
66ab6f2db2efa7e0c5dbb85fa7c05e6446518129
[ "Apache-2.0" ]
3
2015-06-24T10:59:28.000Z
2017-09-10T16:49:09.000Z
server-admin/control/usermanagement.py
yafraorg/yapki
66ab6f2db2efa7e0c5dbb85fa7c05e6446518129
[ "Apache-2.0" ]
2
2020-04-20T21:06:33.000Z
2020-05-06T10:15:31.000Z
server-admin/control/usermanagement.py
yafraorg/yapki
66ab6f2db2efa7e0c5dbb85fa7c05e6446518129
[ "Apache-2.0" ]
1
2016-12-02T10:12:42.000Z
2016-12-02T10:12:42.000Z
from sqlalchemy.orm import Session from utils import security from model import user from model.db import DbUser def get_user(db: Session, user_id: int): return db.query(DbUser).filter(DbUser.id == user_id).first() def get_user_by_email(db: Session, email: str): return db.query(DbUser).filter(DbUser.email == email).first() def get_users(db: Session, skip: int = 0, limit: int = 100): return db.query(DbUser).offset(skip).limit(limit).all() def create_user(db: Session, user: user.UserCreate): hashed_password = security.get_password_hash(user.password) db_user = DbUser(email=user.email, hashed_password=hashed_password) db.add(db_user) db.commit() db.refresh(db_user) return db_user def authenticate_user(db: Session, email: str, password: str): user = get_user_by_email(db=db, email=email) if not user: return None if not security.verify_password(password, user.hashed_password): return None return user
27.416667
71
0.720365
149
987
4.61745
0.281879
0.065407
0.056686
0.082849
0.136628
0.090116
0
0
0
0
0
0.004878
0.1692
987
35
72
28.2
0.834146
0
0
0.083333
0
0
0
0
0
0
0
0
0
1
0.208333
false
0.166667
0.166667
0.125
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
1
0
1
0
1
1
0
0
4
7058460b98a7265119a48d5694b46400ecbc4855
519
py
Python
skyhook/skyhook/utils/heap.py
wfgydbu/skyhook
8577d903bef90110646860fa6c59543c6a60d053
[ "BSD-2-Clause" ]
2
2020-04-20T15:36:08.000Z
2020-07-15T00:50:04.000Z
skyhook/skyhook/utils/heap.py
wfgydbu/skyhook
8577d903bef90110646860fa6c59543c6a60d053
[ "BSD-2-Clause" ]
1
2021-03-31T19:44:32.000Z
2021-03-31T19:44:32.000Z
skyhook/skyhook/utils/heap.py
wfgydbu/skyhook
8577d903bef90110646860fa6c59543c6a60d053
[ "BSD-2-Clause" ]
2
2020-04-28T01:37:20.000Z
2020-07-02T04:47:37.000Z
import heapq class HeapManager(object): def __init__(self): super(HeapManager, self).__init__() self.data = [] def sync(self, items): if self.data: self.data[:] = [] self.data = [(item[0], item) for item in items] heapq.heapify(self.data) def pop(self): return heapq.heappop(self.data)[1] if self.data else None def push(self, item): heapq.heappush(self.data, (item[0], item)) def length(self): return len(self.data)
22.565217
65
0.576108
68
519
4.279412
0.411765
0.247423
0.075601
0.109966
0.116838
0
0
0
0
0
0
0.008086
0.285164
519
22
66
23.590909
0.77628
0
0
0
0
0
0
0
0
0
0
0
0
1
0.3125
false
0
0.0625
0.125
0.5625
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
7062857693723d59531fd8a709551db00b6e328b
92
py
Python
web_MNIST/apps.py
lorenzophys/django-web-MNIST
5219fa9c1858cabd910dce5fdcce7bf8988ff8a2
[ "MIT" ]
null
null
null
web_MNIST/apps.py
lorenzophys/django-web-MNIST
5219fa9c1858cabd910dce5fdcce7bf8988ff8a2
[ "MIT" ]
null
null
null
web_MNIST/apps.py
lorenzophys/django-web-MNIST
5219fa9c1858cabd910dce5fdcce7bf8988ff8a2
[ "MIT" ]
null
null
null
from django.apps import AppConfig class WebMnistConfig(AppConfig): name = 'web_MNIST'
15.333333
33
0.76087
11
92
6.272727
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.163043
92
5
34
18.4
0.896104
0
0
0
0
0
0.097826
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
5611e15c8c5f47304a4406a7c32dbdd64f5cecd0
164
py
Python
vizdoomgymmaze/envs/vizdoommazetwo9.py
WangChen100/vizdoomgymmaze
51f750405a762e3f19193c09ef34380786c11efe
[ "MIT" ]
6
2019-08-22T09:19:24.000Z
2020-11-21T03:29:39.000Z
vizdoomgymmaze/envs/vizdoommazetwo9.py
BillOmg/vizdoomgymmaze
51f750405a762e3f19193c09ef34380786c11efe
[ "MIT" ]
2
2019-08-10T06:50:02.000Z
2021-11-30T13:57:41.000Z
vizdoomgymmaze/envs/vizdoommazetwo9.py
BillOmg/vizdoomgymmaze
51f750405a762e3f19193c09ef34380786c11efe
[ "MIT" ]
6
2019-08-23T13:17:05.000Z
2021-06-18T20:24:53.000Z
from vizdoomgymmaze.envs.vizdoomenv import VizdoomEnv class VizdoomMazeTwo9(VizdoomEnv): def __init__(self): super(VizdoomMazeTwo9, self).__init__(42)
27.333333
53
0.77439
17
164
7
0.705882
0
0
0
0
0
0
0
0
0
0
0.028369
0.140244
164
6
54
27.333333
0.815603
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
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
563c0bdd241be7bbf957e3f394fe4ad6b0ecd0e9
185
py
Python
problem_solving/algorithms/strings/__init__.py
mxdzi/hackerrank
4455f73e4479a4204b2e1167253f6a02351aa5b7
[ "MIT" ]
null
null
null
problem_solving/algorithms/strings/__init__.py
mxdzi/hackerrank
4455f73e4479a4204b2e1167253f6a02351aa5b7
[ "MIT" ]
null
null
null
problem_solving/algorithms/strings/__init__.py
mxdzi/hackerrank
4455f73e4479a4204b2e1167253f6a02351aa5b7
[ "MIT" ]
null
null
null
__all__ = [ 'q2_camelcase', 'q3_strong_password', 'q6_mars_exploration', 'q7_hackerrank_in_a_string', 'q11_funny_string', 'q18_anagram', 'q21_two_strings' ]
18.5
32
0.664865
22
185
4.772727
0.954545
0
0
0
0
0
0
0
0
0
0
0.068493
0.210811
185
9
33
20.555556
0.650685
0
0
0
0
0
0.627027
0.135135
0
0
0
0
0
1
0
false
0.111111
0
0
0
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
1
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
563e238eb35f9b9defe5395aaae33b88143c4156
203
py
Python
day4/stringoperation.py
nikhilsamninan/python-files
15198459081097058a939b40b5e8ef754e578fe0
[ "Apache-2.0" ]
null
null
null
day4/stringoperation.py
nikhilsamninan/python-files
15198459081097058a939b40b5e8ef754e578fe0
[ "Apache-2.0" ]
null
null
null
day4/stringoperation.py
nikhilsamninan/python-files
15198459081097058a939b40b5e8ef754e578fe0
[ "Apache-2.0" ]
null
null
null
basic=" Hello World " #print(basic.upper()) #print(basic.lower()) #print(basic.split()) #print(basic.split('l')) print(basic.isalpha()) print(basic.strip()) print(basic.find('h')) print(basic.index('h'))
22.555556
24
0.684729
30
203
4.633333
0.433333
0.57554
0.215827
0
0
0
0
0
0
0
0
0
0.054187
203
9
25
22.555556
0.723958
0.408867
0
0
0
0
0.128205
0
0
0
0
0
0
1
0
false
0
0
0
0
0.8
0
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
1
0
4
565fe86d3ef54d1caec998617ae49d49545c0330
246
py
Python
tinycord/exceptions.py
tinycord/tinycord
9e817452c1f2357878f07f8622f6240687470cad
[ "MIT" ]
8
2022-01-08T20:04:29.000Z
2022-03-21T19:12:19.000Z
tinycord/exceptions.py
tinycord/tinycord
9e817452c1f2357878f07f8622f6240687470cad
[ "MIT" ]
null
null
null
tinycord/exceptions.py
tinycord/tinycord
9e817452c1f2357878f07f8622f6240687470cad
[ "MIT" ]
1
2022-01-02T21:42:53.000Z
2022-01-02T21:42:53.000Z
class GatewayError(Exception): """ Base class for all gateway errors. """ def __init__(self, message: str) -> None: self.message: str = message """The message of the error.""" super().__init__(message)
27.333333
45
0.585366
27
246
5.037037
0.666667
0.161765
0.205882
0
0
0
0
0
0
0
0
0
0.284553
246
9
46
27.333333
0.772727
0.138211
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
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4