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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
404b7dbee2461d1b57e4fc3525a23a690d0a3335
| 1,297
|
py
|
Python
|
blocksim/models/permissoned_transaction_queue.py
|
Jiali-Xing/Talaria
|
a6777ade8db8a5c4897a881a97a1513ad625de66
|
[
"MIT"
] | 5
|
2021-04-06T03:06:26.000Z
|
2022-03-29T04:11:03.000Z
|
blocksim/models/permissoned_transaction_queue.py
|
Jiali-Xing/Talaria
|
a6777ade8db8a5c4897a881a97a1513ad625de66
|
[
"MIT"
] | null | null | null |
blocksim/models/permissoned_transaction_queue.py
|
Jiali-Xing/Talaria
|
a6777ade8db8a5c4897a881a97a1513ad625de66
|
[
"MIT"
] | 2
|
2021-08-03T19:06:30.000Z
|
2022-01-17T18:55:24.000Z
|
from collections import OrderedDict
# from collections import deque
# from blocksim.utils import time
class TransactionQueue():
def __init__(self, env, node, consensus):
self._env = env
self._node = node
self._consensus = consensus
self._transaction_queue = OrderedDict()
key = f'{node.address}_number_of_transactions_queue'
self._env.data[key] = 0
def put(self, tx):
key = f'{self._node.address}_number_of_transactions_queue'
self._env.data[key] += 1
self._transaction_queue[tx.signature] = tx
def get(self):
# TODO: A delay to retrieve a transaction from the Queue
# Jiali: FIFO popitem is achieved with the OrderedDict() here
return self._transaction_queue.popitem(last=False)[1]
def remove(self, tx):
# None is the default value for pop, so no exception is raised if given key doesn't exist
return self._transaction_queue.pop(tx.signature, None)
def remove_txs(self, txs):
[self._transaction_queue.pop(tx.signature) for tx in txs]
def add_txs(self, txs):
for tx in txs:
self.put(tx)
def is_empty(self):
return len(self._transaction_queue) == 0
def size(self):
return len(self._transaction_queue)
| 31.634146
| 97
| 0.660756
| 176
| 1,297
| 4.670455
| 0.386364
| 0.127737
| 0.170316
| 0.046229
| 0.284672
| 0.284672
| 0.121655
| 0.121655
| 0.121655
| 0.121655
| 0
| 0.004107
| 0.249036
| 1,297
| 40
| 98
| 32.425
| 0.839836
| 0.203547
| 0
| 0
| 0
| 0
| 0.089581
| 0.089581
| 0
| 0
| 0
| 0.025
| 0
| 1
| 0.307692
| false
| 0
| 0.038462
| 0.153846
| 0.538462
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
408660cef1d6a7c0f50b2bd48a78daa85aa03c30
| 320
|
py
|
Python
|
tests/test_spam/test_envio_para_base_de_usuarios.py
|
guyrux/PyTools-API-GitHub
|
39c638c130c44ce80e854b969694104c6688368e
|
[
"MIT"
] | null | null | null |
tests/test_spam/test_envio_para_base_de_usuarios.py
|
guyrux/PyTools-API-GitHub
|
39c638c130c44ce80e854b969694104c6688368e
|
[
"MIT"
] | 14
|
2021-02-20T21:26:41.000Z
|
2021-03-30T03:43:39.000Z
|
tests/test_spam/test_envio_para_base_de_usuarios.py
|
guyrux/PyTools-API-GitHub
|
39c638c130c44ce80e854b969694104c6688368e
|
[
"MIT"
] | null | null | null |
from libpythonpro_github.spam.enviador_de_email import Enviador
from libpythonpro_github.spam.main import EnviadorDeSpam
def test_envio_de_spam(sessao):
enviador_de_spam = EnviadorDeSpam(sessao, Enviador())
enviador_de_spam.envia_emails('guyrux@gmail.com', 'Curso Python Pro', 'Testando essa parte do codigo')
| 40
| 106
| 0.815625
| 44
| 320
| 5.659091
| 0.613636
| 0.120482
| 0.176707
| 0.208835
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.103125
| 320
| 7
| 107
| 45.714286
| 0.867596
| 0
| 0
| 0
| 0
| 0
| 0.190625
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.4
| 0
| 0.6
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
40ccad18ad316ca4fbe39a342d0091ef05f86ad7
| 90
|
py
|
Python
|
quizmake/blank.py
|
jnguyen1098/quizmake
|
760f59b06b3c574ac176305deeaa13d077080e64
|
[
"0BSD"
] | 1
|
2021-06-21T21:51:44.000Z
|
2021-06-21T21:51:44.000Z
|
quizmake/blank.py
|
jnguyen1098/quizmake
|
760f59b06b3c574ac176305deeaa13d077080e64
|
[
"0BSD"
] | 8
|
2020-06-19T13:30:57.000Z
|
2021-04-15T20:07:33.000Z
|
quizmake/blank.py
|
jnguyen1098/quizmake
|
760f59b06b3c574ac176305deeaa13d077080e64
|
[
"0BSD"
] | null | null | null |
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Name this module.
This is blank
"""
| 10
| 23
| 0.566667
| 13
| 90
| 3.923077
| 0.923077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.027778
| 0.2
| 90
| 8
| 24
| 11.25
| 0.680556
| 0.855556
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
dc0f258c3e142fc9e3b7a389b161a00a8564b8e3
| 120
|
py
|
Python
|
desafio01.py
|
bruno-victor32/Curso-de-Python---Mundo-1-Fundamentos
|
4ff929a5e0137ee9d1bcbc36636a4c9b143a77fa
|
[
"MIT"
] | null | null | null |
desafio01.py
|
bruno-victor32/Curso-de-Python---Mundo-1-Fundamentos
|
4ff929a5e0137ee9d1bcbc36636a4c9b143a77fa
|
[
"MIT"
] | null | null | null |
desafio01.py
|
bruno-victor32/Curso-de-Python---Mundo-1-Fundamentos
|
4ff929a5e0137ee9d1bcbc36636a4c9b143a77fa
|
[
"MIT"
] | null | null | null |
nome = input ('Digite o seu nome, por favor!')
print('======== DESAFIO 01 ========')
print(nome , 'seja bem-vindo!!!')
| 30
| 46
| 0.55
| 16
| 120
| 4.125
| 0.8125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.019608
| 0.15
| 120
| 3
| 47
| 40
| 0.627451
| 0
| 0
| 0
| 0
| 0
| 0.616667
| 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
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
dc13d8a32d17f452c0ee9d3e128d3cd82b17e7e0
| 607
|
py
|
Python
|
foundations/paths.py
|
chenw23/open_lth
|
2ce732fe48abd5a80c10a153c45d397b048e980c
|
[
"MIT"
] | 509
|
2020-05-07T16:45:46.000Z
|
2022-03-28T13:41:36.000Z
|
foundations/paths.py
|
chenw23/open_lth
|
2ce732fe48abd5a80c10a153c45d397b048e980c
|
[
"MIT"
] | 12
|
2020-06-10T10:07:09.000Z
|
2022-02-03T01:57:32.000Z
|
foundations/paths.py
|
chenw23/open_lth
|
2ce732fe48abd5a80c10a153c45d397b048e980c
|
[
"MIT"
] | 103
|
2020-05-07T21:40:06.000Z
|
2022-03-11T19:07:55.000Z
|
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
def checkpoint(root): return os.path.join(root, 'checkpoint.pth')
def logger(root): return os.path.join(root, 'logger')
def mask(root): return os.path.join(root, 'mask.pth')
def sparsity_report(root): return os.path.join(root, 'sparsity_report.json')
def model(root, step): return os.path.join(root, 'model_ep{}_it{}.pth'.format(step.ep, step.it))
def hparams(root): return os.path.join(root, 'hparams.log')
| 24.28
| 96
| 0.728171
| 100
| 607
| 4.38
| 0.43
| 0.109589
| 0.164384
| 0.219178
| 0.319635
| 0.273973
| 0
| 0
| 0
| 0
| 0
| 0
| 0.131796
| 607
| 24
| 97
| 25.291667
| 0.83112
| 0.276771
| 0
| 0
| 0
| 0
| 0.17931
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.857143
| false
| 0
| 0.142857
| 0.857143
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
dc192a2f8597515973d310e3d1083d381081a3f4
| 37,480
|
py
|
Python
|
TreesSegmentTests.py
|
LeoUfimtsev/PythonStudy
|
80ab01686648085fd500cb96e54584b9d3dcdbba
|
[
"Apache-2.0"
] | null | null | null |
TreesSegmentTests.py
|
LeoUfimtsev/PythonStudy
|
80ab01686648085fd500cb96e54584b9d3dcdbba
|
[
"Apache-2.0"
] | null | null | null |
TreesSegmentTests.py
|
LeoUfimtsev/PythonStudy
|
80ab01686648085fd500cb96e54584b9d3dcdbba
|
[
"Apache-2.0"
] | null | null | null |
from unittest import TestCase
from unittest import skip, skipIf
from TreesSegment import *
from itertools import combinations
import random
class stTest(TestCase):
#######
# Tests cases for correctness of Solution
#######
T0 = [2, 5, 1, 4, 9, 3]
T1 = [26, 5, 20, 23, 44, 17, 17, 4, 50, 9] # i=0 j=7
######
# Tests to benchmark solutions. Turn on if benchmarking:
T_large_skip = True
#
# All in all:
# - naive solution is faster for small arrays (len<1000) or if j-i is very small.
# - Segment Tree solution works exponentially faster (e.5 30x) for large data sets (n=90000) and j-i is large (e.g 5000+)
# - Implementing Segment Tree via array or dynammically linked Nodes doesn't seem to have any performance difference.
# Every i,j test (combinatorial)
# This test can take 3 + 3 + 6 minutes to execute.
# [random.randint(0,200) for i in xrange(5000)] # -> 12497500 combinations.
# naive: 7m 11s
# mst: 3m 28s
# starr: 3m 31s
#T_large = 5 * [108, 87, 140, 113, 112, 31, 23, 10, 181, 44, 30, 137, 188, 17, 4, 26, 65, 153, 152, 148, 68, 89, 147, 87, 118, 3, 42, 166, 12, 188, 159, 99, 17, 74, 33, 24, 70, 73, 65, 23, 25, 144, 179, 73, 14, 194, 120, 14, 98, 161, 46, 45, 106, 33, 113, 90, 85, 188, 197, 101, 94, 174, 137, 93, 100, 141, 96, 182, 86, 169, 176, 58, 178, 100, 112, 71, 101, 159, 171, 105, 157, 146, 40, 101, 1, 193, 32, 185, 88, 120, 139, 151, 42, 84, 32, 147, 136, 170, 47, 123, 44, 132, 77, 79, 41, 183, 2, 113, 14, 159, 7, 81, 24, 102, 43, 105, 168, 55, 95, 77, 105, 178, 149, 5, 85, 198, 70, 122, 152, 133, 131, 79, 107, 50, 20, 134, 94, 175, 23, 145, 131, 120, 101, 74, 90, 85, 125, 28, 67, 40, 83, 123, 64, 137, 172, 62, 161, 133, 115, 173, 31, 120, 126, 191, 143, 121, 184, 174, 33, 21, 81, 5, 111, 54, 103, 49, 128, 133, 49, 68, 157, 135, 153, 97, 88, 176, 156, 100, 131, 51, 84, 15, 21, 78, 47, 0, 155, 162, 60, 110, 125, 127, 21, 9, 164, 48, 153, 177, 122, 87, 2, 162, 28, 112, 9, 193, 78, 23, 102, 60, 122, 192, 27, 161, 14, 151, 119, 145, 71, 114, 125, 119, 12, 39, 157, 71, 151, 132, 14, 108, 181, 175, 20, 171, 19, 9, 167, 47, 5, 16, 59, 81, 144, 80, 146, 126, 173, 72, 114, 95, 75, 58, 73, 58, 123, 33, 189, 13, 31, 182, 77, 168, 120, 159, 186, 196, 168, 182, 144, 130, 171, 23, 174, 27, 122, 184, 19, 32, 136, 84, 19, 44, 157, 72, 27, 181, 170, 18, 160, 188, 109, 106, 163, 112, 169, 132, 91, 198, 46, 25, 13, 68, 46, 62, 117, 127, 47, 31, 131, 60, 179, 147, 49, 91, 153, 102, 151, 98, 125, 88, 52, 185, 25, 105, 68, 138, 164, 17, 176, 23, 47, 15, 84, 145, 85, 162, 50, 128, 41, 105, 66, 162, 57, 145, 199, 19, 35, 18, 148, 178, 86, 13, 175, 180, 9, 58, 164, 12, 174, 14, 79, 41, 15, 81, 36, 181, 185, 111, 100, 193, 26, 21, 88, 94, 113, 19, 70, 137, 154, 181, 157, 37, 115, 93, 141, 156, 10, 18, 187, 148, 147, 45, 92, 181, 150, 111, 62, 52, 142, 185, 85, 84, 122, 34, 55, 48, 200, 127, 113, 69, 25, 111, 163, 28, 44, 70, 36, 70, 95, 195, 0, 38, 46, 14, 95, 72, 184, 163, 150, 6, 43, 72, 76, 9, 157, 70, 188, 92, 169, 0, 109, 7, 167, 4, 6, 179, 93, 91, 38, 50, 95, 114, 42, 169, 124, 195, 177, 111, 117, 197, 195, 158, 54, 93, 85, 60, 22, 15, 195, 163, 135, 38, 138, 15, 71, 151, 135, 116, 82, 152, 167, 165, 134, 77, 198, 56, 17, 2, 61, 66, 20, 187, 118, 9, 180, 22, 120, 35, 11, 184, 129, 166, 153, 65, 125, 33, 182, 98, 42, 77, 141, 5, 143, 93, 138, 51, 26, 131, 99, 159, 76, 38, 137, 173, 17, 30, 39, 137, 150, 112, 150, 172, 124, 172, 13, 43, 64, 96, 96, 58, 63, 35, 82, 29, 28, 163, 170, 142, 188, 81, 56, 19, 39, 91, 103, 158, 58, 138, 79, 77, 11, 112, 142, 89, 188, 138, 25, 29, 82, 126, 23, 15, 14, 157, 62, 139, 148, 90, 196, 65, 111, 131, 73, 187, 104, 193, 156, 156, 66, 5, 40, 25, 86, 67, 49, 96, 53, 20, 110, 49, 115, 193, 41, 97, 126, 100, 6, 150, 57, 16, 17, 12, 119, 158, 19, 55, 165, 79, 22, 132, 13, 162, 125, 143, 143, 122, 25, 157, 60, 72, 99, 57, 150, 176, 62, 179, 0, 85, 17, 60, 125, 100, 42, 62, 132, 193, 131, 197, 190, 62, 75, 39, 165, 24, 37, 55, 15, 51, 167, 100, 61, 174, 6, 80, 132, 135, 99, 182, 46, 38, 45, 80, 158, 126, 117, 174, 3, 120, 151, 117, 48, 191, 138, 129, 174, 80, 54, 99, 19, 36, 44, 134, 191, 96, 97, 102, 19, 155, 179, 26, 157, 34, 44, 175, 116, 87, 8, 59, 162, 75, 130, 168, 195, 113, 1, 103, 86, 60, 198, 141, 33, 136, 159, 117, 160, 114, 98, 101, 197, 172, 199, 118, 76, 154, 21, 4, 66, 160, 93, 42, 200, 178, 62, 189, 114, 186, 93, 5, 77, 111, 110, 64, 133, 82, 90, 146, 122, 120, 111, 40, 6, 46, 37, 23, 131, 146, 112, 55, 108, 80, 68, 82, 88, 199, 27, 143, 33, 110, 98, 142, 108, 111, 71, 129, 27, 148, 5, 105, 72, 37, 68, 149, 72, 32, 63, 68, 67, 156, 145, 116, 52, 133, 176, 198, 155, 130, 18, 149, 5, 101, 110, 9, 10, 130, 43, 60, 116, 145, 57, 59, 184, 40, 68, 183, 51, 89, 166, 115, 87, 162, 127, 76, 35, 186, 52, 163, 152, 30, 142, 37, 62, 116, 91, 126, 193, 156, 154, 87, 4, 16, 57, 134, 150, 84, 71, 41, 60, 179, 9, 127, 23, 191, 149, 11, 150, 187, 41, 19, 187, 42, 114, 158, 25, 12, 18, 118, 191, 149, 117, 30, 124, 88, 90, 53, 104, 18, 190, 44, 1, 72, 162, 164, 103, 39, 54, 141, 35, 60, 4, 104, 96, 157, 9, 11, 199, 118, 170, 22, 96, 187, 185, 144, 10, 62, 190, 114, 82, 182, 18, 140, 182, 8, 22, 9, 20, 82, 58, 190, 96, 98, 78, 64, 87, 88, 116, 193, 162, 108, 158, 123, 27, 77, 61, 170, 172, 31, 145, 94, 17, 22, 103, 88, 27, 89, 168, 198, 131, 170, 96, 180, 149, 4, 17, 124, 3, 112, 34, 160, 80, 171, 47, 1, 0, 19, 39, 80, 49, 43, 5, 114, 185, 123, 85, 63, 68, 32, 128, 18, 161, 153, 163]
# naive method better than mst for smaller lists where we often have to traverse small i,j ranges.
# [random.randint(0,200) for i in xrange(1000)] # -> 499500 combinations.
# naive: 4s
# mst: 6s
# mst starr: 7s
T_large = [73, 153, 117, 18, 105, 140, 162, 92, 131, 102, 104, 65, 187, 198, 20, 55, 39, 99, 119, 107, 158, 119, 13, 79, 32, 115, 78, 57, 129, 100, 131, 10, 142, 107, 142, 91, 165, 83, 184, 41, 107, 172, 3, 29, 93, 82, 45, 54, 198, 189, 196, 111, 30, 101, 94, 23, 92, 34, 174, 41, 56, 173, 2, 151, 193, 145, 164, 68, 58, 147, 111, 75, 144, 106, 139, 93, 22, 192, 126, 81, 196, 97, 72, 13, 52, 48, 127, 129, 171, 19, 13, 183, 190, 33, 161, 55, 70, 126, 42, 1, 71, 28, 26, 40, 8, 164, 154, 188, 103, 34, 143, 92, 88, 85, 97, 33, 190, 76, 103, 8, 11, 160, 154, 79, 44, 51, 196, 59, 51, 72, 121, 155, 77, 158, 171, 130, 120, 141, 139, 150, 50, 191, 162, 89, 68, 28, 163, 1, 3, 54, 67, 164, 11, 94, 53, 133, 86, 111, 151, 22, 41, 4, 145, 131, 24, 151, 188, 78, 23, 6, 9, 82, 58, 20, 142, 0, 179, 68, 164, 146, 62, 181, 168, 101, 49, 48, 30, 33, 197, 111, 72, 178, 72, 196, 183, 150, 167, 157, 191, 38, 98, 198, 122, 199, 137, 105, 18, 76, 176, 68, 23, 84, 98, 84, 133, 198, 153, 196, 149, 22, 182, 192, 111, 172, 76, 198, 92, 103, 93, 80, 9, 34, 177, 127, 59, 128, 5, 23, 186, 68, 131, 142, 23, 39, 22, 128, 114, 89, 171, 86, 148, 70, 113, 115, 137, 62, 125, 61, 194, 129, 33, 161, 115, 87, 92, 128, 105, 164, 115, 65, 74, 82, 110, 87, 105, 39, 125, 175, 160, 4, 139, 174, 82, 166, 117, 146, 110, 110, 179, 148, 137, 87, 7, 38, 171, 74, 30, 12, 30, 118, 56, 122, 123, 128, 77, 133, 108, 178, 32, 37, 188, 2, 181, 36, 110, 159, 110, 54, 175, 156, 23, 1, 133, 25, 24, 67, 133, 156, 110, 21, 51, 115, 116, 109, 48, 190, 17, 196, 4, 44, 16, 59, 127, 16, 7, 195, 13, 94, 86, 28, 22, 197, 134, 178, 89, 159, 198, 192, 162, 23, 168, 107, 191, 198, 100, 45, 52, 13, 47, 41, 79, 129, 148, 141, 176, 115, 144, 108, 189, 177, 91, 196, 178, 164, 170, 24, 74, 98, 79, 64, 194, 19, 60, 28, 138, 89, 142, 143, 40, 130, 22, 130, 58, 134, 21, 103, 17, 172, 66, 153, 86, 53, 31, 7, 40, 1, 94, 140, 95, 137, 15, 40, 95, 103, 5, 169, 155, 98, 69, 87, 188, 89, 157, 178, 108, 186, 92, 57, 79, 40, 55, 77, 180, 184, 83, 46, 5, 50, 116, 198, 3, 71, 31, 160, 29, 94, 12, 186, 188, 76, 1, 51, 35, 94, 82, 52, 92, 56, 186, 3, 144, 135, 15, 129, 32, 199, 94, 105, 102, 147, 52, 192, 148, 32, 142, 128, 140, 180, 87, 106, 68, 169, 55, 177, 150, 46, 100, 119, 38, 192, 171, 3, 120, 41, 149, 170, 28, 29, 178, 145, 94, 195, 33, 124, 102, 90, 16, 92, 88, 198, 60, 152, 188, 126, 186, 73, 32, 1, 88, 161, 168, 35, 68, 136, 108, 184, 196, 59, 118, 96, 25, 25, 172, 181, 87, 22, 5, 68, 23, 94, 31, 27, 54, 118, 38, 96, 19, 13, 1, 114, 20, 26, 116, 23, 62, 3, 184, 185, 52, 109, 35, 86, 113, 58, 14, 103, 24, 87, 29, 105, 158, 106, 21, 52, 34, 106, 92, 109, 185, 67, 78, 152, 196, 29, 174, 156, 142, 151, 103, 23, 74, 152, 126, 85, 155, 153, 29, 117, 34, 56, 167, 88, 149, 111, 186, 98, 131, 183, 119, 59, 13, 164, 162, 37, 200, 68, 142, 22, 25, 159, 166, 146, 20, 146, 149, 130, 34, 162, 176, 72, 63, 26, 56, 179, 75, 153, 126, 18, 178, 181, 131, 69, 99, 13, 78, 89, 127, 70, 82, 197, 141, 102, 6, 90, 79, 144, 133, 13, 176, 57, 193, 68, 8, 135, 160, 142, 11, 180, 196, 157, 11, 182, 45, 135, 1, 69, 123, 26, 199, 194, 156, 158, 147, 28, 17, 166, 184, 47, 89, 188, 49, 37, 73, 194, 105, 133, 50, 104, 140, 10, 30, 110, 6, 114, 8, 166, 84, 35, 148, 32, 200, 99, 106, 75, 83, 41, 31, 125, 32, 34, 108, 99, 7, 22, 137, 129, 15, 114, 40, 182, 36, 95, 99, 19, 117, 66, 110, 192, 196, 86, 182, 186, 27, 194, 12, 106, 74, 45, 125, 33, 145, 53, 179, 30, 1, 133, 119, 110, 24, 34, 173, 87, 66, 3, 7, 127, 25, 70, 163, 116, 195, 185, 145, 86, 188, 92, 89, 70, 152, 94, 136, 15, 66, 170, 52, 130, 133, 5, 153, 62, 55, 110, 45, 46, 5, 56, 160, 30, 78, 169, 182, 53, 49, 143, 62, 128, 45, 37, 160, 74, 189, 198, 13, 13, 160, 140, 80, 59, 31, 124, 27, 6, 134, 162, 134, 13, 29, 63, 64, 13, 84, 143, 35, 27, 125, 108, 88, 160, 122, 136, 140, 3, 34, 100, 79, 17, 54, 11, 34, 60, 33, 94, 101, 198, 58, 112, 60, 37, 72, 135, 11, 33, 181, 163, 1, 49, 191, 47, 79, 29, 81, 130, 73, 187, 70, 87, 155, 37, 84, 18, 189, 49, 190, 153, 132, 52, 86, 111, 119, 13, 105, 150, 4, 79, 188, 6, 136, 24, 165, 191, 117, 191, 101, 181, 69, 195, 50, 183, 78, 138, 49, 47, 36, 4, 34, 147, 7, 55, 7, 180, 7, 175, 37, 137, 195, 137, 105, 184, 154, 111, 43, 185, 163, 66, 62, 22, 51, 115, 41, 74, 21, 103, 97, 126, 76, 162, 98, 176, 23, 142, 100, 179, 52, 21, 95, 180, 5, 141, 97, 69, 105, 144, 16, 0, 56, 58, 41, 93, 132, 30, 141, 139, 65, 90, 191, 137, 16, 70, 46, 25, 83, 123, 148, 127, 85, 118, 130, 78, 88, 175]
# Emulating long lists and queries with large-enough distance shows mst is better.
# [random.randint(0, 200) for i in xrange(10000)]
# naive: 729ms # Naive method is 4 times slower.
# mst: 280ms
# mst strarr: 258ms
T_large2 = 10 * [165, 124, 20, 17, 128, 176, 119, 71, 185, 60, 93, 168, 10, 180, 152, 162, 21, 90, 28, 163, 51, 130, 178, 175, 90, 34, 187, 145, 3, 71, 162, 121, 62, 127, 56, 92, 96, 74, 37, 48, 30, 12, 134, 33, 59, 183, 108, 87, 20, 97, 134, 38, 49, 111, 74, 139, 48, 9, 19, 70, 96, 81, 39, 142, 58, 146, 73, 125, 186, 15, 136, 157, 102, 17, 87, 66, 155, 161, 152, 76, 153, 120, 59, 69, 21, 13, 113, 164, 149, 150, 180, 22, 134, 20, 71, 61, 139, 100, 106, 70, 34, 165, 174, 98, 191, 2, 104, 133, 66, 158, 39, 106, 103, 76, 121, 134, 145, 51, 167, 63, 143, 68, 81, 139, 126, 66, 174, 166, 0, 134, 134, 135, 113, 99, 84, 112, 154, 105, 128, 157, 41, 119, 122, 177, 193, 167, 143, 48, 183, 169, 68, 76, 3, 76, 15, 34, 189, 132, 70, 15, 15, 118, 194, 146, 30, 131, 131, 154, 124, 145, 140, 37, 101, 121, 70, 74, 56, 3, 196, 105, 93, 8, 101, 189, 7, 74, 56, 59, 76, 194, 54, 106, 79, 70, 110, 158, 51, 191, 18, 70, 188, 53, 194, 104, 181, 179, 98, 44, 12, 84, 173, 71, 161, 102, 81, 162, 181, 165, 95, 84, 37, 52, 14, 8, 11, 194, 49, 100, 1, 149, 40, 23, 156, 94, 181, 93, 123, 113, 39, 130, 137, 16, 90, 195, 134, 12, 49, 95, 73, 163, 30, 125, 168, 177, 105, 70, 28, 39, 91, 185, 19, 56, 172, 187, 178, 161, 141, 192, 86, 92, 108, 49, 81, 76, 141, 19, 116, 83, 179, 133, 94, 148, 182, 85, 6, 26, 154, 129, 20, 22, 8, 124, 68, 65, 84, 10, 134, 146, 27, 59, 173, 158, 26, 162, 7, 165, 11, 64, 196, 119, 17, 79, 51, 6, 31, 94, 96, 14, 32, 43, 104, 87, 30, 65, 73, 191, 185, 0, 149, 107, 181, 47, 53, 149, 35, 175, 50, 153, 130, 41, 80, 116, 122, 140, 150, 55, 94, 139, 70, 78, 27, 89, 128, 51, 193, 68, 135, 104, 130, 97, 128, 159, 124, 145, 185, 164, 145, 193, 46, 89, 81, 122, 92, 184, 161, 97, 26, 176, 73, 180, 105, 154, 121, 81, 64, 107, 84, 199, 59, 3, 150, 37, 130, 129, 200, 19, 194, 200, 170, 134, 167, 47, 116, 173, 197, 10, 16, 10, 126, 58, 93, 118, 74, 12, 40, 181, 19, 92, 150, 85, 131, 3, 28, 94, 96, 86, 77, 99, 50, 147, 140, 198, 89, 120, 127, 60, 124, 92, 155, 62, 83, 95, 65, 121, 183, 153, 118, 177, 44, 167, 149, 21, 112, 49, 115, 42, 116, 26, 107, 3, 94, 25, 117, 50, 198, 169, 160, 172, 84, 177, 185, 196, 113, 6, 195, 111, 12, 15, 97, 25, 49, 48, 83, 66, 120, 86, 127, 112, 74, 125, 27, 164, 186, 57, 99, 122, 181, 21, 9, 15, 135, 43, 85, 182, 200, 29, 15, 54, 62, 88, 53, 66, 18, 132, 98, 3, 183, 130, 153, 121, 15, 106, 54, 44, 60, 109, 39, 116, 53, 74, 197, 67, 5, 62, 108, 33, 112, 151, 168, 145, 199, 13, 115, 38, 99, 114, 123, 5, 5, 150, 193, 175, 121, 197, 76, 76, 69, 179, 152, 80, 172, 84, 76, 63, 131, 139, 63, 199, 151, 34, 57, 128, 17, 44, 96, 107, 95, 142, 77, 40, 59, 169, 17, 8, 143, 190, 172, 31, 126, 118, 136, 63, 37, 99, 118, 47, 164, 148, 129, 92, 184, 152, 55, 199, 19, 22, 69, 161, 122, 188, 50, 10, 157, 186, 155, 16, 148, 73, 111, 114, 46, 188, 16, 6, 34, 87, 139, 175, 96, 42, 133, 58, 30, 48, 34, 180, 90, 182, 169, 52, 30, 75, 142, 93, 13, 81, 60, 108, 118, 168, 0, 142, 36, 60, 39, 180, 52, 53, 97, 171, 63, 12, 53, 100, 113, 194, 14, 58, 182, 87, 112, 61, 36, 40, 84, 25, 37, 36, 195, 190, 115, 7, 154, 31, 175, 51, 2, 121, 109, 101, 113, 159, 21, 14, 46, 125, 81, 182, 28, 59, 197, 170, 0, 111, 80, 187, 186, 141, 163, 76, 165, 94, 113, 129, 86, 10, 191, 133, 41, 146, 161, 191, 63, 187, 136, 139, 28, 52, 120, 131, 82, 163, 46, 122, 10, 166, 26, 114, 119, 158, 148, 79, 104, 69, 75, 146, 27, 197, 4, 98, 78, 144, 151, 129, 36, 159, 154, 8, 52, 48, 155, 164, 140, 57, 76, 7, 155, 141, 66, 173, 125, 48, 194, 1, 111, 41, 200, 150, 157, 154, 199, 108, 54, 52, 28, 131, 183, 166, 58, 169, 157, 166, 64, 28, 179, 77, 44, 70, 154, 34, 75, 11, 190, 21, 68, 24, 31, 128, 9, 164, 58, 176, 140, 106, 121, 168, 36, 180, 181, 179, 49, 30, 182, 119, 191, 57, 21, 87, 147, 19, 147, 34, 32, 129, 1, 26, 48, 6, 156, 18, 178, 22, 0, 37, 159, 78, 10, 131, 159, 49, 141, 69, 73, 44, 41, 108, 103, 9, 143, 59, 197, 65, 157, 87, 163, 163, 35, 18, 110, 86, 91, 13, 82, 132, 183, 138, 187, 31, 65, 117, 37, 188, 185, 162, 179, 121, 104, 149, 1, 155, 52, 109, 133, 91, 98, 24, 198, 47, 121, 132, 78, 36, 97, 189, 110, 126, 191, 187, 14, 14, 127, 198, 174, 146, 29, 197, 0, 76, 130, 56, 193, 12, 193, 52, 91, 51, 99, 82, 31, 112, 118, 11, 52, 54, 113, 20, 164, 118, 157, 181, 191, 175, 131, 155, 107, 83, 0, 47, 47, 74, 103, 117, 7, 8, 174, 160, 145, 47, 126, 43, 21, 56, 199, 183, 30, 36, 68, 61, 57, 163, 174, 135, 13, 26, 24, 155, 26, 196, 23, 94, 96, 99, 41, 135, 189, 67, 81, 181, 93, 197, 58, 99, 16, 185, 172, 10, 112, 35, 132, 49, 115]
# while len(Q) < 9000:
# a, b = random.randint(0, 9999), random.randint(0, 9999)
# i = min(a,b)
# j = max(a,b)
# if j - i < 500:
# continue
# else:
# Q.append((i,j))
## Leo: 500 * 18 = 9000. (9000 items slow down IDE)
T_large2_queries = 18 * [(1200, 9494), (4518, 9975), (4763, 8122), (260, 8007), (291, 1060), (1447, 6072), (481, 8564), (4168, 5797), (3920, 7735), (1511, 5159), (4208, 5871), (3276, 4029), (5596, 7196), (6284, 7317), (2964, 5036), (7233, 9127), (1667, 6361), (2160, 7478), (3030, 9440), (1342, 3582), (2463, 8848), (7007, 7984), (5896, 8539), (7164, 9781), (4665, 8121), (597, 5626), (6278, 7665), (5001, 7584), (2919, 7412), (1502, 2704), (233, 7539), (6561, 9547), (508, 4188), (3667, 7925), (3512, 4419), (6140, 9667), (385, 5772), (52, 7759), (2551, 9448), (166, 9642), (2368, 5485), (552, 5688), (7458, 9609), (1772, 9398), (589, 6235), (1321, 5514), (5733, 9692), (2027, 2993), (4641, 6646), (1971, 3900), (812, 5086), (1636, 3494), (3164, 8752), (4591, 7393), (2987, 8597), (3939, 6460), (4193, 5953), (663, 4470), (5067, 5701), (445, 5419), (1771, 7474), (6411, 8204), (871, 4591), (4205, 9384), (781, 8143), (242, 2045), (4263, 8963), (7343, 9313), (3462, 8739), (6117, 9402), (2688, 5120), (5007, 8227), (3973, 5731), (463, 3819), (1315, 6353), (8060, 8658), (2731, 9499), (3950, 5110), (5472, 6674), (4970, 8600), (1353, 2419), (13, 1383), (4677, 8670), (7376, 9964), (138, 2562), (1129, 7793), (2287, 2996), (5141, 9583), (1119, 7729), (50, 7921), (2440, 8582), (5058, 8758), (7356, 9962), (971, 9150), (667, 3834), (6970, 8216), (1131, 7463), (5272, 6542), (2856, 5679), (8566, 9275), (2263, 7898), (4625, 5898), (765, 7346), (1210, 8468), (3517, 7850), (1780, 5523), (5446, 8393), (391, 5240), (1201, 5899), (3414, 9006), (1577, 4670), (7280, 8124), (3238, 7853), (2928, 4905), (617, 3183), (4042, 8604), (597, 3978), (978, 1508), (2182, 7668), (1792, 5764), (1906, 7602), (3718, 8579), (4718, 6586), (1910, 2621), (4389, 8246), (5347, 6520), (1346, 6406), (2337, 6196), (6325, 9302), (1081, 9951), (689, 5009), (174, 9695), (5191, 9509), (4094, 7334), (109, 6991), (1391, 3797), (932, 4799), (2300, 6764), (97, 9299), (1837, 9507), (2494, 3720), (436, 3703), (4387, 6132), (5593, 6780), (3451, 8411), (4685, 7237), (2566, 3982), (33, 8302), (5071, 6694), (5038, 5600), (3692, 5008), (4485, 9428), (2114, 8919), (2961, 3840), (115, 6191), (765, 4171), (1891, 5010), (5559, 8046), (4260, 8764), (825, 7600), (3350, 4738), (3153, 5926), (4224, 5405), (5721, 7381), (4547, 5144), (2531, 7683), (4970, 9306), (3231, 4401), (5853, 9287), (1667, 4570), (131, 1464), (2388, 7755), (60, 4828), (5456, 9241), (1151, 6629), (557, 1824), (3084, 9717), (3151, 4491), (4403, 7424), (1061, 4258), (4911, 6427), (3854, 5989), (2700, 7475), (1156, 9090), (1418, 8281), (67, 653), (4324, 9599), (6918, 9763), (6601, 8926), (348, 4445), (3459, 7425), (2010, 5846), (4200, 5579), (3200, 7834), (3333, 6946), (806, 7194), (1289, 4717), (1472, 4781), (7469, 9790), (1405, 7301), (5748, 6556), (6553, 9592), (503, 3015), (2042, 9382), (1618, 4027), (26, 588), (733, 2080), (8102, 9267), (1144, 6078), (3958, 8223), (979, 3344), (4860, 9745), (4252, 5578), (2374, 7507), (2044, 9837), (1299, 8735), (8862, 9981), (3394, 3961), (3377, 7655), (6353, 8365), (5742, 7469), (862, 3257), (2129, 4106), (913, 7611), (2084, 4997), (1620, 8871), (94, 5479), (818, 1382), (529, 5466), (1360, 6245), (961, 7374), (1577, 5590), (6635, 9355), (1461, 2182), (6012, 6894), (3410, 8935), (6535, 8289), (1591, 7666), (7912, 8692), (1743, 3559), (7633, 9961), (3615, 5074), (1951, 5369), (507, 5868), (3131, 5520), (2542, 6971), (3055, 8603), (8041, 8596), (1655, 3848), (4249, 5680), (325, 3686), (415, 1287), (794, 5283), (4367, 6955), (7107, 8219), (931, 5214), (3974, 8319), (4646, 8460), (4346, 7825), (6787, 8831), (4335, 6590), (2599, 7408), (4555, 6903), (1797, 5946), (2173, 8404), (2784, 8441), (1654, 5863), (6828, 8523), (668, 8022), (7305, 9554), (4900, 8698), (2629, 4575), (2307, 8227), (1740, 5540), (7368, 9283), (413, 8141), (1893, 5610), (4013, 5475), (533, 3064), (1635, 2428), (2414, 4375), (1064, 3434), (502, 8162), (3973, 8786), (6939, 8219), (161, 4427), (1481, 5599), (526, 5480), (1213, 5707), (3496, 7799), (3049, 9418), (3106, 7532), (2261, 5768), (3240, 7678), (968, 8273), (3306, 7006), (3836, 8794), (5882, 6614), (2483, 5024), (645, 4459), (3084, 8525), (5507, 7291), (3921, 8922), (4713, 6753), (3138, 9169), (793, 9258), (6521, 9609), (5831, 8849), (432, 7585), (4146, 8378), (1436, 3367), (2821, 6657), (3391, 4792), (443, 4414), (6076, 9558), (6053, 9344), (95, 9236), (92, 4122), (4280, 5901), (2479, 3005), (7065, 7795), (2529, 4075), (5044, 5730), (6481, 8683), (5335, 8954), (2125, 6754), (5856, 9039), (5549, 6118), (2505, 9798), (1240, 5322), (120, 4952), (5435, 8267), (3279, 9969), (5946, 7521), (8254, 8956), (3010, 8364), (8406, 9391), (3513, 5403), (5291, 6779), (5505, 9657), (521, 2581), (2426, 3589), (2727, 5600), (4763, 9970), (2010, 5313), (1729, 2524), (1984, 3145), (3224, 4008), (1399, 7564), (2240, 6231), (620, 9156), (3408, 9762), (294, 9539), (1479, 6467), (1555, 9870), (3324, 5728), (6293, 8053), (2820, 4756), (3531, 8026), (4338, 5137), (1997, 7827), (2552, 8594), (7059, 8718), (692, 9736), (4688, 5488), (5359, 8868), (5343, 9171), (1249, 9998), (801, 6662), (8299, 9456), (6268, 7803), (451, 1506), (2893, 6432), (861, 7778), (3496, 9869), (563, 3359), (4227, 7751), (655, 2603), (1240, 8465), (758, 8991), (965, 8716), (575, 4004), (635, 1577), (5448, 6129), (4688, 6749), (809, 8043), (5147, 6903), (2887, 5069), (1088, 6546), (5578, 7285), (1165, 6266), (4169, 5219), (634, 2361), (1465, 4863), (6024, 6855), (1411, 3563), (5460, 9910), (1980, 5785), (2223, 6539), (180, 3443), (137, 3548), (8231, 9513), (5103, 8025), (2442, 8526), (2252, 8868), (3733, 7613), (946, 4399), (6938, 9844), (5088, 9945), (1844, 6051), (4208, 9243), (3966, 6298), (6117, 9357), (1250, 8902), (1303, 4553), (3522, 6054), (888, 4337), (4165, 9671), (4795, 6305), (3302, 5677), (5752, 7753), (3847, 5583), (908, 4994), (3177, 6223), (3925, 9079), (87, 791), (7630, 9837), (6185, 7168), (3510, 6469), (1312, 8629), (622, 4348), (174, 4104), (5465, 7427), (468, 9170), (3380, 7437), (1733, 4968), (6403, 9220), (2613, 5229), (3269, 5464), (2893, 5876), (6757, 7602), (4294, 5106), (7690, 8490), (1177, 2867), (2147, 6901), (1541, 3447), (258, 4175), (5427, 6135), (1076, 3714), (3907, 8756), (729, 2579), (2309, 8115), (1831, 5020), (48, 7369), (4755, 5727), (4161, 8734), (2551, 7433), (1289, 3036), (3343, 8782), (7239, 8763), (3000, 7423), (1955, 3405), (3740, 5262), (1891, 9189), (6598, 9640), (5168, 6886), (8119, 9527), (408, 2319), (3971, 6225), (1309, 3622), (1797, 8728), (2883, 3712), (7210, 9869), (1776, 6370), (4415, 9336), (129, 5662), (3132, 8500), (5052, 9002), (2710, 8501), (4902, 6320), (8339, 9755), (262, 2986), (1723, 6890), (4973, 6769), (8850, 9836), (1842, 8072), (8170, 9307), (2040, 7727), (2620, 4427), (968, 8159), (3182, 9492), (6561, 9376), (3105, 9646), (6326, 6913), (1693, 8588), (5668, 8987), (406, 3041), (4974, 6787), (2065, 5768), (7639, 9472)]
# [random.randint(0, 50000-1) for i in xrange(50000)]
# Leo[edit]: Took a 1000 sample and clone it 50 times instead. 50k items in IDE slow it down a lot.
T_large3 = 50 * [11651, 14335, 48737, 3875, 48119, 39323, 35173, 8035, 40762, 23107, 9276, 36426, 44535, 45365, 45436, 14894, 45997, 34049, 38728, 26361, 35900, 35590, 32072, 9406, 6204, 2413, 5255, 34093, 8613, 29305, 22635, 12623, 8398, 44636, 4718, 12512, 12596, 8468, 32882, 4976, 14342, 13382, 45034, 52, 20830, 37388, 35122, 19803, 12607, 12555, 31166, 12830, 17346, 2728, 41299, 32646, 16022, 17114, 35998, 24347, 26668, 1945, 33368, 49468, 3920, 43438, 23811, 5129, 2811, 20389, 18593, 12024, 43581, 14994, 23741, 3237, 20015, 30227, 42759, 12983, 3158, 11513, 35829, 5665, 6464, 45283, 25710, 6210, 9781, 20723, 4355, 16008, 6685, 38684, 17447, 4495, 8438, 36259, 17309, 49652, 35158, 34261, 17172, 894, 45492, 10090, 27441, 6453, 5002, 40399, 20146, 44783, 1126, 22388, 33932, 42228, 34625, 43678, 13970, 32866, 4935, 15367, 2809, 23044, 10018, 33451, 34436, 13254, 16078, 16106, 49182, 12377, 24269, 36996, 38219, 27784, 43844, 41805, 14429, 11926, 4912, 46158, 41193, 38448, 8876, 33078, 23006, 49042, 12596, 47563, 3130, 17659, 29020, 7358, 33544, 6200, 43307, 34209, 37430, 28867, 40862, 44775, 2432, 27037, 20742, 3919, 44277, 22230, 7715, 4843, 21472, 46393, 19391, 48, 13505, 4306, 42742, 23980, 834, 11981, 20812, 20798, 1725, 42968, 16357, 10422, 9981, 25602, 45316, 10373, 41090, 4767, 2997, 23490, 43740, 33331, 13418, 31537, 3729, 2749, 28238, 31829, 18807, 37276, 39985, 42523, 49313, 11856, 14760, 14671, 5951, 41120, 29268, 32173, 37227, 29426, 40613, 9405, 35261, 8666, 9861, 40166, 20640, 42362, 15947, 48405, 18516, 39490, 22871, 29418, 108, 8505, 28906, 30330, 25897, 488, 186, 47803, 20469, 27462, 26019, 39275, 8435, 15592, 26677, 42146, 23487, 44604, 10663, 5584, 28382, 12023, 3288, 9596, 15619, 30718, 39710, 39831, 19552, 38279, 28185, 34166, 38225, 32747, 26656, 33435, 27908, 27931, 8446, 30466, 13874, 14858, 10529, 30674, 3814, 13381, 44669, 48642, 5342, 28602, 15872, 4466, 47185, 38543, 25013, 20099, 14307, 23744, 40503, 2267, 6916, 29865, 31323, 49324, 48209, 20700, 49450, 43258, 8457, 24609, 29954, 40523, 9632, 14531, 39220, 343, 1900, 23253, 47996, 10018, 28299, 4465, 27839, 47390, 16041, 26928, 39537, 30759, 3174, 40038, 42689, 41923, 23192, 16020, 36394, 49377, 25682, 2490, 19652, 37754, 26786, 35999, 5066, 36599, 26015, 17133, 26706, 44245, 7354, 38202, 15674, 26179, 21350, 22819, 43577, 10221, 27303, 33311, 25450, 49837, 4547, 4208, 605, 15666, 33141, 37894, 35055, 24797, 23343, 18034, 39512, 35665, 19869, 44076, 34023, 21217, 9974, 26056, 25573, 31946, 2909, 34085, 40914, 22796, 44276, 10318, 36457, 18060, 20033, 20777, 19344, 38825, 42761, 12397, 4001, 24040, 25088, 12857, 49090, 16415, 6421, 33036, 13500, 5255, 16177, 36225, 44847, 30300, 40886, 48170, 41895, 44777, 36254, 13929, 49465, 43689, 39783, 223, 29032, 49733, 36786, 21197, 13659, 13212, 12850, 18594, 706, 46663, 23006, 48719, 43929, 4989, 45282, 24381, 44048, 4431, 9689, 32616, 39417, 30494, 21357, 33081, 43056, 8509, 27669, 8070, 7883, 12321, 40455, 35417, 3543, 17824, 44835, 9768, 10408, 5232, 4247, 46121, 14915, 20182, 26585, 35553, 15974, 5301, 39452, 45930, 24203, 3686, 20015, 2704, 38316, 28271, 47238, 9296, 6439, 174, 17318, 22454, 41759, 3331, 21281, 8077, 41235, 41312, 42417, 27293, 20638, 47724, 22423, 6891, 12624, 41641, 35100, 47166, 41619, 36434, 42506, 17952, 13604, 49005, 28458, 5845, 17455, 39762, 35949, 45509, 43093, 21142, 37398, 45910, 1689, 18270, 32978, 9980, 19164, 45513, 24997, 43685, 943, 14455, 48535, 14861, 11705, 9636, 12907, 28294, 23591, 34774, 41856, 36041, 38483, 23893, 15034, 13495, 47709, 25510, 24474, 754, 30193, 48302, 27344, 28442, 31390, 12401, 45127, 42511, 49966, 9431, 21378, 49342, 6082, 8052, 7889, 10325, 16050, 18645, 34925, 44914, 40772, 15762, 22083, 37390, 49042, 31693, 40877, 17483, 49932, 49398, 49344, 45925, 25161, 21077, 26108, 3505, 42347, 35895, 35267, 17877, 25394, 8438, 34858, 19549, 44102, 40661, 20226, 27602, 48735, 49343, 29455, 34782, 12753, 48181, 17198, 8547, 6385, 3725, 13602, 49446, 40240, 24163, 38411, 15636, 41457, 340, 384, 23553, 3068, 37465, 39828, 3152, 45647, 12245, 32265, 13218, 1167, 41600, 34798, 14551, 29759, 24578, 15849, 16051, 27678, 10830, 28599, 17957, 20795, 22226, 32367, 26127, 30895, 25448, 47988, 49967, 976, 24404, 24405, 18561, 49584, 46509, 31308, 11037, 40763, 37816, 39286, 15489, 10305, 48431, 5445, 8480, 22595, 20945, 20003, 7424, 24241, 21391, 20832, 5066, 40406, 30911, 13293, 11388, 24681, 49754, 8236, 31808, 15875, 33437, 28854, 8390, 44254, 13777, 13603, 36713, 28021, 3398, 40385, 38517, 35623, 5108, 16104, 25124, 7985, 26415, 10997, 43446, 9905, 36857, 42062, 30287, 183, 14503, 30708, 42563, 25776, 10337, 33067, 13746, 19953, 21654, 11054, 4887, 29792, 43612, 24238, 49749, 22706, 13637, 24140, 49090, 13877, 48312, 9270, 49640, 28593, 42109, 34053, 4367, 19441, 17269, 6177, 446, 4, 18765, 22480, 49645, 17849, 23110, 37666, 39699, 1064, 1338, 12196, 41166, 8139, 49866, 19815, 11928, 19662, 14156, 20068, 14141, 16957, 8573, 9228, 11502, 35308, 34580, 37080, 32854, 27444, 49912, 33510, 23, 4088, 14398, 14175, 22767, 26696, 27965, 1485, 22610, 15093, 39890, 3649, 41721, 10911, 40557, 35230, 24948, 326, 15872, 36421, 37109, 37857, 4595, 28999, 12125, 34060, 18957, 38139, 27903, 10833, 27523, 24543, 38477, 25834, 22276, 12994, 46019, 24102, 47258, 19677, 42707, 34476, 28431, 47992, 10580, 21345, 23286, 44971, 5640, 21498, 4402, 43752, 9191, 29552, 24591, 28087, 31397, 14303, 44315, 44154, 46476, 4600, 23392, 26506, 7059, 33417, 23422, 13936, 1197, 35499, 31504, 19153, 38349, 13738, 3907, 7704, 16096, 42349, 26588, 34814, 9898, 17873, 37349, 41008, 221, 48573, 11319, 16689, 32371, 23356, 12966, 47186, 23171, 21995, 46097, 25719, 41822, 23195, 26366, 15408, 11916, 6748, 1972, 23275, 37961, 31437, 18295, 29446, 30438, 39272, 38313, 13215, 33372, 44180, 41806, 42487, 48563, 620, 32031, 36534, 3689, 10741, 21696, 31006, 9511, 12174, 921, 44791, 1811, 21031, 39504, 29747, 49005, 21676, 31873, 47849, 4971, 16635, 15627, 14482, 16654, 35442, 30863, 46052, 45754, 46, 33149, 34675, 14944, 8241, 43736, 6830, 11597, 21464, 11456, 41483, 25929, 22446, 4933, 4232, 2595, 35205, 979, 20546, 49612, 48896, 2503, 21773, 35490, 21287, 45892, 38632, 7993, 18491, 3081, 38698, 4624, 2282, 43912, 17753, 12560, 2345, 32517, 19347, 35090, 3385, 8883, 42275, 48383, 10679, 41481, 38661, 37846, 14866, 9882, 18625, 3910, 9533, 23427, 5308, 47620, 1855, 43161, 47645, 14423, 41211, 25614, 17252, 10451, 13947, 29606, 39994, 26443, 24547, 9942, 4685, 38499, 33442, 24521, 38060, 47814, 2364, 36087, 44479, 46124, 38264, 23949, 8004, 861, 39340, 33346, 36256, 45753, 48982, 47975, 43930, 27803, 32656, 34418, 49125, 16990, 44512, 38081, 12887, 4343, 4655, 24785, 522, 20043, 46195, 48887, 48063, 7119, 10078, 46715, 11914, 47520, 44422]
# Q = []
# while len(Q) < 90000:
# a, b = random.randint(0, 50000-1), random.randint(0, 50000-1)
# i = min(a, b)
# j = max(a, b)
# if j - i < 10000:
# continue
# else:
# Q.append((i, j))
# # Leo note: List with 90,000 elements is rather large and slows down IDE. Workaround: take the first 63 elements and duplicate it 1587 times.
# mst: 2s, 862ms
# mst starr: 2s 887ms <<< Interestingly enough, Tree array implementation doesn't give us much of a benifit.
# naive: 56s! <<< Exponential growth observed here.
T_large3_queries = 1587 * [(17459, 41445), (2867, 46776), (21890, 35494), (10413, 37391), (18814, 36558), (8717, 36794), (6054, 16332), (10237, 36801), (16380, 41365), (28254, 43939), (5944, 25342), (17449, 28410), (10297, 22554), (6017, 30209), (2800, 18339), (19153, 29603), (22948, 35368), (14412, 26648), (25779, 39097), (15089, 36888), (11275, 34909), (6383, 17036), (29806, 45000), (2252, 47316), (186, 39834), (7924, 37000), (4889, 35693), (14743, 45818), (24355, 36795), (16800, 37588), (23197, 44021), (20748, 46662), (21562, 35182), (4709, 41310), (20088, 42635), (391, 27711), (19533, 29721), (7015, 19397), (1781, 33282), (1711, 32460), (17994, 41199), (11159, 31606), (9453, 21142), (7966, 30053), (17933, 43031), (10475, 29688), (14370, 44780), (9907, 49181), (7055, 44731), (902, 26383), (14419, 49013), (4811, 17793), (3153, 36058), (1552, 15861), (21007, 45243), (1804, 40105), (31506, 49651), (5327, 30121), (8314, 19925), (15033, 27091), (23777, 49241), (5407, 24078), (10769, 30332)]
@skipIf(T_large_skip, "T_large_skip is True")
def test_performance2_naive(self):
t_count = 0
for i, j in self.T_large2_queries:
min_val = min(self.T_large2[i:j+1])
t_count += 1
print("test_performance2_naive completed tests:", t_count)
@skipIf(T_large_skip, "T_large_skip is True")
def test_performance2_mst(self):
mst = SegmentTree(self.T_large2_queries, min)
t_count = 0
for i, j in self.T_large2_queries:
min_val = mst.query(i,j)
t_count += 1
print("test_performance2_mst completed tests:", t_count)
@skipIf(T_large_skip, "T_large_skip is True")
def test_performance2_mst_starr(self):
mst = SegmentTreeArr(self.T_large2_queries, min)
t_count = 0
for i, j in self.T_large2_queries:
min_val = mst.query(i,j)
t_count += 1
print("test_performance2_mst_starr completed tests:", t_count)
# This one is very slow. ~1 minute. Very good showcase of performance difference.
@skipIf(T_large_skip, "T_large_skip is True")
def test_performance3_naive(self):
t_count = 0
for i, j in self.T_large3_queries:
min_val = min(self.T_large3[i:j+1])
t_count += 1
print("test_performance3_naive completed tests:", t_count)
@skipIf(T_large_skip, "T_large_skip is True")
def test_performance3_mst(self):
mst = SegmentTree(self.T_large3, min)
t_count = 0
for i, j in self.T_large3_queries:
min_val = mst.query(i,j)
t_count += 1
print("test_performance3_mst completed tests:", t_count)
@skipIf(T_large_skip, "T_large_skip is True")
def test_performance3_mst_starr(self):
mst = SegmentTreeArr(self.T_large3, min)
t_count = 0
for i, j in self.T_large3_queries:
min_val = mst.query(i,j)
t_count += 1
print("test_performance3_mst_starr completed tests:", t_count)
def test_min_queries_T0(self):
min_segment_tree = SegmentTree(self.T0, min)
# print "Min for 1,3 = ", min_segment_tree.query(1,3), " (expecting 1)"
for i, j in combinations(list(range(len(self.T0))), 2):
self.assertEqual(min(self.T0[i:j+1]), min_segment_tree.query(i, j))
def test_min_queries_T1(self):
mst = SegmentTree(self.T1, min)
mst_min = mst.query(0, 7)
min_min = min(self.T1[0:7+1])
self.assertEqual(mst_min, min_min, "{} {}".format(mst_min, min_min))
def test_max_queries_T0(self):
max_segment_tree = SegmentTree(self.T0, max)
# print "Min for 1,3 = ", min_segment_tree.query(1,3), " (expecting 1)"
for i, j in combinations(list(range(len(self.T0))), 2):
self.assertEqual(max(self.T0[i:j+1]), max_segment_tree.query(i, j))
def test_max_queries_T1(self):
mst = SegmentTree(self.T1, max)
mst_max = mst.query(0, 7)
max_max = max(self.T1[0:7+1])
self.assertEqual(mst_max, max_max, "{} {}".format(mst_max, max_max))
def test_starr_min_queries_T0(self):
min_segment_tree = SegmentTreeArr(self.T0, min)
# print "Min for 1,3 = ", min_segment_tree.query(1,3), " (expecting 1)"
for i, j in combinations(list(range(len(self.T0))), 2):
self.assertEqual(min(self.T0[i:j+1]), min_segment_tree.query(i, j))
def test_starr_min_queries_T1(self):
mst = SegmentTreeArr(self.T1, min)
mst_min = mst.query(0, 7)
min_min = min(self.T1[0:7+1])
self.assertEqual(mst_min, min_min, "{} {}".format(mst_min, min_min))
def test_min_queries_T_Rand(self):
"""Test with randomly generated lists. Test every possible index combination.
I caught a few subtle bugs with this method. Random testing is good!
"""
for t in range(1, 70):
L = [random.randint(0, 50) for _ in range(t)]
# print "L: ", L # Debug
# print "List with len: ", len(L)
min_segment_tree = SegmentTree(L, min)
for i, j in combinations(list(range(len(L))), 2):
m = min(L[i:j+1])
mq = min_segment_tree.query(i,j)
# print m == mq, i, j, L[i:j+1], m, mq # Debug
self.assertEqual(m, mq)
def test_max_queries_T_Rand(self):
"""Test with randomly generated lists. Test every possible index combination.
I caught a few subtle bugs with this method. Random testing is good!
"""
for t in range(1, 70):
L = [random.randint(0, 50) for _ in range(t)]
# print "L: ", L # Debug
# print "List with len: ", len(L)
min_segment_tree = SegmentTree(L, max)
for i, j in combinations(list(range(len(L))), 2):
m = max(L[i:j+1])
mq = min_segment_tree.query(i,j)
# print m == mq, i, j, L[i:j+1], m, mq # Debug
self.assertEqual(m, mq)
def test_min_queries_T_Rand_starr(self):
"""As above except for SegmentTreeArr"""
for t in range(1, 70):
L = [random.randint(0, 50) for _ in range(t)]
min_segment_tree = SegmentTreeArr(L, min)
for i, j in combinations(list(range(len(L))), 2):
m = min(L[i:j+1])
mq = min_segment_tree.query(i,j)
self.assertEqual(m, mq)
@skipIf(T_large_skip, "T_large_skip is True")
def test_performance_naive(self):
t_count = 0
for i, j in combinations(list(range(len(self.T_large))), 2):
min_val = min(self.T_large[i:j+1])
t_count += 1
print("naive implemented did ", t_count, "tests")
pass
@skipIf(T_large_skip, "T_large_skip is True")
def test_performance_mst_generation(self):
mst = SegmentTree(self.T_large, min)
@skipIf(T_large_skip, "T_large_skip is True")
def test_performance_mst_generation_starr(self):
mst = SegmentTreeArr(self.T_large, min)
@skipIf(T_large_skip, "T_large_skip is True")
def test_performance_mst_query(self):
mst = SegmentTree(self.T_large, min)
t_count = 0
for i, j in combinations(list(range(len(self.T_large))), 2):
min_val = mst.query(i, j)
t_count += 1
print("mst implementation did ", t_count, "tests")
pass
@skipIf(T_large_skip, "T_large_skip is True")
def test_performance_mst_query_starr(self):
mst = SegmentTreeArr(self.T_large, min)
t_count = 0
for i, j in combinations(list(range(len(self.T_large))), 2):
min_val = mst.query(i, j)
t_count += 1
print("mst implementation did ", t_count, "tests")
pass
# todo - max segment tree
# todo - sum_segment tree
| 150.522088
| 6,907
| 0.59421
| 6,564
| 37,480
| 3.355271
| 0.369744
| 0.003996
| 0.010443
| 0.004768
| 0.170904
| 0.163049
| 0.156511
| 0.143071
| 0.133809
| 0.1334
| 0
| 0.570253
| 0.208911
| 37,480
| 248
| 6,908
| 151.129032
| 0.172546
| 0.193517
| 0
| 0.566434
| 0
| 0
| 0.018684
| 0.004721
| 0
| 0
| 0
| 0.004032
| 0.062937
| 1
| 0.13986
| false
| 0.020979
| 0.034965
| 0
| 0.237762
| 0.062937
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
90a3a7046dba696b500543344f552d5e48c95b09
| 183
|
py
|
Python
|
parsing/exceptions.py
|
davesque/parsing.py
|
ff8b20e53b94e79571971ef23f0e5091e2786566
|
[
"MIT"
] | 1
|
2020-11-14T13:06:42.000Z
|
2020-11-14T13:06:42.000Z
|
parsing/exceptions.py
|
davesque/parsing.py
|
ff8b20e53b94e79571971ef23f0e5091e2786566
|
[
"MIT"
] | null | null | null |
parsing/exceptions.py
|
davesque/parsing.py
|
ff8b20e53b94e79571971ef23f0e5091e2786566
|
[
"MIT"
] | null | null | null |
class ParseError(Exception):
pass
class NotEnoughInputError(ParseError):
pass
class ImproperInputError(ParseError):
pass
class PlaceholderError(Exception):
pass
| 12.2
| 38
| 0.748634
| 16
| 183
| 8.5625
| 0.4375
| 0.19708
| 0.277372
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.185792
| 183
| 14
| 39
| 13.071429
| 0.919463
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 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
| 4
|
90b4ef5432ba6667039b82c4d8cf114cdc1b742c
| 625
|
py
|
Python
|
Syclop_e-prop-rl/testop.py
|
eldadassa/eligibility_propagation
|
6ca02ab509785e40c01161f8aa23ef60c49887bb
|
[
"BSD-3-Clause"
] | null | null | null |
Syclop_e-prop-rl/testop.py
|
eldadassa/eligibility_propagation
|
6ca02ab509785e40c01161f8aa23ef60c49887bb
|
[
"BSD-3-Clause"
] | null | null | null |
Syclop_e-prop-rl/testop.py
|
eldadassa/eligibility_propagation
|
6ca02ab509785e40c01161f8aa23ef60c49887bb
|
[
"BSD-3-Clause"
] | null | null | null |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import tensorflow as tf
dir_path = os.path.dirname(os.path.realpath(__file__))
_tst_module = tf.load_op_library(os.path.join(dir_path, 'tfoptest.so'))
def _game_dir():
return os.path.join(os.path.abspath(os.path.dirname(__file__)), "roms")
def get_game_path(game_name):
return os.path.join(_game_dir(), game_name) + ".bin"
def optest(action, reset, max_episode_length, game_name, **kwargs):
return _tst_module.optest(action, reset, max_episode_length, get_game_path(game_name), **kwargs)
| 31.25
| 100
| 0.776
| 97
| 625
| 4.525773
| 0.402062
| 0.095672
| 0.109339
| 0.072893
| 0.236902
| 0.150342
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1072
| 625
| 19
| 101
| 32.894737
| 0.786738
| 0
| 0
| 0
| 0
| 0
| 0.030449
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.230769
| false
| 0
| 0.384615
| 0.230769
| 0.846154
| 0.076923
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 4
|
90c75150f46f0c55fe5a2ff04097af88200c3d26
| 261
|
py
|
Python
|
thomas/magic_coins1.py
|
thomas-siwoo/python-edu
|
cf6dc09b98383e2b4117f33239155d94426a6200
|
[
"Apache-2.0"
] | null | null | null |
thomas/magic_coins1.py
|
thomas-siwoo/python-edu
|
cf6dc09b98383e2b4117f33239155d94426a6200
|
[
"Apache-2.0"
] | null | null | null |
thomas/magic_coins1.py
|
thomas-siwoo/python-edu
|
cf6dc09b98383e2b4117f33239155d94426a6200
|
[
"Apache-2.0"
] | null | null | null |
found_coins = 20
magic_coins = 10
stolen_coins = 3
print(found_coins + magic_coins * 365 - stolen_coins * 52)
stolen_coins = 2
print(found_coins + magic_coins * 365 - stolen_coins * 52)
magic_coins = 13
print(found_coins + magic_coins * 365 - stolen_coins * 52)
| 32.625
| 58
| 0.754789
| 42
| 261
| 4.357143
| 0.285714
| 0.273224
| 0.245902
| 0.327869
| 0.672131
| 0.672131
| 0.672131
| 0.672131
| 0.672131
| 0
| 0
| 0.104545
| 0.157088
| 261
| 8
| 59
| 32.625
| 0.727273
| 0
| 0
| 0.375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.375
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
90e20145840b40d80ad3c66c76626873c3b4e478
| 92
|
py
|
Python
|
fechbase.py
|
h4ck3rm1k3/FEC-Field-Documentation
|
c2f1f36e14c67ac3656c09f801b9f595d3e9f92e
|
[
"Unlicense"
] | 1
|
2016-06-13T23:54:31.000Z
|
2016-06-13T23:54:31.000Z
|
fechbase.py
|
h4ck3rm1k3/FEC-Field-Documentation
|
c2f1f36e14c67ac3656c09f801b9f595d3e9f92e
|
[
"Unlicense"
] | null | null | null |
fechbase.py
|
h4ck3rm1k3/FEC-Field-Documentation
|
c2f1f36e14c67ac3656c09f801b9f595d3e9f92e
|
[
"Unlicense"
] | 1
|
2019-07-03T10:35:19.000Z
|
2019-07-03T10:35:19.000Z
|
class RecordsBase:
pass
class VersionBase:
pass
class VersionsBase:
pass
| 8.363636
| 19
| 0.663043
| 9
| 92
| 6.777778
| 0.555556
| 0.295082
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.304348
| 92
| 10
| 20
| 9.2
| 0.953125
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
90e418c67603c1501d61c49b20542048b638bc32
| 22
|
py
|
Python
|
amazon_dash/__init__.py
|
luke255/amazon-dash
|
c3642e6c0e6eba889772bab2e604bc245902532e
|
[
"MIT"
] | 765
|
2016-11-17T03:13:10.000Z
|
2022-03-31T22:48:14.000Z
|
amazon_dash/__init__.py
|
luke255/amazon-dash
|
c3642e6c0e6eba889772bab2e604bc245902532e
|
[
"MIT"
] | 171
|
2016-12-02T23:56:44.000Z
|
2022-03-09T23:46:09.000Z
|
amazon_dash/__init__.py
|
luke255/amazon-dash
|
c3642e6c0e6eba889772bab2e604bc245902532e
|
[
"MIT"
] | 77
|
2016-11-17T12:02:30.000Z
|
2022-03-09T20:53:46.000Z
|
__version__ = '1.4.0'
| 11
| 21
| 0.636364
| 4
| 22
| 2.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 0.136364
| 22
| 2
| 21
| 11
| 0.368421
| 0
| 0
| 0
| 0
| 0
| 0.227273
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
29151dccc58d4305ab4c36324410e059bfa62664
| 5,172
|
py
|
Python
|
resources/dot_PyCharm/system/python_stubs/-762174762/PySide/QtGui/QMdiArea.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/QMdiArea.py
|
basepipe/developer_onboarding
|
05b6a776f8974c89517868131b201f11c6c2a5ad
|
[
"MIT"
] | null | null | null |
resources/dot_PyCharm/system/python_stubs/cache/8cdc475d469a13122bc4bc6c3ac1c215d93d5f120f5cc1ef33a8f3088ee54d8e/PySide/QtGui/QMdiArea.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
from QAbstractScrollArea import QAbstractScrollArea
class QMdiArea(QAbstractScrollArea):
# no doc
def activateNextSubWindow(self, *args, **kwargs): # real signature unknown
pass
def activatePreviousSubWindow(self, *args, **kwargs): # real signature unknown
pass
def activationOrder(self, *args, **kwargs): # real signature unknown
pass
def activeSubWindow(self, *args, **kwargs): # real signature unknown
pass
def addSubWindow(self, *args, **kwargs): # real signature unknown
pass
def background(self, *args, **kwargs): # real signature unknown
pass
def cascadeSubWindows(self, *args, **kwargs): # real signature unknown
pass
def childEvent(self, *args, **kwargs): # real signature unknown
pass
def closeActiveSubWindow(self, *args, **kwargs): # real signature unknown
pass
def closeAllSubWindows(self, *args, **kwargs): # real signature unknown
pass
def currentSubWindow(self, *args, **kwargs): # real signature unknown
pass
def documentMode(self, *args, **kwargs): # real signature unknown
pass
def event(self, *args, **kwargs): # real signature unknown
pass
def eventFilter(self, *args, **kwargs): # real signature unknown
pass
def minimumSizeHint(self, *args, **kwargs): # real signature unknown
pass
def paintEvent(self, *args, **kwargs): # real signature unknown
pass
def removeSubWindow(self, *args, **kwargs): # real signature unknown
pass
def resizeEvent(self, *args, **kwargs): # real signature unknown
pass
def scrollContentsBy(self, *args, **kwargs): # real signature unknown
pass
def setActivationOrder(self, *args, **kwargs): # real signature unknown
pass
def setActiveSubWindow(self, *args, **kwargs): # real signature unknown
pass
def setBackground(self, *args, **kwargs): # real signature unknown
pass
def setDocumentMode(self, *args, **kwargs): # real signature unknown
pass
def setOption(self, *args, **kwargs): # real signature unknown
pass
def setTabPosition(self, *args, **kwargs): # real signature unknown
pass
def setTabsClosable(self, *args, **kwargs): # real signature unknown
pass
def setTabShape(self, *args, **kwargs): # real signature unknown
pass
def setTabsMovable(self, *args, **kwargs): # real signature unknown
pass
def setupViewport(self, *args, **kwargs): # real signature unknown
pass
def setViewMode(self, *args, **kwargs): # real signature unknown
pass
def showEvent(self, *args, **kwargs): # real signature unknown
pass
def sizeHint(self, *args, **kwargs): # real signature unknown
pass
def subWindowActivated(self, *args, **kwargs): # real signature unknown
""" Signal """
pass
def subWindowList(self, *args, **kwargs): # real signature unknown
pass
def tabPosition(self, *args, **kwargs): # real signature unknown
pass
def tabsClosable(self, *args, **kwargs): # real signature unknown
pass
def tabShape(self, *args, **kwargs): # real signature unknown
pass
def tabsMovable(self, *args, **kwargs): # real signature unknown
pass
def testOption(self, *args, **kwargs): # real signature unknown
pass
def tileSubWindows(self, *args, **kwargs): # real signature unknown
pass
def timerEvent(self, *args, **kwargs): # real signature unknown
pass
def viewMode(self, *args, **kwargs): # real signature unknown
pass
def viewportEvent(self, *args, **kwargs): # real signature unknown
pass
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(S, *more): # real signature unknown; restored from __doc__
""" T.__new__(S, ...) -> a new object with type S, a subtype of T """
pass
ActivationHistoryOrder = PySide.QtGui.QMdiArea.WindowOrder.ActivationHistoryOrder
AreaOption = None # (!) real value is "<type 'PySide.QtGui.QMdiArea.AreaOption'>"
AreaOptions = None # (!) real value is "<type 'AreaOptions'>"
CreationOrder = PySide.QtGui.QMdiArea.WindowOrder.CreationOrder
DontMaximizeSubWindowOnActivation = PySide.QtGui.QMdiArea.AreaOption.DontMaximizeSubWindowOnActivation
StackingOrder = PySide.QtGui.QMdiArea.WindowOrder.StackingOrder
staticMetaObject = None # (!) real value is '<PySide.QtCore.QMetaObject object at 0x000000000407FB48>'
SubWindowView = PySide.QtGui.QMdiArea.ViewMode.SubWindowView
TabbedView = PySide.QtGui.QMdiArea.ViewMode.TabbedView
ViewMode = None # (!) real value is "<type 'PySide.QtGui.QMdiArea.ViewMode'>"
WindowOrder = None # (!) real value is "<type 'PySide.QtGui.QMdiArea.WindowOrder'>"
| 30.97006
| 106
| 0.663766
| 551
| 5,172
| 6.185118
| 0.199637
| 0.171655
| 0.264085
| 0.232394
| 0.565434
| 0.559859
| 0.549883
| 0.538732
| 0
| 0
| 0
| 0.005532
| 0.231052
| 5,172
| 166
| 107
| 31.156627
| 0.851396
| 0.306071
| 0
| 0.424528
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.424528
| false
| 0.424528
| 0.028302
| 0
| 0.566038
| 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
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
29440568b89336f9205b59959743ed4c1fc0a1b9
| 479
|
py
|
Python
|
setup.py
|
kbdancer/WIFIHTTPMonitor
|
a9bff2c0a19cc98d1187fe06ec3faffe74f6bb3b
|
[
"MIT"
] | 30
|
2016-06-30T17:02:40.000Z
|
2021-09-01T13:56:36.000Z
|
setup.py
|
jiuge10235/WIFIHTTPMonitor-1
|
a9bff2c0a19cc98d1187fe06ec3faffe74f6bb3b
|
[
"MIT"
] | 1
|
2018-05-05T01:05:27.000Z
|
2018-05-05T01:05:27.000Z
|
setup.py
|
jiuge10235/WIFIHTTPMonitor-1
|
a9bff2c0a19cc98d1187fe06ec3faffe74f6bb3b
|
[
"MIT"
] | 19
|
2016-10-15T14:55:19.000Z
|
2021-03-20T08:47:53.000Z
|
#!/usr/bin/env python
# coding=utf-8
# code by 92ez.com
import os
os.system('apt-get update && apt-get dist-upgrade -y')
os.system('apt-get install python-dev -y')
os.system('apt-get install gcc -y')
os.system('apt-get install rfkill -y')
os.system('apt-get -y install isc-dhcp-server')
os.system('wget https://bootstrap.pypa.io/get-pip.py')
os.system('python get-pip.py')
os.system('pip install -U web.py')
os.system('pip install -U psutil')
os.system('pip install -U scapy')
| 28.176471
| 54
| 0.705637
| 89
| 479
| 3.797753
| 0.426966
| 0.236686
| 0.162722
| 0.207101
| 0.485207
| 0.319527
| 0
| 0
| 0
| 0
| 0
| 0.006993
| 0.104384
| 479
| 16
| 55
| 29.9375
| 0.780886
| 0.104384
| 0
| 0
| 0
| 0
| 0.63615
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.090909
| 0
| 0.090909
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
297452a2dc3150e0499443ff44e5617750d7b329
| 35,234
|
py
|
Python
|
openstackclient/tests/unit/common/test_quota.py
|
BeyondTheClouds/python-openstackclient
|
45af14ca72b44c03f14189ac61a29253faf03bd7
|
[
"Apache-2.0"
] | 5
|
2015-02-26T18:03:07.000Z
|
2017-05-01T20:17:20.000Z
|
openstackclient/tests/unit/common/test_quota.py
|
BeyondTheClouds/python-openstackclient
|
45af14ca72b44c03f14189ac61a29253faf03bd7
|
[
"Apache-2.0"
] | null | null | null |
openstackclient/tests/unit/common/test_quota.py
|
BeyondTheClouds/python-openstackclient
|
45af14ca72b44c03f14189ac61a29253faf03bd7
|
[
"Apache-2.0"
] | 1
|
2020-07-21T02:18:23.000Z
|
2020-07-21T02:18:23.000Z
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import copy
import mock
from osc_lib import exceptions
from openstackclient.common import quota
from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes
from openstackclient.tests.unit import fakes
from openstackclient.tests.unit.identity.v2_0 import fakes as identity_fakes
from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes_v3
from openstackclient.tests.unit.network.v2 import fakes as network_fakes
from openstackclient.tests.unit.volume.v2 import fakes as volume_fakes
class FakeQuotaResource(fakes.FakeResource):
_keys = {'property': 'value'}
def set_keys(self, args):
self._keys.update(args)
def unset_keys(self, keys):
for key in keys:
self._keys.pop(key, None)
def get_keys(self):
return self._keys
class TestQuota(compute_fakes.TestComputev2):
def setUp(self):
super(TestQuota, self).setUp()
# Set up common projects
self.projects = identity_fakes_v3.FakeProject.create_projects(count=2)
self.projects_mock = self.app.client_manager.identity.projects
self.projects_mock.reset_mock()
self.projects_mock.get.return_value = self.projects[0]
self.compute_quotas_mock = self.app.client_manager.compute.quotas
self.compute_quotas_mock.reset_mock()
self.compute_quotas_class_mock = \
self.app.client_manager.compute.quota_classes
self.compute_quotas_class_mock.reset_mock()
self.volume_quotas_mock = self.app.client_manager.volume.quotas
self.volume_quotas_mock.reset_mock()
self.volume_quotas_class_mock = \
self.app.client_manager.volume.quota_classes
self.volume_quotas_class_mock.reset_mock()
self.app.client_manager.auth_ref = mock.Mock()
self.app.client_manager.auth_ref.service_catalog = mock.Mock()
self.service_catalog_mock = \
self.app.client_manager.auth_ref.service_catalog
self.service_catalog_mock.reset_mock()
self.app.client_manager.auth_ref.project_id = identity_fakes.project_id
class TestQuotaList(TestQuota):
"""Test cases for quota list command"""
compute_column_header = (
'Project ID',
'Cores',
'Fixed IPs',
'Injected Files',
'Injected File Content Bytes',
'Injected File Path Bytes',
'Instances',
'Key Pairs',
'Metadata Items',
'Ram',
'Server Groups',
'Server Group Members',
)
network_column_header = (
'Project ID',
'Floating IPs',
'Networks',
'Ports',
'RBAC Policies',
'Routers',
'Security Groups',
'Security Group Rules',
'Subnets',
'Subnet Pools'
)
volume_column_header = (
'Project ID',
'Backups',
'Backup Gigabytes',
'Gigabytes',
'Per Volume Gigabytes',
'Snapshots',
'Volumes',
)
def setUp(self):
super(TestQuotaList, self).setUp()
# Work with multiple projects in this class
self.projects_mock.get.side_effect = self.projects
self.projects_mock.list.return_value = self.projects
self.compute_quotas = [
compute_fakes.FakeQuota.create_one_comp_quota(),
compute_fakes.FakeQuota.create_one_comp_quota(),
]
self.compute_default_quotas = [
compute_fakes.FakeQuota.create_one_default_comp_quota(),
compute_fakes.FakeQuota.create_one_default_comp_quota(),
]
self.compute = self.app.client_manager.compute
self.compute.quotas.defaults = mock.Mock(
side_effect=self.compute_default_quotas,
)
self.compute_reference_data = (
self.projects[0].id,
self.compute_quotas[0].cores,
self.compute_quotas[0].fixed_ips,
self.compute_quotas[0].injected_files,
self.compute_quotas[0].injected_file_content_bytes,
self.compute_quotas[0].injected_file_path_bytes,
self.compute_quotas[0].instances,
self.compute_quotas[0].key_pairs,
self.compute_quotas[0].metadata_items,
self.compute_quotas[0].ram,
self.compute_quotas[0].server_groups,
self.compute_quotas[0].server_group_members,
)
self.network_quotas = [
network_fakes.FakeQuota.create_one_net_quota(),
network_fakes.FakeQuota.create_one_net_quota(),
]
self.network_default_quotas = [
network_fakes.FakeQuota.create_one_default_net_quota(),
network_fakes.FakeQuota.create_one_default_net_quota(),
]
self.network = self.app.client_manager.network
self.network.get_quota_default = mock.Mock(
side_effect=self.network_default_quotas,
)
self.network_reference_data = (
self.projects[0].id,
self.network_quotas[0].floating_ips,
self.network_quotas[0].networks,
self.network_quotas[0].ports,
self.network_quotas[0].rbac_policies,
self.network_quotas[0].routers,
self.network_quotas[0].security_groups,
self.network_quotas[0].security_group_rules,
self.network_quotas[0].subnets,
self.network_quotas[0].subnet_pools,
)
self.volume_quotas = [
volume_fakes.FakeQuota.create_one_vol_quota(),
volume_fakes.FakeQuota.create_one_vol_quota(),
]
self.volume_default_quotas = [
volume_fakes.FakeQuota.create_one_default_vol_quota(),
volume_fakes.FakeQuota.create_one_default_vol_quota(),
]
self.volume = self.app.client_manager.volume
self.volume.quotas.defaults = mock.Mock(
side_effect=self.volume_default_quotas,
)
self.volume_reference_data = (
self.projects[0].id,
self.volume_quotas[0].backups,
self.volume_quotas[0].backup_gigabytes,
self.volume_quotas[0].gigabytes,
self.volume_quotas[0].per_volume_gigabytes,
self.volume_quotas[0].snapshots,
self.volume_quotas[0].volumes,
)
self.cmd = quota.ListQuota(self.app, None)
@staticmethod
def _get_detailed_reference_data(quota):
reference_data = []
for name, values in quota.to_dict().items():
if type(values) is dict:
if 'used' in values:
# For network quota it's "used" key instead of "in_use"
in_use = values['used']
else:
in_use = values['in_use']
resource_values = [
in_use,
values['reserved'],
values['limit']]
reference_data.append(tuple([name] + resource_values))
return reference_data
def test_quota_list_details_compute(self):
detailed_quota = (
compute_fakes.FakeQuota.create_one_comp_detailed_quota())
detailed_column_header = (
'Resource',
'In Use',
'Reserved',
'Limit',
)
detailed_reference_data = (
self._get_detailed_reference_data(detailed_quota))
self.compute.quotas.get = mock.Mock(return_value=detailed_quota)
arglist = [
'--detail', '--compute',
]
verifylist = [
('detail', True),
('compute', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
ret_quotas = list(data)
self.assertEqual(detailed_column_header, columns)
self.assertEqual(
sorted(detailed_reference_data), sorted(ret_quotas))
def test_quota_list_details_network(self):
detailed_quota = (
network_fakes.FakeQuota.create_one_net_detailed_quota())
detailed_column_header = (
'Resource',
'In Use',
'Reserved',
'Limit',
)
detailed_reference_data = (
self._get_detailed_reference_data(detailed_quota))
self.network.get_quota = mock.Mock(return_value=detailed_quota)
arglist = [
'--detail', '--network',
]
verifylist = [
('detail', True),
('network', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
ret_quotas = list(data)
self.assertEqual(detailed_column_header, columns)
self.assertEqual(
sorted(detailed_reference_data), sorted(ret_quotas))
def test_quota_list_compute(self):
# Two projects with non-default quotas
self.compute.quotas.get = mock.Mock(
side_effect=self.compute_quotas,
)
arglist = [
'--compute',
]
verifylist = [
('compute', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
ret_quotas = list(data)
self.assertEqual(self.compute_column_header, columns)
self.assertEqual(self.compute_reference_data, ret_quotas[0])
self.assertEqual(2, len(ret_quotas))
def test_quota_list_compute_default(self):
# One of the projects is at defaults
self.compute.quotas.get = mock.Mock(
side_effect=[
self.compute_quotas[0],
compute_fakes.FakeQuota.create_one_default_comp_quota(),
],
)
arglist = [
'--compute',
]
verifylist = [
('compute', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
ret_quotas = list(data)
self.assertEqual(self.compute_column_header, columns)
self.assertEqual(self.compute_reference_data, ret_quotas[0])
self.assertEqual(1, len(ret_quotas))
def test_quota_list_compute_no_project_not_found(self):
# Make one of the projects disappear
self.compute.quotas.get = mock.Mock(
side_effect=[
self.compute_quotas[0],
exceptions.NotFound("NotFound"),
],
)
arglist = [
'--compute',
]
verifylist = [
('compute', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
ret_quotas = list(data)
self.assertEqual(self.compute_column_header, columns)
self.assertEqual(self.compute_reference_data, ret_quotas[0])
self.assertEqual(1, len(ret_quotas))
def test_quota_list_compute_no_project_4xx(self):
# Make one of the projects disappear
self.compute.quotas.get = mock.Mock(
side_effect=[
self.compute_quotas[0],
exceptions.BadRequest("Bad request"),
],
)
arglist = [
'--compute',
]
verifylist = [
('compute', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
ret_quotas = list(data)
self.assertEqual(self.compute_column_header, columns)
self.assertEqual(self.compute_reference_data, ret_quotas[0])
self.assertEqual(1, len(ret_quotas))
def test_quota_list_compute_no_project_5xx(self):
# Make one of the projects disappear
self.compute.quotas.get = mock.Mock(
side_effect=[
self.compute_quotas[0],
exceptions.HTTPNotImplemented("Not implemented??"),
],
)
arglist = [
'--compute',
]
verifylist = [
('compute', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.assertRaises(
exceptions.HTTPNotImplemented,
self.cmd.take_action,
parsed_args,
)
def test_quota_list_network(self):
# Two projects with non-default quotas
self.network.get_quota = mock.Mock(
side_effect=self.network_quotas,
)
arglist = [
'--network',
]
verifylist = [
('network', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
ret_quotas = list(data)
self.assertEqual(self.network_column_header, columns)
self.assertEqual(self.network_reference_data, ret_quotas[0])
self.assertEqual(2, len(ret_quotas))
def test_quota_list_network_default(self):
# Two projects with non-default quotas
self.network.get_quota = mock.Mock(
side_effect=[
self.network_quotas[0],
network_fakes.FakeQuota.create_one_default_net_quota(),
],
)
arglist = [
'--network',
]
verifylist = [
('network', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
ret_quotas = list(data)
self.assertEqual(self.network_column_header, columns)
self.assertEqual(self.network_reference_data, ret_quotas[0])
self.assertEqual(1, len(ret_quotas))
def test_quota_list_network_no_project(self):
# Two projects with non-default quotas
self.network.get_quota = mock.Mock(
side_effect=[
self.network_quotas[0],
exceptions.NotFound("NotFound"),
],
)
arglist = [
'--network',
]
verifylist = [
('network', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
ret_quotas = list(data)
self.assertEqual(self.network_column_header, columns)
self.assertEqual(self.network_reference_data, ret_quotas[0])
self.assertEqual(1, len(ret_quotas))
def test_quota_list_volume(self):
# Two projects with non-default quotas
self.volume.quotas.get = mock.Mock(
side_effect=self.volume_quotas,
)
arglist = [
'--volume',
]
verifylist = [
('volume', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
ret_quotas = list(data)
self.assertEqual(self.volume_column_header, columns)
self.assertEqual(self.volume_reference_data, ret_quotas[0])
self.assertEqual(2, len(ret_quotas))
def test_quota_list_volume_default(self):
# Two projects with non-default quotas
self.volume.quotas.get = mock.Mock(
side_effect=[
self.volume_quotas[0],
volume_fakes.FakeQuota.create_one_default_vol_quota(),
],
)
arglist = [
'--volume',
]
verifylist = [
('volume', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
ret_quotas = list(data)
self.assertEqual(self.volume_column_header, columns)
self.assertEqual(self.volume_reference_data, ret_quotas[0])
self.assertEqual(1, len(ret_quotas))
def test_quota_list_volume_no_project(self):
# Two projects with non-default quotas
self.volume.quotas.get = mock.Mock(
side_effect=[
self.volume_quotas[0],
volume_fakes.FakeQuota.create_one_default_vol_quota(),
],
)
arglist = [
'--volume',
]
verifylist = [
('volume', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
ret_quotas = list(data)
self.assertEqual(self.volume_column_header, columns)
self.assertEqual(self.volume_reference_data, ret_quotas[0])
self.assertEqual(1, len(ret_quotas))
class TestQuotaSet(TestQuota):
def setUp(self):
super(TestQuotaSet, self).setUp()
self.compute_quotas_mock.update.return_value = FakeQuotaResource(
None,
copy.deepcopy(compute_fakes.QUOTA),
loaded=True,
)
self.compute_quotas_class_mock.update.return_value = FakeQuotaResource(
None,
copy.deepcopy(compute_fakes.QUOTA),
loaded=True,
)
self.volume_quotas_mock.update.return_value = FakeQuotaResource(
None,
copy.deepcopy(compute_fakes.QUOTA),
loaded=True,
)
self.volume_quotas_class_mock.update.return_value = FakeQuotaResource(
None,
copy.deepcopy(compute_fakes.QUOTA),
loaded=True,
)
self.network_mock = self.app.client_manager.network
self.network_mock.update_quota = mock.Mock()
self.cmd = quota.SetQuota(self.app, None)
def test_quota_set(self):
arglist = [
'--floating-ips', str(compute_fakes.floating_ip_num),
'--fixed-ips', str(compute_fakes.fix_ip_num),
'--injected-files', str(compute_fakes.injected_file_num),
'--injected-file-size', str(compute_fakes.injected_file_size_num),
'--injected-path-size', str(compute_fakes.injected_path_size_num),
'--key-pairs', str(compute_fakes.key_pair_num),
'--cores', str(compute_fakes.core_num),
'--ram', str(compute_fakes.ram_num),
'--instances', str(compute_fakes.instance_num),
'--properties', str(compute_fakes.property_num),
'--secgroup-rules', str(compute_fakes.secgroup_rule_num),
'--secgroups', str(compute_fakes.secgroup_num),
'--server-groups', str(compute_fakes.servgroup_num),
'--server-group-members', str(compute_fakes.servgroup_members_num),
self.projects[0].name,
]
verifylist = [
('floating_ips', compute_fakes.floating_ip_num),
('fixed_ips', compute_fakes.fix_ip_num),
('injected_files', compute_fakes.injected_file_num),
('injected_file_content_bytes',
compute_fakes.injected_file_size_num),
('injected_file_path_bytes', compute_fakes.injected_path_size_num),
('key_pairs', compute_fakes.key_pair_num),
('cores', compute_fakes.core_num),
('ram', compute_fakes.ram_num),
('instances', compute_fakes.instance_num),
('metadata_items', compute_fakes.property_num),
('security_group_rules', compute_fakes.secgroup_rule_num),
('security_groups', compute_fakes.secgroup_num),
('server_groups', compute_fakes.servgroup_num),
('server_group_members', compute_fakes.servgroup_members_num),
('project', self.projects[0].name),
]
self.app.client_manager.network_endpoint_enabled = False
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args)
kwargs = {
'floating_ips': compute_fakes.floating_ip_num,
'fixed_ips': compute_fakes.fix_ip_num,
'injected_files': compute_fakes.injected_file_num,
'injected_file_content_bytes':
compute_fakes.injected_file_size_num,
'injected_file_path_bytes': compute_fakes.injected_path_size_num,
'key_pairs': compute_fakes.key_pair_num,
'cores': compute_fakes.core_num,
'ram': compute_fakes.ram_num,
'instances': compute_fakes.instance_num,
'metadata_items': compute_fakes.property_num,
'security_group_rules': compute_fakes.secgroup_rule_num,
'security_groups': compute_fakes.secgroup_num,
'server_groups': compute_fakes.servgroup_num,
'server_group_members': compute_fakes.servgroup_members_num,
}
self.compute_quotas_mock.update.assert_called_once_with(
self.projects[0].id,
**kwargs
)
self.assertIsNone(result)
def test_quota_set_volume(self):
arglist = [
'--gigabytes', str(volume_fakes.QUOTA['gigabytes']),
'--snapshots', str(volume_fakes.QUOTA['snapshots']),
'--volumes', str(volume_fakes.QUOTA['volumes']),
'--backups', str(volume_fakes.QUOTA['backups']),
'--backup-gigabytes', str(volume_fakes.QUOTA['backup_gigabytes']),
'--per-volume-gigabytes',
str(volume_fakes.QUOTA['per_volume_gigabytes']),
self.projects[0].name,
]
verifylist = [
('gigabytes', volume_fakes.QUOTA['gigabytes']),
('snapshots', volume_fakes.QUOTA['snapshots']),
('volumes', volume_fakes.QUOTA['volumes']),
('backups', volume_fakes.QUOTA['backups']),
('backup_gigabytes', volume_fakes.QUOTA['backup_gigabytes']),
('per_volume_gigabytes',
volume_fakes.QUOTA['per_volume_gigabytes']),
('project', self.projects[0].name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args)
kwargs = {
'gigabytes': volume_fakes.QUOTA['gigabytes'],
'snapshots': volume_fakes.QUOTA['snapshots'],
'volumes': volume_fakes.QUOTA['volumes'],
'backups': volume_fakes.QUOTA['backups'],
'backup_gigabytes': volume_fakes.QUOTA['backup_gigabytes'],
'per_volume_gigabytes': volume_fakes.QUOTA['per_volume_gigabytes']
}
self.volume_quotas_mock.update.assert_called_once_with(
self.projects[0].id,
**kwargs
)
self.assertIsNone(result)
def test_quota_set_volume_with_volume_type(self):
arglist = [
'--gigabytes', str(volume_fakes.QUOTA['gigabytes']),
'--snapshots', str(volume_fakes.QUOTA['snapshots']),
'--volumes', str(volume_fakes.QUOTA['volumes']),
'--backups', str(volume_fakes.QUOTA['backups']),
'--backup-gigabytes', str(volume_fakes.QUOTA['backup_gigabytes']),
'--per-volume-gigabytes',
str(volume_fakes.QUOTA['per_volume_gigabytes']),
'--volume-type', 'volume_type_backend',
self.projects[0].name,
]
verifylist = [
('gigabytes', volume_fakes.QUOTA['gigabytes']),
('snapshots', volume_fakes.QUOTA['snapshots']),
('volumes', volume_fakes.QUOTA['volumes']),
('backups', volume_fakes.QUOTA['backups']),
('backup_gigabytes', volume_fakes.QUOTA['backup_gigabytes']),
('per_volume_gigabytes',
volume_fakes.QUOTA['per_volume_gigabytes']),
('volume_type', 'volume_type_backend'),
('project', self.projects[0].name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args)
kwargs = {
'gigabytes_volume_type_backend': volume_fakes.QUOTA['gigabytes'],
'snapshots_volume_type_backend': volume_fakes.QUOTA['snapshots'],
'volumes_volume_type_backend': volume_fakes.QUOTA['volumes'],
'backups': volume_fakes.QUOTA['backups'],
'backup_gigabytes': volume_fakes.QUOTA['backup_gigabytes'],
'per_volume_gigabytes': volume_fakes.QUOTA['per_volume_gigabytes']
}
self.volume_quotas_mock.update.assert_called_once_with(
self.projects[0].id,
**kwargs
)
self.assertIsNone(result)
def test_quota_set_network(self):
arglist = [
'--subnets', str(network_fakes.QUOTA['subnet']),
'--networks', str(network_fakes.QUOTA['network']),
'--floating-ips', str(network_fakes.QUOTA['floatingip']),
'--subnetpools', str(network_fakes.QUOTA['subnetpool']),
'--secgroup-rules',
str(network_fakes.QUOTA['security_group_rule']),
'--secgroups', str(network_fakes.QUOTA['security_group']),
'--routers', str(network_fakes.QUOTA['router']),
'--rbac-policies', str(network_fakes.QUOTA['rbac_policy']),
'--ports', str(network_fakes.QUOTA['port']),
self.projects[0].name,
]
verifylist = [
('subnet', network_fakes.QUOTA['subnet']),
('network', network_fakes.QUOTA['network']),
('floatingip', network_fakes.QUOTA['floatingip']),
('subnetpool', network_fakes.QUOTA['subnetpool']),
('security_group_rule',
network_fakes.QUOTA['security_group_rule']),
('security_group', network_fakes.QUOTA['security_group']),
('router', network_fakes.QUOTA['router']),
('rbac_policy', network_fakes.QUOTA['rbac_policy']),
('port', network_fakes.QUOTA['port']),
('project', self.projects[0].name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args)
kwargs = {
'subnet': network_fakes.QUOTA['subnet'],
'network': network_fakes.QUOTA['network'],
'floatingip': network_fakes.QUOTA['floatingip'],
'subnetpool': network_fakes.QUOTA['subnetpool'],
'security_group_rule':
network_fakes.QUOTA['security_group_rule'],
'security_group': network_fakes.QUOTA['security_group'],
'router': network_fakes.QUOTA['router'],
'rbac_policy': network_fakes.QUOTA['rbac_policy'],
'port': network_fakes.QUOTA['port'],
}
self.network_mock.update_quota.assert_called_once_with(
self.projects[0].id,
**kwargs
)
self.assertIsNone(result)
def test_quota_set_with_class(self):
arglist = [
'--injected-files', str(compute_fakes.injected_file_num),
'--injected-file-size', str(compute_fakes.injected_file_size_num),
'--injected-path-size', str(compute_fakes.injected_path_size_num),
'--key-pairs', str(compute_fakes.key_pair_num),
'--cores', str(compute_fakes.core_num),
'--ram', str(compute_fakes.ram_num),
'--instances', str(compute_fakes.instance_num),
'--properties', str(compute_fakes.property_num),
'--server-groups', str(compute_fakes.servgroup_num),
'--server-group-members', str(compute_fakes.servgroup_members_num),
'--gigabytes', str(compute_fakes.floating_ip_num),
'--snapshots', str(compute_fakes.fix_ip_num),
'--volumes', str(volume_fakes.QUOTA['volumes']),
'--network', str(network_fakes.QUOTA['network']),
'--class',
self.projects[0].name,
]
verifylist = [
('injected_files', compute_fakes.injected_file_num),
('injected_file_content_bytes',
compute_fakes.injected_file_size_num),
('injected_file_path_bytes', compute_fakes.injected_path_size_num),
('key_pairs', compute_fakes.key_pair_num),
('cores', compute_fakes.core_num),
('ram', compute_fakes.ram_num),
('instances', compute_fakes.instance_num),
('metadata_items', compute_fakes.property_num),
('server_groups', compute_fakes.servgroup_num),
('server_group_members', compute_fakes.servgroup_members_num),
('gigabytes', compute_fakes.floating_ip_num),
('snapshots', compute_fakes.fix_ip_num),
('volumes', volume_fakes.QUOTA['volumes']),
('network', network_fakes.QUOTA['network']),
('quota_class', True),
('project', self.projects[0].name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args)
kwargs_compute = {
'injected_files': compute_fakes.injected_file_num,
'injected_file_content_bytes':
compute_fakes.injected_file_size_num,
'injected_file_path_bytes': compute_fakes.injected_path_size_num,
'key_pairs': compute_fakes.key_pair_num,
'cores': compute_fakes.core_num,
'ram': compute_fakes.ram_num,
'instances': compute_fakes.instance_num,
'metadata_items': compute_fakes.property_num,
'server_groups': compute_fakes.servgroup_num,
'server_group_members': compute_fakes.servgroup_members_num,
}
kwargs_volume = {
'gigabytes': compute_fakes.floating_ip_num,
'snapshots': compute_fakes.fix_ip_num,
'volumes': volume_fakes.QUOTA['volumes'],
}
self.compute_quotas_class_mock.update.assert_called_with(
self.projects[0].name,
**kwargs_compute
)
self.volume_quotas_class_mock.update.assert_called_with(
self.projects[0].name,
**kwargs_volume
)
self.assertNotCalled(self.network_mock.update_quota)
self.assertIsNone(result)
class TestQuotaShow(TestQuota):
def setUp(self):
super(TestQuotaShow, self).setUp()
self.compute_quota = compute_fakes.FakeQuota.create_one_comp_quota()
self.compute_quotas_mock.get.return_value = self.compute_quota
self.compute_default_quota = \
compute_fakes.FakeQuota.create_one_default_comp_quota()
self.compute_quotas_mock.defaults.return_value = \
self.compute_default_quota
self.compute_quotas_class_mock.get.return_value = FakeQuotaResource(
None,
copy.deepcopy(compute_fakes.QUOTA),
loaded=True,
)
self.volume_quota = volume_fakes.FakeQuota.create_one_vol_quota()
self.volume_quotas_mock.get.return_value = self.volume_quota
self.volume_default_quota = \
volume_fakes.FakeQuota.create_one_default_vol_quota()
self.volume_quotas_mock.defaults.return_value = \
self.volume_default_quota
self.volume_quotas_class_mock.get.return_value = FakeQuotaResource(
None,
copy.deepcopy(volume_fakes.QUOTA),
loaded=True,
)
fake_network_endpoint = fakes.FakeResource(
None,
copy.deepcopy(identity_fakes.ENDPOINT),
loaded=True,
)
self.service_catalog_mock.get_endpoints.return_value = {
'network': fake_network_endpoint
}
self.app.client_manager.network = network_fakes.FakeNetworkV2Client(
endpoint=fakes.AUTH_URL,
token=fakes.AUTH_TOKEN,
)
self.network = self.app.client_manager.network
self.network.get_quota = mock.Mock(
return_value=network_fakes.QUOTA,
)
self.network.get_quota_default = mock.Mock(
return_value=network_fakes.QUOTA,
)
self.cmd = quota.ShowQuota(self.app, None)
def test_quota_show(self):
arglist = [
self.projects[0].name,
]
verifylist = [
('project', self.projects[0].name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args)
self.compute_quotas_mock.get.assert_called_once_with(
self.projects[0].id, detail=False
)
self.volume_quotas_mock.get.assert_called_once_with(
self.projects[0].id,
)
self.network.get_quota.assert_called_once_with(
self.projects[0].id, details=False
)
self.assertNotCalled(self.network.get_quota_default)
def test_quota_show_with_default(self):
arglist = [
'--default',
self.projects[0].name,
]
verifylist = [
('default', True),
('project', self.projects[0].name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args)
self.compute_quotas_mock.defaults.assert_called_once_with(
self.projects[0].id,
)
self.volume_quotas_mock.defaults.assert_called_once_with(
self.projects[0].id,
)
self.network.get_quota_default.assert_called_once_with(
self.projects[0].id,
)
self.assertNotCalled(self.network.get_quota)
def test_quota_show_with_class(self):
arglist = [
'--class',
self.projects[0].name,
]
verifylist = [
('quota_class', True),
('project', self.projects[0].name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args)
self.compute_quotas_class_mock.get.assert_called_once_with(
self.projects[0].name,
)
self.volume_quotas_class_mock.get.assert_called_once_with(
self.projects[0].name,
)
self.assertNotCalled(self.network.get_quota)
self.assertNotCalled(self.network.get_quota_default)
def test_quota_show_no_project(self):
parsed_args = self.check_parser(self.cmd, [], [])
self.cmd.take_action(parsed_args)
self.compute_quotas_mock.get.assert_called_once_with(
identity_fakes.project_id, detail=False
)
self.volume_quotas_mock.get.assert_called_once_with(
identity_fakes.project_id,
)
self.network.get_quota.assert_called_once_with(
identity_fakes.project_id, details=False
)
self.assertNotCalled(self.network.get_quota_default)
| 36.286303
| 79
| 0.611199
| 3,796
| 35,234
| 5.363014
| 0.068757
| 0.054819
| 0.031437
| 0.024855
| 0.81005
| 0.757393
| 0.700216
| 0.668681
| 0.642745
| 0.628009
| 0
| 0.004142
| 0.280553
| 35,234
| 970
| 80
| 36.323711
| 0.798966
| 0.031021
| 0
| 0.524044
| 0
| 0
| 0.101258
| 0.011052
| 0
| 0
| 0
| 0
| 0.077682
| 1
| 0.036991
| false
| 0
| 0.01233
| 0.001233
| 0.062885
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
464bf9c2bd90d28c4a59f439cb93b4cbbca0ea68
| 93
|
py
|
Python
|
situs/jualtiket/apps.py
|
torikwer/django-penj-tiket
|
846ef20d74700f798922f2364df7736b5e41bb82
|
[
"MIT"
] | null | null | null |
situs/jualtiket/apps.py
|
torikwer/django-penj-tiket
|
846ef20d74700f798922f2364df7736b5e41bb82
|
[
"MIT"
] | null | null | null |
situs/jualtiket/apps.py
|
torikwer/django-penj-tiket
|
846ef20d74700f798922f2364df7736b5e41bb82
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class JualtiketConfig(AppConfig):
name = 'jualtiket'
| 15.5
| 33
| 0.763441
| 10
| 93
| 7.1
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.16129
| 93
| 5
| 34
| 18.6
| 0.910256
| 0
| 0
| 0
| 0
| 0
| 0.096774
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
46597193ce6ad827ece1d139f1b90548a7405219
| 200
|
py
|
Python
|
bookmarks/common/utils.py
|
mp5maker/django
|
a2d38e2e9973e755afce1bd0ccb17e58f3db7e33
|
[
"MIT"
] | null | null | null |
bookmarks/common/utils.py
|
mp5maker/django
|
a2d38e2e9973e755afce1bd0ccb17e58f3db7e33
|
[
"MIT"
] | 13
|
2020-02-12T00:14:20.000Z
|
2022-02-10T08:46:42.000Z
|
bookmarks/common/utils.py
|
mp5maker/django
|
a2d38e2e9973e755afce1bd0ccb17e58f3db7e33
|
[
"MIT"
] | null | null | null |
from django.conf import settings
import redis
def redis_cache():
return redis.StrictRedis(
host=settings.REDIS_HOST,
port=settings.REDIS_PORT,
db=settings.REDIS_DB
)
| 18.181818
| 33
| 0.685
| 25
| 200
| 5.32
| 0.52
| 0.293233
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.24
| 200
| 10
| 34
| 20
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.125
| true
| 0
| 0.25
| 0.125
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
46686e05640bc79046c5454375212624714448e4
| 125
|
bzl
|
Python
|
test/implementation_deps/aspect.bzl
|
Vertexwahn/depend_on_what_you_use
|
480732677a74fb7033848004d4d5015af0ad36c5
|
[
"MIT"
] | 8
|
2022-03-08T06:27:38.000Z
|
2022-03-20T21:21:43.000Z
|
test/implementation_deps/aspect.bzl
|
Vertexwahn/depend_on_what_you_use
|
480732677a74fb7033848004d4d5015af0ad36c5
|
[
"MIT"
] | 11
|
2022-03-17T18:53:02.000Z
|
2022-03-28T21:15:02.000Z
|
test/implementation_deps/aspect.bzl
|
Vertexwahn/depend_on_what_you_use
|
480732677a74fb7033848004d4d5015af0ad36c5
|
[
"MIT"
] | 1
|
2022-03-08T06:27:43.000Z
|
2022-03-08T06:27:43.000Z
|
load("//:defs.bzl", "dwyu_aspect_factory")
implementation_deps_aspect = dwyu_aspect_factory(use_implementation_deps = True)
| 31.25
| 80
| 0.816
| 16
| 125
| 5.875
| 0.625
| 0.212766
| 0.361702
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.064
| 125
| 3
| 81
| 41.666667
| 0.803419
| 0
| 0
| 0
| 0
| 0
| 0.24
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
46758b805ec12e12c3e6e78a3d6027161ecc2756
| 199
|
py
|
Python
|
pixplot/__init__.py
|
invisiblearchitects/pix-plot
|
a3364810adf6a5c9cbd35bb35baca23707e61c70
|
[
"MIT"
] | 405
|
2017-12-22T16:34:26.000Z
|
2022-03-17T08:02:52.000Z
|
pixplot/__init__.py
|
invisiblearchitects/pix-plot
|
a3364810adf6a5c9cbd35bb35baca23707e61c70
|
[
"MIT"
] | 125
|
2017-12-13T20:10:51.000Z
|
2022-03-22T20:53:59.000Z
|
pixplot/__init__.py
|
invisiblearchitects/pix-plot
|
a3364810adf6a5c9cbd35bb35baca23707e61c70
|
[
"MIT"
] | 120
|
2017-12-19T18:18:31.000Z
|
2022-03-29T20:42:51.000Z
|
from __future__ import absolute_import
from pixplot.pixplot import process_images, parse
# specify version number
import pkg_resources
__version__ = pkg_resources.get_distribution('pixplot').version
| 33.166667
| 63
| 0.859296
| 25
| 199
| 6.32
| 0.6
| 0.151899
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.090452
| 199
| 6
| 63
| 33.166667
| 0.872928
| 0.110553
| 0
| 0
| 0
| 0
| 0.039773
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.75
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
4696983ee9d02319104bc75a60f9280643b60f20
| 359
|
py
|
Python
|
admin.py
|
SyntaxBlitz/bridie
|
e363bbf55038874f89fdea7f44b8ff790460ed85
|
[
"MIT"
] | null | null | null |
admin.py
|
SyntaxBlitz/bridie
|
e363bbf55038874f89fdea7f44b8ff790460ed85
|
[
"MIT"
] | null | null | null |
admin.py
|
SyntaxBlitz/bridie
|
e363bbf55038874f89fdea7f44b8ff790460ed85
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from mysite.bridie.models import User, Post, Comment
# Register your models here.
class UserAdmin(admin.ModelAdmin):
pass
class PostAdmin(admin.ModelAdmin):
pass
class CommentAdmin(admin.ModelAdmin):
pass
admin.site.register(User, UserAdmin)
admin.site.register(Post, PostAdmin)
admin.site.register(Comment, CommentAdmin)
| 25.642857
| 52
| 0.810585
| 47
| 359
| 6.191489
| 0.446809
| 0.154639
| 0.195876
| 0.164948
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.094708
| 359
| 13
| 53
| 27.615385
| 0.895385
| 0.072423
| 0
| 0.272727
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.272727
| 0.181818
| 0
| 0.454545
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
469cf7055b3a2338d20b98e05b0bd3e9028c393b
| 1,246
|
py
|
Python
|
processing/dbconnfactory.py
|
paganellif/sctm-project-paganelli-2021
|
810d9a82c653db8ec9db117c57f35b64cc14aaaf
|
[
"MIT"
] | null | null | null |
processing/dbconnfactory.py
|
paganellif/sctm-project-paganelli-2021
|
810d9a82c653db8ec9db117c57f35b64cc14aaaf
|
[
"MIT"
] | null | null | null |
processing/dbconnfactory.py
|
paganellif/sctm-project-paganelli-2021
|
810d9a82c653db8ec9db117c57f35b64cc14aaaf
|
[
"MIT"
] | null | null | null |
from processing.dbconnectorimpl import *
class DBConnAbstractFactory(ABC):
@abstractmethod
def create_manager_db_connector(self) -> DBManagerConnector:
"""
:return:
"""
pass
@abstractmethod
def create_trigger_db_connector(self) -> DBTriggerConnector:
"""
:return:
"""
pass
@abstractmethod
def create_statistics_db_connector(self) -> DBStatisticsConnector:
"""
:return:
"""
pass
@abstractmethod
def create_front_end_db_connector(self) -> DBFrontEndConnector:
"""
:return:
"""
pass
class DBConnFactory(DBConnAbstractFactory):
def create_manager_db_connector(self) -> DBManagerConnector:
return DBManagerConnectorImpl(cfg.database["dbmanager_url"])
def create_trigger_db_connector(self) -> DBTriggerConnector:
return DBTriggerConnectorImpl(cfg.database["trigger_url"])
def create_statistics_db_connector(self) -> DBStatisticsConnector:
return DBStatisticsConnectorImpl(cfg.database["statistics_url"])
def create_front_end_db_connector(self) -> DBFrontEndConnector:
return DBFrontEndConnectorImpl(cfg.database["frontend_url"])
| 24.431373
| 72
| 0.676565
| 104
| 1,246
| 7.817308
| 0.326923
| 0.088561
| 0.147601
| 0.099631
| 0.627306
| 0.560886
| 0.560886
| 0.560886
| 0.140221
| 0
| 0
| 0
| 0.233547
| 1,246
| 50
| 73
| 24.92
| 0.851309
| 0.02809
| 0
| 0.695652
| 0
| 0
| 0.044883
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.347826
| false
| 0.173913
| 0.043478
| 0.173913
| 0.652174
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
46a6dc0ba69e186f68a42a6a2049d2dc327b2695
| 163
|
py
|
Python
|
djangoProject/myapp/forms.py
|
logikonabstractions/django_tplt_dockerized
|
8f35d78f3c5bff0af2d9b8c3bfaba7dc60413cd3
|
[
"MIT"
] | null | null | null |
djangoProject/myapp/forms.py
|
logikonabstractions/django_tplt_dockerized
|
8f35d78f3c5bff0af2d9b8c3bfaba7dc60413cd3
|
[
"MIT"
] | null | null | null |
djangoProject/myapp/forms.py
|
logikonabstractions/django_tplt_dockerized
|
8f35d78f3c5bff0af2d9b8c3bfaba7dc60413cd3
|
[
"MIT"
] | null | null | null |
from django import forms
from .models import ImageModel
class UploadForm(forms.ModelForm):
class Meta:
model = ImageModel
fields = ('file',)
| 18.111111
| 34
| 0.674847
| 18
| 163
| 6.111111
| 0.722222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.245399
| 163
| 8
| 35
| 20.375
| 0.894309
| 0
| 0
| 0
| 0
| 0
| 0.024691
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
d3bb1be867a978d871e1dc24d49e8afeb4de7708
| 599
|
py
|
Python
|
src/secWrap.py
|
fausecteam/faustctf-2017-tempsense
|
52ccf4654a8a430c976ded0ba9149b234e8f420a
|
[
"ISC"
] | null | null | null |
src/secWrap.py
|
fausecteam/faustctf-2017-tempsense
|
52ccf4654a8a430c976ded0ba9149b234e8f420a
|
[
"ISC"
] | null | null | null |
src/secWrap.py
|
fausecteam/faustctf-2017-tempsense
|
52ccf4654a8a430c976ded0ba9149b234e8f420a
|
[
"ISC"
] | 1
|
2018-09-23T19:15:25.000Z
|
2018-09-23T19:15:25.000Z
|
from subprocess import check_output
ENCODING = 'utf-8'
def generate_key_pair():
output = check_output(['./secure', '-g']).decode(ENCODING)
public_key = output.split('-----END PUBLIC KEY-----')[0] + '-----END PUBLIC KEY-----'
private_key = output.split('-----END PUBLIC KEY-----')[1].lstrip('\n')
return private_key, public_key
def encrypt(key, file):
return check_output(['./secure -k "{}" -e "{}"'.format(key, file)], shell=True).decode(ENCODING)
def decrypt(key, file):
return check_output(['./secure -k "{}" -d "{}"'.format(key, file)], shell=True).decode(ENCODING)
| 33.277778
| 100
| 0.627713
| 79
| 599
| 4.632911
| 0.417722
| 0.122951
| 0.139344
| 0.092896
| 0.508197
| 0.508197
| 0.36612
| 0
| 0
| 0
| 0
| 0.005803
| 0.136895
| 599
| 17
| 101
| 35.235294
| 0.702128
| 0
| 0
| 0
| 1
| 0
| 0.228715
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.272727
| false
| 0
| 0.090909
| 0.181818
| 0.636364
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
d3ceecdba4e43dcf6b4429f7ae41b1e50e3813c2
| 79
|
py
|
Python
|
custom_errors.py
|
LincT/PythonExamples
|
a0b61e8c60cd0754f2406b6b72fcd562667c9bb0
|
[
"MIT"
] | null | null | null |
custom_errors.py
|
LincT/PythonExamples
|
a0b61e8c60cd0754f2406b6b72fcd562667c9bb0
|
[
"MIT"
] | null | null | null |
custom_errors.py
|
LincT/PythonExamples
|
a0b61e8c60cd0754f2406b6b72fcd562667c9bb0
|
[
"MIT"
] | null | null | null |
class NameTooShortError(ValueError):
pass
raise NameTooShortError("foo")
| 13.166667
| 36
| 0.772152
| 7
| 79
| 8.714286
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.139241
| 79
| 5
| 37
| 15.8
| 0.897059
| 0
| 0
| 0
| 0
| 0
| 0.037975
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.333333
| 0
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
d3d3b2d097890f412754763758219e5ccb3d29f8
| 93
|
py
|
Python
|
python/491.increasing-subsequences.py
|
stavanmehta/leetcode
|
1224e43ce29430c840e65daae3b343182e24709c
|
[
"Apache-2.0"
] | null | null | null |
python/491.increasing-subsequences.py
|
stavanmehta/leetcode
|
1224e43ce29430c840e65daae3b343182e24709c
|
[
"Apache-2.0"
] | null | null | null |
python/491.increasing-subsequences.py
|
stavanmehta/leetcode
|
1224e43ce29430c840e65daae3b343182e24709c
|
[
"Apache-2.0"
] | null | null | null |
class Solution:
def findSubsequences(self, nums: List[int]) -> List[List[int]]:
| 23.25
| 67
| 0.623656
| 11
| 93
| 5.272727
| 0.727273
| 0.241379
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.225806
| 93
| 3
| 68
| 31
| 0.805556
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
3101b3084e66d4c8bf1b6330b295cf7b01c898db
| 19
|
py
|
Python
|
src/kalam/parsers/base.py
|
AnkCorp/kalam
|
6ba5b9dfcd20a8e57eaa1942f3d2650f3579dc0c
|
[
"MIT"
] | null | null | null |
src/kalam/parsers/base.py
|
AnkCorp/kalam
|
6ba5b9dfcd20a8e57eaa1942f3d2650f3579dc0c
|
[
"MIT"
] | null | null | null |
src/kalam/parsers/base.py
|
AnkCorp/kalam
|
6ba5b9dfcd20a8e57eaa1942f3d2650f3579dc0c
|
[
"MIT"
] | null | null | null |
"""Base parser."""
| 9.5
| 18
| 0.526316
| 2
| 19
| 5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 19
| 1
| 19
| 19
| 0.588235
| 0.631579
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
3132f82fd8df9657acd829150df2d60b246de33a
| 228
|
py
|
Python
|
sorting/insertionSort.py
|
saketvikram/algorithms-ds-in-python
|
8b100182df8fcc4350b2458f2148481c7e0fb043
|
[
"MIT"
] | null | null | null |
sorting/insertionSort.py
|
saketvikram/algorithms-ds-in-python
|
8b100182df8fcc4350b2458f2148481c7e0fb043
|
[
"MIT"
] | null | null | null |
sorting/insertionSort.py
|
saketvikram/algorithms-ds-in-python
|
8b100182df8fcc4350b2458f2148481c7e0fb043
|
[
"MIT"
] | null | null | null |
def insertionSort(array):
for i in range(1, len(array)):
j = i
while j > 0 and array[j] < array[ j - 1]:
swap(j, j - 1, array)
j -= 1
return array
def swap(i, j, array):
array[i], array[j] = array[j], array[i]
| 22.8
| 43
| 0.565789
| 43
| 228
| 3
| 0.348837
| 0.27907
| 0.255814
| 0.186047
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.029412
| 0.254386
| 228
| 10
| 44
| 22.8
| 0.729412
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
31865532c16a9dde112b48976332e0db2af46371
| 402
|
py
|
Python
|
robot_stub/Bot.py
|
jernaumorat/IntelligentPantry
|
33d1ee867a5b6e0169fb44918069fbec5bfde259
|
[
"MIT"
] | null | null | null |
robot_stub/Bot.py
|
jernaumorat/IntelligentPantry
|
33d1ee867a5b6e0169fb44918069fbec5bfde259
|
[
"MIT"
] | null | null | null |
robot_stub/Bot.py
|
jernaumorat/IntelligentPantry
|
33d1ee867a5b6e0169fb44918069fbec5bfde259
|
[
"MIT"
] | 1
|
2021-11-11T09:25:34.000Z
|
2021-11-11T09:25:34.000Z
|
from abc import ABC, abstractmethod
class Bot(ABC):
@abstractmethod
def moveTo(self , x , y):
pass
# get robot camera image of pantry
@abstractmethod
def getImage(self):
pass
# scan pantry
@abstractmethod
def scan(self):
pass
# system state scan /idle date and time
@abstractmethod
def updateStatus(self):
pass
| 19.142857
| 43
| 0.597015
| 45
| 402
| 5.333333
| 0.6
| 0.283333
| 0.191667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.338308
| 402
| 21
| 44
| 19.142857
| 0.902256
| 0.20398
| 0
| 0.571429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0.285714
| 0.071429
| 0
| 0.428571
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
318f0188b22d3b4873dbabd32ffd6b1a50e8460e
| 88
|
py
|
Python
|
blog/admin.py
|
KaptanSingh2020/pyblog
|
5b0af8dce4b1c324f0384f27f7331c156e9ad51e
|
[
"MIT"
] | 1
|
2016-04-04T11:49:26.000Z
|
2016-04-04T11:49:26.000Z
|
blog/admin.py
|
KaptanSingh2020/pyblog
|
5b0af8dce4b1c324f0384f27f7331c156e9ad51e
|
[
"MIT"
] | null | null | null |
blog/admin.py
|
KaptanSingh2020/pyblog
|
5b0af8dce4b1c324f0384f27f7331c156e9ad51e
|
[
"MIT"
] | 3
|
2021-08-10T19:00:18.000Z
|
2021-08-11T00:53:09.000Z
|
from django.contrib import admin
from blog.models import Post
admin.site.register(Post)
| 22
| 32
| 0.829545
| 14
| 88
| 5.214286
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.102273
| 88
| 4
| 33
| 22
| 0.924051
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
31a8a69f73306fdf3fb0a3453760dcdb363b3a65
| 1,941
|
py
|
Python
|
application/controller.py
|
THTatsuishi/finite-group-analyzer
|
fc8d4174849196ae81a3063eb67623857df01f58
|
[
"MIT"
] | 2
|
2021-01-28T04:46:11.000Z
|
2021-09-18T19:35:18.000Z
|
application/controller.py
|
THTatsuishi/finite-group-analyzer
|
fc8d4174849196ae81a3063eb67623857df01f58
|
[
"MIT"
] | 1
|
2021-02-13T13:06:45.000Z
|
2021-02-13T14:12:04.000Z
|
application/controller.py
|
THTatsuishi/finite-group-analyzer
|
fc8d4174849196ae81a3063eb67623857df01f58
|
[
"MIT"
] | null | null | null |
"""
アプリ制御用のモジュール。
"""
from abc import ABCMeta
from abc import abstractmethod
class Controller(metaclass = ABCMeta):
"""
コントローラー。
画面部分や計算部分をつなぐための抽象クラス。
"""
@abstractmethod
def message(self, text: str):
"""
メッセージを表示。
Parameters
----------
text : str
DESCRIPTION.
Returns
-------
None.
"""
pass
@abstractmethod
def calc_start(self, text: str):
"""
計算の開始を把握するためのメソッド。
Parameters
----------
text : str
計算開始を表す文章。
Returns
-------
None.
"""
pass
@abstractmethod
def calc_progress(self, text: str):
"""
主に時間のかかる計算の進捗を把握するためのメソッド。
Parameters
----------
text : str
計算の進捗を表す文章。
Returns
-------
None.
"""
pass
@abstractmethod
def calc_end(self, text: str):
"""
計算の終了を把握するためのメソッド。
Parameters
----------
text : str
計算終了を表す文章。
Returns
-------
None.
"""
pass
class NullController(Controller):
"""
コントローラーを指定しない場合に用いるダミーのコントローラー。
何の機能も持たない。
"""
def calc_start(self, text: str):
pass
def calc_progress(self, text: str):
pass
def calc_end(self, text: str):
pass
class ConsoleController(Controller):
"""
コンソール出力のみを扱うコントローラー。
"""
def message(self, text: str):
print(text)
def calc_start(self, text: str):
print(text)
def calc_progress(self, text: str):
print("\r"+text,end ="")
def calc_end(self, text: str):
print("\n"+text)
class APPController(Controller):
"""
アプリケーションを制御するためのコントローラー。
"""
def calc_progress(self, text: str):
print(text)
| 16.310924
| 39
| 0.478104
| 150
| 1,941
| 6.12
| 0.28
| 0.122004
| 0.143791
| 0.087146
| 0.441176
| 0.40305
| 0.118736
| 0
| 0
| 0
| 0
| 0
| 0.396188
| 1,941
| 118
| 40
| 16.449153
| 0.783276
| 0.257599
| 0
| 0.764706
| 0
| 0
| 0.00391
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.352941
| false
| 0.205882
| 0.058824
| 0
| 0.529412
| 0.147059
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 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
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
31ae318ab673e4a6f8c6ada9eed9e00dc2f89382
| 107
|
py
|
Python
|
__init__.py
|
arjun-namdeo/logIO
|
3bb06c0d7d0a45486bc2c82900fb116d8d75fb4c
|
[
"MIT"
] | null | null | null |
__init__.py
|
arjun-namdeo/logIO
|
3bb06c0d7d0a45486bc2c82900fb116d8d75fb4c
|
[
"MIT"
] | null | null | null |
__init__.py
|
arjun-namdeo/logIO
|
3bb06c0d7d0a45486bc2c82900fb116d8d75fb4c
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Custom Logging IO
"""
from logIO.setupLogging import *
| 11.888889
| 32
| 0.626168
| 14
| 107
| 4.785714
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011236
| 0.168224
| 107
| 8
| 33
| 13.375
| 0.741573
| 0.560748
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
31cf7aca33008871bbf01f7814a2cf99f7be749f
| 214
|
py
|
Python
|
simple_discrete_game/simple_discrete_game/__init__.py
|
sen-pai/pygame2gym
|
1c8bc1422c1f3fb80054e77c03362e7eca2ef461
|
[
"MIT"
] | 1
|
2020-11-04T18:02:13.000Z
|
2020-11-04T18:02:13.000Z
|
simple_discrete_game/simple_discrete_game/__init__.py
|
sen-pai/pygame2gym
|
1c8bc1422c1f3fb80054e77c03362e7eca2ef461
|
[
"MIT"
] | null | null | null |
simple_discrete_game/simple_discrete_game/__init__.py
|
sen-pai/pygame2gym
|
1c8bc1422c1f3fb80054e77c03362e7eca2ef461
|
[
"MIT"
] | null | null | null |
from gym.envs.registration import register
register(id="GoalGrid-v0", entry_point="simple_discrete_game.envs:GoalGridEnv")
# register(id="BubbleShooter-v0", entry_point="gym_bubbleshooter.envs:BubbleShooterEnv")
| 35.666667
| 88
| 0.82243
| 27
| 214
| 6.333333
| 0.62963
| 0.116959
| 0.140351
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009852
| 0.051402
| 214
| 5
| 89
| 42.8
| 0.832512
| 0.401869
| 0
| 0
| 0
| 0
| 0.380952
| 0.293651
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
31e4c30873b6505cec7ea8b9facb2088275994cd
| 252
|
py
|
Python
|
app/forms.py
|
natcowan/pairify
|
3855f1c91aee19b294faed4fe3f479804dda3067
|
[
"MIT"
] | null | null | null |
app/forms.py
|
natcowan/pairify
|
3855f1c91aee19b294faed4fe3f479804dda3067
|
[
"MIT"
] | null | null | null |
app/forms.py
|
natcowan/pairify
|
3855f1c91aee19b294faed4fe3f479804dda3067
|
[
"MIT"
] | null | null | null |
from flask_wtf import FlaskForm
from wtforms.fields import SelectMultipleField
from wtforms.validators import DataRequired
class SelectForm(FlaskForm):
response = SelectMultipleField('Response', choices = [], \
validators=[DataRequired()])
| 36
| 59
| 0.781746
| 24
| 252
| 8.166667
| 0.583333
| 0.112245
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.134921
| 252
| 7
| 60
| 36
| 0.899083
| 0
| 0
| 0
| 0
| 0
| 0.031621
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.833333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
31e586fb2e21d9cdce2086bbfab4a044567e07a4
| 248
|
py
|
Python
|
source/controllers/base_controller.py
|
iYasha/pyfinancebot
|
4357131fdc414dc5682d5e1761d7483603dce4a6
|
[
"MIT"
] | null | null | null |
source/controllers/base_controller.py
|
iYasha/pyfinancebot
|
4357131fdc414dc5682d5e1761d7483603dce4a6
|
[
"MIT"
] | null | null | null |
source/controllers/base_controller.py
|
iYasha/pyfinancebot
|
4357131fdc414dc5682d5e1761d7483603dce4a6
|
[
"MIT"
] | null | null | null |
from abc import ABC, abstractmethod
from telebot.types import InlineKeyboardButton
class BaseController(ABC):
@abstractmethod
def callback_name(self) -> str:
pass
def get_menu_btn(self) -> InlineKeyboardButton:
pass
| 19.076923
| 51
| 0.717742
| 27
| 248
| 6.481481
| 0.666667
| 0.194286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.217742
| 248
| 12
| 52
| 20.666667
| 0.902062
| 0
| 0
| 0.25
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0.25
| 0.25
| 0
| 0.625
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
9eddcee957d466ae169093d7c7a3108ed327c8c2
| 449
|
py
|
Python
|
kadot/utils.py
|
the-new-sky/Kadot
|
00fab7dae4cf3945d1f2000a8a39ad1ef6a641b1
|
[
"MIT"
] | 131
|
2017-02-05T10:19:45.000Z
|
2022-03-04T07:19:15.000Z
|
kadot/utils.py
|
the-new-sky/Kadot
|
00fab7dae4cf3945d1f2000a8a39ad1ef6a641b1
|
[
"MIT"
] | 4
|
2017-02-25T07:50:28.000Z
|
2017-10-15T15:20:52.000Z
|
kadot/utils.py
|
the-new-sky/Kadot
|
00fab7dae4cf3945d1f2000a8a39ad1ef6a641b1
|
[
"MIT"
] | 11
|
2017-02-24T19:12:55.000Z
|
2020-06-02T04:11:43.000Z
|
import pickle
def unique_words(words):
# TODO: add list of list/ list of Tokens objects gestion
return sorted(set(words))
class SavedObject(object):
"""
A class that can be saved in a file.
"""
def save(self, filename):
with open(filename, 'wb') as save_file:
pickle.dump(self, save_file)
def load_object(filename):
with open(filename, 'rb') as save_file:
return pickle.load(save_file)
| 20.409091
| 60
| 0.648107
| 64
| 449
| 4.453125
| 0.546875
| 0.112281
| 0.112281
| 0.168421
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.249443
| 449
| 21
| 61
| 21.380952
| 0.845697
| 0.2049
| 0
| 0
| 0
| 0
| 0.01173
| 0
| 0
| 0
| 0
| 0.047619
| 0
| 1
| 0.3
| false
| 0
| 0.1
| 0.1
| 0.7
| 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
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
9eec2a4a6e8988452089c96d9fb1558f2b74fc65
| 109
|
py
|
Python
|
JapanToBook/write_box/settings.py
|
michael-act/JapanToBook
|
497cfb6c3148b560cdcaf6cce1a47c41c551defc
|
[
"MIT"
] | 4
|
2020-09-30T14:55:12.000Z
|
2020-11-16T13:42:19.000Z
|
JapanToBook/write_box/settings.py
|
michael-act/JapanToBook
|
497cfb6c3148b560cdcaf6cce1a47c41c551defc
|
[
"MIT"
] | null | null | null |
JapanToBook/write_box/settings.py
|
michael-act/JapanToBook
|
497cfb6c3148b560cdcaf6cce1a47c41c551defc
|
[
"MIT"
] | 1
|
2021-03-16T03:03:19.000Z
|
2021-03-16T03:03:19.000Z
|
IMAGES_PATH = 'write_box/images/'
FONTS_PATH = 'write_box/fonts/'
LOGFILE_PATH = 'log.txt'
TOKEN = 'TOKEN'
| 27.25
| 34
| 0.715596
| 16
| 109
| 4.5625
| 0.5625
| 0.246575
| 0.328767
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12844
| 109
| 4
| 35
| 27.25
| 0.768421
| 0
| 0
| 0
| 0
| 0
| 0.420561
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
7315259c38268a892ca8a87e8fc2aa34d90acd9b
| 61
|
py
|
Python
|
nautobot_device_onboarding/api/__init__.py
|
pszulczewski/nautobot-plugin-device-onboarding
|
9ddec52d7bcc751c4616bd7c1180ed2a1d31ff2c
|
[
"Apache-2.0"
] | 13
|
2021-03-05T10:47:50.000Z
|
2022-03-18T19:07:09.000Z
|
nautobot_device_onboarding/api/__init__.py
|
pszulczewski/nautobot-plugin-device-onboarding
|
9ddec52d7bcc751c4616bd7c1180ed2a1d31ff2c
|
[
"Apache-2.0"
] | 18
|
2021-03-05T10:29:13.000Z
|
2022-03-08T13:10:38.000Z
|
nautobot_device_onboarding/api/__init__.py
|
pszulczewski/nautobot-plugin-device-onboarding
|
9ddec52d7bcc751c4616bd7c1180ed2a1d31ff2c
|
[
"Apache-2.0"
] | 14
|
2021-03-06T19:33:46.000Z
|
2022-03-28T16:31:38.000Z
|
"""REST API module for nautobot_device_onboarding plugin."""
| 30.5
| 60
| 0.786885
| 8
| 61
| 5.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098361
| 61
| 1
| 61
| 61
| 0.836364
| 0.885246
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
7357915ede7ba8d06e997587bc5353a468133815
| 233
|
py
|
Python
|
13-protocol-abc/typing/randompickload.py
|
leorochael/example-code-2e
|
bbc664308a50e0c62d7e7b2f1715eb49d7061456
|
[
"MIT"
] | 1
|
2021-03-03T13:28:37.000Z
|
2021-03-03T13:28:37.000Z
|
13-protocol-abc/typing/randompickload.py
|
Turall/example-code-2e
|
1702717182cff9a48beb55b2a9f5618e9bd1da18
|
[
"MIT"
] | null | null | null |
13-protocol-abc/typing/randompickload.py
|
Turall/example-code-2e
|
1702717182cff9a48beb55b2a9f5618e9bd1da18
|
[
"MIT"
] | null | null | null |
from typing import Protocol, runtime_checkable, Any, Iterable
from randompick import RandomPicker
@runtime_checkable # <1>
class LoadableRandomPicker(RandomPicker, Protocol): # <2>
def load(self, Iterable) -> None: ... # <3>
| 33.285714
| 61
| 0.738197
| 26
| 233
| 6.538462
| 0.730769
| 0.188235
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.015152
| 0.150215
| 233
| 6
| 62
| 38.833333
| 0.843434
| 0.04721
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.4
| 0
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
735cf704d973c24a36127b942d51b1402db36470
| 73
|
py
|
Python
|
test_hello.py
|
troswell/pynet_terry
|
019068022fa7b59848aa07a39d2df6c12979b23f
|
[
"Apache-2.0"
] | null | null | null |
test_hello.py
|
troswell/pynet_terry
|
019068022fa7b59848aa07a39d2df6c12979b23f
|
[
"Apache-2.0"
] | null | null | null |
test_hello.py
|
troswell/pynet_terry
|
019068022fa7b59848aa07a39d2df6c12979b23f
|
[
"Apache-2.0"
] | null | null | null |
print "hello world"
print "something else"
for i in range(7):
print i
| 10.428571
| 22
| 0.69863
| 13
| 73
| 3.923077
| 0.769231
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.017241
| 0.205479
| 73
| 6
| 23
| 12.166667
| 0.862069
| 0
| 0
| 0
| 0
| 0
| 0.347222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.75
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
b40e023db1eb5544d9786605001e6664097a504f
| 482
|
py
|
Python
|
django/currencies/serializers.py
|
AngelOnFira/megagame-controller
|
033fec84babf80ffd0868a0f7d946ac4c18b061c
|
[
"MIT"
] | null | null | null |
django/currencies/serializers.py
|
AngelOnFira/megagame-controller
|
033fec84babf80ffd0868a0f7d946ac4c18b061c
|
[
"MIT"
] | 1
|
2022-03-03T21:56:12.000Z
|
2022-03-03T21:56:12.000Z
|
django/currencies/serializers.py
|
AngelOnFira/megagame-controller
|
033fec84babf80ffd0868a0f7d946ac4c18b061c
|
[
"MIT"
] | null | null | null |
from rest_framework import serializers
from .models import Currency, Transaction, Wallet
class TransactionSerializer(serializers.ModelSerializer):
class Meta:
model = Transaction
fields = "__all__"
depth = 1
class WalletSerializer(serializers.ModelSerializer):
class Meta:
model = Wallet
fields = ["id"]
class CurrencySerializer(serializers.ModelSerializer):
class Meta:
model = Currency
fields = "__all__"
| 20.956522
| 57
| 0.686722
| 43
| 482
| 7.488372
| 0.488372
| 0.242236
| 0.28882
| 0.326087
| 0.372671
| 0
| 0
| 0
| 0
| 0
| 0
| 0.002747
| 0.244813
| 482
| 22
| 58
| 21.909091
| 0.881868
| 0
| 0
| 0.333333
| 0
| 0
| 0.033195
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.133333
| 0
| 0.533333
| 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
| 1
| 0
|
0
| 4
|
b41aebd6f7ee765f1a9f461189749e4314cf2d9d
| 94
|
py
|
Python
|
src/obfuscapk/obfuscators/advanced_reflection/__init__.py
|
AkshayJainG/Obfuscapk
|
6f2e791dbc06afc17d69393b3e5064cc4821a582
|
[
"MIT"
] | 12
|
2020-02-24T13:40:41.000Z
|
2021-05-05T12:41:43.000Z
|
src/obfuscapk/obfuscators/advanced_reflection/__init__.py
|
z3r0Sec/Obfuscapk
|
3adbf7bfa84adf117326409c683e375ceb5a5df4
|
[
"MIT"
] | null | null | null |
src/obfuscapk/obfuscators/advanced_reflection/__init__.py
|
z3r0Sec/Obfuscapk
|
3adbf7bfa84adf117326409c683e375ceb5a5df4
|
[
"MIT"
] | 3
|
2020-05-15T16:44:43.000Z
|
2021-07-31T03:21:14.000Z
|
#!/usr/bin/env python3.7
# coding: utf-8
from .advanced_reflection import AdvancedReflection
| 18.8
| 51
| 0.787234
| 13
| 94
| 5.615385
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.035714
| 0.106383
| 94
| 4
| 52
| 23.5
| 0.833333
| 0.393617
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
b425559ba5fe163a1e49b2cd21bd343f983c6a1e
| 250
|
py
|
Python
|
pages/models/emitters/__init__.py
|
kevin-klein/101wiki
|
8647271c00e8e9d954df2e43ddbf12f5f3d062be
|
[
"MIT"
] | null | null | null |
pages/models/emitters/__init__.py
|
kevin-klein/101wiki
|
8647271c00e8e9d954df2e43ddbf12f5f3d062be
|
[
"MIT"
] | 1
|
2020-02-12T00:17:34.000Z
|
2020-02-12T00:17:34.000Z
|
pages/models/emitters/__init__.py
|
kevin-klein/101wiki
|
8647271c00e8e9d954df2e43ddbf12f5f3d062be
|
[
"MIT"
] | null | null | null |
from .linkemitter import LinkEmitter
from .metadatacollector import MetadataCollector
from .wikiemitter import WikiEmitter
from .schemacollector import SchemaCollector
__all__ = ['LinkEmitter', 'MetadataCollector', 'SchemaCollector', 'WikiEmitter']
| 35.714286
| 80
| 0.836
| 21
| 250
| 9.761905
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.092
| 250
| 6
| 81
| 41.666667
| 0.903084
| 0
| 0
| 0
| 0
| 0
| 0.216
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.8
| 0
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
b4263f1905dbf6a4f434e55aa6b293eea559dd82
| 16,136
|
py
|
Python
|
python/topics/combinatorial-optimization/minimum-cut-solver.py
|
fossabot/a-grim-loth
|
a6c8d549289a39ec981c1e0d0c754bb2708dfff9
|
[
"MIT"
] | 4
|
2021-06-26T17:18:47.000Z
|
2022-02-02T15:02:27.000Z
|
python/topics/combinatorial-optimization/minimum-cut-solver.py
|
fossabot/a-grim-loth
|
a6c8d549289a39ec981c1e0d0c754bb2708dfff9
|
[
"MIT"
] | 8
|
2021-06-29T07:00:32.000Z
|
2021-12-01T11:26:22.000Z
|
python/topics/combinatorial-optimization/minimum-cut-solver.py
|
fossabot/a-grim-loth
|
a6c8d549289a39ec981c1e0d0c754bb2708dfff9
|
[
"MIT"
] | 3
|
2021-07-14T14:42:08.000Z
|
2021-12-07T19:36:53.000Z
|
class FlowNetwork:
"""This class is copied from wiki for benchmark."""
def __init__(self):
self.adj, self.flow, = (
{},
{},
)
self.src, self.sink = None, None
def add_vertex(self, vertex):
self.adj[vertex] = []
def add_vertices(self, vertices):
map(self.add_vertex, vertices)
def get_edges(self, v):
return self.adj[v]
def add_edge(self, u, v, w=0):
self.adj[u].append((v, w))
self.adj[v].append((u, 0))
self.flow[(u, v)] = self.flow[(v, u)] = 0
def find_path(self, source, sink, path):
if source == sink:
return path
for vertex, capacity in self.get_edges(source):
residual = capacity - self.flow[(source, vertex)]
edge = (source, vertex, residual)
if residual > 0 and not edge in path:
result = self.find_path(vertex, sink, path + [edge])
if result is not None:
return result
def max_flow(self, source, sink):
path = self.find_path(source, sink, [])
while path is not None:
flow = min(r for u, v, r in path)
for u, v, _ in path:
self.flow[(u, v)] += flow
self.flow[(v, u)] -= flow
path = self.find_path(source, sink, [])
return sum(
self.flow[(source, vertex)] for vertex, capacity in self.get_edges(source)
)
class UndirectedGraph:
def __init__(self):
self.vertices = []
self.edges = {}
def add_vertex(self, v):
self.vertices.append(v)
self.edges[(v, v)] = 0
def add_vertices(self, v_s):
self.vertices.extend(v_s)
for v in v_s:
self.edges[(v, v)] = 0
def add_edge(self, u, v, w=0):
self.edges[(u, v)] = w
self.edges[(v, u)] = w
def adjacents(self, u):
li = []
for v in self.vertices:
w = self.edges.get((u, v), 0)
if w:
li.append((v, w))
return li
def merge(self, u, v):
"""merge u to v, where v is in the graph"""
u_adjs = self.adjacents(u)
for z, w in u_adjs:
self.edges.pop((u, z))
self.edges.pop((z, u))
self.vertices.remove(u)
v_adjs = dict(self.adjacents(v))
for n, w in u_adjs:
if n == v:
continue
v_adjs[n] = v_adjs.get(n, 0) + w
for n, w in v_adjs.iteritems():
self.edges[(v, n)] = w
self.edges[(n, v)] = w
def w(g, A, y):
if y in A:
raise AssertionError
return sum(w for v, w in g.adjacents(y) if v in A)
def min_cut_phase(g, a):
A = {a}
V = set(g.vertices)
order = [a]
while A != V:
w_candidates = [
(w(g, A, v), v) for v in V - A
] #: candidates for most tightly connected
_, x = max(w_candidates)
A.add(x)
order.append(x)
t, s = order[-1], order[-2]
min_cut = sum(w for v, w in g.adjacents(t))
g.merge(t, s)
return min_cut
def minimum_cut(g, a):
min_cut = sum(w for v, w in g.adjacents(a))
while len(g.vertices) > 1:
min_cut_candidate = min_cut_phase(g, a)
if min_cut_candidate < min_cut:
min_cut = min_cut_candidate
return min_cut
class Reader:
"""A file reader: read the formated input data provided by Q2914: Minimum Cut"""
def __init__(self, fd):
"""@param fd: an opened file-like object, and its contents are the input data."""
self.fd = fd
def gen_graph(self):
"""a generator that yield graphs in order"""
while True:
try:
line = self.fd.__next__
nVertices, nEdges = map(int, line.split())
if g_TryFlowNetwork:
g = FlowNetwork()
g.add_vertices(range(nVertices))
for i in range(nEdges):
u, v, w = map(int, self.fd.next().split())
if u < v:
g.add_edge(u, v, w)
else:
g.add_edge(v, u, w)
g.src, g.sink = 0, nVertices - 1
else:
g = UndirectedGraph()
g.add_vertices(range(nVertices))
for i in range(nEdges):
u, v, w = map(int, self.fd.next().split())
g.add_edge(u, v, w)
yield g
except StopIteration:
break
def __del__(self):
self.fd.close()
if __name__ == "__main__":
import time
from io import StringIO
test_input = """3 3
0 1 1
1 2 1
2 0 1
4 3
0 1 1
1 2 1
2 3 1
8 14
0 1 1
0 2 1
0 3 1
1 2 1
1 3 1
2 3 1
4 5 1
4 6 1
4 7 1
5 6 1
5 7 1
6 7 1
4 0 1
7 3 1
8 12
0 1 2
0 4 3
1 4 2
4 5 3
1 2 3
1 5 2
5 6 1
2 6 2
2 3 4
3 6 2
3 7 2
6 7 3
5 10
0 1 1
0 2 1
0 3 1
0 4 1
1 2 1
1 3 1
1 4 1
2 3 1
2 4 1
3 4 1
20 190
0 1 1
0 2 1
0 3 1
0 4 1
0 5 1
0 6 1
0 7 1
0 8 1
0 9 1
0 10 1
0 11 1
0 12 1
0 13 1
0 14 1
0 15 1
0 16 1
0 17 1
0 18 1
0 19 1
1 2 1
1 3 1
1 4 1
1 5 1
1 6 1
1 7 1
1 8 1
1 9 1
1 10 1
1 11 1
1 12 1
1 13 1
1 14 1
1 15 1
1 16 1
1 17 1
1 18 1
1 19 1
2 3 1
2 4 1
2 5 1
2 6 1
2 7 1
2 8 1
2 9 1
2 10 1
2 11 1
2 12 1
2 13 1
2 14 1
2 15 1
2 16 1
2 17 1
2 18 1
2 19 1
3 4 1
3 5 1
3 6 1
3 7 1
3 8 1
3 9 1
3 10 1
3 11 1
3 12 1
3 13 1
3 14 1
3 15 1
3 16 1
3 17 1
3 18 1
3 19 1
4 5 1
4 6 1
4 7 1
4 8 1
4 9 1
4 10 1
4 11 1
4 12 1
4 13 1
4 14 1
4 15 1
4 16 1
4 17 1
4 18 1
4 19 1
5 6 1
5 7 1
5 8 1
5 9 1
5 10 1
5 11 1
5 12 1
5 13 1
5 14 1
5 15 1
5 16 1
5 17 1
5 18 1
5 19 1
6 7 1
6 8 1
6 9 1
6 10 1
6 11 1
6 12 1
6 13 1
6 14 1
6 15 1
6 16 1
6 17 1
6 18 1
6 19 1
7 8 1
7 9 1
7 10 1
7 11 1
7 12 1
7 13 1
7 14 1
7 15 1
7 16 1
7 17 1
7 18 1
7 19 1
8 9 1
8 10 1
8 11 1
8 12 1
8 13 1
8 14 1
8 15 1
8 16 1
8 17 1
8 18 1
8 19 1
9 10 1
9 11 1
9 12 1
9 13 1
9 14 1
9 15 1
9 16 1
9 17 1
9 18 1
9 19 1
10 11 1
10 12 1
10 13 1
10 14 1
10 15 1
10 16 1
10 17 1
10 18 1
10 19 1
11 12 1
11 13 1
11 14 1
11 15 1
11 16 1
11 17 1
11 18 1
11 19 1
12 13 1
12 14 1
12 15 1
12 16 1
12 17 1
12 18 1
12 19 1
13 14 1
13 15 1
13 16 1
13 17 1
13 18 1
13 19 1
14 15 1
14 16 1
14 17 1
14 18 1
14 19 1
15 16 1
15 17 1
15 18 1
15 19 1
16 17 1
16 18 1
16 19 1
17 18 1
17 19 1
18 19 1
50 1225
0 1 1
0 2 1
0 3 1
0 4 1
0 5 1
0 6 1
0 7 1
0 8 1
0 9 1
0 10 1
0 11 1
0 12 1
0 13 1
0 14 1
0 15 1
0 16 1
0 17 1
0 18 1
0 19 1
0 20 1
0 21 1
0 22 1
0 23 1
0 24 1
0 25 1
0 26 1
0 27 1
0 28 1
0 29 1
0 30 1
0 31 1
0 32 1
0 33 1
0 34 1
0 35 1
0 36 1
0 37 1
0 38 1
0 39 1
0 40 1
0 41 1
0 42 1
0 43 1
0 44 1
0 45 1
0 46 1
0 47 1
0 48 1
0 49 1
1 2 1
1 3 1
1 4 1
1 5 1
1 6 1
1 7 1
1 8 1
1 9 1
1 10 1
1 11 1
1 12 1
1 13 1
1 14 1
1 15 1
1 16 1
1 17 1
1 18 1
1 19 1
1 20 1
1 21 1
1 22 1
1 23 1
1 24 1
1 25 1
1 26 1
1 27 1
1 28 1
1 29 1
1 30 1
1 31 1
1 32 1
1 33 1
1 34 1
1 35 1
1 36 1
1 37 1
1 38 1
1 39 1
1 40 1
1 41 1
1 42 1
1 43 1
1 44 1
1 45 1
1 46 1
1 47 1
1 48 1
1 49 1
2 3 1
2 4 1
2 5 1
2 6 1
2 7 1
2 8 1
2 9 1
2 10 1
2 11 1
2 12 1
2 13 1
2 14 1
2 15 1
2 16 1
2 17 1
2 18 1
2 19 1
2 20 1
2 21 1
2 22 1
2 23 1
2 24 1
2 25 1
2 26 1
2 27 1
2 28 1
2 29 1
2 30 1
2 31 1
2 32 1
2 33 1
2 34 1
2 35 1
2 36 1
2 37 1
2 38 1
2 39 1
2 40 1
2 41 1
2 42 1
2 43 1
2 44 1
2 45 1
2 46 1
2 47 1
2 48 1
2 49 1
3 4 1
3 5 1
3 6 1
3 7 1
3 8 1
3 9 1
3 10 1
3 11 1
3 12 1
3 13 1
3 14 1
3 15 1
3 16 1
3 17 1
3 18 1
3 19 1
3 20 1
3 21 1
3 22 1
3 23 1
3 24 1
3 25 1
3 26 1
3 27 1
3 28 1
3 29 1
3 30 1
3 31 1
3 32 1
3 33 1
3 34 1
3 35 1
3 36 1
3 37 1
3 38 1
3 39 1
3 40 1
3 41 1
3 42 1
3 43 1
3 44 1
3 45 1
3 46 1
3 47 1
3 48 1
3 49 1
4 5 1
4 6 1
4 7 1
4 8 1
4 9 1
4 10 1
4 11 1
4 12 1
4 13 1
4 14 1
4 15 1
4 16 1
4 17 1
4 18 1
4 19 1
4 20 1
4 21 1
4 22 1
4 23 1
4 24 1
4 25 1
4 26 1
4 27 1
4 28 1
4 29 1
4 30 1
4 31 1
4 32 1
4 33 1
4 34 1
4 35 1
4 36 1
4 37 1
4 38 1
4 39 1
4 40 1
4 41 1
4 42 1
4 43 1
4 44 1
4 45 1
4 46 1
4 47 1
4 48 1
4 49 1
5 6 1
5 7 1
5 8 1
5 9 1
5 10 1
5 11 1
5 12 1
5 13 1
5 14 1
5 15 1
5 16 1
5 17 1
5 18 1
5 19 1
5 20 1
5 21 1
5 22 1
5 23 1
5 24 1
5 25 1
5 26 1
5 27 1
5 28 1
5 29 1
5 30 1
5 31 1
5 32 1
5 33 1
5 34 1
5 35 1
5 36 1
5 37 1
5 38 1
5 39 1
5 40 1
5 41 1
5 42 1
5 43 1
5 44 1
5 45 1
5 46 1
5 47 1
5 48 1
5 49 1
6 7 1
6 8 1
6 9 1
6 10 1
6 11 1
6 12 1
6 13 1
6 14 1
6 15 1
6 16 1
6 17 1
6 18 1
6 19 1
6 20 1
6 21 1
6 22 1
6 23 1
6 24 1
6 25 1
6 26 1
6 27 1
6 28 1
6 29 1
6 30 1
6 31 1
6 32 1
6 33 1
6 34 1
6 35 1
6 36 1
6 37 1
6 38 1
6 39 1
6 40 1
6 41 1
6 42 1
6 43 1
6 44 1
6 45 1
6 46 1
6 47 1
6 48 1
6 49 1
7 8 1
7 9 1
7 10 1
7 11 1
7 12 1
7 13 1
7 14 1
7 15 1
7 16 1
7 17 1
7 18 1
7 19 1
7 20 1
7 21 1
7 22 1
7 23 1
7 24 1
7 25 1
7 26 1
7 27 1
7 28 1
7 29 1
7 30 1
7 31 1
7 32 1
7 33 1
7 34 1
7 35 1
7 36 1
7 37 1
7 38 1
7 39 1
7 40 1
7 41 1
7 42 1
7 43 1
7 44 1
7 45 1
7 46 1
7 47 1
7 48 1
7 49 1
8 9 1
8 10 1
8 11 1
8 12 1
8 13 1
8 14 1
8 15 1
8 16 1
8 17 1
8 18 1
8 19 1
8 20 1
8 21 1
8 22 1
8 23 1
8 24 1
8 25 1
8 26 1
8 27 1
8 28 1
8 29 1
8 30 1
8 31 1
8 32 1
8 33 1
8 34 1
8 35 1
8 36 1
8 37 1
8 38 1
8 39 1
8 40 1
8 41 1
8 42 1
8 43 1
8 44 1
8 45 1
8 46 1
8 47 1
8 48 1
8 49 1
9 10 1
9 11 1
9 12 1
9 13 1
9 14 1
9 15 1
9 16 1
9 17 1
9 18 1
9 19 1
9 20 1
9 21 1
9 22 1
9 23 1
9 24 1
9 25 1
9 26 1
9 27 1
9 28 1
9 29 1
9 30 1
9 31 1
9 32 1
9 33 1
9 34 1
9 35 1
9 36 1
9 37 1
9 38 1
9 39 1
9 40 1
9 41 1
9 42 1
9 43 1
9 44 1
9 45 1
9 46 1
9 47 1
9 48 1
9 49 1
10 11 1
10 12 1
10 13 1
10 14 1
10 15 1
10 16 1
10 17 1
10 18 1
10 19 1
10 20 1
10 21 1
10 22 1
10 23 1
10 24 1
10 25 1
10 26 1
10 27 1
10 28 1
10 29 1
10 30 1
10 31 1
10 32 1
10 33 1
10 34 1
10 35 1
10 36 1
10 37 1
10 38 1
10 39 1
10 40 1
10 41 1
10 42 1
10 43 1
10 44 1
10 45 1
10 46 1
10 47 1
10 48 1
10 49 1
11 12 1
11 13 1
11 14 1
11 15 1
11 16 1
11 17 1
11 18 1
11 19 1
11 20 1
11 21 1
11 22 1
11 23 1
11 24 1
11 25 1
11 26 1
11 27 1
11 28 1
11 29 1
11 30 1
11 31 1
11 32 1
11 33 1
11 34 1
11 35 1
11 36 1
11 37 1
11 38 1
11 39 1
11 40 1
11 41 1
11 42 1
11 43 1
11 44 1
11 45 1
11 46 1
11 47 1
11 48 1
11 49 1
12 13 1
12 14 1
12 15 1
12 16 1
12 17 1
12 18 1
12 19 1
12 20 1
12 21 1
12 22 1
12 23 1
12 24 1
12 25 1
12 26 1
12 27 1
12 28 1
12 29 1
12 30 1
12 31 1
12 32 1
12 33 1
12 34 1
12 35 1
12 36 1
12 37 1
12 38 1
12 39 1
12 40 1
12 41 1
12 42 1
12 43 1
12 44 1
12 45 1
12 46 1
12 47 1
12 48 1
12 49 1
13 14 1
13 15 1
13 16 1
13 17 1
13 18 1
13 19 1
13 20 1
13 21 1
13 22 1
13 23 1
13 24 1
13 25 1
13 26 1
13 27 1
13 28 1
13 29 1
13 30 1
13 31 1
13 32 1
13 33 1
13 34 1
13 35 1
13 36 1
13 37 1
13 38 1
13 39 1
13 40 1
13 41 1
13 42 1
13 43 1
13 44 1
13 45 1
13 46 1
13 47 1
13 48 1
13 49 1
14 15 1
14 16 1
14 17 1
14 18 1
14 19 1
14 20 1
14 21 1
14 22 1
14 23 1
14 24 1
14 25 1
14 26 1
14 27 1
14 28 1
14 29 1
14 30 1
14 31 1
14 32 1
14 33 1
14 34 1
14 35 1
14 36 1
14 37 1
14 38 1
14 39 1
14 40 1
14 41 1
14 42 1
14 43 1
14 44 1
14 45 1
14 46 1
14 47 1
14 48 1
14 49 1
15 16 1
15 17 1
15 18 1
15 19 1
15 20 1
15 21 1
15 22 1
15 23 1
15 24 1
15 25 1
15 26 1
15 27 1
15 28 1
15 29 1
15 30 1
15 31 1
15 32 1
15 33 1
15 34 1
15 35 1
15 36 1
15 37 1
15 38 1
15 39 1
15 40 1
15 41 1
15 42 1
15 43 1
15 44 1
15 45 1
15 46 1
15 47 1
15 48 1
15 49 1
16 17 1
16 18 1
16 19 1
16 20 1
16 21 1
16 22 1
16 23 1
16 24 1
16 25 1
16 26 1
16 27 1
16 28 1
16 29 1
16 30 1
16 31 1
16 32 1
16 33 1
16 34 1
16 35 1
16 36 1
16 37 1
16 38 1
16 39 1
16 40 1
16 41 1
16 42 1
16 43 1
16 44 1
16 45 1
16 46 1
16 47 1
16 48 1
16 49 1
17 18 1
17 19 1
17 20 1
17 21 1
17 22 1
17 23 1
17 24 1
17 25 1
17 26 1
17 27 1
17 28 1
17 29 1
17 30 1
17 31 1
17 32 1
17 33 1
17 34 1
17 35 1
17 36 1
17 37 1
17 38 1
17 39 1
17 40 1
17 41 1
17 42 1
17 43 1
17 44 1
17 45 1
17 46 1
17 47 1
17 48 1
17 49 1
18 19 1
18 20 1
18 21 1
18 22 1
18 23 1
18 24 1
18 25 1
18 26 1
18 27 1
18 28 1
18 29 1
18 30 1
18 31 1
18 32 1
18 33 1
18 34 1
18 35 1
18 36 1
18 37 1
18 38 1
18 39 1
18 40 1
18 41 1
18 42 1
18 43 1
18 44 1
18 45 1
18 46 1
18 47 1
18 48 1
18 49 1
19 20 1
19 21 1
19 22 1
19 23 1
19 24 1
19 25 1
19 26 1
19 27 1
19 28 1
19 29 1
19 30 1
19 31 1
19 32 1
19 33 1
19 34 1
19 35 1
19 36 1
19 37 1
19 38 1
19 39 1
19 40 1
19 41 1
19 42 1
19 43 1
19 44 1
19 45 1
19 46 1
19 47 1
19 48 1
19 49 1
20 21 1
20 22 1
20 23 1
20 24 1
20 25 1
20 26 1
20 27 1
20 28 1
20 29 1
20 30 1
20 31 1
20 32 1
20 33 1
20 34 1
20 35 1
20 36 1
20 37 1
20 38 1
20 39 1
20 40 1
20 41 1
20 42 1
20 43 1
20 44 1
20 45 1
20 46 1
20 47 1
20 48 1
20 49 1
21 22 1
21 23 1
21 24 1
21 25 1
21 26 1
21 27 1
21 28 1
21 29 1
21 30 1
21 31 1
21 32 1
21 33 1
21 34 1
21 35 1
21 36 1
21 37 1
21 38 1
21 39 1
21 40 1
21 41 1
21 42 1
21 43 1
21 44 1
21 45 1
21 46 1
21 47 1
21 48 1
21 49 1
22 23 1
22 24 1
22 25 1
22 26 1
22 27 1
22 28 1
22 29 1
22 30 1
22 31 1
22 32 1
22 33 1
22 34 1
22 35 1
22 36 1
22 37 1
22 38 1
22 39 1
22 40 1
22 41 1
22 42 1
22 43 1
22 44 1
22 45 1
22 46 1
22 47 1
22 48 1
22 49 1
23 24 1
23 25 1
23 26 1
23 27 1
23 28 1
23 29 1
23 30 1
23 31 1
23 32 1
23 33 1
23 34 1
23 35 1
23 36 1
23 37 1
23 38 1
23 39 1
23 40 1
23 41 1
23 42 1
23 43 1
23 44 1
23 45 1
23 46 1
23 47 1
23 48 1
23 49 1
24 25 1
24 26 1
24 27 1
24 28 1
24 29 1
24 30 1
24 31 1
24 32 1
24 33 1
24 34 1
24 35 1
24 36 1
24 37 1
24 38 1
24 39 1
24 40 1
24 41 1
24 42 1
24 43 1
24 44 1
24 45 1
24 46 1
24 47 1
24 48 1
24 49 1
25 26 1
25 27 1
25 28 1
25 29 1
25 30 1
25 31 1
25 32 1
25 33 1
25 34 1
25 35 1
25 36 1
25 37 1
25 38 1
25 39 1
25 40 1
25 41 1
25 42 1
25 43 1
25 44 1
25 45 1
25 46 1
25 47 1
25 48 1
25 49 1
26 27 1
26 28 1
26 29 1
26 30 1
26 31 1
26 32 1
26 33 1
26 34 1
26 35 1
26 36 1
26 37 1
26 38 1
26 39 1
26 40 1
26 41 1
26 42 1
26 43 1
26 44 1
26 45 1
26 46 1
26 47 1
26 48 1
26 49 1
27 28 1
27 29 1
27 30 1
27 31 1
27 32 1
27 33 1
27 34 1
27 35 1
27 36 1
27 37 1
27 38 1
27 39 1
27 40 1
27 41 1
27 42 1
27 43 1
27 44 1
27 45 1
27 46 1
27 47 1
27 48 1
27 49 1
28 29 1
28 30 1
28 31 1
28 32 1
28 33 1
28 34 1
28 35 1
28 36 1
28 37 1
28 38 1
28 39 1
28 40 1
28 41 1
28 42 1
28 43 1
28 44 1
28 45 1
28 46 1
28 47 1
28 48 1
28 49 1
29 30 1
29 31 1
29 32 1
29 33 1
29 34 1
29 35 1
29 36 1
29 37 1
29 38 1
29 39 1
29 40 1
29 41 1
29 42 1
29 43 1
29 44 1
29 45 1
29 46 1
29 47 1
29 48 1
29 49 1
30 31 1
30 32 1
30 33 1
30 34 1
30 35 1
30 36 1
30 37 1
30 38 1
30 39 1
30 40 1
30 41 1
30 42 1
30 43 1
30 44 1
30 45 1
30 46 1
30 47 1
30 48 1
30 49 1
31 32 1
31 33 1
31 34 1
31 35 1
31 36 1
31 37 1
31 38 1
31 39 1
31 40 1
31 41 1
31 42 1
31 43 1
31 44 1
31 45 1
31 46 1
31 47 1
31 48 1
31 49 1
32 33 1
32 34 1
32 35 1
32 36 1
32 37 1
32 38 1
32 39 1
32 40 1
32 41 1
32 42 1
32 43 1
32 44 1
32 45 1
32 46 1
32 47 1
32 48 1
32 49 1
33 34 1
33 35 1
33 36 1
33 37 1
33 38 1
33 39 1
33 40 1
33 41 1
33 42 1
33 43 1
33 44 1
33 45 1
33 46 1
33 47 1
33 48 1
33 49 1
34 35 1
34 36 1
34 37 1
34 38 1
34 39 1
34 40 1
34 41 1
34 42 1
34 43 1
34 44 1
34 45 1
34 46 1
34 47 1
34 48 1
34 49 1
35 36 1
35 37 1
35 38 1
35 39 1
35 40 1
35 41 1
35 42 1
35 43 1
35 44 1
35 45 1
35 46 1
35 47 1
35 48 1
35 49 1
36 37 1
36 38 1
36 39 1
36 40 1
36 41 1
36 42 1
36 43 1
36 44 1
36 45 1
36 46 1
36 47 1
36 48 1
36 49 1
37 38 1
37 39 1
37 40 1
37 41 1
37 42 1
37 43 1
37 44 1
37 45 1
37 46 1
37 47 1
37 48 1
37 49 1
38 39 1
38 40 1
38 41 1
38 42 1
38 43 1
38 44 1
38 45 1
38 46 1
38 47 1
38 48 1
38 49 1
39 40 1
39 41 1
39 42 1
39 43 1
39 44 1
39 45 1
39 46 1
39 47 1
39 48 1
39 49 1
40 41 1
40 42 1
40 43 1
40 44 1
40 45 1
40 46 1
40 47 1
40 48 1
40 49 1
41 42 1
41 43 1
41 44 1
41 45 1
41 46 1
41 47 1
41 48 1
41 49 1
42 43 1
42 44 1
42 45 1
42 46 1
42 47 1
42 48 1
42 49 1
43 44 1
43 45 1
43 46 1
43 47 1
43 48 1
43 49 1
44 45 1
44 46 1
44 47 1
44 48 1
44 49 1
45 46 1
45 47 1
45 48 1
45 49 1
46 47 1
46 48 1
46 49 1
47 48 1
47 49 1
48 49 1
"""
g_TryFlowNetwork = (
#: when this variable is True, use FlowNetwork to find the min cut.
False
)
fd = StringIO()
fd.write(test_input)
fd.seek(0)
r = Reader(fd)
for g in r.gen_graph():
start_time = time.time()
if g_TryFlowNetwork:
print(g.max_flow(g.src, g.sink))
else:
print(minimum_cut(g, 1))
print(time.time() - start_time)
| 9.803159
| 89
| 0.564948
| 5,099
| 16,136
| 1.770151
| 0.03687
| 0.017505
| 0.002327
| 0.002659
| 0.232772
| 0.225127
| 0.216929
| 0.209284
| 0.196986
| 0.191115
| 0
| 0.673057
| 0.395513
| 16,136
| 1,645
| 90
| 9.809119
| 0.252307
| 0.023488
| 0
| 0.268944
| 0
| 0
| 0.695359
| 0
| 0
| 0
| 0
| 0
| 0.000621
| 1
| 0.011801
| false
| 0
| 0.001242
| 0.000621
| 0.019876
| 0.001863
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b4373ff6d17a3b97be42cb4c08f94d13559443ff
| 829
|
py
|
Python
|
tests/test_sequnpack.py
|
keisukefukuda/msgpack-python-pure
|
a67e6a143059ae1504bcc08572d55cfe377855e7
|
[
"Apache-2.0"
] | 2
|
2015-04-21T03:00:03.000Z
|
2021-05-10T16:41:39.000Z
|
tests/test_sequnpack.py
|
keisukefukuda/msgpack-python-pure
|
a67e6a143059ae1504bcc08572d55cfe377855e7
|
[
"Apache-2.0"
] | null | null | null |
tests/test_sequnpack.py
|
keisukefukuda/msgpack-python-pure
|
a67e6a143059ae1504bcc08572d55cfe377855e7
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python
# coding: utf-8
from nose.tools import *
from msgpack import Unpacker
def test_foobar():
unpacker = Unpacker(read_size=3)
unpacker.feed('foobar')
assert_equal(unpacker.unpack(), ord('f'))
assert_equal(unpacker.unpack(), ord('o'))
assert_equal(unpacker.unpack(), ord('o'))
assert_equal(unpacker.unpack(), ord('b'))
assert_equal(unpacker.unpack(), ord('a'))
assert_equal(unpacker.unpack(), ord('r'))
try:
o = unpacker.unpack()
print "Oops!", o
assert 0
except StopIteration:
assert 1
else:
assert 0
unpacker.feed('foo')
unpacker.feed('bar')
k = 0
for o, e in zip(unpacker, 'foobarbaz'):
assert o == ord(e)
k += 1
assert k == len('foobar')
if __name__ == '__main__':
test_foobar()
| 23.027778
| 45
| 0.598311
| 108
| 829
| 4.435185
| 0.453704
| 0.204593
| 0.237996
| 0.313152
| 0.354906
| 0.179541
| 0.179541
| 0.179541
| 0.179541
| 0.179541
| 0
| 0.011182
| 0.244873
| 829
| 35
| 46
| 23.685714
| 0.753994
| 0.041013
| 0
| 0.142857
| 0
| 0
| 0.058081
| 0
| 0
| 0
| 0
| 0
| 0.392857
| 0
| null | null | 0
| 0.071429
| null | null | 0.035714
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b43ccd14028811d4d4444a0a8988c5696d19120f
| 499
|
py
|
Python
|
tests/emmet-core/test_mpid.py
|
wuxiaohua1011/emmet
|
49ae8f67fe42a00e1c3157667a23b4ce2d86a729
|
[
"BSD-3-Clause-LBNL"
] | null | null | null |
tests/emmet-core/test_mpid.py
|
wuxiaohua1011/emmet
|
49ae8f67fe42a00e1c3157667a23b4ce2d86a729
|
[
"BSD-3-Clause-LBNL"
] | 29
|
2021-05-31T07:05:46.000Z
|
2022-03-28T15:08:24.000Z
|
tests/emmet-core/test_mpid.py
|
wuxiaohua1011/emmet
|
49ae8f67fe42a00e1c3157667a23b4ce2d86a729
|
[
"BSD-3-Clause-LBNL"
] | null | null | null |
from emmet.core.mpid import MPID
def test_mpid():
assert MPID("mp-3") == MPID("mp-3")
assert MPID("mp-3") < 3
assert MPID("mp-3") < MPID("np-3")
assert MPID("mp-3") > MPID("mp-2")
assert 3 > MPID("mp-3")
assert min([MPID("mp-44545"), MPID("mp-33"), MPID("mp-2134234")]) == MPID("mp-33")
assert (
len(set([MPID("mp-33"), MPID("mp-44545"), MPID("mp-33"), MPID("mp-2134234")]))
== 3
)
def test_to_str():
assert str(MPID("mp-149")) == "mp-149"
| 22.681818
| 86
| 0.533066
| 81
| 499
| 3.246914
| 0.259259
| 0.365019
| 0.159696
| 0.197719
| 0.596958
| 0.460076
| 0.243346
| 0.243346
| 0.243346
| 0
| 0
| 0.124682
| 0.212425
| 499
| 21
| 87
| 23.761905
| 0.544529
| 0
| 0
| 0
| 0
| 0
| 0.200401
| 0
| 0
| 0
| 0
| 0
| 0.571429
| 1
| 0.142857
| true
| 0
| 0.071429
| 0
| 0.214286
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b468c167ac77a3112e818d92b00408cc74cec6cc
| 147
|
py
|
Python
|
tests/test_zint_url.py
|
dionboles/cda-python
|
2e00d29931801bb977d20028cb4795195d550aa4
|
[
"Apache-2.0"
] | 7
|
2021-02-24T15:30:13.000Z
|
2022-02-25T21:32:05.000Z
|
tests/test_zint_url.py
|
dionboles/cda-python
|
2e00d29931801bb977d20028cb4795195d550aa4
|
[
"Apache-2.0"
] | 82
|
2021-02-26T14:53:18.000Z
|
2022-03-24T17:53:57.000Z
|
tests/test_zint_url.py
|
dionboles/cda-python
|
2e00d29931801bb977d20028cb4795195d550aa4
|
[
"Apache-2.0"
] | 5
|
2021-03-11T15:19:47.000Z
|
2022-03-08T20:39:12.000Z
|
from cdapython import Q
def test_url_change():
Q.set_host_url("http://34.71.0.127:8080")
assert Q.get_host_url().split(":")[2] == "8080"
| 21
| 51
| 0.653061
| 26
| 147
| 3.461538
| 0.769231
| 0.155556
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.134921
| 0.142857
| 147
| 6
| 52
| 24.5
| 0.579365
| 0
| 0
| 0
| 0
| 0
| 0.190476
| 0
| 0
| 0
| 0
| 0
| 0.25
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b47b8bf4add81cd76da099637c22bf34df61b483
| 825
|
py
|
Python
|
python/simple_calculator.py
|
YashKrSaini/basic-algorithms
|
114e24f1eb18548901b29f354184787d091eede5
|
[
"MIT"
] | null | null | null |
python/simple_calculator.py
|
YashKrSaini/basic-algorithms
|
114e24f1eb18548901b29f354184787d091eede5
|
[
"MIT"
] | null | null | null |
python/simple_calculator.py
|
YashKrSaini/basic-algorithms
|
114e24f1eb18548901b29f354184787d091eede5
|
[
"MIT"
] | null | null | null |
def calculator():
print " List of the fuctions : "
print " 1. Add "
print " 2. Sub "
print " 3. Mul "
print " 4. Div "
opt=input(" Enter your number => ")
if opt==01:
a=input(" Enter your first number : ")
b=input(" Enter your second number: ")
c=a+b
print c
elif opt==02:
a=input(" Enter your first number : ")
b=input(" Enter your second number: ")
c=a-b
print c
elif opt==03:
a=input(" Enter your first number : ")
b=input(" Enter your second number: ")
c=a*b
print c
elif opt==04:
a=input(" Enter your first number : ")
b=input(" Enter your second number: ")
c=a/b
print c
else :
print " wrong command : "
calculator()
calculator()
| 25.78125
| 46
| 0.505455
| 110
| 825
| 3.790909
| 0.309091
| 0.215827
| 0.302158
| 0.143885
| 0.645084
| 0.645084
| 0.645084
| 0.645084
| 0.645084
| 0.645084
| 0
| 0.023166
| 0.372121
| 825
| 31
| 47
| 26.612903
| 0.781853
| 0
| 0
| 0.451613
| 0
| 0
| 0.378182
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.322581
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
81f1e6cfc0e95de87dcad65f1a18552346063078
| 14,582
|
py
|
Python
|
pymatgen/analysis/tests/test_piezo_sensitivity.py
|
exenGT/pymatgen
|
a8ffb820ab8fc3f60251099e38c8888f45eae618
|
[
"MIT"
] | 1
|
2021-11-02T21:10:11.000Z
|
2021-11-02T21:10:11.000Z
|
pymatgen/analysis/tests/test_piezo_sensitivity.py
|
exenGT/pymatgen
|
a8ffb820ab8fc3f60251099e38c8888f45eae618
|
[
"MIT"
] | 5
|
2018-08-07T23:00:23.000Z
|
2021-01-05T22:46:23.000Z
|
pymatgen/analysis/tests/test_piezo_sensitivity.py
|
exenGT/pymatgen
|
a8ffb820ab8fc3f60251099e38c8888f45eae618
|
[
"MIT"
] | 6
|
2019-04-26T18:50:41.000Z
|
2020-03-29T17:58:34.000Z
|
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
Test for the piezo tensor class
"""
__author__ = "Handong Ling"
__version__ = "0.1"
__maintainer__ = "Handong Ling"
__email__ = "handongling@berkeley.edu"
__status__ = "Development"
__date__ = "4/23/19"
import os
import unittest
import numpy as np
import pymatgen
from pymatgen.analysis.piezo import PiezoTensor
from pymatgen.analysis.piezo_sensitivity import *
from pymatgen.symmetry import site_symmetries as ss
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer as sga
from pymatgen.util.testing import PymatgenTest
try:
from phonopy import Phonopy
except ImportError:
Phonopy = None
test_dir = os.path.join(PymatgenTest.TEST_FILES_DIR, "piezo_sensitivity")
class PiezoSensitivityTest(PymatgenTest):
def setUp(self):
self.piezo_struc = self.get_structure("Pb2TiZrO6")
self.IST = np.load(os.path.join(test_dir, "pztist.npy"), allow_pickle=True)
self.BEC = np.load(os.path.join(test_dir, "pztborn.npy"), allow_pickle=True)
self.FCM = np.load(os.path.join(test_dir, "pztfcm.npy"), allow_pickle=True)
self.pointops = np.load(os.path.join(test_dir, "pointops.npy"), allow_pickle=True)
self.sharedops = np.load(os.path.join(test_dir, "sharedops.npy"), allow_pickle=True)
self.BEC_operations = np.load(os.path.join(test_dir, "becops.npy"), allow_pickle=True)
self.IST_operations = np.load(os.path.join(test_dir, "istops.npy"), allow_pickle=True)
self.FCM_operations = np.load(os.path.join(test_dir, "fcmops.npy"), allow_pickle=True)
self.piezo = np.array(
[
[
[5.32649351e-03, -1.33404642e-14, -6.86958142e02],
[-1.33404642e-14, 4.95526253e-03, -5.60353712e-13],
[-6.86958142e02, -5.60353712e-13, 1.33209787e-02],
],
[
[4.86622567e-03, 3.14840965e-13, -7.41608150e-13],
[3.14840965e-13, 5.23745666e-03, -6.68536818e02],
[-7.41608150e-13, -6.68536818e02, 1.35025755e-02],
],
[
[-1.01086427e02, 3.20177004e-14, -3.68487214e-14],
[3.20177004e-14, -1.01086427e02, 1.22012318e-14],
[-3.68487214e-14, 1.22012318e-14, -5.32241086e02],
],
]
)
def test_BornEffectiveChargeTensor(self):
bec = BornEffectiveCharge(self.piezo_struc, self.BEC, self.pointops)
self.assertArrayAlmostEqual(self.BEC, bec.bec)
def test_InternalStrainTensor(self):
ist = InternalStrainTensor(self.piezo_struc, self.IST, self.pointops)
self.assertArrayAlmostEqual(ist.ist, self.IST)
def test_ForceConstantMatrix(self):
fcmt = ForceConstantMatrix(self.piezo_struc, self.FCM, self.pointops, self.sharedops)
self.assertArrayAlmostEqual(fcmt.fcm, self.FCM)
def test_get_BEC_operations(self):
bec = BornEffectiveCharge(self.piezo_struc, self.BEC, self.pointops)
bec.get_BEC_operations()
self.assertTrue(np.all(self.BEC_operations == bec.BEC_operations))
def test_get_rand_BEC(self):
bec = BornEffectiveCharge(self.piezo_struc, self.BEC, self.pointops)
bec.get_BEC_operations()
rand_BEC = bec.get_rand_BEC()
for i in range(len(self.BEC_operations)):
for j in range(len(self.BEC_operations[i][2])):
self.assertTrue(
np.allclose(
rand_BEC[self.BEC_operations[i][0]],
self.BEC_operations[i][2][j].transform_tensor(rand_BEC[self.BEC_operations[i][1]]),
atol=1e-03,
)
)
def test_get_rand_IST(self):
ist = InternalStrainTensor(self.piezo_struc, self.IST, self.pointops)
ist.get_IST_operations()
rand_IST = ist.get_rand_IST()
for i in range(len(self.IST_operations)):
for j in range(len(self.IST_operations[i])):
self.assertTrue(
np.allclose(
rand_IST[i],
self.IST_operations[i][j][1].transform_tensor(rand_IST[self.IST_operations[i][j][0]]),
atol=1e-03,
)
)
def test_get_FCM_operations(self):
fcm = ForceConstantMatrix(self.piezo_struc, self.FCM, self.pointops, self.sharedops)
fcm.get_FCM_operations()
self.assertTrue(np.all(fcm.FCM_operations == self.FCM_operations))
def test_get_unstable_FCM(self):
fcm = ForceConstantMatrix(self.piezo_struc, self.FCM, self.pointops, self.sharedops)
fcm.get_FCM_operations()
rand_FCM = fcm.get_unstable_FCM()
rand_FCM = np.reshape(rand_FCM, (10, 3, 10, 3)).swapaxes(1, 2)
for i in range(len(self.FCM_operations)):
for j in range(len(self.FCM_operations[i][4])):
self.assertTrue(
np.allclose(
self.FCM_operations[i][4][j].transform_tensor(
rand_FCM[self.FCM_operations[i][2]][self.FCM_operations[i][3]]
),
rand_FCM[self.FCM_operations[i][0]][self.FCM_operations[i][1]],
atol=1e-04,
)
)
def test_get_FCM_symmetry(self):
fcm = ForceConstantMatrix(self.piezo_struc, self.FCM, self.pointops, self.sharedops)
fcm.get_FCM_operations()
fcm = fcm.get_symmetrized_FCM(np.random.rand(30, 30))
fcm = np.reshape(fcm, (10, 3, 10, 3)).swapaxes(1, 2)
for i in range(len(self.FCM_operations)):
for j in range(len(self.FCM_operations[i][4])):
self.assertTrue(
np.allclose(
self.FCM_operations[i][4][j].transform_tensor(
fcm[self.FCM_operations[i][2]][self.FCM_operations[i][3]]
),
fcm[self.FCM_operations[i][0]][self.FCM_operations[i][1]],
atol=1e-04,
)
)
def test_get_asum_FCM(self):
fcm = ForceConstantMatrix(self.piezo_struc, self.FCM, self.pointops, self.sharedops)
fcm.get_FCM_operations()
rand_FCM = fcm.get_unstable_FCM()
rand_FCM = fcm.get_asum_FCM(rand_FCM)
rand_FCM = np.reshape(rand_FCM, (10, 3, 10, 3)).swapaxes(1, 2)
for i in range(len(self.FCM_operations)):
for j in range(len(self.FCM_operations[i][4])):
self.assertTrue(
np.allclose(
self.FCM_operations[i][4][j].transform_tensor(
rand_FCM[self.FCM_operations[i][2]][self.FCM_operations[i][3]]
),
rand_FCM[self.FCM_operations[i][0]][self.FCM_operations[i][1]],
atol=1e-04,
)
)
for i in range(len(rand_FCM)):
asum1 = np.zeros([3, 3])
asum2 = np.zeros([3, 3])
for j in range(len(rand_FCM[i])):
asum1 += rand_FCM[i][j]
asum2 += rand_FCM[j][i]
self.assertTrue(np.allclose(asum1, np.zeros([3, 3]), atol=1e-05))
self.assertTrue(np.allclose(asum2, np.zeros([3, 3]), atol=1e-05))
def test_get_stable_FCM(self):
fcm = ForceConstantMatrix(self.piezo_struc, self.FCM, self.pointops, self.sharedops)
fcm.get_FCM_operations()
rand_FCM = fcm.get_unstable_FCM()
rand_FCM1 = fcm.get_stable_FCM(rand_FCM)
eigs, vecs = np.linalg.eig(rand_FCM1)
eigsort = np.argsort(np.abs(eigs))
for i in range(3, len(eigs)):
self.assertTrue(eigs[eigsort[i]] < 1e-06)
rand_FCM1 = np.reshape(rand_FCM1, (10, 3, 10, 3)).swapaxes(1, 2)
for i in range(len(self.FCM_operations)):
for j in range(len(self.FCM_operations[i][4])):
self.assertTrue(
np.allclose(
self.FCM_operations[i][4][j].transform_tensor(
rand_FCM1[self.FCM_operations[i][2]][self.FCM_operations[i][3]]
),
rand_FCM1[self.FCM_operations[i][0]][self.FCM_operations[i][1]],
atol=1e-04,
)
)
for i in range(len(rand_FCM1)):
asum1 = np.zeros([3, 3])
asum2 = np.zeros([3, 3])
for j in range(len(rand_FCM1[i])):
asum1 += rand_FCM1[i][j]
asum2 += rand_FCM1[j][i]
self.assertTrue(np.allclose(asum1, np.zeros([3, 3]), atol=1e-05))
self.assertTrue(np.allclose(asum2, np.zeros([3, 3]), atol=1e-05))
@unittest.skipIf(Phonopy is None, "Phonopy not present")
def test_rand_FCM(self):
fcm = ForceConstantMatrix(self.piezo_struc, self.FCM, self.pointops, self.sharedops)
fcm.get_FCM_operations()
rand_FCM = fcm.get_rand_FCM()
structure = pymatgen.io.phonopy.get_phonopy_structure(self.piezo_struc)
pnstruc = Phonopy(structure, np.eye(3), np.eye(3))
pnstruc.set_force_constants(rand_FCM)
dyn = pnstruc.get_dynamical_matrix_at_q([0, 0, 0])
dyn = np.reshape(dyn, (10, 3, 10, 3)).swapaxes(1, 2)
dyn = np.real(dyn)
numsites = len(self.piezo_struc)
masses = []
for j in range(numsites):
masses.append(self.piezo_struc.sites[j].specie.atomic_mass)
dynmass = np.zeros([numsites, numsites, 3, 3])
for m in range(numsites):
for n in range(numsites):
dynmass[m][n] = dyn[m][n] / np.sqrt(masses[m]) / np.sqrt(masses[n])
dynmass = np.reshape(np.swapaxes(dynmass, 1, 2), (10 * 3, 10 * 3))
eigs, vecs = np.linalg.eig(dynmass)
eigsort = np.argsort(np.abs(eigs))
for i in range(3, len(eigs)):
self.assertTrue(eigs[eigsort[i]] < 1e-06)
# rand_FCM1 = np.reshape(rand_FCM1, (10,3,10,3)).swapaxes(1,2)
dynmass = np.reshape(dynmass, (10, 3, 10, 3)).swapaxes(1, 2)
for i in range(len(self.FCM_operations)):
for j in range(len(self.FCM_operations[i][4])):
self.assertTrue(
np.allclose(
self.FCM_operations[i][4][j].transform_tensor(
dynmass[self.FCM_operations[i][2]][self.FCM_operations[i][3]]
),
dynmass[self.FCM_operations[i][0]][self.FCM_operations[i][1]],
atol=1e-04,
)
)
for i in range(len(dynmass)):
asum1 = np.zeros([3, 3])
asum2 = np.zeros([3, 3])
for j in range(len(dynmass[i])):
asum1 += dynmass[i][j]
asum2 += dynmass[j][i]
self.assertTrue(np.allclose(asum1, np.zeros([3, 3]), atol=1e-05))
self.assertTrue(np.allclose(asum2, np.zeros([3, 3]), atol=1e-05))
def test_get_piezo(self):
piezo = get_piezo(self.BEC, self.IST, self.FCM)
self.assertTrue(np.allclose(piezo, self.piezo, atol=1e-05))
@unittest.skipIf(Phonopy is None, "Phonopy not present")
def test_rand_piezo(self):
rand_BEC, rand_IST, rand_FCM, piezo = rand_piezo(
self.piezo_struc,
self.pointops,
self.sharedops,
self.BEC,
self.IST,
self.FCM,
)
for i in range(len(self.BEC_operations)):
for j in range(len(self.BEC_operations[i][2])):
self.assertTrue(
np.allclose(
rand_BEC[self.BEC_operations[i][0]],
self.BEC_operations[i][2][j].transform_tensor(rand_BEC[self.BEC_operations[i][1]]),
atol=1e-03,
)
)
for i in range(len(self.IST_operations)):
for j in range(len(self.IST_operations[i])):
self.assertTrue(
np.allclose(
rand_IST[i],
self.IST_operations[i][j][1].transform_tensor(rand_IST[self.IST_operations[i][j][0]]),
atol=1e-03,
)
)
structure = pymatgen.io.phonopy.get_phonopy_structure(self.piezo_struc)
pnstruc = Phonopy(structure, np.eye(3), np.eye(3))
pnstruc.set_force_constants(rand_FCM)
dyn = pnstruc.get_dynamical_matrix_at_q([0, 0, 0])
dyn = np.reshape(dyn, (10, 3, 10, 3)).swapaxes(1, 2)
dyn = np.real(dyn)
numsites = len(self.piezo_struc)
masses = []
for j in range(numsites):
masses.append(self.piezo_struc.sites[j].specie.atomic_mass)
dynmass = np.zeros([numsites, numsites, 3, 3])
for m in range(numsites):
for n in range(numsites):
dynmass[m][n] = dyn[m][n] / np.sqrt(masses[m]) / np.sqrt(masses[n])
dynmass = np.reshape(np.swapaxes(dynmass, 1, 2), (10 * 3, 10 * 3))
eigs, vecs = np.linalg.eig(dynmass)
eigsort = np.argsort(np.abs(eigs))
for i in range(3, len(eigs)):
self.assertTrue(eigs[eigsort[i]] < 1e-06)
# rand_FCM1 = np.reshape(rand_FCM1, (10,3,10,3)).swapaxes(1,2)
dynmass = np.reshape(dynmass, (10, 3, 10, 3)).swapaxes(1, 2)
for i in range(len(self.FCM_operations)):
for j in range(len(self.FCM_operations[i][4])):
self.assertTrue(
np.allclose(
self.FCM_operations[i][4][j].transform_tensor(
dynmass[self.FCM_operations[i][2]][self.FCM_operations[i][3]]
),
dynmass[self.FCM_operations[i][0]][self.FCM_operations[i][1]],
atol=1e-04,
)
)
for i in range(len(dynmass)):
asum1 = np.zeros([3, 3])
asum2 = np.zeros([3, 3])
for j in range(len(dynmass[i])):
asum1 += dynmass[i][j]
asum2 += dynmass[j][i]
self.assertTrue(np.allclose(asum1, np.zeros([3, 3]), atol=1e-05))
self.assertTrue(np.allclose(asum2, np.zeros([3, 3]), atol=1e-05))
if __name__ == "__main__":
unittest.main()
| 42.023055
| 110
| 0.554382
| 1,852
| 14,582
| 4.208963
| 0.099892
| 0.054779
| 0.095959
| 0.08313
| 0.765491
| 0.741373
| 0.719564
| 0.704811
| 0.69211
| 0.69211
| 0
| 0.060639
| 0.313537
| 14,582
| 346
| 111
| 42.144509
| 0.718082
| 0.016664
| 0
| 0.589831
| 0
| 0
| 0.015843
| 0.001675
| 0
| 0
| 0
| 0
| 0.091525
| 1
| 0.050847
| false
| 0
| 0.037288
| 0
| 0.091525
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
81fad5ae1abcbae616039774cab15ff0e81964d6
| 222
|
py
|
Python
|
tests/context.py
|
bartbroere/lir
|
041f1cea40366937d56c43bb15712873eb3e8a0a
|
[
"Apache-2.0"
] | 6
|
2020-12-24T08:20:04.000Z
|
2022-02-03T15:31:20.000Z
|
tests/context.py
|
bartbroere/lir
|
041f1cea40366937d56c43bb15712873eb3e8a0a
|
[
"Apache-2.0"
] | 23
|
2021-02-19T10:48:20.000Z
|
2022-03-20T12:58:11.000Z
|
tests/context.py
|
bartbroere/lir
|
041f1cea40366937d56c43bb15712873eb3e8a0a
|
[
"Apache-2.0"
] | 2
|
2021-03-04T15:26:30.000Z
|
2021-03-08T13:39:45.000Z
|
from __future__ import absolute_import
import os
import sys
# this is a hack https://github.com/pytest-dev/pytest/issues/2421
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import lir
| 24.666667
| 82
| 0.761261
| 37
| 222
| 4.324324
| 0.675676
| 0.1125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.024876
| 0.094595
| 222
| 9
| 83
| 24.666667
| 0.771144
| 0.283784
| 0
| 0
| 0
| 0
| 0.012658
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.8
| 0
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
81febafbd825396029588603c05ad070cc6866e9
| 2,339
|
py
|
Python
|
recipe/run_test.py
|
regro-cf-autotick-bot/scipy-feedstock
|
666864e2ecbe5665b82d09ceb0bfd6f8bd61c94a
|
[
"BSD-3-Clause"
] | null | null | null |
recipe/run_test.py
|
regro-cf-autotick-bot/scipy-feedstock
|
666864e2ecbe5665b82d09ceb0bfd6f8bd61c94a
|
[
"BSD-3-Clause"
] | null | null | null |
recipe/run_test.py
|
regro-cf-autotick-bot/scipy-feedstock
|
666864e2ecbe5665b82d09ceb0bfd6f8bd61c94a
|
[
"BSD-3-Clause"
] | null | null | null |
import sys
import os
# Use OpenBLAS with 1 thread only as it seems to be using too many
# on the CIs apparently.
os.environ["OPENBLAS_NUM_THREADS"] = "1"
import scipy
import scipy.cluster._hierarchy
import scipy.cluster._vq
import scipy.fftpack._fftpack
import scipy.fftpack.convolve
import scipy.integrate._dop
import scipy.integrate._odepack
import scipy.integrate._quadpack
import scipy.integrate._test_multivariate
import scipy.integrate._test_odeint_banded
import scipy.integrate.lsoda
import scipy.integrate.vode
import scipy.interpolate._fitpack
import scipy.interpolate._interpolate
import scipy.interpolate._ppoly
import scipy.interpolate.dfitpack
import scipy.interpolate.interpnd
import scipy.io.matlab.mio5_utils
import scipy.io.matlab.mio_utils
import scipy.io.matlab.streams
import scipy.linalg._decomp_update
import scipy.linalg._fblas
import scipy.linalg._flapack
import scipy.linalg._flinalg
import scipy.linalg._interpolative
import scipy.linalg._solve_toeplitz
import scipy.linalg.cython_blas
import scipy.linalg.cython_lapack
import scipy.ndimage._nd_image
import scipy.ndimage._ni_label
import scipy.odr.__odrpack
import scipy.optimize._cobyla
import scipy.optimize._group_columns
import scipy.optimize._lbfgsb
import scipy.optimize._lsq.givens_elimination
import scipy.optimize._minpack
import scipy.optimize._nnls
import scipy.optimize._slsqp
import scipy.optimize._zeros
import scipy.optimize.minpack2
import scipy.optimize.moduleTNC
import scipy.signal._max_len_seq_inner
import scipy.signal._spectral
import scipy.signal.sigtools
import scipy.signal.spline
import scipy.sparse._csparsetools
import scipy.sparse._sparsetools
import scipy.sparse.csgraph._min_spanning_tree
import scipy.sparse.csgraph._reordering
import scipy.sparse.csgraph._shortest_path
import scipy.sparse.csgraph._tools
import scipy.sparse.csgraph._traversal
import scipy.sparse.linalg.dsolve._superlu
import scipy.sparse.linalg.eigen.arpack._arpack
import scipy.sparse.linalg.isolve._iterative
import scipy.spatial._distance_wrap
import scipy.spatial.ckdtree
import scipy.spatial.qhull
import scipy.special._ellip_harm_2
import scipy.special._ufuncs
import scipy.special._ufuncs_cxx
import scipy.special.specfun
import scipy.stats.mvn
import scipy.stats.statlib
import scipy.stats
import scipy.special
sys.exit(not scipy.test(verbose=2))
| 29.987179
| 66
| 0.859769
| 334
| 2,339
| 5.811377
| 0.383234
| 0.374034
| 0.097888
| 0.061824
| 0.02473
| 0
| 0
| 0
| 0
| 0
| 0
| 0.002761
| 0.070971
| 2,339
| 77
| 67
| 30.376623
| 0.890474
| 0.037195
| 0
| 0
| 0
| 0
| 0.009337
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.971429
| 0
| 0.971429
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
c308bef88be33aa9dbdef14c29e2c276763b3565
| 95
|
py
|
Python
|
transformer/utils/__init__.py
|
ViktorStagge/transformer
|
39a331f41cafbfbe5fdf64ffdac5897b4d2aa319
|
[
"MIT"
] | null | null | null |
transformer/utils/__init__.py
|
ViktorStagge/transformer
|
39a331f41cafbfbe5fdf64ffdac5897b4d2aa319
|
[
"MIT"
] | null | null | null |
transformer/utils/__init__.py
|
ViktorStagge/transformer
|
39a331f41cafbfbe5fdf64ffdac5897b4d2aa319
|
[
"MIT"
] | null | null | null |
from transformer.utils.utils import get_tqdm, \
get_logger
| 31.666667
| 47
| 0.515789
| 9
| 95
| 5.222222
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.442105
| 95
| 2
| 48
| 47.5
| 0.886792
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
c30dcec0382001121669c3e0c0090d186fa177a6
| 78
|
py
|
Python
|
sdnify/platforms/__init__.py
|
ericrochow/sdnify
|
f84020ea846282a60b754583a574a9109bf73834
|
[
"Apache-2.0"
] | 1
|
2019-08-18T11:21:40.000Z
|
2019-08-18T11:21:40.000Z
|
sdnify/platforms/__init__.py
|
ericrochow/sdnify
|
f84020ea846282a60b754583a574a9109bf73834
|
[
"Apache-2.0"
] | 93
|
2019-08-18T11:21:46.000Z
|
2020-10-03T04:13:25.000Z
|
sdnify/platforms/__init__.py
|
ericrochow/sdnify
|
f84020ea846282a60b754583a574a9109bf73834
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python
"""
Contains modules for platform-specific methods.
"""
| 15.6
| 47
| 0.717949
| 10
| 78
| 5.6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115385
| 78
| 4
| 48
| 19.5
| 0.811594
| 0.871795
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c31ff3f9cc9855909f0bba3cd706795681370136
| 593
|
py
|
Python
|
parser_rabota/web/models.py
|
AndreyeuIvan/JobScrabber
|
fab960dde260fd2b94e846e95b46e97d313db235
|
[
"MIT"
] | null | null | null |
parser_rabota/web/models.py
|
AndreyeuIvan/JobScrabber
|
fab960dde260fd2b94e846e95b46e97d313db235
|
[
"MIT"
] | null | null | null |
parser_rabota/web/models.py
|
AndreyeuIvan/JobScrabber
|
fab960dde260fd2b94e846e95b46e97d313db235
|
[
"MIT"
] | null | null | null |
from main import db
class Keyword(db.Model):
id = db.Column(db.Integer, primary_key = True)
name = db.Column(db.String(100))
data = db.relationship('Data', backref='data')
def __repr__(self):
return f"Keyword is '{self.name}'"
class Data(db.Model):
id = db.Column(db.Integer, primary_key = True)
company = db.Column(db.String(100))
title = db.Column(db.String(50))
link = db.Column(db.String(200))
location = db.Column(db.String(100))
keyword = db.Column(db.Integer, db.ForeignKey("keyword.id"))
def __repr__(self):
return f"Job in '{self.company}', as a '{self.title}'"
| 25.782609
| 61
| 0.688027
| 95
| 593
| 4.189474
| 0.378947
| 0.160804
| 0.201005
| 0.201005
| 0.434673
| 0.201005
| 0.201005
| 0.201005
| 0.201005
| 0.201005
| 0
| 0.02729
| 0.134907
| 593
| 22
| 62
| 26.954545
| 0.748538
| 0
| 0
| 0.25
| 0
| 0
| 0.145025
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.125
| false
| 0
| 0.0625
| 0.125
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
c356da6307ea4e397b6f3f98f4044a41a9825154
| 138
|
py
|
Python
|
lambdata_jbanks/banks.py
|
JenBanks8585/lambdata-JenBanks
|
7b4d01e9a8e3ad6d1c5a39ff5aa5cf01e99849ef
|
[
"MIT"
] | null | null | null |
lambdata_jbanks/banks.py
|
JenBanks8585/lambdata-JenBanks
|
7b4d01e9a8e3ad6d1c5a39ff5aa5cf01e99849ef
|
[
"MIT"
] | null | null | null |
lambdata_jbanks/banks.py
|
JenBanks8585/lambdata-JenBanks
|
7b4d01e9a8e3ad6d1c5a39ff5aa5cf01e99849ef
|
[
"MIT"
] | null | null | null |
import pandas
from pandas import DataFrame
from lambdata_jbanks.mod import enlarge
x= int(input("enter an integer"))
print(enlarge(x))
| 15.333333
| 39
| 0.782609
| 21
| 138
| 5.095238
| 0.714286
| 0.149533
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.130435
| 138
| 9
| 40
| 15.333333
| 0.891667
| 0
| 0
| 0
| 0
| 0
| 0.116788
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.6
| 0
| 0.6
| 0.2
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
6f2fd25a34eeb278f9fe3cd36b601c79f812532e
| 33
|
py
|
Python
|
pay.py
|
BCshell/42_02
|
f8fdf76a6561524e15ba21a1aae158aec5e976df
|
[
"MIT"
] | null | null | null |
pay.py
|
BCshell/42_02
|
f8fdf76a6561524e15ba21a1aae158aec5e976df
|
[
"MIT"
] | null | null | null |
pay.py
|
BCshell/42_02
|
f8fdf76a6561524e15ba21a1aae158aec5e976df
|
[
"MIT"
] | null | null | null |
pay = 1
pay = 2
pay = 3
over
| 3.666667
| 7
| 0.484848
| 7
| 33
| 2.285714
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 0.424242
| 33
| 8
| 8
| 4.125
| 0.684211
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6f3e9cb43d9fa685466c4f1e9da3c56f0832e136
| 236
|
py
|
Python
|
gym_trader/__init__.py
|
jajimer/gym-trader
|
5ccb7bfbd280a1260ea56adbe1c6e2fdc66ac415
|
[
"MIT"
] | null | null | null |
gym_trader/__init__.py
|
jajimer/gym-trader
|
5ccb7bfbd280a1260ea56adbe1c6e2fdc66ac415
|
[
"MIT"
] | null | null | null |
gym_trader/__init__.py
|
jajimer/gym-trader
|
5ccb7bfbd280a1260ea56adbe1c6e2fdc66ac415
|
[
"MIT"
] | null | null | null |
from gym.envs.registration import register
register(
id='single-discrete-v0',
entry_point='gym_trader.envs:SingleDiscreteEnv',
)
register(
id='single-continuous-v0',
entry_point='gym_trader.envs:SingleContinuousEnv',
)
| 21.454545
| 54
| 0.75
| 28
| 236
| 6.178571
| 0.571429
| 0.115607
| 0.184971
| 0.17341
| 0.289017
| 0.289017
| 0
| 0
| 0
| 0
| 0
| 0.009662
| 0.122881
| 236
| 10
| 55
| 23.6
| 0.826087
| 0
| 0
| 0.222222
| 0
| 0
| 0.449153
| 0.288136
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.111111
| 0
| 0.111111
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6f43e606edba65d7d506b3ed9533b89cc35ea7de
| 192
|
py
|
Python
|
snowfall/bin/modes/cli_base.py
|
aarora8/snowfall
|
4484fb52a7a2d9a067f77dbbaee8dad7946db185
|
[
"Apache-2.0"
] | 145
|
2020-11-12T07:12:31.000Z
|
2022-03-11T14:56:15.000Z
|
snowfall/bin/modes/cli_base.py
|
aarora8/snowfall
|
4484fb52a7a2d9a067f77dbbaee8dad7946db185
|
[
"Apache-2.0"
] | 212
|
2020-11-12T07:47:39.000Z
|
2022-02-02T08:11:33.000Z
|
snowfall/bin/modes/cli_base.py
|
aarora8/snowfall
|
4484fb52a7a2d9a067f77dbbaee8dad7946db185
|
[
"Apache-2.0"
] | 43
|
2020-11-12T07:30:37.000Z
|
2022-03-15T08:07:19.000Z
|
# Copyright (c) 2021 Xiaomi Corp. (author: Fangjun Kuang)
import click
@click.group()
def cli():
'''
Entry point to the collection of utilities in snowall.
'''
pass
| 16
| 65
| 0.614583
| 24
| 192
| 4.916667
| 0.958333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.028777
| 0.276042
| 192
| 11
| 66
| 17.454545
| 0.820144
| 0.619792
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0.25
| 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
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
6f4b6a528b00bc6d9cb6b9444b8656b7b230eb3d
| 725
|
py
|
Python
|
app01/migrations/0008_auto_20211102_1151.py
|
aitomato123/hptest
|
842cf5f8c9f419c1a9395f43563d19213a1d531a
|
[
"Apache-2.0"
] | null | null | null |
app01/migrations/0008_auto_20211102_1151.py
|
aitomato123/hptest
|
842cf5f8c9f419c1a9395f43563d19213a1d531a
|
[
"Apache-2.0"
] | null | null | null |
app01/migrations/0008_auto_20211102_1151.py
|
aitomato123/hptest
|
842cf5f8c9f419c1a9395f43563d19213a1d531a
|
[
"Apache-2.0"
] | null | null | null |
# Generated by Django 3.2.4 on 2021-11-02 03:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app01', '0007_auto_20211102_1130'),
]
operations = [
migrations.RenameField(
model_name='samplehandover',
old_name='samplehandover_to_project_id',
new_name='sh_pid',
),
migrations.RenameField(
model_name='samplehandover',
old_name='samplehandover_to_sample_type',
new_name='sh_spt',
),
migrations.RenameField(
model_name='samplehandover',
old_name='samplehandover_to_storage',
new_name='sh_sto',
),
]
| 25
| 53
| 0.590345
| 72
| 725
| 5.625
| 0.569444
| 0.266667
| 0.192593
| 0.222222
| 0.496296
| 0.496296
| 0.496296
| 0.496296
| 0.496296
| 0
| 0
| 0.065868
| 0.308966
| 725
| 28
| 54
| 25.892857
| 0.742515
| 0.062069
| 0
| 0.409091
| 1
| 0
| 0.250737
| 0.154867
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.045455
| 0
| 0.181818
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6f62df2d6250a39fcbbddc94e477b42a5bb88277
| 12,902
|
py
|
Python
|
openbb_terminal/common/quantitative_analysis/rolling_view.py
|
23errg/GamestonkTerminal
|
826cd8a723d8e2b810c51bf8266c09e8e55059c4
|
[
"MIT"
] | null | null | null |
openbb_terminal/common/quantitative_analysis/rolling_view.py
|
23errg/GamestonkTerminal
|
826cd8a723d8e2b810c51bf8266c09e8e55059c4
|
[
"MIT"
] | null | null | null |
openbb_terminal/common/quantitative_analysis/rolling_view.py
|
23errg/GamestonkTerminal
|
826cd8a723d8e2b810c51bf8266c09e8e55059c4
|
[
"MIT"
] | null | null | null |
"""Rolling Statistics View"""
__docformat__ = "numpy"
import logging
import os
from typing import Optional, List
import matplotlib.pyplot as plt
import pandas as pd
from openbb_terminal.config_terminal import theme
from openbb_terminal.common.quantitative_analysis import rolling_model
from openbb_terminal.config_plot import PLOT_DPI
from openbb_terminal.decorators import log_start_end
from openbb_terminal.helper_funcs import export_data, plot_autoscale, reindex_dates
from openbb_terminal.rich_config import console
logger = logging.getLogger(__name__)
@log_start_end(log=logger)
def display_mean_std(
name: str,
df: pd.DataFrame,
target: str,
window: int,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
):
"""View rolling spread
Parameters
----------
name : str
Stock ticker
df : pd.DataFrame
Dataframe
target : str
Column in data to look at
window : int
Length of window
export : str
Format to export data
external_axes : Optional[List[plt.Axes]], optional
External axes (2 axes are expected in the list), by default None
"""
data = df[target]
rolling_mean, rolling_std = rolling_model.get_rolling_avg(data, window)
plot_data = pd.merge(
data,
rolling_mean,
how="outer",
left_index=True,
right_index=True,
suffixes=("", "_mean"),
)
plot_data = pd.merge(
plot_data,
rolling_std,
how="outer",
left_index=True,
right_index=True,
suffixes=("", "_std"),
)
plot_data = reindex_dates(plot_data)
# This plot has 2 axes
if external_axes is None:
_, axes = plt.subplots(
2,
1,
sharex=True,
figsize=plot_autoscale(),
dpi=PLOT_DPI,
)
ax1, ax2 = axes
else:
if len(external_axes) != 2:
logger.error("Expected list of two axis items.")
console.print("[red]Expected list of 2 axis items./n[/red]")
return
(ax1, ax2) = external_axes
ax1.plot(
plot_data.index,
plot_data[target].values,
label=name,
)
ax1.plot(
plot_data.index,
plot_data[target + "_mean"].values,
)
ax1.set_ylabel(
"Values",
)
ax1.legend(["Real Values", "Rolling Mean"])
ax1.set_title(f"Rolling mean and std (window {str(window)}) of {name} {target}")
ax1.set_xlim([plot_data.index[0], plot_data.index[-1]])
ax2.plot(
plot_data.index,
plot_data[target + "_std"].values,
label="Rolling std",
)
ax2.legend(["Rolling std"])
ax2.set_ylabel(
f"{target} Std Deviation",
)
theme.style_primary_axis(
ax1,
data_index=plot_data.index.to_list(),
tick_labels=plot_data["date"].to_list(),
)
theme.style_primary_axis(
ax2,
data_index=plot_data.index.to_list(),
tick_labels=plot_data["date"].to_list(),
)
if external_axes is None:
theme.visualize_output()
export_data(
export,
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
"rolling",
rolling_mean.join(rolling_std, lsuffix="_mean", rsuffix="_std"),
)
@log_start_end(log=logger)
def display_spread(
name: str,
df: pd.DataFrame,
target: str,
window: int,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
):
"""View rolling spread
Parameters
----------
name : str
Stock ticker
df : pd.DataFrame
Dataframe
target: str
Column in data to look at
window : int
Length of window
export : str
Format to export data
external_axes : Optional[List[plt.Axes]], optional
External axes (3 axes are expected in the list), by default None
"""
data = df[target]
df_sd, df_var = rolling_model.get_spread(data, window)
plot_data = pd.merge(
data,
df_sd,
how="outer",
left_index=True,
right_index=True,
suffixes=("", "_sd"),
)
plot_data = pd.merge(
plot_data,
df_var,
how="outer",
left_index=True,
right_index=True,
suffixes=("", "_var"),
)
plot_data = reindex_dates(plot_data)
# This plot has 1 axis
if external_axes is None:
_, axes = plt.subplots(
3,
1,
sharex=True,
figsize=plot_autoscale(),
dpi=PLOT_DPI,
)
(ax1, ax2, ax3) = axes
else:
if len(external_axes) != 3:
logger.error("Expected list of one axis item.")
console.print("[red]Expected list of 1 axis items./n[/red]")
return
(ax1, ax2, ax3) = external_axes
ax1.plot(plot_data.index, plot_data[target].values)
ax1.set_xlim(plot_data.index[0], plot_data.index[-1])
ax1.set_ylabel("Value")
ax1.set_title(f"Spread of {name} {target}")
ax2.plot(
plot_data[f"STDEV_{window}"].index,
plot_data[f"STDEV_{window}"].values,
label="Stdev",
)
ax2.set_ylabel("Stdev")
ax3.plot(
plot_data[f"VAR_{window}"].index,
plot_data[f"VAR_{window}"].values,
label="Variance",
)
ax3.set_ylabel("Variance")
theme.style_primary_axis(
ax1,
data_index=plot_data.index.to_list(),
tick_labels=plot_data["date"].to_list(),
)
theme.style_primary_axis(
ax2,
data_index=plot_data.index.to_list(),
tick_labels=plot_data["date"].to_list(),
)
theme.style_primary_axis(
ax3,
data_index=plot_data.index.to_list(),
tick_labels=plot_data["date"].to_list(),
)
if external_axes is None:
theme.visualize_output()
export_data(
export,
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
"spread",
df_sd.join(df_var, lsuffix="_sd", rsuffix="_var"),
)
@log_start_end(log=logger)
def display_quantile(
name: str,
df: pd.DataFrame,
target: str,
window: int,
quantile: float,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
):
"""View rolling quantile
Parameters
----------
name : str
Stock ticker
df : pd.DataFrame
Dataframe
target : str
Column in data to look at
window : int
Length of window
quantile : float
Quantile to get
export : str
Format to export data
external_axes : Optional[List[plt.Axes]], optional
External axes (1 axis is expected in the list), by default None
"""
data = df[target]
df_med, df_quantile = rolling_model.get_quantile(data, window, quantile)
plot_data = pd.merge(
data,
df_med,
how="outer",
left_index=True,
right_index=True,
suffixes=("", "_med"),
)
plot_data = pd.merge(
plot_data,
df_quantile,
how="outer",
left_index=True,
right_index=True,
suffixes=("", "_quantile"),
)
plot_data = reindex_dates(plot_data)
# This plot has 1 axis
if external_axes is None:
_, ax = plt.subplots(
figsize=plot_autoscale(),
dpi=PLOT_DPI,
)
else:
if len(external_axes) != 1:
logger.error("Expected list of one axis item.")
console.print("[red]Expected list of 1 axis items./n[/red]")
return
(ax,) = external_axes
ax.set_title(f"{name} {target} Median & Quantile")
ax.plot(plot_data.index, plot_data[target].values, label=target)
ax.plot(
plot_data.index,
plot_data[f"MEDIAN_{window}"].values,
label=f"Median w={window}",
)
ax.plot(
plot_data.index,
plot_data[f"QTL_{window}_{quantile}"].values,
label=f"Quantile q={quantile}",
linestyle="--",
)
ax.set_xlim(plot_data.index[0], plot_data.index[-1])
ax.set_ylabel(f"{name} Value")
ax.legend()
theme.style_primary_axis(
ax,
data_index=plot_data.index.to_list(),
tick_labels=plot_data["date"].to_list(),
)
if external_axes is None:
theme.visualize_output()
export_data(
export,
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
"quantile",
df_med.join(df_quantile),
)
@log_start_end(log=logger)
def display_skew(
name: str,
df: pd.DataFrame,
target: str,
window: int,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
):
"""View rolling skew
Parameters
----------
name : str
Stock ticker
df : pd.DataFrame
Dataframe
target : str
Column in data to look at
window : int
Length of window
export : str
Format to export data
external_axes : Optional[List[plt.Axes]], optional
External axes (2 axes are expected in the list), by default None
"""
data = df[target]
df_skew = rolling_model.get_skew(data, window)
plot_data = pd.merge(
data,
df_skew,
how="outer",
left_index=True,
right_index=True,
)
plot_data = reindex_dates(plot_data)
# This plot has 1 axis
if external_axes is None:
_, axes = plt.subplots(
2,
1,
sharex=True,
figsize=plot_autoscale(),
dpi=PLOT_DPI,
)
(ax1, ax2) = axes
else:
if len(external_axes) != 2:
logger.error("Expected list of two axis items.")
console.print("[red]Expected list of 2 axis items./n[/red]")
return
(ax1, ax2) = external_axes
ax1.set_title(f"{name} Skewness Indicator")
ax1.plot(plot_data.index, plot_data[target].values)
ax1.set_xlim(plot_data.index[0], plot_data.index[-1])
ax1.set_ylabel(f"{target}")
ax2.plot(plot_data.index, plot_data[f"SKEW_{window}"].values, label="Skew")
ax2.set_ylabel("Indicator")
theme.style_primary_axis(
ax1,
data_index=plot_data.index.to_list(),
tick_labels=plot_data["date"].to_list(),
)
theme.style_primary_axis(
ax2,
data_index=plot_data.index.to_list(),
tick_labels=plot_data["date"].to_list(),
)
if external_axes is None:
theme.visualize_output()
console.print("")
export_data(
export,
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
"skew",
df_skew,
)
@log_start_end(log=logger)
def display_kurtosis(
name: str,
df: pd.DataFrame,
target: str,
window: int,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
):
"""View rolling kurtosis
Parameters
----------
name : str
Ticker
df : pd.DataFrame
Dataframe of stock prices
window : int
Length of window
export : str
Format to export data
external_axes : Optional[List[plt.Axes]], optional
External axes (2 axes are expected in the list), by default None
"""
data = df[target]
df_kurt = rolling_model.get_kurtosis(data, window)
plot_data = pd.merge(
data,
df_kurt,
how="outer",
left_index=True,
right_index=True,
)
plot_data = reindex_dates(plot_data)
# This plot has 1 axis
if external_axes is None:
_, axes = plt.subplots(
2,
1,
sharex=True,
figsize=plot_autoscale(),
dpi=PLOT_DPI,
)
(ax1, ax2) = axes
else:
if len(external_axes) != 2:
logger.error("Expected list of two axis items.")
console.print("[red]Expected list of 2 axis items./n[/red]")
return
(ax1, ax2) = external_axes
ax1.set_title(f"{name} {target} Kurtosis Indicator (window {str(window)})")
ax1.plot(plot_data.index, plot_data[target].values)
ax1.set_xlim(plot_data.index[0], plot_data.index[-1])
ax1.set_ylabel(f"{target}")
ax2.plot(
plot_data.index,
plot_data[f"KURT_{window}"].values,
)
ax2.set_ylabel("Indicator")
theme.style_primary_axis(
ax1,
data_index=plot_data.index.to_list(),
tick_labels=plot_data["date"].to_list(),
)
theme.style_primary_axis(
ax2,
data_index=plot_data.index.to_list(),
tick_labels=plot_data["date"].to_list(),
)
if external_axes is None:
theme.visualize_output()
console.print("")
export_data(
export,
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
"kurtosis",
df_kurt,
)
| 25.248532
| 84
| 0.586188
| 1,617
| 12,902
| 4.460111
| 0.097093
| 0.085413
| 0.055879
| 0.049501
| 0.781614
| 0.757626
| 0.743899
| 0.706323
| 0.680948
| 0.627981
| 0
| 0.010318
| 0.293908
| 12,902
| 510
| 85
| 25.298039
| 0.781339
| 0.141683
| 0
| 0.648649
| 0
| 0
| 0.104062
| 0.002143
| 0
| 0
| 0
| 0
| 0
| 1
| 0.013514
| false
| 0
| 0.02973
| 0
| 0.056757
| 0.018919
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
489a77b5a707184b360e0634e711b01b15a25abd
| 136
|
py
|
Python
|
Python/Codeforces/1A.py
|
flmnv/Training
|
6070b8ddfb6e01c0f433c813265bf50d59a26ef4
|
[
"Unlicense"
] | null | null | null |
Python/Codeforces/1A.py
|
flmnv/Training
|
6070b8ddfb6e01c0f433c813265bf50d59a26ef4
|
[
"Unlicense"
] | null | null | null |
Python/Codeforces/1A.py
|
flmnv/Training
|
6070b8ddfb6e01c0f433c813265bf50d59a26ef4
|
[
"Unlicense"
] | null | null | null |
from math import ceil
nma = input().split(' ')
result = ceil(int(nma[0]) / int(nma[2])) * ceil(int(nma[1]) / int(nma[2]))
print(result)
| 27.2
| 74
| 0.617647
| 24
| 136
| 3.5
| 0.541667
| 0.285714
| 0.238095
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.033898
| 0.132353
| 136
| 5
| 75
| 27.2
| 0.677966
| 0
| 0
| 0
| 0
| 0
| 0.007299
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 0.25
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
48ae8c6f3922d6e7ec644846f97660711d6cfca0
| 277
|
py
|
Python
|
run_examples.py
|
bstellato/miosqp
|
ac672338b0593d865dd15b7a76434f25e24244a9
|
[
"Apache-2.0"
] | 62
|
2017-11-23T09:57:47.000Z
|
2021-05-21T06:49:40.000Z
|
run_examples.py
|
bstellato/miosqp
|
ac672338b0593d865dd15b7a76434f25e24244a9
|
[
"Apache-2.0"
] | 12
|
2017-08-31T17:28:14.000Z
|
2021-04-19T15:19:17.000Z
|
run_examples.py
|
bstellato/miosqp
|
ac672338b0593d865dd15b7a76434f25e24244a9
|
[
"Apache-2.0"
] | 19
|
2019-01-23T14:10:37.000Z
|
2021-04-17T17:08:28.000Z
|
"""
Run MIQP examples
"""
from __future__ import print_function
import examples.power_converter.run_example as power_converter
import examples.random_miqp.run_example as random_miqp
if __name__ == "__main__":
random_miqp.run_example()
power_converter.run_example()
| 19.785714
| 62
| 0.797834
| 37
| 277
| 5.351351
| 0.432432
| 0.20202
| 0.171717
| 0.242424
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.126354
| 277
| 13
| 63
| 21.307692
| 0.818182
| 0.061372
| 0
| 0
| 0
| 0
| 0.031746
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0.166667
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
48c7bf8eab29ebaf195b176af688e2d1694ca5d3
| 699
|
py
|
Python
|
backend_server/tests/test_pybackend_urilib.py
|
ismir-net/open-eval
|
ebb4612ff5a6c6f7b6fbc908d837857f8377d95a
|
[
"MIT"
] | 6
|
2016-08-09T18:34:18.000Z
|
2016-08-12T01:58:05.000Z
|
backend_server/tests/test_pybackend_urilib.py
|
cosmir/openmic-annotator
|
ebb4612ff5a6c6f7b6fbc908d837857f8377d95a
|
[
"MIT"
] | 4
|
2016-08-13T14:35:00.000Z
|
2016-08-13T14:37:25.000Z
|
backend_server/tests/test_pybackend_urilib.py
|
ismir-net/open-eval
|
ebb4612ff5a6c6f7b6fbc908d837857f8377d95a
|
[
"MIT"
] | null | null | null |
import pytest
import pybackend.urilib as U
def test_validate():
U.validate("x:y")
with pytest.raises(ValueError):
U.validate(":x")
with pytest.raises(ValueError):
U.validate("y:")
with pytest.raises(ValueError):
U.validate(":")
with pytest.raises(ValueError):
U.validate("x:x:y")
def test_split():
assert U.split("x:y") == ("x", "y")
with pytest.raises(ValueError):
U.split(":x")
def test_join():
assert U.join("x", "y") == "x:y"
with pytest.raises(ValueError):
U.join("x")
with pytest.raises(ValueError):
U.join("x", "y", "z")
with pytest.raises(ValueError):
U.join(":x", "y")
| 18.394737
| 39
| 0.566524
| 94
| 699
| 4.180851
| 0.191489
| 0.040712
| 0.3257
| 0.529262
| 0.707379
| 0.707379
| 0.618321
| 0.3257
| 0.157761
| 0
| 0
| 0
| 0.244635
| 699
| 37
| 40
| 18.891892
| 0.744318
| 0
| 0
| 0.333333
| 0
| 0
| 0.04578
| 0
| 0
| 0
| 0
| 0
| 0.083333
| 1
| 0.125
| true
| 0
| 0.083333
| 0
| 0.208333
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
48cf42970538a19959fd912b200541cab893d500
| 1,661
|
py
|
Python
|
app/models.py
|
Koech-code/bookings
|
e164ba118de32e82dac9d9c69961df1eeb4d384c
|
[
"MIT"
] | null | null | null |
app/models.py
|
Koech-code/bookings
|
e164ba118de32e82dac9d9c69961df1eeb4d384c
|
[
"MIT"
] | null | null | null |
app/models.py
|
Koech-code/bookings
|
e164ba118de32e82dac9d9c69961df1eeb4d384c
|
[
"MIT"
] | null | null | null |
from datetime import datetime
from sqlalchemy.orm import backref
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from . import login_manager
from . import db
@login_manager.user_loader
def load_user(user_id):
return User.query.get(user_id)
class User(UserMixin, db.Model):
__tablename__='users'
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(255))
email = db.Column(db.String(255))
pass_secure = db.Column(db.String(255))
@property
def password(self):
raise AttributeError('You cannot read the password attribute')
@password.setter
def password(self, password):
self.pass_secure = generate_password_hash(password)
def verify_password(self,password):
return check_password_hash(self.pass_secure,password)
def __repr__(self):
return f'User {self.username}'
class Session(db.Model):
__tablename__='sessions'
id = db.Column(db.Integer, primary_key=True)
tarehe = db.Column(db.Date())
email = db.Column(db.String(255))
service=db.Column(db.String(255))
status= db.Column(db.String(255))
class Cancel(db.Model):
__tablename__='del'
id = db.Column(db.Integer, primary_key=True)
tarehe = db.Column(db.Date())
email = db.Column(db.String(255))
service=db.Column(db.String(255))
status= db.Column(db.String(255))
class Contact(db.Model):
__tablename__='feedback'
id = db.Column(db.Integer, primary_key=True)
name= db.Column(db.String(255))
email = db.Column(db.String(255))
message=db.Column(db.String(255))
| 28.152542
| 73
| 0.701987
| 232
| 1,661
| 4.840517
| 0.280172
| 0.128228
| 0.160285
| 0.170971
| 0.406055
| 0.372217
| 0.372217
| 0.372217
| 0.313446
| 0.313446
| 0
| 0.026297
| 0.175798
| 1,661
| 58
| 74
| 28.637931
| 0.79401
| 0
| 0
| 0.311111
| 1
| 0
| 0.049427
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.111111
| false
| 0.2
| 0.133333
| 0.066667
| 0.888889
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
48d2f1512a3d93d8436cd8f13cc0b3a207c90588
| 64
|
py
|
Python
|
lib/galaxy/tool_util/linters/__init__.py
|
rikeshi/galaxy
|
c536a877e4a9b3d12aa0d00fd4d5e705109a0d0a
|
[
"CC-BY-3.0"
] | 1,085
|
2015-02-18T16:14:38.000Z
|
2022-03-30T23:52:07.000Z
|
lib/galaxy/tool_util/linters/__init__.py
|
rikeshi/galaxy
|
c536a877e4a9b3d12aa0d00fd4d5e705109a0d0a
|
[
"CC-BY-3.0"
] | 11,253
|
2015-02-18T17:47:32.000Z
|
2022-03-31T21:47:03.000Z
|
lib/galaxy/tool_util/linters/__init__.py
|
rikeshi/galaxy
|
c536a877e4a9b3d12aa0d00fd4d5e705109a0d0a
|
[
"CC-BY-3.0"
] | 1,000
|
2015-02-18T16:18:10.000Z
|
2022-03-29T08:22:56.000Z
|
"""This package contains linting functions for Galaxy tools."""
| 32
| 63
| 0.765625
| 8
| 64
| 6.125
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125
| 64
| 1
| 64
| 64
| 0.875
| 0.890625
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
48eebc92ff0684d98295f1a379d39559fbd41024
| 178
|
py
|
Python
|
diventi/brave/apps.py
|
flavoi/diven
|
3173ca3ca3fbedc191b8eab3639a6bceb3c442c4
|
[
"Apache-2.0"
] | 2
|
2019-06-27T16:00:17.000Z
|
2020-08-14T07:46:05.000Z
|
diventi/brave/apps.py
|
flavoi/diven
|
3173ca3ca3fbedc191b8eab3639a6bceb3c442c4
|
[
"Apache-2.0"
] | 26
|
2020-02-15T22:39:35.000Z
|
2022-02-19T21:09:01.000Z
|
diventi/brave/apps.py
|
flavoi/diven
|
3173ca3ca3fbedc191b8eab3639a6bceb3c442c4
|
[
"Apache-2.0"
] | 1
|
2021-11-12T22:30:15.000Z
|
2021-11-12T22:30:15.000Z
|
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class BraveConfig(AppConfig):
name = 'diventi.brave'
verbose_name = _('Brave')
| 22.25
| 54
| 0.758427
| 22
| 178
| 5.954545
| 0.727273
| 0.152672
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157303
| 178
| 7
| 55
| 25.428571
| 0.873333
| 0
| 0
| 0
| 0
| 0
| 0.101124
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
5b050e90ac3f072754ac05656df3e41d25a3dbb8
| 676
|
py
|
Python
|
api/infrastructure/persistence/peewee/results_models.py
|
manisharmagarg/qymatix
|
0dc240970359429ae5105db79f9aebf1a99ba6fd
|
[
"Apache-2.0"
] | null | null | null |
api/infrastructure/persistence/peewee/results_models.py
|
manisharmagarg/qymatix
|
0dc240970359429ae5105db79f9aebf1a99ba6fd
|
[
"Apache-2.0"
] | null | null | null |
api/infrastructure/persistence/peewee/results_models.py
|
manisharmagarg/qymatix
|
0dc240970359429ae5105db79f9aebf1a99ba6fd
|
[
"Apache-2.0"
] | null | null | null |
from peewee import *
database = MySQLDatabase('results_qymatix_com', **{'charset': 'utf8', 'use_unicode': True, 'host': 'localhost', 'user': 'root', 'password': 'dev'})
class UnknownField(object):
def __init__(self, *_, **__): pass
class BaseModel(Model):
class Meta:
database = database
class Critters(BaseModel):
ccbm = TextField(null=True)
margin = TextField(null=True)
name = TextField(null=True)
ppb = TextField(null=True)
risk = TextField(null=True)
row_names = TextField(null=True)
sales = TextField(null=True)
size = TextField(null=True)
class Meta:
table_name = 'critters'
primary_key = False
| 26
| 147
| 0.655325
| 77
| 676
| 5.584416
| 0.584416
| 0.24186
| 0.316279
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.001862
| 0.205621
| 676
| 25
| 148
| 27.04
| 0.798883
| 0
| 0
| 0.105263
| 0
| 0
| 0.12
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.052632
| false
| 0.105263
| 0.052632
| 0
| 0.789474
| 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
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
d2967bf07661e5d38488849f9f38933d29a1422f
| 67
|
py
|
Python
|
docker-gunicorn.conf.py
|
noampolak/ADL_LRS
|
86455e0cee1cfe8525143eb07d9ec86f2bda05c1
|
[
"Apache-2.0"
] | null | null | null |
docker-gunicorn.conf.py
|
noampolak/ADL_LRS
|
86455e0cee1cfe8525143eb07d9ec86f2bda05c1
|
[
"Apache-2.0"
] | null | null | null |
docker-gunicorn.conf.py
|
noampolak/ADL_LRS
|
86455e0cee1cfe8525143eb07d9ec86f2bda05c1
|
[
"Apache-2.0"
] | null | null | null |
accesslog = "/var/log/lrs.log"
errorlog = "/var/log/lrs-error.log"
| 22.333333
| 35
| 0.686567
| 11
| 67
| 4.181818
| 0.545455
| 0.26087
| 0.391304
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.089552
| 67
| 2
| 36
| 33.5
| 0.754098
| 0
| 0
| 0
| 0
| 0
| 0.567164
| 0.328358
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d299f24fb0efddf88b71f453b95ee23cfaf5a6ff
| 704
|
py
|
Python
|
third_party/blink/web_tests/http/tests/websocket/workers/resources/binary-frames_wsh.py
|
zealoussnow/chromium
|
fd8a8914ca0183f0add65ae55f04e287543c7d4a
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 14,668
|
2015-01-01T01:57:10.000Z
|
2022-03-31T23:33:32.000Z
|
third_party/blink/web_tests/http/tests/websocket/workers/resources/binary-frames_wsh.py
|
zealoussnow/chromium
|
fd8a8914ca0183f0add65ae55f04e287543c7d4a
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 113
|
2015-05-04T09:58:14.000Z
|
2022-01-31T19:35:03.000Z
|
third_party/blink/web_tests/http/tests/websocket/workers/resources/binary-frames_wsh.py
|
zealoussnow/chromium
|
fd8a8914ca0183f0add65ae55f04e287543c7d4a
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 5,941
|
2015-01-02T11:32:21.000Z
|
2022-03-31T16:35:46.000Z
|
from six.moves import range
from mod_pywebsocket import common
from mod_pywebsocket import stream
from mod_pywebsocket import util
def web_socket_do_extra_handshake(request):
pass
def web_socket_transfer_data(request):
messages_to_send = [b'Hello, world!', b'', all_distinct_bytes()]
for message in messages_to_send:
# FIXME: Should use better API to send binary messages when pywebsocket
# supports it.
header = stream.create_header(common.OPCODE_BINARY,
len(message), 1, 0, 0, 0, 0)
request.connection.write(header + message)
def all_distinct_bytes():
return b''.join([util.pack_byte(i) for i in range(256)])
| 29.333333
| 79
| 0.691761
| 98
| 704
| 4.755102
| 0.561224
| 0.045064
| 0.11588
| 0.154506
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.014679
| 0.225852
| 704
| 23
| 80
| 30.608696
| 0.840367
| 0.116477
| 0
| 0
| 0
| 0
| 0.021002
| 0
| 0
| 0
| 0
| 0.043478
| 0
| 1
| 0.214286
| false
| 0.071429
| 0.285714
| 0.071429
| 0.571429
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
d2baa34db83ba7f092bd6f1a54fecfa995304c91
| 50
|
py
|
Python
|
smartlearner/optimizers/__init__.py
|
havaeimo/smartlearner
|
9fa0d4e757310b185e5c0d2ff43279d21ab4cb17
|
[
"BSD-3-Clause"
] | null | null | null |
smartlearner/optimizers/__init__.py
|
havaeimo/smartlearner
|
9fa0d4e757310b185e5c0d2ff43279d21ab4cb17
|
[
"BSD-3-Clause"
] | null | null | null |
smartlearner/optimizers/__init__.py
|
havaeimo/smartlearner
|
9fa0d4e757310b185e5c0d2ff43279d21ab4cb17
|
[
"BSD-3-Clause"
] | null | null | null |
from .sgd import SGD
from .adagrad import AdaGrad
| 16.666667
| 28
| 0.8
| 8
| 50
| 5
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.16
| 50
| 2
| 29
| 25
| 0.952381
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
d2be9498bbeecc96596ecff52f12aba1308d2564
| 114
|
py
|
Python
|
App/RoletaRussa.py
|
Caiozxx/RoletaRussa
|
84eaef279eca96cf63aa7287f372e08d2beca278
|
[
"MIT"
] | null | null | null |
App/RoletaRussa.py
|
Caiozxx/RoletaRussa
|
84eaef279eca96cf63aa7287f372e08d2beca278
|
[
"MIT"
] | null | null | null |
App/RoletaRussa.py
|
Caiozxx/RoletaRussa
|
84eaef279eca96cf63aa7287f372e08d2beca278
|
[
"MIT"
] | null | null | null |
import random
import os
if random.randint(0,6) == 1:
os.remove("C:\Windows\System32")
else:
print("ufa")
| 14.25
| 36
| 0.649123
| 18
| 114
| 4.111111
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.053191
| 0.175439
| 114
| 7
| 37
| 16.285714
| 0.734043
| 0
| 0
| 0
| 0
| 0
| 0.192982
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0.166667
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
d2beb7f9d7bb512407ba66b5a808daf06dfb88c6
| 232
|
py
|
Python
|
tests/context.py
|
SportsDataDirect/sdd_python_api
|
bfd66a0398bb779abf7cfbc3c5e66ff67814f4a3
|
[
"MIT"
] | 1
|
2021-01-09T04:37:39.000Z
|
2021-01-09T04:37:39.000Z
|
tests/context.py
|
SportsDataDirect/sdd_python_api
|
bfd66a0398bb779abf7cfbc3c5e66ff67814f4a3
|
[
"MIT"
] | 1
|
2017-12-01T20:59:06.000Z
|
2017-12-29T04:27:40.000Z
|
tests/context.py
|
SportsDataDirect/sdd_python_api
|
bfd66a0398bb779abf7cfbc3c5e66ff67814f4a3
|
[
"MIT"
] | 1
|
2018-07-13T17:02:52.000Z
|
2018-07-13T17:02:52.000Z
|
#created quickly without thought by using http://docs.python-guide.org/en/latest/writing/structure/
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import sdd_api
import tests
| 33.142857
| 99
| 0.775862
| 38
| 232
| 4.605263
| 0.736842
| 0.102857
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.004673
| 0.077586
| 232
| 7
| 100
| 33.142857
| 0.813084
| 0.422414
| 0
| 0
| 0
| 0
| 0.014925
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.8
| 0
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
d2eaa5e3e3fb9d9edf5c12f8d9addf6a85c05a6e
| 93
|
py
|
Python
|
world/quests/apps.py
|
dvoraen/arxcode
|
a89f2004fca10e0b1f1995c2420dd3ffbf08774b
|
[
"MIT"
] | 42
|
2018-08-12T00:55:24.000Z
|
2021-12-24T15:16:08.000Z
|
world/quests/apps.py
|
dvoraen/arxcode
|
a89f2004fca10e0b1f1995c2420dd3ffbf08774b
|
[
"MIT"
] | 312
|
2018-10-22T23:03:27.000Z
|
2022-02-06T13:02:58.000Z
|
world/quests/apps.py
|
dvoraen/arxcode
|
a89f2004fca10e0b1f1995c2420dd3ffbf08774b
|
[
"MIT"
] | 42
|
2018-08-12T00:41:48.000Z
|
2022-01-27T14:03:16.000Z
|
from django.apps import AppConfig
class QuestsConfig(AppConfig):
name = "world.quests"
| 15.5
| 33
| 0.752688
| 11
| 93
| 6.363636
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.16129
| 93
| 5
| 34
| 18.6
| 0.897436
| 0
| 0
| 0
| 0
| 0
| 0.129032
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
96002ad66e465ee28d9c76475af05cb77c779f24
| 202
|
py
|
Python
|
rcreator/repos/serializers.py
|
adrianmoo2/repo-simplifier
|
156aab7d4d2ad96ef6d53f0528f3c52bf7073859
|
[
"MIT"
] | null | null | null |
rcreator/repos/serializers.py
|
adrianmoo2/repo-simplifier
|
156aab7d4d2ad96ef6d53f0528f3c52bf7073859
|
[
"MIT"
] | 11
|
2019-12-04T23:33:01.000Z
|
2022-02-10T09:53:05.000Z
|
rcreator/repos/serializers.py
|
adrianmoo2/repo-simplifier
|
156aab7d4d2ad96ef6d53f0528f3c52bf7073859
|
[
"MIT"
] | null | null | null |
from rest_framework import serializers
from repos.models import Repo
# Repo Serializer
class RepoSerializer(serializers.ModelSerializer):
class Meta:
model = Repo
fields = '__all__'
| 25.25
| 50
| 0.742574
| 22
| 202
| 6.590909
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.20297
| 202
| 8
| 51
| 25.25
| 0.900621
| 0.074257
| 0
| 0
| 0
| 0
| 0.037634
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
8255d73e54de9220be22fbba5cf5e1372f9ce870
| 158
|
py
|
Python
|
docs/_ext/__init__.py
|
RichardScottOZ/geoapps
|
5b3c1d4fd11add45992e8b2497312ac014272b69
|
[
"MIT"
] | 34
|
2020-07-14T10:26:08.000Z
|
2022-02-15T06:07:10.000Z
|
docs/_ext/__init__.py
|
sebhmg/geoapps
|
1463ba4ec3c914abdc7403e54eca0ee2bbc3f4f4
|
[
"MIT"
] | 224
|
2020-09-07T19:02:33.000Z
|
2022-03-30T22:32:02.000Z
|
docs/_ext/__init__.py
|
sebhmg/geoapps
|
1463ba4ec3c914abdc7403e54eca0ee2bbc3f4f4
|
[
"MIT"
] | 6
|
2021-03-24T03:16:34.000Z
|
2022-02-18T16:25:04.000Z
|
from Add2Build import copyImages
from autodoc import make_lectures_page
from edit_on_github import *
from environmentSetup import supress_nonlocal_image_warn
| 31.6
| 56
| 0.892405
| 22
| 158
| 6.090909
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007042
| 0.101266
| 158
| 4
| 57
| 39.5
| 0.93662
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
825bc84bdf7d2a07bf1517bcf14d4bd36b20e548
| 12
|
py
|
Python
|
adv_ant/retroNet/tests.py
|
ayushxx7/retroNet
|
d9a20c1c03059c0694b807d184a082310df67e9f
|
[
"MIT"
] | 40
|
2020-08-02T07:38:22.000Z
|
2021-07-26T01:46:50.000Z
|
adv_ant/retroNet/tests.py
|
ayushxx7/retroNet
|
d9a20c1c03059c0694b807d184a082310df67e9f
|
[
"MIT"
] | 134
|
2020-07-31T12:15:45.000Z
|
2020-12-13T04:42:19.000Z
|
adv_ant/retroNet/tests.py
|
ayushxx7/retroNet
|
d9a20c1c03059c0694b807d184a082310df67e9f
|
[
"MIT"
] | 101
|
2020-07-31T12:00:47.000Z
|
2021-11-01T09:06:58.000Z
|
# No Tests.
| 6
| 11
| 0.583333
| 2
| 12
| 3.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.25
| 12
| 1
| 12
| 12
| 0.777778
| 0.75
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
827e831a2fe5eff641b321653a86aa4cb3b5399e
| 1,098
|
py
|
Python
|
ITMO_FS/utils/information_theory.py
|
18756/ITMO_FS
|
d0465c61b15264812b3455194e8b9eea93b3f550
|
[
"BSD-3-Clause"
] | null | null | null |
ITMO_FS/utils/information_theory.py
|
18756/ITMO_FS
|
d0465c61b15264812b3455194e8b9eea93b3f550
|
[
"BSD-3-Clause"
] | null | null | null |
ITMO_FS/utils/information_theory.py
|
18756/ITMO_FS
|
d0465c61b15264812b3455194e8b9eea93b3f550
|
[
"BSD-3-Clause"
] | null | null | null |
from collections import Counter
from itertools import groupby
from math import log, fsum
from operator import itemgetter
import numpy as np
def conditional_entropy(x_j, y):
# H(Y|X)
buf = [[e[1] for e in g] for _, g in groupby(sorted(zip(x_j, y)), itemgetter(0))]
return fsum(entropy(group) * len(group) for group in buf) / len(x_j)
def matrix_mutual_information(x, y):
return np.apply_along_axis(mutual_information, 0, x, y)
def mutual_information(x, y):
return entropy(y) - conditional_entropy(x, y)
def conditional_mutual_information(x, y, z):
return entropy(list(zip(x, z))) + entropy(list(zip(y, z))) - entropy(list(zip(x, y, z))) - entropy(z)
def joint_mutual_information(x, y, z):
return mutual_information(x, z) + conditional_mutual_information(y, z, x)
def interaction_information(x, y, z):
return mutual_information(x, z) + mutual_information(y, z) - joint_mutual_information(x, y, z)
def elog(x):
return x * log(x) if 0. < x < 1. else 0.
def entropy(x):
return log(len(x)) - fsum(v * log(v) for v in Counter(x).values()) / len(x)
| 26.780488
| 105
| 0.687614
| 186
| 1,098
| 3.930108
| 0.258065
| 0.232558
| 0.172367
| 0.129959
| 0.259918
| 0.191518
| 0.106703
| 0.106703
| 0.106703
| 0
| 0
| 0.006623
| 0.174863
| 1,098
| 40
| 106
| 27.45
| 0.800221
| 0.005464
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.363636
| false
| 0
| 0.227273
| 0.318182
| 0.954545
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
828a62a02681af09aa630fc659bca96b93fc69f5
| 110
|
py
|
Python
|
billy2pupa/dc.py
|
backwardn/billy
|
07ac788d25a6c79d03dd0e3d55459bbb55e22439
|
[
"BSD-3-Clause"
] | 33
|
2016-11-05T07:25:48.000Z
|
2022-01-31T03:40:43.000Z
|
billy2pupa/dc.py
|
backwardn/billy
|
07ac788d25a6c79d03dd0e3d55459bbb55e22439
|
[
"BSD-3-Clause"
] | 16
|
2015-02-05T21:25:58.000Z
|
2015-09-18T20:27:06.000Z
|
billy2pupa/dc.py
|
backwardn/billy
|
07ac788d25a6c79d03dd0e3d55459bbb55e22439
|
[
"BSD-3-Clause"
] | 22
|
2015-03-23T07:13:20.000Z
|
2016-06-10T04:41:06.000Z
|
from openstatesapi.jurisdiction import make_jurisdiction
J = make_jurisdiction('dc')
J.url = 'http://dc.gov'
| 22
| 56
| 0.772727
| 15
| 110
| 5.533333
| 0.666667
| 0.385542
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1
| 110
| 4
| 57
| 27.5
| 0.838384
| 0
| 0
| 0
| 0
| 0
| 0.136364
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
82adfacb42f3a8131656a0f3295822084334dd3a
| 2,550
|
py
|
Python
|
tests/test_transform_upscale.py
|
mrstephenneal/pdfwatermarker
|
55934803efd91b6b456985be7df93c03d24747c7
|
[
"Apache-2.0"
] | 9
|
2018-08-28T14:08:19.000Z
|
2019-08-22T07:33:14.000Z
|
tests/test_transform_upscale.py
|
mrstephenneal/pdfwatermarker
|
55934803efd91b6b456985be7df93c03d24747c7
|
[
"Apache-2.0"
] | 15
|
2018-08-28T14:08:17.000Z
|
2019-07-08T01:29:34.000Z
|
tests/test_transform_upscale.py
|
mrstephenneal/pdfwatermarker
|
55934803efd91b6b456985be7df93c03d24747c7
|
[
"Apache-2.0"
] | 1
|
2020-08-10T00:14:43.000Z
|
2020-08-10T00:14:43.000Z
|
import os
import unittest
from tempfile import TemporaryDirectory
from looptools import Timer
from pdfconduit import Info, Upscale
from tests import *
class TestUpscale(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.pdf_path = pdf_path
cls.temp = TemporaryDirectory()
@classmethod
def tearDownClass(cls):
cls.temp.cleanup()
@Timer.decorator
def test_upscale_pdfrw_20x(self):
"""Resize a PDF file to 2.0x times the original scale."""
s = 2.0
upscaled = Upscale(pdf_path, scale=s, suffix='upscaled_2.0_pdfrw', tempdir=self.temp.name, method='pdfrw').file
# Assert upscaled file exists
self.assertTrue(os.path.isfile(upscaled))
# Assert upscaled pdf file is the correct size
self.assertEqual(Info(upscaled).size, tuple([i * s for i in Info(pdf_path).size]))
return upscaled
@Timer.decorator
def test_upscale_pdfrw_15x(self):
"""Resize a PDF file to 1.5x times the original scale."""
s = 1.5
upscaled = Upscale(pdf_path, scale=s, suffix='upscaled_1.5_pdfrw', tempdir=self.temp.name, method='pdfrw').file
# Assert upscaled file exists
self.assertTrue(os.path.isfile(upscaled))
# Assert upscaled pdf file is the correct size
self.assertEqual(Info(upscaled).size, tuple([i * s for i in Info(pdf_path).size]))
return upscaled
@Timer.decorator
def test_upscale_pdfrw_30x(self):
"""Resize a PDF file to 3.0x times the original scale."""
s = 3.0
upscaled = Upscale(pdf_path, scale=s, suffix='upscaled_3.0_pdfrw', tempdir=self.temp.name, method='pdfrw').file
# Assert upscaled file exists
self.assertTrue(os.path.isfile(upscaled))
# Assert upscaled pdf file is the correct size
self.assertEqual(Info(upscaled).size, tuple([i * s for i in Info(pdf_path).size]))
return upscaled
@Timer.decorator
def test_downscale_pdfrw_20x(self):
"""Resize a PDF file to 3.0x times the original scale."""
s = 1 / 2
upscaled = Upscale(pdf_path, scale=s, suffix='downscaled_2.0_pdfrw', tempdir=self.temp.name,
method='pdfrw').file
# Assert upscaled file exists
self.assertTrue(os.path.isfile(upscaled))
# Assert upscaled pdf file is the correct size
self.assertEqual(Info(upscaled).size, tuple([i * s for i in Info(pdf_path).size]))
return upscaled
if __name__ == '__main__':
unittest.main()
| 33.116883
| 119
| 0.656078
| 348
| 2,550
| 4.698276
| 0.198276
| 0.042813
| 0.04159
| 0.051376
| 0.797554
| 0.797554
| 0.738838
| 0.718043
| 0.670336
| 0.617737
| 0
| 0.01652
| 0.240392
| 2,550
| 76
| 120
| 33.552632
| 0.827568
| 0.196078
| 0
| 0.4
| 0
| 0
| 0.050445
| 0
| 0
| 0
| 0
| 0
| 0.177778
| 1
| 0.133333
| false
| 0
| 0.133333
| 0
| 0.377778
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
82c5fb16da64f47c09383cdc448df902c7b8bd2d
| 22
|
py
|
Python
|
gargantua/__init__.py
|
Laisky/laisky-blog
|
ebe7dadf8fce283ebab0539926ad1be1246e5156
|
[
"Apache-2.0"
] | 18
|
2015-05-08T02:06:39.000Z
|
2022-03-05T21:36:48.000Z
|
gargantua/__init__.py
|
Laisky/laisky-blog
|
ebe7dadf8fce283ebab0539926ad1be1246e5156
|
[
"Apache-2.0"
] | 131
|
2015-01-22T14:54:59.000Z
|
2022-02-16T15:14:10.000Z
|
gargantua/__init__.py
|
Laisky/laisky-blog
|
ebe7dadf8fce283ebab0539926ad1be1246e5156
|
[
"Apache-2.0"
] | 3
|
2016-01-11T13:52:41.000Z
|
2019-06-12T08:54:15.000Z
|
__version__ = '2.9.5'
| 11
| 21
| 0.636364
| 4
| 22
| 2.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 0.136364
| 22
| 1
| 22
| 22
| 0.368421
| 0
| 0
| 0
| 0
| 0
| 0.227273
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
82c69683b7388110326bcc9239029c279a42b5da
| 96
|
py
|
Python
|
src/minterpy/schemes/barycentric/__init__.py
|
karanprime/minterpy
|
75d8976b2ddcf79ebaa29b4cb80691ca02a6d180
|
[
"MIT"
] | 13
|
2021-11-30T17:52:45.000Z
|
2021-12-09T10:05:20.000Z
|
src/minterpy/schemes/barycentric/__init__.py
|
karanprime/minterpy
|
75d8976b2ddcf79ebaa29b4cb80691ca02a6d180
|
[
"MIT"
] | 2
|
2021-11-30T18:31:22.000Z
|
2022-02-10T10:13:37.000Z
|
src/minterpy/schemes/barycentric/__init__.py
|
karanprime/minterpy
|
75d8976b2ddcf79ebaa29b4cb80691ca02a6d180
|
[
"MIT"
] | 6
|
2021-11-30T18:17:26.000Z
|
2022-02-18T17:38:27.000Z
|
"""
This 'barycentic' submodule is part of `minterpy` and the submodule `minterpy.schemes`.
"""
| 24
| 87
| 0.71875
| 12
| 96
| 5.75
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.135417
| 96
| 3
| 88
| 32
| 0.831325
| 0.90625
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
7d62e7d277335211a28b1b195998e9c544eeff4d
| 183
|
py
|
Python
|
exhibit/project/views.py
|
ddonco/django_blog
|
de353bafaf1d8044f2160070f92970bad3137215
|
[
"MIT"
] | null | null | null |
exhibit/project/views.py
|
ddonco/django_blog
|
de353bafaf1d8044f2160070f92970bad3137215
|
[
"MIT"
] | null | null | null |
exhibit/project/views.py
|
ddonco/django_blog
|
de353bafaf1d8044f2160070f92970bad3137215
|
[
"MIT"
] | null | null | null |
from django.shortcuts import render
from django.views import generic
# Create your views here.
class ProjectListView(generic.TemplateView):
template_name = 'project/index.html'
| 22.875
| 44
| 0.797814
| 23
| 183
| 6.304348
| 0.782609
| 0.137931
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.131148
| 183
| 7
| 45
| 26.142857
| 0.91195
| 0.125683
| 0
| 0
| 0
| 0
| 0.113924
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
7d638bc3999f69d2ecda00680c2ce1ac51704889
| 266
|
py
|
Python
|
trunk/swen610/toolshare/admin.py
|
leon486/toolshare
|
13f6ab1afb96a5f8294c121ff6916a1fcab5c2bc
|
[
"MIT"
] | null | null | null |
trunk/swen610/toolshare/admin.py
|
leon486/toolshare
|
13f6ab1afb96a5f8294c121ff6916a1fcab5c2bc
|
[
"MIT"
] | null | null | null |
trunk/swen610/toolshare/admin.py
|
leon486/toolshare
|
13f6ab1afb96a5f8294c121ff6916a1fcab5c2bc
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
# Register your models here.
from toolshare.models import *
# Register your models here.
admin.site.register(User)
admin.site.register(Tool)
admin.site.register(Shed)
admin.site.register(ShareZone)
admin.site.register(Reservation)
| 22.166667
| 32
| 0.804511
| 37
| 266
| 5.783784
| 0.432432
| 0.21028
| 0.397196
| 0.205607
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.093985
| 266
| 11
| 33
| 24.181818
| 0.887967
| 0.199248
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.285714
| 0
| 0.285714
| 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
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
7d640f2d850013bacf5016744c7adbf620dcaf19
| 89
|
py
|
Python
|
docs/conftest.py
|
concreted/prefect
|
dd732f5990ee2b0f3d816adb285168fd63b239e4
|
[
"Apache-2.0"
] | 8,633
|
2019-03-23T17:51:03.000Z
|
2022-03-31T22:17:42.000Z
|
docs/conftest.py
|
concreted/prefect
|
dd732f5990ee2b0f3d816adb285168fd63b239e4
|
[
"Apache-2.0"
] | 3,903
|
2019-03-23T19:11:21.000Z
|
2022-03-31T23:21:23.000Z
|
docs/conftest.py
|
ngriffiths13/prefect
|
7f5613abcb182494b7dc12159277c3bc5f3c9898
|
[
"Apache-2.0"
] | 937
|
2019-03-23T18:49:44.000Z
|
2022-03-31T21:45:13.000Z
|
import sys
if sys.version_info < (3, 6):
collect_ignore = ["test_generate_docs.py"]
| 17.8
| 46
| 0.696629
| 14
| 89
| 4.142857
| 0.928571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.027027
| 0.168539
| 89
| 4
| 47
| 22.25
| 0.756757
| 0
| 0
| 0
| 1
| 0
| 0.235955
| 0.235955
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
7d849a1472c4febe43e684666ea18763528e0260
| 29
|
py
|
Python
|
SpoTwillio/lib/python3.6/keyword.py
|
Natfan/funlittlethings
|
80d5378b45b5c0ead725942ee50403bd057514a6
|
[
"MIT"
] | 99
|
2019-10-09T16:14:46.000Z
|
2022-03-17T02:23:47.000Z
|
SpoTwillio/lib/python3.6/keyword.py
|
Natfan/funlittlethings
|
80d5378b45b5c0ead725942ee50403bd057514a6
|
[
"MIT"
] | 43
|
2021-02-18T22:37:01.000Z
|
2021-05-05T19:37:51.000Z
|
SpoTwillio/lib/python3.6/keyword.py
|
Natfan/funlittlethings
|
80d5378b45b5c0ead725942ee50403bd057514a6
|
[
"MIT"
] | 98
|
2019-10-17T14:48:28.000Z
|
2022-01-21T03:33:38.000Z
|
/usr/lib/python3.6/keyword.py
| 29
| 29
| 0.793103
| 6
| 29
| 3.833333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.068966
| 0
| 29
| 1
| 29
| 29
| 0.724138
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
7d86f11f77ab56049cb409cf748e384e6e0cf6fc
| 2,589
|
py
|
Python
|
Protheus_WebApp/Modules/SIGAGFE/GFEA013TESTCASE.py
|
98llm/tir-script-samples
|
0bff8393b79356aa562e9e6512c11ee6e039b177
|
[
"MIT"
] | 17
|
2018-09-24T17:27:08.000Z
|
2021-09-16T19:09:46.000Z
|
Protheus_WebApp/Modules/SIGAGFE/GFEA013TESTCASE.py
|
98llm/tir-script-samples
|
0bff8393b79356aa562e9e6512c11ee6e039b177
|
[
"MIT"
] | 4
|
2018-09-24T17:30:32.000Z
|
2022-01-03T11:39:30.000Z
|
Protheus_WebApp/Modules/SIGAGFE/GFEA013TESTCASE.py
|
98llm/tir-script-samples
|
0bff8393b79356aa562e9e6512c11ee6e039b177
|
[
"MIT"
] | 18
|
2019-06-07T17:41:34.000Z
|
2022-01-31T18:17:31.000Z
|
from tir import Webapp
import unittest
class GFEA013(unittest.TestCase):
@classmethod
def setUpClass(inst):
inst.oHelper = Webapp()
inst.oHelper.Setup('SIGAGFE','03/11/2020','T1','D MG 01 ','78')
inst.oHelper.Program('GFEA013')
def test_GFEA013_CT001(self):
self.oHelper.SetButton('Incluir')
self.oHelper.SetValue('Unid Feder ', 'AC')
self.oHelper.SetValue('Trib Est Ctb', '2')
self.oHelper.SetValue('Trib Est NC ', '2')
self.oHelper.SetValue('Trib Int Ctb', '2')
self.oHelper.SetValue('Trib Int NC ', '2')
self.oHelper.SetValue('Aliq Est Ctb', '4', check_value = False)
self.oHelper.SetValue('Aliq Est NC ', '4', check_value = False)
self.oHelper.SetValue('Aliq Int Ctb', '4', check_value = False)
self.oHelper.SetValue('Aliq Int NC ', '4', check_value = False)
self.oHelper.SetValue('% Cred ICMS ', '10', check_value = False)
self.oHelper.SetButton('Confirmar')
self.oHelper.SetButton('Fechar')
self.oHelper.SearchBrowse(' AC')
self.oHelper.SetButton('Alterar')
self.oHelper.SetValue('Trib Est Ctb', '1')
self.oHelper.SetValue('Trib Est NC ', '1')
self.oHelper.SetValue('Trib Int Ctb', '1')
self.oHelper.SetValue('Trib Int NC ', '1')
self.oHelper.SetButton('Confirmar')
self.oHelper.SetButton('Fechar')
self.oHelper.SearchBrowse(' AC')
self.oHelper.SetButton('Visualizar')
self.oHelper.SetButton('Fechar')
self.oHelper.SearchBrowse(' AC')
self.oHelper.SetButton('Outras Ações','Copiar')
self.oHelper.SetValue('Unid Feder ', 'GO')
self.oHelper.SetValue('Trib Est Ctb', '1')
self.oHelper.SetValue('Trib Est NC ', '1')
self.oHelper.SetValue('Trib Int Ctb', '1')
self.oHelper.SetValue('Trib Int NC ', '1')
self.oHelper.SetValue('Aliq Est Ctb', '10', check_value = False)
self.oHelper.SetValue('Aliq Est NC ', '10', check_value = False)
self.oHelper.SetValue('Aliq Int Ctb', '10', check_value = False)
self.oHelper.SetValue('Aliq Int NC ', '10', check_value = False)
self.oHelper.SetValue('% Cred ICMS ', '10', check_value = False)
self.oHelper.SetButton('Confirmar')
self.oHelper.SetButton('Fechar')
self.oHelper.SearchBrowse(' AC')
self.oHelper.SetButton('Outras Ações','Excluir')
self.oHelper.SetButton('Confirmar')
self.oHelper.SetButton('Fechar')
self.oHelper.SearchBrowse(' GO')
self.oHelper.SetButton('Outras Ações','Excluir')
self.oHelper.SetButton('Confirmar')
self.oHelper.SetButton('Fechar')
self.oHelper.AssertTrue()
@classmethod
def tearDownClass(inst):
inst.oHelper.TearDown()
if __name__ == '__main__':
unittest.main()
| 35.465753
| 66
| 0.692159
| 341
| 2,589
| 5.196481
| 0.187683
| 0.291761
| 0.257336
| 0.155756
| 0.812641
| 0.780474
| 0.691309
| 0.691309
| 0.689616
| 0.534424
| 0
| 0.023746
| 0.137891
| 2,589
| 72
| 67
| 35.958333
| 0.770161
| 0
| 0
| 0.47541
| 0
| 0
| 0.222093
| 0
| 0
| 0
| 0
| 0
| 0.016393
| 1
| 0.04918
| false
| 0
| 0.032787
| 0
| 0.098361
| 0
| 0
| 0
| 0
| null | 1
| 1
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
7d98666d50ca3cff6bb5890ba06ac1757c6e41d4
| 179
|
py
|
Python
|
launcher.py
|
cjuliani/opencv-edge-detection-multisource-control
|
e265a49f81d27cbb7e3289750b5336b9b117507a
|
[
"MIT"
] | null | null | null |
launcher.py
|
cjuliani/opencv-edge-detection-multisource-control
|
e265a49f81d27cbb7e3289750b5336b9b117507a
|
[
"MIT"
] | null | null | null |
launcher.py
|
cjuliani/opencv-edge-detection-multisource-control
|
e265a49f81d27cbb7e3289750b5336b9b117507a
|
[
"MIT"
] | null | null | null |
import os
os.chdir("C:/Users/cyrilj/Desktop/github-multi-edge-detector")
import edge_detector
model = edge_detector.detector()
# Initiate the main function
model.detect()
| 22.375
| 63
| 0.759777
| 25
| 179
| 5.36
| 0.68
| 0.268657
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.122905
| 179
| 8
| 64
| 22.375
| 0.853503
| 0.145251
| 0
| 0
| 0
| 0
| 0.344828
| 0.344828
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
7dbea45feb7e04ff545e611a8dbec709a6a496a1
| 1,041
|
py
|
Python
|
src/Classes/MSDS400/Module 2/simplex_matrix.py
|
bmoretz/Python-Playground
|
a367ec7659b85c24363c21b5c0ac25db08ffa1f6
|
[
"MIT"
] | null | null | null |
src/Classes/MSDS400/Module 2/simplex_matrix.py
|
bmoretz/Python-Playground
|
a367ec7659b85c24363c21b5c0ac25db08ffa1f6
|
[
"MIT"
] | null | null | null |
src/Classes/MSDS400/Module 2/simplex_matrix.py
|
bmoretz/Python-Playground
|
a367ec7659b85c24363c21b5c0ac25db08ffa1f6
|
[
"MIT"
] | null | null | null |
from sympy import Matrix, pprint
M = Matrix( [
[ 1, 0, 1, 0, 0, 0, 0, 0, 3 ],
[ 0, 1, 0, 1, 0, 0, 0, 0, 4 ],
[ 2, 1, 0, 0, 1, 0, 0, 0, 7 ],
[ 1, 1, 0, 0, 0, 1, 0, 0, 5 ],
[ -1, 0, 0, 0, 0, 0, 1, 0, 0 ],
[ 0, -1, 0, 0, 0, 0, 0, 1, 0 ],
[-3000, -2000, 0, 0, 0, 0, 0, 0, 0 ] ] )
pprint( M )
# Pivot 1
[ M[i,8]/M[i,0] for i in range(0,4) ]
M.row_op( 2, lambda v,j: v-2*M[ 0, j ] )
M.row_op( 3, lambda v,j: v-1*M[ 0, j ] )
M.row_op( 4, lambda v,j: v+1*M[ 0, j ] )
M.row_op( 6, lambda v,j: v+3000*M[ 0, j ] )
pprint( M )
# Pivot 2
[ M[i,8]/M[i,1] for i in range(0,4) ]
M.row_op( 1, lambda v,j: v-1*M[2,j] )
M.row_op( 3, lambda v,j: v-1*M[2,j] )
M.row_op( 5, lambda v,j: v+1*M[2,j] )
M.row_op( 6, lambda v,j: v+2000*M[2,j ] )
pprint( M )
# Pivot 3
[ M[i,8]/M[i,2] for i in range(0,4) ]
M.row_op(0, lambda v,j: v-1*M[3,j] )
M.row_op(1, lambda v,j: v-2*M[3,j] )
M.row_op(2, lambda v,j: v+2*M[3,j] )
M.row_op(4, lambda v,j: v-M[3,j] )
M.row_op(5, lambda v,j: v+2*M[3,j] )
M.row_op(6, lambda v,j: v+1000*M[3,j] )
pprint( M )
| 23.133333
| 43
| 0.487992
| 287
| 1,041
| 1.721254
| 0.097561
| 0.117409
| 0.115385
| 0.255061
| 0.755061
| 0.724696
| 0.665992
| 0.617409
| 0.568826
| 0.364372
| 0
| 0.168766
| 0.237272
| 1,041
| 45
| 44
| 23.133333
| 0.453401
| 0.022094
| 0
| 0.133333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.033333
| 0
| 0.033333
| 0.166667
| 0
| 0
| 1
| null | 0
| 0
| 1
| 0
| 1
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
7dd429f8eaf1f9c45a881cdffdd6620e546c6d5c
| 118
|
py
|
Python
|
tronpy/providers/__init__.py
|
drodel/tronpy
|
9e869fb508c3f77b432948cc56cd66985375843d
|
[
"MIT"
] | 87
|
2020-08-24T08:46:37.000Z
|
2022-03-28T02:50:56.000Z
|
tronpy/providers/__init__.py
|
drodel/tronpy
|
9e869fb508c3f77b432948cc56cd66985375843d
|
[
"MIT"
] | 40
|
2020-07-17T11:15:46.000Z
|
2022-03-30T01:02:16.000Z
|
tronpy/providers/__init__.py
|
drodel/tronpy
|
9e869fb508c3f77b432948cc56cd66985375843d
|
[
"MIT"
] | 50
|
2020-08-04T15:10:37.000Z
|
2022-03-29T02:03:38.000Z
|
from .http import HTTPProvider
from .async_http import AsyncHTTPProvider
__all__ = [HTTPProvider, AsyncHTTPProvider]
| 23.6
| 43
| 0.838983
| 12
| 118
| 7.833333
| 0.583333
| 0.212766
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.110169
| 118
| 4
| 44
| 29.5
| 0.895238
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
7ddd17c23d558b02e2531fc010ac8f46f5fc86c7
| 290
|
py
|
Python
|
test/node.py
|
TysonHeart/dynomite
|
6870eca86a1b1703e1b56edece57c9e564f071ab
|
[
"Apache-2.0"
] | 3,380
|
2015-01-01T15:58:41.000Z
|
2022-03-31T10:29:23.000Z
|
test/node.py
|
TysonHeart/dynomite
|
6870eca86a1b1703e1b56edece57c9e564f071ab
|
[
"Apache-2.0"
] | 468
|
2015-01-02T12:37:05.000Z
|
2022-03-11T19:20:15.000Z
|
test/node.py
|
TysonHeart/dynomite
|
6870eca86a1b1703e1b56edece57c9e564f071ab
|
[
"Apache-2.0"
] | 542
|
2015-01-04T09:54:21.000Z
|
2022-03-03T04:53:38.000Z
|
#!/usr/bin/env python3
class Node(object):
def __init__(self, ip, port):
self.ip = ip
self.port=port
self.name="Node: %s:%d" % (ip, port)
def __name__(self):
return self.name
def start(self):
return
def stop(self):
return
| 17.058824
| 44
| 0.537931
| 39
| 290
| 3.794872
| 0.461538
| 0.202703
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005128
| 0.327586
| 290
| 16
| 45
| 18.125
| 0.753846
| 0.072414
| 0
| 0.181818
| 0
| 0
| 0.041045
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.363636
| false
| 0
| 0
| 0.272727
| 0.727273
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
7df00ef943a4cd904dc0b9d3b7bba30aa3437c93
| 15,659
|
py
|
Python
|
test/unit/test_storage.py
|
jasonstrimpel/py2neo
|
051125cab0adfb769415898ecfadad02eb6a7965
|
[
"Apache-2.0"
] | 1
|
2018-11-14T17:10:15.000Z
|
2018-11-14T17:10:15.000Z
|
test/unit/test_storage.py
|
jasonstrimpel/py2neo
|
051125cab0adfb769415898ecfadad02eb6a7965
|
[
"Apache-2.0"
] | null | null | null |
test/unit/test_storage.py
|
jasonstrimpel/py2neo
|
051125cab0adfb769415898ecfadad02eb6a7965
|
[
"Apache-2.0"
] | 1
|
2020-10-07T05:48:13.000Z
|
2020-10-07T05:48:13.000Z
|
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2018, Nigel Small
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from unittest import TestCase
from py2neo.storage import FrozenGraphStore, MutableGraphStore
class GraphStoreTestCase(TestCase):
store = MutableGraphStore()
a, b, c, d = store.add_nodes((
(["X"], {"name": "Alice"}),
(["X", "Y"], {"name": "Bob"}),
(["X", "Y"], {"name": "Carol"}),
(["Y"], {"name": "Dave"}),
))
(a_likes_b, b_likes_a, a_knows_b, a_knows_c,
c_knows_b, c_married_to_d) = store.add_relationships((
("LIKES", (a, b), {}),
("LIKES", (b, a), {}),
("KNOWS", (a, b), {"since": 1999}),
("KNOWS", (a, c), {"since": 2000}),
("KNOWS", (c, b), {"since": 2001}),
("MARRIED_TO", (c, d), {}),
)
)
def test_should_reflect_self_in_store_magic_method(self):
store = FrozenGraphStore(self.store)
self.assertIs(store.__graph_store__(), store)
def test_should_get_counts(self):
store = FrozenGraphStore(self.store)
self.assertEqual(store.node_count(), 4)
self.assertEqual(store.node_count("X"), 3)
self.assertEqual(store.relationship_count(), 6)
self.assertEqual(store.relationship_count("KNOWS"), 3)
self.assertEqual(store.node_labels(), {"X", "Y"})
self.assertEqual(store.relationship_types(), {"LIKES", "KNOWS", "MARRIED_TO"})
def test_should_get_node_degree(self):
store = FrozenGraphStore(self.store)
self.assertEqual(store.relationship_count(n_ids={self.a}), 4)
self.assertEqual(store.relationship_count(r_type="LIKES", n_ids={self.a}), 2)
self.assertEqual(store.relationship_count(n_ids={self.b}), 4)
self.assertEqual(store.relationship_count(n_ids={self.c}), 3)
self.assertEqual(store.relationship_count(n_ids={self.d}), 1)
def test_should_get_nodes(self):
store = FrozenGraphStore(self.store)
self.assertEqual(set(store.nodes()), {self.a, self.b, self.c, self.d})
def test_should_get_nodes_with_a_label(self):
store = FrozenGraphStore(self.store)
self.assertEqual(set(store.nodes("X")), {self.a, self.b, self.c})
self.assertEqual(set(store.nodes("Y")), {self.b, self.c, self.d})
self.assertFalse(set(store.nodes("Z")))
def test_should_get_nodes_with_multiple_labels(self):
store = FrozenGraphStore(self.store)
self.assertEqual(set(store.nodes("X", "Y")), {self.b, self.c})
self.assertFalse(set(store.nodes("X", "Z")))
def test_should_get_node_labels(self):
store = FrozenGraphStore(self.store)
self.assertEqual(store.node_labels(), {"X", "Y"})
self.assertEqual(store.node_labels(self.a), {"X"})
self.assertEqual(store.node_labels(self.b), {"X", "Y"})
self.assertEqual(store.node_labels(self.c), {"X", "Y"})
self.assertEqual(store.node_labels(self.d), {"Y"})
self.assertIs(store.node_labels(object()), None)
def test_should_get_node_properties(self):
store = FrozenGraphStore(self.store)
self.assertEqual(store.node_properties(self.a), {"name": "Alice"})
self.assertEqual(store.node_properties(self.b), {"name": "Bob"})
self.assertEqual(store.node_properties(self.c), {"name": "Carol"})
self.assertEqual(store.node_properties(self.d), {"name": "Dave"})
self.assertIs(store.node_properties(object()), None)
def test_should_get_relationships(self):
store = FrozenGraphStore(self.store)
self.assertEqual(set(store.relationships()), {self.a_likes_b, self.b_likes_a, self.a_knows_b,
self.a_knows_c, self.c_knows_b, self.c_married_to_d})
self.assertEqual(set(store.relationships("KNOWS")), {self.a_knows_b, self.a_knows_c, self.c_knows_b})
self.assertEqual(set(store.relationships("MARRIED_TO")), {self.c_married_to_d})
self.assertEqual(set(store.relationships(n_ids=(self.a, None))), {self.a_likes_b, self.a_knows_b,
self.a_knows_c})
self.assertEqual(set(store.relationships("KNOWS", (self.a, None))), {self.a_knows_b, self.a_knows_c})
self.assertEqual(set(store.relationships(n_ids=(None, self.b))), {self.a_likes_b, self.a_knows_b,
self.c_knows_b})
self.assertEqual(set(store.relationships("KNOWS", n_ids=(None, self.b))), {self.a_knows_b, self.c_knows_b})
self.assertEqual(set(store.relationships(n_ids=(self.a, self.b))), {self.a_likes_b, self.a_knows_b})
self.assertEqual(set(store.relationships("KNOWS", (self.a, self.b))), {self.a_knows_b})
self.assertEqual(set(store.relationships(n_ids={self.a})), {self.a_likes_b, self.b_likes_a,
self.a_knows_b, self.a_knows_c})
self.assertEqual(set(store.relationships("KNOWS", {self.a})), {self.a_knows_b, self.a_knows_c})
self.assertEqual(set(store.relationships(n_ids={self.a, self.b})), {self.a_likes_b, self.b_likes_a,
self.a_knows_b})
self.assertEqual(set(store.relationships("KNOWS", n_ids={self.a, self.b})), {self.a_knows_b})
def test_should_fail_on_bad_node_sequence(self):
store = FrozenGraphStore(self.store)
self.assertEqual(list(store.relationships(n_ids=(self.a, self.b, self.c))), [])
def test_should_fail_on_bad_node_set(self):
store = FrozenGraphStore(self.store)
_ = store.relationships(n_ids={self.a, self.b, self.c})
def test_should_fail_on_bad_node_type(self):
store = FrozenGraphStore(self.store)
with self.assertRaises(TypeError):
_ = store.relationships(n_ids=1)
def test_should_get_relationship_nodes(self):
store = FrozenGraphStore(self.store)
self.assertEqual(store.relationship_nodes(self.a_likes_b), (self.a, self.b))
self.assertEqual(store.relationship_nodes(self.b_likes_a), (self.b, self.a))
self.assertEqual(store.relationship_nodes(self.a_knows_b), (self.a, self.b))
self.assertEqual(store.relationship_nodes(self.a_knows_c), (self.a, self.c))
self.assertEqual(store.relationship_nodes(self.c_knows_b), (self.c, self.b))
self.assertEqual(store.relationship_nodes(self.c_married_to_d), (self.c, self.d))
self.assertIs(store.relationship_nodes(object()), None)
def test_should_get_relationship_properties(self):
store = FrozenGraphStore(self.store)
self.assertEqual(store.relationship_properties(self.a_knows_b), {"since": 1999})
self.assertEqual(store.relationship_properties(self.a_knows_c), {"since": 2000})
self.assertEqual(store.relationship_properties(self.c_knows_b), {"since": 2001})
self.assertIs(store.relationship_properties(object()), None)
def test_should_get_relationship_type(self):
store = FrozenGraphStore(self.store)
self.assertEqual(store.relationship_type(self.a_likes_b), "LIKES")
self.assertEqual(store.relationship_type(self.b_likes_a), "LIKES")
self.assertEqual(store.relationship_type(self.a_knows_b), "KNOWS")
self.assertEqual(store.relationship_type(self.a_knows_c), "KNOWS")
self.assertEqual(store.relationship_type(self.c_knows_b), "KNOWS")
self.assertEqual(store.relationship_type(self.c_married_to_d), "MARRIED_TO")
self.assertIs(store.relationship_type(object()), None)
class FrozenGraphStoreTestCase(TestCase):
store = MutableGraphStore()
a, b, c, d = store.add_nodes((
(["X"], {"name": "Alice"}),
(["X", "Y"], {"name": "Bob"}),
(["X", "Y"], {"name": "Carol"}),
(["Y"], {"name": "Dave"}),
))
store.add_relationships((
("KNOWS", (a, b), {}),
("KNOWS", (a, c), {}),
("KNOWS", (b, c), {}),
("KNOWS", (c, d), {}),
))
store = FrozenGraphStore(store)
def test_should_create_empty_on_none(self):
store = FrozenGraphStore()
self.assertEqual(store.node_count(), 0)
self.assertEqual(store.relationship_count(), 0)
self.assertFalse(store.node_labels())
self.assertFalse(store.relationship_types())
def test_should_not_create_from_non_store(self):
with self.assertRaises(TypeError):
_ = FrozenGraphStore(object())
def test_should_create_copy_of_frozen_store(self):
store = FrozenGraphStore(FrozenGraphStore(self.store))
self.assertEqual(store.node_count(), 4)
self.assertEqual(store.relationship_count(), 4)
self.assertEqual(store.node_labels(), {"X", "Y"})
self.assertEqual(store.relationship_types(), {"KNOWS"})
def test_should_create_copy_of_mutable_store(self):
store = FrozenGraphStore(self.store)
self.assertEqual(store.node_count(), 4)
self.assertEqual(store.relationship_count(), 4)
self.assertEqual(store.node_labels(), {"X", "Y"})
self.assertEqual(store.relationship_types(), {"KNOWS"})
def test_should_allow_construction_arguments(self):
store = FrozenGraphStore.build({
"a": (["Person"], {"name": "Alice", "age": 33}),
"b": (["Person"], {"name": "Bob", "age": 44}),
}, {
"ab": ("KNOWS", ("a", "b"), {"since": 1999}),
})
self.assertIsInstance(store, FrozenGraphStore)
self.assertEqual(store.node_count(), 2)
self.assertEqual(store.relationship_count(), 1)
self.assertEqual(store.node_labels(), {"Person"})
self.assertEqual(store.relationship_types(), {"KNOWS"})
self.assertEqual(set(store.nodes("Person")), {"a", "b"})
self.assertEqual(store.node_labels("a"), {"Person"})
self.assertEqual(store.node_labels("b"), {"Person"})
self.assertEqual(store.node_properties("a"), {"name": "Alice", "age": 33})
self.assertEqual(store.node_properties("b"), {"name": "Bob", "age": 44})
self.assertEqual(set(store.relationships("KNOWS")), {"ab"})
self.assertEqual(store.relationship_type("ab"), "KNOWS")
self.assertEqual(store.relationship_properties("ab"), {"since": 1999})
class MutableGraphStoreTestCase(TestCase):
store = MutableGraphStore()
a, b, c, d = store.add_nodes((
(["X"], {"name": "Alice"}),
(["X", "Y"], {"name": "Bob"}),
(["X", "Y"], {"name": "Carol"}),
(["Y"], {"name": "Dave"}),
))
store.add_relationships((
("KNOWS", (a, b), {}),
("KNOWS", (a, c), {}),
("KNOWS", (b, c), {}),
("KNOWS", (c, d), {}),
))
def test_should_create_empty_on_none(self):
store = MutableGraphStore()
self.assertEqual(store.node_count(), 0)
self.assertEqual(store.relationship_count(), 0)
self.assertFalse(store.node_labels())
self.assertFalse(store.relationship_types())
def test_should_create_copy_of_frozen_store(self):
store = MutableGraphStore(FrozenGraphStore(self.store))
self.assertEqual(store.node_count(), 4)
self.assertEqual(store.relationship_count(), 4)
self.assertEqual(store.node_labels(), {"X", "Y"})
self.assertEqual(store.relationship_types(), {"KNOWS"})
def test_should_create_copy_of_mutable_store(self):
store = MutableGraphStore(self.store)
self.assertEqual(store.node_count(), 4)
self.assertEqual(store.relationship_count(), 4)
self.assertEqual(store.node_labels(), {"X", "Y"})
self.assertEqual(store.relationship_types(), {"KNOWS"})
def test_can_add_new_label(self):
store = MutableGraphStore(self.store)
labels = store.node_labels(self.a)
self.assertEqual(labels, {"X"})
labels.add("Z")
self.assertEqual(store.node_labels(self.a), {"X", "Z"})
assert "Z" in set(store.node_labels())
def test_can_add_existing_label(self):
store = MutableGraphStore(self.store)
labels = store.node_labels(self.a)
self.assertEqual(labels, {"X"})
labels.add("X")
self.assertEqual(store.node_labels(self.a), {"X"})
def test_can_remove_label(self):
store = MutableGraphStore(self.store)
labels = store.node_labels(self.a)
self.assertEqual(labels, {"X"})
labels.remove("X")
self.assertFalse(store.node_labels(self.a))
def test_can_discard_label(self):
store = MutableGraphStore(self.store)
labels = store.node_labels(self.a)
self.assertEqual(labels, {"X"})
labels.discard("Z")
self.assertEqual(store.node_labels(self.a), {"X"})
def test_can_clear_labels(self):
store = MutableGraphStore(self.store)
labels = store.node_labels(self.b)
self.assertEqual(labels, {"X", "Y"})
labels.clear()
self.assertFalse(store.node_labels(self.b))
def test_can_add_properties(self):
store = MutableGraphStore(self.store)
properties = store.node_properties(self.a)
self.assertEqual(properties, {"name": "Alice"})
properties["age"] = 33
self.assertEqual(store.node_properties(self.a), {"name": "Alice", "age": 33})
def test_can_update_properties(self):
store = MutableGraphStore(self.store)
properties = store.node_properties(self.a)
self.assertEqual(properties, {"name": "Alice"})
properties["name"] = "Alistair"
self.assertEqual(store.node_properties(self.a), {"name": "Alistair"})
def test_can_remove_properties(self):
store = MutableGraphStore(self.store)
properties = store.node_properties(self.a)
self.assertEqual(properties, {"name": "Alice"})
del properties["name"]
self.assertEqual(store.node_properties(self.a), {})
def test_should_allow_construction_arguments(self):
store = MutableGraphStore.build({
"a": (["Person"], {"name": "Alice", "age": 33}),
"b": (["Person"], {"name": "Bob", "age": 44}),
}, {
"ab": ("KNOWS", ("a", "b"), {"since": 1999}),
})
self.assertIsInstance(store, MutableGraphStore)
self.assertEqual(store.node_count(), 2)
self.assertEqual(store.relationship_count(), 1)
self.assertEqual(store.node_labels(), {"Person"})
self.assertEqual(store.relationship_types(), {"KNOWS"})
self.assertEqual(set(store.nodes("Person")), {"a", "b"})
self.assertEqual(store.node_labels("a"), {"Person"})
self.assertEqual(store.node_labels("b"), {"Person"})
self.assertEqual(store.node_properties("a"), {"name": "Alice", "age": 33})
self.assertEqual(store.node_properties("b"), {"name": "Bob", "age": 44})
self.assertEqual(set(store.relationships(r_type="KNOWS")), {"ab"})
self.assertEqual(store.relationship_type("ab"), "KNOWS")
self.assertEqual(store.relationship_properties("ab"), {"since": 1999})
| 46.465875
| 115
| 0.631586
| 1,911
| 15,659
| 4.969649
| 0.088435
| 0.175319
| 0.17058
| 0.138149
| 0.827946
| 0.789618
| 0.733916
| 0.680847
| 0.609772
| 0.527219
| 0
| 0.008039
| 0.205633
| 15,659
| 336
| 116
| 46.604167
| 0.755447
| 0.038253
| 0
| 0.525362
| 0
| 0
| 0.049651
| 0
| 0
| 0
| 0
| 0
| 0.471014
| 1
| 0.115942
| false
| 0
| 0.007246
| 0
| 0.148551
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
81691ed795893e79519ab37f6da9bbdc13f7231a
| 929
|
py
|
Python
|
test/test_validation_api.py
|
CiscoDevNet/python-msx-sdk
|
d7e0a08c656504b4f4551d263e67c671a2a04b3f
|
[
"MIT"
] | null | null | null |
test/test_validation_api.py
|
CiscoDevNet/python-msx-sdk
|
d7e0a08c656504b4f4551d263e67c671a2a04b3f
|
[
"MIT"
] | null | null | null |
test/test_validation_api.py
|
CiscoDevNet/python-msx-sdk
|
d7e0a08c656504b4f4551d263e67c671a2a04b3f
|
[
"MIT"
] | null | null | null |
"""
MSX SDK
MSX SDK client. # noqa: E501
The version of the OpenAPI document: 1.0.9
Generated by: https://openapi-generator.tech
"""
import unittest
import python_msx_sdk
from python_msx_sdk.api.validation_api import ValidationApi # noqa: E501
class TestValidationApi(unittest.TestCase):
"""ValidationApi unit test stubs"""
def setUp(self):
self.api = ValidationApi() # noqa: E501
def tearDown(self):
pass
def test_get_validate_product_version_page(self):
"""Test case for get_validate_product_version_page
Returns a filtered page of validations. # noqa: E501
"""
pass
def test_validate_product_version(self):
"""Test case for validate_product_version
Validate registered product / verison combinations for vulnerabilities. # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()
| 21.604651
| 93
| 0.670614
| 111
| 929
| 5.369369
| 0.477477
| 0.067114
| 0.147651
| 0.083893
| 0.097315
| 0
| 0
| 0
| 0
| 0
| 0
| 0.025714
| 0.246502
| 929
| 42
| 94
| 22.119048
| 0.825714
| 0.440258
| 0
| 0.214286
| 1
| 0
| 0.017937
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0.214286
| 0.214286
| 0
| 0.571429
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
816c091cb7268b6fcb6927eb50aff517342e97fa
| 46
|
py
|
Python
|
clerk/__init__.py
|
mingaleg/yakubovich
|
95398c78eaffbd6ff69f8fdbedfc847531219d8a
|
[
"MIT"
] | 5
|
2018-12-12T16:24:42.000Z
|
2020-02-29T18:45:30.000Z
|
clerk/__init__.py
|
mingaleg/yakubovich
|
95398c78eaffbd6ff69f8fdbedfc847531219d8a
|
[
"MIT"
] | 3
|
2020-06-05T17:47:13.000Z
|
2022-02-11T03:39:54.000Z
|
clerk/__init__.py
|
mingaleg/yakubovich
|
95398c78eaffbd6ff69f8fdbedfc847531219d8a
|
[
"MIT"
] | null | null | null |
default_app_config = "clerk.apps.ClerkConfig"
| 23
| 45
| 0.826087
| 6
| 46
| 6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.065217
| 46
| 1
| 46
| 46
| 0.837209
| 0
| 0
| 0
| 0
| 0
| 0.478261
| 0.478261
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
81772a4b3a6e01f84fb6bffa0654ddb84339bb37
| 4,529
|
py
|
Python
|
vis_imagine_static_voxels/lib/modules/Combine.py
|
mihirp1998/EmbLang
|
169b0468ccda554896973bcc226afb3e762a70e7
|
[
"Apache-2.0"
] | 3
|
2020-07-12T02:15:27.000Z
|
2021-07-18T06:00:49.000Z
|
vis_imagine_static_voxels/lib/modules/Combine.py
|
mihirp1998/EmbLang
|
169b0468ccda554896973bcc226afb3e762a70e7
|
[
"Apache-2.0"
] | 1
|
2021-07-18T06:00:10.000Z
|
2021-07-24T11:51:17.000Z
|
vis_imagine_static_voxels/lib/modules/Combine.py
|
mihirp1998/EmbLang
|
169b0468ccda554896973bcc226afb3e762a70e7
|
[
"Apache-2.0"
] | null | null | null |
import tensorflow as tf
from collections import OrderedDict
from instance_norm import InstanceNormalization
import time
from tensorflow.python.platform import tf_logging
tf_logging.set_verbosity(tf_logging.DEBUG)
import ipdb
st = ipdb.set_trace
# tf.set_random_seed(1)
class Combine_Vis(tf.keras.Model):
def __init__(self, hiddim_v, hiddim_p=None, op='PROD'):
super(Combine_Vis, self).__init__()
self.op = op
self.hiddim_v = hiddim_v
if self.op == 'gPoE':
self.gates_v = tf.keras.Sequential([tf.keras.layers.Conv3D(hiddim_v*4,3,1,padding="same"),
InstanceNormalization(),
tf.keras.layers.Activation('sigmoid'),
tf.keras.layers.Conv3D(hiddim_v*4,3,1,padding="same"),
InstanceNormalization()])
@tf.function
def call(self, x1, x2):
if self.op == 'PROD':
return [x1[0] * x2[0], x1[1] * x2[1]]
if self.op == 'gPoE':
gates = tf.keras.layers.Activation('sigmoid')(self.gates_v(tf.concat([x1[0], x1[1], x2[0], x2[1]], -1)))
x1_mu_g = gates[:,:,:,:,:self.hiddim_v]
x1_var_g = gates[:,:,:,:,self.hiddim_v:2*self.hiddim_v]
x2_mu_g = gates[:,:,:,:,2*self.hiddim_v:3*self.hiddim_v]
x2_var_g = gates[:,:,:,:,3*self.hiddim_v:4*self.hiddim_v]
x1_updated = [x1_mu_g*x1[0],tf.math.log(x1_var_g + 1e-5) + x1[1]]
x2_updated = [x2_mu_g*x2[0], tf.math.log(x2_var_g + 1e-5) + x2[1]]
mlogvar1 = -x1_updated[1]
mlogvar2 = -x2_updated[1]
mu1 = x1_updated[0]
mu2 = x2_updated[0]
logvar = -tf.math.log(tf.math.exp(mlogvar1) + tf.math.exp(mlogvar2))
mu = tf.math.exp(logvar)*(tf.math.exp(mlogvar1)*mu1 + tf.math.exp(mlogvar2)*mu2)
return [mu, logvar]
class Combine_Vis_Z(tf.keras.Model):
def __init__(self, hiddim_v, hiddim_p=None, op='PROD'):
super(Combine_Vis_Z, self).__init__()
self.op = op
self.hiddim_v = hiddim_v
if self.op == 'gPoE':
self.gates_v = tf.keras.Sequential([tf.keras.layers.Conv3D(hiddim_v*2,3,1,padding="same"),
InstanceNormalization(),
tf.keras.layers.Activation('sigmoid'),
tf.keras.layers.Conv3D(hiddim_v*2,3,1,padding="same"),
InstanceNormalization()])
@tf.function
def call(self, x1, x2):
if self.op == 'PROD':
return [x1[0] * x2[0], x1[1] * x2[1]]
if self.op == 'gPoE':
gates = tf.keras.layers.Activation('sigmoid')(self.gates_v(tf.concat([x1, x2], -1)))
x1_g = gates[:,:,:,:,:self.hiddim_v]
x2_g = gates[:,:,:,:,self.hiddim_v:2*self.hiddim_v]
x1_updated = x1_g*x1
x2_updated = x2_g*x2
x_final = x1_updated* x2_updated
return x_final
class Combine_Pos(tf.keras.Model):
def __init__(self,hiddim_p, op='PROD'):
super(Combine_Pos, self).__init__()
self.op = op
self.hiddim_p = hiddim_p
if self.op == 'gPoE':
self.gates_p = tf.keras.Sequential([tf.keras.layers.Conv3D(hiddim_p*4,3,1,padding="same"),
InstanceNormalization(),
tf.keras.layers.Activation('elu'),
tf.keras.layers.Conv3D(hiddim_p*4,3,1,padding="same"),
InstanceNormalization()])
@tf.function
def call(self, x1, x2):
if self.op == 'PROD':
return [x1[0] * x2[0], x1[1] * x2[1]]
if self.op == 'gPoE':
gates = tf.keras.layers.Activation('sigmoid')(self.gates_p(tf.concat([x1[0], x1[1], x2[0], x2[1]], -1)))
x1_mu_g = gates[:,:,:,:,:self.hiddim_p]
x1_var_g = gates[:,:,:,:,self.hiddim_p:2*self.hiddim_p]
x2_mu_g = gates[:,:,:,:,2*self.hiddim_p:3*self.hiddim_p]
x2_var_g = gates[:,:,:,:,3*self.hiddim_p:4*self.hiddim_p]
x1_updated = [x1_mu_g*x1[0],tf.math.log(x1_var_g + 1e-5) + x1[1]]
x2_updated = [x2_mu_g*x2[0], tf.math.log(x2_var_g + 1e-5) + x2[1]]
mlogvar1 = -x1_updated[1]
mlogvar2 = -x2_updated[1]
mu1 = x1_updated[0]
mu2 = x2_updated[0]
logvar = -tf.math.log(tf.math.exp(mlogvar1) + tf.math.exp(mlogvar2))
mu = tf.math.exp(logvar)*(tf.math.exp(mlogvar1)*mu1 + tf.math.exp(mlogvar2)*mu2)
return [mu, logvar]
def run():
x1 = [tf.random.normal([1,16,16,16,64]),tf.random.normal([1,16,16,16,64])]
x2 = [tf.random.normal([1,16,16,16,64]),tf.random.normal([1,16,16,16,64])]
import time
s = time.time()
cfunc(x1,x2,True)
print(time.time() - s)
if __name__ == "__main__":
cfunc= Combine_Vis(64,"gPoE")
for i in range(20):
run()
print(len(cfunc.trainable_variables))
| 35.661417
| 115
| 0.608302
| 716
| 4,529
| 3.646648
| 0.132682
| 0.088089
| 0.058981
| 0.027576
| 0.788587
| 0.780927
| 0.7545
| 0.700498
| 0.693987
| 0.671773
| 0
| 0.061663
| 0.208655
| 4,529
| 126
| 116
| 35.944444
| 0.666853
| 0.004637
| 0
| 0.514563
| 0
| 0
| 0.027075
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.067961
| false
| 0
| 0.067961
| 0
| 0.223301
| 0.019417
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
81924900cd5ad02c0fc2e7baa20bd83ae371c348
| 78
|
py
|
Python
|
nautobot_netbox_importer/diffsync/__init__.py
|
Thetacz/nautobot-plugin-netbox-importer
|
cbf95e3c471fc4b29aeea338fbeeea7476f1fa19
|
[
"Apache-2.0"
] | 11
|
2021-02-24T17:54:54.000Z
|
2022-01-25T18:36:21.000Z
|
nautobot_netbox_importer/diffsync/__init__.py
|
Thetacz/nautobot-plugin-netbox-importer
|
cbf95e3c471fc4b29aeea338fbeeea7476f1fa19
|
[
"Apache-2.0"
] | 44
|
2021-02-28T20:21:52.000Z
|
2022-02-10T21:40:35.000Z
|
nautobot_netbox_importer/diffsync/__init__.py
|
Thetacz/nautobot-plugin-netbox-importer
|
cbf95e3c471fc4b29aeea338fbeeea7476f1fa19
|
[
"Apache-2.0"
] | 9
|
2021-02-28T17:05:53.000Z
|
2021-10-05T23:48:06.000Z
|
"""DiffSync adapter and model implementation for nautobot-netbox-importer."""
| 39
| 77
| 0.794872
| 9
| 78
| 6.888889
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.089744
| 78
| 1
| 78
| 78
| 0.873239
| 0.910256
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
81abd37a53f8dd72615ac2bd52785ea5b752ff75
| 255
|
py
|
Python
|
tea_django/models/vanilla.py
|
alefnula/django-tea
|
30c3fcb54828fe3d5f832cdd629ca53c78f8f930
|
[
"Apache-2.0"
] | 1
|
2020-10-20T00:10:50.000Z
|
2020-10-20T00:10:50.000Z
|
tea_django/models/vanilla.py
|
alefnula/tea-django
|
30c3fcb54828fe3d5f832cdd629ca53c78f8f930
|
[
"Apache-2.0"
] | null | null | null |
tea_django/models/vanilla.py
|
alefnula/tea-django
|
30c3fcb54828fe3d5f832cdd629ca53c78f8f930
|
[
"Apache-2.0"
] | null | null | null |
from tea_console.table import RichTableMixin
from django.utils.functional import classproperty
class VanillaModel(RichTableMixin):
@classproperty
def class_name(cls):
return cls.__name__
def to_dict(self) -> dict:
return {}
| 21.25
| 49
| 0.72549
| 29
| 255
| 6.137931
| 0.655172
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.203922
| 255
| 11
| 50
| 23.181818
| 0.876847
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0.25
| 0.875
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
81d8016c8b2a73e578d8cce88377bed293d2f70a
| 374
|
py
|
Python
|
package_making_practice/facades/brightness.py
|
manthanchauhan/package_making_practice
|
22794423219486a80242883cf7299655ae0c39cc
|
[
"MIT"
] | 1
|
2019-01-23T18:11:18.000Z
|
2019-01-23T18:11:18.000Z
|
package_making_practice/facades/brightness.py
|
manthanchauhan/package_making_practice
|
22794423219486a80242883cf7299655ae0c39cc
|
[
"MIT"
] | null | null | null |
package_making_practice/facades/brightness.py
|
manthanchauhan/package_making_practice
|
22794423219486a80242883cf7299655ae0c39cc
|
[
"MIT"
] | null | null | null |
"""
Brightness
"""
class Brightness(object):
"""
Brightness facade
"""
def current_level(self):
return self._current_level()
def set_level(self, level):
return self._set_level(level)
# private
def _current_level(self):
raise NotImplementedError()
def _set_level(self, level):
raise NotImplementedError()
| 16.26087
| 37
| 0.628342
| 38
| 374
| 5.921053
| 0.342105
| 0.16
| 0.133333
| 0.168889
| 0.177778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.264706
| 374
| 22
| 38
| 17
| 0.818182
| 0.09893
| 0
| 0.222222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.444444
| false
| 0
| 0
| 0.222222
| 0.777778
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
81df649f8c7613c60019b928c94c0cf65210ab10
| 1,047
|
py
|
Python
|
volunteer/models.py
|
witty-technologies-empowerment/codeupblood
|
a0aa1725e5776d80e083b6d4e9e67476bb97e983
|
[
"MIT"
] | null | null | null |
volunteer/models.py
|
witty-technologies-empowerment/codeupblood
|
a0aa1725e5776d80e083b6d4e9e67476bb97e983
|
[
"MIT"
] | null | null | null |
volunteer/models.py
|
witty-technologies-empowerment/codeupblood
|
a0aa1725e5776d80e083b6d4e9e67476bb97e983
|
[
"MIT"
] | 1
|
2022-01-19T11:09:13.000Z
|
2022-01-19T11:09:13.000Z
|
from django.db import models
# Create your models here.
class Volunteer(models.Model):
telegram = models.CharField(max_length=100, blank=True)
first_name = models.CharField(max_length=100, blank=False)
last_name = models.CharField(max_length=100, blank=False)
email = models.CharField(max_length=250, blank=False)
phone = models.CharField(max_length=50, blank=False)
city = models.CharField(max_length=50, blank=False)
state = models.CharField(max_length=50, blank=False)
tell_us = models.CharField(max_length=500, blank=False)
where = models.CharField(max_length=50, blank=False)
what = models.CharField(max_length=500, blank=False)
why = models.CharField(max_length=500, blank=False)
verified = models.BooleanField(default=False)
created = models.DateTimeField(auto_now_add=True)
class Meta:
ordering = ['created']
def __str__(self):
if self.verified:
return self.first_name + " " + self.last_name + " is volunteering"
else:
return self.first_name + " " + self.last_name + " has submitted a volunteering form"
| 36.103448
| 87
| 0.756447
| 148
| 1,047
| 5.189189
| 0.378378
| 0.214844
| 0.257813
| 0.34375
| 0.561198
| 0.561198
| 0.519531
| 0.106771
| 0
| 0
| 0
| 0.031659
| 0.125119
| 1,047
| 28
| 88
| 37.392857
| 0.806769
| 0.022923
| 0
| 0
| 0
| 0
| 0.057843
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.045455
| false
| 0
| 0.045455
| 0
| 0.863636
| 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
| 1
| 0
|
0
| 4
|
81e3b02ed34e17640e60f38b1f16c4743b8de174
| 408
|
py
|
Python
|
astoria/consumers/astctl/usercode/__init__.py
|
sedders123/astoria
|
d1e9603b10d765aed4c1237e79b5ab48a9af1d83
|
[
"MIT"
] | 1
|
2021-02-03T02:54:54.000Z
|
2021-02-03T02:54:54.000Z
|
astoria/consumers/astctl/usercode/__init__.py
|
sedders123/astoria
|
d1e9603b10d765aed4c1237e79b5ab48a9af1d83
|
[
"MIT"
] | 72
|
2020-12-15T18:29:18.000Z
|
2022-03-08T09:42:53.000Z
|
astoria/astctl/usercode/__init__.py
|
trickeydan/astoria
|
ef08ed4be4d5997751846b0cadce9aa8261ae151
|
[
"MIT"
] | 2
|
2022-02-05T23:00:51.000Z
|
2022-03-09T21:40:49.000Z
|
"""Commands to interact with usercode."""
import click
from .kill import kill
from .log import log
from .restart import restart
from .show import show
from .trigger import trigger
@click.group("usercode")
def usercode() -> None:
"""Interact with Usercode."""
usercode.add_command(kill)
usercode.add_command(log)
usercode.add_command(restart)
usercode.add_command(show)
usercode.add_command(trigger)
| 19.428571
| 41
| 0.769608
| 56
| 408
| 5.517857
| 0.321429
| 0.177994
| 0.291262
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.120098
| 408
| 20
| 42
| 20.4
| 0.860724
| 0.144608
| 0
| 0
| 0
| 0
| 0.023669
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.076923
| true
| 0
| 0.461538
| 0
| 0.538462
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
81e6012c210f1bff12325b5e62af9f61fa458356
| 364
|
py
|
Python
|
molecule/default/tests/test_default.py
|
osism/ansible-operator
|
bf5ff3635d8f29acabeaf8736d41a0d319c1d53f
|
[
"Apache-2.0"
] | null | null | null |
molecule/default/tests/test_default.py
|
osism/ansible-operator
|
bf5ff3635d8f29acabeaf8736d41a0d319c1d53f
|
[
"Apache-2.0"
] | 4
|
2019-11-20T21:10:53.000Z
|
2020-10-30T00:42:38.000Z
|
molecule/default/tests/test_default.py
|
osism/ansible-operator
|
bf5ff3635d8f29acabeaf8736d41a0d319c1d53f
|
[
"Apache-2.0"
] | 1
|
2019-08-23T09:07:54.000Z
|
2019-08-23T09:07:54.000Z
|
import pytest
@pytest.fixture()
def AnsibleDefaults(host):
return host.ansible("include_vars", "defaults.yml")["ansible_facts"]
def test_operator_user_and_group(host, AnsibleDefaults):
user = host.user(AnsibleDefaults["operator_user"])
assert user.name == AnsibleDefaults["operator_user"]
assert user.group == AnsibleDefaults["operator_group"]
| 28
| 72
| 0.758242
| 42
| 364
| 6.357143
| 0.47619
| 0.134831
| 0.202247
| 0.247191
| 0.277154
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115385
| 364
| 12
| 73
| 30.333333
| 0.829193
| 0
| 0
| 0
| 0
| 0
| 0.211538
| 0
| 0
| 0
| 0
| 0
| 0.25
| 1
| 0.25
| false
| 0
| 0.125
| 0.125
| 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
| 1
| 0
| 0
|
0
| 4
|
c4912930f60067aa4fae300fbbeb759c2bf798a6
| 479
|
py
|
Python
|
lib/log_utils/__init__.py
|
rainwangphy/AutoDL-Projects
|
1a40948255ac3c16ee529d94144a39bf26e89bfa
|
[
"MIT"
] | 923
|
2020-01-11T06:36:53.000Z
|
2022-03-31T00:26:57.000Z
|
lib/log_utils/__init__.py
|
rainwangphy/AutoDL-Projects
|
1a40948255ac3c16ee529d94144a39bf26e89bfa
|
[
"MIT"
] | 25
|
2020-02-27T08:35:46.000Z
|
2022-01-25T08:54:19.000Z
|
lib/log_utils/__init__.py
|
rainwangphy/AutoDL-Projects
|
1a40948255ac3c16ee529d94144a39bf26e89bfa
|
[
"MIT"
] | 262
|
2020-01-02T02:19:40.000Z
|
2022-03-23T04:56:16.000Z
|
##################################################
# Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2019 #
##################################################
# every package does not rely on pytorch or tensorflow
# I tried to list all dependency here: os, sys, time, numpy, (possibly) matplotlib
from .logger import Logger, PrintLogger
from .meter import AverageMeter
from .time_utils import time_for_file, time_string, time_string_short, time_print, convert_secs2time
| 53.222222
| 102
| 0.597077
| 56
| 479
| 4.964286
| 0.803571
| 0.071942
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012136
| 0.139875
| 479
| 8
| 103
| 59.875
| 0.662621
| 0.377871
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
|
0
| 4
|
c4cdb7e054ca946b3bfe8f0eb5b3fb9348e7c785
| 70
|
py
|
Python
|
tarun.py
|
belonesox/casket_assembler
|
e6e4801cbb6942f465c3d0f38b3b068978e7806d
|
[
"MIT"
] | 6
|
2021-05-31T05:38:59.000Z
|
2022-03-30T10:33:20.000Z
|
tarun.py
|
belonesox/casket_assembler
|
e6e4801cbb6942f465c3d0f38b3b068978e7806d
|
[
"MIT"
] | null | null | null |
tarun.py
|
belonesox/casket_assembler
|
e6e4801cbb6942f465c3d0f38b3b068978e7806d
|
[
"MIT"
] | 1
|
2020-12-05T19:12:45.000Z
|
2020-12-05T19:12:45.000Z
|
#!/usr/bin/env python
from terrarium_assembler.cli import main
main()
| 17.5
| 40
| 0.785714
| 11
| 70
| 4.909091
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1
| 70
| 4
| 41
| 17.5
| 0.857143
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.