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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
665411990ceedf780468299b1765689361fdab45 | 348 | py | Python | resources/dot_PyCharm/system/python_stubs/-762174762/PySide/QtGui/QClipboardEvent.py | basepipe/developer_onboarding | 05b6a776f8974c89517868131b201f11c6c2a5ad | [
"MIT"
] | 1 | 2020-04-20T02:27:20.000Z | 2020-04-20T02:27:20.000Z | resources/dot_PyCharm/system/python_stubs/cache/8cdc475d469a13122bc4bc6c3ac1c215d93d5f120f5cc1ef33a8f3088ee54d8e/PySide/QtGui/QClipboardEvent.py | basepipe/developer_onboarding | 05b6a776f8974c89517868131b201f11c6c2a5ad | [
"MIT"
] | null | null | null | resources/dot_PyCharm/system/python_stubs/cache/8cdc475d469a13122bc4bc6c3ac1c215d93d5f120f5cc1ef33a8f3088ee54d8e/PySide/QtGui/QClipboardEvent.py | basepipe/developer_onboarding | 05b6a776f8974c89517868131b201f11c6c2a5ad | [
"MIT"
] | null | null | null | # encoding: utf-8
# module PySide.QtGui
# from C:\Python27\lib\site-packages\PySide\QtGui.pyd
# by generator 1.147
# no doc
# imports
import PySide.QtCore as __PySide_QtCore
import Shiboken as __Shiboken
class QClipboardEvent(__PySide_QtCore.QEvent):
# no doc
def __init__(self, *args, **kwargs): # real signature unknown
pass
| 19.333333 | 65 | 0.729885 | 48 | 348 | 5.041667 | 0.75 | 0.14876 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02439 | 0.175287 | 348 | 17 | 66 | 20.470588 | 0.818815 | 0.433908 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.2 | 0.4 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
b0ba70e5498a44a15d39de5effec074f2599f013 | 112 | py | Python | tests/test_mail_bug.py | FunTimeCoding/mail-bug | 185ed77ce92be44c9b37ebf380a1b80a1385c263 | [
"MIT"
] | null | null | null | tests/test_mail_bug.py | FunTimeCoding/mail-bug | 185ed77ce92be44c9b37ebf380a1b80a1385c263 | [
"MIT"
] | null | null | null | tests/test_mail_bug.py | FunTimeCoding/mail-bug | 185ed77ce92be44c9b37ebf380a1b80a1385c263 | [
"MIT"
] | null | null | null | from mail_bug.mail_bug import MailBug
def test_return_code():
bug = MailBug([])
assert bug.run() == 0
| 16 | 37 | 0.669643 | 17 | 112 | 4.176471 | 0.705882 | 0.197183 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011236 | 0.205357 | 112 | 6 | 38 | 18.666667 | 0.786517 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b0cb8d6fd396de4dcda21996632c248c8e21dab4 | 320 | py | Python | version.py | ERICMIAO0817/knlp | 56052e49be87d604839d8f81a7295c73a5ac62cf | [
"MIT"
] | 19 | 2021-03-17T02:15:18.000Z | 2021-12-14T04:46:21.000Z | version.py | ERICMIAO0817/knlp | 56052e49be87d604839d8f81a7295c73a5ac62cf | [
"MIT"
] | 4 | 2022-03-08T16:28:18.000Z | 2022-03-28T15:11:11.000Z | version.py | ERICMIAO0817/knlp | 56052e49be87d604839d8f81a7295c73a5ac62cf | [
"MIT"
] | 7 | 2021-03-17T02:15:23.000Z | 2022-03-17T15:41:04.000Z | #!/usr/bin/python
# -*- coding:UTF-8 -*-
# -----------------------------------------------------------------------#
# File Name: version.py
# Author: Junyi Li
# Mail: 4ljy@163.com
# Created Time: 2021-01-27
# Description:
# -----------------------------------------------------------------------#
__version__ = "0.2.2"
| 26.666667 | 74 | 0.34375 | 27 | 320 | 3.925926 | 0.925926 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.055172 | 0.09375 | 320 | 11 | 75 | 29.090909 | 0.310345 | 0.865625 | 0 | 0 | 0 | 0 | 0.15625 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b0f062298bedb55fde1aeecf88bc32677fffabc9 | 127 | py | Python | ssshare/__init__.py | centaur679/ShadowSocksShare | 41f85e9a0adc1322fd8f254a1c1a5360d228507a | [
"Apache-2.0"
] | 2,341 | 2019-03-04T05:41:12.000Z | 2022-03-31T11:30:40.000Z | ssshare/__init__.py | centaur679/ShadowSocksShare | 41f85e9a0adc1322fd8f254a1c1a5360d228507a | [
"Apache-2.0"
] | 50 | 2019-03-24T01:35:13.000Z | 2021-09-09T22:59:15.000Z | ssshare/__init__.py | centaur679/ShadowSocksShare | 41f85e9a0adc1322fd8f254a1c1a5360d228507a | [
"Apache-2.0"
] | 780 | 2019-03-04T07:33:37.000Z | 2022-03-22T23:32:53.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask
app = Flask(__name__)
app.config.from_object("config")
| 15.875 | 32 | 0.685039 | 19 | 127 | 4.315789 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009091 | 0.133858 | 127 | 7 | 33 | 18.142857 | 0.736364 | 0.330709 | 0 | 0 | 0 | 0 | 0.072289 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
9fe3efc076ac50b9a73eb652fb87630b07aba672 | 286 | py | Python | backend/api/api.py | iamdempa/react-flask-postgres-boilerplate-with-docker | f1d74dfa08777ff2aeef3ed2620087855d6e30c3 | [
"Apache-2.0"
] | 67 | 2018-10-02T04:04:15.000Z | 2022-03-30T17:43:56.000Z | backend/api/api.py | iamdempa/react-flask-postgres-boilerplate-with-docker | f1d74dfa08777ff2aeef3ed2620087855d6e30c3 | [
"Apache-2.0"
] | null | null | null | backend/api/api.py | iamdempa/react-flask-postgres-boilerplate-with-docker | f1d74dfa08777ff2aeef3ed2620087855d6e30c3 | [
"Apache-2.0"
] | 30 | 2018-11-21T22:55:08.000Z | 2022-03-01T16:55:53.000Z | from flask import jsonify
from flask_restful import Resource, Api
from .models import Player as PlayerModel, to_dict
api = Api()
class Player(Resource):
def get(self):
return jsonify([to_dict(player) for player in PlayerModel.query.all()])
api.add_resource(Player, '/')
| 22 | 79 | 0.734266 | 41 | 286 | 5.02439 | 0.560976 | 0.087379 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164336 | 286 | 12 | 80 | 23.833333 | 0.861925 | 0 | 0 | 0 | 0 | 0 | 0.003497 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.375 | 0.125 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
9fedd39a8f50939e9c4f94bb47bef7f75ae894a9 | 8,113 | py | Python | mozi/layers/recurrent.py | hycis/Mozi | 7f2eccbe3169c10d231e07edf8bc650039fa4eb2 | [
"MIT"
] | 122 | 2015-07-24T09:29:06.000Z | 2022-02-22T02:51:00.000Z | mozi/layers/recurrent.py | hycis/Mozi | 7f2eccbe3169c10d231e07edf8bc650039fa4eb2 | [
"MIT"
] | 4 | 2015-07-27T04:37:11.000Z | 2020-04-04T08:05:00.000Z | mozi/layers/recurrent.py | hycis/Mozi | 7f2eccbe3169c10d231e07edf8bc650039fa4eb2 | [
"MIT"
] | 27 | 2015-07-24T12:59:35.000Z | 2020-04-14T00:21:43.000Z |
from mozi.utils.theano_utils import shared_zeros, alloc_zeros_matrix, shared_ones
from mozi.layers.template import Template
from mozi.weight_init import OrthogonalWeight, GaussianWeight, Identity
import theano.tensor as T
import theano
class LSTM(Template):
def __init__(self, input_dim, output_dim, truncate_gradient=-1, return_sequences=True,
weight_init=OrthogonalWeight(), inner_init=GaussianWeight(mean=0, std=0.1)):
self.input_dim = input_dim
self.output_dim = output_dim
self.truncate_gradient = truncate_gradient
self.return_sequences = return_sequences
self.W_i = weight_init((self.input_dim, self.output_dim))
self.U_i = inner_init((self.output_dim, self.output_dim))
self.b_i = shared_zeros((self.output_dim), name='b_i')
self.W_f = weight_init((self.input_dim, self.output_dim))
self.U_f = inner_init((self.output_dim, self.output_dim))
self.b_f = shared_ones((self.output_dim), name='b_f')
self.W_c = weight_init((self.input_dim, self.output_dim))
self.U_c = inner_init((self.output_dim, self.output_dim))
self.b_c = shared_zeros((self.output_dim), name='b_c')
self.W_o = weight_init((self.input_dim, self.output_dim))
self.U_o = inner_init((self.output_dim, self.output_dim))
self.b_o = shared_zeros((self.output_dim), name='b_o')
self.params = [
self.W_i, self.U_i, self.b_i,
self.W_c, self.U_c, self.b_c,
self.W_f, self.U_f, self.b_f,
self.W_o, self.U_o, self.b_o,
]
def _step(self, xi_t, xf_t, xo_t, xc_t,
h_tm1, c_tm1, u_i, u_f, u_o, u_c):
i_t = T.nnet.sigmoid(xi_t + T.dot(h_tm1, u_i))
f_t = T.nnet.sigmoid(xf_t + T.dot(h_tm1, u_f))
o_t = T.nnet.sigmoid(xo_t + T.dot(h_tm1, u_o))
g_t = T.tanh(xc_t + T.dot(h_tm1, u_c))
c_t = f_t * c_tm1 + i_t * g_t
h_t = o_t * T.tanh(c_t)
return h_t, c_t
def _train_fprop(self, state_below):
X = state_below.dimshuffle((1, 0, 2))
xi = T.dot(X, self.W_i) + self.b_i
xf = T.dot(X, self.W_f) + self.b_f
xc = T.dot(X, self.W_c) + self.b_c
xo = T.dot(X, self.W_o) + self.b_o
[outputs, memories], updates = theano.scan(
self._step,
sequences=[xi, xf, xo, xc],
outputs_info=[
T.unbroadcast(alloc_zeros_matrix(X.shape[1], self.output_dim), 1),
T.unbroadcast(alloc_zeros_matrix(X.shape[1], self.output_dim), 1)
],
non_sequences=[self.U_i, self.U_f, self.U_o, self.U_c],
truncate_gradient=self.truncate_gradient)
if self.return_sequences:
return outputs.dimshuffle((1, 0, 2))
return outputs[-1]
class BiLSTM(Template):
'''
Bidirection LSTM
'''
def __init__(self, input_dim, output_dim, weight_init=OrthogonalWeight(),
inner_init=GaussianWeight(mean=0, std=0.1), truncate_gradient=-1,
output_mode='concat', return_sequences=False, return_idx=-1):
self.input_dim = input_dim
self.output_dim = output_dim
self.truncate_gradient = truncate_gradient
self.output_mode = output_mode # output_mode is either sum or concatenate
self.return_sequences = return_sequences
self.return_idx = return_idx
# forward weights
self.W_i = weight_init((self.input_dim, self.output_dim))
self.U_i = inner_init((self.output_dim, self.output_dim))
self.b_i = shared_zeros((self.output_dim), name='b_i')
self.W_f = weight_init((self.input_dim, self.output_dim))
self.U_f = inner_init((self.output_dim, self.output_dim))
self.b_f = shared_ones((self.output_dim), name='b_f')
self.W_c = weight_init((self.input_dim, self.output_dim))
self.U_c = inner_init((self.output_dim, self.output_dim))
self.b_c = shared_zeros((self.output_dim), name='b_c')
self.W_o = weight_init((self.input_dim, self.output_dim))
self.U_o = inner_init((self.output_dim, self.output_dim))
self.b_o = shared_zeros((self.output_dim), name='b_o')
# backward weights
self.Wb_i = weight_init((self.input_dim, self.output_dim))
self.Ub_i = inner_init((self.output_dim, self.output_dim))
self.bb_i = shared_zeros((self.output_dim), name='bb_i')
self.Wb_f = weight_init((self.input_dim, self.output_dim))
self.Ub_f = inner_init((self.output_dim, self.output_dim))
self.bb_f = shared_ones((self.output_dim), name='bb_f')
self.Wb_c = weight_init((self.input_dim, self.output_dim))
self.Ub_c = inner_init((self.output_dim, self.output_dim))
self.bb_c = shared_zeros((self.output_dim), name='bb_c')
self.Wb_o = weight_init((self.input_dim, self.output_dim))
self.Ub_o = inner_init((self.output_dim, self.output_dim))
self.bb_o = shared_zeros((self.output_dim), name='bb_o')
self.params = [
self.W_i, self.U_i, self.b_i,
self.W_c, self.U_c, self.b_c,
self.W_f, self.U_f, self.b_f,
self.W_o, self.U_o, self.b_o,
self.Wb_i, self.Ub_i, self.bb_i,
self.Wb_c, self.Ub_c, self.bb_c,
self.Wb_f, self.Ub_f, self.bb_f,
self.Wb_o, self.Ub_o, self.bb_o,
]
def _forward_step(self,
xi_t, xf_t, xo_t, xc_t,
h_tm1, c_tm1,
u_i, u_f, u_o, u_c):
i_t = T.nnet.sigmoid(xi_t + T.dot(h_tm1, u_i))
f_t = T.nnet.sigmoid(xf_t + T.dot(h_tm1, u_f))
o_t = T.nnet.sigmoid(xo_t + T.dot(h_tm1, u_o))
g_t = T.tanh(xc_t + T.dot(h_tm1, u_c))
c_t = f_t * c_tm1 + i_t * g_t
h_t = o_t * T.tanh(c_t)
return h_t, c_t
def get_forward_output(self, state_below):
X = state_below.dimshuffle((1,0,2))
xi = T.dot(X, self.W_i) + self.b_i
xf = T.dot(X, self.W_f) + self.b_f
xc = T.dot(X, self.W_c) + self.b_c
xo = T.dot(X, self.W_o) + self.b_o
[outputs, memories], updates = theano.scan(
self._forward_step,
sequences=[xi, xf, xo, xc],
outputs_info=[
T.unbroadcast(alloc_zeros_matrix(X.shape[1], self.output_dim), 1),
T.unbroadcast(alloc_zeros_matrix(X.shape[1], self.output_dim), 1)
],
non_sequences=[self.U_i, self.U_f, self.U_o, self.U_c],
truncate_gradient=self.truncate_gradient
)
return outputs.dimshuffle((1,0,2))
def get_backward_output(self, state_below):
X = state_below.dimshuffle((1,0,2))
xi = T.dot(X, self.Wb_i) + self.bb_i
xf = T.dot(X, self.Wb_f) + self.bb_f
xc = T.dot(X, self.Wb_c) + self.bb_c
xo = T.dot(X, self.Wb_o) + self.bb_o
[outputs, memories], updates = theano.scan(
self._forward_step,
sequences=[xi, xf, xo, xc],
outputs_info=[
T.unbroadcast(alloc_zeros_matrix(X.shape[1], self.output_dim), 1),
T.unbroadcast(alloc_zeros_matrix(X.shape[1], self.output_dim), 1)
],
non_sequences=[self.Ub_i, self.Ub_f, self.Ub_o, self.Ub_c],
go_backwards = True,
truncate_gradient=self.truncate_gradient
)
return outputs.dimshuffle((1,0,2))
def _train_fprop(self, state_below):
forward = self.get_forward_output(state_below)
backward = self.get_backward_output(state_below)
if self.output_mode == 'sum':
output = forward + backward
elif self.output_mode == 'concat':
output = T.concatenate([forward, backward], axis=2)
else:
raise Exception('output mode is not sum or concat')
if self.return_sequences==False:
return output[:,self.return_idx,:]
elif self.return_sequences==True:
return output
else:
raise Exception('Unexpected output shape for return_sequences')
| 38.450237 | 92 | 0.609762 | 1,298 | 8,113 | 3.5 | 0.078582 | 0.118864 | 0.160247 | 0.134713 | 0.765794 | 0.763592 | 0.727493 | 0.688532 | 0.688532 | 0.688532 | 0 | 0.009188 | 0.262172 | 8,113 | 210 | 93 | 38.633333 | 0.749749 | 0.011217 | 0 | 0.604938 | 0 | 0 | 0.016369 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.049383 | false | 0 | 0.030864 | 0 | 0.141975 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9ffe6ea421da07a4d91197e1ea46c83dd156f66f | 826 | py | Python | app/components/admin.py | Uniquode/uniquode2 | 385f3e0b26383c042d8da64b52350e82414580ea | [
"MIT"
] | null | null | null | app/components/admin.py | Uniquode/uniquode2 | 385f3e0b26383c042d8da64b52350e82414580ea | [
"MIT"
] | null | null | null | app/components/admin.py | Uniquode/uniquode2 | 385f3e0b26383c042d8da64b52350e82414580ea | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from django.utils.timesince import timesince
class CreatedByAdminMixin:
def save_model(self, request, obj, form, change):
if getattr(obj, 'created_by', None) is None:
obj.created_by = request.user
# noinspection PyUnresolvedReferences
super().save_model(request, obj, form, change)
# noinspection PyMethodMayBeStatic
class TimestampAdminMixin:
def since_created(self, obj):
return timesince(obj.dt_created)
def since_modified(self, obj):
return timesince(obj.dt_created)
class TaggedAdminMixin:
# noinspection PyUnresolvedReferences
def get_queryset(self, request):
return super().get_queryset(request).prefetch_related('tags')
def _tags(self, obj):
return ", ".join(o.name for o in obj.tags.all())
| 25.8125 | 69 | 0.690073 | 96 | 826 | 5.8125 | 0.479167 | 0.037634 | 0.069892 | 0.071685 | 0.121864 | 0.121864 | 0.121864 | 0 | 0 | 0 | 0 | 0.001527 | 0.207022 | 826 | 31 | 70 | 26.645161 | 0.850382 | 0.152542 | 0 | 0.125 | 0 | 0 | 0.023022 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3125 | false | 0 | 0.0625 | 0.25 | 0.8125 | 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 | 0 | 1 | 1 | 0 | 0 | 3 |
b0091d1b6caace04c666bba350b86f62370a21bc | 78 | py | Python | desafio1.py | sergioboff/Desafios-Curso-em-Video | f876396635b12c00bdd9523758364bbebfd70ae0 | [
"MIT"
] | null | null | null | desafio1.py | sergioboff/Desafios-Curso-em-Video | f876396635b12c00bdd9523758364bbebfd70ae0 | [
"MIT"
] | null | null | null | desafio1.py | sergioboff/Desafios-Curso-em-Video | f876396635b12c00bdd9523758364bbebfd70ae0 | [
"MIT"
] | null | null | null | nome= input('Qual seu nome ?: ')
print ('Olá {} Seja bem vindo'.format(nome))
| 26 | 44 | 0.641026 | 12 | 78 | 4.166667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 78 | 2 | 45 | 39 | 0.757576 | 0 | 0 | 0 | 0 | 0 | 0.487179 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 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 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
b0120808c75c26295ac6097ea109b68947111348 | 323 | py | Python | tests/expr/expr08.py | ktok07b6/polyphony | 657c5c7440520db6b4985970bd50547407693ac4 | [
"MIT"
] | 83 | 2015-11-30T09:59:13.000Z | 2021-08-03T09:12:28.000Z | tests/expr/expr08.py | jesseclin/polyphony | 657c5c7440520db6b4985970bd50547407693ac4 | [
"MIT"
] | 4 | 2017-02-10T01:43:11.000Z | 2020-07-14T03:52:25.000Z | tests/expr/expr08.py | jesseclin/polyphony | 657c5c7440520db6b4985970bd50547407693ac4 | [
"MIT"
] | 11 | 2016-11-18T14:39:15.000Z | 2021-02-23T10:05:20.000Z | from polyphony import testbench
def expr08(a, b, c):
return a < b < c
@testbench
def test():
assert False == expr08(0, 0, 0)
assert True == expr08(0, 1, 2)
assert False == expr08(1, 0, 2)
assert False == expr08(2, 1, 0)
assert True == expr08(-1, 0, 1)
assert True == expr08(-2, -1, 0)
test()
| 21.533333 | 36 | 0.575851 | 53 | 323 | 3.509434 | 0.320755 | 0.043011 | 0.274194 | 0.182796 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134454 | 0.263158 | 323 | 14 | 37 | 23.071429 | 0.647059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0.166667 | false | 0 | 0.083333 | 0.083333 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b026bd7b3b263fb2129be4259af4f24d57934ce8 | 20,746 | py | Python | Name Generator/names.py | Rakkerrak/Projects | 0a9bc54b7d41e69b444165f60254262a163509a9 | [
"MIT"
] | null | null | null | Name Generator/names.py | Rakkerrak/Projects | 0a9bc54b7d41e69b444165f60254262a163509a9 | [
"MIT"
] | null | null | null | Name Generator/names.py | Rakkerrak/Projects | 0a9bc54b7d41e69b444165f60254262a163509a9 | [
"MIT"
] | null | null | null | feFirst = ['Emma', 'Olivia', 'Ava', 'Isabella', 'Sophia', 'Charlotte', 'Mia', 'Amelia', 'Harper', 'Evelyn', 'Abigail', 'Emily', 'Elizabeth', 'Mila', 'Ella', 'Avery', 'Sofia', 'Camila', 'Aria', 'Scarlett', 'Victoria', 'Madison', 'Luna', 'Grace', 'Chloe', 'Penelope', 'Layla', 'Riley', 'Zoey', 'Nora', 'Lily', 'Eleanor', 'Hannah', 'Lillian', 'Addison', 'Aubrey', 'Ellie', 'Stella', 'Natalie', 'Zoe', 'Leah', 'Hazel', 'Violet', 'Aurora', 'Savannah', 'Audrey', 'Brooklyn', 'Bella', 'Claire', 'Skylar', 'Lucy', 'Paisley', 'Everly', 'Anna', 'Caroline', 'Nova', 'Genesis', 'Emilia', 'Kennedy', 'Samantha', 'Maya', 'Willow', 'Kinsley', 'Naomi', 'Aaliyah', 'Elena', 'Sarah', 'Ariana', 'Allison', 'Gabriella', 'Alice', 'Madelyn', 'Cora', 'Ruby', 'Eva', 'Serenity', 'Autumn', 'Adeline', 'Hailey', 'Gianna', 'Valentina', 'Isla', 'Eliana', 'Quinn', 'Nevaeh', 'Ivy', 'Sadie', 'Piper', 'Lydia', 'Alexa', 'Josephine', 'Emery', 'Julia', 'Delilah', 'Arianna', 'Vivian', 'Kaylee', 'Sophie', 'Brielle', 'Madeline', 'Peyton', 'Rylee', 'Clara', 'Hadley', 'Melanie', 'Mackenzie', 'Reagan', 'Adalynn', 'Liliana', 'Aubree', 'Jade', 'Katherine', 'Isabelle', 'Natalia', 'Raelynn', 'Maria', 'Athena', 'Ximena', 'Arya', 'Leilani', 'Taylor', 'Faith', 'Rose', 'Kylie', 'Alexandra', 'Mary', 'Margaret', 'Lyla', 'Ashley', 'Amaya', 'Eliza', 'Brianna', 'Bailey', 'Andrea', 'Khloe', 'Jasmine', 'Melody', 'Iris', 'Isabel', 'Norah', 'Annabelle', 'Valeria', 'Emerson', 'Adalyn', 'Ryleigh', 'Eden', 'Emersyn', 'Anastasia', 'Kayla', 'Alyssa', 'Juliana', 'Charlie', 'Esther', 'Ariel', 'Cecilia', 'Valerie', 'Alina', 'Molly', 'Reese', 'Aliyah', 'Lilly', 'Parker', 'Finley', 'Morgan', 'Sydney', 'Jordyn', 'Eloise', 'Trinity', 'Daisy', 'Kimberly', 'Lauren', 'Genevieve', 'Sara', 'Arabella', 'Harmony', 'Elise', 'Remi', 'Teagan', 'Alexis', 'London', 'Sloane', 'Laila', 'Lucia', 'Diana', 'Juliette', 'Sienna', 'Elliana', 'Londyn', 'Ayla', 'Callie', 'Gracie', 'Josie', 'Amara', 'Jocelyn', 'Daniela', 'Everleigh', 'Mya', 'Rachel', 'Summer', 'Alana', 'Brooke', 'Alaina', 'Mckenzie', 'Catherine', 'Amy', 'Presley', 'Journee', 'Rosalie', 'Ember', 'Brynlee', 'Rowan', 'Joanna', 'Paige', 'Rebecca', 'Ana', 'Sawyer', 'Mariah', 'Nicole', 'Brooklynn', 'Payton', 'Marley', 'Fiona', 'Georgia', 'Lila', 'Harley', 'Adelyn', 'Alivia', 'Noelle', 'Gemma', 'Vanessa', 'Journey', 'Makayla', 'Angelina', 'Adaline', 'Catalina', 'Alayna', 'Julianna', 'Leila', 'Lola', 'Adriana', 'June', 'Juliet', 'Jayla', 'River', 'Tessa', 'Lia', 'Dakota', 'Delaney', 'Selena', 'Blakely', 'Ada', 'Camille', 'Zara', 'Malia', 'Hope', 'Samara', 'Vera', 'Mckenna', 'Briella', 'Izabella', 'Hayden', 'Raegan', 'Michelle', 'Angela', 'Ruth', 'Freya', 'Kamila', 'Vivienne', 'Aspen', 'Olive', 'Kendall', 'Elaina', 'Thea', 'Kali', 'Destiny', 'Amiyah', 'Evangeline', 'Cali', 'Blake', 'Elsie', 'Juniper', 'Alexandria', 'Myla', 'Ariella', 'Kate', 'Mariana', 'Lilah', 'Charlee', 'Daleyza', 'Nyla', 'Jane', 'Maggie', 'Zuri', 'Aniyah', 'Lucille', 'Leia', 'Melissa', 'Adelaide', 'Amina', 'Giselle', 'Lena', 'Camilla', 'Miriam', 'Millie', 'Brynn', 'Gabrielle', 'Sage', 'Annie', 'Logan', 'Lilliana', 'Haven', 'Jessica', 'Kaia', 'Magnolia', 'Amira', 'Adelynn', 'Makenzie', 'Stephanie', 'Nina', 'Phoebe', 'Arielle', 'Evie', 'Lyric', 'Alessandra', 'Gabriela', 'Paislee', 'Raelyn', 'Madilyn', 'Paris', 'Makenna', 'Kinley', 'Gracelyn', 'Talia', 'Maeve', 'Rylie', 'Kiara', 'Evelynn', 'Brinley', 'Jacqueline', 'Laura', 'Gracelynn', 'Lexi', 'Ariah', 'Fatima', 'Jennifer', 'Kehlani', 'Alani', 'Ariyah', 'Luciana', 'Allie', 'Heidi', 'Maci', 'Phoenix', 'Felicity', 'Joy', 'Kenzie', 'Veronica', 'Margot', 'Addilyn', 'Lana', 'Cassidy', 'Remington', 'Saylor', 'Ryan', 'Keira', 'Harlow', 'Miranda', 'Angel', 'Amanda', 'Daniella', 'Royalty', 'Gwendolyn', 'Ophelia', 'Heaven', 'Jordan', 'Madeleine', 'Esmeralda', 'Kira', 'Miracle', 'Elle', 'Amari', 'Danielle', 'Daphne', 'Willa', 'Haley', 'Gia', 'Kaitlyn', 'Oakley', 'Kailani', 'Winter', 'Alicia', 'Serena', 'Nadia', 'Aviana', 'Demi', 'Jada', 'Braelynn', 'Dylan', 'Ainsley', 'Alison', 'Camryn', 'Avianna', 'Bianca', 'Skyler', 'Scarlet', 'Maddison', 'Nylah', 'Sarai', 'Regina', 'Dahlia', 'Nayeli', 'Raven', 'Helen', 'Adrianna', 'Averie', 'Skye', 'Kelsey', 'Tatum', 'Kensley', 'Maliyah', 'Erin', 'Viviana', 'Jenna', 'Anaya', 'Carolina', 'Shelby', 'Sabrina', 'Mikayla', 'Annalise', 'Octavia', 'Lennon', 'Blair', 'Carmen', 'Yaretzi', 'Kennedi', 'Mabel', 'Zariah', 'Kyla', 'Christina', 'Selah', 'Celeste', 'Eve', 'Mckinley', 'Milani', 'Frances', 'Jimena', 'Kylee', 'Leighton', 'Katie', 'Aitana', 'Kayleigh', 'Sierra', 'Kathryn', 'Rosemary', 'Jolene', 'Alondra', 'Elisa', 'Helena', 'Charleigh', 'Hallie', 'Lainey', 'Avah', 'Jazlyn', 'Kamryn', 'Mira', 'Cheyenne', 'Francesca', 'Antonella', 'Wren', 'Chelsea', 'Amber', 'Emory', 'Lorelei', 'Nia', 'Abby', 'April', 'Emelia', 'Carter', 'Aylin', 'Cataleya', 'Bethany', 'Marlee', 'Carly', 'Kaylani', 'Emely', 'Liana', 'Madelynn', 'Cadence', 'Matilda', 'Sylvia', 'Myra', 'Fernanda', 'Oaklyn', 'Elianna', 'Hattie', 'Dayana', 'Kendra', 'Maisie', 'Malaysia', 'Kara', 'Katelyn', 'Maia', 'Celine', 'Cameron', 'Renata', 'Jayleen', 'Charli', 'Emmalyn', 'Holly', 'Azalea', 'Leona', 'Alejandra', 'Bristol', 'Collins', 'Imani', 'Meadow', 'Alexia', 'Edith', 'Kaydence', 'Leslie', 'Lilith', 'Kora', 'Aisha', 'Meredith', 'Danna', 'Wynter', 'Emberly', 'Julieta', 'Michaela', 'Alayah', 'Jemma', 'Reign', 'Colette', 'Kaliyah', 'Elliott', 'Johanna', 'Remy', 'Sutton', 'Emmy', 'Virginia', 'Briana', 'Oaklynn', 'Adelina', 'Everlee', 'Megan', 'Angelica', 'Justice', 'Mariam', 'Khaleesi', 'Macie', 'Karsyn', 'Alanna', 'Aleah', 'Mae', 'Mallory', 'Esme', 'Skyla', 'Madilynn', 'Charley', 'Allyson', 'Hanna', 'Shiloh', 'Henley', 'Macy', 'Maryam', 'Ivanna', 'Ashlynn', 'Lorelai', 'Amora', 'Ashlyn', 'Sasha', 'Baylee', 'Beatrice', 'Itzel', 'Priscilla', 'Marie', 'Jayda', 'Liberty', 'Rory', 'Alessia', 'Alaia', 'Janelle', 'Kalani', 'Gloria', 'Sloan', 'Dorothy', 'Greta', 'Julie', 'Zahra', 'Savanna', 'Annabella', 'Poppy', 'Amalia', 'Zaylee', 'Cecelia', 'Coraline', 'Kimber', 'Emmie', 'Anne', 'Karina', 'Kassidy', 'Kynlee', 'Monroe', 'Anahi', 'Jaliyah', 'Jazmin', 'Maren', 'Monica', 'Siena', 'Marilyn', 'Reyna', 'Kyra', 'Lilian', 'Jamie', 'Melany', 'Alaya', 'Ariya', 'Kelly', 'Rosie', 'Adley', 'Dream', 'Jaylah', 'Laurel', 'Jazmine', 'Mina', 'Karla', 'Bailee', 'Aubrie', 'Katalina', 'Melina', 'Harlee', 'Elliot', 'Hayley', 'Elaine', 'Karen', 'Dallas', 'Irene', 'Lylah', 'Ivory', 'Chaya', 'Rosa', 'Aleena', 'Braelyn', 'Nola', 'Alma', 'Leyla', 'Pearl', 'Addyson', 'Roselyn', 'Lacey', 'Lennox', 'Reina', 'Aurelia', 'Noa', 'Janiyah', 'Jessie', 'Madisyn', 'Saige', 'Alia', 'Tiana', 'Astrid', 'Cassandra', 'Kyleigh', 'Romina', 'Stevie', 'Haylee', 'Zelda', 'Lillie', 'Aileen', 'Brylee', 'Eileen', 'Yara', 'Ensley', 'Lauryn', 'Giuliana', 'Livia', 'Anya', 'Mikaela', 'Palmer', 'Lyra', 'Mara', 'Marina', 'Kailey', 'Liv', 'Clementine', 'Kenna', 'Briar', 'Emerie', 'Galilea', 'Tiffany', 'Bonnie', 'Elyse', 'Cynthia', 'Frida', 'Kinslee', 'Tatiana', 'Joelle', 'Armani', 'Jolie', 'Nalani', 'Rayna', 'Yareli', 'Meghan', 'Rebekah', 'Addilynn', 'Faye', 'Zariyah', 'Lea', 'Aliza', 'Julissa', 'Lilyana', 'Anika', 'Kairi', 'Aniya', 'Noemi', 'Angie', 'Crystal', 'Bridget', 'Ari', 'Davina', 'Amelie', 'Amirah', 'Annika', 'Elora', 'Xiomara', 'Linda', 'Hana', 'Laney', 'Mercy', 'Hadassah', 'Madalyn', 'Louisa', 'Simone', 'Kori', 'Jillian', 'Alena', 'Malaya', 'Miley', 'Milan', 'Sariyah', 'Malani', 'Clarissa', 'Nala', 'Princess', 'Amani', 'Analia', 'Estella', 'Milana', 'Aya', 'Chana', 'Jayde', 'Tenley', 'Zaria', 'Itzayana', 'Penny', 'Ailani', 'Lara', 'Aubriella', 'Clare', 'Lina', 'Rhea', 'Bria', 'Thalia', 'Keyla', 'Haisley', 'Ryann', 'Addisyn', 'Amaia', 'Chanel', 'Ellen', 'Harmoni', 'Aliana', 'Tinsley', 'Landry', 'Paisleigh', 'Lexie', 'Myah', 'Rylan', 'Deborah', 'Emilee', 'Laylah', 'Novalee', 'Ellis', 'Emmeline', 'Avalynn', 'Hadlee', 'Legacy', 'Braylee', 'Elisabeth', 'Kaylie', 'Ansley', 'Dior', 'Paula', 'Belen', 'Corinne', 'Maleah', 'Martha', 'Teresa', 'Salma', 'Louise', 'Averi', 'Lilianna', 'Amiya', 'Milena', 'Royal', 'Aubrielle', 'Calliope', 'Frankie', 'Natasha', 'Kamilah', 'Meilani', 'Raina', 'Amayah', 'Lailah', 'Rayne', 'Zaniyah', 'Isabela', 'Nathalie', 'Miah', 'Opal', 'Kenia', 'Azariah', 'Hunter', 'Tori', 'Andi', 'Keily', 'Leanna', 'Scarlette', 'Jaelyn', 'Saoirse', 'Selene', 'Dalary', 'Lindsey', 'Marianna', 'Ramona', 'Estelle', 'Giovanna', 'Holland', 'Nancy', 'Emmalynn', 'Mylah', 'Rosalee', 'Sariah', 'Zoie', 'Blaire', 'Lyanna', 'Maxine', 'Anais', 'Dana', 'Judith', 'Kiera', 'Jaelynn', 'Noor', 'Kai', 'Adalee', 'Oaklee', 'Amaris', 'Jaycee', 'Belle', 'Carolyn', 'Della', 'Karter', 'Sky', 'Treasure', 'Vienna', 'Jewel', 'Rivka', 'Rosalyn', 'Alannah', 'Ellianna', 'Sunny', 'Claudia', 'Cara', 'Hailee', 'Estrella', 'Harleigh', 'Zhavia', 'Alianna', 'Brittany', 'Jaylene', 'Journi', 'Marissa', 'Mavis', 'Iliana', 'Jurnee', 'Aislinn', 'Alyson', 'Elsa', 'Kamiyah', 'Kiana', 'Lisa', 'Arlette', 'Kadence', 'Kathleen', 'Halle', 'Erika', 'Sylvie', 'Adele', 'Erica', 'Veda', 'Whitney', 'Bexley', 'Emmaline', 'Guadalupe', 'August', 'Brynleigh', 'Gwen', 'Promise', 'Alisson', 'India', 'Madalynn', 'Paloma', 'Patricia', 'Samira', 'Aliya', 'Casey', 'Jazlynn', 'Paulina', 'Dulce', 'Kallie', 'Perla', 'Adrienne', 'Alora', 'Nataly', 'Ayleen', 'Christine', 'Kaiya', 'Ariadne', 'Karlee', 'Barbara', 'Lillianna', 'Raquel', 'Saniyah', 'Yamileth', 'Arely', 'Celia', 'Heavenly', 'Kaylin', 'Marisol', 'Marleigh', 'Avalyn', 'Berkley', 'Kataleya', 'Zainab', 'Dani', 'Egypt', 'Joyce', 'Kenley', 'Annabel', 'Kaelyn', 'Etta', 'Hadleigh', 'Joselyn', 'Luella', 'Jaylee', 'Zola', 'Alisha', 'Ezra', 'Queen', 'Amia', 'Annalee', 'Bellamy', 'Paola', 'Tinley', 'Violeta', 'Jenesis', 'Arden', 'Giana', 'Wendy', 'Ellison', 'Florence', 'Margo', 'Naya', 'Robin', 'Sandra', 'Scout', 'Waverly', 'Janessa', 'Jayden', 'Micah', 'Novah', 'Zora', 'Ann', 'Jana', 'Taliyah', 'Vada', 'Giavanna', 'Ingrid', 'Valery', 'Azaria', 'Emmarie', 'Esperanza', 'Kailyn', 'Aiyana', 'Keilani', 'Austyn', 'Whitley', 'Elina', 'Kimora', 'Maliah']
maFirst = ['Liam', 'Noah', 'William', 'James', 'Oliver', 'Benjamin', 'Elijah', 'Lucas', 'Mason', 'Logan', 'Alexander', 'Ethan', 'Jacob', 'Michael', 'Daniel', 'Henry', 'Jackson', 'Sebastian', 'Aiden', 'Matthew', 'Samuel', 'David', 'Joseph', 'Carter', 'Owen', 'Wyatt', 'John', 'Jack', 'Luke', 'Jayden', 'Dylan', 'Grayson', 'Levi', 'Isaac', 'Gabriel', 'Julian', 'Mateo', 'Anthony', 'Jaxon', 'Lincoln', 'Joshua', 'Christopher', 'Andrew', 'Theodore', 'Caleb', 'Ryan', 'Asher', 'Nathan', 'Thomas', 'Leo', 'Isaiah', 'Charles', 'Josiah', 'Hudson', 'Christian', 'Hunter', 'Connor', 'Eli', 'Ezra', 'Aaron', 'Landon', 'Adrian', 'Jonathan', 'Nolan', 'Jeremiah', 'Easton', 'Elias', 'Colton', 'Cameron', 'Carson', 'Robert', 'Angel', 'Maverick', 'Nicholas', 'Dominic', 'Jaxson', 'Greyson', 'Adam', 'Ian', 'Austin', 'Santiago', 'Jordan', 'Cooper', 'Brayden', 'Roman', 'Evan', 'Ezekiel', 'Xavier', 'Jose', 'Jace', 'Jameson', 'Leonardo', 'Bryson', 'Axel', 'Everett', 'Parker', 'Kayden', 'Miles', 'Sawyer', 'Jason', 'Declan', 'Weston', 'Micah', 'Ayden', 'Wesley', 'Luca', 'Vincent', 'Damian', 'Zachary', 'Silas', 'Gavin', 'Chase', 'Kai', 'Emmett', 'Harrison', 'Nathaniel', 'Kingston', 'Cole', 'Tyler', 'Bennett', 'Bentley', 'Ryker', 'Tristan', 'Brandon', 'Kevin', 'Luis', 'George', 'Ashton', 'Rowan', 'Braxton', 'Ryder', 'Gael', 'Ivan', 'Diego', 'Maxwell', 'Max', 'Carlos', 'Kaiden', 'Juan', 'Maddox', 'Justin', 'Waylon', 'Calvin', 'Giovanni', 'Jonah', 'Abel', 'Jayce', 'Jesus', 'Amir', 'King', 'Beau', 'Camden', 'Alex', 'Jasper', 'Malachi', 'Brody', 'Jude', 'Blake', 'Emmanuel', 'Eric', 'Brooks', 'Elliot', 'Antonio', 'Abraham', 'Timothy', 'Finn', 'Rhett', 'Elliott', 'Edward', 'August', 'Xander', 'Alan', 'Dean', 'Lorenzo', 'Bryce', 'Karter', 'Victor', 'Milo', 'Miguel', 'Hayden', 'Graham', 'Grant', 'Zion', 'Tucker', 'Jesse', 'Zayden', 'Joel', 'Richard', 'Patrick', 'Emiliano', 'Avery', 'Nicolas', 'Brantley', 'Dawson', 'Myles', 'Matteo', 'River', 'Steven', 'Thiago', 'Zane', 'Matias', 'Judah', 'Messiah', 'Jeremy', 'Preston', 'Oscar', 'Kaleb', 'Alejandro', 'Marcus', 'Mark', 'Peter', 'Maximus', 'Barrett', 'Jax', 'Andres', 'Holden', 'Legend', 'Charlie', 'Knox', 'Kaden', 'Paxton', 'Kyrie', 'Kyle', 'Griffin', 'Josue', 'Kenneth', 'Beckett', 'Enzo', 'Adriel', 'Arthur', 'Felix', 'Bryan', 'Lukas', 'Paul', 'Brian', 'Colt', 'Caden', 'Leon', 'Archer', 'Omar', 'Israel', 'Aidan', 'Theo', 'Javier', 'Remington', 'Jaden', 'Bradley', 'Emilio', 'Colin', 'Riley', 'Cayden', 'Phoenix', 'Clayton', 'Simon', 'Ace', 'Nash', 'Derek', 'Rafael', 'Zander', 'Brady', 'Jorge', 'Jake', 'Louis', 'Damien', 'Karson', 'Walker', 'Maximiliano', 'Amari', 'Sean', 'Chance', 'Walter', 'Martin', 'Finley', 'Andre', 'Tobias', 'Cash', 'Corbin', 'Arlo', 'Iker', 'Erick', 'Emerson', 'Gunner', 'Cody', 'Stephen', 'Francisco', 'Killian', 'Dallas', 'Reid', 'Manuel', 'Lane', 'Atlas', 'Rylan', 'Jensen', 'Ronan', 'Beckham', 'Daxton', 'Anderson', 'Kameron', 'Raymond', 'Orion', 'Cristian', 'Tanner', 'Kyler', 'Jett', 'Cohen', 'Ricardo', 'Spencer', 'Gideon', 'Ali', 'Fernando', 'Jaiden', 'Titus', 'Travis', 'Bodhi', 'Eduardo', 'Dante', 'Ellis', 'Prince', 'Kane', 'Luka', 'Kash', 'Hendrix', 'Desmond', 'Donovan', 'Mario', 'Atticus', 'Cruz', 'Garrett', 'Hector', 'Angelo', 'Jeffrey', 'Edwin', 'Cesar', 'Zayn', 'Devin', 'Conor', 'Warren', 'Odin', 'Jayceon', 'Romeo', 'Julius', 'Jaylen', 'Hayes', 'Kayson', 'Muhammad', 'Jaxton', 'Joaquin', 'Caiden', 'Dakota', 'Major', 'Keegan', 'Sergio', 'Marshall', 'Johnny', 'Kade', 'Edgar', 'Leonel', 'Ismael', 'Marco', 'Tyson', 'Wade', 'Collin', 'Troy', 'Nasir', 'Conner', 'Adonis', 'Jared', 'Rory', 'Andy', 'Jase', 'Lennox', 'Shane', 'Malik', 'Ari', 'Reed', 'Seth', 'Clark', 'Erik', 'Lawson', 'Trevor', 'Gage', 'Nico', 'Malakai', 'Quinn', 'Cade', 'Johnathan', 'Sullivan', 'Solomon', 'Cyrus', 'Fabian', 'Pedro', 'Frank', 'Shawn', 'Malcolm', 'Khalil', 'Nehemiah', 'Dalton', 'Mathias', 'Jay', 'Ibrahim', 'Peyton', 'Winston', 'Kason', 'Zayne', 'Noel', 'Princeton', 'Matthias', 'Gregory', 'Sterling', 'Dominick', 'Elian', 'Grady', 'Russell', 'Finnegan', 'Ruben', 'Gianni', 'Porter', 'Kendrick', 'Leland', 'Pablo', 'Allen', 'Hugo', 'Raiden', 'Kolton', 'Remy', 'Ezequiel', 'Damon', 'Emanuel', 'Zaiden', 'Otto', 'Bowen', 'Marcos', 'Abram', 'Kasen', 'Franklin', 'Royce', 'Jonas', 'Sage', 'Philip', 'Esteban', 'Drake', 'Kashton', 'Roberto', 'Harvey', 'Alexis', 'Kian', 'Jamison', 'Maximilian', 'Adan', 'Milan', 'Phillip', 'Albert', 'Dax', 'Mohamed', 'Ronin', 'Kamden', 'Hank', 'Memphis', 'Oakley', 'Augustus', 'Drew', 'Moises', 'Armani', 'Rhys', 'Benson', 'Jayson', 'Kyson', 'Braylen', 'Corey', 'Gunnar', 'Omari', 'Alonzo', 'Landen', 'Armando', 'Derrick', 'Dexter', 'Enrique', 'Bruce', 'Nikolai', 'Francis', 'Rocco', 'Kairo', 'Royal', 'Zachariah', 'Arjun', 'Deacon', 'Skyler', 'Eden', 'Alijah', 'Rowen', 'Pierce', 'Uriel', 'Ronald', 'Luciano', 'Tate', 'Frederick', 'Kieran', 'Lawrence', 'Moses', 'Rodrigo', 'Brycen', 'Leonidas', 'Nixon', 'Keith', 'Chandler', 'Case', 'Davis', 'Asa', 'Darius', 'Isaias', 'Aden', 'Jaime', 'Landyn', 'Raul', 'Niko', 'Trenton', 'Apollo', 'Cairo', 'Izaiah', 'Scott', 'Dorian', 'Julio', 'Wilder', 'Santino', 'Dustin', 'Donald', 'Raphael', 'Saul', 'Taylor', 'Ayaan', 'Duke', 'Ryland', 'Tatum', 'Ahmed', 'Moshe', 'Edison', 'Emmitt', 'Cannon', 'Alec', 'Danny', 'Keaton', 'Roy', 'Conrad', 'Roland', 'Quentin', 'Lewis', 'Samson', 'Brock', 'Kylan', 'Cason', 'Ahmad', 'Jalen', 'Nikolas', 'Braylon', 'Kamari', 'Dennis', 'Callum', 'Justice', 'Soren', 'Rayan', 'Aarav', 'Gerardo', 'Ares', 'Brendan', 'Jamari', 'Kaison', 'Yusuf', 'Issac', 'Jasiah', 'Callen', 'Forrest', 'Makai', 'Crew', 'Kobe', 'Bo', 'Julien', 'Mathew', 'Braden', 'Johan', 'Marvin', 'Zaid', 'Stetson', 'Casey', 'Ty', 'Ariel', 'Tony', 'Zain', 'Callan', 'Cullen', 'Sincere', 'Uriah', 'Dillon', 'Kannon', 'Colby', 'Axton', 'Cassius', 'Quinton', 'Mekhi', 'Reece', 'Alessandro', 'Jerry', 'Mauricio', 'Sam', 'Trey', 'Mohammad', 'Alberto', 'Gustavo', 'Arturo', 'Fletcher', 'Marcelo', 'Abdiel', 'Hamza', 'Alfredo', 'Chris', 'Finnley', 'Curtis', 'Kellan', 'Quincy', 'Kase', 'Harry', 'Kyree', 'Wilson', 'Cayson', 'Hezekiah', 'Kohen', 'Neil', 'Mohammed', 'Raylan', 'Kaysen', 'Lucca', 'Sylas', 'Mack', 'Leonard', 'Lionel', 'Ford', 'Roger', 'Rex', 'Alden', 'Boston', 'Colson', 'Briggs', 'Zeke', 'Dariel', 'Kingsley', 'Valentino', 'Jamir', 'Salvador', 'Vihaan', 'Mitchell', 'Lance', 'Lucian', 'Darren', 'Jimmy', 'Alvin', 'Amos', 'Tripp', 'Zaire', 'Layton', 'Reese', 'Casen', 'Colten', 'Brennan', 'Korbin', 'Sonny', 'Bruno', 'Orlando', 'Devon', 'Huxley', 'Boone', 'Maurice', 'Nelson', 'Douglas', 'Randy', 'Gary', 'Lennon', 'Titan', 'Denver', 'Jaziel', 'Noe', 'Jefferson', 'Ricky', 'Lochlan', 'Rayden', 'Bryant', 'Langston', 'Lachlan', 'Clay', 'Abdullah', 'Lee', 'Baylor', 'Leandro', 'Ben', 'Kareem', 'Layne', 'Joe', 'Crosby', 'Deandre', 'Demetrius', 'Kellen', 'Carl', 'Jakob', 'Ridge', 'Bronson', 'Jedidiah', 'Rohan', 'Larry', 'Stanley', 'Tomas', 'Shiloh', 'Thaddeus', 'Watson', 'Baker', 'Vicente', 'Koda', 'Jagger', 'Nathanael', 'Carmelo', 'Shepherd', 'Graysen', 'Melvin', 'Ernesto', 'Jamie', 'Yosef', 'Clyde', 'Eddie', 'Tristen', 'Grey', 'Ray', 'Tommy', 'Samir', 'Ramon', 'Santana', 'Kristian', 'Marcel', 'Wells', 'Zyaire', 'Brecken', 'Byron', 'Otis', 'Reyansh', 'Axl', 'Joey', 'Trace', 'Morgan', 'Musa', 'Harlan', 'Enoch', 'Henrik', 'Kristopher', 'Talon', 'Rey', 'Guillermo', 'Houston', 'Jon', 'Vincenzo', 'Dane', 'Terry', 'Azariah', 'Castiel', 'Kye', 'Augustine', 'Zechariah', 'Joziah', 'Kamryn', 'Hassan', 'Jamal', 'Chaim', 'Bodie', 'Emery', 'Branson', 'Jaxtyn', 'Kole', 'Wayne', 'Aryan', 'Alonso', 'Brixton', 'Madden', 'Allan', 'Flynn', 'Jaxen', 'Harley', 'Magnus', 'Sutton', 'Dash', 'Anders', 'Westley', 'Brett', 'Emory', 'Felipe', 'Yousef', 'Jadiel', 'Mordechai', 'Dominik', 'Junior', 'Eliseo', 'Fisher', 'Harold', 'Jaxxon', 'Kamdyn', 'Maximo', 'Caspian', 'Kelvin', 'Damari', 'Fox', 'Trent', 'Hugh', 'Briar', 'Franco', 'Keanu', 'Terrance', 'Yahir', 'Ameer', 'Kaiser', 'Thatcher', 'Ishaan', 'Koa', 'Merrick', 'Coen', 'Rodney', 'Brayan', 'London', 'Rudy', 'Gordon', 'Bobby', 'Aron', 'Marc', 'Van', 'Anakin', 'Canaan', 'Dario', 'Reginald', 'Westin', 'Darian', 'Ledger', 'Leighton', 'Maxton', 'Tadeo', 'Valentin', 'Aldo', 'Khalid', 'Nickolas', 'Toby', 'Dayton', 'Jacoby', 'Billy', 'Gatlin', 'Elisha', 'Jabari', 'Jermaine', 'Alvaro', 'Marlon', 'Mayson', 'Blaze', 'Jeffery', 'Kace', 'Braydon', 'Achilles', 'Brysen', 'Saint', 'Xzavier', 'Aydin', 'Eugene', 'Adrien', 'Cain', 'Kylo', 'Nova', 'Onyx', 'Arian', 'Bjorn', 'Jerome', 'Miller', 'Alfred', 'Kenzo', 'Kyng', 'Leroy', 'Maison', 'Jordy', 'Stefan', 'Wallace', 'Benicio', 'Kendall', 'Zayd', 'Blaine', 'Tristian', 'Anson', 'Gannon', 'Jeremias', 'Marley', 'Ronnie', 'Dangelo', 'Kody', 'Will', 'Bentlee', 'Gerald', 'Salvatore', 'Turner', 'Chad', 'Misael', 'Mustafa', 'Konnor', 'Maxim', 'Rogelio', 'Zakai', 'Cory', 'Judson', 'Brentley', 'Darwin', 'Louie', 'Ulises', 'Dakari', 'Rocky', 'Wesson', 'Alfonso', 'Payton', 'Dwayne', 'Juelz', 'Duncan', 'Keagan', 'Deshawn', 'Bode', 'Bridger', 'Skylar', 'Brodie', 'Landry', 'Avi', 'Keenan', 'Reuben', 'Jaxx', 'Rene', 'Yehuda', 'Imran', 'Yael', 'Alexzander', 'Willie', 'Cristiano', 'Heath', 'Lyric', 'Davion', 'Elon', 'Karsyn', 'Krew', 'Jairo', 'Maddux', 'Ephraim', 'Ignacio', 'Vivaan', 'Aries', 'Vance', 'Boden', 'Lyle', 'Ralph', 'Reign', 'Camilo', 'Draven', 'Terrence', 'Idris', 'Ira', 'Javion', 'Jericho', 'Khari', 'Marcellus', 'Creed', 'Shepard', 'Terrell', 'Ahmir', 'Camdyn', 'Cedric', 'Howard', 'Jad', 'Zahir', 'Harper', 'Justus', 'Forest', 'Gibson', 'Zev', 'Alaric', 'Decker', 'Ernest', 'Jesiah', 'Torin', 'Benedict', 'Bowie', 'Deangelo', 'Genesis', 'Harlem', 'Kalel', 'Kylen', 'Bishop', 'Immanuel', 'Lian', 'Zavier', 'Archie', 'Davian', 'Gus', 'Kabir', 'Korbyn', 'Randall', 'Benton', 'Coleman', 'Markus']
last = ['Smith', 'Johnson', 'Williams', 'Brown', 'Jones', 'Garcia', 'Miller', 'Davis', 'Rodriguez', 'Martinez', 'Hernandez', 'Lopez', 'Gonzales', 'Wilson', 'Anderson', 'Thomas', 'Taylor', 'Moore', 'Jackson', 'Martin', 'Lee', 'Perez', 'Thompson', 'White', 'Harris', 'Sanchez', 'Clark', 'Ramirez', 'Lewis', 'Robinson', 'Walker', 'Young', 'Allen', 'King', 'Wright', 'Scott', 'Torres', 'Nguyen', 'Hill', 'Flores', 'Green', 'Adams', 'Nelson', 'Baker', 'Hall', 'Rivera', 'Campbell', 'Mitchell', 'Carter', 'Roberts', 'Gomez', 'Phillips', 'Evans', 'Turner', 'Diaz', 'Parker', 'Cruz', 'Edwards', 'Collins', 'Reyes', 'Stewart', 'Morris', 'Morales', 'Murphy', 'Cook', 'Rogers', 'Gutierrez', 'Ortiz', 'Morgan', 'Cooper', 'Peterson', 'Bailey', 'Reed', 'Kelly', 'Howard', 'Ramos', 'Kim', 'Cox', 'Ward', 'Richardson', 'Watson', 'Brooks', 'Chavez', 'Wood', 'James', 'Bennet', 'Gray', 'Mendoza', 'Ruiz', 'Hughes', 'Price', 'Alvarez', 'Castillo', 'Sanders', 'Patel', 'Myers', 'Long', 'Ross', 'Foster', 'Jimenez']
| 3,457.666667 | 10,010 | 0.594428 | 2,103 | 20,746 | 5.864004 | 0.947694 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.10161 | 20,746 | 5 | 10,011 | 4,149.2 | 0.661659 | 0 | 0 | 0 | 0 | 0 | 0.59356 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b028018661b0929da5b6a926d65bb750a50efe57 | 444 | py | Python | oldtoronto/test/toronto_archives_test.py | patcon/oldto | 44c099550a4e3cfafa85afbaebd3cd6c33325891 | [
"Apache-2.0"
] | 22 | 2018-04-25T22:03:53.000Z | 2021-07-13T18:43:23.000Z | oldtoronto/test/toronto_archives_test.py | patcon/oldto | 44c099550a4e3cfafa85afbaebd3cd6c33325891 | [
"Apache-2.0"
] | 17 | 2018-04-30T14:04:08.000Z | 2022-02-13T19:52:44.000Z | oldtoronto/test/toronto_archives_test.py | patcon/oldto | 44c099550a4e3cfafa85afbaebd3cd6c33325891 | [
"Apache-2.0"
] | 7 | 2018-05-08T23:32:44.000Z | 2022-01-27T17:49:30.000Z | from nose.tools import eq_
from oldtoronto.toronto_archives import get_citation_hierarchy # noqa
def test_get_citation_hierarchy():
eq_([
'Fonds 200, Series 123',
'Fonds 200'
], get_citation_hierarchy('Fonds 200, Series 123, Item 456'))
eq_([
'Fonds 257, Series 12, File 1983',
'Fonds 257, Series 12',
'Fonds 257'
], get_citation_hierarchy('Fonds 257, Series 12, File 1983, 52","'))
| 26.117647 | 73 | 0.646396 | 58 | 444 | 4.724138 | 0.431034 | 0.160584 | 0.291971 | 0.175182 | 0.175182 | 0.175182 | 0 | 0 | 0 | 0 | 0 | 0.136905 | 0.243243 | 444 | 16 | 74 | 27.75 | 0.678571 | 0.009009 | 0 | 0.166667 | 0 | 0 | 0.365297 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | true | 0 | 0.166667 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b0578e2fd0b0bbd54ee3add80281e9bcba12bdeb | 428 | py | Python | airypi/redis_queue.py | airypi/airypi | c7e3e781eaf2e6b3e2e87b576d5202e381544d0c | [
"Apache-2.0"
] | 3 | 2015-11-04T19:45:48.000Z | 2017-10-26T19:40:18.000Z | airypi/redis_queue.py | airypi/airypi | c7e3e781eaf2e6b3e2e87b576d5202e381544d0c | [
"Apache-2.0"
] | null | null | null | airypi/redis_queue.py | airypi/airypi | c7e3e781eaf2e6b3e2e87b576d5202e381544d0c | [
"Apache-2.0"
] | null | null | null | import redis
from flask import g, session
import device
import message_queue
import os
class RedisMQ(message_queue.MessageQueue):
redis = None
def push(self, data):
RedisMQ.redis.lpush(self.queue_key, data)
RedisMQ.redis.ltrim(self.queue_key, 0, self.max_size)
def pop(self):
return RedisMQ.redis.rpop(self.queue_key)
def clear(self):
RedisMQ.redis.delete(self.queue_key) | 22.526316 | 61 | 0.698598 | 61 | 428 | 4.786885 | 0.47541 | 0.164384 | 0.164384 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00295 | 0.207944 | 428 | 19 | 62 | 22.526316 | 0.858407 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.357143 | 0.071429 | 0.785714 | 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 | 0 | 1 | 0 | 0 | 3 |
c665a58b2ec63745fb6a56eded667c424d56d832 | 548 | py | Python | fisica.py | Kenedw/RSSF | b9e7f2f0c6f2304af4de645039e70800d22d2b0c | [
"MIT"
] | 1 | 2019-09-01T20:28:35.000Z | 2019-09-01T20:28:35.000Z | fisica.py | Kenedw/RSSF | b9e7f2f0c6f2304af4de645039e70800d22d2b0c | [
"MIT"
] | null | null | null | fisica.py | Kenedw/RSSF | b9e7f2f0c6f2304af4de645039e70800d22d2b0c | [
"MIT"
] | 1 | 2019-05-18T00:09:26.000Z | 2019-05-18T00:09:26.000Z | from packet import packet
# Camada Fisica
class fisica():
'''
@param link list(hosts)
@param ativo boolean (true|false)
'''
def __init__(self):
self.__link = []
# self.__link = link
self.__is_ativo = False
self.__dado = packet
def __SetAtivo(self,ativo):
self.__is_ativo = ativo
def __GetAtivo(self):
return self.__is_ativo
def __SetDado(self,dado):
self.__dado = dado
def __GetDado(self):
return self.__dado
def __SendDado(self,hostDest):
hostDest.send(hostDest.ID,self.__GetDado())
| 18.896552 | 47 | 0.669708 | 70 | 548 | 4.742857 | 0.4 | 0.096386 | 0.099398 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.215328 | 548 | 28 | 48 | 19.571429 | 0.772093 | 0.166058 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0 | 0.0625 | 0.125 | 0.625 | 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 | 0 | 1 | 1 | 0 | 0 | 3 |
c68b2764c5975cf7d7cb7f41a4acfa6e9c0a27aa | 2,496 | py | Python | Misc/convm.py | Dengjianping/AlgorithmsPractice | 612f40b4fca4c1cf2b0cd9ca4df63e217b7affbf | [
"MIT"
] | null | null | null | Misc/convm.py | Dengjianping/AlgorithmsPractice | 612f40b4fca4c1cf2b0cd9ca4df63e217b7affbf | [
"MIT"
] | null | null | null | Misc/convm.py | Dengjianping/AlgorithmsPractice | 612f40b4fca4c1cf2b0cd9ca4df63e217b7affbf | [
"MIT"
] | null | null | null | a=[[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5]]
b=[[1,2,3,4],[3,4,5,5]]
def convMatrix(a, b, mode='full'):
if mode == 'full':
row=len(a)+len(b) - 1
col=len(a[0])+len(b[0]) - 1
c= [[0 for i in range(col)] for i in range(row)]
for i in range(len(a)):
for j in range(len(a[0])):
for m in range(len(b)):
for n in range(len(b[0])):
c[i+m][j+n] += a[i][j] * b[m][n]
return c
if mode == 'same':
row=len(a)
col=len(a[0])
c= [[0 for i in range(col)] for i in range(row)]
for i in range(len(a)):
for j in range(len(a[0])):
for m in range(len(b)):
for n in range(len(b[0])):
if (0 <= i+m-len(b)/2 < row and 0 <= j+n-len(b[0])/2 < col):
c[i+m-len(b)/2][j+n-len(b[0])/2] += a[i][j] * b[m][n]
return c
if mode == 'valid':
row=len(a)-len(b) + 1
col=len(a[0])-len(b[0]) + 1
c= [[0 for i in range(col)] for i in range(row)]
for i in range(len(a)):
for j in range(len(a[0])):
for m in range(len(b)):
for n in range(len(b[0])):
r = i-len(b)+m+1
co = j+n-len(b[0])+1
if (0 <= r < row and 0 <= co < col):
c[r][co] += a[i][j] * b[m][n]
return c
def convArray(a, b, mode='full'):
if mode == 'full':
c=[0 for i in range(len(a) + len(b) - 1)]
for i, value in enumerate(a):
for j, key in enumerate(b):
c[i+j] += a[i] * b[j]
return c
if mode == 'same':
c=[0 for i in range(len(a))]
for i, value in enumerate(a):
for j, key in enumerate(b):
if (i+j-len(b)/2>=0 and i+j-len(b)/2<len(a)):
c[i+j-len(b)/2] += a[i] * b[j]
return c
if mode == 'valid':
c=[0 for i in range(len(a) - len(b)+1)]
for i, value in enumerate(a):
for j, key in enumerate(b):
if (i+j-len(b)+1>=0 and i+j-len(b)+1 < len(c)):
c[i+j-len(b)+1] += a[i] * b[j]
return c
print convArray(a[0], b[0],'full')
print convArray(a[0], b[0],'same')
print convArray(a[0], b[0],'valid')
print convMatrix(a, b,'full')
print convMatrix(a, b,'same')
print convMatrix(a, b,'valid') | 35.15493 | 84 | 0.405849 | 451 | 2,496 | 2.24612 | 0.077605 | 0.094768 | 0.148075 | 0.130306 | 0.814413 | 0.75617 | 0.656466 | 0.616979 | 0.553801 | 0.553801 | 0 | 0.048121 | 0.392228 | 2,496 | 71 | 85 | 35.15493 | 0.619644 | 0 | 0 | 0.515625 | 0 | 0 | 0.024029 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.09375 | 0 | 0 | 0 | null | 0 | 0 | 0 | 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 | 3 |
c68e8c8615c536021a7d96bf97849a89f15fbe86 | 672 | py | Python | build/lib/ripda/__init__.py | isakruas/ripda | a85e04be6f2d019a294a284e16b55b533cd32c33 | [
"MIT"
] | 3 | 2021-06-05T13:05:49.000Z | 2021-06-08T12:01:16.000Z | build/lib/ripda/__init__.py | isakruas/ripda | a85e04be6f2d019a294a284e16b55b533cd32c33 | [
"MIT"
] | null | null | null | build/lib/ripda/__init__.py | isakruas/ripda | a85e04be6f2d019a294a284e16b55b533cd32c33 | [
"MIT"
] | 1 | 2021-06-05T13:06:15.000Z | 2021-06-05T13:06:15.000Z | import os
from pathlib import Path
from .settings import default
import logging
try:
if os.path.isdir(str(Path.home()) + '/ripda/'):
if not os.path.isdir(str(Path.home()) + '/ripda/blocks/'):
os.mkdir(str(Path.home()) + '/ripda/blocks/')
pass
if not os.path.isfile(str(Path.home()) + '/ripda/config.ini'):
default()
pass
else:
os.mkdir(str(Path.home()) + '/ripda/')
os.mkdir(str(Path.home()) + '/ripda/blocks/')
default()
except Exception as e:
logging.exception(e)
__all__ = [
'block',
'blockchain',
'miner',
'node',
'transaction',
'wallet'
]
| 21.677419 | 70 | 0.549107 | 81 | 672 | 4.506173 | 0.407407 | 0.115068 | 0.180822 | 0.263014 | 0.386301 | 0.369863 | 0.306849 | 0 | 0 | 0 | 0 | 0 | 0.27381 | 672 | 30 | 71 | 22.4 | 0.747951 | 0 | 0 | 0.230769 | 0 | 0 | 0.169643 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.076923 | 0.153846 | 0 | 0.153846 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
c69e524f9b42fcb4896f83fcc4785aff222562d4 | 303 | py | Python | terrascript/data/davidji99/split.py | mjuenema/python-terrascript | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | [
"BSD-2-Clause"
] | 507 | 2017-07-26T02:58:38.000Z | 2022-01-21T12:35:13.000Z | terrascript/data/davidji99/split.py | mjuenema/python-terrascript | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | [
"BSD-2-Clause"
] | 135 | 2017-07-20T12:01:59.000Z | 2021-10-04T22:25:40.000Z | terrascript/data/davidji99/split.py | mjuenema/python-terrascript | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | [
"BSD-2-Clause"
] | 81 | 2018-02-20T17:55:28.000Z | 2022-01-31T07:08:40.000Z | # terrascript/data/davidji99/split.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:27:33 UTC)
import terrascript
class split_traffic_type(terrascript.Data):
pass
class split_workspace(terrascript.Data):
pass
__all__ = [
"split_traffic_type",
"split_workspace",
]
| 16.833333 | 73 | 0.745875 | 39 | 303 | 5.538462 | 0.615385 | 0.208333 | 0.148148 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.054475 | 0.151815 | 303 | 17 | 74 | 17.823529 | 0.785992 | 0.353135 | 0 | 0.222222 | 1 | 0 | 0.170984 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.222222 | 0.111111 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
c6ac4f68c9c3e35b48eadd2793c372b95b8f9ebd | 1,793 | py | Python | zinnia/converters.py | emencia/django-blog-xinnia | ab19b55477ce7003b6f0712f8bd12af3501c4829 | [
"BSD-3-Clause"
] | null | null | null | zinnia/converters.py | emencia/django-blog-xinnia | ab19b55477ce7003b6f0712f8bd12af3501c4829 | [
"BSD-3-Clause"
] | null | null | null | zinnia/converters.py | emencia/django-blog-xinnia | ab19b55477ce7003b6f0712f8bd12af3501c4829 | [
"BSD-3-Clause"
] | 1 | 2021-06-17T14:02:21.000Z | 2021-06-17T14:02:21.000Z | """URL converters for the Zinnia project"""
class FourDigitYearConverter:
"""
Pattern converter for a Year on four digits exactly
"""
regex = '[0-9]{4}'
def to_python(self, value):
return int(value)
def to_url(self, value):
# Enforce integer since some code may try to pass a number as a string
return '%04d' % int(value)
class TwoDigitMonthConverter:
"""
Pattern converter for a Month on four digits exactly
"""
regex = '[0-9]{2}'
def to_python(self, value):
return int(value)
def to_url(self, value):
# Enforce integer since some code may try to pass a number as a string
return '%02d' % int(value)
class TwoDigitDayConverter(TwoDigitMonthConverter):
"""
Pattern converter for a Day on four digits exactly.
Just an explicit Class which inherit from 'TwoDigitMonthConverter'.
"""
pass
class UsernamePathConverter:
"""
Pattern converter for Author username string
"""
regex = r'[a-zA-Z0-9_.+-@]+'
def to_python(self, value):
return value
def to_url(self, value):
return value
class PathPathConverter:
"""
Pattern converter for path string (such as ``foo/bar``)
"""
regex = r'[-\/\w]+'
def to_python(self, value):
return value
def to_url(self, value):
return value
class TagPathConverter:
"""
Pattern converter for tag string
"""
regex = '[^/]+'
def to_python(self, value):
return value
def to_url(self, value):
return value
class TokenPathConverter:
"""
Pattern converter for token string
"""
regex = r'[\dA-Z]+'
def to_python(self, value):
return value
def to_url(self, value):
return value
| 20.146067 | 78 | 0.611824 | 222 | 1,793 | 4.882883 | 0.310811 | 0.055351 | 0.138376 | 0.147601 | 0.563653 | 0.486162 | 0.486162 | 0.438192 | 0.438192 | 0.438192 | 0 | 0.009331 | 0.282766 | 1,793 | 88 | 79 | 20.375 | 0.833593 | 0.318461 | 0 | 0.578947 | 0 | 0 | 0.056058 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.315789 | false | 0.026316 | 0 | 0.315789 | 0.973684 | 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 | 0 | 1 | 1 | 0 | 0 | 3 |
c6ad38af41dda6b3a428b74b7d6a179478b67cda | 583 | py | Python | packages/syft/src/syft/core/node/common/node_table/setup.py | callezenwaka/PySyft | 2545c302441cfe727ec095c4f9aa136bff02be32 | [
"Apache-1.1"
] | 2 | 2022-02-18T03:48:27.000Z | 2022-03-05T06:13:57.000Z | packages/syft/src/syft/core/node/common/node_table/setup.py | callezenwaka/PySyft | 2545c302441cfe727ec095c4f9aa136bff02be32 | [
"Apache-1.1"
] | 3 | 2021-11-17T15:34:03.000Z | 2021-12-08T14:39:10.000Z | packages/syft/src/syft/core/node/common/node_table/setup.py | callezenwaka/PySyft | 2545c302441cfe727ec095c4f9aa136bff02be32 | [
"Apache-1.1"
] | 1 | 2021-08-19T12:23:01.000Z | 2021-08-19T12:23:01.000Z | # third party
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import String
# relative
from . import Base
class SetupConfig(Base):
__tablename__ = "setup"
id = Column(Integer(), primary_key=True, autoincrement=True)
domain_name = Column(String(255), default="")
node_id = Column(String(32), default="")
def __str__(self) -> str:
return f"<Domain Name: {self.domain_name}>"
def create_setup(id: int, domain_name: str, node_id: str) -> SetupConfig:
return SetupConfig(id=id, domain_name=domain_name, node_id=node_id)
| 25.347826 | 73 | 0.716981 | 78 | 583 | 5.115385 | 0.410256 | 0.150376 | 0.150376 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010331 | 0.169811 | 583 | 22 | 74 | 26.5 | 0.81405 | 0.034305 | 0 | 0 | 0 | 0 | 0.067857 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.307692 | 0.153846 | 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 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
c6b2844ec8d83bfcefb1163893e3fea8102bf2bc | 1,554 | py | Python | 04 - Classes-inheritance-oops/39-classes-numeric-normal-magic-methods.py | python-demo-codes/basics | 2a151bbff4b528cefd52978829c632fd087c8f20 | [
"DOC"
] | 2 | 2019-08-23T06:05:55.000Z | 2019-08-26T03:56:07.000Z | 04 - Classes-inheritance-oops/39-classes-numeric-normal-magic-methods.py | python-lang-codes/basics | 2a151bbff4b528cefd52978829c632fd087c8f20 | [
"DOC"
] | null | null | null | 04 - Classes-inheritance-oops/39-classes-numeric-normal-magic-methods.py | python-lang-codes/basics | 2a151bbff4b528cefd52978829c632fd087c8f20 | [
"DOC"
] | 4 | 2020-10-01T07:16:07.000Z | 2021-07-17T07:55:08.000Z | # HEAD
# Classes - Magic Methods - Normal Numeric Magic Methods
# DESCRIPTION
# Describes the magic methods of classes
# add, sub, mul, floordiv, div, truediv, mod,
# divmod, pow, lshift, rshift, and, or, xor
# RESOURCES
#
# https://rszalski.github.io/magicmethods/
# Normal arithmetic operators
# Now, we cover the typical binary operators (and a function or two): +, -, * and the like. These are, for the most part, pretty self-explanatory.
# __add__(self, other)
# Implements addition.
# __sub__(self, other)
# Implements subtraction.
# __mul__(self, other)
# Implements multiplication.
# __floordiv__(self, other)
# Implements integer division using the // operator.
# __div__(self, other)
# Implements division using the / operator.
# __truediv__(self, other)
# Implements true division. Note that this only works when from __future__ import division is in effect.
# __mod__(self, other)
# Implements modulo using the % operator.
# __divmod__(self, other)
# Implements behavior for long division using the divmod() built in function.
# __pow__
# Implements behavior for exponents using the ** operator.
# __lshift__(self, other)
# Implements left bitwise shift using the << operator.
# __rshift__(self, other)
# Implements right bitwise shift using the >> operator.
# __and__(self, other)
# Implements bitwise and using the & operator.
# __or__(self, other)
# Implements bitwise or using the | operator.
# __xor__(self, other)
# Implements bitwise xor using the ^ operator.
| 34.533333 | 146 | 0.714286 | 190 | 1,554 | 5.526316 | 0.421053 | 0.111429 | 0.235238 | 0.074286 | 0.053333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.19305 | 1,554 | 44 | 147 | 35.318182 | 0.837321 | 0.945946 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 3 |
c6b7b42e398b5ad8a87b392745a1b79c63f44e1e | 1,612 | py | Python | sdk/ml/azure-ai-ml/tests/batch_services/unittests/test_batch_deployment_schema.py | dubiety/azure-sdk-for-python | 62ffa839f5d753594cf0fe63668f454a9d87a346 | [
"MIT"
] | 1 | 2022-02-01T18:50:12.000Z | 2022-02-01T18:50:12.000Z | sdk/ml/azure-ai-ml/tests/batch_services/unittests/test_batch_deployment_schema.py | ellhe-blaster/azure-sdk-for-python | 82193ba5e81cc5e5e5a5239bba58abe62e86f469 | [
"MIT"
] | null | null | null | sdk/ml/azure-ai-ml/tests/batch_services/unittests/test_batch_deployment_schema.py | ellhe-blaster/azure-sdk-for-python | 82193ba5e81cc5e5e5a5239bba58abe62e86f469 | [
"MIT"
] | null | null | null | from pathlib import Path
import pytest
import yaml
from azure.ai.ml._schema._deployment.batch.batch_deployment import BatchDeploymentSchema
from azure.ai.ml.constants import BASE_PATH_CONTEXT_KEY, BatchDeploymentOutputAction
from azure.ai.ml.entities._util import load_from_dict
from azure.ai.ml.entities import BatchDeployment
def load_batch_deployment_entity_from_yaml(path: str, context={}) -> BatchDeployment:
"""batch deployment yaml -> batch deployment entity"""
with open(path, "r") as f:
cfg = yaml.safe_load(f)
context.update({BASE_PATH_CONTEXT_KEY: Path(path).parent})
deployment = load_from_dict(BatchDeploymentSchema, cfg, context)
return deployment
@pytest.mark.unittest
class TestBatchDeploymentSchema:
def test_serialize_batch_deployment(self) -> None:
test_path = "./tests/test_configs/deployments/batch/batch_deployment_1.yaml"
batch_deployment_entity = load_batch_deployment_entity_from_yaml(test_path)
assert batch_deployment_entity
assert batch_deployment_entity.environment == "AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:1"
assert batch_deployment_entity.compute == "cpu-cluster"
assert batch_deployment_entity.output_action == BatchDeploymentOutputAction.APPEND_ROW
assert batch_deployment_entity.output_file_name == "append_row.txt"
assert batch_deployment_entity.error_threshold == 10
assert batch_deployment_entity.mini_batch_size == 5
assert batch_deployment_entity.max_concurrency_per_instance == 5
assert batch_deployment_entity.resources.instance_count == 2
| 46.057143 | 99 | 0.782258 | 203 | 1,612 | 5.891626 | 0.394089 | 0.213211 | 0.228261 | 0.203177 | 0.192308 | 0.055184 | 0 | 0 | 0 | 0 | 0 | 0.011561 | 0.141439 | 1,612 | 34 | 100 | 47.411765 | 0.852601 | 0.029777 | 0 | 0 | 0 | 0 | 0.084082 | 0.067394 | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0.074074 | false | 0 | 0.259259 | 0 | 0.407407 | 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 | 0 | 0 | 0 | 0 | 0 | 3 |
c6bbabf1d22c4d30fab6e968dbe23f93d2189af5 | 67 | py | Python | codes/course1/demo3_3.py | BigShuang/big-shuang-python-introductory-course | c4fd1343c4c539567180072c749b68bda7c28075 | [
"MIT"
] | null | null | null | codes/course1/demo3_3.py | BigShuang/big-shuang-python-introductory-course | c4fd1343c4c539567180072c749b68bda7c28075 | [
"MIT"
] | null | null | null | codes/course1/demo3_3.py | BigShuang/big-shuang-python-introductory-course | c4fd1343c4c539567180072c749b68bda7c28075 | [
"MIT"
] | null | null | null | for i in range(11):
v = 2 ** i
print("2^%s = %s" % (i, v))
| 16.75 | 31 | 0.38806 | 14 | 67 | 1.857143 | 0.642857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 0.343284 | 67 | 3 | 32 | 22.333333 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0.134328 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c6d1c365ef9f848b0908e928e06218bc28eb4a5c | 1,037 | py | Python | backend/bundle/tests/seeker_tests/samples/indentation.py | fossabot/Graphery | 61f23b2ad4ad0fa5dff643047597f9bb6cae35a2 | [
"MIT"
] | 5 | 2020-08-26T00:15:01.000Z | 2021-01-11T17:24:51.000Z | backend/bundle/tests/seeker_tests/samples/indentation.py | fossabot/Graphery | 61f23b2ad4ad0fa5dff643047597f9bb6cae35a2 | [
"MIT"
] | 69 | 2020-08-02T23:45:44.000Z | 2021-04-17T03:04:32.000Z | backend/bundle/tests/seeker_tests/samples/indentation.py | fossabot/Graphery | 61f23b2ad4ad0fa5dff643047597f9bb6cae35a2 | [
"MIT"
] | 4 | 2020-09-10T05:40:49.000Z | 2020-12-20T11:44:16.000Z | from bundle import seeker
@seeker.tracer(depth=2, only_watch=False)
def main():
f2()
def f2():
f3()
def f3():
f4()
@seeker.tracer(depth=2, only_watch=False)
def f4():
f5()
def f5():
pass
expected_output = '''
Source path:... Whatever
call 5 def main():
line 6 f2()
call 9 def f2():
line 10 f3()
Source path:... Whatever
call 18 def f4():
line 19 f5()
call 22 def f5():
line 23 pass
return 23 pass
Return value:.. None
return 19 f5()
Return value:.. None
Elapsed time: 00:00:00.000134
return 10 f3()
Return value:.. None
return 6 f2()
Return value:.. None
Elapsed time: 00:00:00.000885
'''
| 21.604167 | 52 | 0.387657 | 105 | 1,037 | 3.8 | 0.380952 | 0.110276 | 0.150376 | 0.090226 | 0.33584 | 0.33584 | 0.33584 | 0.33584 | 0 | 0 | 0 | 0.126506 | 0.519769 | 1,037 | 47 | 53 | 22.06383 | 0.674699 | 0 | 0 | 0.228571 | 0 | 0 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0.085714 | 0.028571 | 0 | 0.285714 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
c6e9c16512d69ea6fa5eab9288773894d5292bcf | 102 | py | Python | garage/utils/LED-on.py | 1337DS/SmartGarage | 1be4ad010653fc358e59417a26cd34e2146bdbf7 | [
"Apache-2.0"
] | 1 | 2022-02-09T10:36:43.000Z | 2022-02-09T10:36:43.000Z | garage/utils/LED-on.py | 1337DS/SmartGarage | 1be4ad010653fc358e59417a26cd34e2146bdbf7 | [
"Apache-2.0"
] | null | null | null | garage/utils/LED-on.py | 1337DS/SmartGarage | 1be4ad010653fc358e59417a26cd34e2146bdbf7 | [
"Apache-2.0"
] | null | null | null | import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(26, GPIO.OUT)
GPIO.output(26, GPIO.HIGH)
| 12.75 | 26 | 0.735294 | 19 | 102 | 3.947368 | 0.578947 | 0.16 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044444 | 0.117647 | 102 | 7 | 27 | 14.571429 | 0.788889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 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 | 0 | 0 | 0 | 3 |
05e6f09ddfc0212cb3f08469b5c83b81051137ad | 99 | py | Python | django_models_from_csv/__init__.py | themarshallproject/django-collaborative | 1474b9737eaea35eb11b39380b35c2a801831d9c | [
"MIT"
] | 88 | 2019-05-17T19:52:44.000Z | 2022-03-28T19:43:07.000Z | django_models_from_csv/__init__.py | themarshallproject/django-collaborative | 1474b9737eaea35eb11b39380b35c2a801831d9c | [
"MIT"
] | 65 | 2019-05-17T20:06:18.000Z | 2021-01-13T03:51:07.000Z | django_models_from_csv/__init__.py | themarshallproject/django-collaborative | 1474b9737eaea35eb11b39380b35c2a801831d9c | [
"MIT"
] | 15 | 2019-07-09T20:48:14.000Z | 2021-07-24T20:45:55.000Z | default_app_config = 'django_models_from_csv.apps.DjangoDynamicModelsConfig'
__version__ = "1.1.0"
| 33 | 76 | 0.838384 | 13 | 99 | 5.692308 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032258 | 0.060606 | 99 | 2 | 77 | 49.5 | 0.763441 | 0 | 0 | 0 | 0 | 0 | 0.585859 | 0.535354 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
af223891e643b0660e741c07d3a8f87905708723 | 1,341 | py | Python | tests/mazehat/test_view_to_sensehat.py | AndrewWasHere/aMAZEing_SenseHat | 03f0c15f99b6d6c56c2baad4e558799e91fc194a | [
"BSD-3-Clause"
] | null | null | null | tests/mazehat/test_view_to_sensehat.py | AndrewWasHere/aMAZEing_SenseHat | 03f0c15f99b6d6c56c2baad4e558799e91fc194a | [
"BSD-3-Clause"
] | null | null | null | tests/mazehat/test_view_to_sensehat.py | AndrewWasHere/aMAZEing_SenseHat | 03f0c15f99b6d6c56c2baad4e558799e91fc194a | [
"BSD-3-Clause"
] | null | null | null | """
Copyright 2017, Andrew Lin
All rights reserved.
This software is licensed under the BSD 3-Clause License.
See LICENSE.txt at the root of the project or
https://opensource.org/licenses/BSD-3-Clause
"""
from maze.maze import Maze, Coordinates
from maze.mazehat import MazeHat
def test_view_to_sensehat():
mh = MazeHat()
maze = [
list('#######'),
list(' ##### '),
list('# # # #'),
list(' SHFH '),
list('# # # #'),
list(' ##### '),
list('#######'),
]
view = Maze(maze, 7).view(Coordinates(6, 6))
gold_view = [
mh.wall, mh.wall, mh.wall, mh.wall, mh.wall, mh.wall, mh.wall, mh.empty,
mh.empty, mh.wall, mh.wall, mh.wall, mh.wall, mh.wall, mh.empty, mh.empty,
mh.wall, mh.empty, mh.wall, mh.empty, mh.wall, mh.empty, mh.wall, mh.empty,
mh.empty, mh.empty, mh.start, mh.avatar, mh.finish, mh.hazard, mh.empty, mh.empty,
mh.wall, mh.empty, mh.wall, mh.empty, mh.wall, mh.empty, mh.wall, mh.empty,
mh.empty, mh.wall, mh.wall, mh.wall, mh.wall, mh.wall, mh.empty, mh.empty,
mh.wall, mh.wall, mh.wall, mh.wall, mh.wall, mh.wall, mh.wall, mh.empty,
mh.empty, mh.empty, mh.empty, mh.empty, mh.empty, mh.empty, mh.empty, mh.empty,
]
mview = mh.view_to_sensehat(view)
assert mview == gold_view
| 34.384615 | 90 | 0.59135 | 209 | 1,341 | 3.760766 | 0.248804 | 0.244275 | 0.3257 | 0.305344 | 0.496183 | 0.496183 | 0.496183 | 0.496183 | 0.496183 | 0.487277 | 0 | 0.008671 | 0.225951 | 1,341 | 38 | 91 | 35.289474 | 0.748555 | 0.146905 | 0 | 0.461538 | 0 | 0 | 0.043134 | 0 | 0 | 0 | 0 | 0 | 0.038462 | 1 | 0.038462 | false | 0 | 0.076923 | 0 | 0.115385 | 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 | 0 | 0 | 0 | 0 | 0 | 3 |
af44d9ce71d347bfea046cddeb10613e1ff52421 | 67 | py | Python | jetbrains-academy/Numeric Matrix Processor/Problems/Alphabet/task.py | robinpatra/ML-Study-3 | 6f401706a8da4cac5e63304ce09ff6ff62756d0b | [
"MIT"
] | null | null | null | jetbrains-academy/Numeric Matrix Processor/Problems/Alphabet/task.py | robinpatra/ML-Study-3 | 6f401706a8da4cac5e63304ce09ff6ff62756d0b | [
"MIT"
] | null | null | null | jetbrains-academy/Numeric Matrix Processor/Problems/Alphabet/task.py | robinpatra/ML-Study-3 | 6f401706a8da4cac5e63304ce09ff6ff62756d0b | [
"MIT"
] | null | null | null | # work with this string
alphabet = input()
print(tuple(alphabet))
| 13.4 | 23 | 0.731343 | 9 | 67 | 5.444444 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.149254 | 67 | 4 | 24 | 16.75 | 0.859649 | 0.313433 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 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 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
af55a79f421926129b24a6d21a7c6d4dc299051b | 1,477 | py | Python | chainer/distributions/one_hot_categorical.py | lehy/chainer | 007f86fdc68d9963a01f9d9230e004071a1fcfb2 | [
"MIT"
] | null | null | null | chainer/distributions/one_hot_categorical.py | lehy/chainer | 007f86fdc68d9963a01f9d9230e004071a1fcfb2 | [
"MIT"
] | null | null | null | chainer/distributions/one_hot_categorical.py | lehy/chainer | 007f86fdc68d9963a01f9d9230e004071a1fcfb2 | [
"MIT"
] | null | null | null | import chainer
from chainer.backends import cuda
from chainer import distribution
from chainer.functions.math import exponential
import chainer.functions.math.sum as sum_mod
class OneHotCategorical(distribution.Distribution):
"""OneHotCategorical Distribution.
Args:
p(:class:`~chainer.Variable` or :class:`numpy.ndarray` or \
:class:`cupy.ndarray`): Parameter of distribution.
"""
def __init__(self, p):
super(OneHotCategorical, self).__init__()
self.__p = chainer.as_variable(p)
@property
def p(self):
return self.__p
@property
def batch_shape(self):
return self.p.shape[:-1]
@property
def event_shape(self):
return self.p.shape[-1:]
@property
def _is_gpu(self):
return isinstance(self.p.data, cuda.ndarray)
def log_prob(self, x):
return sum_mod.sum(exponential.log(self.p) * x, axis=-1)
@property
def mean(self):
return self.p
def sample_n(self, n):
xp = cuda.get_array_module(self.p)
obo_p = self.p.data.reshape((-1,) + self.event_shape)
eye = xp.eye(self.event_shape[0])
eps = [xp.random.choice(
one_p.shape[0], size=(n,), p=one_p) for one_p in obo_p]
eps = xp.stack(eps).T.reshape((n,)+self.batch_shape)
eps = eye[eps]
noise = chainer.Variable(eps)
return noise
@property
def variance(self):
return self.p * (1. - self.p)
| 25.465517 | 67 | 0.625592 | 200 | 1,477 | 4.465 | 0.315 | 0.067189 | 0.078387 | 0.083987 | 0.082867 | 0.082867 | 0.082867 | 0.082867 | 0.082867 | 0 | 0 | 0.006312 | 0.249154 | 1,477 | 57 | 68 | 25.912281 | 0.798918 | 0.107651 | 0 | 0.153846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.128205 | 0.179487 | 0.589744 | 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 | 0 | 1 | 1 | 0 | 0 | 3 |
af623410296e659a3a4c8fe5f812620f14b8f668 | 1,098 | py | Python | LnkParse3/extra/shim_layer.py | ernix/LnkParse3 | ab8b2c796a501b103eb74142762e7fe9f4f1960a | [
"MIT"
] | 6 | 2019-04-16T10:19:15.000Z | 2022-03-18T22:21:18.000Z | LnkParse3/extra/shim_layer.py | ernix/LnkParse3 | ab8b2c796a501b103eb74142762e7fe9f4f1960a | [
"MIT"
] | 12 | 2020-09-15T08:02:48.000Z | 2021-07-19T13:52:57.000Z | LnkParse3/extra/shim_layer.py | ernix/LnkParse3 | ab8b2c796a501b103eb74142762e7fe9f4f1960a | [
"MIT"
] | 3 | 2019-10-10T06:38:48.000Z | 2020-10-25T08:24:34.000Z | from LnkParse3.extra.lnk_extra_base import LnkExtraBase
"""
------------------------------------------------------------------
| 0-7b | 8-15b | 16-23b | 24-31b |
------------------------------------------------------------------
| <u_int32> BlockSize >= 0x00000088 |
------------------------------------------------------------------
| <u_int32> BlockSignature == 0xA0000008 |
------------------------------------------------------------------
| <unicode_str> LayerName |
| ? B |
------------------------------------------------------------------
"""
class ShimLayer(LnkExtraBase):
def name(self):
return "SHIM_LAYER_BLOCK"
def layer_name(self):
start = 8
binary = self._raw[start:]
text = self.text_processor.read_string(binary)
return text
def as_dict(self):
tmp = super().as_dict()
tmp["layer_name"] = self.layer_name()
return tmp
| 35.419355 | 66 | 0.327869 | 73 | 1,098 | 4.726027 | 0.616438 | 0.069565 | 0.075362 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047059 | 0.303279 | 1,098 | 30 | 67 | 36.6 | 0.403922 | 0 | 0 | 0 | 0 | 0 | 0.061758 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.076923 | 0.076923 | 0.615385 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
af62d6c68ae4c048711e5debf87644009ac5b327 | 293 | py | Python | django_project_template/django_project_template/apps/app/urls.py | eduardolujan/django_project_template | 6e449b1da6d95ab7afb532a4a76d724be666ae4f | [
"MIT"
] | null | null | null | django_project_template/django_project_template/apps/app/urls.py | eduardolujan/django_project_template | 6e449b1da6d95ab7afb532a4a76d724be666ae4f | [
"MIT"
] | null | null | null | django_project_template/django_project_template/apps/app/urls.py | eduardolujan/django_project_template | 6e449b1da6d95ab7afb532a4a76d724be666ae4f | [
"MIT"
] | null | null | null | from django.conf.urls.static import static
from django.conf.urls import patterns, url, include
from django.conf import settings
from django.contrib import admin
from apps.app.views import *
admin.autodiscover()
urlpatterns = patterns('',
url(r'^/?$','apps.app.views.index',name='index'),
) | 26.636364 | 51 | 0.757679 | 42 | 293 | 5.285714 | 0.47619 | 0.18018 | 0.189189 | 0.162162 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.105802 | 293 | 11 | 52 | 26.636364 | 0.847328 | 0 | 0 | 0 | 0 | 0 | 0.098639 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.555556 | 0 | 0.555556 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
af97ce7ed6690110d340cf7da5e8b723433180ff | 526 | py | Python | forms.py | MarioAer/BubblesData | 849cc6428b5e8d64f5517f94a714e3f737bfc75d | [
"MIT"
] | null | null | null | forms.py | MarioAer/BubblesData | 849cc6428b5e8d64f5517f94a714e3f737bfc75d | [
"MIT"
] | null | null | null | forms.py | MarioAer/BubblesData | 849cc6428b5e8d64f5517f94a714e3f737bfc75d | [
"MIT"
] | null | null | null | # -*- coding: UTF-8 -*-
"""(forms.py) Flask-Login Example: Login Form"""
from flask_wtf import Form # import from flask_wtf, NOT wtforms
from wtforms import StringField, PasswordField
from wtforms.validators import InputRequired, Length
# Define the LoginRorm class by sub-classing Form
class LoginForm(Form):
# This form contains two fields with validators
name = StringField(u'User Name:', validators=[InputRequired(), Length(max=20)])
passwd = PasswordField(u'Password:', validators=[Length(min=4, max=16)])
| 40.461538 | 83 | 0.741445 | 70 | 526 | 5.542857 | 0.6 | 0.046392 | 0.061856 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013274 | 0.140684 | 526 | 12 | 84 | 43.833333 | 0.845133 | 0.368821 | 0 | 0 | 0 | 0 | 0.058824 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.333333 | 0.5 | 0 | 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 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
afceffc0fa04029d539709b408be0aca115cbc14 | 415 | py | Python | student.py | gabrielmccoll/python-learning | 253dcf9df647dbdcaaeac498c962db39868d6604 | [
"MIT"
] | null | null | null | student.py | gabrielmccoll/python-learning | 253dcf9df647dbdcaaeac498c962db39868d6604 | [
"MIT"
] | null | null | null | student.py | gabrielmccoll/python-learning | 253dcf9df647dbdcaaeac498c962db39868d6604 | [
"MIT"
] | null | null | null | students = []
class Student:
school_name = "Springfield Elementary"
#pass #tells the interpreter just to do nothing
def __init__(self,name, student_id=332):
self.name = name
self.student_id = student_id
students.append(self)
def __str__(self):
return "Student " + self.name
def get_name_capitalize(self):
return self.name.capitalize()
def get_school_name(self):
return self.school_name
| 21.842105 | 48 | 0.73253 | 58 | 415 | 4.948276 | 0.431034 | 0.111498 | 0.097561 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008721 | 0.171084 | 415 | 18 | 49 | 23.055556 | 0.825581 | 0.108434 | 0 | 0 | 0 | 0 | 0.081522 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0 | 0 | 0.230769 | 0.692308 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
bb5df3fbda301f153649b52b26d0e9ba6ce8747f | 24 | py | Python | ckan_cloud_operator/providers/db/constants.py | MuhammadIsmailShahzad/ckan-cloud-operator | 35a4ca88c4908d81d1040a21fca8904e77c4cded | [
"MIT"
] | 14 | 2019-11-18T12:01:03.000Z | 2021-09-15T15:29:50.000Z | ckan_cloud_operator/providers/db/constants.py | MuhammadIsmailShahzad/ckan-cloud-operator | 35a4ca88c4908d81d1040a21fca8904e77c4cded | [
"MIT"
] | 52 | 2019-09-09T14:22:41.000Z | 2021-09-29T08:29:24.000Z | ckan_cloud_operator/providers/db/constants.py | MuhammadIsmailShahzad/ckan-cloud-operator | 35a4ca88c4908d81d1040a21fca8904e77c4cded | [
"MIT"
] | 8 | 2019-10-05T12:46:25.000Z | 2021-09-15T15:13:05.000Z | PROVIDER_SUBMODULE='db'
| 12 | 23 | 0.833333 | 3 | 24 | 6.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041667 | 24 | 1 | 24 | 24 | 0.826087 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bb64614546d6d512164770fa3b04fc627d4d3bf2 | 218 | py | Python | api/urls.py | kaito1002/django-rest-init | 8ece6311ea84c46e74a0ac0b7f42983f40a72c34 | [
"MIT"
] | null | null | null | api/urls.py | kaito1002/django-rest-init | 8ece6311ea84c46e74a0ac0b7f42983f40a72c34 | [
"MIT"
] | null | null | null | api/urls.py | kaito1002/django-rest-init | 8ece6311ea84c46e74a0ac0b7f42983f40a72c34 | [
"MIT"
] | null | null | null | from rest_framework import routers
from user.views import UserViewSet
from .views import SampleViewSet
router = routers.DefaultRouter()
router.register('users', UserViewSet)
router.register('samples', SampleViewSet)
| 24.222222 | 41 | 0.821101 | 25 | 218 | 7.12 | 0.56 | 0.123596 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09633 | 218 | 8 | 42 | 27.25 | 0.903553 | 0 | 0 | 0 | 0 | 0 | 0.055046 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
bb8abe691f8096772a0b83004f7d364cbc981a7d | 154 | py | Python | app/helper_functions.py | shane-kercheval/dash-ml-explorer | c1664d733e037b7e00b918b5bbdbd0b7cbdc3c2d | [
"Apache-2.0"
] | null | null | null | app/helper_functions.py | shane-kercheval/dash-ml-explorer | c1664d733e037b7e00b918b5bbdbd0b7cbdc3c2d | [
"Apache-2.0"
] | null | null | null | app/helper_functions.py | shane-kercheval/dash-ml-explorer | c1664d733e037b7e00b918b5bbdbd0b7cbdc3c2d | [
"Apache-2.0"
] | null | null | null | import yaml
def read_yaml(file_name) -> dict:
with open(file_name, "r") as stream:
yaml_dict = yaml.safe_load(stream)
return yaml_dict
| 17.111111 | 42 | 0.675325 | 24 | 154 | 4.083333 | 0.625 | 0.163265 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.227273 | 154 | 8 | 43 | 19.25 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0.006536 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
bb949682762af25e0d9e85b1dcc96637afca8f13 | 60 | py | Python | doc/example.py | jtpio/jupyterlab-python-bytecode | 23c3d4e228829743b65685d8796cf1bc95fd88ba | [
"BSD-3-Clause"
] | 58 | 2018-09-30T00:08:57.000Z | 2022-01-15T20:54:02.000Z | doc/example.py | jtpio/jupyterlab-python-bytecode | 23c3d4e228829743b65685d8796cf1bc95fd88ba | [
"BSD-3-Clause"
] | 7 | 2018-09-30T09:55:32.000Z | 2021-04-20T09:50:36.000Z | doc/example.py | jtpio/jupyterlab-python-bytecode | 23c3d4e228829743b65685d8796cf1bc95fd88ba | [
"BSD-3-Clause"
] | 4 | 2019-03-03T07:18:50.000Z | 2022-02-27T01:19:12.000Z | for i in range(10):
pass
j = 0
while j < 10:
j += 1 | 10 | 19 | 0.483333 | 13 | 60 | 2.230769 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.162162 | 0.383333 | 60 | 6 | 20 | 10 | 0.621622 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.2 | 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 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
bb94df94114e25069a2e0c94c2a3c7a8d9c17d5d | 408 | py | Python | pymongo_cursor_json_encoder/__init__.py | rogervila/python-mongo-json-encoder | 63dfc9bbe6702c6bacca8b6aa04b17a6f6fbd918 | [
"MIT"
] | 1 | 2021-01-14T16:08:45.000Z | 2021-01-14T16:08:45.000Z | pymongo_cursor_json_encoder/__init__.py | rogervila/python-mongo-json-encoder | 63dfc9bbe6702c6bacca8b6aa04b17a6f6fbd918 | [
"MIT"
] | null | null | null | pymongo_cursor_json_encoder/__init__.py | rogervila/python-mongo-json-encoder | 63dfc9bbe6702c6bacca8b6aa04b17a6f6fbd918 | [
"MIT"
] | null | null | null | from datetime import datetime, date
from isodate import datetime_isoformat
from bson import ObjectId
from json import JSONEncoder
class MongoJSONEncoder(JSONEncoder):
def default(self, output):
if isinstance(output, (datetime, date)):
return datetime_isoformat(output)
if isinstance(output, ObjectId):
return str(output)
return super().default(output)
| 25.5 | 48 | 0.708333 | 45 | 408 | 6.377778 | 0.466667 | 0.097561 | 0.125436 | 0.167247 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.223039 | 408 | 15 | 49 | 27.2 | 0.905363 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.363636 | 0 | 0.818182 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
bbbae9f34a49725dac76a6810057af802194d6d9 | 327 | py | Python | labgraph/websockets/ws_server/ws_server_stream_message.py | Yunusbcr/labgraph | a00ae7098b7b0e0eda8ce2e7e62dae86854616fb | [
"MIT"
] | 124 | 2021-07-14T21:25:59.000Z | 2022-03-08T20:40:16.000Z | labgraph/websockets/ws_server/ws_server_stream_message.py | Yunusbcr/labgraph | a00ae7098b7b0e0eda8ce2e7e62dae86854616fb | [
"MIT"
] | 46 | 2021-07-16T18:41:11.000Z | 2022-03-31T20:53:00.000Z | labgraph/websockets/ws_server/ws_server_stream_message.py | Yunusbcr/labgraph | a00ae7098b7b0e0eda8ce2e7e62dae86854616fb | [
"MIT"
] | 22 | 2021-07-16T18:34:56.000Z | 2022-03-31T15:12:06.000Z | #!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
import numpy as np
from ...messages import Message
class WSStreamMessage(Message):
"""
A message representing data that was/will be communicated
to WebSocket.
"""
samples: np.float64
stream_name: str
stream_id: str
| 18.166667 | 61 | 0.703364 | 42 | 327 | 5.428571 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027237 | 0.214067 | 327 | 17 | 62 | 19.235294 | 0.859922 | 0.449541 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 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 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
bbbbbd636a90f7a83f3583eed93d7178ff373d2b | 162 | py | Python | notification/urls.py | zaska-afk/twitterclone-zaska-afk | 9a2c0d86f4c359fc6f943e2f0cb56c1681bc2bb2 | [
"MIT"
] | null | null | null | notification/urls.py | zaska-afk/twitterclone-zaska-afk | 9a2c0d86f4c359fc6f943e2f0cb56c1681bc2bb2 | [
"MIT"
] | null | null | null | notification/urls.py | zaska-afk/twitterclone-zaska-afk | 9a2c0d86f4c359fc6f943e2f0cb56c1681bc2bb2 | [
"MIT"
] | null | null | null | from django.urls import path
from notification import views
urlpatterns = [
path('notifications/<int:id>/', views.notification_view, name='notifications'),
] | 27 | 83 | 0.759259 | 19 | 162 | 6.421053 | 0.684211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117284 | 162 | 6 | 84 | 27 | 0.853147 | 0 | 0 | 0 | 0 | 0 | 0.220859 | 0.141104 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
bbe0811cc9331cc6588c71ea015afd88bed83389 | 509 | py | Python | openapi_core/validation/util.py | erpheus/openapi-core | b37510b0e306f6819971f64106617fb116974243 | [
"BSD-3-Clause"
] | null | null | null | openapi_core/validation/util.py | erpheus/openapi-core | b37510b0e306f6819971f64106617fb116974243 | [
"BSD-3-Clause"
] | null | null | null | openapi_core/validation/util.py | erpheus/openapi-core | b37510b0e306f6819971f64106617fb116974243 | [
"BSD-3-Clause"
] | null | null | null | """OpenAPI core validation util module"""
from yarl import URL
def get_operation_pattern(server_url, request_url_pattern):
"""Return an updated request URL pattern with the server URL removed."""
if server_url[-1] == "/":
# operations have to start with a slash, so do not remove it
server_url = server_url[:-1]
if URL(server_url).is_absolute():
return request_url_pattern.replace(server_url, "", 1)
return URL(request_url_pattern).path_qs.replace(server_url, "", 1)
| 39.153846 | 76 | 0.70334 | 75 | 509 | 4.546667 | 0.52 | 0.211144 | 0.199413 | 0.117302 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009662 | 0.18664 | 509 | 12 | 77 | 42.416667 | 0.81401 | 0.318271 | 0 | 0 | 0 | 0 | 0.002976 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.571429 | 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 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
bbe3888f6e45c812298b82e8ac836a9bd58f2e7b | 2,461 | py | Python | lib/helpertools/helpertools/geometry.py | aws-samples/amazon-textract-large-scale-selectable-pdf | e62b1c5ed79c02008783bc1361d70f0b5b69e0b7 | [
"MIT-0"
] | 4 | 2022-01-12T15:30:54.000Z | 2022-02-28T22:12:17.000Z | lib/helpertools/helpertools/geometry.py | aws-samples/amazon-textract-large-scale-selectable-pdf | e62b1c5ed79c02008783bc1361d70f0b5b69e0b7 | [
"MIT-0"
] | null | null | null | lib/helpertools/helpertools/geometry.py | aws-samples/amazon-textract-large-scale-selectable-pdf | e62b1c5ed79c02008783bc1361d70f0b5b69e0b7 | [
"MIT-0"
] | 2 | 2021-10-24T01:43:12.000Z | 2022-01-21T20:14:33.000Z | '''
'''
from typing import Dict, Optional
# classes
# -------
class BoundingBox():
'''
Class to manipulate a bounding box (bbox). A bounding box is a rectangle aligned with
the coordinate system. The bounding box are defined on coordinate system with x
pointing toward east and y pointing toward north. This is the usual coordinate
system used in euclidian geometry (i.e. lower left origin). Note that images
generally have a a cordinate system defined with a upper left origin.
'''
# constructors
def __init__(self, left: float, bottom: float, right: float, top: float) -> None:
'''
constructor.
'''
self.bounds = [left, bottom, right, top]
@classmethod
def from_textract_bbox(cls, textract_bbox: Dict[str, float]) -> None:
'''
Construct a BoundingBox object from the bounding box defined by an AWS Textract
output json. As Textract uses a coordinate system with a upper left origin
(i.e. y pointing downward), the definition of bottom=top+height (note
the "+", instead of a "-").
'''
return cls(
left=textract_bbox['Left'],
bottom=textract_bbox['Top']+textract_bbox['Height'],
right=textract_bbox['Left']+textract_bbox['Width'],
top=textract_bbox['Top'],
)
# class methods
def scale(self, x_scale: None, y_scale: Optional[float]=None) -> None:
'''
Scale a bounding box by a x and y factor. If y is not defined, the bbox is
scaled by x in all directions
'''
if not y_scale:
y_scale = x_scale
self.bounds[0] *= x_scale
self.bounds[1] *= y_scale
self.bounds[2] *= x_scale
self.bounds[3] *= y_scale
# overload methods
def __getitem__(self, key):
return self.bounds[key]
def __setitem__(self, key, value):
self.bounds[key] = value
# getters
@property
def left(self) -> float:
return self.bounds[0]
@property
def bottom(self) -> float:
return self.bounds[1]
@property
def right(self) -> float:
return self.bounds[2]
@property
def top(self) -> float:
return self.bounds[3]
@property
def width(self) -> float:
return abs(self.bounds[0]-self.bounds[2])
@property
def height(self) -> float:
return abs(self.bounds[3]-self.bounds[1]) | 30.7625 | 90 | 0.604632 | 320 | 2,461 | 4.55625 | 0.3125 | 0.102881 | 0.061728 | 0.052126 | 0.15775 | 0.038409 | 0 | 0 | 0 | 0 | 0 | 0.006857 | 0.288907 | 2,461 | 80 | 91 | 30.7625 | 0.826286 | 0.341731 | 0 | 0.146341 | 0 | 0 | 0.016938 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.268293 | false | 0 | 0.02439 | 0.170732 | 0.512195 | 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 | 0 | 1 | 1 | 0 | 0 | 3 |
bbf71be865b8e26676ff85c557b20b334f5953a8 | 4,420 | py | Python | tests/queries/recursive/query_typeddict.py | s1s5/python-gql-compiler | 52e0ed7c9fa6deafe2c169c8340d66e8cc168491 | [
"MIT"
] | null | null | null | tests/queries/recursive/query_typeddict.py | s1s5/python-gql-compiler | 52e0ed7c9fa6deafe2c169c8340d66e8cc168491 | [
"MIT"
] | null | null | null | tests/queries/recursive/query_typeddict.py | s1s5/python-gql-compiler | 52e0ed7c9fa6deafe2c169c8340d66e8cc168491 | [
"MIT"
] | null | null | null | # @generated AUTOGENERATED file. Do not Change!
# flake8: noqa
# fmt: off
# isort: skip_file
import typing
from gql import gql, Client
Episode = typing.Literal["NEWHOPE", "EMPIRE", "JEDI"]
GetRecursive__hero__Droid__friends__Droid__friends = typing.TypedDict("GetRecursive__hero__Droid__friends__Droid__friends", {"name": str})
GetRecursive__hero__Droid__friends__Droid = typing.TypedDict("GetRecursive__hero__Droid__friends__Droid", {"__typename": typing.Literal["Droid"], "id": str, "name": str, "friends": typing.List[typing.Optional[GetRecursive__hero__Droid__friends__Droid__friends]]})
GetRecursive__hero__Droid__friends__Human__starships = typing.TypedDict("GetRecursive__hero__Droid__friends__Human__starships", {"name": str})
GetRecursive__hero__Droid__friends__Human = typing.TypedDict("GetRecursive__hero__Droid__friends__Human", {"__typename": typing.Literal["Human"], "id": str, "name": str, "starships": typing.List[typing.Optional[GetRecursive__hero__Droid__friends__Human__starships]]})
__GetRecursive__hero__Droid__friends = typing.TypedDict("__GetRecursive__hero__Droid__friends", {"__typename": typing.Literal["Character"], "id": str})
GetRecursive__hero__Droid__friends = typing.Union[__GetRecursive__hero__Droid__friends, GetRecursive__hero__Droid__friends__Human, GetRecursive__hero__Droid__friends__Droid]
GetRecursive__hero__Droid = typing.TypedDict("GetRecursive__hero__Droid", {"__typename": typing.Literal["Droid"], "name": str, "primaryFunction": str, "friends": typing.List[typing.Optional[GetRecursive__hero__Droid__friends]]})
GetRecursive__hero__Human__friends__Droid = typing.TypedDict("GetRecursive__hero__Human__friends__Droid", {"__typename": typing.Literal["Droid"], "id": str, "name": str})
GetRecursive__hero__Human__friends__Human = typing.TypedDict("GetRecursive__hero__Human__friends__Human", {"__typename": typing.Literal["Human"], "name": str})
__GetRecursive__hero__Human__friends = typing.TypedDict("__GetRecursive__hero__Human__friends", {"__typename": typing.Literal["Character"]})
GetRecursive__hero__Human__friends = typing.Union[__GetRecursive__hero__Human__friends, GetRecursive__hero__Human__friends__Human, GetRecursive__hero__Human__friends__Droid]
GetRecursive__hero__Human = typing.TypedDict("GetRecursive__hero__Human", {"__typename": typing.Literal["Human"], "name": str, "friends": typing.List[typing.Optional[GetRecursive__hero__Human__friends]]})
__GetRecursive__hero = typing.TypedDict("__GetRecursive__hero", {"__typename": typing.Literal["Character"], "name": str})
GetRecursive__hero = typing.Union[__GetRecursive__hero, GetRecursive__hero__Human, GetRecursive__hero__Droid]
GetRecursiveResponse = typing.TypedDict("GetRecursiveResponse", {"hero": GetRecursive__hero})
_GetRecursiveInput__required = typing.TypedDict("_GetRecursiveInput__required", {"episode": Episode})
_GetRecursiveInput__not_required = typing.TypedDict("_GetRecursiveInput__not_required", {}, total=False)
class _GetRecursiveInput(_GetRecursiveInput__required, _GetRecursiveInput__not_required):
pass
class GetRecursive:
Response: typing.TypeAlias = GetRecursiveResponse
Input: typing.TypeAlias = _GetRecursiveInput
_query = gql('''
query GetRecursive($episode: Episode!) {
hero(episode: $episode) {
__typename
name
... on Human {
friends {
__typename
... on Human { name }
... on Droid { id name }
}
}
... on Droid {
primaryFunction
friends {
__typename
id
... on Human {
name
starships { name }
}
... on Droid {
name
friends { name }
}
}
}
}
}
''')
@classmethod
def execute(cls, client: Client, variable_values: _GetRecursiveInput) -> GetRecursiveResponse:
return client.execute( # type: ignore
cls._query, variable_values=variable_values
)
@classmethod
def execute_async(cls, client: Client, variable_values: _GetRecursiveInput) -> typing.Awaitable[GetRecursiveResponse]:
return client.execute_async( # type: ignore
cls._query, variable_values=variable_values
)
| 43.762376 | 267 | 0.721493 | 427 | 4,420 | 6.697892 | 0.142857 | 0.218182 | 0.146853 | 0.166434 | 0.607343 | 0.512587 | 0.288462 | 0.184965 | 0.096154 | 0.077273 | 0 | 0.000275 | 0.176471 | 4,420 | 100 | 268 | 44.2 | 0.78544 | 0.024887 | 0 | 0.246154 | 1 | 0 | 0.340228 | 0.109226 | 0 | 0 | 0 | 0 | 0 | 1 | 0.030769 | false | 0.015385 | 0.030769 | 0.030769 | 0.169231 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a52c5d9d6fb9e5755519e9da6cf0e9e7b0ba2f4d | 221 | py | Python | db.py | HoolaBoola/tsoha_article_library | 9c1d79eb06811a97c6984d4c970ee71a18724df7 | [
"MIT"
] | null | null | null | db.py | HoolaBoola/tsoha_article_library | 9c1d79eb06811a97c6984d4c970ee71a18724df7 | [
"MIT"
] | 2 | 2021-04-26T18:19:39.000Z | 2021-04-26T19:43:35.000Z | db.py | HoolaBoola/tsoha_article_library | 9c1d79eb06811a97c6984d4c970ee71a18724df7 | [
"MIT"
] | 1 | 2021-05-06T09:10:35.000Z | 2021-05-06T09:10:35.000Z | from app import app
from flask_sqlalchemy import SQLAlchemy
from os import getenv
app.config["SQLALCHEMY_DATABASE_URI"] = getenv("DATABASE_URL")
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
db = SQLAlchemy(app)
| 24.555556 | 62 | 0.809955 | 30 | 221 | 5.766667 | 0.5 | 0.104046 | 0.219653 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.104072 | 221 | 8 | 63 | 27.625 | 0.873737 | 0 | 0 | 0 | 0 | 0 | 0.294118 | 0.239819 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a5344db9359a04a85d968f45541c787bd80db9a0 | 579 | py | Python | sample.py | aakibqureshi/goibibo_python | fb8b43eb85bad9baf016e701051a3196ac84a23d | [
"MIT"
] | null | null | null | sample.py | aakibqureshi/goibibo_python | fb8b43eb85bad9baf016e701051a3196ac84a23d | [
"MIT"
] | null | null | null | sample.py | aakibqureshi/goibibo_python | fb8b43eb85bad9baf016e701051a3196ac84a23d | [
"MIT"
] | null | null | null | """
Sample Example
"""
from goibibo import goibiboAPI
GO = goibiboAPI("ae51f09b", "da2d83a905110d15a51795b018605026")
print GO.FlightSearch("BLR", "HYD", 20141028)
print GO.MinimumFare("BLR", "HYD", 20141028)
print GO.BusSearch("bangalore", "hyderabad", 20141028)
print GO.BusSeatMap("vJ52KC0ymd0635qTD9bDDy9GHBkGl5FJMJje0aFX\
_GQTyev_4N9Y62TTfrmS-Re3dCHl0-UxLq4AsoQ%3D")
print GO.SearchHotelsByCity(6771549831164675055)
print GO.GetHotelData([1017089108070373346, 6085103403340214927])
print GO.GetHotelPriceByCity(6771549831164675055, 20141101, 20141102)
| 36.1875 | 69 | 0.789292 | 52 | 579 | 8.75 | 0.634615 | 0.107692 | 0.098901 | 0.083516 | 0.092308 | 0 | 0 | 0 | 0 | 0 | 0 | 0.314779 | 0.100173 | 579 | 15 | 70 | 38.6 | 0.558541 | 0 | 0 | 0 | 0 | 0 | 0.125673 | 0.057451 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.1 | null | null | 0.7 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 1 | 0 | 3 |
a5477960eb696e3d1bcdbdddd2a93a52054fb340 | 11,884 | py | Python | pybind/slxos/v16r_1_00b/brocade_firmware_rpc/dad_status/output/dad_status_entries/__init__.py | shivharis/pybind | 4e1c6d54b9fd722ccec25546ba2413d79ce337e6 | [
"Apache-2.0"
] | null | null | null | pybind/slxos/v16r_1_00b/brocade_firmware_rpc/dad_status/output/dad_status_entries/__init__.py | shivharis/pybind | 4e1c6d54b9fd722ccec25546ba2413d79ce337e6 | [
"Apache-2.0"
] | null | null | null | pybind/slxos/v16r_1_00b/brocade_firmware_rpc/dad_status/output/dad_status_entries/__init__.py | shivharis/pybind | 4e1c6d54b9fd722ccec25546ba2413d79ce337e6 | [
"Apache-2.0"
] | 1 | 2021-11-05T22:15:42.000Z | 2021-11-05T22:15:42.000Z |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from decimal import Decimal
from bitarray import bitarray
import __builtin__
class dad_status_entries(PybindBase):
"""
This class was auto-generated by the PythonClass plugin for PYANG
from YANG module brocade-firmware - based on the path /brocade_firmware_rpc/dad-status/output/dad-status-entries. Each member element of
the container is represented as a class variable - with a specific
YANG type.
"""
__slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_rest_name', '_extmethods', '__index','__date_and_time_info','__message',)
_yang_name = 'dad-status-entries'
_rest_name = 'dad-status-entries'
_pybind_generated_by = 'container'
def __init__(self, *args, **kwargs):
path_helper_ = kwargs.pop("path_helper", None)
if path_helper_ is False:
self._path_helper = False
elif path_helper_ is not None and isinstance(path_helper_, xpathhelper.YANGPathHelper):
self._path_helper = path_helper_
elif hasattr(self, "_parent"):
path_helper_ = getattr(self._parent, "_path_helper", False)
self._path_helper = path_helper_
else:
self._path_helper = False
extmethods = kwargs.pop("extmethods", None)
if extmethods is False:
self._extmethods = False
elif extmethods is not None and isinstance(extmethods, dict):
self._extmethods = extmethods
elif hasattr(self, "_parent"):
extmethods = getattr(self._parent, "_extmethods", None)
self._extmethods = extmethods
else:
self._extmethods = False
self.__index = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="index", rest_name="index", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=False, extensions={u'tailf-common': {u'info': u'Sequence number for the message'}}, namespace='urn:brocade.com:mgmt:brocade-firmware', defining_module='brocade-firmware', yang_type='uint32', is_config=True)
self.__message = YANGDynClass(base=unicode, is_leaf=True, yang_name="message", rest_name="message", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=False, extensions={u'tailf-common': {u'info': u'Textual description of the status'}}, namespace='urn:brocade.com:mgmt:brocade-firmware', defining_module='brocade-firmware', yang_type='string', is_config=True)
self.__date_and_time_info = YANGDynClass(base=unicode, is_leaf=True, yang_name="date-and-time-info", rest_name="date-and-time-info", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=False, extensions={u'tailf-common': {u'info': u'Date and time of the message. The format is YYYY-MM-DD/HH:MM:SS.SSSS (micro seconds)'}}, namespace='urn:brocade.com:mgmt:brocade-firmware', defining_module='brocade-firmware', yang_type='string', is_config=True)
load = kwargs.pop("load", None)
if args:
if len(args) > 1:
raise TypeError("cannot create a YANG container with >1 argument")
all_attr = True
for e in self._pyangbind_elements:
if not hasattr(args[0], e):
all_attr = False
break
if not all_attr:
raise ValueError("Supplied object did not have the correct attributes")
for e in self._pyangbind_elements:
nobj = getattr(args[0], e)
if nobj._changed() is False:
continue
setmethod = getattr(self, "_set_%s" % e)
if load is None:
setmethod(getattr(args[0], e))
else:
setmethod(getattr(args[0], e), load=load)
def _path(self):
if hasattr(self, "_parent"):
return self._parent._path()+[self._yang_name]
else:
return [u'brocade_firmware_rpc', u'dad-status', u'output', u'dad-status-entries']
def _rest_path(self):
if hasattr(self, "_parent"):
if self._rest_name:
return self._parent._rest_path()+[self._rest_name]
else:
return self._parent._rest_path()
else:
return [u'dad-status', u'output', u'dad-status-entries']
def _get_index(self):
"""
Getter method for index, mapped from YANG variable /brocade_firmware_rpc/dad_status/output/dad_status_entries/index (uint32)
"""
return self.__index
def _set_index(self, v, load=False):
"""
Setter method for index, mapped from YANG variable /brocade_firmware_rpc/dad_status/output/dad_status_entries/index (uint32)
If this variable is read-only (config: false) in the
source YANG file, then _set_index is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_index() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="index", rest_name="index", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=False, extensions={u'tailf-common': {u'info': u'Sequence number for the message'}}, namespace='urn:brocade.com:mgmt:brocade-firmware', defining_module='brocade-firmware', yang_type='uint32', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """index must be of a type compatible with uint32""",
'defined-type': "uint32",
'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="index", rest_name="index", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=False, extensions={u'tailf-common': {u'info': u'Sequence number for the message'}}, namespace='urn:brocade.com:mgmt:brocade-firmware', defining_module='brocade-firmware', yang_type='uint32', is_config=True)""",
})
self.__index = t
if hasattr(self, '_set'):
self._set()
def _unset_index(self):
self.__index = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="index", rest_name="index", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=False, extensions={u'tailf-common': {u'info': u'Sequence number for the message'}}, namespace='urn:brocade.com:mgmt:brocade-firmware', defining_module='brocade-firmware', yang_type='uint32', is_config=True)
def _get_date_and_time_info(self):
"""
Getter method for date_and_time_info, mapped from YANG variable /brocade_firmware_rpc/dad_status/output/dad_status_entries/date_and_time_info (string)
"""
return self.__date_and_time_info
def _set_date_and_time_info(self, v, load=False):
"""
Setter method for date_and_time_info, mapped from YANG variable /brocade_firmware_rpc/dad_status/output/dad_status_entries/date_and_time_info (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_date_and_time_info is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_date_and_time_info() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="date-and-time-info", rest_name="date-and-time-info", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=False, extensions={u'tailf-common': {u'info': u'Date and time of the message. The format is YYYY-MM-DD/HH:MM:SS.SSSS (micro seconds)'}}, namespace='urn:brocade.com:mgmt:brocade-firmware', defining_module='brocade-firmware', yang_type='string', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """date_and_time_info must be of a type compatible with string""",
'defined-type': "string",
'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="date-and-time-info", rest_name="date-and-time-info", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=False, extensions={u'tailf-common': {u'info': u'Date and time of the message. The format is YYYY-MM-DD/HH:MM:SS.SSSS (micro seconds)'}}, namespace='urn:brocade.com:mgmt:brocade-firmware', defining_module='brocade-firmware', yang_type='string', is_config=True)""",
})
self.__date_and_time_info = t
if hasattr(self, '_set'):
self._set()
def _unset_date_and_time_info(self):
self.__date_and_time_info = YANGDynClass(base=unicode, is_leaf=True, yang_name="date-and-time-info", rest_name="date-and-time-info", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=False, extensions={u'tailf-common': {u'info': u'Date and time of the message. The format is YYYY-MM-DD/HH:MM:SS.SSSS (micro seconds)'}}, namespace='urn:brocade.com:mgmt:brocade-firmware', defining_module='brocade-firmware', yang_type='string', is_config=True)
def _get_message(self):
"""
Getter method for message, mapped from YANG variable /brocade_firmware_rpc/dad_status/output/dad_status_entries/message (string)
"""
return self.__message
def _set_message(self, v, load=False):
"""
Setter method for message, mapped from YANG variable /brocade_firmware_rpc/dad_status/output/dad_status_entries/message (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_message is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_message() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="message", rest_name="message", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=False, extensions={u'tailf-common': {u'info': u'Textual description of the status'}}, namespace='urn:brocade.com:mgmt:brocade-firmware', defining_module='brocade-firmware', yang_type='string', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """message must be of a type compatible with string""",
'defined-type': "string",
'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="message", rest_name="message", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=False, extensions={u'tailf-common': {u'info': u'Textual description of the status'}}, namespace='urn:brocade.com:mgmt:brocade-firmware', defining_module='brocade-firmware', yang_type='string', is_config=True)""",
})
self.__message = t
if hasattr(self, '_set'):
self._set()
def _unset_message(self):
self.__message = YANGDynClass(base=unicode, is_leaf=True, yang_name="message", rest_name="message", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=False, extensions={u'tailf-common': {u'info': u'Textual description of the status'}}, namespace='urn:brocade.com:mgmt:brocade-firmware', defining_module='brocade-firmware', yang_type='string', is_config=True)
index = __builtin__.property(_get_index, _set_index)
date_and_time_info = __builtin__.property(_get_date_and_time_info, _set_date_and_time_info)
message = __builtin__.property(_get_message, _set_message)
_pyangbind_elements = {'index': index, 'date_and_time_info': date_and_time_info, 'message': message, }
| 61.57513 | 496 | 0.73073 | 1,654 | 11,884 | 4.990326 | 0.113059 | 0.046038 | 0.042646 | 0.050884 | 0.780228 | 0.719409 | 0.706324 | 0.695784 | 0.695784 | 0.678217 | 0 | 0.007265 | 0.142881 | 11,884 | 192 | 497 | 61.895833 | 0.803063 | 0.150034 | 0 | 0.40625 | 0 | 0.046875 | 0.342285 | 0.120499 | 0 | 0 | 0 | 0 | 0 | 1 | 0.09375 | false | 0 | 0.0625 | 0 | 0.289063 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a54e64b95c67ef2ea40471b8b49ce1a8e5671cf2 | 1,065 | py | Python | insights/parsers/tests/test_kpatch_patches.py | akshay196/insights-core | 598865e6563119089c77152599300de38a77c72c | [
"Apache-2.0"
] | null | null | null | insights/parsers/tests/test_kpatch_patches.py | akshay196/insights-core | 598865e6563119089c77152599300de38a77c72c | [
"Apache-2.0"
] | null | null | null | insights/parsers/tests/test_kpatch_patches.py | akshay196/insights-core | 598865e6563119089c77152599300de38a77c72c | [
"Apache-2.0"
] | null | null | null | from insights.parsers import kpatch_patches
from insights.tests import context_wrap
from insights.core.plugins import ContentException
import pytest
ASSORTED_KPATCHES = """
asdfasdfasdf_asdfasdfasdf-asdfasdfasdf_asdfasdfasdf.ko
asdfasdfasdf_asdfasdfasdf-asdfasdfasdf_asdfasdfasdf.ko.xz
foo-bar.ko
foo-bar.ko.xz
foo.ko
foo.ko.xz
test_klp_callbacks_demo.ko
test_klp_callbacks_demo.ko.xz
""".strip()
NO_KPATCH = """
/bin/ls: cannot access '/var/lib/kpatch/4.18.0-147.8.el8.x86_64': No such file or directory
""".strip()
# Try a bunch of random potential patch names
# Compare to expected module names
def test_assorted():
kp = kpatch_patches.KpatchPatches(context_wrap(ASSORTED_KPATCHES))
for patch in [
'asdfasdfasdf_asdfasdfasdf_asdfasdfasdf_asdfasdfasdf',
'foo_bar',
'foo',
'test_klp_callbacks_demo']:
assert patch in kp.patches
# Try the case of no patches installed
def test_no_kpatch():
with pytest.raises(ContentException):
kpatch_patches.KpatchPatches(context_wrap(NO_KPATCH))
| 27.307692 | 91 | 0.753991 | 145 | 1,065 | 5.324138 | 0.462069 | 0.279793 | 0.279793 | 0.186529 | 0.282383 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014477 | 0.156808 | 1,065 | 38 | 92 | 28.026316 | 0.845212 | 0.106103 | 0 | 0.071429 | 0 | 0.035714 | 0.411392 | 0.297468 | 0 | 0 | 0 | 0 | 0.035714 | 1 | 0.071429 | false | 0 | 0.142857 | 0 | 0.214286 | 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 | 0 | 0 | 0 | 0 | 0 | 3 |
a56370a9c455e4054cc211abc2c3f2c8a9e7a1f6 | 171 | py | Python | tests/const.py | makotookamura/GmoCoin | 025d3e68364bf52418dbc3445987ff21528db732 | [
"Apache-2.0"
] | 1 | 2021-05-20T01:34:28.000Z | 2021-05-20T01:34:28.000Z | tests/const.py | makotookamura/GmoCoin | 025d3e68364bf52418dbc3445987ff21528db732 | [
"Apache-2.0"
] | 44 | 2020-11-15T01:17:38.000Z | 2021-07-20T13:45:12.000Z | tests/const.py | makotookamura/GmoCoin | 025d3e68364bf52418dbc3445987ff21528db732 | [
"Apache-2.0"
] | 1 | 2021-07-17T16:56:03.000Z | 2021-07-17T16:56:03.000Z | from gmocoin.common.const import ConstMeta
class TestConst(metaclass=ConstMeta):
API_CALL_INTERVAL = 0.5
ORDER_PRICE = 2000000
ORDER_LOSSCUT_PRICE = 1500000
| 21.375 | 42 | 0.77193 | 22 | 171 | 5.772727 | 0.863636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.112676 | 0.169591 | 171 | 7 | 43 | 24.428571 | 0.78169 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 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 | 0 | 0 | 1 | 0 | 0 | 3 |
a5991177aa084d283fe154f4a7a56db6da664557 | 162 | py | Python | testing/tests/constants_enums/constants_enums.py | gigabackup/gigantum-client | 70fe6b39b87b1c56351f2b4c551b6f1693813e4f | [
"MIT"
] | 60 | 2018-09-26T15:46:00.000Z | 2021-10-10T02:37:14.000Z | testing/tests/constants_enums/constants_enums.py | gigabackup/gigantum-client | 70fe6b39b87b1c56351f2b4c551b6f1693813e4f | [
"MIT"
] | 1,706 | 2018-09-26T16:11:22.000Z | 2021-08-20T13:37:59.000Z | testing/tests/constants_enums/constants_enums.py | griffinmilsap/gigantum-client | 70fe6b39b87b1c56351f2b4c551b6f1693813e4f | [
"MIT"
] | 11 | 2019-03-14T13:23:51.000Z | 2022-01-25T01:29:16.000Z | import enum
"""Declare all enumerations used in test."""
class ProjectConstants(enum.Enum):
"""All constants for project test."""
SUCCESS = 'success'
| 16.2 | 44 | 0.685185 | 19 | 162 | 5.842105 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.185185 | 162 | 9 | 45 | 18 | 0.840909 | 0.191358 | 0 | 0 | 0 | 0 | 0.0875 | 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 | 0 | 0 | 0 | 3 |
a5ad0bf99db5282a28fe82ac56a8026546459cf4 | 1,480 | py | Python | unittests/TestSets.py | vtbassmatt/Scrython | 49fd9bd112e0f552a4310ac81fdb3f2b9e2a3976 | [
"MIT"
] | null | null | null | unittests/TestSets.py | vtbassmatt/Scrython | 49fd9bd112e0f552a4310ac81fdb3f2b9e2a3976 | [
"MIT"
] | null | null | null | unittests/TestSets.py | vtbassmatt/Scrython | 49fd9bd112e0f552a4310ac81fdb3f2b9e2a3976 | [
"MIT"
] | null | null | null | # This workaround makes sure that we can import from the parent dir
import sys
sys.path.append('..')
from scrython.sets import Code
import unittest
import time
promo_khans = Code('PKTK')
khans = Code('KTK')
class TestSets(unittest.TestCase):
def test_object(self):
self.assertIsInstance(khans.object(), str)
def test_code(self):
self.assertIsInstance(khans.code(), str)
def test_mtgo_code(self):
self.assertIsInstance(khans.mtgo_code(), str)
def test_name(self):
self.assertIsInstance(khans.name(), str)
def test_set_type(self):
self.assertIsInstance(khans.set_type(), str)
def test_released_at(self):
self.assertIsInstance(khans.released_at(), str)
def test_block_code(self):
self.assertIsInstance(khans.block_code(), str)
def test_block(self):
self.assertIsInstance(khans.block(), str)
def test_parent_set_code(self):
self.assertIsInstance(promo_khans.parent_set_code(), str)
def test_card_count(self):
self.assertIsInstance(khans.card_count(), int)
def test_digital(self):
self.assertIsInstance(khans.digital(), bool)
def test_foil_only(self):
self.assertIsInstance(khans.foil_only(), bool)
def test_icon_svg_uri(self):
self.assertIsInstance(khans.icon_svg_uri(), str)
def test_search_uri(self):
self.assertIsInstance(khans.search_uri(), str)
if __name__ == '__main__':
unittest.main() | 25.084746 | 67 | 0.691892 | 191 | 1,480 | 5.120419 | 0.277487 | 0.100205 | 0.343558 | 0.385481 | 0.206544 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.191892 | 1,480 | 59 | 68 | 25.084746 | 0.817726 | 0.043919 | 0 | 0 | 0 | 0 | 0.012023 | 0 | 0 | 0 | 0 | 0 | 0.368421 | 1 | 0.368421 | false | 0 | 0.105263 | 0 | 0.5 | 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 | 0 | 0 | 0 | 3 |
a5b6d5ce0ce97c7ff9249912738d183eb9ca560c | 449 | py | Python | LBP51.py | Anandgowda18/LogicBasedPrograms | 25baa9fbf19cd45229c87e099877e97281b0e76b | [
"MIT"
] | null | null | null | LBP51.py | Anandgowda18/LogicBasedPrograms | 25baa9fbf19cd45229c87e099877e97281b0e76b | [
"MIT"
] | null | null | null | LBP51.py | Anandgowda18/LogicBasedPrograms | 25baa9fbf19cd45229c87e099877e97281b0e76b | [
"MIT"
] | null | null | null | '''Given a valid IP address, return a defanged version of that IP address. A defanged IP address replaces every period '.' with "[.]".
Input Format
A string
Constraints
non-empty String
Output Format
replacement String
Sample Input 0
1.1.1.1
Sample Output 0
1[.]1[.]1[.]1
Sample Input 1
255.100.50.0
Sample Output 1
255[.]100[.]50[.]0
Sample Input 2
1.2.3.4
Sample Output 2
1[.]2[.]3[.]4'''
#solution
print(input().replace('.','[.]')) | 12.472222 | 134 | 0.67706 | 79 | 449 | 3.848101 | 0.43038 | 0.039474 | 0.039474 | 0.026316 | 0.210526 | 0.177632 | 0 | 0 | 0 | 0 | 0 | 0.106667 | 0.164811 | 449 | 36 | 135 | 12.472222 | 0.704 | 0.904232 | 0 | 0 | 0 | 0 | 0.105263 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 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 | 0 | 0 | 0 | 1 | 0 | 3 |
3c4dca815ed01033d3b7eadeef2709708a553018 | 1,902 | py | Python | src/nr/util/orderedset.py | NiklasRosenstein/python-nr.util | 087f2410d38006c1005a5fb330c47a56bcdb2279 | [
"MIT"
] | null | null | null | src/nr/util/orderedset.py | NiklasRosenstein/python-nr.util | 087f2410d38006c1005a5fb330c47a56bcdb2279 | [
"MIT"
] | 3 | 2022-02-16T13:17:28.000Z | 2022-03-14T15:28:41.000Z | src/nr/util/orderedset.py | NiklasRosenstein/python-nr.util | 087f2410d38006c1005a5fb330c47a56bcdb2279 | [
"MIT"
] | null | null | null |
import collections
import functools
import typing as t
from nr.util.generic import T
T_OrderedSet = t.TypeVar('T_OrderedSet', bound='OrderedSet')
@functools.total_ordering
class OrderedSet(t.MutableSet[T]):
def __init__(self, iterable: t.Optional[t.Iterable[T]] = None) -> None:
self._index_map: t.Dict[T, int] = {}
self._content: t.Deque[T] = collections.deque()
if iterable is not None:
self.update(iterable)
def __repr__(self) -> str:
if not self._content:
return '%s()' % (type(self).__name__,)
return '%s(%r)' % (type(self).__name__, list(self))
def __iter__(self) -> t.Iterator[T]:
return iter(self._content)
def __reversed__(self) -> 'OrderedSet[T]':
return OrderedSet(reversed(self._content))
def __eq__(self, other: t.Any) -> bool:
if isinstance(other, OrderedSet):
return len(self) == len(other) and list(self) == list(other)
return False
def __le__(self, other: t.Any) -> bool:
return all(e in other for e in self)
def __len__(self) -> int:
return len(self._content)
def __contains__(self, key: t.Any) -> bool:
return key in self._index_map
def __getitem__(self, index: int) -> T:
return self._content[index]
def add(self, key: T) -> None:
if key not in self._index_map:
self._index_map[key] = len(self._content)
self._content.append(key)
def copy(self: T_OrderedSet) -> 'T_OrderedSet':
return type(self)(self)
def discard(self, key: T) -> None:
if key in self._index_map:
index = self._index_map.pop(key)
del self._content[index]
def pop(self, last: bool = True) -> T:
if not self._content:
raise KeyError('set is empty')
key = self._content.pop() if last else self._content.popleft()
self._index_map.pop(key)
return key
def update(self, iterable: t.Iterable[T]) -> None:
for x in iterable:
self.add(x)
| 26.788732 | 73 | 0.656677 | 279 | 1,902 | 4.207885 | 0.268817 | 0.112436 | 0.07155 | 0.035775 | 0.114991 | 0.028961 | 0 | 0 | 0 | 0 | 0 | 0 | 0.20347 | 1,902 | 70 | 74 | 27.171429 | 0.774917 | 0 | 0 | 0.039216 | 0 | 0 | 0.036297 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.27451 | false | 0 | 0.078431 | 0.137255 | 0.607843 | 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 | 0 | 1 | 1 | 0 | 0 | 3 |
3c4ddc1c01b18295d9fb2f58c8e9a33ac6c57830 | 1,812 | py | Python | applied_python/applied_python/lib/python2.7/site-packages/netmiko/linux/linux_ssh.py | mith1979/ansible_automation | 013dfa67c6d91720b787fadb21de574b6e023a26 | [
"Apache-2.0"
] | null | null | null | applied_python/applied_python/lib/python2.7/site-packages/netmiko/linux/linux_ssh.py | mith1979/ansible_automation | 013dfa67c6d91720b787fadb21de574b6e023a26 | [
"Apache-2.0"
] | null | null | null | applied_python/applied_python/lib/python2.7/site-packages/netmiko/linux/linux_ssh.py | mith1979/ansible_automation | 013dfa67c6d91720b787fadb21de574b6e023a26 | [
"Apache-2.0"
] | null | null | null | import re
from netmiko.ssh_connection import SSHConnection
class LinuxSSH(SSHConnection):
def set_base_prompt(self, pri_prompt_terminator='$',
alt_prompt_terminator='#', delay_factor=.1):
"""Determine base prompt."""
return super(SSHConnection, self).set_base_prompt(
pri_prompt_terminator=pri_prompt_terminator,
alt_prompt_terminator=alt_prompt_terminator,
delay_factor=delay_factor)
def send_config_set(self, config_commands=None, exit_config_mode=True, **kwargs):
"""Can't exit from root (if root)"""
if self.username == "root":
exit_config_mode = False
return super(SSHConnection, self).send_config_set(config_commands=config_commands,
exit_config_mode=exit_config_mode,
**kwargs)
def check_config_mode(self, check_string='#'):
"""Verify root"""
return super(SSHConnection, self).check_config_mode(check_string=check_string)
def config_mode(self, config_command='sudo su'):
"""Attempt to become root."""
return self.enable(cmd=config_command)
def exit_config_mode(self, exit_config='exit'):
return super(SSHConnection, self).exit_config_mode(exit_config=exit_config)
def check_enable_mode(self, check_string='#'):
return self.check_config_mode(check_string=check_string)
def exit_enable_mode(self, exit_command='exit'):
return self.exit_config_mode(exit_config=exit_command)
def enable(self, cmd='sudo su', pattern='ssword', re_flags=re.IGNORECASE):
"""Attempt to become root."""
return super(SSHConnection, self).enable(cmd=cmd, pattern=pattern, re_flags=re_flags)
| 42.139535 | 93 | 0.657837 | 216 | 1,812 | 5.199074 | 0.240741 | 0.097952 | 0.087266 | 0.124666 | 0.349955 | 0.239537 | 0.217275 | 0.078362 | 0.078362 | 0 | 0 | 0.000727 | 0.240618 | 1,812 | 42 | 94 | 43.142857 | 0.815407 | 0.062362 | 0 | 0 | 0 | 0 | 0.021518 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.296296 | false | 0 | 0.074074 | 0.111111 | 0.703704 | 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 | 0 | 1 | 1 | 0 | 0 | 3 |
b1bbb7e85fba153d58638741ce35332ddf59f2bb | 127 | py | Python | blog/home/urls.py | 11059/blog | bd3a68b4a032c24da5831aefd33f358284ca4c3d | [
"MIT"
] | null | null | null | blog/home/urls.py | 11059/blog | bd3a68b4a032c24da5831aefd33f358284ca4c3d | [
"MIT"
] | null | null | null | blog/home/urls.py | 11059/blog | bd3a68b4a032c24da5831aefd33f358284ca4c3d | [
"MIT"
] | null | null | null | from django.urls import path
from home.views import IndexView
urlpatterns=[
path('', IndexView.as_view(),name='index'),
] | 18.142857 | 47 | 0.724409 | 17 | 127 | 5.352941 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133858 | 127 | 7 | 48 | 18.142857 | 0.827273 | 0 | 0 | 0 | 0 | 0 | 0.039063 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
b1d70b532712bd846f1a70f021a50fadff6b4449 | 9,816 | py | Python | src/preprocess.py | vkola-lab/ajpa2021 | 67a76ae184b4c9c40c9bc104c8d87ffa5ea69d91 | [
"MIT"
] | null | null | null | src/preprocess.py | vkola-lab/ajpa2021 | 67a76ae184b4c9c40c9bc104c8d87ffa5ea69d91 | [
"MIT"
] | null | null | null | src/preprocess.py | vkola-lab/ajpa2021 | 67a76ae184b4c9c40c9bc104c8d87ffa5ea69d91 | [
"MIT"
] | null | null | null | import os
import PIL
from PIL import Image
from PIL import Image, ImageStat
PIL.Image.MAX_IMAGE_PIXELS = 10000000000
import numpy as np
import cv2
import openslide
import time
PATCH_SIZE = 224
STRIDE = 224
DOWN_SIZE = 508
def preprocess_mask(path_ori, path_mask, width_resize=2560, height_resize=1920):
start_time = time.time()
all_files = os.listdir(path_ori)
for file_ in all_files:
ori = openslide.OpenSlide(os.path.join(path_ori, file_))
name = file_.split('.')[0]
if os.path.exists(os.path.join(path_mask, '{}-annotations.png'.format(name))):
annt = Image.open(os.path.join(path_mask, '{}-annotations.png'.format(name)))
width, height = annt.size
width_r = width/width_resize
height_r = height/height_resize
annt_resize = annt.resize((width_resize,height_resize))
annt_resize_img = np.array(annt_resize)
os.makedirs(os.path.join('data/masks/'), exist_ok=True)
cv2.imwrite('data/masks/{}_annt.jpg'.format(name), annt_resize_img)
print('{} finished'.format(name))
time.s
print("--- %s seconds ---" % (time.time() - start_time_total))
def preprocess_global(path_ori, width_resize=2560, height_resize=1920):
start_time = time.time()
all_files = os.listdir(path_ori)
for file_ in all_files:
ori = openslide.OpenSlide(os.path.join(path_ori, file_))
name = file_.split('.')[0]
width, height = ori.dimensions
x_resize_mins = []
x_resize_maxs = []
y_resize_mins = []
y_resize_maxs = []
if os.path.exists('data/masks/{}_annt.jpg'.format(name)):
annt_resized = cv2.imread('data/masks/{}_annt.jpg'.format(name), 0)
height_annt, width_annt = annt_resized.shape
ret, score = cv2.threshold(annt_resized, 128, 1, 0)
nLabels, labels, stats, centroids = cv2.connectedComponentsWithStats(score.astype(np.uint8), connectivity=4)
for k in range(1,nLabels):
size = stats[k, cv2.CC_STAT_AREA]
if size < 10000: continue
segmap = np.zeros(annt_resized.shape, dtype=np.uint8)
segmap[labels==k] = 255
np_contours = np.roll(np.array(np.where(segmap!=0)),1,axis=0).transpose().reshape(-1,2)
x_resize_min, x_resize_max = min(np_contours[:,1]), max(np_contours[:,1])
y_resize_min, y_resize_max = min(np_contours[:,0]), max(np_contours[:,0])
x_resize_mins.append(x_resize_min)
x_resize_maxs.append(x_resize_max)
y_resize_mins.append(y_resize_min)
y_resize_maxs.append(y_resize_max)
width_r = width/width_resize
height_r = height/height_resize
if len(x_resize_maxs) != 0:
x_resize_min, x_resize_max, y_resize_min, y_resize_max = min(x_resize_mins), max(x_resize_maxs), min(y_resize_mins), max(y_resize_maxs)
else:
for k in range(1,nLabels):
size = stats[k, cv2.CC_STAT_AREA]
if size < 150: continue
segmap = np.zeros(annt_resized.shape, dtype=np.uint8)
segmap[labels==k] = 255
np_contours = np.roll(np.array(np.where(segmap!=0)),1,axis=0).transpose().reshape(-1,2)
x_resize_min, x_resize_max = min(np_contours[:,1]), max(np_contours[:,1])
y_resize_min, y_resize_max = min(np_contours[:,0]), max(np_contours[:,0])
x_resize_mins.append(x_resize_min)
x_resize_maxs.append(x_resize_max)
y_resize_mins.append(y_resize_min)
y_resize_maxs.append(y_resize_max)
x_resize_min, x_resize_max, y_resize_min, y_resize_max = min(x_resize_mins), max(x_resize_maxs), min(y_resize_mins), max(y_resize_maxs)
x_min, x_max = int(x_resize_min * height_r), int(x_resize_max * height_r)
y_min, y_max = int(y_resize_min * width_r), int(y_resize_max * width_r)
crop = ori.read_region((y_min,x_min), 0, (y_max-y_min,x_max-x_min))
crop = crop.resize((DOWN_SIZE,DOWN_SIZE))
crop_np = np.array(crop)
crop_np = cv2.cvtColor(crop_np, cv2.COLOR_RGBA2RGB)
os.makedirs(os.path.join('data/globals/'), exist_ok=True)
cv2.imwrite('data/globals/{}.png'.format(name), crop_np)
print('{} finished'.format(name))
time.s
print("--- %s seconds ---" % (time.time() - start_time))
def preprocess_patch(path_ori, width_resize=2560, height_resize=1920):
start_time = time.time()
all_files = os.listdir(path_ori)
os.makedirs(os.path.join('data/locals/'), exist_ok=True)
for file_ in all_files:
ori = openslide.OpenSlide(os.path.join(path_ori, file_))
name = file_.split('.')[0]
width, height = ori.dimensions
x_resize_mins = []
x_resize_maxs = []
y_resize_mins = []
y_resize_maxs = []
if os.path.exists('data/masks/{}_annt.jpg'.format(name)):
os.makedirs(os.path.join('data/locals/' + name), exist_ok=True)
annt_resized = cv2.imread('data/masks/{}_annt.jpg'.format(name), 0)
height_annt, width_annt = annt_resized.shape
ret, score = cv2.threshold(annt_resized, 128, 1, 0)
nLabels, labels, stats, centroids = cv2.connectedComponentsWithStats(score.astype(np.uint8), connectivity=4)
for k in range(1,nLabels):
size = stats[k, cv2.CC_STAT_AREA]
if size < 10000: continue
segmap = np.zeros(annt_resized.shape, dtype=np.uint8)
segmap[labels==k] = 255
np_contours = np.roll(np.array(np.where(segmap!=0)),1,axis=0).transpose().reshape(-1,2)
x_resize_min, x_resize_max = min(np_contours[:,1]), max(np_contours[:,1])
y_resize_min, y_resize_max = min(np_contours[:,0]), max(np_contours[:,0])
x_resize_mins.append(x_resize_min)
x_resize_maxs.append(x_resize_max)
y_resize_mins.append(y_resize_min)
y_resize_maxs.append(y_resize_max)
width_r = width/width_resize
height_r = height/height_resize
if len(x_resize_maxs) != 0:
x_resize_min, x_resize_max, y_resize_min, y_resize_max = min(x_resize_mins), max(x_resize_maxs), min(y_resize_mins), max(y_resize_maxs)
else:
for k in range(1,nLabels):
size = stats[k, cv2.CC_STAT_AREA]
if size < 150: continue
segmap = np.zeros(annt_resized.shape, dtype=np.uint8)
segmap[labels==k] = 255
np_contours = np.roll(np.array(np.where(segmap!=0)),1,axis=0).transpose().reshape(-1,2)
x_resize_min, x_resize_max = min(np_contours[:,1]), max(np_contours[:,1])
y_resize_min, y_resize_max = min(np_contours[:,0]), max(np_contours[:,0])
x_resize_mins.append(x_resize_min)
x_resize_maxs.append(x_resize_max)
y_resize_mins.append(y_resize_min)
y_resize_maxs.append(y_resize_max)
x_resize_min, x_resize_max, y_resize_min, y_resize_max = min(x_resize_mins), max(x_resize_maxs), min(y_resize_mins), max(y_resize_maxs)
x_min, x_max = int(x_resize_min * height_r), int(x_resize_max * height_r)
y_min, y_max = int(y_resize_min * width_r), int(y_resize_max * width_r)
else:
continue
roi_h = x_max - x_min
roi_w = y_max - y_min
wp = int((roi_w - PATCH_SIZE) / STRIDE + 1)
hp = int((roi_h - PATCH_SIZE) / STRIDE + 1)
total = wp * hp
cnt = 0
for w in range(wp):
for h in range(hp):
y = y_min + w * STRIDE
x = x_min + h * STRIDE
cnt += 1
if y > width or x > height:
continue
crop = ori.read_region((y,x), 0, (PATCH_SIZE,PATCH_SIZE))
crop = crop.convert('RGB')
if sum(ImageStat.Stat(crop).stddev)/3 < 18 or sum(ImageStat.Stat(crop).median)/3 > 200:
continue
os.makedirs(os.path.join('data/locals/{}'.format(name)), exist_ok=True)
crop.save('data/locals/{}/{}_{}_{}_{}_{}.png'.format(name,name,str(h),str(w),str(roi_h),str(roi_w)))
if cnt % 1000 == 0:
print('{}/{}'.format(str(cnt), str(total)))
print('{} finished'.format(name))
print("--- %s seconds ---" % (time.time() - start_time_total))
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description='Preprocessing')
parser.add_argument('--path_ori', type=str, default='/scratch2/zheng/ajpa2021-master/data/OSUWMC/', help='path to dataset where images store')
parser.add_argument('--path_mask', type=str, default='/scratch2/zheng/ajpa2021-master/data/OSUWMC_MASK/', help='path to dataset where masks (if possible) store')
parser.add_argument('--m', action='store_true', default=False, help='preprocess masks if possible')
parser.add_argument('--g', action='store_true', default=False, help='preprocess data at global level')
parser.add_argument('--p', action='store_true', default=False, help='preprocess data at patch level')
args = parser.parse_args()
if args.m:
preprocess_mask(args.path_ori, args.path_mask)
elif args.g:
preprocess_global(args.path_ori)
elif args.p:
preprocess_patch(args.path_ori)
| 49.326633 | 165 | 0.599124 | 1,366 | 9,816 | 4.016837 | 0.123719 | 0.063787 | 0.02916 | 0.024057 | 0.753235 | 0.738655 | 0.721524 | 0.692182 | 0.684892 | 0.633862 | 0 | 0.025361 | 0.272922 | 9,816 | 198 | 166 | 49.575758 | 0.74345 | 0 | 0 | 0.632768 | 0 | 0 | 0.071516 | 0.024042 | 0 | 0 | 0 | 0 | 0 | 1 | 0.016949 | false | 0 | 0.050847 | 0 | 0.067797 | 0.039548 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b1d9ea1eac536432c7382cf5532afaf25887bbe6 | 276 | py | Python | test/test_main.py | KY64/python-starter-template | 6ba734cec57668db6246e85bf0c324ff04359482 | [
"MIT"
] | null | null | null | test/test_main.py | KY64/python-starter-template | 6ba734cec57668db6246e85bf0c324ff04359482 | [
"MIT"
] | 2 | 2021-09-24T12:57:15.000Z | 2021-09-24T19:55:01.000Z | test/test_main.py | KY64/python-starter-template | 6ba734cec57668db6246e85bf0c324ff04359482 | [
"MIT"
] | null | null | null | import unittest
from src.main import substract, add
class TestMain(unittest.TestCase):
def test_add(self):
result = add(9, 7)
self.assertEqual(result, 16)
def test_substract(self):
result = substract(9, 7)
self.assertEqual(result, 2)
| 23 | 36 | 0.655797 | 36 | 276 | 4.972222 | 0.527778 | 0.078212 | 0.067039 | 0.189944 | 0.256983 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033493 | 0.242754 | 276 | 11 | 37 | 25.090909 | 0.822967 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 1 | 0.222222 | false | 0 | 0.222222 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
b1da8715774b114e58c022d18b5599a966be0c83 | 116 | py | Python | question_model.py | sangethmathewjohn/PyQuiz_OOP | a9fdcab3884cee1b80951c1e279f5e58db981c3d | [
"Unlicense"
] | 2 | 2021-06-27T08:33:58.000Z | 2021-07-20T06:59:53.000Z | question_model.py | sangethmathewjohn/PyQuiz_OOP | a9fdcab3884cee1b80951c1e279f5e58db981c3d | [
"Unlicense"
] | null | null | null | question_model.py | sangethmathewjohn/PyQuiz_OOP | a9fdcab3884cee1b80951c1e279f5e58db981c3d | [
"Unlicense"
] | null | null | null | class Question:
def __init__(self, qtext, qanswer):
self.text =qtext
self.answer =qanswer
| 19.333333 | 40 | 0.603448 | 13 | 116 | 5.076923 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.310345 | 116 | 5 | 41 | 23.2 | 0.825 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 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 | 0 | 0 | 0 | 3 |
b1dbc2b8aaeac4063785ede18a17f1f56b8d7356 | 86 | py | Python | flytekit/__init__.py | flytehub/flytekit | f8f53567594069b29fcd3f99abd1da71a5ef0e22 | [
"Apache-2.0"
] | null | null | null | flytekit/__init__.py | flytehub/flytekit | f8f53567594069b29fcd3f99abd1da71a5ef0e22 | [
"Apache-2.0"
] | null | null | null | flytekit/__init__.py | flytehub/flytekit | f8f53567594069b29fcd3f99abd1da71a5ef0e22 | [
"Apache-2.0"
] | null | null | null | from __future__ import absolute_import
import flytekit.plugins
__version__ = '0.3.1'
| 17.2 | 38 | 0.813953 | 12 | 86 | 5.083333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039474 | 0.116279 | 86 | 4 | 39 | 21.5 | 0.763158 | 0 | 0 | 0 | 0 | 0 | 0.05814 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
b1fca680c3a855f104f3ad48d1f63a988374a6e5 | 26 | py | Python | constants.py | harryrobertwright/plutus | 7a0d9f1474982d1bb66d7b018f2ce7e28aab7bc3 | [
"MIT"
] | null | null | null | constants.py | harryrobertwright/plutus | 7a0d9f1474982d1bb66d7b018f2ce7e28aab7bc3 | [
"MIT"
] | null | null | null | constants.py | harryrobertwright/plutus | 7a0d9f1474982d1bb66d7b018f2ce7e28aab7bc3 | [
"MIT"
] | null | null | null | INTERVALS = [
"1h",
]
| 6.5 | 13 | 0.423077 | 2 | 26 | 5.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058824 | 0.346154 | 26 | 3 | 14 | 8.666667 | 0.588235 | 0 | 0 | 0 | 0 | 0 | 0.076923 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5909eb773cf91122abfbd155ab1ef7779d77f23a | 26 | py | Python | micro-benchmark-key-errs/snippets/parameters/imported_assigned_call/to_import.py | WenJinfeng/PyCG | b45e8e04fe697d8301cf27222a8f37646d69f168 | [
"Apache-2.0"
] | 121 | 2020-12-16T20:31:37.000Z | 2022-03-21T20:32:43.000Z | micro-benchmark-key-errs/snippets/parameters/imported_assigned_call/to_import.py | WenJinfeng/PyCG | b45e8e04fe697d8301cf27222a8f37646d69f168 | [
"Apache-2.0"
] | 24 | 2021-03-13T00:04:00.000Z | 2022-03-21T17:28:11.000Z | micro-benchmark-key-errs/snippets/parameters/imported_assigned_call/to_import.py | WenJinfeng/PyCG | b45e8e04fe697d8301cf27222a8f37646d69f168 | [
"Apache-2.0"
] | 19 | 2021-03-23T10:58:47.000Z | 2022-03-24T19:46:50.000Z | const1 = "a"
const2 = "b"
| 8.666667 | 12 | 0.538462 | 4 | 26 | 3.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 0.230769 | 26 | 2 | 13 | 13 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0.076923 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
591250889987fba85313b14511149afd485e1e41 | 268 | py | Python | rustplus/exceptions/exceptions.py | fieu/rustplus | d1e82a7a32988d48ce2c3fd386f464bd48f50385 | [
"MIT"
] | 1 | 2021-08-10T12:59:42.000Z | 2021-08-10T12:59:42.000Z | rustplus/exceptions/exceptions.py | fieu/rustplus | d1e82a7a32988d48ce2c3fd386f464bd48f50385 | [
"MIT"
] | null | null | null | rustplus/exceptions/exceptions.py | fieu/rustplus | d1e82a7a32988d48ce2c3fd386f464bd48f50385 | [
"MIT"
] | null | null | null | class Error(Exception):
"""Base class for other exceptions"""
pass
class ClientError(Error):
"""Raised when the client details are not valid"""
pass
class ImageError(Error):
"""Raised when the Image Returned is not valid"""
pass
| 20.615385 | 55 | 0.641791 | 33 | 268 | 5.212121 | 0.636364 | 0.104651 | 0.174419 | 0.209302 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.257463 | 268 | 12 | 56 | 22.333333 | 0.864322 | 0.447761 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
59245ad69bc6ea799437abf97159920fe65df34f | 149 | py | Python | exercicio-mundo-1/ex010.py | amosxrl/python | 8399a9c42fdb49184fcfe906f8bce82d1a671667 | [
"MIT"
] | 2 | 2020-05-06T23:49:20.000Z | 2020-05-06T23:49:25.000Z | exercicio-mundo-1/ex010.py | amosxrl/python | 8399a9c42fdb49184fcfe906f8bce82d1a671667 | [
"MIT"
] | null | null | null | exercicio-mundo-1/ex010.py | amosxrl/python | 8399a9c42fdb49184fcfe906f8bce82d1a671667 | [
"MIT"
] | null | null | null | print('Quanto dinheiro voce tem na carteiro')
print('-'*20)
re = float(input('R$ '))
dol = re * 0.1874
print('-'*20)
print('US$ {:.2f}'.format(dol))
| 21.285714 | 45 | 0.610738 | 24 | 149 | 3.791667 | 0.75 | 0.153846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.076923 | 0.127517 | 149 | 6 | 46 | 24.833333 | 0.623077 | 0 | 0 | 0.333333 | 0 | 0 | 0.342282 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.666667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
3caefd3f5a8bfe14855d5ea0372e3bc9a9317bc4 | 480 | py | Python | legacy-code/pailindrome.py | developbiao/pythonbasics | a7549786629e820646dcde5bb9f1aad4331de9be | [
"MIT"
] | 1 | 2019-06-13T15:33:57.000Z | 2019-06-13T15:33:57.000Z | legacy-code/pailindrome.py | developbiao/pythonbasics | a7549786629e820646dcde5bb9f1aad4331de9be | [
"MIT"
] | null | null | null | legacy-code/pailindrome.py | developbiao/pythonbasics | a7549786629e820646dcde5bb9f1aad4331de9be | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
#-*- coding: utf-8 -*-
def is_palindrome(n):
x = n
op_num = 0
while n:
op_num = op_num * 10 + n % 10
n = n//10
return x == op_num
# Test
output = filter(is_palindrome, range(1, 1000))
print('1~1000:', list(output))
if list(filter(is_palindrome, range(1, 200))) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191]:
print('测试成功!')
else:
print('测试失败!')
| 25.263158 | 163 | 0.55 | 86 | 480 | 2.988372 | 0.662791 | 0.077821 | 0.046693 | 0.178988 | 0.18677 | 0 | 0 | 0 | 0 | 0 | 0 | 0.221607 | 0.247917 | 480 | 18 | 164 | 26.666667 | 0.490305 | 0.097917 | 0 | 0 | 0 | 0 | 0.039535 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0 | 0 | 0.153846 | 0.230769 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3cb5796f6762e147de6c1a95dfd1c12f82cf44f8 | 241 | py | Python | hw-2/useful_modules.py | Atlasshrugs00/astr-119 | be30734d2580acd947e5b2e22e3039d0d42419f3 | [
"MIT"
] | null | null | null | hw-2/useful_modules.py | Atlasshrugs00/astr-119 | be30734d2580acd947e5b2e22e3039d0d42419f3 | [
"MIT"
] | 8 | 2021-09-24T04:02:52.000Z | 2021-12-09T05:45:22.000Z | hw-2/useful_modules.py | Atlasshrugs00/astr-119 | be30734d2580acd947e5b2e22e3039d0d42419f3 | [
"MIT"
] | null | null | null | import numpy as np #numpy library
import matplotlib.pyplot as plt #matplotlib pyplot
import sys #acces to c-like sys library
import os #gives access to operating system
print(sys.argv) #prints any command line arguments
print(os.getcwd()) | 26.777778 | 50 | 0.792531 | 39 | 241 | 4.897436 | 0.666667 | 0.136126 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.145228 | 241 | 9 | 51 | 26.777778 | 0.927184 | 0.506224 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0.333333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3cb8db111fef337bf519873d89b2fd5a45a81770 | 250 | py | Python | Learning/CodeWars/Python/7 kyu_Sum_of_numbers_from_0_to_N.py | aliasfoxkde/snippets | bb6dcc6597316ef9c88611f526935059451c3b5a | [
"MIT"
] | null | null | null | Learning/CodeWars/Python/7 kyu_Sum_of_numbers_from_0_to_N.py | aliasfoxkde/snippets | bb6dcc6597316ef9c88611f526935059451c3b5a | [
"MIT"
] | null | null | null | Learning/CodeWars/Python/7 kyu_Sum_of_numbers_from_0_to_N.py | aliasfoxkde/snippets | bb6dcc6597316ef9c88611f526935059451c3b5a | [
"MIT"
] | null | null | null | # See: https://www.codewars.com/kata/56e9e4f516bcaa8d4f001763
def show_sequence(n):
if n == 0:
return '0=0'
elif n < 0:
return str(n) + '<0'
return str(range(n+1))[1:-1].replace(', ','+') + ' = ' + str(sum(range(1,n+1)))
| 27.777778 | 83 | 0.54 | 38 | 250 | 3.526316 | 0.526316 | 0.044776 | 0.179104 | 0.164179 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129534 | 0.228 | 250 | 8 | 84 | 31.25 | 0.564767 | 0.236 | 0 | 0 | 0 | 0 | 0.058201 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
3cb91fcc9d369715e263d80560e5e0440993f481 | 144 | py | Python | pnbp/helpers/__init__.py | prettynb/pnbp | 1be54a2217a85675ec4a14a1c8a1d2501be88404 | [
"MIT"
] | 1 | 2021-07-30T02:00:29.000Z | 2021-07-30T02:00:29.000Z | pnbp/helpers/__init__.py | prettynb/pnbp | 1be54a2217a85675ec4a14a1c8a1d2501be88404 | [
"MIT"
] | null | null | null | pnbp/helpers/__init__.py | prettynb/pnbp | 1be54a2217a85675ec4a14a1c8a1d2501be88404 | [
"MIT"
] | null | null | null | from .base import _convert_datetime
from .codeblock import CodeBlock
from .link import Link
from .tag import Tag
from .url import Url
| 9 | 35 | 0.756944 | 21 | 144 | 5.095238 | 0.428571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.208333 | 144 | 15 | 36 | 9.6 | 0.938596 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3ccccac3d5c3d7c8d168081f420c8dfcbee68843 | 761 | py | Python | NhMedicalSite/panel/models.py | Dogruyer/ecommerce | aa505b401e42882a96e6ef6375bd1a1ed95c5b85 | [
"Apache-2.0"
] | null | null | null | NhMedicalSite/panel/models.py | Dogruyer/ecommerce | aa505b401e42882a96e6ef6375bd1a1ed95c5b85 | [
"Apache-2.0"
] | null | null | null | NhMedicalSite/panel/models.py | Dogruyer/ecommerce | aa505b401e42882a96e6ef6375bd1a1ed95c5b85 | [
"Apache-2.0"
] | 1 | 2018-11-01T11:10:58.000Z | 2018-11-01T11:10:58.000Z | from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Category(models.Model):
category_name=models.CharField(max_length=100)
class Products(models.Model):
title=models.CharField(max_length=100)
content = models.TextField(max_length=300)
product_image=models.ImageField(upload_to='images/products/',
default='images/products/default.jpg')
product_price=models.DecimalField(max_digits=6,decimal_places=4)
category_id=models.ForeignKey(Category)
class User:
name=models.CharField(max_length=50)
lastname=models.CharField(max_length=50)
email=models.EmailField(max_length=100)
password=models.CharField(max_length=20)
| 21.138889 | 75 | 0.730618 | 95 | 761 | 5.652632 | 0.505263 | 0.117318 | 0.167598 | 0.223464 | 0.212291 | 0 | 0 | 0 | 0 | 0 | 0 | 0.031746 | 0.172142 | 761 | 35 | 76 | 21.742857 | 0.820635 | 0.031537 | 0 | 0 | 0 | 0 | 0.059557 | 0.037396 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.0625 | 0.125 | 0 | 0.9375 | 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 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
a7024ecc7fc28ff6673f46a13ae3e63f8ae5b339 | 114 | py | Python | tests/demo/demoproject/urls.py | saxix/django-mb | 3700c05b45854a28bd23368c4e4971ae54c18cad | [
"BSD-3-Clause"
] | 2 | 2017-03-20T12:26:02.000Z | 2017-04-22T11:46:17.000Z | tests/demo/demoproject/urls.py | saxix/django-mb | 3700c05b45854a28bd23368c4e4971ae54c18cad | [
"BSD-3-Clause"
] | null | null | null | tests/demo/demoproject/urls.py | saxix/django-mb | 3700c05b45854a28bd23368c4e4971ae54c18cad | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import
from django.contrib import admin
admin.autodiscover()
urlpatterns = (
)
| 12.666667 | 38 | 0.798246 | 13 | 114 | 6.615385 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140351 | 114 | 8 | 39 | 14.25 | 0.877551 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a71f0fb6127bf9b694c0e036c4b163b042f9e29b | 127 | py | Python | landingpage/urls.py | aurphillus/Django-Library-Completed | f46e45f85c888e7694323e22f6e966c291a4a0be | [
"MIT"
] | null | null | null | landingpage/urls.py | aurphillus/Django-Library-Completed | f46e45f85c888e7694323e22f6e966c291a4a0be | [
"MIT"
] | null | null | null | landingpage/urls.py | aurphillus/Django-Library-Completed | f46e45f85c888e7694323e22f6e966c291a4a0be | [
"MIT"
] | null | null | null | from django.urls import path
from landingpage.views import *
urlpatterns = [
path('',landingpage,name="landingpage"),
]
| 14.111111 | 44 | 0.716535 | 14 | 127 | 6.5 | 0.642857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15748 | 127 | 8 | 45 | 15.875 | 0.850467 | 0 | 0 | 0 | 0 | 0 | 0.086614 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a71fe8e9c812b790a9f8e10c54db7ff385e01808 | 31,509 | py | Python | cloud-v2.0/verify/verify.py | 13242084001/api | 71f57b485d685caae94a84b625d64be832cf8910 | [
"Apache-2.0"
] | null | null | null | cloud-v2.0/verify/verify.py | 13242084001/api | 71f57b485d685caae94a84b625d64be832cf8910 | [
"Apache-2.0"
] | 1 | 2021-03-25T23:58:32.000Z | 2021-03-25T23:58:32.000Z | cloud-v2.0/verify/verify.py | 13242084001/api | 71f57b485d685caae94a84b625d64be832cf8910 | [
"Apache-2.0"
] | null | null | null | from common import sshClient
import time
import eventlet
from .gol import *
import requests
from common.uploadMirror import login
from common.sqlquery import Query
#import pytest
import json
def check_login_response_headers(response):
result = False
if "cloud0" in response.headers.get("Set-Cookie"):
result = True
assert result == True
def logout_ok(response):
pass
def check_stop_py_machine(response):
#print(json.dumps(response.json()))
#print(response.json().get("code"), "yyyyyyyyyyyyyyy")
assert response.json().get("code") == 0
def check_add_role(response):
body_json = response.json()
assert body_json.get("code") == 1
assert body_json.get("error") == None
def check_remove_role(response):
body = response.json()
assert body.get("code") == 1
assert body.get("error") == None
#校验添加区域
def check_add_zone(response):
body = response.json()
resourceIds = body.get("resourceIds")
#print(body)
assert body.get("code") == 1
#assert isinstance(resourceIds,list)
def check_query_zone(response):
body = response.json()
assert body.get("code") == 1
def check_query_cluster(response):
body = response.json()
print("####################################################")
assert body.get("code") == 1
assert isinstance(body.get("rows"), list)
#json 校验,暂未使用
def check_cluster_add(response):
body = response.json()
print(body)
def check_physicalmachine_query_ok(response):
body = response.json()
print(body)
assert body.get("code") == 1
#assert body.get("rows")
def check_physical_update_ok(response):
body = response.json()
print(body)
assert body.get("code") == 1
assert isinstance(body.get("resourceIds"), list)
def check_stop_start_pysicalmachine_ok(response):
body = response.json()
assert body.get("code") == 1
assert isinstance(body.get("resourceIds"), list)
# 校验查询主存储
def check_mainStorage_query_ok(response):
body = response.json()
assert body.get("code") == 1
assert isinstance(body.get("rows"), list)
# 校验修改主存储
def check_mainStorage_update_ok(response):
body = response.json()
assert body.get("code") == 1
assert isinstance(body.get("resourceIds"), list)
# 校验主存储添加集群查询集群列表
def check_query_clusterUnload_list_ok(response):
body = response.json()
assert body.get("code") == 1
assert isinstance(body.get("rows"), list)
# 校验主存储添加集群
def check_mainStorage_addCluster_ok(response, clusterId, uri):
assert response.json().get('code') == 1
#print(response.json())
result = Query()('SELECT * FROM `cl_host_inf` WHERE CLUSTERID="{0}" AND STATE=1 AND DELETED=0'.format(clusterId))
#print(result)
#print(555555555555555555555555)
username = "root"
password = "user@dev"
ip = "172.16.130.254"
cmd = 'kubectl get vmp|grep "{0}"|wc -l'.format(uri)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret) == len(result):
# print(1111)
flag = True
break
assert flag
def check_delete_mainStorage_ok(response, ids):
id_list = ids.split(",")
#result = Query()(
# 'SELECT COUNT(*) FROM `cl_host_inf` WHERE CLUSTERID="{0}" AND STATE=1 AND DELETED=0'.format(clusterid))
username = "root"
password = "user@dev"
ip = "172.16.130.254"
for id in id_list:
cmd = 'kubectl get vmp|grep "{0}"|wc -l'.format(id)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
try:
if not int(ret):
# print(1111)
flag = True
break
except Exception as e:
print(e)
flag = True
break
assert flag
def check_add_mirrorServer_ok(response):
print(response.json())
username = "root"
password = "user@dev"
ip = "172.16.130.254"
cmd = 'kubectl get vmp|grep vmdi|wc -l'
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret) > 1:
# print(1111)
flag = True
break
assert flag
#校验添加云主机成功
def check_cloudHost_add_ok(response):
body = response.json()
print(body)
assert body.get("code") == 1
id = body.get("id")
id_len = len(id.split(","))
id = id.replace(",", "|")
username = "root"
password = "user@dev"
ip = "172.16.130.254"
cmd = 'kubectl get vm|grep -E "{0}"|wc -l'.format(id)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret) == id_len:
#print(1111)
flag = True
break
assert flag
#校验查询running状态的云主机
def check_query_vm_status_ok(response, state):
#print("zheshi jjjjjj ", state)
verify_rows = get_value("rows")
num = 0
for row in verify_rows:
if row.get("state") == state:
num += 1
local_rows = response.json().get("rows")
for row in local_rows:
assert row.get("state") == state
continue
assert len(local_rows) == num
def check_query_vm_ok(response, keyword, searchtype):
searchtype_dict = {0: "name", 2: "hostip"}
verify_rows = get_value("rows")
#print(verify_rows,"f"*30)
num = 0
for row in verify_rows:
if keyword in row.get(searchtype_dict.get(searchtype)):
num += 1
local_rows = response.json().get("rows")
for row in local_rows:
assert keyword in row.get(searchtype_dict.get(searchtype))
continue
assert len(local_rows) == num
def search_vmip_list(keyword):
des_url = "http://172.16.130.254:38080/networkCard/query.do"
vm_list = get_value("rows")
#print(vm_list, "8"*10)
vmid_list = [i.get("vmid") for i in vm_list]
result = 0
cookie = login()
for vmid in vmid_list:
params = {
"order": "asc",
"offset": 0,
"limit": 20,
"vmid": vmid
}
res = requests.get(des_url, params=params,
headers={"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Cookie": cookie})
#print(res.json())
rows = res.json().get("rows")
for row in rows:
if keyword in row.get("ip"):
result += 1
return result
def check_query_vm_ip_ok(response, keyword):
cmp_num = search_vmip_list(keyword=keyword)
rows = response.json().get("rows")
#print(cmp_num, "hhhhhhh")
#print(len(rows))
assert len(rows) == cmp_num
def check_reboot_vm_ok(response):
assert response.json().get("code") == 1
def check_pause_forceStop_stop_ok(response, state, hostip):
vmid = response.json().get("id")
username = "root"
password = "user@dev"
ip = hostip
cmd = 'virsh list --all|grep {0}|grep -E "{1}"|wc -l'.format(state, vmid)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret):
# print(1111)
flag = True
break
assert flag
des_url = "http://172.16.130.254:38080/networkCard/query.do"
params = {
"order": "asc",
"offset": 0,
"limit": 20,
"searchtype": 0,
"keyword": None,
"state": None,
}
cookie = login()
res = requests.get(des_url, params=params,
headers={"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Cookie": cookie})
# print(res.json())
rows = res.json().get("rows")
if state == "shut":
st = "stopped"
elif state == "paused":
st = state
else:
st = "running"
for row in rows:
if row.get("vmid") == vmid:
assert row.get("state") == st
def check_all_vm_stop(response, ids):
username = "root"
password = "user@dev"
ip = "172.16.130.254"
for i in ids.split(","):
cmd = 'kubectl get vm|grep {0}|grep -i shut|wc -l'.format(i)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if not (int(ret) - 3):
# print(1111)
flag = True
break
assert flag
def check_cloudDisk_add_ok(response, template=0):
id = response.json().get("id")
username = "root"
password = "user@dev"
ip = "172.16.130.254"
if template:
cmd = 'find /var/lib/libvirt/cstor/ -name {0}|wc -l'.format(id)
else:
cmd = 'kubectl get vmd|grep {0}|wc -l'.format(id)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret):
# print(1111)
flag = True
break
assert flag
def check_cloudDiskLoad_or_unload_ok(response, vmid, volumeid, typee=1):
username = "root"
password = "user@dev"
ip = "172.16.130.254"
cmd = 'kubectl get vm {0} -o yaml|grep {1}|wc -l'.format(vmid, volumeid)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if typee:
if int(ret):
# print(1111)
flag = True
break
else:
if not int(ret):
# print(1111)
flag = True
break
assert flag
def check_cloudDisk_queryImageserver_ok(response):
rows = response.json().get("rows")
for row in rows:
assert row.get("state") == 1
def check_cloudDisk_snapshot_add_ok(response):
id = response.json().get('id')
username = "root"
password = "user@dev"
ip = "172.16.130.254"
cmd = 'kubectl get vmd|grep {0}|wc -l'.format(id)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret):
flag = True
break
assert flag
def check_cloudDisk_setQos_ok(response, vmid, rx, tx):
assert response.json().get("id")
username = "root"
password = "user@dev"
ip = "172.16.130.254"
for i in [rx, tx]:
cmd = "kubectl get vm {0} -i yaml|grep 'text: {1}'|wc -l".format(vmid, i*1024*1024)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret):
flag = True
break
assert flag
def check_cloudDisk_cancleQos_ok(response, vmid):
assert response.json().get("id")
username = "root"
password = "user@dev"
ip = "172.16.130.254"
cmd = "kubectl get vm {0} -i yaml|grep -E 'write|read'|wc -l".format(vmid)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret):
flag = True
break
assert flag
def check_cloudDisk_expandVol_ok(response, installpath, size, hostip):
assert response.json().get("id")
username = "root"
password = "user@dev"
ip = hostip
cmd = "qume-img info %s|grep virtual|awk '{print $3}'" % (installpath,)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if str(ret) == size:
flag = True
break
assert flag
#这个函数本来是用来验证存储迁移查询可选择的物理机列表的,但是开发傻逼,传参没传clusterid,导致这里无法验证
def verify_query_cluster_all_phymachine_ok(response):
pass
def check_cloudDisk_migrate_ok(response, installpath, pmip, msurl, msname):
cloudDiskId = response.json().get("resourceIds")[0]
username = "root"
password = "user@dev"
ip = pmip
cmd = "kubectl get vmd|grep %s|awk '{print $3}'" % (cloudDiskId,)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if msurl in str(ret) and (msurl not in installpath):
flag = True
break
assert flag
des_url = "http://172.16.130.254:38080/cloudDisk/query.do"
params = {
"order": "asc",
"offset": 0,
"limit": 20,
"searchtype": 0,
"keyword": None,
"state": None,
}
cookie = login()
res = requests.get(des_url, params=params,
headers={"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Cookie": cookie})
# print(res.json())
rows = res.json().get("rows")
for row in rows:
if row.get("volumeid") == cloudDiskId:
assert row.get("msname") == msname
break
def check_query_cloudHost_loadable_or_unloadable_disk_ok(response, vmid, load=1):
if load:
sql_result = Query()("SELECT * FROM `cl_volume_inf` where STATE = 0 and VMID is null;")
else:
sql_result = Query()('SELECT * FROM `cl_volume_inf` where VMID="{0}" and TYPE=2;'.format(vmid,))
sql_volid_list = [x.get("VOLUMEID") for x in sql_result]
json_volid_list = [x.get("volumeid") for x in response.json().get("rows")]
assert len(sql_volid_list) == len(json_volid_list)
for volid in sql_volid_list:
assert volid in json_volid_list
def check_cloudHost_setHa_ok(response, vmid, hostip, cancle=0):
username = "root"
password = "user@dev"
ip = hostip
cmd = 'kubectl get vm {0} -o yaml|grep -w ha|wc -l'.format(vmid)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if not cancle:
if int(ret):
flag = True
break
else:
if not int(ret):
flag = True
break
assert flag
def check_cloudHost_makeSnapshot_ok(response, vmid, hostip):
id = response.json().get("id")
assert id
username = "root"
password = "user@dev"
ip = hostip
cmd = 'kubectl get vmd|grep {0}|wc -l'.format(vmid)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret):
flag = True
break
assert flag
def check_makeVMimage_ok(response, hostip):
id = response.json().get("id")
assert id
username = "root"
password = "user@dev"
ip = hostip
cmd = 'find / -name {0}|wc -l'.format(id)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret):
flag = True
break
assert flag
def check_modify_cpu_num_ok(response, cpunum_new, hostip):
id = response.json().get("id")
assert id
username = "root"
password = "user@dev"
ip = hostip
cmd = "virsh vcpucount %s|grep current|awk '{print $3}'|tail -1" % (id,)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret) == cpunum_new:
flag = True
break
assert flag
def check_modify_mem_ok(response, memorysize, hostip):
#print(11111111111111111111111111111111111111111)
#print(response.json())
id = response.json().get("id")
#print("this is id....", id)
assert id
username = "root"
password = "user@dev"
ip = hostip
cmd = "virsh dominfo %s|grep Use|awk '{print $3}'" % (id,)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(int(ret)/(1024*1024)) == memorysize:
flag = True
break
assert flag
def check_query_cmrom_iso(response, vmid):
mirrorid_list = Query()('SELECT MIRRORID FROM `cl_mirror_inf` WHERE status=1 and MFORMAT="iso" AND '
'DOMAINID=(SELECT DOMAINID FROM `cl_vm_inf` WHERE VMID="{0}") '
'AND MIRRORID NOT IN (SELECT ISOID FROM `cl_vmcdrom_inf` WHERE'
' VMID="{1}")'.format(vmid, vmid))
rows = response.json().get("rows")
assert len(mirrorid_list) == len(rows)
for row in rows:
assert row.get("mirrorid") in mirrorid_list
def check_addCdrom_ok(vmid, mirrorid, hostip):
username = "root"
password = "user@dev"
ip = hostip
cmd = "kubectl get vm {0} -o yaml|grep {1}.iso|wc -l".format(vmid, mirrorid)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
print("this is flag...", flag)
if int(ret):
flag = True
break
assert flag
def check_changeBootSequence_ok(response, vmid, bootSeq, hostip):
assert response.json().get("id")
username = "root"
password = "user@dev"
ip = hostip
cmd = "kubectl get vm {0} -o yaml|grep order|cut -d: -f 2".format(vmid, )
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(180, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
ret = ret.decode("utf-8").replace("\n", "").replace(" ", "")
if bootSeq == 1:
if ret == "12":
flag = True
break
elif bootSeq == 2:
if ret == "21":
flag = True
break
assert flag
def check_changeSystem_querySystem_ok(response, vmid):
mirrorid_list = Query()('SELECT MIRRORID FROM `cl_mirror_inf` WHERE status=1 and MFORMAT!="iso" AND '
'DOMAINID=(SELECT DOMAINID FROM `cl_vm_inf` WHERE VMID="{0}") '
'AND MIRRORID NOT IN (SELECT ISOID FROM `cl_vmcdrom_inf` WHERE'
' VMID="{1}")'.format(vmid, vmid))
rows = response.json().get("rows")
assert len(mirrorid_list) == len(rows)
for row in rows:
assert row.get("mirrorid") in mirrorid_list
def check_changeOs_ok(response, template_url, rootvolumeid, hostip):
username = "root"
password = "user@dev"
ip = hostip
cmd = "diff %s `kubectl get vmd %s|tail -1|awk '{print $3}'`|wc -l" % (template_url, rootvolumeid)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(30, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
print("this is flag...", flag)
if not int(ret):
flag = True
break
assert flag
def check_delete_mirror_all_ok(response):
print(response.json())
def check_delete_mirrorServer_ok(response, mirrorServerId):
print(response.json())
username = "root"
password = "user@dev"
ip = "172.16.130.254"
cmd = "kubectl get vmp|grep {0}|wc -l".format(mirrorServerId)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(30, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
print("this is flag...", flag)
if not int(ret):
flag = True
break
assert flag
def check_delete_all_resource_ok(response, flag="vm"):
username = "root"
password = "user@dev"
ip = "172.16.130.254"
ids = response.json().get("id")
ids_list = ids.split(",")
for id in ids_list:
if flag == "vm":
cmd = "kubectl get vm|grep {0}|wc -l".format(id)
else:
cmd = "kubectl get vmp|grep {0}|wc -l".format(id)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(30, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
#print("this is flag...", flag)
if not int(ret):
flag = True
break
assert flag
def check_delete_net(response, l2vmn_num=2):
username = "root"
password = "user@dev"
ip = "172.16.130.254"
cmd = "kubectl get vmn|grep l2network|wc -l"
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(30, False):
while 1:
time.sleep(0.5)
try:
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
ret = int(ret)
except Exception:
flag = True
break
if int(l2vmn_num) - ret == 2:
flag = True
break
assert flag
#l2vmn check
def check_creat_net_ok(response, l2vmn_num=0):
username = "root"
password = "user@dev"
ip = "172.16.130.254"
cmd = "kubectl get vmn|grep l2network|wc -l"
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(30, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret) - int(l2vmn_num) == 2:
flag = True
break
assert flag
def check_creat_l3_net_ok(response):
id = response.json().get("id")
assert id
username = "root"
password = "user@dev"
ip = "172.16.130.254"
cmd = "kubectl get vmn|grep {0}|wc -l".format(id)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(30, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret):
flag = True
break
assert flag
def check_creat_vxlanPool_ok(response, pool_name):
#print(response)
try:
code = response.json().get("code")
if "1" in pool_name:
assert -1 == code
else:
assert 1 == code
except Exception as e:
print(e)
assert True
def check_add_vxlan_vni_ok(response, flag):
print(response.json())
if 3 == flag:
assert response.json().get("code") == 1
if 2 == flag:
assert response.json().get("code") == -1
if 1 == flag:
assert response.json().get("code") == -1
def check_delete_vni_range_ok(response, vni_list, vnistart, endvni):
for vni in vni_list.split(","):
if vni in range(int(vnistart), int(endvni) + 1):
assert -1 == response.json().get("code")
assert 1 == response.json().get("code")
def check_delete_vxlan_net_ok(response, vni, vxlan_clusterid_list):
assert response.json().get("code") == 1
#print(vxlan_clusterid_list)
#print(7777777777777777777777777)
try:
vxlan_clusterid_list = json.loads(vxlan_clusterid_list)
except Exception:
vxlan_clusterid_list = tuple(vxlan_clusterid_list.split(","))
#print(vxlan_clusterid_list)
#print(66666666666666)
if len(vxlan_clusterid_list) > 1:
sql_cmd = 'SELECT HOSTIP FROM `cl_host_inf` WHERE STATE=1 AND DELETED=0 AND `STATUS`="Ready" and CLUSTERID IN {0};'.format(str(vxlan_clusterid_list))
else:
sql_cmd = 'SELECT HOSTIP FROM `cl_host_inf` WHERE STATE=1 AND DELETED=0 AND `STATUS`="Ready" and CLUSTERID="{0}";'.format(vxlan_clusterid_list[0])
#print(sql_cmd)
#print(555555555555555555555)
result = Query()(sql_cmd)
ip_list = []
for re in result:
ip_list.append(re.get("HOSTIP"))
username = "root"
password = "user@dev"
for ip in ip_list:
cmd = "ovs-vsctl list-br|grep vx{0}|wc -l".format(vni)
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(30, False):
while 1:
time.sleep(0.1)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if not int(ret):
flag = True
break
assert flag
def check_modify_l3network_mtu(response, mtu):
id = response.json().get("id")
cmd = "ovn-nbctl dhcp-options-get-options `ovn-nbctl show %s|grep dhcp|awk -F\"-\" '{print $3\"-\"$4\"-\"$5\"-\"$6\"-\"$7}'`|grep mtu|cut -d\"=\" -f2" % (id,)
username = "root"
password = "user@dev"
ip = "172.16.130.254"
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(30, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret) == int(mtu):
flag = True
break
assert flag
def check_l3network_add_dns(response, mtu, rows, nid, dns_addr):
cmd = "ovn-nbctl dhcp-options-get-options `ovn-nbctl show %s|grep dhcp|awk -F\"-\" '{print $3\"-\"$4\"-\"$5\"-\"$6\"-\"$7}'`|grep -E 'mtu|dns'|sed ':a;N;s/\n/\t/;ba;'" % (nid,)
dns_list = [row.get("dns") for row in rows]
re_mtu = 0
re_dns_list = []
username = "root"
password = "user@dev"
ip = "172.16.130.254"
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(30, False):
while 1:
time.sleep(0.2)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
tp_str = ret.split()
for i in tp_str:
if "mtu" in i:
re_mtu = int(i.split("=")[1])
elif "dns" in i:
if "," in i:
re_dns_list = i[12:-1].split(",")
else:
re_dns_list.append(i.split("=")[1])
assert int(mtu) == re_mtu
assert dns_addr in re_dns_list
flag_2 = True
for dns in dns_list:
if dns not in re_dns_list:
flag_2 = False
break
if flag_2:
flag = True
break
assert flag
def check_vpc_network_add_ok(response):
id = response.json().get("id")
assert id
cmd = "kubectl get vmn|grep {0}|wc -l".format(id,)
username = "root"
password = "user@dev"
ip = "172.16.130.254"
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(40, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if 1 == int(ret):
flag = True
break
assert flag
def check_vpc_router_stop_or_start(response):
id = response.json().get("id")
cmd = "kubectl get vm|grep {0}|grep -i shut|wc -l".format(id, )
username = "root"
password = "user@dev"
ip = "172.16.130.254"
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(100, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if 1 == int(ret):
flag = True
break
assert flag
def check_setConsolePasswd_ok(response, hostip, passwd=None):
id = response.json().get("id")
if passwd:
cmd = 'cat /tmp/%s.xml |grep passwd|awk -F"passwd=" \'{print $2}\'|cut -d"\"" -f2' % (id,)
else:
cmd = 'cat /tmp/%s.xml |grep passwd|wc -l' % (id,)
username = "root"
password = "user@dev"
ip = hostip
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(30, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if passwd:
if ret == str(passwd):
flag = True
break
else:
if not int(ret):
flag = True
break
assert flag
def check_modifyCpuNum_ok(response, hostip, cpunum):
id = response.json().get("id")
cmd = "virsh vcpucount %s|grep current|grep live|awk '{print $3}'" % (id,)
username = "root"
password = "user@dev"
ip = hostip
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(30, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret) == int(cpunum):
flag = True
break
assert flag
def check_modifyVpcMem_ok(response, memory, hostip):
id = response.json().get("id")
cmd = "virsh dominfo %s|grep 'Used mem'|awk '{print $3}'" % (id,)
username = "root"
password = "user@dev"
ip = hostip
flag = False
eventlet.monkey_patch()
with eventlet.Timeout(30, False):
while 1:
time.sleep(0.5)
ret = sshClient.tunction(ip=ip, username=username, password=password, cmd=cmd)
if int(ret)/(1024*1024) == int(memory):
flag = True
break
assert flag | 31.8917 | 180 | 0.564061 | 3,941 | 31,509 | 4.414108 | 0.087795 | 0.027593 | 0.029892 | 0.046907 | 0.731203 | 0.701828 | 0.677914 | 0.64716 | 0.613474 | 0.590998 | 0 | 0.03671 | 0.306643 | 31,509 | 988 | 181 | 31.8917 | 0.759555 | 0.034339 | 0 | 0.71734 | 0 | 0.008314 | 0.13539 | 0.007406 | 0 | 0 | 0 | 0 | 0.110451 | 1 | 0.074822 | false | 0.090261 | 0.009501 | 0 | 0.085511 | 0.028504 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
a73018c4b01cc941e04ea8bb39a52a6d8c243fb6 | 10,631 | py | Python | IRIS_data_download/IRIS_download_support/obspy/core/tests/test_util_attribdict.py | earthinversion/Fnet_IRIS_data_automated_download | 09a6e0c992662feac95744935e038d1c68539fa1 | [
"MIT"
] | 2 | 2020-03-05T01:03:01.000Z | 2020-12-17T05:04:07.000Z | IRIS_data_download/IRIS_download_support/obspy/core/tests/test_util_attribdict.py | earthinversion/Fnet_IRIS_data_automated_download | 09a6e0c992662feac95744935e038d1c68539fa1 | [
"MIT"
] | 4 | 2021-03-31T19:25:55.000Z | 2021-12-13T20:32:46.000Z | IRIS_data_download/IRIS_download_support/obspy/core/tests/test_util_attribdict.py | earthinversion/Fnet_IRIS_data_automated_download | 09a6e0c992662feac95744935e038d1c68539fa1 | [
"MIT"
] | 2 | 2020-09-08T19:33:40.000Z | 2021-04-05T09:47:50.000Z | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from future.builtins import * # NOQA @UnusedWildImport
import unittest
from obspy.core import AttribDict
class AttribDictTestCase(unittest.TestCase):
"""
Test suite for obspy.core.util.attribdict
"""
def test_pop(self):
"""
Tests pop method of AttribDict class.
"""
ad = AttribDict()
ad.test = 1
ad['test2'] = 'test'
# removing via pop
temp = ad.pop('test')
self.assertEqual(temp, 1)
self.assertFalse('test' in ad)
self.assertIn('test2', ad)
self.assertFalse('test' in ad.__dict__)
self.assertIn('test2', ad.__dict__)
self.assertFalse(hasattr(ad, 'test'))
self.assertTrue(hasattr(ad, 'test2'))
# using pop() for not existing element raises a KeyError
self.assertRaises(KeyError, ad.pop, 'test')
def test_popitem(self):
"""
Tests pop method of AttribDict class.
"""
ad = AttribDict()
ad['test2'] = 'test'
# removing via popitem
temp = ad.popitem()
self.assertEqual(temp, ('test2', 'test'))
self.assertFalse('test2' in ad)
self.assertFalse('test2' in ad.__dict__)
self.assertFalse(hasattr(ad, 'test2'))
# popitem for empty AttribDict raises a KeyError
self.assertRaises(KeyError, ad.popitem)
def test_delete(self):
"""
Tests delete method of AttribDict class.
"""
ad = AttribDict()
ad.test = 1
ad['test2'] = 'test'
# deleting test using dictionary
del ad['test']
self.assertFalse('test' in ad)
self.assertIn('test2', ad)
self.assertFalse('test' in ad.__dict__)
self.assertIn('test2', ad.__dict__)
self.assertFalse(hasattr(ad, 'test'))
self.assertTrue(hasattr(ad, 'test2'))
# deleting test2 using attribute
del ad.test2
self.assertFalse('test2' in ad)
self.assertFalse('test2' in ad.__dict__)
self.assertFalse(hasattr(ad, 'test2'))
def test_init(self):
"""
Tests initialization of AttribDict class.
"""
ad = AttribDict({'test': 'NEW'})
self.assertEqual(ad['test'], 'NEW')
self.assertEqual(ad.test, 'NEW')
self.assertEqual(ad.get('test'), 'NEW')
self.assertEqual(ad.__getattr__('test'), 'NEW')
self.assertEqual(ad.__getitem__('test'), 'NEW')
self.assertEqual(ad.__dict__['test'], 'NEW')
self.assertEqual(ad.__dict__.get('test'), 'NEW')
self.assertIn('test', ad)
self.assertIn('test', ad.__dict__)
def test_setitem(self):
"""
Tests __setitem__ method of AttribDict class.
"""
# 1
ad = AttribDict()
ad['test'] = 'NEW'
self.assertEqual(ad['test'], 'NEW')
self.assertEqual(ad.test, 'NEW')
self.assertEqual(ad.get('test'), 'NEW')
self.assertEqual(ad.__getattr__('test'), 'NEW')
self.assertEqual(ad.__getitem__('test'), 'NEW')
self.assertEqual(ad.__dict__['test'], 'NEW')
self.assertEqual(ad.__dict__.get('test'), 'NEW')
self.assertIn('test', ad)
self.assertIn('test', ad.__dict__)
# 2
ad = AttribDict()
ad.__setitem__('test', 'NEW')
self.assertEqual(ad['test'], 'NEW')
self.assertEqual(ad.test, 'NEW')
self.assertEqual(ad.get('test'), 'NEW')
self.assertEqual(ad.__getattr__('test'), 'NEW')
self.assertEqual(ad.__getitem__('test'), 'NEW')
self.assertEqual(ad.__dict__['test'], 'NEW')
self.assertEqual(ad.__dict__.get('test'), 'NEW')
self.assertIn('test', ad)
self.assertIn('test', ad.__dict__)
def test_setattr(self):
"""
Tests __setattr__ method of AttribDict class.
"""
# 1
ad = AttribDict()
ad.test = 'NEW'
self.assertEqual(ad['test'], 'NEW')
self.assertEqual(ad.test, 'NEW')
self.assertEqual(ad.get('test'), 'NEW')
self.assertEqual(ad.__getattr__('test'), 'NEW')
self.assertEqual(ad.__getitem__('test'), 'NEW')
self.assertEqual(ad.__dict__['test'], 'NEW')
self.assertEqual(ad.__dict__.get('test'), 'NEW')
self.assertIn('test', ad)
self.assertIn('test', ad.__dict__)
# 2
ad = AttribDict()
ad.__setattr__('test', 'NEW')
self.assertEqual(ad['test'], 'NEW')
self.assertEqual(ad.test, 'NEW')
self.assertEqual(ad.get('test'), 'NEW')
self.assertEqual(ad.__getattr__('test'), 'NEW')
self.assertEqual(ad.__getitem__('test'), 'NEW')
self.assertEqual(ad.__dict__['test'], 'NEW')
self.assertEqual(ad.__dict__.get('test'), 'NEW')
self.assertIn('test', ad)
self.assertIn('test', ad.__dict__)
def test_setdefault(self):
"""
Tests setdefault method of AttribDict class.
"""
ad = AttribDict()
# 1
default = ad.setdefault('test', 'NEW')
self.assertEqual(default, 'NEW')
self.assertEqual(ad['test'], 'NEW')
self.assertEqual(ad.test, 'NEW')
self.assertEqual(ad.get('test'), 'NEW')
self.assertEqual(ad.__getattr__('test'), 'NEW')
self.assertEqual(ad.__getitem__('test'), 'NEW')
self.assertEqual(ad.__dict__['test'], 'NEW')
self.assertEqual(ad.__dict__.get('test'), 'NEW')
self.assertIn('test', ad)
self.assertIn('test', ad.__dict__)
# 2 - existing key should not be overwritten
default = ad.setdefault('test', 'SOMETHINGDIFFERENT')
self.assertEqual(default, 'NEW')
self.assertEqual(ad['test'], 'NEW')
self.assertEqual(ad.test, 'NEW')
self.assertEqual(ad.get('test'), 'NEW')
self.assertEqual(ad.__getattr__('test'), 'NEW')
self.assertEqual(ad.__getitem__('test'), 'NEW')
self.assertEqual(ad.__dict__['test'], 'NEW')
self.assertEqual(ad.__dict__.get('test'), 'NEW')
self.assertIn('test', ad)
self.assertIn('test', ad.__dict__)
# 3 - default value isNone
ad = AttribDict()
default = ad.setdefault('test')
self.assertEqual(default, None)
self.assertEqual(ad['test'], None)
self.assertEqual(ad.test, None)
self.assertEqual(ad.get('test'), None)
self.assertEqual(ad.__getattr__('test'), None)
self.assertEqual(ad.__getitem__('test'), None)
self.assertEqual(ad.__dict__['test'], None)
self.assertEqual(ad.__dict__.get('test'), None)
self.assertIn('test', ad)
self.assertIn('test', ad.__dict__)
def test_clear(self):
"""
Tests clear method of AttribDict class.
"""
ad = AttribDict()
ad.test = 1
ad['test2'] = 'test'
# removing via pop
ad.clear()
self.assertFalse('test' in ad)
self.assertFalse('test2' in ad)
self.assertFalse('test' in ad.__dict__)
self.assertFalse('test2' in ad.__dict__)
self.assertFalse(hasattr(ad, 'test'))
self.assertFalse(hasattr(ad, 'test2'))
# class attributes should be still present
self.assertTrue(hasattr(ad, 'readonly'))
self.assertTrue(hasattr(ad, 'defaults'))
def test_init_argument(self):
"""
Tests initialization of AttribDict with various arguments.
"""
# one dict works as expected
ad = AttribDict({'test': 1})
self.assertEqual(ad.test, 1)
# multiple dicts results into TypeError
self.assertRaises(TypeError, AttribDict, {}, {})
self.assertRaises(TypeError, AttribDict, {}, {}, blah=1)
# non-dicts results into TypeError
self.assertRaises(TypeError, AttribDict, 1)
self.assertRaises(TypeError, AttribDict, object())
def test_defaults(self):
"""
Tests default of __getitem__/__getattr__ methods of AttribDict class.
"""
# 1
ad = AttribDict()
ad['test'] = 'NEW'
self.assertEqual(ad.__getitem__('test'), 'NEW')
self.assertEqual(ad.__getitem__('xxx', 'blub'), 'blub')
self.assertEqual(ad.__getitem__('test', 'blub'), 'NEW')
self.assertEqual(ad.__getattr__('test'), 'NEW')
self.assertEqual(ad.__getattr__('xxx', 'blub'), 'blub')
self.assertEqual(ad.__getattr__('test', 'blub'), 'NEW')
# should raise KeyError without default item
self.assertRaises(KeyError, ad.__getitem__, 'xxx')
self.assertRaises(AttributeError, ad.__getattr__, 'xxx')
# 2
ad2 = AttribDict(defaults={'test2': 'NEW'})
self.assertEqual(ad2.__getitem__('test2'), 'NEW')
self.assertRaises(KeyError, ad2.__getitem__, 'xxx')
def test_set_readonly(self):
"""
Tests of setting readonly attributes.
"""
class MyAttribDict(AttribDict):
readonly = ['test']
defaults = {'test': 1}
ad = MyAttribDict()
self.assertEqual(ad.test, 1)
self.assertRaises(AttributeError, ad.__setitem__, 'test', 1)
def test_deepcopy(self):
"""
Tests __deepcopy__ method of AttribDict.
"""
class MyAttribDict(AttribDict):
defaults = {'test': 1}
ad = MyAttribDict()
ad.muh = 2
ad2 = ad.__deepcopy__()
self.assertEqual(ad2.test, 1)
self.assertEqual(ad2.muh, 2)
def test_compare_with_dict(self):
"""
Checks if AttribDict is still comparable to a dict object.
"""
adict = {'test': 1}
ad = AttribDict(adict)
self.assertEqual(ad, adict)
self.assertEqual(adict, ad)
def test_pretty_str(self):
"""
Test _pretty_str method of AttribDict.
"""
# 1
ad = AttribDict({'test1': 1, 'test2': 2})
out = ' test1: 1\n test2: 2'
self.assertEqual(ad._pretty_str(), out)
# 2
ad = AttribDict({'test1': 1, 'test2': 2})
out = ' test2: 2\n test1: 1'
self.assertEqual(ad._pretty_str(priorized_keys=['test2']), out)
# 3
ad = AttribDict({'test1': 1, 'test2': 2})
out = ' test1: 1\n test2: 2'
self.assertEqual(ad._pretty_str(min_label_length=6), out)
def suite():
return unittest.makeSuite(AttribDictTestCase, 'test')
if __name__ == '__main__':
unittest.main(defaultTest='suite')
| 35.555184 | 77 | 0.577462 | 1,160 | 10,631 | 5.022414 | 0.118966 | 0.198249 | 0.198421 | 0.181943 | 0.658599 | 0.599382 | 0.566941 | 0.543769 | 0.516821 | 0.504634 | 0 | 0.010993 | 0.272693 | 10,631 | 298 | 78 | 35.674497 | 0.742499 | 0.114571 | 0 | 0.617647 | 0 | 0 | 0.101989 | 0 | 0 | 0 | 0 | 0 | 0.632353 | 1 | 0.073529 | false | 0 | 0.019608 | 0.004902 | 0.112745 | 0.004902 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a739e22b895dd7f5b68d4cbbe585f6f9e1e16131 | 305 | py | Python | docker_sdk_api/domain/services/contracts/abstract_dataset_validator_service.py | BMW-InnovationLab/BMW-Semantic-Segmentation-Training-GUI | 902f35a7e367e635898f687b16a830db892fbaa5 | [
"Apache-2.0"
] | 20 | 2021-07-13T13:08:57.000Z | 2022-03-29T09:38:00.000Z | docker_sdk_api/domain/services/contracts/abstract_dataset_validator_service.py | BMW-InnovationLab/BMW-Semantic-Segmentation-Training-GUI | 902f35a7e367e635898f687b16a830db892fbaa5 | [
"Apache-2.0"
] | null | null | null | docker_sdk_api/domain/services/contracts/abstract_dataset_validator_service.py | BMW-InnovationLab/BMW-Semantic-Segmentation-Training-GUI | 902f35a7e367e635898f687b16a830db892fbaa5 | [
"Apache-2.0"
] | 2 | 2021-07-12T08:42:53.000Z | 2022-03-04T18:41:25.000Z | from abc import ABC, ABCMeta, abstractmethod
from domain.models.datase_information import DatasetInformation
class AbstractDatasetValidatorService(ABC):
__metaclass__ = ABCMeta
@abstractmethod
def validate_dataset(self, dataset_info: DatasetInformation) -> None: raise NotImplementedError
| 27.727273 | 99 | 0.816393 | 29 | 305 | 8.344828 | 0.724138 | 0.173554 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131148 | 305 | 10 | 100 | 30.5 | 0.913208 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.833333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
5955db7626231d3711353993b2796474b288c67c | 169 | py | Python | tests/collaboration/factories.py | cad106uk/market-access-api | a357c33bbec93408b193e598a5628634126e9e99 | [
"MIT"
] | null | null | null | tests/collaboration/factories.py | cad106uk/market-access-api | a357c33bbec93408b193e598a5628634126e9e99 | [
"MIT"
] | 51 | 2018-05-31T12:16:31.000Z | 2022-03-08T09:36:48.000Z | tests/collaboration/factories.py | cad106uk/market-access-api | a357c33bbec93408b193e598a5628634126e9e99 | [
"MIT"
] | 2 | 2019-12-24T09:47:42.000Z | 2021-02-09T09:36:51.000Z | import factory
from api.collaboration.models import TeamMember
class TeamMemberFactory(factory.django.DjangoModelFactory):
class Meta:
model = TeamMember
| 18.777778 | 59 | 0.781065 | 17 | 169 | 7.764706 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16568 | 169 | 8 | 60 | 21.125 | 0.93617 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
597101821b26dde66f369e5d6c9ba4029fcb1428 | 140 | py | Python | util/emojis.py | Lithimlin/TeaWaiter | fef8d6ef19b8bd10fcd48a2bb320f6cda3ac7156 | [
"MIT"
] | null | null | null | util/emojis.py | Lithimlin/TeaWaiter | fef8d6ef19b8bd10fcd48a2bb320f6cda3ac7156 | [
"MIT"
] | null | null | null | util/emojis.py | Lithimlin/TeaWaiter | fef8d6ef19b8bd10fcd48a2bb320f6cda3ac7156 | [
"MIT"
] | null | null | null | statusEmojis = {'yes':'✅', 'no':'❌'}
numEmojis = {1:'1️⃣', 2:'2️⃣', 3:'3️⃣', 4:'4️⃣', 5:'5️⃣', 6:'6️⃣', 7:'7️⃣', 8:'8️⃣', 9:'9️⃣', 0:'0️⃣'}
| 46.666667 | 102 | 0.328571 | 36 | 140 | 1.888889 | 0.472222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16129 | 0.114286 | 140 | 2 | 103 | 70 | 0.209677 | 0 | 0 | 0 | 0 | 0 | 0.264286 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
597ddcf7272429172b7edee0cb03c0de356cd799 | 127 | py | Python | tests/test_main.py | skypaw/rconcrete | 30bc7e5ada2afa975caabcd38461707e094d695b | [
"MIT"
] | null | null | null | tests/test_main.py | skypaw/rconcrete | 30bc7e5ada2afa975caabcd38461707e094d695b | [
"MIT"
] | 2 | 2022-02-05T18:49:44.000Z | 2022-02-06T01:11:07.000Z | tests/test_main.py | skypaw/rconcrete | 30bc7e5ada2afa975caabcd38461707e094d695b | [
"MIT"
] | null | null | null | from src.main import sample_function
def test_addition():
test = sample_function(4)
print('test')
assert 8 == test | 21.166667 | 36 | 0.692913 | 18 | 127 | 4.722222 | 0.722222 | 0.329412 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019802 | 0.204724 | 127 | 6 | 37 | 21.166667 | 0.821782 | 0 | 0 | 0 | 0 | 0 | 0.03125 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.4 | 0.2 | 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 | 0 | 0 | 0 | 0 | 0 | 3 |
59807967b291bcc22ce0c7c760cacd407b042fe9 | 609 | py | Python | tipico_server/utils/constants.py | lbusoni/tipico_server | 390e1ad8ca6a56ac14cebc1f9c50c9cb5803e287 | [
"MIT"
] | null | null | null | tipico_server/utils/constants.py | lbusoni/tipico_server | 390e1ad8ca6a56ac14cebc1f9c50c9cb5803e287 | [
"MIT"
] | null | null | null | tipico_server/utils/constants.py | lbusoni/tipico_server | 390e1ad8ca6a56ac14cebc1f9c50c9cb5803e287 | [
"MIT"
] | null | null | null |
class Constants:
METER_2_NANOMETER= 1e9
APP_NAME= "inaf.arcetri.ao.tipico_server"
APP_AUTHOR= "INAF Arcetri Adaptive Optics"
THIS_PACKAGE= 'tipico_server'
PROCESS_MONITOR_CONFIG_SECTION= 'processMonitor'
SERVER_1_CONFIG_SECTION= 'serverOfAnInstrument'
SERVER_2_CONFIG_SECTION= 'serverOfAnotherInstrument'
# TODO: must be the same of console_scripts in setup.py
START_PROCESS_NAME= 'tipico_start'
STOP_PROCESS_NAME= 'tipico_stop'
KILL_ALL_PROCESS_NAME= 'tipico_kill_all'
SERVER_1_PROCESS_NAME= 'tipico_server_1'
SERVER_2_PROCESS_NAME= 'tipico_server_2'
| 30.45 | 59 | 0.775041 | 80 | 609 | 5.425 | 0.5125 | 0.126728 | 0.195853 | 0.105991 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017544 | 0.157635 | 609 | 19 | 60 | 32.052632 | 0.82846 | 0.087028 | 0 | 0 | 0 | 0 | 0.357532 | 0.098004 | 0 | 0 | 0 | 0.052632 | 0 | 1 | 0 | false | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
598893a66d83b9b4e168cfcddf559998286b638d | 469 | py | Python | statping/exceptions.py | danielpalstra/pystatping | eb6325229d45cd452528007b440ca545bacc3e04 | [
"Apache-2.0"
] | null | null | null | statping/exceptions.py | danielpalstra/pystatping | eb6325229d45cd452528007b440ca545bacc3e04 | [
"Apache-2.0"
] | null | null | null | statping/exceptions.py | danielpalstra/pystatping | eb6325229d45cd452528007b440ca545bacc3e04 | [
"Apache-2.0"
] | null | null | null | class BaseExceptions(Exception):
pass
class AuthException(BaseException):
"""Raised when an api method requires authentication"""
pass
class DeleteException(BaseException):
"""Raised when the delete of an object fails"""
pass
class UpsertException(BaseException):
"""Raised when the combined insert or update fails"""
pass
class NotFoundException(BaseException):
"""Raised when objects cannot be found by the API"""
pass
| 17.37037 | 59 | 0.714286 | 52 | 469 | 6.442308 | 0.576923 | 0.107463 | 0.274627 | 0.155224 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.202559 | 469 | 26 | 60 | 18.038462 | 0.895722 | 0.396588 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
599682564ad210bc55f3314403d4b2babc14038c | 578 | py | Python | tests/unit/test_runner.py | mariocj89/dothub | bcfdcc5a076e48a73c4e0827c56431522e4cc4ba | [
"MIT"
] | 12 | 2017-05-30T12:46:41.000Z | 2019-08-18T18:55:43.000Z | tests/unit/test_runner.py | mariocj89/dothub | bcfdcc5a076e48a73c4e0827c56431522e4cc4ba | [
"MIT"
] | 30 | 2017-07-10T19:28:35.000Z | 2021-11-22T11:09:25.000Z | tests/unit/test_runner.py | Mariocj89/dothub | bcfdcc5a076e48a73c4e0827c56431522e4cc4ba | [
"MIT"
] | 1 | 2017-08-02T21:04:43.000Z | 2017-08-02T21:04:43.000Z | from click.testing import CliRunner
from dothub.cli import dothub
base_args = ["--user=xxx", "--token=yyy"]
def test_dothub_help():
runner = CliRunner()
result = runner.invoke(dothub, ['--help'], obj={})
assert result.exit_code == 0
def test_dothub_pull_help():
runner = CliRunner()
result = runner.invoke(dothub, base_args + ['pull', "--help"], obj={})
assert result.exit_code == 0
def test_dothub_push_help():
runner = CliRunner()
result = runner.invoke(dothub, base_args + ['push', "--help"], obj={})
assert result.exit_code == 0
| 23.12 | 74 | 0.652249 | 75 | 578 | 4.84 | 0.346667 | 0.082645 | 0.115702 | 0.206612 | 0.702479 | 0.702479 | 0.702479 | 0.506887 | 0.506887 | 0.225895 | 0 | 0.006342 | 0.181661 | 578 | 24 | 75 | 24.083333 | 0.761099 | 0 | 0 | 0.4 | 0 | 0 | 0.081456 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.2 | false | 0 | 0.133333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
59c36cd98ae3acd086f78aaa65bd7f255f2c8c8a | 176 | py | Python | tests/test_env.py | AERX-dev/MetaBuildHackathon | 6ed437f1c60491502d04922270e88e778bd2288f | [
"MIT"
] | 4 | 2022-02-28T18:30:40.000Z | 2022-03-22T15:29:25.000Z | tests/test_env.py | AERX-dev/MetaBuildHackathon | 6ed437f1c60491502d04922270e88e778bd2288f | [
"MIT"
] | 5 | 2022-02-22T23:04:59.000Z | 2022-03-22T00:47:59.000Z | tests/test_env.py | AERX-dev/MetaBuildHackathon | 6ed437f1c60491502d04922270e88e778bd2288f | [
"MIT"
] | 2 | 2022-03-05T15:54:47.000Z | 2022-03-31T09:05:28.000Z | from brownie import ETH_ADDRESS, accounts
def test_brownie():
"""Test if the brownie module is working.
"""
acc = accounts[0]
assert type(acc.address) == str
| 19.555556 | 45 | 0.664773 | 24 | 176 | 4.791667 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007353 | 0.227273 | 176 | 8 | 46 | 22 | 0.838235 | 0.215909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
59e4f79fb23ffe95401e5b38745cbc03d452f5e7 | 164 | py | Python | BrowniePoints/CryptoVinaigrette/__init__.py | avinashshenoy97/brownie-points | 27eb1e9a5ab685e72a5b701c0f76af44d9700960 | [
"MIT"
] | 1 | 2020-11-25T12:14:40.000Z | 2020-11-25T12:14:40.000Z | BrowniePoints/CryptoVinaigrette/__init__.py | avinashshenoy97/brownie-points | 27eb1e9a5ab685e72a5b701c0f76af44d9700960 | [
"MIT"
] | null | null | null | BrowniePoints/CryptoVinaigrette/__init__.py | avinashshenoy97/brownie-points | 27eb1e9a5ab685e72a5b701c0f76af44d9700960 | [
"MIT"
] | null | null | null | import sys
import os
__all__ = []
__version__ = '0.0.1'
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '.' + '/CryptoVinaigrette'))) | 18.222222 | 104 | 0.689024 | 24 | 164 | 4.208333 | 0.583333 | 0.178218 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027397 | 0.109756 | 164 | 9 | 104 | 18.222222 | 0.664384 | 0 | 0 | 0 | 0 | 0 | 0.145455 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
ab69ddad29bf626715a76cc7655a097259dcb155 | 105 | py | Python | src/clc/APIv1/cli.py | alex-kebede/clc-python-sdk | 7a2a3e57010d238ce3fc2eeeea430e6ddb0c8ae4 | [
"Apache-2.0"
] | 18 | 2015-01-20T18:32:12.000Z | 2018-09-10T16:19:00.000Z | src/clc/APIv1/cli.py | alex-kebede/clc-python-sdk | 7a2a3e57010d238ce3fc2eeeea430e6ddb0c8ae4 | [
"Apache-2.0"
] | 27 | 2015-03-16T19:11:35.000Z | 2020-05-12T17:44:22.000Z | src/clc/APIv1/cli.py | alex-kebede/clc-python-sdk | 7a2a3e57010d238ce3fc2eeeea430e6ddb0c8ae4 | [
"Apache-2.0"
] | 37 | 2015-01-13T00:12:05.000Z | 2020-05-18T21:18:23.000Z | """CLI console script entry point."""
import clc
def main():
clc.v1.Args()
clc.v1.ExecCommand()
| 8.076923 | 37 | 0.638095 | 15 | 105 | 4.466667 | 0.8 | 0.149254 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023529 | 0.190476 | 105 | 12 | 38 | 8.75 | 0.764706 | 0.295238 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | true | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ab82a8f559d650e37cf26796bb3ed2a20df28833 | 150 | py | Python | src/setting.py | yusan123/flasklearn_UserManagement | 857c748f5363e9b3e3a0c0364eac5aa711aa0150 | [
"Apache-2.0"
] | 1 | 2019-04-25T00:53:22.000Z | 2019-04-25T00:53:22.000Z | src/setting.py | yusan123/flasklearn_UserManagement | 857c748f5363e9b3e3a0c0364eac5aa711aa0150 | [
"Apache-2.0"
] | null | null | null | src/setting.py | yusan123/flasklearn_UserManagement | 857c748f5363e9b3e3a0c0364eac5aa711aa0150 | [
"Apache-2.0"
] | null | null | null | # _*_coding:utf-8_*_
# author:qq823947488
# date:2019/4/24 20:12
host='localhost'
port=3306
user='root'
passwd='123'
db='flask_learn'
charset='utf8'
| 13.636364 | 22 | 0.72 | 24 | 150 | 4.291667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.213235 | 0.093333 | 150 | 10 | 23 | 15 | 0.544118 | 0.386667 | 0 | 0 | 0 | 0 | 0.352273 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.166667 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
ab889732980e1f587bb34b0e8ec82b6a14ab0b7b | 94 | py | Python | core/dbs/__init__.py | ybai62868/CornerNet-Lite | cad0fb248be1da38451042ff6c5b9979e67a0729 | [
"BSD-3-Clause"
] | 2 | 2019-12-10T02:11:32.000Z | 2019-12-13T14:26:14.000Z | core/dbs/__init__.py | ybai62868/CornerNet-Lite | cad0fb248be1da38451042ff6c5b9979e67a0729 | [
"BSD-3-Clause"
] | null | null | null | core/dbs/__init__.py | ybai62868/CornerNet-Lite | cad0fb248be1da38451042ff6c5b9979e67a0729 | [
"BSD-3-Clause"
] | null | null | null | from .coco import COCO
from .dac import DAC
datasets = {
"COCO": COCO,
"DAC": DAC
}
| 10.444444 | 22 | 0.595745 | 13 | 94 | 4.307692 | 0.384615 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.276596 | 94 | 8 | 23 | 11.75 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0.075269 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
aba36294bade63b92b2258cf8156dbcd7056f857 | 173 | py | Python | server/users/urls.py | Egor4ik325/chaticket | 023fb2c533268b020b01f1580404ae30af1b231a | [
"MIT"
] | null | null | null | server/users/urls.py | Egor4ik325/chaticket | 023fb2c533268b020b01f1580404ae30af1b231a | [
"MIT"
] | 1 | 2021-09-25T20:53:22.000Z | 2021-09-25T20:53:22.000Z | server/users/urls.py | Egor4ik325/chaticket | 023fb2c533268b020b01f1580404ae30af1b231a | [
"MIT"
] | null | null | null |
from rest_framework.routers import DefaultRouter
from .views import UserViewSet
router = DefaultRouter()
router.register('users', UserViewSet)
urlpatterns = router.urls
| 17.3 | 48 | 0.809249 | 19 | 173 | 7.315789 | 0.684211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115607 | 173 | 9 | 49 | 19.222222 | 0.908497 | 0 | 0 | 0 | 0 | 0 | 0.02907 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
f9ee55d442bf6d3dde7fbd268f409bf967f59adc | 163 | py | Python | Dataset/Leetcode/train/125/374.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/125/374.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/125/374.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | class Solution:
'''第九题'''
def XXX(self, s: str) -> bool:
s = ''.join([i.lower() for i in s if i.strip().isalnum()])
return s == s[::-1]
| 20.375 | 66 | 0.466258 | 25 | 163 | 3.04 | 0.76 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008772 | 0.300614 | 163 | 7 | 67 | 23.285714 | 0.657895 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e6067b473594f19a0b7c388916cf26a23f82d960 | 579 | py | Python | thirdparty/org/apache/arrow/flatbuf/VectorType.py | mrocklin/pygdf | 2de9407427da9497ebdf8951a12857be0fab31bb | [
"Apache-2.0"
] | 5 | 2018-10-17T20:28:42.000Z | 2022-02-15T17:33:01.000Z | thirdparty/org/apache/arrow/flatbuf/VectorType.py | mrocklin/pygdf | 2de9407427da9497ebdf8951a12857be0fab31bb | [
"Apache-2.0"
] | 19 | 2018-07-18T07:15:44.000Z | 2021-02-22T17:00:18.000Z | thirdparty/org/apache/arrow/flatbuf/VectorType.py | mrocklin/pygdf | 2de9407427da9497ebdf8951a12857be0fab31bb | [
"Apache-2.0"
] | 2 | 2020-05-01T09:54:34.000Z | 2021-04-17T10:57:07.000Z | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: flatbuf
# /// ----------------------------------------------------------------------
# /// The possible types of a vector
class VectorType(object):
# /// used in List type, Dense Union and variable length primitive types (String, Binary)
OFFSET = 0
# /// actual data, either wixed width primitive types in slots or variable width delimited by an OFFSET vector
DATA = 1
# /// Bit vector indicating if each value is null
VALIDITY = 2
# /// Type vector used in Union type
TYPE = 3
| 34.058824 | 110 | 0.621762 | 72 | 579 | 5 | 0.736111 | 0.033333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008511 | 0.188256 | 579 | 16 | 111 | 36.1875 | 0.757447 | 0.82038 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
e6129fa4f147cc4a7f5689db1f136f1e4febaef9 | 399 | py | Python | observatory/views/side.py | spookey/observatory | be5cc92f53f12e6341e7e3040f26360e54cfdf7d | [
"MIT"
] | null | null | null | observatory/views/side.py | spookey/observatory | be5cc92f53f12e6341e7e3040f26360e54cfdf7d | [
"MIT"
] | 1 | 2020-03-28T09:51:56.000Z | 2020-03-28T09:51:56.000Z | observatory/views/side.py | spookey/dz_stats_page | be5cc92f53f12e6341e7e3040f26360e54cfdf7d | [
"MIT"
] | null | null | null | from flask import Blueprint, current_app, send_from_directory
BLUEPRINT_SIDE = Blueprint('side', __name__)
@BLUEPRINT_SIDE.route('/logo.png', endpoint='logo')
@BLUEPRINT_SIDE.route('/favicon.ico')
@BLUEPRINT_SIDE.route('/favicon.png')
def favicon():
return send_from_directory(
current_app.static_folder,
current_app.config.get('FAVICON'),
mimetype='image/png',
)
| 26.6 | 61 | 0.719298 | 49 | 399 | 5.530612 | 0.489796 | 0.239852 | 0.199262 | 0.184502 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 399 | 14 | 62 | 28.5 | 0.792398 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.090909 | 0.090909 | 0.272727 | 0.181818 | 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 | 0 | 0 | 3 |
e62e88ca85209412b46b34f3a3135f7a89043c82 | 183 | py | Python | examples/sandbox/sandbox/__main__.py | salt-die/nurses_2 | 29b76c34b9a28bf7c115998f4e81979966c82df0 | [
"MIT"
] | 171 | 2021-06-23T15:29:15.000Z | 2022-03-25T18:53:10.000Z | examples/sandbox/sandbox/__main__.py | salt-die/nurses_2 | 29b76c34b9a28bf7c115998f4e81979966c82df0 | [
"MIT"
] | 1 | 2022-01-07T05:08:35.000Z | 2022-01-10T04:53:57.000Z | examples/sandbox/sandbox/__main__.py | salt-die/nurses_2 | 29b76c34b9a28bf7c115998f4e81979966c82df0 | [
"MIT"
] | 3 | 2021-10-01T09:12:15.000Z | 2022-01-14T21:31:11.000Z | from nurses_2.app import App
from .sandbox import Sandbox
class SandboxApp(App):
async def on_start(self):
self.add_widget(Sandbox(size=(31, 100)))
SandboxApp().run()
| 16.636364 | 48 | 0.704918 | 27 | 183 | 4.666667 | 0.703704 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039735 | 0.174863 | 183 | 10 | 49 | 18.3 | 0.794702 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e6329473dcae584a805afb6f3b7a11b77f6eec4b | 130 | py | Python | src/app/groups/apps.py | serious-notreally/cappa | 993a8df35ca6c3b22f3ca811937fd29c07fc71aa | [
"MIT"
] | 9 | 2020-04-05T07:35:55.000Z | 2021-08-03T05:50:05.000Z | src/app/groups/apps.py | serious-notreally/cappa | 993a8df35ca6c3b22f3ca811937fd29c07fc71aa | [
"MIT"
] | 89 | 2020-01-26T11:50:06.000Z | 2022-03-31T07:14:18.000Z | src/app/groups/apps.py | serious-notreally/cappa | 993a8df35ca6c3b22f3ca811937fd29c07fc71aa | [
"MIT"
] | 13 | 2020-03-10T14:45:07.000Z | 2021-07-31T02:43:40.000Z | from django.apps import AppConfig
class GroupsAppConfig(AppConfig):
name = 'app.groups'
verbose_name = "Учебные группы"
| 18.571429 | 35 | 0.738462 | 15 | 130 | 6.333333 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176923 | 130 | 6 | 36 | 21.666667 | 0.88785 | 0 | 0 | 0 | 0 | 0 | 0.184615 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 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 | 0 | 0 | 1 | 0 | 0 | 3 |
e6546737a433ea44c0aabf656ba019b30d17d227 | 1,033 | py | Python | tests/test_service.py | beepscore/pi_gpio_service | 47aa9c6e4e378a168320d1f42b6d4c18c998e4db | [
"MIT"
] | 2 | 2018-10-16T18:22:04.000Z | 2021-05-04T21:09:53.000Z | tests/test_service.py | beepscore/pi_gpio_service | 47aa9c6e4e378a168320d1f42b6d4c18c998e4db | [
"MIT"
] | null | null | null | tests/test_service.py | beepscore/pi_gpio_service | 47aa9c6e4e378a168320d1f42b6d4c18c998e4db | [
"MIT"
] | null | null | null | #!/usr/bin/env/python3
import unittest
from pi_gpio_service import service
class TestPiGpioService(unittest.TestCase):
def test_input_pins(self):
pins = {
'23': {'name': 'IN_23', 'pin_direction': 'input'},
'24': {'name': 'OUT_24', 'pin_direction': 'output'},
'25': {'name': 'OUT_25', 'pin_direction': 'output'}
}
# call method under test
self.assertEqual(service.input_pins(pins),
{'23': {'name': 'IN_23', 'pin_direction': 'input'}})
def test_output_pins(self):
pins = {
'23': {'name': 'IN_23', 'pin_direction': 'input'},
'24': {'name': 'OUT_24', 'pin_direction': 'output'},
'25': {'name': 'OUT_25', 'pin_direction': 'output'}
}
expected = {'24': {'name': 'OUT_24', 'pin_direction': 'output'},
'25': {'name': 'OUT_25', 'pin_direction': 'output'}}
# call method under test
self.assertEqual(service.output_pins(pins), expected)
| 30.382353 | 77 | 0.535334 | 113 | 1,033 | 4.663717 | 0.283186 | 0.204934 | 0.204934 | 0.068311 | 0.6926 | 0.6926 | 0.6926 | 0.6926 | 0.633776 | 0.633776 | 0 | 0.049664 | 0.2788 | 1,033 | 33 | 78 | 31.30303 | 0.657718 | 0.06486 | 0 | 0.4 | 0 | 0 | 0.283489 | 0 | 0 | 0 | 0 | 0 | 0.1 | 1 | 0.1 | false | 0 | 0.1 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e65fe6b2cc9e13aae056f4e22435bebdff299fe1 | 1,148 | py | Python | tests/test_app.py | betasewer/machaon | 63ccb4405ac693f14f9d25f6a706466a917dddbf | [
"MIT"
] | 2 | 2020-07-05T08:39:12.000Z | 2022-01-19T22:08:21.000Z | tests/test_app.py | betasewer/machaon | 63ccb4405ac693f14f9d25f6a706466a917dddbf | [
"MIT"
] | 23 | 2020-06-23T16:18:17.000Z | 2021-12-29T09:56:48.000Z | tests/test_app.py | betasewer/machaon | 63ccb4405ac693f14f9d25f6a706466a917dddbf | [
"MIT"
] | null | null | null | from machaon.app import AppRoot, deploy_directory, transfer_deployed_directory
from machaon.process import Spirit, TempSpirit
from machaon.types.shell import Path
def test_deploy(tmpdir):
deploydir = tmpdir.mkdir("deploy")
deploy_directory(Path(deploydir))
assert deploydir.join("machaon").check()
assert deploydir.join("machaon", "store").check()
assert deploydir.join("machaon", "packages").check()
assert deploydir.join("machaon", "credential").check()
assert deploydir.join("machaon", "credential", "credential.ini").check()
assert deploydir.join("machaon", "local").check()
assert deploydir.join("machaon", "apps.ini").check()
assert deploydir.join("main.py").check()
deploydir2 = tmpdir.mkdir("deploy2")
spi = TempSpirit()
transfer_deployed_directory(spi, Path(deploydir.join("machaon")), Path(deploydir2))
assert deploydir2.join("machaon").check()
assert deploydir2.join("machaon", "apps.ini").check()
assert deploydir2.join("machaon", "credential", "credential.ini").check()
assert deploydir2.join("main.py").check()
assert not deploydir.join("machaon").check()
| 39.586207 | 87 | 0.715157 | 132 | 1,148 | 6.166667 | 0.265152 | 0.162162 | 0.22113 | 0.223587 | 0.453317 | 0.256757 | 0.110565 | 0 | 0 | 0 | 0 | 0.006979 | 0.126307 | 1,148 | 28 | 88 | 41 | 0.804586 | 0 | 0 | 0 | 0 | 0 | 0.176829 | 0 | 0 | 0 | 0 | 0 | 0.590909 | 1 | 0.045455 | false | 0 | 0.136364 | 0 | 0.181818 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e66034257961b772951c35834b998bf6cf78de31 | 74 | py | Python | 02 Algorithm Reference/06 Securities and Portfolio/01 Securities and Portfolio Classes/03 code.py | Jay-Jay-D/Documentation | c4894e5ac20355ec82ee0db19618ad7f17bf8592 | [
"Apache-2.0"
] | null | null | null | 02 Algorithm Reference/06 Securities and Portfolio/01 Securities and Portfolio Classes/03 code.py | Jay-Jay-D/Documentation | c4894e5ac20355ec82ee0db19618ad7f17bf8592 | [
"Apache-2.0"
] | null | null | null | 02 Algorithm Reference/06 Securities and Portfolio/01 Securities and Portfolio Classes/03 code.py | Jay-Jay-D/Documentation | c4894e5ac20355ec82ee0db19618ad7f17bf8592 | [
"Apache-2.0"
] | null | null | null | #Securities array access to Security Objects:
self.Securities["IBM"].Price | 37 | 45 | 0.810811 | 10 | 74 | 6 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.081081 | 74 | 2 | 46 | 37 | 0.882353 | 0.594595 | 0 | 0 | 0 | 0 | 0.1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 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 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0513d4822718f78bada1c9c056ce41bfe1fb2ffe | 472 | py | Python | rest_framework_tracking/mixins.py | Zagrebelin/drf-tracking | 5fe102439e7baaffc886253e39c21dd96481391f | [
"ISC"
] | 387 | 2015-05-26T08:23:52.000Z | 2022-03-18T11:10:44.000Z | rest_framework_tracking/mixins.py | Zagrebelin/drf-tracking | 5fe102439e7baaffc886253e39c21dd96481391f | [
"ISC"
] | 138 | 2015-05-26T16:20:25.000Z | 2021-09-22T18:07:24.000Z | rest_framework_tracking/mixins.py | Zagrebelin/drf-tracking | 5fe102439e7baaffc886253e39c21dd96481391f | [
"ISC"
] | 121 | 2015-09-25T16:53:48.000Z | 2021-08-18T12:42:04.000Z | from .base_mixins import BaseLoggingMixin
from .models import APIRequestLog
class LoggingMixin(BaseLoggingMixin):
def handle_log(self):
"""
Hook to define what happens with the log.
Defaults on saving the data on the db.
"""
APIRequestLog(**self.log).save()
class LoggingErrorsMixin(LoggingMixin):
"""
Log only errors
"""
def should_log(self, request, response):
return response.status_code >= 400
| 21.454545 | 49 | 0.658898 | 53 | 472 | 5.792453 | 0.679245 | 0.045603 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008523 | 0.254237 | 472 | 21 | 50 | 22.47619 | 0.863636 | 0.205508 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.125 | 0.875 | 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 | 0 | 1 | 1 | 0 | 0 | 3 |
0531675b4efb814c0c0505cc13c93cd557315404 | 1,310 | py | Python | grr/server/grr_response_server/blob_stores/db_blob_store.py | oueldz4/grr | 8c60d9198cc0875a8ea80b90237eb0a8272082ff | [
"Apache-2.0"
] | null | null | null | grr/server/grr_response_server/blob_stores/db_blob_store.py | oueldz4/grr | 8c60d9198cc0875a8ea80b90237eb0a8272082ff | [
"Apache-2.0"
] | null | null | null | grr/server/grr_response_server/blob_stores/db_blob_store.py | oueldz4/grr | 8c60d9198cc0875a8ea80b90237eb0a8272082ff | [
"Apache-2.0"
] | 1 | 2020-07-09T01:08:48.000Z | 2020-07-09T01:08:48.000Z | #!/usr/bin/env python
"""REL_DB blobstore implementation."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from grr_response_server import blob_store
from grr_response_server import data_store
class DbBlobStore(blob_store.BlobStore):
"""A REL_DB-based blob store implementation."""
# TODO(user): REL_DB can be None, because initialization is happening at some
# early but nondeterministic time. Once REL_DB is guaranteed to be not None,
# perform type checking that REL_DB.delegate is a BlobStore..
@property
def delegate(self):
return data_store.REL_DB.delegate
def WriteBlobs(self, blob_id_data_map):
return self.delegate.WriteBlobs(blob_id_data_map)
def ReadBlobs(self, blob_ids):
return self.delegate.ReadBlobs(blob_ids)
def ReadBlob(self, blob_id):
return self.delegate.ReadBlob(blob_id)
def CheckBlobsExist(self, blob_ids):
return self.delegate.CheckBlobsExist(blob_ids)
def CheckBlobExists(self, blob_id):
return self.delegate.CheckBlobExists(blob_id)
def WriteBlobsWithUnknownHashes(self, blobs_data):
return self.delegate.WriteBlobsWithUnknownHashes(blobs_data)
def WriteBlobWithUnknownHash(self, blob_data):
return self.delegate.WriteBlobWithUnknownHash(blob_data)
| 31.190476 | 79 | 0.79084 | 175 | 1,310 | 5.657143 | 0.365714 | 0.070707 | 0.127273 | 0.042424 | 0.169697 | 0.115152 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134351 | 1,310 | 41 | 80 | 31.95122 | 0.873016 | 0.233588 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02439 | 0 | 1 | 0.347826 | false | 0 | 0.217391 | 0.347826 | 0.956522 | 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 | 0 | 0 | 0 | 3 |
055c22d5891f38a9238c8713208320ff8c57d8d5 | 185 | py | Python | bot/states/states.py | amtp1/ubi-4 | bbfa07f0936960058d7f282b1c83be7150494dc1 | [
"BSD-3-Clause"
] | null | null | null | bot/states/states.py | amtp1/ubi-4 | bbfa07f0936960058d7f282b1c83be7150494dc1 | [
"BSD-3-Clause"
] | null | null | null | bot/states/states.py | amtp1/ubi-4 | bbfa07f0936960058d7f282b1c83be7150494dc1 | [
"BSD-3-Clause"
] | null | null | null | from aiogram.dispatcher.filters.state import StatesGroup, State
class Attack(StatesGroup):
set_phone_call = State()
class Mailing(StatesGroup):
set_mailing_text_call = State() | 26.428571 | 63 | 0.783784 | 23 | 185 | 6.086957 | 0.608696 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12973 | 185 | 7 | 64 | 26.428571 | 0.869565 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 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 | 0 | 0 | 1 | 0 | 0 | 3 |
055c45d3bc0e2eb761a389c587de2205205755a0 | 255 | py | Python | apps/user/urls.py | dimastbk/x-one_test | aedf4dd4c5299c1f6e6afde2f557bd284e50f6dc | [
"MIT"
] | 1 | 2020-08-10T11:46:17.000Z | 2020-08-10T11:46:17.000Z | apps/user/urls.py | dimastbk/x-one_test | aedf4dd4c5299c1f6e6afde2f557bd284e50f6dc | [
"MIT"
] | null | null | null | apps/user/urls.py | dimastbk/x-one_test | aedf4dd4c5299c1f6e6afde2f557bd284e50f6dc | [
"MIT"
] | null | null | null | from rest_framework.routers import DefaultRouter
from apps.user.views import AuthViewSet, UserViewSet
router = DefaultRouter()
router.register("", AuthViewSet, basename="auth")
router.register("", UserViewSet, basename="user")
urlpatterns = router.urls
| 28.333333 | 52 | 0.796078 | 28 | 255 | 7.214286 | 0.607143 | 0.138614 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090196 | 255 | 8 | 53 | 31.875 | 0.87069 | 0 | 0 | 0 | 0 | 0 | 0.031373 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
057756ea7512bea24b4425c570ad661d5b1d078c | 118 | py | Python | Codeforces/B_Simple_Game.py | anubhab-code/Competitive-Programming | de28cb7d44044b9e7d8bdb475da61e37c018ac35 | [
"MIT"
] | null | null | null | Codeforces/B_Simple_Game.py | anubhab-code/Competitive-Programming | de28cb7d44044b9e7d8bdb475da61e37c018ac35 | [
"MIT"
] | null | null | null | Codeforces/B_Simple_Game.py | anubhab-code/Competitive-Programming | de28cb7d44044b9e7d8bdb475da61e37c018ac35 | [
"MIT"
] | null | null | null | n,m=map(int,input().split())
mid=n//2
if n==1 and m==1:
print("1")
elif mid<m:
print(m-1)
else:
print(m+1) | 14.75 | 28 | 0.542373 | 27 | 118 | 2.37037 | 0.518519 | 0.09375 | 0.21875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.063158 | 0.194915 | 118 | 8 | 29 | 14.75 | 0.610526 | 0 | 0 | 0 | 0 | 0 | 0.008403 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.375 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
05884cb8cc1e8c53f7f9b4339d31feb82c92a4b6 | 98 | py | Python | Code coach problems/Easy/Python/Isogram_Detector.py | Djivs/sololearn-code-solutions | 7727dd97f79863a88841548770481f6f2abdc7bf | [
"MIT"
] | 1 | 2020-07-27T07:32:57.000Z | 2020-07-27T07:32:57.000Z | Code coach problems/Easy/Python/Isogram_Detector.py | Djivs/sololearn-code-solutions | 7727dd97f79863a88841548770481f6f2abdc7bf | [
"MIT"
] | null | null | null | Code coach problems/Easy/Python/Isogram_Detector.py | Djivs/sololearn-code-solutions | 7727dd97f79863a88841548770481f6f2abdc7bf | [
"MIT"
] | 1 | 2020-11-07T12:45:21.000Z | 2020-11-07T12:45:21.000Z | a = input()
i = 0
while i != len(a):
if a[i] in a[i+1:]:
break
print(str(i == len(a)).lower())
| 14 | 31 | 0.510204 | 22 | 98 | 2.272727 | 0.590909 | 0.16 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025974 | 0.214286 | 98 | 6 | 32 | 16.333333 | 0.623377 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0594a8c465e7b18e9888443f247ba1cf8ff7c9cf | 702 | py | Python | layers/reshape.py | WJGiles/Dorknet | 1582937e843b1a911334291c25ea415fb56e5ccc | [
"MIT"
] | null | null | null | layers/reshape.py | WJGiles/Dorknet | 1582937e843b1a911334291c25ea415fb56e5ccc | [
"MIT"
] | null | null | null | layers/reshape.py | WJGiles/Dorknet | 1582937e843b1a911334291c25ea415fb56e5ccc | [
"MIT"
] | 1 | 2020-07-27T17:03:22.000Z | 2020-07-27T17:03:22.000Z | import numpy as np
from .layer import Layer
class ReshapeLayer:
def __init__(self, layer_name, input_shape, output_shape):
super.__init__(layer_name)
self.input_shape = input_shape
self.output_shape = output_shape
def __repr__(self):
s = "ReshapeLayer(input_shape={}, output_shape={})".format(self.input_shape,
self.output_shape)
return s
def forward(self, X, test_mode=False):
return X.reshape(self.output_shape)
def backward(self, upstream_dx):
return upstream_dx.reshape(self.input_shape) | 33.428571 | 85 | 0.564103 | 76 | 702 | 4.828947 | 0.381579 | 0.163488 | 0.13079 | 0.114441 | 0.13624 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.358974 | 702 | 21 | 86 | 33.428571 | 0.815556 | 0 | 0 | 0 | 0 | 0 | 0.064011 | 0.039829 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0.133333 | 0.133333 | 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 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
05983c5f355ffca2350a3a76badc57638f8db8e8 | 1,308 | py | Python | rlpy/Domains/__init__.py | okkhoy/rlpy | af25d2011fff1d61cb7c5cc8992549808f0c6103 | [
"BSD-3-Clause"
] | 265 | 2015-01-21T08:11:12.000Z | 2021-12-21T08:06:21.000Z | rlpy/Domains/__init__.py | okkhoy/rlpy | af25d2011fff1d61cb7c5cc8992549808f0c6103 | [
"BSD-3-Clause"
] | 22 | 2015-03-26T17:41:43.000Z | 2019-12-19T08:47:36.000Z | rlpy/Domains/__init__.py | okkhoy/rlpy | af25d2011fff1d61cb7c5cc8992549808f0c6103 | [
"BSD-3-Clause"
] | 85 | 2015-02-18T00:25:15.000Z | 2021-11-15T11:10:00.000Z | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
#from Domain import Domain
from future import standard_library
standard_library.install_aliases()
from .HelicopterHover import HelicopterHover, HelicopterHoverExtended
from .HIVTreatment import HIVTreatment
from .PuddleWorld import PuddleWorld
from .GridWorld import GridWorld
from .BlocksWorld import BlocksWorld
from .MountainCar import MountainCar
from .ChainMDP import ChainMDP
from .SystemAdministrator import SystemAdministrator
from .PST import PST
from .Pacman import Pacman
from .IntruderMonitoring import IntruderMonitoring
from .FiftyChain import FiftyChain
from .FlipBoard import FlipBoard
from .RCCar import RCCar
from .Acrobot import Acrobot, AcrobotLegacy
from .Bicycle import BicycleBalancing, BicycleRiding
from .Swimmer import Swimmer
from .Pinball import Pinball
from .FiniteTrackCartPole import (FiniteCartPoleBalance,
FiniteCartPoleBalanceOriginal,
FiniteCartPoleBalanceModern,
FiniteCartPoleSwingUp,
FiniteCartPoleSwingUpFriction)
from .InfiniteTrackCartPole import InfCartPoleBalance, InfCartPoleSwingUp
| 40.875 | 73 | 0.786697 | 120 | 1,308 | 8.391667 | 0.375 | 0.049652 | 0.079444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.187309 | 1,308 | 31 | 74 | 42.193548 | 0.947319 | 0.019113 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.833333 | 0 | 0.833333 | 0.033333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
5537fd0769af5384988d439a528247d706c25d2b | 848 | py | Python | lumin/utils/mod_ver.py | choisant/lumin | c039136eb096e8f3800f13925f9325b99cf7e76b | [
"Apache-2.0"
] | 43 | 2019-02-11T16:16:42.000Z | 2021-12-13T15:35:20.000Z | lumin/utils/mod_ver.py | choisant/lumin | c039136eb096e8f3800f13925f9325b99cf7e76b | [
"Apache-2.0"
] | 48 | 2020-05-21T02:40:50.000Z | 2021-08-10T11:07:08.000Z | lumin/utils/mod_ver.py | choisant/lumin | c039136eb096e8f3800f13925f9325b99cf7e76b | [
"Apache-2.0"
] | 14 | 2019-05-02T15:09:41.000Z | 2022-01-12T21:13:34.000Z | import pkg_resources
__all__ = []
def check_pdpbox():
try:
ver = pkg_resources.get_distribution("pdpbox").version
assert ver >= '0.2.0+13.g73c6966', f'''You have version {ver} of pdpbox. Use of this function requires pdpbox>=0.2.0+13.g73c6966, which is not currently
available from pypi. Please install from source via:\n
`git clone https://github.com/SauceCat/PDPbox.git && cd PDPbox && pip install -e .`'''
except pkg_resources.DistributionNotFound:
print('''Use of this function requires pdpbox>=0.2.0+13.g73c6966, which is not currently available from pypi. Please install from source via:\n
`git clone https://github.com/SauceCat/PDPbox.git && cd PDPbox && pip install -e .`''')
| 56.533333 | 160 | 0.602594 | 108 | 848 | 4.648148 | 0.453704 | 0.071713 | 0.017928 | 0.02988 | 0.683267 | 0.657371 | 0.657371 | 0.657371 | 0.657371 | 0.657371 | 0 | 0.054726 | 0.288915 | 848 | 15 | 161 | 56.533333 | 0.777778 | 0 | 0 | 0 | 0 | 0.363636 | 0.713781 | 0.061249 | 0 | 0 | 0 | 0 | 0.090909 | 1 | 0.090909 | false | 0 | 0.090909 | 0 | 0.181818 | 0.090909 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
555ab459155bc7618fd3e853eed5270201c2705f | 341 | py | Python | eoa.py | LDNN97/evolutionary-optimization-algorithm | 5819ab759ecc1fee94a03e407c97f2ab7bd0f862 | [
"MIT"
] | 21 | 2019-03-12T14:48:36.000Z | 2022-03-08T12:55:30.000Z | eoa.py | LDNN97/Evolutionary-Optimization-Algorithms | 5819ab759ecc1fee94a03e407c97f2ab7bd0f862 | [
"MIT"
] | null | null | null | eoa.py | LDNN97/Evolutionary-Optimization-Algorithms | 5819ab759ecc1fee94a03e407c97f2ab7bd0f862 | [
"MIT"
] | 5 | 2021-02-17T08:33:39.000Z | 2022-01-23T11:44:16.000Z | from prob.problems import *
from opti.de import DE
from opti.cmaes import CMAES
from opti.cmaes_origin import CMAESO
from opti.cmaes_maes import CMAESM
from opti.cmaes_large import CMAESL
# beta
from opti.cmaes_bipop import CMAESB
if __name__ == "__main__":
TaskProb = Sphere(50, -50, 50)
Task = DE(TaskProb, 1000)
Task.run()
| 21.3125 | 36 | 0.747801 | 53 | 341 | 4.584906 | 0.471698 | 0.197531 | 0.26749 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035461 | 0.173021 | 341 | 15 | 37 | 22.733333 | 0.826241 | 0.01173 | 0 | 0 | 0 | 0 | 0.023881 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.636364 | 0 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.