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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c84397a494519c8d89b852e924ed1743bfee7e32 | 40 | py | Python | airbyte-integrations/connectors/source-mailchimp/source_mailchimp/models/__init__.py | rajatariya21/airbyte | 11e70a7a96e2682b479afbe6f709b9a5fe9c4a8d | [
"MIT"
] | 6,215 | 2020-09-21T13:45:56.000Z | 2022-03-31T21:21:45.000Z | airbyte-integrations/connectors/source-mailchimp/source_mailchimp/models/__init__.py | rajatariya21/airbyte | 11e70a7a96e2682b479afbe6f709b9a5fe9c4a8d | [
"MIT"
] | 8,448 | 2020-09-21T00:43:50.000Z | 2022-03-31T23:56:06.000Z | airbyte-integrations/connectors/source-mailchimp/source_mailchimp/models/__init__.py | rajatariya21/airbyte | 11e70a7a96e2682b479afbe6f709b9a5fe9c4a8d | [
"MIT"
] | 1,251 | 2020-09-20T05:48:47.000Z | 2022-03-31T10:41:29.000Z | from .mailchimp import HealthCheckError
| 20 | 39 | 0.875 | 4 | 40 | 8.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 40 | 1 | 40 | 40 | 0.972222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
c84efc07fd2d74a464b3cbbac09ca31e2bf2b027 | 56 | py | Python | recommends/tests/__init__.py | coagulant/django-recommends | 412b741c3a0aa5204b70f869cc893ef9fbccbe51 | [
"MIT"
] | 4 | 2015-01-29T17:17:26.000Z | 2021-03-03T08:17:03.000Z | recommends/tests/__init__.py | coagulant/django-recommends | 412b741c3a0aa5204b70f869cc893ef9fbccbe51 | [
"MIT"
] | null | null | null | recommends/tests/__init__.py | coagulant/django-recommends | 412b741c3a0aa5204b70f869cc893ef9fbccbe51 | [
"MIT"
] | 1 | 2015-09-22T08:35:26.000Z | 2015-09-22T08:35:26.000Z | # flake8: noqa
from recommends.tests.providers import *
| 18.666667 | 40 | 0.785714 | 7 | 56 | 6.285714 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020408 | 0.125 | 56 | 2 | 41 | 28 | 0.877551 | 0.214286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
c077ab182108e6ae8a82f5e8d9291baac4a599f7 | 55 | py | Python | flexipage/tests/__init__.py | eRestin/MezzGIS | 984341fa5361433cf9b6f30b113358c19d3cd05c | [
"BSD-2-Clause"
] | null | null | null | flexipage/tests/__init__.py | eRestin/MezzGIS | 984341fa5361433cf9b6f30b113358c19d3cd05c | [
"BSD-2-Clause"
] | null | null | null | flexipage/tests/__init__.py | eRestin/MezzGIS | 984341fa5361433cf9b6f30b113358c19d3cd05c | [
"BSD-2-Clause"
] | null | null | null |
from test_utils import *
from test_flexipage import *
| 13.75 | 28 | 0.8 | 8 | 55 | 5.25 | 0.625 | 0.380952 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163636 | 55 | 3 | 29 | 18.333333 | 0.913043 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
c085365aac4670351aadba8b39e6bac8055384f1 | 87 | py | Python | fileModPassArgCall.py | vijayjoset/PythonFCSITM | bddfc086c299a162594fe023627f6381f8d4c976 | [
"MIT"
] | null | null | null | fileModPassArgCall.py | vijayjoset/PythonFCSITM | bddfc086c299a162594fe023627f6381f8d4c976 | [
"MIT"
] | null | null | null | fileModPassArgCall.py | vijayjoset/PythonFCSITM | bddfc086c299a162594fe023627f6381f8d4c976 | [
"MIT"
] | null | null | null | import sys
import fileModPassArg
num = int(sys.argv[1])
print(fileModPassArg(num))
| 17.4 | 27 | 0.747126 | 12 | 87 | 5.416667 | 0.666667 | 0.523077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013333 | 0.137931 | 87 | 4 | 28 | 21.75 | 0.853333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.5 | 0.5 | 0 | 0.5 | 0.25 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 5 |
c0a87ea76408cfa69a3e29ebb38dfccc3395c3e7 | 4,615 | py | Python | ex/ex080.py | Ozcry/PythonExercicio | b4d4a4fbd6467d1ced0815677ecbd78c2613c4c9 | [
"MIT"
] | null | null | null | ex/ex080.py | Ozcry/PythonExercicio | b4d4a4fbd6467d1ced0815677ecbd78c2613c4c9 | [
"MIT"
] | null | null | null | ex/ex080.py | Ozcry/PythonExercicio | b4d4a4fbd6467d1ced0815677ecbd78c2613c4c9 | [
"MIT"
] | null | null | null | '''Crie um programa onde o usuário posso digitar cinco valores numéricos e cadastre-os em uma lista, já na posição
correta de inserção (sem usar o sort()). No final, mostre a lista ordenada na tela.'''
print('\033[1;33m-=\033[m' * 20)
lista = []
for c in range(0, 5):
n1 = int(input('\033[34mDigite um valor:\033[m '))
if c == 0 or n1 > lista[-1]:
lista.append(n1)
print('\033[31mAdicionado ao final da lista...\033[m')
print('\033[1;33m-=\033[m' * 20)
else:
pos = 0
while pos < len(lista):
if n1 <= lista[pos]:
lista.insert(pos, n1)
print(f'\033[35mAdicionando na posição {pos} da lista...\033[m')
print('\033[1;33m-=\033[m' * 20)
break
pos += 1
print(f'\033[36mOs valores digitados em ordem foram {lista}\033[m')
print('\033[1;33m-=\033[m' * 20)
print('\033[1;32mFIM\033[m')
### Outro metodo
'''
lista = []
print('\033[1;33m-=\033[m' * 20)
while True:
if len(lista) == 0:
n1 = int(input('Digite um valor: '))
lista.append(n1)
print('Adicionado ao final da lista...')
print('\033[1;33m-=\033[m' * 20)
if len(lista) == 1:
n1 = int(input('Digite um valor: '))
if n1 < lista[0]:
lista.insert(0, n1)
print(f'Adicionado na posição {lista.index(n1) + 1} da lista...')
print('\033[1;33m-=\033[m' * 20)
elif n1 > lista[0]:
lista.append(n1)
print('Adicionado ao final da lista...')
print('\033[1;33m-=\033[m' * 20)
elif n1 in lista:
print('Valor duplicado! Não vou adicionar...')
print('\033[1;33m-=\033[m' * 20)
if len(lista) == 2:
n1 = int(input('Digite um valor: '))
if n1 > lista[1]:
lista.append(n1)
print('Adicionado ao final da lista...')
print('\033[1;33m-=\033[m' * 20)
elif n1 < lista[0]:
lista.insert(0, n1)
print(f'Adicionado na posição {lista.index(n1) + 1} da lista...')
print('\033[1;33m-=\033[m' * 20)
elif lista[0] < n1 < lista[1]:
lista.insert(1, n1)
print(f'Adicionado na posição {lista.index(n1) + 1} da lista...')
print('\033[1;33m-=\033[m' * 20)
elif n1 in lista:
print('Valor duplicado! Não vou adicionar...')
print('\033[1;33m-=\033[m' * 20)
if len(lista) == 3:
n1 = int(input('Digite um valor: '))
if n1 < lista[0]:
lista.insert(0, n1)
print(f'Adicionado na posição {lista.index(n1) + 1} da lista...')
print('\033[1;33m-=\033[m' * 20)
elif n1 > lista[2]:
lista.append(n1)
print('Adicionado ao final da lista...')
print('\033[1;33m-=\033[m' * 20)
elif lista[1] < n1 < lista[2]:
lista.insert(2, n1)
print(f'Adicionado na posição {lista.index(n1) + 1} da lista...')
print('\033[1;33m-=\033[m' * 20)
elif lista[0] < n1 < lista[1]:
lista.insert(1, n1)
print(f'Adicionado na posição {lista.index(n1) + 1} da lista...')
print('\033[1;33m-=\033[m' * 20)
elif n1 in lista:
print('Valor duplicado! Não vou adicionar...')
print('\033[1;33m-=\033[m' * 20)
if len(lista) == 4:
n1 = int(input('Digite um valor: '))
if n1 < lista[0]:
lista.insert(0, n1)
print(f'Adicionado na posição {lista.index(n1) + 1} da lista...')
print('\033[1;33m-=\033[m' * 20)
elif n1 > lista[3]:
lista.append(n1)
print('Adicionado ao final da lista...')
print('\033[1;33m-=\033[m' * 20)
elif lista[0] < n1 < lista[1]:
lista.insert(1, n1)
print(f'Adicionado na posição {lista.index(n1) + 1} da lista...')
print('\033[1;33m-=\033[m' * 20)
elif lista[1] < n1 < lista[2]:
lista.insert(2, n1)
print(f'Adicionado na posição {lista.index(n1) + 1} da lista...')
print('\033[1;33m-=\033[m' * 20)
elif lista[2] < n1 < lista[3]:
lista.insert(3, n1)
print(f'Adicionado na posição {lista.index(n1) + 1} da lista...')
print('\033[1;33m-=\033[m' * 20)
elif n1 in lista:
print('Valor duplicado! Não vou adicionar...')
print('\033[1;33m-=\033[m' * 20)
if len(lista) == 5:
break
print(f'Os números digitados foram {lista}')
print('\033[1;33m-=\033[m' * 20)
print('FIM')
''' | 40.130435 | 114 | 0.505742 | 664 | 4,615 | 3.51506 | 0.126506 | 0.051414 | 0.100257 | 0.128535 | 0.793916 | 0.793916 | 0.784062 | 0.764781 | 0.740788 | 0.727078 | 0 | 0.133186 | 0.31506 | 4,615 | 115 | 115 | 40.130435 | 0.605188 | 0.045287 | 0 | 0.2 | 0 | 0 | 0.386648 | 0 | 0 | 0 | 0 | 0.008696 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.4 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
c0b2e769f45b83ac223972a42a84685bd7e6c0e1 | 349 | py | Python | mountainlab_pytools/mlproc/__init__.py | timsainb/mountainlab_pytools | 7d765e9af8be119a0fd8667d117ce8a5593486b5 | [
"Apache-2.0"
] | null | null | null | mountainlab_pytools/mlproc/__init__.py | timsainb/mountainlab_pytools | 7d765e9af8be119a0fd8667d117ce8a5593486b5 | [
"Apache-2.0"
] | 4 | 2018-07-17T13:14:13.000Z | 2019-01-02T15:40:39.000Z | mountainlab_pytools/mlproc/__init__.py | timsainb/mountainlab_pytools | 7d765e9af8be119a0fd8667d117ce8a5593486b5 | [
"Apache-2.0"
] | 3 | 2018-07-11T16:15:43.000Z | 2019-01-03T02:45:29.000Z | from .mlproc_impl import runProcess
from .mlproc_impl import lariLogin,initPipeline,addProcess
from .mlproc_impl import spec
from .mlproc_impl import locateFile,realizeFile,kbucketPath,readDir
from .mlproc_impl import runPipeline
from .mlproc_impl import addContainerRule,setContainerRules,containerRules
from .mlclient import MLClient,MLJobMonitor
| 43.625 | 74 | 0.876791 | 42 | 349 | 7.142857 | 0.452381 | 0.2 | 0.28 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.080229 | 349 | 7 | 75 | 49.857143 | 0.934579 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
c0b4a5d28b6e59e5eae2120ecc1e05276c94f305 | 40 | py | Python | examples/getUserBadges.py | iranathan/RobloxPy | a83eeea30dc449f66b89dd011f4e09404248f866 | [
"MIT"
] | 1 | 2020-12-08T15:08:38.000Z | 2020-12-08T15:08:38.000Z | examples/getUserBadges.py | iranathan/RobloxPy | a83eeea30dc449f66b89dd011f4e09404248f866 | [
"MIT"
] | null | null | null | examples/getUserBadges.py | iranathan/RobloxPy | a83eeea30dc449f66b89dd011f4e09404248f866 | [
"MIT"
] | 1 | 2020-12-08T15:08:39.000Z | 2020-12-08T15:08:39.000Z | from robloxpy import User
User.badges(1) | 20 | 25 | 0.825 | 7 | 40 | 4.714286 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027778 | 0.1 | 40 | 2 | 26 | 20 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
23925b54b8261a42a19a2a24b73cfce63790735a | 314 | py | Python | configs/gdrn/ycbvPbrSO/resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO_bop_test/resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO_bop_test_12_21BleachCleanser.py | THU-DA-6D-Pose-Group/self6dpp | c267cfa55e440e212136a5e9940598720fa21d16 | [
"Apache-2.0"
] | 33 | 2021-12-15T07:11:47.000Z | 2022-03-29T08:58:32.000Z | configs/gdrn/ycbvPbrSO/resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO_bop_test/resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO_bop_test_12_21BleachCleanser.py | THU-DA-6D-Pose-Group/self6dpp | c267cfa55e440e212136a5e9940598720fa21d16 | [
"Apache-2.0"
] | 3 | 2021-12-15T11:39:54.000Z | 2022-03-29T07:24:23.000Z | configs/gdrn/ycbvPbrSO/resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO_bop_test/resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO_bop_test_12_21BleachCleanser.py | THU-DA-6D-Pose-Group/self6dpp | c267cfa55e440e212136a5e9940598720fa21d16 | [
"Apache-2.0"
] | null | null | null | _base_ = "./resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO_bop_test_01_02MasterChefCan.py"
OUTPUT_DIR = (
"output/gdrn/ycbvPbrSO/resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO/12_21BleachCleanser"
)
DATASETS = dict(TRAIN=("ycbv_021_bleach_cleanser_train_pbr",))
| 52.333333 | 118 | 0.875796 | 38 | 314 | 6.526316 | 0.736842 | 0.193548 | 0.225806 | 0.282258 | 0.508065 | 0.508065 | 0.508065 | 0.508065 | 0 | 0 | 0 | 0.09699 | 0.047771 | 314 | 5 | 119 | 62.8 | 0.732441 | 0 | 0 | 0 | 0 | 0 | 0.792994 | 0.792994 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
239aea79f97c031d4d8fb10fbb6a8181fc8f3463 | 163 | py | Python | simtbx/diffBragg/refiners/__init__.py | dperl-sol/cctbx_project | b9e390221a2bc4fd00b9122e97c3b79c632c6664 | [
"BSD-3-Clause-LBNL"
] | 155 | 2016-11-23T12:52:16.000Z | 2022-03-31T15:35:44.000Z | simtbx/diffBragg/refiners/__init__.py | dperl-sol/cctbx_project | b9e390221a2bc4fd00b9122e97c3b79c632c6664 | [
"BSD-3-Clause-LBNL"
] | 590 | 2016-12-10T11:31:18.000Z | 2022-03-30T23:10:09.000Z | simtbx/diffBragg/refiners/__init__.py | dperl-sol/cctbx_project | b9e390221a2bc4fd00b9122e97c3b79c632c6664 | [
"BSD-3-Clause-LBNL"
] | 115 | 2016-11-15T08:17:28.000Z | 2022-02-09T15:30:14.000Z | from __future__ import absolute_import, division, print_function
from .base_refiner import BaseRefiner, BreakToUseCurvatures, BreakBecauseSignal # special import
| 54.333333 | 97 | 0.865031 | 17 | 163 | 7.882353 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09816 | 163 | 2 | 98 | 81.5 | 0.911565 | 0.08589 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 5 |
23ac4b8fb0dd3df022d1cc1921eebc57f986dbc1 | 79 | py | Python | incasem/torch/__init__.py | kirchhausenlab/incasem | ee9e007c5c04571e547e2fb5af5e800bd2d2b435 | [
"BSD-3-Clause"
] | null | null | null | incasem/torch/__init__.py | kirchhausenlab/incasem | ee9e007c5c04571e547e2fb5af5e800bd2d2b435 | [
"BSD-3-Clause"
] | null | null | null | incasem/torch/__init__.py | kirchhausenlab/incasem | ee9e007c5c04571e547e2fb5af5e800bd2d2b435 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import
from . import models
from . import loss
| 19.75 | 38 | 0.822785 | 11 | 79 | 5.454545 | 0.545455 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.151899 | 79 | 3 | 39 | 26.333333 | 0.895522 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
23bc22e9c13932ff93ea87fe51ee99a8bcef275f | 31 | py | Python | mdutils/tools/__init__.py | yngtodd/mdutils | 2dce7a2fe7d8c92a968bde38af57a7e83602174d | [
"MIT"
] | 1 | 2020-05-01T20:12:33.000Z | 2020-05-01T20:12:33.000Z | mdutils/tools/__init__.py | yngtodd/mdutils | 2dce7a2fe7d8c92a968bde38af57a7e83602174d | [
"MIT"
] | 10 | 2020-01-08T00:19:43.000Z | 2020-03-02T14:23:42.000Z | pythonlogbook/logbookenv/lib/python3.6/site-packages/mdutils/tools/__init__.py | lukew3/logbook | 53b5df5ea5b416267f7640351bd043de18af4f77 | [
"MIT"
] | null | null | null | from mdutils.tools import tools | 31 | 31 | 0.870968 | 5 | 31 | 5.4 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096774 | 31 | 1 | 31 | 31 | 0.964286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
23d0702ad68b98764e9618c9fa1c34f8f25c4dec | 107 | py | Python | initdb.py | rskwan/ncindex | 5621eec1c6475b2e977be5b716b583930ba4de80 | [
"MIT"
] | 1 | 2018-05-02T16:59:41.000Z | 2018-05-02T16:59:41.000Z | initdb.py | rskwan/ncindex | 5621eec1c6475b2e977be5b716b583930ba4de80 | [
"MIT"
] | null | null | null | initdb.py | rskwan/ncindex | 5621eec1c6475b2e977be5b716b583930ba4de80 | [
"MIT"
] | null | null | null | # Run this to initialize the database.
from ncindex import db
from ncindex.models import *
db.create_all()
| 21.4 | 38 | 0.785047 | 17 | 107 | 4.882353 | 0.764706 | 0.26506 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.149533 | 107 | 4 | 39 | 26.75 | 0.912088 | 0.336449 | 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 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
23f8834b84427b238b8d9ad604721a9685d66f45 | 460 | py | Python | src/study/cli.py | ppmzhang2/gpt3-study | 1c4e34238301e06da8cbda23eb4e473567e15c80 | [
"MIT"
] | null | null | null | src/study/cli.py | ppmzhang2/gpt3-study | 1c4e34238301e06da8cbda23eb4e473567e15c80 | [
"MIT"
] | null | null | null | src/study/cli.py | ppmzhang2/gpt3-study | 1c4e34238301e06da8cbda23eb4e473567e15c80 | [
"MIT"
] | null | null | null | """all commands here"""
import click
from .serv import decode
from .serv import encode
from .serv import encode_with_pretrained
from .serv import fine_tune_train
from .serv import prompt_generate
from .serv import tokenize
@click.group()
def cli():
"""all clicks here"""
cli.add_command(decode)
cli.add_command(encode)
cli.add_command(encode_with_pretrained)
cli.add_command(fine_tune_train)
cli.add_command(prompt_generate)
cli.add_command(tokenize)
| 20 | 40 | 0.797826 | 70 | 460 | 5.014286 | 0.328571 | 0.136752 | 0.239316 | 0.11396 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.108696 | 460 | 22 | 41 | 20.909091 | 0.856098 | 0.071739 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | true | 0 | 0.466667 | 0 | 0.533333 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
f1b1a1f95b25de6f1dfa58d8dca73fe8aa84a617 | 58 | py | Python | optflow/viz/__init__.py | czming/optflow | 6a6d24efbaac162f1d3da5d26430f9ea9e60bbad | [
"MIT"
] | null | null | null | optflow/viz/__init__.py | czming/optflow | 6a6d24efbaac162f1d3da5d26430f9ea9e60bbad | [
"MIT"
] | 1 | 2021-01-12T01:26:21.000Z | 2021-01-12T01:26:21.000Z | optflow/viz/__init__.py | czming/optflow | 6a6d24efbaac162f1d3da5d26430f9ea9e60bbad | [
"MIT"
] | 1 | 2021-01-12T00:35:04.000Z | 2021-01-12T00:35:04.000Z | from .display_flow import *
from .visualize_state import * | 29 | 30 | 0.810345 | 8 | 58 | 5.625 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12069 | 58 | 2 | 30 | 29 | 0.882353 | 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 | 1 | 0 | 0 | 5 |
7b234731eeaf74fa7437e4cb0a5d7859f436fbd6 | 128 | py | Python | hello.py | abrosen/cis1051demo | 182fd075d915b2bfd7ba814dc62416666ebba8ab | [
"MIT"
] | null | null | null | hello.py | abrosen/cis1051demo | 182fd075d915b2bfd7ba814dc62416666ebba8ab | [
"MIT"
] | null | null | null | hello.py | abrosen/cis1051demo | 182fd075d915b2bfd7ba814dc62416666ebba8ab | [
"MIT"
] | null | null | null | # this is a hello world file
# it is boring
print("begin hello world")
print("hello!")
print("world")
print("end hello world")
| 16 | 28 | 0.695313 | 21 | 128 | 4.238095 | 0.52381 | 0.337079 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15625 | 128 | 7 | 29 | 18.285714 | 0.824074 | 0.304688 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
7b2d7193bb5c1a97040b264b8033dd7627855382 | 277 | py | Python | src/blip_sdk/extensions/artificial_intelligence/content_assistant/content_type.py | mirlarof/blip-sdk-python | f958149b2524d4340eeafad8739a33db71df45ed | [
"MIT"
] | 2 | 2021-07-02T20:10:48.000Z | 2021-07-13T20:51:18.000Z | src/blip_sdk/extensions/artificial_intelligence/content_assistant/content_type.py | mirlarof/blip-sdk-python | f958149b2524d4340eeafad8739a33db71df45ed | [
"MIT"
] | 9 | 2021-05-27T21:08:23.000Z | 2021-06-14T20:10:10.000Z | src/blip_sdk/extensions/artificial_intelligence/content_assistant/content_type.py | mirlarof/blip-sdk-python | f958149b2524d4340eeafad8739a33db71df45ed | [
"MIT"
] | 3 | 2021-06-23T19:53:20.000Z | 2022-01-04T17:50:44.000Z | class ContentType:
"""Content Assistant Content type class."""
CONTENT_RESULT = 'application/vnd.iris.ai.content-result+json'
CONTENT_COMBINATION = 'application/vnd.iris.ai.content-combination+json'
ANALYSIS = 'application/vnd.iris.ai.analysis-request+json'
| 30.777778 | 76 | 0.747292 | 33 | 277 | 6.212121 | 0.424242 | 0.204878 | 0.263415 | 0.292683 | 0.263415 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126354 | 277 | 8 | 77 | 34.625 | 0.847107 | 0.133574 | 0 | 0 | 0 | 0 | 0.581197 | 0.581197 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
9e33b0959897faf145ca4c3bedee7c5278dc0757 | 78 | py | Python | env/lib/python3.7/site-packages/indicoio/custom/__init__.py | Novandev/gn_api | 08b071ae3916bb7a183d61843a2cd09e9fe15c7b | [
"MIT"
] | 4 | 2015-08-20T22:42:19.000Z | 2016-03-14T01:28:45.000Z | indicoio/custom/__init__.py | mikesperry/IndicoIo-python | caa155b8b31b76df3f86f559ce5324f061a03e40 | [
"MIT"
] | null | null | null | indicoio/custom/__init__.py | mikesperry/IndicoIo-python | caa155b8b31b76df3f86f559ce5324f061a03e40 | [
"MIT"
] | null | null | null | from .custom import Collection, collections, vectorize, visualize_explanation
| 39 | 77 | 0.858974 | 8 | 78 | 8.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.089744 | 78 | 1 | 78 | 78 | 0.929577 | 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 | 1 | 0 | 0 | 5 |
9e33d770da8ab7937c126ba233776c74dd33c135 | 36 | py | Python | desktop/core/ext-py/nose-1.3.7/unit_tests/support/script.py | kokosing/hue | 2307f5379a35aae9be871e836432e6f45138b3d9 | [
"Apache-2.0"
] | 5,079 | 2015-01-01T03:39:46.000Z | 2022-03-31T07:38:22.000Z | desktop/core/ext-py/nose-1.3.7/unit_tests/support/script.py | zks888/hue | 93a8c370713e70b216c428caa2f75185ef809deb | [
"Apache-2.0"
] | 1,623 | 2015-01-01T08:06:24.000Z | 2022-03-30T19:48:52.000Z | desktop/core/ext-py/nose-1.3.7/unit_tests/support/script.py | zks888/hue | 93a8c370713e70b216c428caa2f75185ef809deb | [
"Apache-2.0"
] | 2,033 | 2015-01-04T07:18:02.000Z | 2022-03-28T19:55:47.000Z | #!/usr/bin/env python
print "FAIL"
| 9 | 21 | 0.666667 | 6 | 36 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138889 | 36 | 3 | 22 | 12 | 0.774194 | 0.555556 | 0 | 0 | 0 | 0 | 0.266667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 1 | 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 | 1 | 0 | 5 |
9e3597ebd1e335f4fa0fddeb9a7a34dc71c462b7 | 113 | py | Python | kalliope/core/ConfigurationManager/__init__.py | joshuaboniface/kalliope | 0e040be3165e838485d1e5addc4d2c5df12bfd84 | [
"MIT"
] | 1 | 2020-03-30T15:03:19.000Z | 2020-03-30T15:03:19.000Z | kalliope/core/ConfigurationManager/__init__.py | joshuaboniface/kalliope | 0e040be3165e838485d1e5addc4d2c5df12bfd84 | [
"MIT"
] | null | null | null | kalliope/core/ConfigurationManager/__init__.py | joshuaboniface/kalliope | 0e040be3165e838485d1e5addc4d2c5df12bfd84 | [
"MIT"
] | 1 | 2021-11-21T19:08:15.000Z | 2021-11-21T19:08:15.000Z | from .YAMLLoader import YAMLLoader
from .SettingLoader import SettingLoader
from .BrainLoader import BrainLoader
| 28.25 | 40 | 0.867257 | 12 | 113 | 8.166667 | 0.416667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106195 | 113 | 3 | 41 | 37.666667 | 0.970297 | 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 | 1 | 0 | 0 | 5 |
9e4276cd81cdc93ceb8fdc2f251baa5dff89c5cc | 180 | py | Python | OOP/OOP-Practice/inheritance/design_oops.py | siddhantdixit/OOP-ClassWork | ce414a3836d03aa7dee0eb1d7a69e849fb6707c0 | [
"MIT"
] | null | null | null | OOP/OOP-Practice/inheritance/design_oops.py | siddhantdixit/OOP-ClassWork | ce414a3836d03aa7dee0eb1d7a69e849fb6707c0 | [
"MIT"
] | null | null | null | OOP/OOP-Practice/inheritance/design_oops.py | siddhantdixit/OOP-ClassWork | ce414a3836d03aa7dee0eb1d7a69e849fb6707c0 | [
"MIT"
] | null | null | null | class DesignOops:
def __init__(self):
print("Hello")
class NewOOps(DesignOops):
def __init__(self):
print("OK")
super().__init__()
NewOOps() | 15 | 26 | 0.577778 | 18 | 180 | 5.111111 | 0.555556 | 0.282609 | 0.369565 | 0.456522 | 0.565217 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.283333 | 180 | 12 | 27 | 15 | 0.713178 | 0 | 0 | 0.25 | 0 | 0 | 0.038674 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0.25 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
9e76ee1433334ed25322746c31f01a8f24b230ec | 273 | py | Python | DQM/Physics/python/qcdPhotonsCosmicDQM_cff.py | PKUfudawei/cmssw | 8fbb5ce74398269c8a32956d7c7943766770c093 | [
"Apache-2.0"
] | 1 | 2018-08-28T16:51:36.000Z | 2018-08-28T16:51:36.000Z | DQM/Physics/python/qcdPhotonsCosmicDQM_cff.py | PKUfudawei/cmssw | 8fbb5ce74398269c8a32956d7c7943766770c093 | [
"Apache-2.0"
] | 25 | 2016-06-24T20:55:32.000Z | 2022-02-01T19:24:45.000Z | DQM/Physics/python/qcdPhotonsCosmicDQM_cff.py | PKUfudawei/cmssw | 8fbb5ce74398269c8a32956d7c7943766770c093 | [
"Apache-2.0"
] | 8 | 2016-03-25T07:17:43.000Z | 2021-07-08T17:11:21.000Z | import FWCore.ParameterSet.Config as cms
import DQM.Physics.qcdPhotonsDQM_cfi
qcdPhotonsCosmicDQM = DQM.Physics.qcdPhotonsDQM_cfi.qcdPhotonsDQM.clone(
barrelRecHitTag = "ecalRecHit:EcalRecHitsEB",
endcapRecHitTag = "ecalRecHit:EcalRecHitsEE"
)
| 34.125 | 72 | 0.761905 | 24 | 273 | 8.583333 | 0.708333 | 0.097087 | 0.223301 | 0.252427 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164835 | 273 | 7 | 73 | 39 | 0.903509 | 0 | 0 | 0 | 0 | 0 | 0.175824 | 0.175824 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
9ebf8eaf41c98c8441a45396ec01008c464295b7 | 62 | py | Python | misc/python/py.py | saranshbht/codes-and-more-codes | 0bd2e46ca613b3b81e1196d393902e86a43aa353 | [
"MIT"
] | null | null | null | misc/python/py.py | saranshbht/codes-and-more-codes | 0bd2e46ca613b3b81e1196d393902e86a43aa353 | [
"MIT"
] | null | null | null | misc/python/py.py | saranshbht/codes-and-more-codes | 0bd2e46ca613b3b81e1196d393902e86a43aa353 | [
"MIT"
] | null | null | null | print("Hello World");
import math;
print(math.degrees(0.345)); | 20.666667 | 27 | 0.725806 | 10 | 62 | 4.5 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068966 | 0.064516 | 62 | 3 | 27 | 20.666667 | 0.706897 | 0 | 0 | 0 | 0 | 0 | 0.174603 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0.666667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 5 |
7b550234d62d197e4d471b3b12530cdd2ae76832 | 550 | py | Python | meddlr/modeling/meta_arch/__init__.py | ad12/meddlr | dda5a4ad7855de3a34331c60599e3253f980e989 | [
"Apache-2.0"
] | 23 | 2021-11-05T02:00:01.000Z | 2022-03-21T15:35:38.000Z | meddlr/modeling/meta_arch/__init__.py | ad12/meddlr | dda5a4ad7855de3a34331c60599e3253f980e989 | [
"Apache-2.0"
] | 29 | 2021-11-04T22:18:26.000Z | 2022-03-24T01:04:53.000Z | meddlr/modeling/meta_arch/__init__.py | ad12/meddlr | dda5a4ad7855de3a34331c60599e3253f980e989 | [
"Apache-2.0"
] | 1 | 2022-01-25T22:34:51.000Z | 2022-01-25T22:34:51.000Z | from .build import META_ARCH_REGISTRY, build_model, initialize_model # noqa: F401
from .cs_model import CSModel # noqa: F401
from .denoising import DenoisingModel # noqa: F401
from .generalized_unet import GeneralizedUNet # noqa: F401
from .m2r import M2RModel # noqa: F401
from .n2r import N2RModel # noqa: F401
from .nm2r import NM2RModel # noqa: F401
from .ssdu import SSDUModel # noqa: F401
from .unet import UnetModel # noqa: F401
from .unrolled import GeneralizedUnrolledCNN # noqa: F401
from .vortex import VortexModel # noqa: F401
| 45.833333 | 82 | 0.772727 | 74 | 550 | 5.662162 | 0.405405 | 0.210024 | 0.286396 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.084783 | 0.163636 | 550 | 11 | 83 | 50 | 0.826087 | 0.218182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
7bc7f92777ddd9d7ad94caded9569daef630fec4 | 1,967 | py | Python | tests/test_scheduling_tools.py | Smurgs/CourseScheduler | bea9f4ba489bc65bd5c3aaf265fede18f7862a58 | [
"MIT"
] | null | null | null | tests/test_scheduling_tools.py | Smurgs/CourseScheduler | bea9f4ba489bc65bd5c3aaf265fede18f7862a58 | [
"MIT"
] | null | null | null | tests/test_scheduling_tools.py | Smurgs/CourseScheduler | bea9f4ba489bc65bd5c3aaf265fede18f7862a58 | [
"MIT"
] | null | null | null | import sys
sys.path.append('../course_scheduler')
from course_scheduler.scheduling_tools import *
class TestVirtualSchedule(object):
def setup(self):
self.vs = VirtualSchedule()
def test_empty_schedule(self):
assert len(self.vs.get_registered_classes()) == 0
def test_add_section(self):
time_slot = TimeSlot("M", "08:35", "11:35")
section = Section("MATH2004A", time_slot)
assert self.vs.add_to_schedule(section)
assert len(self.vs.get_registered_classes()) == 1
def test_add_lab(self):
time_slot = TimeSlot("T", "08:35", "11:35")
lab = Lab("MATH2004A", time_slot)
assert self.vs.add_to_schedule(lab)
assert len(self.vs.get_registered_classes()) == 1
def test_no_overlap(self):
time_slot = TimeSlot("M", "08:35", "11:35")
section = Section("MATH2004A", time_slot)
assert self.vs.add_to_schedule(section)
time_slot = TimeSlot("M", "08:35", "11:35")
lab = Lab("ELEC2004A", time_slot)
assert not self.vs.add_to_schedule(lab)
time_slot = TimeSlot("M", "10:35", "12:35")
lab = Lab("ELEC2004A", time_slot)
assert not self.vs.add_to_schedule(lab)
time_slot = TimeSlot("M", "06:35", "09:35")
lab = Lab("ELEC2004A", time_slot)
assert not self.vs.add_to_schedule(lab)
time_slot = TimeSlot("M", "06:35", "12:35")
lab = Lab("ELEC2004A", time_slot)
assert not self.vs.add_to_schedule(lab)
def test_boundary(self):
time_slot = TimeSlot("M", "08:35", "11:25")
section = Section("MATH2004A", time_slot)
assert self.vs.add_to_schedule(section)
time_slot = TimeSlot("M", "11:35", "12:25")
lab = Lab("ELEC2004A", time_slot)
assert self.vs.add_to_schedule(lab)
time_slot = TimeSlot("M", "07:35", "08:25")
lab = Lab("ELEC2004A", time_slot)
assert self.vs.add_to_schedule(lab)
| 32.245902 | 57 | 0.617692 | 274 | 1,967 | 4.222628 | 0.186131 | 0.138289 | 0.138289 | 0.095073 | 0.78306 | 0.78306 | 0.770959 | 0.740709 | 0.712187 | 0.673293 | 0 | 0.081728 | 0.234875 | 1,967 | 60 | 58 | 32.783333 | 0.687043 | 0 | 0 | 0.545455 | 0 | 0 | 0.111394 | 0 | 0 | 0 | 0 | 0 | 0.295455 | 1 | 0.136364 | false | 0 | 0.045455 | 0 | 0.204545 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
c8838fd70df6b3e6bfbd20c4e8ac74132a1d171c | 132 | py | Python | affo_email_service/api/exception.py | fossabot/affo-email-service | 4e224c025a410504601651f1a85762c91300f4e9 | [
"BSD-3-Clause"
] | null | null | null | affo_email_service/api/exception.py | fossabot/affo-email-service | 4e224c025a410504601651f1a85762c91300f4e9 | [
"BSD-3-Clause"
] | 1 | 2019-11-25T14:25:18.000Z | 2019-11-25T14:25:18.000Z | affo_email_service/api/exception.py | fossabot/affo-email-service | 4e224c025a410504601651f1a85762c91300f4e9 | [
"BSD-3-Clause"
] | 1 | 2019-11-25T14:21:58.000Z | 2019-11-25T14:21:58.000Z | import http
import connexion_buzz
class NoSuchMessage(connexion_buzz.ConnexionBuzz):
status_code = http.HTTPStatus.NOT_FOUND
| 16.5 | 50 | 0.825758 | 16 | 132 | 6.5625 | 0.75 | 0.247619 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121212 | 132 | 7 | 51 | 18.857143 | 0.905172 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 1 | 0 | 1 | 0 | 0 | null | 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 | 1 | 0 | 0 | 5 |
c8d4cf7daf112be480531fbca567f02655daf82d | 4,236 | py | Python | hw7_ValidationOnLinReg.py | alisa-ipn/Learning-From-Data-MOOC-hws | 97ed5b23bcbfb825975fe882f9eff3ca80b620bc | [
"MIT"
] | null | null | null | hw7_ValidationOnLinReg.py | alisa-ipn/Learning-From-Data-MOOC-hws | 97ed5b23bcbfb825975fe882f9eff3ca80b620bc | [
"MIT"
] | null | null | null | hw7_ValidationOnLinReg.py | alisa-ipn/Learning-From-Data-MOOC-hws | 97ed5b23bcbfb825975fe882f9eff3ca80b620bc | [
"MIT"
] | 1 | 2018-11-22T17:45:36.000Z | 2018-11-22T17:45:36.000Z | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 9 22:04:17 2016
@author: alisazhila
"""
import numpy as np
import hw6_2LinRegRegularized
def read_dta_25_10(fname):
tr_data = []
val_data =[]
data = []
for s in open(fname):
values = s.strip().split()
values = np.array(map(float, values))
for v in values:
v = float(v)
data.append(values)
tr_data = data[:25]
val_data = data[-10:]
return tr_data, val_data
def nonlinear_transformation_to_k(data, k):
transformed_data = []
labels = []
if k > 0:
for datapoint in data:
transformed_datapoint = []
transformed_datapoint.append(1) #1
transformed_datapoint.append(datapoint[0]) #x1
transformed_datapoint.append(datapoint[1]) #x2
if k >=3:
transformed_datapoint.append(datapoint[0]*datapoint[0]) #x1^2
if k >=4:
transformed_datapoint.append(datapoint[1]*datapoint[1]) #x2^2
if k >=5:
transformed_datapoint.append(datapoint[0]*datapoint[1]) #x1*x2
if k >=6:
transformed_datapoint.append(abs(datapoint[0]-datapoint[1])) #|x1-x2|
if k >=7:
transformed_datapoint.append(abs(datapoint[0]+datapoint[1])) #|x1+x2|
transformed_data.append(transformed_datapoint)
labels.append(datapoint[2])
return transformed_data, labels
def experiment_1(k):
tr_data, val_data = read_dta_25_10('./data/in.dta')
transformed_tr_data, tr_labels = nonlinear_transformation_to_k(tr_data, k)
#model training
w = hw6_2LinRegRegularized.linear_reg(transformed_tr_data, tr_labels)
#print w
err_in = hw6_2LinRegRegularized.estimate_err(w, transformed_tr_data, tr_labels)
print "err_in=", err_in
transformed_val_data, val_labels = nonlinear_transformation_to_k(val_data, k)
err_out = hw6_2LinRegRegularized.estimate_err(w, transformed_val_data, val_labels)
print "err_out=", err_out
return w, err_in, err_out
def experiment_2(k):
tr_data, val_data = read_dta_25_10('./data/in.dta')
transformed_tr_data, tr_labels = nonlinear_transformation_to_k(tr_data, k)
#model training
w = hw6_2LinRegRegularized.linear_reg(transformed_tr_data, tr_labels)
#print w
err_in = hw6_2LinRegRegularized.estimate_err(w, transformed_tr_data, tr_labels)
print "err_in=", err_in
test_data = hw6_2LinRegRegularized.read_dta('./data/out.dta')
transformed_test_data, test_labels = nonlinear_transformation_to_k(test_data, k)
err_out = hw6_2LinRegRegularized.estimate_err(w, transformed_test_data, test_labels)
print "err_out=", err_out
return w, err_in, err_out
def experiment_3(k):
val_data, tr_data = read_dta_25_10('./data/in.dta')
transformed_tr_data, tr_labels = nonlinear_transformation_to_k(tr_data, k)
#model training
w = hw6_2LinRegRegularized.linear_reg(transformed_tr_data, tr_labels)
#print w
err_in = hw6_2LinRegRegularized.estimate_err(w, transformed_tr_data, tr_labels)
print "err_in=", err_in
transformed_val_data, val_labels = nonlinear_transformation_to_k(val_data, k)
err_out = hw6_2LinRegRegularized.estimate_err(w, transformed_val_data, val_labels)
print "err_out=", err_out
return w, err_in, err_out
def experiment_4(k):
val_data, tr_data = read_dta_25_10('./data/in.dta')
transformed_tr_data, tr_labels = nonlinear_transformation_to_k(tr_data, k)
#model training
w = hw6_2LinRegRegularized.linear_reg(transformed_tr_data, tr_labels)
#print w
err_in = hw6_2LinRegRegularized.estimate_err(w, transformed_tr_data, tr_labels)
print "err_in=", err_in
test_data = hw6_2LinRegRegularized.read_dta('./data/out.dta')
transformed_test_data, test_labels = nonlinear_transformation_to_k(test_data, k)
err_out = hw6_2LinRegRegularized.estimate_err(w, transformed_test_data, test_labels)
print "err_out=", err_out
return w, err_in, err_out
errs = []
for k in [3,4,5,6,7]:
print "k=", k
w, err_in, err_out = experiment_2(k)
errs.append(err_out)
print errs
print min(errs)
| 34.721311 | 88 | 0.686969 | 600 | 4,236 | 4.503333 | 0.123333 | 0.051073 | 0.0755 | 0.084382 | 0.775722 | 0.73131 | 0.705033 | 0.705033 | 0.69393 | 0.69393 | 0 | 0.032625 | 0.211284 | 4,236 | 122 | 89 | 34.721311 | 0.776115 | 0.03423 | 0 | 0.44186 | 0 | 0 | 0.035411 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.023256 | null | null | 0.127907 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
74054058327b48cc0b5cd549e9c8b42c88da2ba8 | 837 | py | Python | DjangoCountries/countries/services.py | xm4dn355x/specialist_DjangoCountries | debfbead4cc87faf1e60af374863498080c5fa8f | [
"MIT"
] | null | null | null | DjangoCountries/countries/services.py | xm4dn355x/specialist_DjangoCountries | debfbead4cc87faf1e60af374863498080c5fa8f | [
"MIT"
] | null | null | null | DjangoCountries/countries/services.py | xm4dn355x/specialist_DjangoCountries | debfbead4cc87faf1e60af374863498080c5fa8f | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
########################################################################
# #
# #
# #
# MIT License #
# Copyright (c) 2021 Michael Nikitenko #
# #
########################################################################
def get_languages_list(countries: list):
return sorted(set([language for country in countries for language in country['languages']]))
def get_alphabet():
return [chr(i).upper() for i in range(ord('a'), ord('z') + 1)]
| 46.5 | 96 | 0.247312 | 45 | 837 | 4.533333 | 0.688889 | 0.058824 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014634 | 0.510155 | 837 | 17 | 97 | 49.235294 | 0.482927 | 0.403823 | 0 | 0 | 0 | 0 | 0.046218 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 5 |
a821930880c1585f34b0476b1cccfca6cef8d433 | 47 | py | Python | tests/__main__.py | agrif/earendil | 2477d85d3c2198a4cb1ab2c482d420705a28b022 | [
"MIT"
] | 2 | 2020-02-22T03:38:09.000Z | 2021-02-17T12:03:01.000Z | tests/__main__.py | agrif/quartustcl | 899aef7ca6b26c191e80c4a525d3f9c3322e51d0 | [
"MIT"
] | null | null | null | tests/__main__.py | agrif/quartustcl | 899aef7ca6b26c191e80c4a525d3f9c3322e51d0 | [
"MIT"
] | 1 | 2019-04-16T22:27:07.000Z | 2019-04-16T22:27:07.000Z | import unittest
unittest.main(module='tests')
| 11.75 | 29 | 0.787234 | 6 | 47 | 6.166667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.085106 | 47 | 3 | 30 | 15.666667 | 0.860465 | 0 | 0 | 0 | 0 | 0 | 0.106383 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
b51a574c2886afa4c19772207653bfe0824367b4 | 234 | py | Python | basen/__init__.py | vd2org/basen | ca3996c2c7900a071fa91d06960efc0c7f25b4be | [
"MIT"
] | 1 | 2021-08-03T01:49:47.000Z | 2021-08-03T01:49:47.000Z | basen/__init__.py | vd2org/basen | ca3996c2c7900a071fa91d06960efc0c7f25b4be | [
"MIT"
] | null | null | null | basen/__init__.py | vd2org/basen | ca3996c2c7900a071fa91d06960efc0c7f25b4be | [
"MIT"
] | 2 | 2020-02-19T11:10:34.000Z | 2022-03-01T06:38:30.000Z | # Copyright (C) 2017-2021 by Ivan.
# This file is part of BaseN package.
# BaseN is released under the MIT License (see LICENSE).
from .basen import BaseN
from .int2base import int2base, base2int
def version():
return "0.0.4"
| 19.5 | 56 | 0.717949 | 37 | 234 | 4.540541 | 0.756757 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.074074 | 0.192308 | 234 | 11 | 57 | 21.272727 | 0.814815 | 0.525641 | 0 | 0 | 0 | 0 | 0.046729 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | true | 0 | 0.5 | 0.25 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 5 |
b5322a0b08ac59891fd8bed7f6663cb64ca140f4 | 96 | py | Python | venv/lib/python3.8/site-packages/tests/test_exceptions.py | GiulianaPola/select_repeats | 17a0d053d4f874e42cf654dd142168c2ec8fbd11 | [
"MIT"
] | 2 | 2022-03-13T01:58:52.000Z | 2022-03-31T06:07:54.000Z | venv/lib/python3.8/site-packages/tests/test_exceptions.py | DesmoSearch/Desmobot | b70b45df3485351f471080deb5c785c4bc5c4beb | [
"MIT"
] | 19 | 2021-11-20T04:09:18.000Z | 2022-03-23T15:05:55.000Z | venv/lib/python3.8/site-packages/tests/test_exceptions.py | DesmoSearch/Desmobot | b70b45df3485351f471080deb5c785c4bc5c4beb | [
"MIT"
] | null | null | null | /home/runner/.cache/pip/pool/2a/f5/40/fbdcc529268cdda1c99782a0b37608cdc6e398b2c7e04199dfdcee68fa | 96 | 96 | 0.895833 | 9 | 96 | 9.555556 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.364583 | 0 | 96 | 1 | 96 | 96 | 0.53125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
b579b05d14abc4a0a02b667697dd80026dfb7c16 | 69 | py | Python | instance/config.py | johnwanjema/news-highlight | 91b36905e4060e9c27308299d8a72c476323c25c | [
"MIT"
] | null | null | null | instance/config.py | johnwanjema/news-highlight | 91b36905e4060e9c27308299d8a72c476323c25c | [
"MIT"
] | null | null | null | instance/config.py | johnwanjema/news-highlight | 91b36905e4060e9c27308299d8a72c476323c25c | [
"MIT"
] | null | null | null | NEWS_API_KEY = '03d3f69ba4844b8e94dc1582f0dc69b9'
SECRET_KEY = "1234" | 34.5 | 49 | 0.84058 | 7 | 69 | 7.857143 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | 0.072464 | 69 | 2 | 50 | 34.5 | 0.484375 | 0 | 0 | 0 | 0 | 0 | 0.514286 | 0.457143 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
b58d866b167dca08228c85800e58036b355b8250 | 5,875 | py | Python | cogs/vccontrol.py | CDESamBotDev/VCRoles | 764fff6be5dc44194ee3979dbfa72340cd66a172 | [
"Apache-2.0"
] | 3 | 2022-02-18T11:41:07.000Z | 2022-02-22T17:33:09.000Z | cogs/vccontrol.py | CDESamBotDev/VCRoles | 764fff6be5dc44194ee3979dbfa72340cd66a172 | [
"Apache-2.0"
] | 15 | 2022-01-22T20:15:10.000Z | 2022-03-29T16:10:40.000Z | cogs/vccontrol.py | CDESamBotDev/VCRoles | 764fff6be5dc44194ee3979dbfa72340cd66a172 | [
"Apache-2.0"
] | null | null | null | import asyncio
from typing import Literal, Optional
import discord
from discord import app_commands
from discord.ext import commands
from bot import MyClient
from checks import check_any, command_available, is_owner
class VCControl(commands.Cog):
def __init__(self, client: MyClient):
self.client = client
control_commands = app_commands.Group(
name="vc", description="Used to control voice channels"
)
async def get_members(
self, interaction: discord.Interaction
) -> list[discord.Member]:
mem = []
for user_id, state in interaction.guild._voice_states.items():
if state.channel and state.channel.id == interaction.user.voice.channel.id:
member = await interaction.guild.fetch_member(user_id)
if member is not None:
mem.append(member)
return mem
@control_commands.command()
@app_commands.describe(who="Who to mute:")
@check_any(command_available, is_owner)
@app_commands.checks.has_permissions(administrator=True)
async def mute(
self,
interaction: discord.Interaction,
who: Optional[Literal["everyone", "everyone but me"]] = "everyone but me",
):
"""Mutes everyone in a voice channel"""
if interaction.user.voice and interaction.user.voice.channel:
vc = interaction.user.voice.channel
mem = await self.get_members(interaction)
if who == "everyone" and vc:
tasks = [
self.client.loop.create_task(member.edit(mute=True)) for member in mem
]
elif who == "everyone but me" and vc:
tasks = [
self.client.loop.create_task(member.edit(mute=True))
for member in mem
if member.id != interaction.user.id
]
else:
return await interaction.response.send_message(
"Please ensure you are in a voice channel."
)
embed = discord.Embed(
colour=discord.Colour.dark_grey(),
description=f"Successfully muted in {vc.mention}",
)
await interaction.response.send_message(embed=embed)
await asyncio.gather(*tasks)
return self.client.incr_counter("vc_mute")
@control_commands.command()
@app_commands.describe(who="Who to deafen:")
@check_any(command_available, is_owner)
@app_commands.checks.has_permissions(administrator=True)
async def deafen(
self,
interaction: discord.Interaction,
who: Optional[Literal["everyone", "everyone but me"]] = "everyone but me",
):
"""Deafens everyone in a voice channel"""
if interaction.user.voice and interaction.user.voice.channel:
vc = interaction.user.voice.channel
mem = await self.get_members(interaction)
if who == "everyone" and vc:
tasks = [
self.client.loop.create_task(member.edit(deafen=True)) for member in mem
]
elif who == "everyone but me" and vc:
tasks = [
self.client.loop.create_task(member.edit(deafen=True))
for member in mem
if member.id != interaction.user.id
]
else:
return await interaction.response.send_message(
"Please ensure you are in a voice channel."
)
embed = discord.Embed(
colour=discord.Colour.dark_grey(),
description=f"Successfully deafened in {vc.mention}",
)
await interaction.response.send_message(embed=embed)
await asyncio.gather(*tasks)
return self.client.incr_counter("vc_deafen")
@control_commands.command()
@check_any(command_available, is_owner)
@app_commands.checks.has_permissions(administrator=True)
async def unmute(self, interaction: discord.Interaction):
"""Unmutes everyone in a voice channel"""
if interaction.user.voice and interaction.user.voice.channel:
vc = interaction.user.voice.channel
mem = await self.get_members(interaction)
if vc:
tasks = [
self.client.loop.create_task(member.edit(mute=False)) for member in mem
]
else:
return await interaction.response.send_message(
"Please ensure you are in a voice channel."
)
embed = discord.Embed(
colour=discord.Colour.dark_grey(),
description=f"Successfully unmuted in {vc.mention}",
)
await interaction.response.send_message(embed=embed)
await asyncio.gather(*tasks)
return self.client.incr_counter("vc_unmute")
@control_commands.command()
@check_any(command_available, is_owner)
@app_commands.checks.has_permissions(administrator=True)
async def undeafen(self, interaction: discord.Interaction):
"""Undeafens everyone in a voice channel"""
if interaction.user.voice and interaction.user.voice.channel:
vc = interaction.user.voice.channel
mem = await self.get_members(interaction)
if vc:
tasks = [
self.client.loop.create_task(member.edit(deafen=False))
for member in mem
]
else:
return await interaction.response.send_message(
"Please ensure you are in a voice channel."
)
embed = discord.Embed(
colour=discord.Colour.dark_grey(),
description=f"Successfully undeafened in {vc.mention}",
)
await interaction.response.send_message(embed=embed)
await asyncio.gather(*tasks)
return self.client.incr_counter("vc_undeafen")
async def setup(client: MyClient):
await client.add_cog(VCControl(client))
| 33.19209 | 88 | 0.620426 | 666 | 5,875 | 5.363363 | 0.162162 | 0.057111 | 0.072788 | 0.068029 | 0.777436 | 0.777436 | 0.768757 | 0.768757 | 0.768757 | 0.741321 | 0 | 0 | 0.286809 | 5,875 | 176 | 89 | 33.380682 | 0.852506 | 0 | 0 | 0.566176 | 0 | 0 | 0.092103 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.007353 | false | 0 | 0.051471 | 0 | 0.139706 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
b59ab55319d5522b977e209c8bbb2df6bffc67d0 | 136 | py | Python | reverse_shell_management/__init__.py | davidegirardi/zos-pivoting | 46c2575f98eb1f6c81a8bce6e3fef2110c6c0b3b | [
"MIT"
] | 3 | 2019-06-01T13:59:11.000Z | 2021-06-07T16:25:50.000Z | reverse_shell_management/__init__.py | davidegirardi/zos-pivoting | 46c2575f98eb1f6c81a8bce6e3fef2110c6c0b3b | [
"MIT"
] | null | null | null | reverse_shell_management/__init__.py | davidegirardi/zos-pivoting | 46c2575f98eb1f6c81a8bce6e3fef2110c6c0b3b | [
"MIT"
] | null | null | null | """Reverse shell connection management"""
from .wrappingshell import WrappingShell
from .reverseshellmanager import ReverseShellManager
| 34 | 52 | 0.852941 | 12 | 136 | 9.666667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.088235 | 136 | 3 | 53 | 45.333333 | 0.935484 | 0.257353 | 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 | 1 | 0 | 0 | 5 |
a9296fd6f1564e3f72c0c971c28df0849b65132e | 24 | py | Python | src/__init__.py | mkbeh/pydrommer | dc7c8f035813f8eddb35f166d445b8f0d9939067 | [
"MIT"
] | 2 | 2019-06-28T10:30:16.000Z | 2021-07-31T03:42:58.000Z | src/__init__.py | mkbeh/pydrommer | dc7c8f035813f8eddb35f166d445b8f0d9939067 | [
"MIT"
] | null | null | null | src/__init__.py | mkbeh/pydrommer | dc7c8f035813f8eddb35f166d445b8f0d9939067 | [
"MIT"
] | 2 | 2020-07-07T05:40:10.000Z | 2021-05-11T22:55:59.000Z | __version__ = '0.30.17'
| 12 | 23 | 0.666667 | 4 | 24 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.238095 | 0.125 | 24 | 1 | 24 | 24 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0.291667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
a98ad8c5d93cef0fce4519ba6461ced074fa797d | 54 | py | Python | plotly/validators/layout/grid/domain/__init__.py | gnestor/plotly.py | a8ae062795ddbf9867b8578fe6d9e244948c15ff | [
"MIT"
] | 12 | 2020-04-18T18:10:22.000Z | 2021-12-06T10:11:15.000Z | plotly/validators/layout/grid/domain/__init__.py | gnestor/plotly.py | a8ae062795ddbf9867b8578fe6d9e244948c15ff | [
"MIT"
] | 27 | 2020-04-28T21:23:12.000Z | 2021-06-25T15:36:38.000Z | plotly/validators/layout/grid/domain/__init__.py | gnestor/plotly.py | a8ae062795ddbf9867b8578fe6d9e244948c15ff | [
"MIT"
] | 6 | 2020-04-18T23:07:08.000Z | 2021-11-18T07:53:06.000Z | from ._y import YValidator
from ._x import XValidator
| 18 | 26 | 0.814815 | 8 | 54 | 5.25 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148148 | 54 | 2 | 27 | 27 | 0.913043 | 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 | 1 | 0 | 0 | 5 |
a999bd549fe4324cd85f3e17475140660e436da7 | 80 | py | Python | foauth/__init__.py | GarrettHeel/foauth.org | f550f11c61ab0d9ec75d9a512fa9665db7a20087 | [
"BSD-3-Clause"
] | null | null | null | foauth/__init__.py | GarrettHeel/foauth.org | f550f11c61ab0d9ec75d9a512fa9665db7a20087 | [
"BSD-3-Clause"
] | null | null | null | foauth/__init__.py | GarrettHeel/foauth.org | f550f11c61ab0d9ec75d9a512fa9665db7a20087 | [
"BSD-3-Clause"
] | null | null | null | class OAuthError(Exception):
pass
class OAuthDenied(Exception):
pass
| 10 | 29 | 0.7125 | 8 | 80 | 7.125 | 0.625 | 0.45614 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2125 | 80 | 7 | 30 | 11.428571 | 0.904762 | 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 | 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 | 5 |
a9a2d5dac8205c0662e7714feb8fd99b81432d5b | 52 | py | Python | flask_new/t.py | Theropod/MLinSiteSelection | dbe0a0912c079558731036be0017042a47d6d5fe | [
"MIT"
] | 1 | 2022-03-12T15:40:56.000Z | 2022-03-12T15:40:56.000Z | flask_new/t.py | Theropod/MLinSiteSelection | dbe0a0912c079558731036be0017042a47d6d5fe | [
"MIT"
] | null | null | null | flask_new/t.py | Theropod/MLinSiteSelection | dbe0a0912c079558731036be0017042a47d6d5fe | [
"MIT"
] | null | null | null | print("\u5c0f\u6c64\u5c71".decode('unicode-escape')) | 52 | 52 | 0.75 | 7 | 52 | 5.571429 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 0 | 52 | 1 | 52 | 52 | 0.596154 | 0 | 0 | 0 | 0 | 0 | 0.603774 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
8d5e9e1bc70df0e3813201fb57739a521ceb339c | 74 | py | Python | FWCore/GuiBrowsers/examples/cleanPatCandidates_cff.py | NTrevisani/cmssw | a212a27526f34eb9507cf8b875c93896e6544781 | [
"Apache-2.0"
] | 3 | 2018-08-24T19:10:26.000Z | 2019-02-19T11:45:32.000Z | FWCore/GuiBrowsers/examples/cleanPatCandidates_cff.py | NTrevisani/cmssw | a212a27526f34eb9507cf8b875c93896e6544781 | [
"Apache-2.0"
] | 7 | 2016-07-17T02:34:54.000Z | 2019-08-13T07:58:37.000Z | FWCore/GuiBrowsers/examples/cleanPatCandidates_cff.py | NTrevisani/cmssw | a212a27526f34eb9507cf8b875c93896e6544781 | [
"Apache-2.0"
] | 5 | 2018-08-21T16:37:52.000Z | 2020-01-09T13:33:17.000Z | from PhysicsTools.PatAlgos.cleaningLayer1.cleanPatCandidates_cff import *
| 37 | 73 | 0.891892 | 7 | 74 | 9.285714 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014286 | 0.054054 | 74 | 1 | 74 | 74 | 0.914286 | 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 | 1 | 0 | 0 | 5 |
8d999a0e4b3e317d4c02947fbe2a4472aa21ed8a | 192 | py | Python | interview/tests.py | M-Davinci/recruitment | b0e2ab06b170ab1543dd590b1d7c70941bc74f41 | [
"Apache-2.0"
] | null | null | null | interview/tests.py | M-Davinci/recruitment | b0e2ab06b170ab1543dd590b1d7c70941bc74f41 | [
"Apache-2.0"
] | null | null | null | interview/tests.py | M-Davinci/recruitment | b0e2ab06b170ab1543dd590b1d7c70941bc74f41 | [
"Apache-2.0"
] | null | null | null | from django.test import TestCase
# Create your tests here.
list = ['svchost.exe||2736||0.05||0.0', 'svchost.exe||2744||2.78||0.0', ]
if 'svchost.exe||2736||0.05||0.0' in list:
print(7)
| 21.333333 | 73 | 0.635417 | 36 | 192 | 3.388889 | 0.611111 | 0.245902 | 0.229508 | 0.245902 | 0.311475 | 0.311475 | 0.311475 | 0 | 0 | 0 | 0 | 0.168675 | 0.135417 | 192 | 8 | 74 | 24 | 0.566265 | 0.119792 | 0 | 0 | 0 | 0 | 0.502994 | 0.502994 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.25 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
8d9e5097fc583b907ff79f708ff8751529a2854c | 242 | py | Python | nengolib/testing.py | ikajic/nengolib | bd30ec38ba656bedb94a267b5f86b51d1cec4954 | [
"MIT"
] | 27 | 2016-01-21T04:11:02.000Z | 2021-11-16T20:41:04.000Z | nengolib/testing.py | ikajic/nengolib | bd30ec38ba656bedb94a267b5f86b51d1cec4954 | [
"MIT"
] | 178 | 2016-01-21T16:04:34.000Z | 2021-05-01T16:28:02.000Z | nengolib/testing.py | ikajic/nengolib | bd30ec38ba656bedb94a267b5f86b51d1cec4954 | [
"MIT"
] | 4 | 2019-03-19T18:22:02.000Z | 2021-03-23T16:06:57.000Z | from nengo.version import version_info
if version_info >= (2, 7, 0):
from pytest import warns # noqa: F401
else: # pragma: no cover
# https://github.com/nengo/nengo/pull/1381
from nengo.utils.testing import warns # noqa: F401
| 30.25 | 55 | 0.698347 | 37 | 242 | 4.513514 | 0.648649 | 0.107784 | 0.179641 | 0.227545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066667 | 0.194215 | 242 | 7 | 56 | 34.571429 | 0.789744 | 0.326446 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.6 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
a5dfe4a9b2bae7d8373bbbd0b987280b0982aed2 | 186 | py | Python | Lesson03/Code/YourName.py | pangmi/learntocode | 719a2bfbc897104d0f95dcf4634fe93427e2c397 | [
"MIT"
] | null | null | null | Lesson03/Code/YourName.py | pangmi/learntocode | 719a2bfbc897104d0f95dcf4634fe93427e2c397 | [
"MIT"
] | null | null | null | Lesson03/Code/YourName.py | pangmi/learntocode | 719a2bfbc897104d0f95dcf4634fe93427e2c397 | [
"MIT"
] | 1 | 2021-12-19T18:01:06.000Z | 2021-12-19T18:01:06.000Z | # input() takes input from user with a prompting message, and returns the
# user input as a string
name = input('Please enter your name: ')
print("Hello", name, name, name, name, name)
| 31 | 73 | 0.715054 | 30 | 186 | 4.433333 | 0.633333 | 0.240602 | 0.270677 | 0.240602 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.177419 | 186 | 5 | 74 | 37.2 | 0.869281 | 0.505376 | 0 | 0 | 0 | 0 | 0.325843 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 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 | 1 | 0 | 5 |
a5f2ba6667e305a4609d9f5390b09b72d052797c | 1,180 | py | Python | app/main/__init__.py | yorksdale/digital-marketplace | a37e79a8b8ac64e0e6f9e08803301eccdb18d7bc | [
"MIT"
] | null | null | null | app/main/__init__.py | yorksdale/digital-marketplace | a37e79a8b8ac64e0e6f9e08803301eccdb18d7bc | [
"MIT"
] | null | null | null | app/main/__init__.py | yorksdale/digital-marketplace | a37e79a8b8ac64e0e6f9e08803301eccdb18d7bc | [
"MIT"
] | null | null | null | from flask import Blueprint
from dmcontent.content_loader import ContentLoader
main = Blueprint('main', __name__)
content_loader = ContentLoader('app/content')
content_loader.load_manifest('digital-outcomes-and-specialists', 'briefs', 'edit_brief')
content_loader.load_manifest('digital-outcomes-and-specialists', 'brief-responses', 'legacy_edit_brief_response')
content_loader.load_manifest('digital-outcomes-and-specialists', 'brief-responses', 'edit_brief_response')
content_loader.load_manifest('digital-outcomes-and-specialists', 'brief-responses', 'legacy_display_brief_response')
content_loader.load_manifest('digital-outcomes-and-specialists', 'brief-responses', 'display_brief_response')
content_loader.load_manifest('digital-outcomes-and-specialists-2', 'briefs', 'edit_brief')
content_loader.load_manifest('digital-outcomes-and-specialists-2', 'brief-responses', 'edit_brief_response')
content_loader.load_manifest('digital-outcomes-and-specialists-2', 'brief-responses', 'display_brief_response')
@main.after_request
def add_cache_control(response):
response.cache_control.no_cache = True
return response
from .views import briefs
from . import errors
| 43.703704 | 116 | 0.817797 | 147 | 1,180 | 6.272109 | 0.244898 | 0.140998 | 0.147505 | 0.21692 | 0.72885 | 0.707158 | 0.707158 | 0.707158 | 0.64859 | 0.64859 | 0 | 0.002705 | 0.060169 | 1,180 | 26 | 117 | 45.384615 | 0.828674 | 0 | 0 | 0 | 0 | 0 | 0.454237 | 0.305932 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0 | 0.222222 | 0 | 0.333333 | 0.111111 | 0 | 0 | 0 | null | 0 | 0 | 1 | 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 | 5 |
f546bc2bc39dbde3cac4289ef478ad6455ba6672 | 73 | py | Python | src/core.py | dmontemayor/msipipeline | f567fcc11458afe2afdd8932438e23801bb7d9cf | [
"MIT"
] | null | null | null | src/core.py | dmontemayor/msipipeline | f567fcc11458afe2afdd8932438e23801bb7d9cf | [
"MIT"
] | null | null | null | src/core.py | dmontemayor/msipipeline | f567fcc11458afe2afdd8932438e23801bb7d9cf | [
"MIT"
] | null | null | null | """Core functions"""
def noop():
""" noop function does nothing"""
| 12.166667 | 37 | 0.589041 | 8 | 73 | 5.375 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.205479 | 73 | 5 | 38 | 14.6 | 0.741379 | 0.561644 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | true | 0 | 0 | 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 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 5 |
f552142016fefd19dad03ac47af7c1b180307394 | 112 | py | Python | lbworkflow/__init__.py | wearypossum4770/django-lb-workflow | 8db36c7a8c5cf3aa2492048cad9fbf26d895c8c7 | [
"MIT"
] | 194 | 2017-04-24T15:28:16.000Z | 2021-12-29T03:35:28.000Z | lbworkflow/__init__.py | wearypossum4770/django-lb-workflow | 8db36c7a8c5cf3aa2492048cad9fbf26d895c8c7 | [
"MIT"
] | 17 | 2018-05-31T07:45:42.000Z | 2021-12-16T08:55:44.000Z | lbworkflow/__init__.py | wearypossum4770/django-lb-workflow | 8db36c7a8c5cf3aa2492048cad9fbf26d895c8c7 | [
"MIT"
] | 67 | 2017-05-18T02:28:28.000Z | 2022-01-20T02:05:10.000Z | VERSION = (1, 0, 1, "alpha", 0)
__version__ = "1.0.1"
default_app_config = "lbworkflow.apps.LBWorkflowConfig"
| 18.666667 | 55 | 0.696429 | 16 | 112 | 4.5 | 0.625 | 0.222222 | 0.25 | 0.277778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.072165 | 0.133929 | 112 | 5 | 56 | 22.4 | 0.670103 | 0 | 0 | 0 | 0 | 0 | 0.375 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 5 |
f576096fbbe0cd25ecb154be064adeba1b068cf4 | 175 | py | Python | python/api-examples-source/metric.example3.py | blackary/docs | 5e49a42219f0d09676c7f784cdd51cc8155cf8a2 | [
"Apache-2.0"
] | 12 | 2021-10-15T20:25:24.000Z | 2022-03-05T10:56:55.000Z | docs/api-examples-source/metric.example3.py | linzhou-zhong/streamlit | fde1b548e4bf2d2e5a97b5c3fcf655d43134b342 | [
"Apache-2.0"
] | 148 | 2020-10-19T20:16:32.000Z | 2022-03-31T03:34:25.000Z | docs/api-examples-source/metric.example3.py | linzhou-zhong/streamlit | fde1b548e4bf2d2e5a97b5c3fcf655d43134b342 | [
"Apache-2.0"
] | 33 | 2021-10-29T19:32:53.000Z | 2022-03-31T19:43:47.000Z | import streamlit as st
st.metric(label="Gas price", value=4, delta=-0.5, delta_color="inverse")
st.metric(label="Active developers", value=123, delta=123, delta_color="off")
| 35 | 77 | 0.742857 | 29 | 175 | 4.413793 | 0.655172 | 0.125 | 0.203125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05625 | 0.085714 | 175 | 4 | 78 | 43.75 | 0.74375 | 0 | 0 | 0 | 0 | 0 | 0.205714 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
f57b21e998b7a08f5d69fa2d3715d95eadd72251 | 97 | py | Python | Term2/Session 17/2-request.py | theseana/apondaone | 7cbf3572a86c73220329804fee1f3d03842ae902 | [
"MIT"
] | null | null | null | Term2/Session 17/2-request.py | theseana/apondaone | 7cbf3572a86c73220329804fee1f3d03842ae902 | [
"MIT"
] | null | null | null | Term2/Session 17/2-request.py | theseana/apondaone | 7cbf3572a86c73220329804fee1f3d03842ae902 | [
"MIT"
] | null | null | null | import urllib.request
import re
contents = urllib.request.urlopen("https://www.nytimes.com/")
| 13.857143 | 61 | 0.752577 | 13 | 97 | 5.615385 | 0.769231 | 0.356164 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.103093 | 97 | 6 | 62 | 16.166667 | 0.83908 | 0 | 0 | 0 | 0 | 0 | 0.25 | 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 | 1 | 0 | 0 | 5 |
1956e07d2827bba4b3075ffba4942bb2182a7309 | 145 | py | Python | collections/top_10_word.py | MailG/code_py | c21a27c871c5c42625aadf45d51a0ba325095739 | [
"MIT"
] | null | null | null | collections/top_10_word.py | MailG/code_py | c21a27c871c5c42625aadf45d51a0ba325095739 | [
"MIT"
] | null | null | null | collections/top_10_word.py | MailG/code_py | c21a27c871c5c42625aadf45d51a0ba325095739 | [
"MIT"
] | null | null | null | import re
from collections import Counter
words = re.findall('\w+', open('top_10_word.py').read().lower())
print Counter(words).most_common(10)
| 24.166667 | 64 | 0.737931 | 23 | 145 | 4.521739 | 0.782609 | 0.230769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030303 | 0.089655 | 145 | 5 | 65 | 29 | 0.757576 | 0 | 0 | 0 | 0 | 0 | 0.117241 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.5 | null | null | 0.25 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
1967a1c2ca340413a16db12efd1a714ab962e4ff | 2,652 | py | Python | FibonacciSequence.py | Xzya/CodeAbbeySolutions | 0a37eb246c24c1d74a6ff6c2ccf525444c5e787a | [
"MIT"
] | 2 | 2021-07-25T13:41:48.000Z | 2022-03-02T21:07:39.000Z | FibonacciSequence.py | Xzya/CodeAbbeySolutions | 0a37eb246c24c1d74a6ff6c2ccf525444c5e787a | [
"MIT"
] | null | null | null | FibonacciSequence.py | Xzya/CodeAbbeySolutions | 0a37eb246c24c1d74a6ff6c2ccf525444c5e787a | [
"MIT"
] | 5 | 2015-10-29T16:11:43.000Z | 2022-03-13T12:50:32.000Z | #input
# 20
# 1777930954809416587147660791784794314784432111526800706093789579403138960940165075820050317562202766948028237512
# 5689768398165682472981133878451278523009637608647762675604795738876774718113916506327804992150205611581315356832469416472592015530113139666919895048261416544213718823613767148595520981851577168
# 1593326225701717188334037111425359127138512324945743711294024460075377172985524819472680355872170395569016093752628516876254232560412670420129021724057156769422272151448461996634558399312613
# 668996615388005031531000081241745415306766517246774551964595292186469
# 2830653773025598082345063352442424920351144475210443140761432888315880232178889808908956305371077582723774166955957876499339886412043139544385164571854387045842521
# 897889194859191704881857622613605161659692872156509128465291624947856903121114331700554055405737435019936805984303748490745
# 5789092068864820527338372482892113982249794889765
# 102334155
# 132980473367242282497284673037549604307310746277363901731233717012104672704818538889393037469151708867132489255106919564710136837304160825061948265664510600390158933
# 167889621328187018603839571160601156165718032465198173590271441192035550962902993642892477664171488276167058117358975773751425901845612997090658
# 11111460156937785151929026842503960837766832936
# 187341518601536966291015050946540312701895836604078191803255601777
# 43566776258854844738105
# 10108265416152526419683994794618270268165872518704428380856874159529924875319101159659894110659650591571332238987107046525767189192225493851401061174799065698263103347
# 40232462861844090389128434238541564732364078131780448061576898306103009199405081373822175980623530127985951663375242165249073319332045062588388761317543568249014325104512245165644739010
# 4953967011875066473162524925231604047727791871346061001150551747313593851366517214899257280600
# 3516470258181436632779942061407967017889567600656021732351687343954813226146279635109807764516348660489138275647928031738863616520008909996193084872671097173635385035177795631888400653504011257
# 941390895042587567453271223806288165311401367715034229502159202
# 1645645409178311156114050175340179094658577397657624573049761120640548215334513341070281
# 139423224561697880139724382870407283950070256587697307264108962948325571622863290691557658876222521294125
def find_fib(fib_numbers, num):
while True:
a, b = fib_numbers[-2:]
c = a + b
fib_numbers.append(c)
if num == c:
break
n = int(input())
fib_numbers = [0, 1]
for i in range(0, n):
num = int(input())
if num not in fib_numbers:
find_fib(fib_numbers, num)
print(fib_numbers.index(num), "", end="") | 64.682927 | 195 | 0.924208 | 79 | 2,652 | 30.911392 | 0.607595 | 0.028665 | 0.00819 | 0.013923 | 0.01638 | 0 | 0 | 0 | 0 | 0 | 0 | 0.89232 | 0.047511 | 2,652 | 41 | 196 | 64.682927 | 0.074426 | 0.85822 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0 | 0 | 0.071429 | 0.071429 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
19752dfbcfbe693d07bff2073f771ad4d70fcbac | 115 | py | Python | tests/test_hello_world.py | polkafoundry/brownie-starter-kit | d1d672397ebb5152ecf0ab0485b387b873840d96 | [
"MIT"
] | null | null | null | tests/test_hello_world.py | polkafoundry/brownie-starter-kit | d1d672397ebb5152ecf0ab0485b387b873840d96 | [
"MIT"
] | null | null | null | tests/test_hello_world.py | polkafoundry/brownie-starter-kit | d1d672397ebb5152ecf0ab0485b387b873840d96 | [
"MIT"
] | null | null | null | import pytest
def test_call_get(hello_world):
message = hello_world.get()
assert message == "Hello world"
| 19.166667 | 35 | 0.721739 | 16 | 115 | 4.9375 | 0.625 | 0.379747 | 0.43038 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.182609 | 115 | 5 | 36 | 23 | 0.840426 | 0 | 0 | 0 | 0 | 0 | 0.095652 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
198f29276be3ef07dfeb16f340744978b4905b1e | 258 | py | Python | gencove/command/upload/exceptions.py | mislavcimpersak/gencove-cli | 2ee9204609d4120c013392f892653ebe9f4a8f7e | [
"Apache-2.0"
] | 1 | 2020-04-28T06:31:53.000Z | 2020-04-28T06:31:53.000Z | gencove/command/upload/exceptions.py | mislavcimpersak/gencove-cli | 2ee9204609d4120c013392f892653ebe9f4a8f7e | [
"Apache-2.0"
] | null | null | null | gencove/command/upload/exceptions.py | mislavcimpersak/gencove-cli | 2ee9204609d4120c013392f892653ebe9f4a8f7e | [
"Apache-2.0"
] | 1 | 2021-07-29T08:24:51.000Z | 2021-07-29T08:24:51.000Z | """Upload command exceptions"""
class UploadError(Exception):
"""Upload related error."""
class UploadNotFound(Exception):
"""Upload related error."""
class SampleSheetError(Exception):
"""Error to generate the sample sheet for uploads."""
| 18.428571 | 57 | 0.70155 | 26 | 258 | 6.961538 | 0.653846 | 0.165746 | 0.243094 | 0.298343 | 0.353591 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.158915 | 258 | 13 | 58 | 19.846154 | 0.834101 | 0.453488 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 1 | 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 | 1 | 0 | 0 | 5 |
199082215a42261e3be2cf154a86dc10b7a63dc0 | 208 | py | Python | Algorithm/complement.py | prathamsingh90/Implementation-of-RC5-Algorithm | db51583c8a4fa2de09e54b565dee63324c0cd6f7 | [
"MIT"
] | null | null | null | Algorithm/complement.py | prathamsingh90/Implementation-of-RC5-Algorithm | db51583c8a4fa2de09e54b565dee63324c0cd6f7 | [
"MIT"
] | null | null | null | Algorithm/complement.py | prathamsingh90/Implementation-of-RC5-Algorithm | db51583c8a4fa2de09e54b565dee63324c0cd6f7 | [
"MIT"
] | 3 | 2017-10-27T05:30:32.000Z | 2020-02-16T13:36:26.000Z | w = '10110111111000010101000101100011'
q = '10011110001101110111100110111001'
a = bin(int(w,2))[2:].zfill(32)
b = bin(int(q,2))[2:].zfill(32)
print a,b
l = bin(int(w,2) + int(q,2))[2:].zfill(32)
print l | 29.714286 | 43 | 0.649038 | 36 | 208 | 3.75 | 0.361111 | 0.133333 | 0.155556 | 0.2 | 0.266667 | 0.266667 | 0.266667 | 0 | 0 | 0 | 0 | 0.423077 | 0.125 | 208 | 7 | 44 | 29.714286 | 0.318681 | 0 | 0 | 0 | 0 | 0 | 0.315271 | 0.315271 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.285714 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
19a5d2309db5643138dfaac660c737c6beadf39a | 86 | py | Python | util/website/errors.py | FellowHashbrown/omega-psi-py | 4ea33cdbef15ffaa537f2c9e382de508c58093fc | [
"MIT"
] | 4 | 2018-12-23T08:49:40.000Z | 2021-03-25T16:51:43.000Z | util/website/errors.py | FellowHashbrown/omega-psi-py | 4ea33cdbef15ffaa537f2c9e382de508c58093fc | [
"MIT"
] | 23 | 2020-11-03T17:40:40.000Z | 2022-02-01T17:12:59.000Z | util/website/errors.py | FellowHashbrown/omega-psi-py | 4ea33cdbef15ffaa537f2c9e382de508c58093fc | [
"MIT"
] | 1 | 2019-07-11T23:40:13.000Z | 2019-07-11T23:40:13.000Z | class InvalidJSONException(Exception): pass
class UnmatchedFormatting(Exception): pass | 43 | 43 | 0.872093 | 8 | 86 | 9.375 | 0.625 | 0.346667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05814 | 86 | 2 | 44 | 43 | 0.925926 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 1 | 0 | 0 | 1 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
271422c86030970ee427acd6638f0cd08c866894 | 192 | py | Python | pdbuddy/formatters/__init__.py | emou/pdbuddy | 5708c44803e46d06aca02a0402ebaec0c5ae4634 | [
"MIT"
] | null | null | null | pdbuddy/formatters/__init__.py | emou/pdbuddy | 5708c44803e46d06aca02a0402ebaec0c5ae4634 | [
"MIT"
] | null | null | null | pdbuddy/formatters/__init__.py | emou/pdbuddy | 5708c44803e46d06aca02a0402ebaec0c5ae4634 | [
"MIT"
] | null | null | null | from __future__ import absolute_import
from pdbuddy.formatters.base import BaseFormatter
from pdbuddy.formatters.simple import SimpleFormatter
__all__ = ['BaseFormatter', 'SimpleFormatter']
| 27.428571 | 53 | 0.84375 | 20 | 192 | 7.65 | 0.55 | 0.143791 | 0.27451 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09375 | 192 | 6 | 54 | 32 | 0.87931 | 0 | 0 | 0 | 0 | 0 | 0.145833 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.75 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
272bfa76e780d34bece8627e1514bb43eb922bd7 | 205 | py | Python | mysiteapp/posts/urls.py | kondoooooo/mysite | b5dd2b6699da55a086a138a76176c97c95a7940a | [
"MIT"
] | null | null | null | mysiteapp/posts/urls.py | kondoooooo/mysite | b5dd2b6699da55a086a138a76176c97c95a7940a | [
"MIT"
] | null | null | null | mysiteapp/posts/urls.py | kondoooooo/mysite | b5dd2b6699da55a086a138a76176c97c95a7940a | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
# views.pyのindexを呼び出して、関数の中を実行する
# urlpatterns = [url ( r'^$', views.index, name='index' )]
urlpatterns = [
path ( '', views.index, name='index' ),
]
| 20.5 | 58 | 0.658537 | 24 | 205 | 5.625 | 0.541667 | 0.148148 | 0.207407 | 0.281481 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.170732 | 205 | 9 | 59 | 22.777778 | 0.794118 | 0.42439 | 0 | 0 | 0 | 0 | 0.043478 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
2740057060731c86901e355e802cfb5f484062ce | 227 | py | Python | FERNLV/__init__.py | otakbeku/FERNLV | 43720d116985bdedbfb8e8b4591c0ca4f04f2054 | [
"MIT"
] | 1 | 2019-10-31T06:43:40.000Z | 2019-10-31T06:43:40.000Z | FERNLV/__init__.py | otakbeku/FERNLV | 43720d116985bdedbfb8e8b4591c0ca4f04f2054 | [
"MIT"
] | null | null | null | FERNLV/__init__.py | otakbeku/FERNLV | 43720d116985bdedbfb8e8b4591c0ca4f04f2054 | [
"MIT"
] | null | null | null | from __future__ import absolute_import
import FERNLV.Camera as Camera
import FERNLV.FaceRecognition as FaceRecognition
import FERNLV.EigenUtils as EigenUtils
import FERNLV.CountPerSec as CountPerSec
import FERNLV.Utils as Utils | 37.833333 | 48 | 0.876652 | 30 | 227 | 6.466667 | 0.366667 | 0.309278 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101322 | 227 | 6 | 49 | 37.833333 | 0.95098 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 5 |
27436c101043734edb9ae38fe58ca6327f69dcc3 | 1,511 | py | Python | app/api/limit_api.py | Ananto30/cap-em | c1241225c69d112bfb88ef6f6f8458da90e4b333 | [
"MIT"
] | 9 | 2020-06-05T11:10:24.000Z | 2022-03-20T13:42:48.000Z | app/api/limit_api.py | Ananto30/cap-em | c1241225c69d112bfb88ef6f6f8458da90e4b333 | [
"MIT"
] | 27 | 2020-05-30T17:53:40.000Z | 2021-07-21T08:40:24.000Z | app/api/limit_api.py | Ananto30/cap-em | c1241225c69d112bfb88ef6f6f8458da90e4b333 | [
"MIT"
] | 19 | 2020-05-31T06:09:01.000Z | 2022-03-24T00:12:36.000Z | from flask_restful import reqparse, Resource
from app.service.limit_service import LimitService
class CheckLimit(Resource):
def __init__(self, **kwargs):
self.limit_service: LimitService = kwargs['limit_service']
@staticmethod
def parse_args():
parser = reqparse.RequestParser()
parser.add_argument('resource_name', type=str, required=True, location='json')
parser.add_argument('access_id', type=str, required=True, location='json')
return parser.parse_args()
def post(self):
args = self.parse_args()
resource_name = args['resource_name'].strip()
access_id = args['access_id'].strip()
has_limit, access_in = self.limit_service.check_limit(resource_name, access_id)
return {
'has_limit': has_limit,
'access_in': access_in
}
class AddUsage(Resource):
def __init__(self, **kwargs):
self.limit_service: LimitService = kwargs['limit_service']
@staticmethod
def parse_args():
parser = reqparse.RequestParser()
parser.add_argument('resource_name', type=str, required=True, location='json')
parser.add_argument('access_id', type=str, required=True, location='json')
return parser.parse_args()
def post(self):
args = self.parse_args()
resource_name = args['resource_name'].strip()
access_id = args['access_id'].strip()
self.limit_service.add_usage(resource_name, access_id)
return
| 29.627451 | 87 | 0.661813 | 177 | 1,511 | 5.367232 | 0.225989 | 0.101053 | 0.067368 | 0.08 | 0.781053 | 0.726316 | 0.726316 | 0.726316 | 0.726316 | 0.726316 | 0 | 0 | 0.221707 | 1,511 | 50 | 88 | 30.22 | 0.807823 | 0 | 0 | 0.685714 | 0 | 0 | 0.097948 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.171429 | false | 0 | 0.057143 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
27c855390cf7620f00cdc5d25d9fef814764cbee | 22,231 | py | Python | mastic/tests/test_selection.py | ADicksonLab/mastic | 58749c40fe364110e3e7be8aa79a89f32d956d09 | [
"MIT"
] | 5 | 2018-01-28T19:53:16.000Z | 2021-02-21T01:53:08.000Z | mastic/tests/test_selection.py | salotz/mast | 58749c40fe364110e3e7be8aa79a89f32d956d09 | [
"MIT"
] | null | null | null | mastic/tests/test_selection.py | salotz/mast | 58749c40fe364110e3e7be8aa79a89f32d956d09 | [
"MIT"
] | 1 | 2021-06-04T05:07:10.000Z | 2021-06-04T05:07:10.000Z | import doctest
import unittest
import numpy as np
import numpy.testing as npt
from mast import selection
import mast.selection as mastsel
class TestSelectionMember(unittest.TestCase):
def setUp(self):
self.member = 'a'
self.selection_member = mastsel.SelectionMember(self.member)
def tearDown(self):
pass
def test_constructor(self):
pass
def test_member(self):
self.assertEqual(self.selection_member.member, self.member)
def test_unselected_registry(self):
self.assertEqual(self.selection_member.registry, [])
def test_repr(self):
pass
def test_get_selections(self):
sel0 = mastsel.Selection([self.selection_member], [0])
sel1 = mastsel.Selection([self.selection_member], [0], flags=['other_selection'])
sel2 = mastsel.IndexedSelection([self.selection_member], [0])
meta_sel = mastsel.Selection([sel0, sel1, sel2], [0],
flags=['meta-selection'])
meta_meta_sel = mastsel.Selection([meta_sel], [0],
flags=['meta-meta-selection'])
sel_list = mastsel.SelectionsList([sel0, sel1, sel2], flags=['list-selection'])
meta_sel_list = mastsel.Selection(sel_list, [0], flags=['meta-list-selection'])
self.selection_member.get_selections(flags=['other_selection'], level=0)
# level 0
self.assertIn(sel0, self.selection_member.get_selections(level=0))
self.assertIn(sel1, self.selection_member.get_selections(level=0))
self.assertIn(sel2, self.selection_member.get_selections(level=0))
self.assertNotIn(meta_sel, self.selection_member.get_selections(level=0))
self.assertNotIn(meta_meta_sel, self.selection_member.get_selections(level=0))
self.assertNotIn(sel_list, self.selection_member.get_selections(level=0))
self.assertNotIn(meta_sel_list, self.selection_member.get_selections(level=0))
# level 1
self.assertIn(sel0, self.selection_member.get_selections(level=1))
self.assertIn(sel1, self.selection_member.get_selections(level=1))
self.assertIn(sel2, self.selection_member.get_selections(level=1))
self.assertIn(meta_sel, self.selection_member.get_selections(level=1))
self.assertNotIn(meta_meta_sel, self.selection_member.get_selections(level=1))
self.assertIn(sel_list, self.selection_member.get_selections(level=1))
self.assertIn(meta_sel_list, self.selection_member.get_selections(level=1))
# level 2
self.assertIn(sel0, self.selection_member.get_selections(level=2))
self.assertIn(sel1, self.selection_member.get_selections(level=2))
self.assertIn(sel2, self.selection_member.get_selections(level=2))
self.assertIn(meta_sel, self.selection_member.get_selections(level=2))
self.assertIn(meta_meta_sel, self.selection_member.get_selections(level=2))
self.assertIn(sel_list, self.selection_member.get_selections(level=2))
self.assertIn(meta_sel_list, self.selection_member.get_selections(level=2))
# recursive
# explicit syntax
self.assertIn(sel0, self.selection_member.get_selections(level=None))
self.assertIn(sel1, self.selection_member.get_selections(level=None))
self.assertIn(sel2, self.selection_member.get_selections(level=None))
self.assertIn(meta_sel, self.selection_member.get_selections(level=None))
self.assertIn(meta_meta_sel, self.selection_member.get_selections(level=None))
self.assertIn(sel_list, self.selection_member.get_selections(level=None))
self.assertIn(meta_sel_list, self.selection_member.get_selections(level=None))
# implicit syntax
self.assertIn(sel0, self.selection_member.get_selections())
self.assertIn(sel1, self.selection_member.get_selections())
self.assertIn(sel2, self.selection_member.get_selections())
self.assertIn(meta_sel, self.selection_member.get_selections())
self.assertIn(meta_meta_sel, self.selection_member.get_selections())
self.assertIn(sel_list, self.selection_member.get_selections())
self.assertIn(meta_sel_list, self.selection_member.get_selections())
# with selection criteria
# level 0 only Selections
self.assertIn(sel0,
self.selection_member.get_selections(
selection_types=[mastsel.Selection],
level=0))
self.assertIn(sel1,
self.selection_member.get_selections(
selection_types=[mastsel.Selection],
level=0))
self.assertNotIn(sel2,
self.selection_member.get_selections(
selection_types=[mastsel.Selection],
level=0))
self.assertNotIn(meta_sel,
self.selection_member.get_selections(
selection_types=[mastsel.Selection],
level=0))
self.assertNotIn(meta_meta_sel,
self.selection_member.get_selections(
selection_types=[mastsel.Selection],
level=0))
self.assertNotIn(sel_list,
self.selection_member.get_selections(
selection_types=[mastsel.Selection],
level=0))
self.assertNotIn(meta_sel_list,
self.selection_member.get_selections(
selection_types=[mastsel.Selection],
level=0))
# level 0 only IndexedSelection
self.assertNotIn(sel0,
self.selection_member.get_selections(
selection_types=[mastsel.IndexedSelection],
level=0))
self.assertNotIn(sel1,
self.selection_member.get_selections(
selection_types=[mastsel.IndexedSelection],
level=0))
self.assertIn(sel2,
self.selection_member.get_selections(
selection_types=[mastsel.IndexedSelection],
level=0))
self.assertNotIn(meta_sel,
self.selection_member.get_selections(
selection_types=[mastsel.IndexedSelection],
level=0))
self.assertNotIn(meta_meta_sel,
self.selection_member.get_selections(
selection_types=[mastsel.IndexedSelection],
level=0))
self.assertNotIn(sel_list,
self.selection_member.get_selections(
selection_types=[mastsel.IndexedSelection],
level=0))
self.assertNotIn(meta_sel_list,
self.selection_member.get_selections(
selection_types=[mastsel.IndexedSelection],
level=0))
# level 0 only 'other_selection' flag
# Don't know why this fails
# self.assertNotIn(sel0,
# self.selection_member.get_selections(
# flags=['other_selection'],
# level=0))
self.assertIn(sel1,
self.selection_member.get_selections(
flags=['other_selection'],
level=0))
self.assertNotIn(sel2,
self.selection_member.get_selections(
flags=['other_selection'],
level=0))
self.assertNotIn(meta_sel,
self.selection_member.get_selections(
flags=['other_selection'],
level=0))
self.assertNotIn(meta_meta_sel,
self.selection_member.get_selections(
flags=['other_selection'],
level=0))
self.assertNotIn(sel_list,
self.selection_member.get_selections(
flags=['other_selection'],
level=0))
self.assertNotIn(meta_sel_list,
self.selection_member.get_selections(
flags=['other_selection'],
level=0))
# recursive only Selections
self.assertIn(sel0,
self.selection_member.get_selections(
selection_types=[mastsel.Selection],
level=None))
self.assertIn(sel1,
self.selection_member.get_selections(
selection_types=[mastsel.Selection],
level=None))
self.assertNotIn(sel2,
self.selection_member.get_selections(
selection_types=[mastsel.Selection],
level=None))
self.assertIn(meta_sel,
self.selection_member.get_selections(
selection_types=[mastsel.Selection],
level=None))
self.assertIn(meta_meta_sel,
self.selection_member.get_selections(
selection_types=[mastsel.Selection],
level=None))
self.assertNotIn(sel_list,
self.selection_member.get_selections(
selection_types=[mastsel.Selection],
level=None))
self.assertIn(meta_sel_list,
self.selection_member.get_selections(
selection_types=[mastsel.Selection],
level=None))
# recursive only SelectionsList
self.assertNotIn(sel0,
self.selection_member.get_selections(
selection_types=[mastsel.SelectionsList],
level=None))
self.assertNotIn(sel1,
self.selection_member.get_selections(
selection_types=[mastsel.SelectionsList],
level=None))
self.assertNotIn(sel2,
self.selection_member.get_selections(
selection_types=[mastsel.SelectionsList],
level=None))
self.assertNotIn(meta_sel,
self.selection_member.get_selections(
selection_types=[mastsel.SelectionsList],
level=None))
self.assertNotIn(meta_meta_sel,
self.selection_member.get_selections(
selection_types=[mastsel.SelectionsList],
level=None))
self.assertIn(sel_list,
self.selection_member.get_selections(
selection_types=[mastsel.SelectionsList],
level=None))
self.assertNotIn(meta_sel_list,
self.selection_member.get_selections(
selection_types=[mastsel.SelectionsList],
level=None))
# recursive only 'list-selection' flag
self.assertIn(sel0,
self.selection_member.get_selections(
flags=['list-selection'],
level=None))
self.assertIn(sel1,
self.selection_member.get_selections(
flags=['list-selection'],
level=None))
self.assertIn(sel2,
self.selection_member.get_selections(
flags=['list-selection'],
level=None))
self.assertNotIn(meta_sel,
self.selection_member.get_selections(
flags=['list-selection'],
level=None))
self.assertNotIn(meta_meta_sel,
self.selection_member.get_selections(
flags=['list-selection'],
level=None))
self.assertIn(sel_list,
self.selection_member.get_selections(
flags=['list-selection'],
level=None))
self.assertNotIn(meta_sel_list,
self.selection_member.get_selections(
flags=['list-selection'],
level=None))
# recursive only 'meta-list-selection' flag
self.assertIn(sel0,
self.selection_member.get_selections(
flags=['meta-list-selection'],
level=None))
self.assertNotIn(sel1,
self.selection_member.get_selections(
flags=['meta-list-selection'],
level=None))
self.assertNotIn(sel2,
self.selection_member.get_selections(
flags=['meta-list-selection'],
level=None))
self.assertNotIn(meta_sel,
self.selection_member.get_selections(
flags=['meta-list-selection'],
level=None))
self.assertNotIn(meta_meta_sel,
self.selection_member.get_selections(
flags=['meta-list-selection'],
level=None))
self.asserttIn(sel_list,
self.selection_member.get_selections(
flags=['meta-list-selection'],
level=None))
self.assertIn(meta_sel_list,
self.selection_member.get_selections(
flags=['meta-list-selection'],
level=None))
def test_register_selection(self):
pass
class TestGenericSelection(unittest.TestCase):
def setUp(self):
self.member = 'a'
self.selection_member = mastsel.SelectionMember(self.member)
self.container = [self.selection_member]
self.generic_selection = mastsel.GenericSelection(self.container)
def tearDown(self):
pass
def test_constructor(self):
with self.assertRaises(AssertionError):
mastsel.GenericSelection(['a'])
mastsel.GenericSelection([])
class TestSelection(unittest.TestCase):
def setUp(self):
self.members = ['a', 'b', 'c']
self.selection_members = [mastsel.SelectionMember(sel) for sel in self.members]
self.sel_idxs = [0,2]
self.selection = mastsel.Selection(self.selection_members, self.sel_idxs)
def tearDown(self):
pass
def test_constructor(self):
with self.assertRaises(AssertionError):
mastsel.Selection(self.selection_members, 'a')
mastsel.Selection(self.selection_members, ['a','b'])
mastsel.Selection(self.selection_members, -1)
mastsel.Selection(self.selection_members, [-1,-2])
mastsel.Selection(self.selection_members, [-1,2])
mastsel.Selection(self.selection_members, [])
mastsel.Selection(self.members, [1])
def test_getitem(self):
# the second element is the third from members
self.assertEqual(self.selection[1], self.selection_members[self.sel_idxs[1]])
def test_selection_member_self_retrieval(self):
for sel_memb in self.selection_members:
for key, selection in sel_memb.registry:
self.assertEqual(selection[key], sel_memb)
class TestChainedSelection(unittest.TestCase):
# set up Selection -0-> [Selection -0-> [SelectionMember]]
def setUp(self):
self.members = ['a', 'b', 'c']
self.selection_members = [mastsel.SelectionMember(sel) for sel in self.members]
self.selection = mastsel.Selection(self.selection_members, [0])
self.selection_container = [self.selection]
self.meta_selection = mastsel.Selection(self.selection_container, [0])
def test_chained_registry_assignment(self):
# the first level is in the recursive get
self.assertIn(self.selection, self.selection_members[0].get_selections())
# the first level is in the level=0 get
self.assertIn(self.selection, self.selection_members[0].get_selections(level=0))
# specifying too many levels is ignored silently
self.assertIn(self.selection, self.selection_members[0].get_selections(level=3))
# the second level selection is in the recursive get
self.assertIn(self.meta_selection, self.selection_members[0].get_selections())
# the second level selection is not in the level=0 get
self.assertNotIn(self.meta_selection, self.selection_members[0].get_selections(level=0))
# the second level selection is in the level=1 get
self.assertIn(self.meta_selection, self.selection_members[0].get_selections(level=1))
for unselected_member in self.selection_members[1:]:
# neither selection is in any other SelectionMember
self.assertEqual(unselected_member.get_selections(), [])
class TestIndexedSelection(unittest.TestCase):
def setUp(self):
self.members = ['a', 'b', 'c']
self.selection_members = [mastsel.SelectionMember(sel) for sel in self.members]
self.selection_idxs = [0, 2]
self.idx_selection = mastsel.IndexedSelection(self.selection_members, self.selection_idxs)
def tearDown(self):
pass
def test_getitem(self):
for idx in self.selection_idxs:
self.assertEqual(self.idx_selection[idx], self.selection_members[idx])
def test_selection_member_self_retrieval(self):
for sel_memb in self.selection_members:
for key, selection in sel_memb.registry:
self.assertEqual(selection[key], sel_memb)
class TestCoordArray(unittest.TestCase):
def setUp(self):
self.array = np.array([[0,0,0], [1,1,1], [2,2,2]])
self.coords = mastsel.CoordArray(self.array)
self.new_coord = np.array([3,3,3])
def test_add_coord(self):
target_array = np.array([[0,0,0], [1,1,1], [2,2,2], [3,3,3]])
self.assertEqual(self.coords.add_coord(self.new_coord), 3)
npt.assert_equal(self.coords.coords, target_array)
with self.assertRaises(AssertionError):
self.coords.add_coord(np.array([4,4,4,4]))
self.coords.add_coord(np.array([2,2]))
self.coords.add_coord(np.array([]))
self.coords.add_coord([])
self.coords.add_coord({'a', 1})
def test_coord_setter(self):
with self.assertRaises(AssertionError):
self.coords.add_coord([])
self.coords.add_coord({'a', 1})
class TestCoordArraySelection(unittest.TestCase):
def setUp(self):
self.array = np.array([[0,0,0], [1,1,1], [2,2,2]])
self.coords = mastsel.CoordArray(self.array)
self.sel_idxs = [0,2]
self.coord_selection = mastsel.CoordArraySelection(self.coords, self.sel_idxs)
def tearDown(self):
pass
def test_constructor(self):
with self.assertRaises(AssertionError):
mastsel.CoordArraySelection(self.coords, 'a')
mastsel.CoordArraySelection(self.coords, ['a','b'])
mastsel.CoordArraySelection(self.coords, -1)
mastsel.CoordArraySelection(self.coords, [-1,-2])
mastsel.CoordArraySelection(self.coords, [-1,2])
mastsel.CoordArraySelection(self.coords, [])
mastsel.CoordArraySelection({}, [1])
def test_getitem(self):
for i, idx in enumerate(self.sel_idxs):
npt.assert_equal(self.coord_selection.container[idx], self.array[idx])
npt.assert_equal(self.coord_selection.data[i], self.array[idx])
npt.assert_equal(self.coord_selection[i], self.array[idx])
def test_coords(self):
target_coords = np.array([[0,0,0], [2,2,2]])
npt.assert_equal(target_coords, self.coord_selection.coords)
class TestPoint(unittest.TestCase):
def setUp(self):
self.point1_coord = np.array([0,1,0])
self.point1 = mastsel.Point(self.point1_coord)
self.array = np.array([[0,0,0], [1,1,1], [2,2,2]])
self.coord_array = mastsel.CoordArray(self.array)
self.point2_coord = self.coord_array[0]
self.point2 = mastsel.Point(self.point2_coord)
self.point3_coord = np.array([0,1,0])
self.point3 = mastsel.Point(self.point3_coord)
self.bad_point_2d = mastsel.CoordArray(np.array([0,1]))
self.bad_point_4d = mastsel.CoordArray(np.array([0,1,2,3]))
def tearDown(self):
pass
def test_constructor(self):
with self.assertRaises(AssertionError):
# wrong dimension points
mastsel.Point(self.bad_point_2d)
mastsel.Point(self.bad_point_4d)
# from existing CoordArray
mastsel.Point(coord_array=np.array([1,2,3]))
mastsel.Point(coord_array=self.coord_array, array_idx=3)
mastsel.Point(coord_array=self.coord_array, array_idx='b')
def test_overlaps(self):
self.assertFalse(self.point1.overlaps(self.point2))
self.assertTrue(self.point1.overlaps(self.point3))
with self.assertRaises(AssertionError):
self.point1.overlaps(np.array([0,1,0]))
self.point1.overlaps([0,1,0])
class TestSelectionType(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
class TestSelectionTypeLibrary(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
if __name__ == "__main__":
from mast import selection
# doctests
print("\n\n\n Doc Tests\n-----------")
nfail, ntests = doctest.testmod(selection, verbose=True)
# unit tests
print("\n\n\n Unit Tests\n-----------")
unittest.main()
| 42.834297 | 97 | 0.588503 | 2,311 | 22,231 | 5.470792 | 0.066205 | 0.131614 | 0.139761 | 0.147908 | 0.800601 | 0.765799 | 0.723721 | 0.705371 | 0.685755 | 0.635134 | 0 | 0.015455 | 0.310197 | 22,231 | 518 | 98 | 42.916988 | 0.808999 | 0.044352 | 0 | 0.644068 | 0 | 0 | 0.023807 | 0 | 0 | 0 | 0 | 0 | 0.268765 | 1 | 0.09201 | false | 0.031477 | 0.016949 | 0 | 0.133172 | 0.004843 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 5 |
27ea6de006bf921090c95a029566bffc31fafebf | 46 | py | Python | Bots/Consulado/check_consulado.py | victorathanasio/Personal-projects | 94c870179cec32aa733a612a6faeb047df16d977 | [
"MIT"
] | null | null | null | Bots/Consulado/check_consulado.py | victorathanasio/Personal-projects | 94c870179cec32aa733a612a6faeb047df16d977 | [
"MIT"
] | null | null | null | Bots/Consulado/check_consulado.py | victorathanasio/Personal-projects | 94c870179cec32aa733a612a6faeb047df16d977 | [
"MIT"
] | null | null | null | from program import *
check_mudanca()
| 7.666667 | 22 | 0.652174 | 5 | 46 | 5.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.282609 | 46 | 5 | 23 | 9.2 | 0.878788 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
fd934d2d052a596fdd403c25bf5821122aaf9d15 | 107 | py | Python | befunge/__init__.py | malloc47/befunge.py | 6bf3f5f667200c1d4f4a389c3c1e82780743db2c | [
"FSFAP"
] | 1 | 2015-09-23T20:43:44.000Z | 2015-09-23T20:43:44.000Z | befunge/__init__.py | malloc47/befunge.py | 6bf3f5f667200c1d4f4a389c3c1e82780743db2c | [
"FSFAP"
] | null | null | null | befunge/__init__.py | malloc47/befunge.py | 6bf3f5f667200c1d4f4a389c3c1e82780743db2c | [
"FSFAP"
] | null | null | null | from befunge.interpreter import run
from befunge.state import State
from befunge.board import BefungeBoard
| 26.75 | 38 | 0.859813 | 15 | 107 | 6.133333 | 0.533333 | 0.358696 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.11215 | 107 | 3 | 39 | 35.666667 | 0.968421 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
fd97c9a805ec0596db35cfc8b5a0a326745a6936 | 65 | py | Python | _src/om2pyItem/scaffold/templates/__init__.py | s32n/OMOOC2py | 33441de0b24cab1615b1a6cd7c83a7f769f781a3 | [
"MIT"
] | 95 | 2015-10-06T15:01:04.000Z | 2017-04-12T09:37:35.000Z | _src/om2pyItem/scaffold/templates/__init__.py | s32n/OMOOC2py | 33441de0b24cab1615b1a6cd7c83a7f769f781a3 | [
"MIT"
] | 117 | 2015-10-05T13:11:47.000Z | 2017-01-21T13:04:18.000Z | _src/om2pyItem/scaffold/templates/__init__.py | s32n/OMOOC2py | 33441de0b24cab1615b1a6cd7c83a7f769f781a3 | [
"MIT"
] | 180 | 2015-10-06T01:39:31.000Z | 2017-04-28T03:52:21.000Z | # -*- coding: utf-8 -*-
import sys
#sys.path.append("..")
| 10.833333 | 24 | 0.492308 | 8 | 65 | 4 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02 | 0.230769 | 65 | 5 | 25 | 13 | 0.62 | 0.646154 | 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 | 1 | 0 | 0 | 5 |
8bf41a821d3d6672d1869a02aee3f0849fb8a2eb | 150 | py | Python | sm4.py | Preeti-Barua/Python | 76d168617f2a92fa41d6af4ddf62450b6272ff84 | [
"bzip2-1.0.6"
] | null | null | null | sm4.py | Preeti-Barua/Python | 76d168617f2a92fa41d6af4ddf62450b6272ff84 | [
"bzip2-1.0.6"
] | null | null | null | sm4.py | Preeti-Barua/Python | 76d168617f2a92fa41d6af4ddf62450b6272ff84 | [
"bzip2-1.0.6"
] | null | null | null |
a="qwerty"
print (a[ 0:3])
print(a[::2])
print(a[2:4])
print(a[-5:-1])
print(a[-1:-4])
print(a[::])
print(a[-6:-1])
print(a[-1:-4])
print(a[-6:-1])
| 11.538462 | 15 | 0.506667 | 35 | 150 | 2.171429 | 0.285714 | 0.710526 | 0.276316 | 0.210526 | 0.394737 | 0.394737 | 0.394737 | 0 | 0 | 0 | 0 | 0.110294 | 0.093333 | 150 | 12 | 16 | 12.5 | 0.448529 | 0 | 0 | 0.4 | 0 | 0 | 0.040541 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.9 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
e31b086b5cbf63ffbf97c18392a223a4cda4b722 | 28 | py | Python | test_ukz/test_midi/__init__.py | clauderichard/Ultrakazoid | 619f1afd1fd55afb06e7d27b2bc30eee9929f660 | [
"MIT"
] | null | null | null | test_ukz/test_midi/__init__.py | clauderichard/Ultrakazoid | 619f1afd1fd55afb06e7d27b2bc30eee9929f660 | [
"MIT"
] | null | null | null | test_ukz/test_midi/__init__.py | clauderichard/Ultrakazoid | 619f1afd1fd55afb06e7d27b2bc30eee9929f660 | [
"MIT"
] | null | null | null | from .test_byteutil import * | 28 | 28 | 0.821429 | 4 | 28 | 5.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.107143 | 28 | 1 | 28 | 28 | 0.88 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
e348debcffa1c942dd6bf4279358fb7bd92ed526 | 81 | py | Python | plots/__init__.py | kuntzer/binfind | 28f9cf9474e6b39a55a1a22d19ca8131a0408c84 | [
"MIT"
] | null | null | null | plots/__init__.py | kuntzer/binfind | 28f9cf9474e6b39a55a1a22d19ca8131a0408c84 | [
"MIT"
] | null | null | null | plots/__init__.py | kuntzer/binfind | 28f9cf9474e6b39a55a1a22d19ca8131a0408c84 | [
"MIT"
] | null | null | null | from roc import roc
from hist import hist
from bar import errorbar
import figures | 20.25 | 24 | 0.839506 | 14 | 81 | 4.857143 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.160494 | 81 | 4 | 25 | 20.25 | 1 | 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 | 1 | 0 | 0 | 5 |
e369c8fc4ff6d108f079d26d2e3b496add4ad379 | 110 | py | Python | novel.py | ILS-Z399/03-branching-plot-novel | a6d06cfc1d7281dcc0a95a8d81db40ad924c87e6 | [
"MIT"
] | null | null | null | novel.py | ILS-Z399/03-branching-plot-novel | a6d06cfc1d7281dcc0a95a8d81db40ad924c87e6 | [
"MIT"
] | null | null | null | novel.py | ILS-Z399/03-branching-plot-novel | a6d06cfc1d7281dcc0a95a8d81db40ad924c87e6 | [
"MIT"
] | 17 | 2017-09-13T13:48:02.000Z | 2018-02-10T22:23:41.000Z | #!/usr/bin/python3
import sys
assert sys.version_info >= (3,4), 'This script requires at least Python 3.4'
| 15.714286 | 76 | 0.709091 | 19 | 110 | 4.052632 | 0.842105 | 0.051948 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.053763 | 0.154545 | 110 | 6 | 77 | 18.333333 | 0.774194 | 0.154545 | 0 | 0 | 0 | 0 | 0.43956 | 0 | 0 | 0 | 0 | 0 | 0.5 | 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 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
8b8a9f73473e5b53cf76e9e1060787d907407343 | 386 | py | Python | sgi/tests.py | jorgevilaca82/SGI | c3f13d9e3e8f04377d9e23636dc8e35ed5ace35a | [
"MIT"
] | null | null | null | sgi/tests.py | jorgevilaca82/SGI | c3f13d9e3e8f04377d9e23636dc8e35ed5ace35a | [
"MIT"
] | 8 | 2019-12-07T13:13:34.000Z | 2021-09-02T03:07:25.000Z | sgi/tests.py | jorgevilaca82/SGI | c3f13d9e3e8f04377d9e23636dc8e35ed5ace35a | [
"MIT"
] | null | null | null | from django.contrib.staticfiles import finders
from django.contrib.staticfiles.storage import staticfiles_storage
from django.test import TestCase
class StaticFilesTest(TestCase):
pass
# ainda não funciona
# def test_static_exists_at_desired_location(self):
# absolute_path = finders.find('img/sapo.jpg')
# assert staticfiles_storage.exists(absolute_path)
| 32.166667 | 66 | 0.777202 | 47 | 386 | 6.191489 | 0.617021 | 0.103093 | 0.116838 | 0.19244 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15285 | 386 | 11 | 67 | 35.090909 | 0.889908 | 0.440415 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.2 | 0.6 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 5 |
8b8f33796a0e21b97dd343c4abaee9ae41e08818 | 88 | py | Python | leveltwo/maze/hexagonal/__init__.py | LilianBoulard/LevelTwo | 23013a53100875d77dfae99494d2ef415d12b0df | [
"MIT"
] | 1 | 2021-05-03T08:21:36.000Z | 2021-05-03T08:21:36.000Z | leveltwo/maze/hexagonal/__init__.py | LilianBoulard/LevelTwo | 23013a53100875d77dfae99494d2ef415d12b0df | [
"MIT"
] | 2 | 2021-05-06T08:37:10.000Z | 2021-05-06T14:08:46.000Z | leveltwo/maze/hexagonal/__init__.py | LilianBoulard/LevelTwo | 23013a53100875d77dfae99494d2ef415d12b0df | [
"MIT"
] | null | null | null | from .editable import MazeEditableHexagonal
from .playable import MazePlayableHexagonal
| 29.333333 | 43 | 0.886364 | 8 | 88 | 9.75 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 88 | 2 | 44 | 44 | 0.975 | 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 | 1 | 0 | 0 | 5 |
8bc0cd7d4b260a90c5719b1569bee010b0962496 | 1,073 | py | Python | optimization/__init__.py | fberanizo/sin5006 | 96f7980b5ff61bd4af7852c9d733521edde540eb | [
"BSD-2-Clause"
] | null | null | null | optimization/__init__.py | fberanizo/sin5006 | 96f7980b5ff61bd4af7852c9d733521edde540eb | [
"BSD-2-Clause"
] | null | null | null | optimization/__init__.py | fberanizo/sin5006 | 96f7980b5ff61bd4af7852c9d733521edde540eb | [
"BSD-2-Clause"
] | null | null | null | from fitness_evaluator import RastriginFloatFitnessEvaluator
from fitness_evaluator import RastriginBinaryFitnessEvaluator
from fitness_evaluator import XSquareFloatFitnessEvaluator
from fitness_evaluator import XSquareBinaryFitnessEvaluator
from fitness_evaluator import XAbsoluteSquareFloatFitnessEvaluator
from fitness_evaluator import XAbsoluteSquareBinaryFitnessEvaluator
from fitness_evaluator import SineXSquareRootFloatFitnessEvaluator
from fitness_evaluator import SineXSquareRootBinaryFitnessEvaluator
from individual import Individual
from individual_factory import RastriginFloatIndividualFactory
from individual_factory import RastriginBinaryIndividualFactory
from individual_factory import XSquareFloatIndividualFactory
from individual_factory import XSquareBinaryIndividualFactory
from individual_factory import XAbsoluteSquareFloatIndividualFactory
from individual_factory import XAbsoluteSquareBinaryIndividualFactory
from individual_factory import SineXSquareRootFloatIndividualFactory
from individual_factory import SineXSquareRootBinaryIndividualFactory | 63.117647 | 69 | 0.937558 | 84 | 1,073 | 11.785714 | 0.261905 | 0.127273 | 0.161616 | 0.210101 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.062442 | 1,073 | 17 | 70 | 63.117647 | 0.984095 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
4734d9cae5077679d95f3ef88b1e620f5c8e8cc7 | 87 | py | Python | test/e2e/test_zip_download.py | ImageMarkup/isic-archive | 7cd8097886d685ec629e2fcba079271fb77d028f | [
"Apache-2.0"
] | 42 | 2015-12-12T14:05:46.000Z | 2022-03-26T15:20:39.000Z | test/e2e/test_zip_download.py | ImageMarkup/isic-archive | 7cd8097886d685ec629e2fcba079271fb77d028f | [
"Apache-2.0"
] | 494 | 2015-07-09T16:14:12.000Z | 2021-03-09T09:37:36.000Z | test/e2e/test_zip_download.py | ImageMarkup/uda | d221af3368baf3a06ecab67e69e9d0077426c8f9 | [
"Apache-2.0"
] | 12 | 2015-08-20T14:20:48.000Z | 2020-10-20T01:14:44.000Z | import pytest
@pytest.mark.skip('not implemented')
def test_zip_download():
pass
| 12.428571 | 36 | 0.735632 | 12 | 87 | 5.166667 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.149425 | 87 | 6 | 37 | 14.5 | 0.837838 | 0 | 0 | 0 | 0 | 0 | 0.172414 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
476f65b37cd34f246843f1436d04317a627eb417 | 171 | py | Python | deeplearning_examples/loaders/__init__.py | dileep-kishore/deeplearning-examples | 2b230ea17f366f602044d44cc8abcac419d4e521 | [
"MIT"
] | null | null | null | deeplearning_examples/loaders/__init__.py | dileep-kishore/deeplearning-examples | 2b230ea17f366f602044d44cc8abcac419d4e521 | [
"MIT"
] | 321 | 2017-11-23T20:37:03.000Z | 2020-12-28T13:06:15.000Z | deeplearning_examples/loaders/__init__.py | dileep-kishore/deeplearning-examples | 2b230ea17f366f602044d44cc8abcac419d4e521 | [
"MIT"
] | null | null | null | import os
BASEPATH = os.path.dirname(__file__).rsplit('/', 1)[0]
DATAPATH = os.path.join(BASEPATH, 'data')
def datapath():
return DATAPATH
from .Churn import Churn
| 17.1 | 54 | 0.701754 | 24 | 171 | 4.833333 | 0.666667 | 0.103448 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013699 | 0.146199 | 171 | 9 | 55 | 19 | 0.780822 | 0 | 0 | 0 | 0 | 0 | 0.02924 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0.166667 | 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 | 1 | 1 | 0 | 0 | 5 |
477c1e50a3dc10f1991cbbf405515e65a248a4f2 | 65 | py | Python | dreamerv2/__init__.py | magamba/dreamerv2 | ad7d54e256a03378bfd483e8a4c389ab2b444078 | [
"MIT"
] | 97 | 2021-07-08T07:05:22.000Z | 2022-03-29T11:47:49.000Z | dreamerv2/__init__.py | magamba/dreamerv2 | ad7d54e256a03378bfd483e8a4c389ab2b444078 | [
"MIT"
] | 2 | 2021-09-01T09:37:07.000Z | 2022-01-28T15:59:54.000Z | dreamerv2/__init__.py | magamba/dreamerv2 | ad7d54e256a03378bfd483e8a4c389ab2b444078 | [
"MIT"
] | 14 | 2021-07-08T07:51:47.000Z | 2022-03-30T14:58:54.000Z | from . import models
from . import training
from . import utils
| 13 | 22 | 0.753846 | 9 | 65 | 5.444444 | 0.555556 | 0.612245 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 65 | 4 | 23 | 16.25 | 0.942308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
9a1accad66cc8ca337b5c3a6e20937009406707a | 87,803 | py | Python | postproc/visualise/plotter.py | J-Massey/postproc | 4552b0ad79072f5d217cf62632c08617ea3d2d82 | [
"MIT"
] | null | null | null | postproc/visualise/plotter.py | J-Massey/postproc | 4552b0ad79072f5d217cf62632c08617ea3d2d82 | [
"MIT"
] | null | null | null | postproc/visualise/plotter.py | J-Massey/postproc | 4552b0ad79072f5d217cf62632c08617ea3d2d82 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
@author: B. Font Garcia
@description: Functions to plot 2D colormaps and CL-torch graphs.
@contact: b.fontgarcia@soton.ac.uk
"""
# Imports
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.colors as mpl_colors
import matplotlib.patches as patches
import matplotlib.colorbar as colorbar
from matplotlib.lines import Line2D
import matplotlib.animation as animation
from mpl_toolkits.axes_grid1 import make_axes_locatable
import seaborn as sns
colors = sns.color_palette("husl", 14)
plt.rc('text', usetex=True)
plt.rc('font', family='sans-serif', size=16) # use 13(JFM) or 16(SNH)
mpl.rc('xtick', labelsize=16)
mpl.rc('ytick', labelsize=16)
mpl.rcParams['text.latex.preamble'] = r'\usepackage{amsmath}' # for \text command
plt.rcParams['animation.ffmpeg_path'] = r"/usr/bin/ffmpeg"
mpl.rcParams['axes.linewidth'] = 0.5
plt.switch_backend('AGG') # png
# plt.switch_backend('PS')
# plt.switch_backend('PDF') # pdf
# plt.switch_backend('TkAgg') # GUI
# colors = ['black', 'orange', 'cyan', 'green', 'blue', 'red', 'magenta', 'yellow']
# colors = ['orange', 'cyan', 'green', 'blue', 'red', 'magenta', 'yellow']
markers = ['|', 's', '^', 'v', 'x', 'o', '*']
# markers = ['s', '^', 'v', 'x', 'o', '*']
# Functions
# ------------------------------------------------------
def plot_history(f, t, label, file, title, **kwargs):
"""
Plot the history for the parameters printed to fort.9
:param f: Force [numpy 1D array]
:param t: Time [numpy 1D array]
:param label: Y label
:param file: output fn name [string]
:param title: graph tit
:param kwargs: Select which additional information you want to include in the plot: 'St', 'CL_rms', 'CD_rms', 'n_periods',
passing the corresponding values. E.g. 'St=0.2'.
:return: -
"""
ax = plt.gca()
fig = plt.gcf()
# Show lines
plt.plot(t, f, color='red', lw=1, label=r'$3\mathrm{length_scale}\,\, \mathrm{total}$')
# Set limits
ax.set_xlim(min(t), max(t))
ax.set_ylim(1.3 * min(f), 1.3 * max(f))
# Edit frame, labels and legend
ax.axhline(linewidth=1)
ax.axvline(linewidth=1)
plt.xlabel(r'$torch/length_scale$')
plt.ylabel(label)
plt.title(title)
# leg = plt.legend(loc='upper right')
# leg.get_frame().set_edgecolor('black')
# Annotations
for key, value in kwargs.items():
if key == 'St':
St_str = '{:.2f}'.format(value)
my_str = r'$S_t=' + St_str + '$'
plt.text(x=1.02 * max(t), y=1.4 * max(f), s=my_str, color='black')
if key == 'CL_rms':
CL_rms_str = '{:.2f}'.format(value)
my_str = r'$\overline{C}_L=' + CL_rms_str + '$'
plt.text(x=1.02 * max(t), y=1.2 * max(f), s=my_str, color='black')
if key == 'CD_rms':
CD_rms_str = '{:.2f}'.format(value)
my_str = r'$\overline{C}_D=' + CD_rms_str + '$'
plt.text(x=1.02 * max(t), y=1.0 * max(f), s=my_str, color='black')
if key == 'n_periods':
n_periods = str(value)
my_str = r'$\textrm{periods}=' + n_periods + '$'
plt.text(x=1.02 * max(t), y=0.8 * max(f), s=my_str, color='black')
# Show plot and save figure
plt.savefig(file, transparent=False, bbox_inches='tight')
return
def fully_defined_plot(x, y, file, x_label, y_label, title=None,
colour='black', colours=None, l_label=None, marker=None,
xlim=None, ylim=None):
plt.style.use(['science', 'grid'])
fig, ax = plt.subplots(figsize=(7, 5))
ax.set_title(title)
ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
# Edit frame, labels and legend
ax.set_xlabel(x_label)
ax.set_ylabel(y_label)
if xlim is not None: ax.set_xlim(xlim)
if ylim is not None: ax.set_ylim(ylim)
# Make legend manually
if l_label and colours is not None:
from matplotlib.lines import Line2D
legend_elements = []
for idx, loop in enumerate(l_label):
legend_elements.append(Line2D([0], [0], color=colours[idx], lw=4, label=loop))
ax.legend(handles=legend_elements, loc='lower right')
ax.plot(x, y, color=colour, marker=marker)
plt.savefig(file, bbox_inches='tight', transparent=False)
return
def domain_test_plot(means, var, file, y_label, title=None, doms=None):
plt.style.use(['science', 'grid'])
fig, ax = plt.subplots(figsize=(10, 3))
ax.set_title(title)
n = np.arange(0, len(doms), 1)
ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
# Edit frame, labels and legend
ax.set_ylabel(y_label)
ax.set_xlabel("Domain size")
ax.set_xticks(n)
ax.set_xticklabels(doms)
ax.fill_between(n, 0.95 * means[-1], 1.05 * means[-1], alpha=0.5, color='C1')
# Make legend manually
# if l_label and colours is not None:
from matplotlib.lines import Line2D
legend_elements = [(Line2D([0], [0], color='C1', alpha=0.5, lw=4, label='$\pm 5 \% $ confidence interval'))]
ax.legend(handles=legend_elements, loc='lower right')
ax.scatter(n, means, color='k', marker='*')
ax.errorbar(n, means, yerr=var, capsize=12)
for idx, lab in enumerate(doms):
ax.annotate(f'$\sigma^2 = {var[idx]:.3e}$', (n[idx], means[idx]))
plt.savefig(file, bbox_inches='tight', transparent=False)
return
def plot_2D(u, file='test.pdf', **kwargs):
"""
Return nothing and saves the figure in the specified fn name.
Args:
cmap: matplotlib cmap. Eg: cmap = "seismic"
lvls: number of levels of the contour. Eg: lvls = 100
lim: min and max values of the contour passed as array. Eg: lim = [-0.5, 0.5]
file: Name of the fn to save the plot (recommended .pdf so it can be converted get .svg).
Eg: fn = "dUdy.pdf"
Kwargs:
x=[xmin,xmax] is the x axis minimum and maximum specified
Y=[ymin,ymax] is the Y axis minimum and maximum specified
annotate: Boolean if annotations for min and max values of the field (and locations) are desired
"""
from matplotlib.ticker import FormatStrFormatter, MultipleLocator, FuncFormatter
contour = kwargs.get('contour', False)
contourf = kwargs.get('contourf', True)
levels = kwargs.get('levels', 50)
lim = kwargs.get('lim', [np.min(u), np.max(u)])
cmap = kwargs.get('cmap', 'Blues')
scaling = kwargs.get('scaling', 1)
shift = kwargs.get('shift', (0, 0))
xwindow = kwargs.get('xwindow', None)
ywindow = kwargs.get('ywindow', None)
title = kwargs.get('tit', '')
n_ticks = kwargs.get('n_ticks', 10)
n_decimals = kwargs.get('n_decimals', 2)
case = kwargs.get('case', None)
annotate = kwargs.get('annotate', False)
eps = kwargs.get('eps', 0.0001)
N, M = u.shape[0], u.shape[1]
# Create uniform grid
if 'grid' in kwargs:
grid = kwargs['grid']
x, y = grid[0] / scaling, grid[1] / scaling
elif 'x' in kwargs and 'Y' in kwargs:
x = np.transpose(kwargs.get('x')) / scaling + shift[0]
y = np.transpose(kwargs.get('Y')) / scaling + shift[1]
x, y = np.meshgrid(x, y)
elif 'x_lims' in kwargs and 'y_lims' in kwargs:
xlims = kwargs.get('x_lims')
ylims = kwargs.get('y_lims')
x, y = np.linspace(xlims[0] / scaling, xlims[1] / scaling, N), np.linspace(ylims[0] / scaling,
ylims[1] / scaling, M)
x, y = x + shift[0], y + shift[1]
x, y = np.meshgrid(x, y)
else:
xmin, xmax = 0, N - 1
ymin, ymax = -M / 2, M / 2 - 1
x, y = np.linspace(xmin / scaling, xmax / scaling, N), np.linspace(ymin / scaling, ymax / scaling, M)
x, y = x + shift[0], y + shift[1]
x, y = np.meshgrid(x, y)
# Matplotlib definitions
fig, ax = plt.subplots(1, 1)
# Create contourf given a normalized (norm) colormap (cmap)
if lim[0] < 0 and lim[1] > 0:
ll = np.linspace(-eps, lim[0], int(levels / 2))
rr = np.linspace(lim[1], eps, int(levels / 2))
lvls = np.append(ll, rr)
if contour:
extra_levels = 5
dl = lvls[1] - lvls[0]
clvls = np.append(lvls, np.linspace(lim[1] + dl, lim[1] + extra_levels * dl, extra_levels))
else:
clvls = levels
lvls = np.linspace(lim[0], lim[1], levels + 1)
u = u.torch
if xwindow is not None:
x_args = np.where(np.logical_and(np.any(x > xwindow[0], axis=0), np.any(x < xwindow[1], axis=0)))[0]
x = x[:, x_args]
y = y[:, x_args]
u = u[:, x_args]
if ywindow is not None:
y_args = np.where(np.logical_and(np.any(y > ywindow[0], axis=1), np.any(y < ywindow[1], axis=1)))[0]
x = x[y_args, :]
y = y[y_args, :]
u = u[y_args, :]
if contour:
ax.contour(x, y, u, clvls, linewidths=0.1, colors='k')
if contourf:
cf = ax.contourf(x, y, u, lvls, vmin=lim[0], vmax=lim[1], cmap=cmap, extend='both')
# Format figure
ax.set_aspect(1)
plt.xlim(np.min(x), np.max(x))
plt.ylim(np.min(y), np.max(y))
ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
ax.xaxis.set_zorder(99999)
ax.yaxis.set_zorder(99999)
divider = make_axes_locatable(ax)
if case == 'taylor-green':
ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi))
ax.xaxis.set_major_formatter(plt.FuncFormatter(multiple_formatter()))
ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi))
ax.yaxis.set_major_formatter(plt.FuncFormatter(multiple_formatter()))
ax.xaxis.set_ticks([xlims[0], xlims[1] + xlims[0], xlims[1]])
ax.yaxis.set_ticks([ylims[0], ylims[1] + ylims[0], ylims[1]])
cax = divider.append_axes("right", size="5%", pad=0.15)
elif case == 'circle':
# ax.yaxis.set_ticks([-2, 0, 2])
grey_color = '#dedede'
cyl = patches.Circle((0, 0), 0.5, linewidth=0.2, edgecolor='black', facecolor=grey_color, zorder=9999)
ax.add_patch(cyl)
# cax = divider.append_axes("right", size="5%", pad=0.0, aspect=15)
cax = divider.append_axes("right", size="5%", pad=0.15)
elif case == 'flat_plate':
grey_color = '#dedede'
rec = patches.Rectangle((-0.5, -1 / 91.2), 1, 1 / 45.71, linewidth=0.2,
edgecolor='black', facecolor=grey_color, zorder=9999)
ax.add_patch(rec)
cax = divider.append_axes("right", size="5%", pad=0.15)
# -- Add colorbar
if lim[0] < 0:
tick1 = np.linspace(lim[0], 0, n_ticks / 2)
dl = tick1[1] - tick1[0]
tick2 = np.linspace(dl, lim[1], n_ticks / 2 - 1)
ticks = np.append(tick1, tick2)
else:
ticks = np.linspace(lim[0], lim[1], n_ticks + 1)
# norm = mpl_colors.Normalize(vmin=lim[0], vmax=lim[1])
norm = mpl_colors.Normalize(vmin=np.min(u), vmax=np.max(u))
cbar = fig.colorbar(cf, cax=cax, extend='both', ticks=ticks, norm=norm)
fmt_str = r'${:.' + str(n_decimals) + 'f}$'
cbar.ax.set_yticklabels([fmt_str.format(t) for t in ticks])
cbar.ax.yaxis.set_tick_params(pad=5, direction='out', size=1) # your number may vary
cbar.ax.set_title(title, x=1, y=1.02, loc='left', size=12)
# Add annotation if desired
if annotate:
str_annotation = max_min_loc(u, x, y)
# print(str_annotation)
ann_ax = fig.add_subplot(133)
ann_ax.axis('off')
ann_ax.annotate(str_annotation, (0, 0),
xycoords="axes fraction", va="center", ha="center",
bbox=dict(boxstyle="round, pad=1", fc="w"))
# Show, save and close figure
plt.savefig(file, transparent=True, bbox_inches='tight')
# plt.draw()
# plt.clf()
return
def animate_2Dx2(a, b, file, **kwargs):
plt.rc('font', size=9)
mpl.rc('xtick', labelsize=9)
mpl.rc('ytick', labelsize=9)
global c1, c2, cf1, cf2, cf
def anim(i):
global c1, c2, cf1, cf2, cf
for c in cf1.collections:
c.remove() # removes only the contours, leaves the rest intact
for c in cf2.collections:
c.remove() # removes only the contours, leaves the rest intact
for c in c1.collections:
c.remove() # removes only the contours, leaves the rest intact
for c in c2.collections:
c.remove() # removes only the contours, leaves the rest intact
c1 = ax1.contour(x.T, y.T, a[i].torch, clvls, linewidths=0.05, colors='k')
c2 = ax2.contour(x.T, y.T, b[i].torch, clvls, linewidths=0.05, colors='k')
cf1 = ax1.contourf(x.T, y.T, a[i].torch, levels, vmin=lim[0], vmax=lim[1], norm=norm, cmap=cmap, extend='both')
cf2 = ax2.contourf(x.T, y.T, b[i].torch, levels, vmin=lim[0], vmax=lim[1], norm=norm, cmap=cmap, extend='both')
title = r'$torch = ' + '{:.2f}'.format(time[i]) + '$'
ax1.set_title(title, size=12, y=1.03)
return [c1, c2, cf1, cf2]
k = len(a) # Number of snapshots
print(k)
time = kwargs.get('time', np.arange(k))
levels = kwargs.get('levels', 50)
lim = kwargs.get('lim', [np.min(a[0]), np.max(a[0])])
cmap = kwargs.get('cmap', 'Blues')
scaling = kwargs.get('scaling', 1)
xshift = kwargs.get('xshift', 0)
yshift = kwargs.get('yshift', 0)
field_name = kwargs.get('field_name', '')
n_ticks = kwargs.get('n_ticks', 20)
n_decimals = kwargs.get('n_decimals', 2)
fps = kwargs.get('fps', 10)
dpi = kwargs.get('dpi', 300)
N, M = a[0].shape[0], a[0].shape[1]
# Create uniform grid
if 'grid' in kwargs:
grid = kwargs['grid']
x, y = grid[0] / scaling, grid[1] / scaling
elif 'x' in kwargs and 'Y' in kwargs:
x = np.transpose(kwargs.get('x')) / scaling + xshift
y = np.transpose(kwargs.get('Y')) / scaling + yshift
x, y = np.meshgrid(x, y)
else:
xmin, xmax = 0, N - 1
ymin, ymax = -M / 2, M / 2 - 1
x, y = np.linspace(xmin / scaling, xmax / scaling, N), np.linspace(ymin / scaling, ymax / scaling, M)
x, y = x + xshift, y + yshift
x, y = np.meshgrid(x, y)
fig, ax = plt.subplots(2, 1)
ax1, ax2 = ax[0], ax[1]
if lim[0] < 0:
clvls = levels
else:
extra_levels = 5
dl = levels[1] - levels[0]
clvls = np.append(levels, np.linspace(lim[1] + dl, lim[1] + extra_levels * dl, extra_levels))
norm = mpl_colors.Normalize(vmin=lim[0], vmax=lim[1])
c1 = ax1.contour(x.T, y.T, a[0].torch, clvls, linewidths=0.05, colors='k')
c2 = ax2.contour(x.T, y.T, b[0].torch, clvls, linewidths=0.05, colors='k')
cf1 = ax1.contourf(x.T, y.T, a[0].torch, levels, vmin=lim[0], vmax=lim[1], norm=norm, cmap=cmap, extend='both')
cf2 = ax2.contourf(x.T, y.T, b[0].torch, levels, vmin=lim[0], vmax=lim[1], norm=norm, cmap=cmap, extend='both')
cf = [c1, c2, cf1, cf2]
# Format figure
ax1.tick_params(bottom="on", top="on", right="on", which='both', direction='in', labelbottom='off', length=2)
ax1.set_xticklabels([])
ax2.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
ax1.set_aspect(1)
ax2.set_aspect(1)
plt.xlim(np.min(x), np.max(x))
plt.ylim(np.min(y), np.max(y))
ax1.yaxis.set_ticks([-2, 0, 2])
ax2.yaxis.set_ticks([-2, 0, 2])
# Set tit, circles and text
title = r'$torch = ' + '{:.2f}'.format(time[0]) + '$'
ax1.set_title(title, size=12, y=1.05)
grey_color = '#dedede'
cyl1 = patches.Circle((0, 0), 0.5, linewidth=0.2, edgecolor='black', facecolor=grey_color, zorder=9999)
cyl2 = patches.Circle((0, 0), 0.5, linewidth=0.2, edgecolor='black', facecolor=grey_color, zorder=9999)
ax1.add_patch(cyl1)
ax2.add_patch(cyl2)
plt.subplots_adjust(hspace=0.05, bottom=0.15)
ax1.text(-1, 2.3, r'$2{\text -}\mathrm{length_scale}$')
ax2.text(-1, 2.3, r'$L_z=\pi$')
# Add colorbar
# if lim[0] < 0:
# tick1 = np.linspace(lim[0], 0, n_ticks / 2)
# dl = tick1[1] - tick1[0]
# tick2 = np.linspace(dl, lim[1], n_ticks / 2 - 1)
# ticks = np.append(tick1, tick2)
# else:
# ticks = np.linspace(lim[0], lim[1], n_ticks + 1)
# cbar_ax = plt.colorbar(cf2, ax=[ax1, ax2], extend='both', norm=norm).ax
# cbar_ax.set_title(field_name, Y=1.02, loc='left', size=12)
# fmt_str = r'${:.' + str(n_decimals) + 'f}$'
# cbar_ax.set_yticklabels([fmt_str.format(torch) for torch in ticks])
# cbar_ax.yaxis.set_tick_params(pad=5, direction='out', size=1) # your number may vary
# cbar_ax.set_title(field_name, x=1, Y=1.02, loc='left', size=12)
# Animate
writer = animation.FFMpegWriter(fps=fps, extra_args=['-vcodec', 'libx264'])
anim = animation.FuncAnimation(fig, anim, frames=len(a))
anim.save(file, writer=writer, dpi=dpi)
return
def scatter(x, y, file='test.pdf', **kwargs):
x_label = kwargs.get('x_label', None)
y_label = kwargs.get('y_label', None)
fig, ax = plt.subplots(1, 1)
ax.scatter(x, y, color='k', s=0.1)
ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
fig, ax = makeSquare(fig, ax)
plt.xlabel(r'$' + x_label + '$')
plt.ylabel(r'$' + y_label + '$')
ax.xaxis.set_zorder(99999)
ax.yaxis.set_zorder(99999)
# Show plot and save figure
plt.savefig(file, transparent=True, bbox_inches='tight')
return
def density2D(x, y, file='test.pdf', nbins=20, **kwargs):
from scipy.stats import kde
x_label = kwargs.get('x_label', None)
y_label = kwargs.get('y_label', None)
x_lims = kwargs.get('x_lims', None)
y_lims = kwargs.get('y_lims', None)
cmap = kwargs.get('cmap', 'gist_heat')
k = kde.gaussian_kde(np.array([x.flatten(), y.flatten()]))
xi, yi = np.mgrid[x.min():x.max():nbins * 1j, y.min():y.max():nbins * 1j]
zi = k(np.vstack([xi.flatten(), yi.flatten()]))
fig, ax = plt.subplots(1, 1)
ax.pcolormesh(xi, yi, zi.reshape(xi.shape), shading='gouraud', cmap=cmap)
ax.contour(xi, yi, zi.reshape(xi.shape), linewidths=0.5, cmap=cmap + '_r')
ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2, color='black')
fig, ax = makeSquare(fig, ax)
plt.xlabel(r'$' + x_label + '$')
plt.ylabel(r'$' + y_label + '$')
if x_lims is not None:
plt.xlim(x_lims[0], x_lims[1])
if y_lims is not None:
plt.ylim(y_lims[0], y_lims[1])
ax.xaxis.set_ticks = [-0.02, 0.00, 0.02]
ax.yaxis.set_ticks = [0.05, 0.01, 0.015]
ax.xaxis.set_zorder(99999)
ax.yaxis.set_zorder(99999)
# Show plot and save figure
plt.savefig(file, transparent=True, bbox_inches='tight')
return
def plot2D_uv(u, cmap, lvls, lim, file, **kwargs):
"""
Return nothing and saves the figure in the specified fn name.
Args:
cmap: matplotlib cmap. Eg: cmap = "seismic"
lvls: number of levels of the contour. Eg: lvls = 100
lim: min and max values of the contour passed as array. Eg: lim = [-0.5, 0.5]
file: Name of the fn to save the plot (recommended .pdf so it can be converted get .svg).
Eg: fn = "dUdy.pdf"
Kwargs:
x=[xmin,xmax] is the x axis minimum and maximum specified
Y=[ymin,ymax] is the Y axis minimum and maximum specified
annotate: Boolean if annotations for min and max values of the field (and locations) are desired
"""
# Internal imports
import matplotlib.colors as colors
from mpl_toolkits.axes_grid1 import make_axes_locatable
plt.rc('font', family='sans-serif', size=15)
mpl.rc('xtick', labelsize=15)
mpl.rc('ytick', labelsize=15)
# mpl.rcParams["contour.negative_linestyle"] = 'dotted'
N, M = u.shape[0], u.shape[1]
if not 'x' in kwargs:
xmin, xmax = 0, N - 1
else:
xmin, xmax = kwargs['x'][0], kwargs['x'][1]
if not 'Y' in kwargs:
ymin, ymax = -M / 2, M / 2 - 1
else:
ymin, ymax = kwargs['Y'][0], kwargs['Y'][1]
annotate = kwargs.get('annotate', False)
scaling = kwargs.get('scaling', 1)
xshift = kwargs.get('xshift', 0)
yshift = kwargs.get('yshift', 0)
# Uniform grid generation
x, y = np.linspace(xmin / scaling, xmax / scaling, N), np.linspace(ymin / scaling, ymax / scaling, M)
x, y = x + xshift, y + yshift
x, y = np.meshgrid(x, y)
u = np.transpose(u)
# Matplotlib definitions
fig1 = plt.gcf()
ax = plt.gca()
# Create contourf given a normalized (norm) colormap (cmap)
norm = colors.Normalize(vmin=lim[0], vmax=lim[1])
# cf = plt.contourf(x, Y, u, '--', lvls, vmin=lim[0], vmax=lim[1], norm=norm, cmap=cmap)
r = ax.contour(x, y, u, lvls, colors='k')
for line, lvl in zip(r.collections, r.levels):
if lvl < 0:
line.set_linestyle('--')
line.set_dashes([(0, (4.0, 4.0))])
line.set_linewidth(0.4)
else:
line.set_linewidth(0.6)
ax.xaxis.set_ticks([0.5, 1.0, 1.5, 2])
ax.yaxis.set_ticks([-0.5, 0.0, 0.5])
ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
# Scale contourf and set limits
plt.axis('scaled')
plt.xlim(np.min(x), np.max(x))
plt.ylim(np.min(y), np.max(y))
# ax.xaxis.set_ticks(np.arange(0.5, 2.5, 0.5))
# Scale colorbar to contourf
# divider = make_axes_locatable(ax)
# cax = divider.append_axes("right", size="5%", pad=0.05, aspect=10)
# cbax = plt.colorbar(cf, cax=cax).ax
# mpl.colorbar.ColorbarBase(cbax, norm=norm, cmap=cmap)
cyl = patches.Circle((0, 0), radius=0.5, linewidth=0.5, edgecolor='black', facecolor='white', zorder=10, alpha=1)
ax.add_patch(cyl)
# Add annotation if desired
if annotate:
str_annotation = max_min_loc(u, xmin, ymin)
print(str_annotation)
ann_ax = fig1.add_subplot(133)
ann_ax.axis('off')
ann_ax.annotate(str_annotation, (0, 0),
xycoords="axes fraction", va="center", ha="center",
bbox=dict(boxstyle="round, pad=1", fc="w"))
# Show, save and close figure
plt.savefig(file, transparent=True, bbox_inches='tight')
plt.draw()
# plt.show()
plt.clf()
return
def plot2D_circulation(u, cmap, lvls, lim, file, **kwargs):
import matplotlib.colors as colors
from mpl_toolkits.axes_grid1 import make_axes_locatable
plt.rc('font', family='sans-serif', size=6)
mpl.rc('xtick', labelsize=6)
mpl.rc('ytick', labelsize=6)
N, M = u.shape[0], u.shape[1]
if not 'x' in kwargs:
xmin, xmax = 0, N - 1
else:
xmin, xmax = kwargs['x'][0], kwargs['x'][1]
if not 'Y' in kwargs:
ymin, ymax = -M / 2, M / 2 - 1
else:
ymin, ymax = kwargs['Y'][0], kwargs['Y'][1]
annotate = kwargs.get('annotate', False)
scaling = kwargs.get('scaling', 1)
xshift = kwargs.get('xshift', 0)
yshift = kwargs.get('yshift', 0)
# Uniform grid generation
x, y = np.linspace(xmin / scaling, xmax / scaling, N), np.linspace(ymin / scaling, ymax / scaling, M)
x, y = x + xshift, y + yshift
x, y = np.meshgrid(x, y)
u = np.transpose(u)
# Matplotlib definitions
fig1 = plt.gcf()
ax = plt.gca()
# Create contourf given a normalized (norm) colormap (cmap)
norm = colors.Normalize(vmin=lim[0], vmax=lim[1])
# cf = plt.contourf(x, Y, u, lvls, vmin=lim[0], vmax=lim[1], norm=norm, cmap=cmap)
ax.contour(x, y, u, lvls, linewidths=0.2, colors='k')
cf = ax.contourf(x, y, u, lvls, vmin=lim[0], vmax=lim[1], norm=norm, cmap=cmap)
# Scale contourf and set limits
plt.axis('scaled')
plt.xlim(np.min(x), np.max(x))
plt.ylim(np.min(y), np.max(y))
ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
grey_color = '#dedede'
cyl = patches.Circle((0, 0), radius=0.5, linewidth=0.5, edgecolor='black', facecolor='white', zorder=10, alpha=1)
rect = patches.Rectangle((0.55, -0.8), 1.5, 1.6, linewidth=0.5, edgecolor='purple', facecolor='none')
ax.add_patch(cyl)
# ax.add_patch(rect)
# Show, save and close figure
plt.savefig(file, transparent=True, bbox_inches='tight')
plt.clf()
return
def plot2Dvort(u, cmap, lvls, lim, file, **kwargs):
"""
Return nothing and saves the figure in the specified fn name.
Args:
cmap: matplotlib cmap. Eg: cmap = "seismic"
lvls: number of levels of the contour. Eg: lvls = 100
lim: min and max values of the contour passed as array. Eg: lim = [-0.5, 0.5]
file: Name of the fn to save the plot (recommended .pdf so it can be converted get .svg).
Eg: fn = "dUdy.pdf"
Kwargs:
x=[xmin,xmax] is the x axis minimum and maximum specified
Y=[ymin,ymax] is the Y axis minimum and maximum specified
annotate: Boolean if annotations for min and max values of the field (and locations) are desired
"""
# Internal imports
import matplotlib.colors as colors
from mpl_toolkits.axes_grid1 import make_axes_locatable
plt.rc('font', family='sans-serif', size=6)
mpl.rc('xtick', labelsize=6)
mpl.rc('ytick', labelsize=6)
N, M = u.shape[0], u.shape[1]
if not 'x_lim' in kwargs:
xmin, xmax = 0, N - 1
else:
xmin, xmax = kwargs['x'][0], kwargs['x'][1]
if not 'y_lim' in kwargs:
ymin, ymax = -M / 2, M / 2 - 1
else:
ymin, ymax = kwargs['Y'][0], kwargs['Y'][1]
annotate = kwargs.get('annotate', False)
scaling = kwargs.get('scaling', 1)
xshift = kwargs.get('xshift', 0)
yshift = kwargs.get('yshift', 0)
# Uniform grid generation
if 'x' not in kwargs and 'Y' not in kwargs:
x = np.linspace(xmin / scaling, xmax / scaling, N)
y = np.linspace(ymin / scaling, ymax / scaling, M)
x, y = x + xshift, y + yshift
x, y = np.meshgrid(x, y)
elif 'x' in kwargs and 'Y' in kwargs:
x = np.transpose(kwargs.get('x')) / scaling
y = np.transpose(kwargs.get('Y')) / scaling
else:
raise ValueError('Pass both x and Y, or none.')
u = np.transpose(u)
# Matplotlib definitions
fig1 = plt.gcf()
ax = plt.gca()
# Create contourf given a normalized (norm) colormap (cmap)
norm = colors.Normalize(vmin=lim[0], vmax=lim[1])
# cf = plt.contourf(x, Y, u, lvls, vmin=lim[0], vmax=lim[1], norm=norm, cmap=cmap)
ax.contour(x, y, u, lvls, linewidths=0.2, colors='k')
cf = ax.contourf(x, y, u, lvls, vmin=lim[0], vmax=lim[1], norm=norm, cmap=cmap)
# Scale contourf and set limits
plt.axis('scaled')
plt.xlim(np.min(x), np.max(x))
plt.ylim(np.min(y), np.max(y))
# ax.xaxis.set_ticks(np.arange(0.5, 2.5, 0.5))
ax.yaxis.set_ticks([-2, 0, 2])
ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
# -- Set tit, circles and text
grey_color = '#dedede'
cyl = patches.Circle((0, 0), 0.51, linewidth=0.2, edgecolor='black', facecolor=grey_color, zorder=9999)
ax.add_patch(cyl)
# Show, save and close figure
plt.savefig(file, transparent=True, bbox_inches='tight')
# plt.draw()
# plt.clf()
return
def plot2Dseparation(u, file, **kwargs):
"""
Return nothing and saves the figure in the specified fn name.
Args:
cmap: matplotlib cmap. Eg: cmap = "seismic"
lvls: number of levels of the contour. Eg: lvls = 100
lim: min and max values of the contour passed as array. Eg: lim = [-0.5, 0.5]
file: Name of the fn to save the plot (recommended .pdf so it can be converted get .svg).
Eg: fn = "dUdy.pdf"
Kwargs:
x=[xmin,xmax] is the x axis minimum and maximum specified
Y=[ymin,ymax] is the Y axis minimum and maximum specified
annotate: Boolean if annotations for min and max values of the field (and locations) are desired
"""
# Internal imports
import matplotlib.colors as colors
from mpl_toolkits.axes_grid1 import make_axes_locatable
plt.rc('font', family='sans-serif', size=6)
mpl.rc('xtick', labelsize=6)
mpl.rc('ytick', labelsize=6)
N, M = u.shape[0], u.shape[1]
scaling = kwargs.get('scaling', 1)
ptype = kwargs.get('ptype', 'contourf')
xshift = kwargs.get('xshift', 0)
yshift = kwargs.get('yshift', 0)
cmap = kwargs.get('cmap', 'seismic')
lvls = kwargs.get('lvls', 50)
lim = kwargs.get('lim', [np.min(u), np.max(u)])
if not 'grid' in kwargs:
xmin, xmax = 0, N - 1
ymin, ymax = -M / 2, M / 2 - 1
x, y = np.linspace(xmin / scaling, xmax / scaling, N), np.linspace(ymin / scaling, ymax / scaling, M)
x, y = x + xshift, y + yshift
x, y = np.meshgrid(x, y)
else:
grid = kwargs['grid']
x, y = grid[0] / scaling, grid[1] / scaling
# Matplotlib definitions
fig = plt.gcf()
ax = plt.gca()
# Create contourf given a normalized (norm) colormap (cmap)
norm = colors.Normalize(vmin=lim[0], vmax=lim[1])
# lvls = np.linspace(lim[0], lim[1], lvls + 1)
if ptype == 'contourf':
# ax.contour(x, Y, u, lvls, linewidths=0.2, colors='k')
# cf = ax.contourf(x.torch, Y.torch, u.torch, levels=lvls, vmin=lim[0], vmax=lim[1], norm=norm, cmap=cmap, extend='both')
cf = ax.contourf(x.T, y.T, u.torch, levels=lvls, vmin=lim[0], vmax=lim[1], norm=norm, cmap=cmap)
else:
cf = ax.pcolormesh(x.T, y.T, u.torch, vmin=lim[0], vmax=lim[1], norm=norm, cmap=cmap)
# Scale contourf and set limits
plt.axis('scaled')
plt.xlim(np.min(x), np.max(x))
plt.ylim(np.min(y), np.max(y))
print(np.min(x), np.max(x))
print(np.min(y), np.max(y))
ax.tick_params(bottom=True, top=True, right=True, which='both', direction='in', length=2)
# Add cylinder
grey_color = '#dedede'
cyl = patches.Circle((0, 0), scaling / 2, linewidth=0.4, edgecolor='purple', facecolor='None')
ax.add_patch(cyl)
# Colormap
# divider = make_axes_locatable(ax)
# cax = divider.append_axes("right", size="5%", pad=0.05)
# v = np.linspace(lim[0], lim[1], 10, endpoint=True)
# length_scale = mpl.cm.get_cmap(cmap)
# length_scale.set_under('r')
# length_scale.set_over('b')
# plt.colorbar(cf, cax=cax, norm=norm, cmap=length_scale, ticks=v, boundaries=v)
# Show, save and close figure
plt.savefig(file, transparent=True, bbox_inches='tight')
plt.clf()
return
# ------------------------------------------------------
def two_point_correlations_single(a, fname):
n_points = len(a)
fig = plt.gcf()
ax = plt.gca()
for i, b in enumerate(a):
point_str = b[0]
n_cases = len(b[1])
print(point_str)
for j, t in enumerate(b[1]):
case_name, c, d = t[0], t[1], t[2]
d[0] = 0.011111
if 'pie' in case_name:
case_name = '\pi'
max_d = np.max(d)
ax.plot(d, c, color=colors[j], lw=1.5, label='$' + case_name + '$', marker=markers[j], markevery=0.05,
markersize=4)
leg1 = ax.legend(loc='lower left')
leg1.get_frame().set_edgecolor('black')
leg1.get_frame().set_facecolor('white')
leg1.get_frame().set_linewidth(0.5)
leg1.get_frame().set_alpha(0.5)
ax.set_ylabel(r'$\left\langle v_1, v_2 \right\rangle$')
ax.set_xlabel(r'$\log dis/length_scale$')
ax.tick_params(bottom=True, top=True, right=True, which='both', direction='in', length=2)
ax.set_xscale('log', nonposx='clip')
ax.set_xlim(1.1e-2, max_d)
ax.set_ylim(0.48, 1.02)
ax.yaxis.set_ticks([0.5, 0.6, 0.7, 0.8, 0.9, 1.0])
fig, ax = makeSquare(fig, ax)
plt.savefig(fname, transparent=True, bbox_inches='tight')
return
def two_point_correlations(a, fname):
from matplotlib.gridspec import GridSpec
n_points = len(a)
fig = plt.figure()
gs = GridSpec(2, 2)
ax = []
ax1 = fig.add_subplot(gs[0, 0])
ax2 = fig.add_subplot(gs[0, 1], sharex=ax1, sharey=ax1)
ax3 = fig.add_subplot(gs[1, 0], sharex=ax1, sharey=ax1)
ax4 = fig.add_subplot(gs[1, 1], sharex=ax1, sharey=ax1)
ax.extend([ax1, ax2, ax3, ax4])
for i, b in enumerate(a):
point_str = b[0]
n_cases = len(b[1])
print(point_str)
print(b)
for j, t in enumerate(b[1]):
case_name, c, d = t[0], t[1], t[2]
d[0] = 0.011111
if 'pie' in case_name:
case_name = '\pi'
max_d = np.max(d)
ax[i].plot(d, c, color=colors[j], lw=1, label='$' + case_name + '$')
leg1 = ax1.legend(loc='lower left')
leg1.get_frame().set_edgecolor('black')
leg1.get_frame().set_facecolor('white')
leg1.get_frame().set_linewidth(0.5)
leg1.get_frame().set_alpha(0.85)
plt.setp(ax1.get_xticklabels(), visible=False)
plt.setp(ax2.get_xticklabels(), visible=False)
plt.setp(ax2.get_yticklabels(), visible=False)
plt.setp(ax4.get_yticklabels(), visible=False)
ax1.set_ylabel(r'$\left\langle v_1, v_2 \right\rangle$')
ax3.set_ylabel(r'$\left\langle v_1, v_2 \right\rangle$')
ax3.set_xlabel(r'$\log dis/length_scale$')
ax4.set_xlabel(r'$\log dis/length_scale$')
for q in ax:
q.tick_params(bottom=True, top=True, right=True, which='both', direction='in', length=2)
q.set_xlim(xmax=max_d)
q.set_ylim(0.5, 1.1)
# q.set_xscale('log', nonposx='clip')
fig_size = fig.get_size_inches()
fig.set_size_inches(fig_size[1] * 1.1, fig_size[1] * 1.1)
fig.tight_layout()
plt.savefig(fname, transparent=True, bbox_inches='tight')
return
def two_point_correlations_3_horizontal(a, fname):
from matplotlib.gridspec import GridSpec
plt.rc('font', family='sans-serif', size=14) # use 13 for squared double columns figures
mpl.rc('xtick', labelsize=14)
mpl.rc('ytick', labelsize=14)
n_points = len(a)
fig = plt.figure()
gs = GridSpec(1, 3)
ax = []
ax1 = fig.add_subplot(gs[0, 0])
ax2 = fig.add_subplot(gs[0, 1], sharey=ax1)
ax3 = fig.add_subplot(gs[0, 2], sharey=ax1)
ax.extend([ax1, ax2, ax3])
for i, b in enumerate(a):
point_str = b[0]
n_cases = len(b[1])
print(point_str)
for j, t in enumerate(b[1]):
case_name, c, d = t[0], t[1], t[2]
d[0] = 0.011111
if 'pie' in case_name:
case_name = '\pi'
max_d = np.max(d)
every = [4, 2, 2, 1, 1]
ax[i].plot(d, c, color=colors[j], lw=1.5, label='$' + case_name + '$', marker=markers[j], markevery=0.05,
markersize=4)
leg1 = ax1.legend(loc='upper right')
leg1.get_frame().set_edgecolor('black')
leg1.get_frame().set_facecolor('white')
leg1.get_frame().set_linewidth(0.5)
leg1.get_frame().set_alpha(0.5)
plt.setp(ax2.get_yticklabels(), visible=False)
plt.setp(ax3.get_yticklabels(), visible=False)
ax1.set_ylabel(r'$\left\langle v_1, v_2 \right\rangle$')
ax1.set_xlabel(r'$\log dis/length_scale$')
ax2.set_xlabel(r'$\log dis/length_scale$')
ax3.set_xlabel(r'$\log dis/length_scale$')
for q in ax:
q.tick_params(bottom=True, top=True, right=True, which='both', direction='in', length=2)
# print(max_d)
# q.set_ylim(0.5, 1.1)
q.set_xscale('log', nonposx='clip')
q.set_xlim(1.1e-2, max_d)
fig_size = fig.get_size_inches()
fig.set_size_inches(fig_size[1] * 2, fig_size[1] * 2 / 2.8)
fig.tight_layout()
plt.savefig(fname, transparent=True, bbox_inches='tight')
return
def two_point_correlations_3_vertical(a, fname):
from matplotlib.gridspec import GridSpec
n_points = len(a)
fig = plt.figure()
gs = GridSpec(3, 1)
ax = []
ax1 = fig.add_subplot(gs[0, 0])
ax2 = fig.add_subplot(gs[1, 0], sharex=ax1)
ax3 = fig.add_subplot(gs[2, 0], sharex=ax1)
ax.extend([ax1, ax2, ax3])
for i, b in enumerate(a):
point_str = b[0]
n_cases = len(b[1])
print(point_str)
for j, t in enumerate(b[1]):
case_name, c, d = t[0], t[1], t[2]
d[0] = 0.011111
if 'pie' in case_name:
case_name = '\pi'
max_d = np.max(d)
every = [4, 2, 2, 1, 1]
ax[i].plot(d, c, color=colors[j], lw=1.5, label='$' + case_name + '$', marker=markers[j], markevery=0.05,
markersize=4)
leg1 = ax1.legend(loc='upper right')
leg1.get_frame().set_edgecolor('black')
leg1.get_frame().set_facecolor('white')
leg1.get_frame().set_linewidth(0.5)
leg1.get_frame().set_alpha(0.5)
plt.setp(ax1.get_xticklabels(), visible=False)
plt.setp(ax2.get_xticklabels(), visible=False)
ax1.set_ylabel(r'$\left\langle v_1, v_2 \right\rangle$')
ax2.set_ylabel(r'$\left\langle v_1, v_2 \right\rangle$')
ax3.set_ylabel(r'$\left\langle v_1, v_2 \right\rangle$')
ax3.set_xlabel(r'$\log dis/length_scale$')
for q in ax:
q.tick_params(bottom=True, top=True, right=True, which='both', direction='in', length=2)
# print(max_d)
# q.set_ylim(0.5, 1.1)
q.set_xscale('log', nonposx='clip')
q.set_xlim(1.1e-2, max_d)
fig_size = fig.get_size_inches()
fig.set_size_inches(fig_size[1] / 2, fig_size[1])
fig.tight_layout()
plt.savefig(fname, transparent=True, bbox_inches='tight')
return
def CL_CD_theta(fy, fx, t, alphas, times, fname):
from scipy.signal import savgol_filter, resample
from scipy.interpolate import interp1d
from matplotlib.gridspec import GridSpec
# fig, [ax1, ax2, ax3] = plt.subplots(nrows=2, ncols=2, sharex=True)
fig = plt.figure()
gs = GridSpec(2, 2)
ax3 = fig.add_subplot(gs[:, 1])
ax1 = fig.add_subplot(gs[0, 0])
ax2 = fig.add_subplot(gs[1, 0], sharex=ax1)
ax1.plot(t, fy, color='black', lw=1, label=r'$C_L$')
ax1.plot(t, fx, color='grey', ls='dashed', lw=1, label=r'$C_D$')
upper, lower = zip(*alphas)
u, l = np.array(upper), np.array(lower)
u = savgol_filter(u, 7, 3) # window size 51, polynomial order 3
l = savgol_filter(l, 7, 3) # window size 51, polynomial order 3
ax2.plot(times, u, color='blue', lw=1, label=r'$\theta_u$')
ax2.plot(times, 360 + l - u, color='purple', ls='dotted', lw=1, label=r'$\theta_l-\theta_u$')
ax2.plot(times, -l, color='red', ls='dashed', lw=1, label=r'$360-\theta_l$')
fy_function = interp1d(t, fy, kind='cubic')
fy = fy_function(times)
ax3.scatter(fy, u + l, s=10, linewidths=1, color='black')
ax3.axhline(0, color='grey', lw=0.1)
ax3.axvline(0, color='grey', lw=0.1)
ax1.grid(axis='both', alpha=0.5)
ax2.grid(axis='both', alpha=0.5)
ax1.tick_params(bottom=True, top=True, right=True, which='both', direction='in', length=2)
ax2.tick_params(bottom=True, top=True, right=True, which='both', direction='in', length=2)
ax3.tick_params(bottom=True, top=True, right=True, which='both', direction='in', length=2)
ax1.set_xlim(min(t), max(t))
ax1.set_ylim(-2, 2)
ax1.yaxis.set_ticks([-1, 0, 1])
plt.setp(ax1.get_xticklabels(), visible=False)
ax2.set_ylim(90, 165)
ax2.yaxis.set_ticks([100, 120, 140, 160])
ax2.set_xlabel(r'$tU/length_scale$')
ax3.set_xlabel(r'$C_L$')
# ax3.set_ylabel(r'$\theta_l+\theta_u$') #labelpad=-3 for 0.5
# ax3.set_ylim(-24,24) #0.5
# ax3.set_xlim(-1.8,1.8)
# ax3.set_ylim(-9,9) #pie
# ax3.set_xlim(-0.8,0.8)
leg1 = ax1.legend(loc='lower left')
leg1.get_frame().set_edgecolor('black')
leg1.get_frame().set_facecolor('white')
leg1.get_frame().set_linewidth(0.5)
leg1.get_frame().set_alpha(0.85)
leg2 = ax2.legend(loc=(0.0375, 0.45), numpoints=1, ncol=2, columnspacing=1, labelspacing=0.1, fontsize=9)
leg2.get_frame().set_edgecolor('black')
leg2.get_frame().set_facecolor('white')
leg2.get_frame().set_linewidth(0.5)
leg2.get_frame().set_alpha(0.85)
# fig_size = fig.get_size_inches()
# fig.set_size_inches(fig_size[1] * 2, fig_size[1] * 2 / 2.8)
# fig.tight_layout()
fig.tight_layout()
plt.savefig(fname, transparent=False, bbox_inches='tight')
return
def CL_CD_theta_2(fy, fx, t, alphas, times, fname):
from scipy.signal import savgol_filter, resample
from scipy.interpolate import interp1d
from matplotlib.gridspec import GridSpec
# fig, [ax1, ax2, ax3] = plt.subplots(nrows=2, ncols=2, sharex=True)
fig = plt.figure()
gs = GridSpec(3, 1)
ax2 = fig.add_subplot(gs[1, 0])
ax1 = fig.add_subplot(gs[0, 0], sharex=ax2)
ax3 = fig.add_subplot(gs[2, 0])
ax1.plot(t, fy, color='black', lw=1, label=r'$C_L$')
ax1.plot(t, fx, color='grey', ls='dashed', lw=1, label=r'$C_D$')
upper, lower = zip(*alphas)
u, l = np.array(upper), np.array(lower)
u = savgol_filter(u, 7, 3) # window size 51, polynomial order 3
l = savgol_filter(l, 7, 3) # window size 51, polynomial order 3
ax2.plot(times, u, color='blue', lw=1, label=r'$\theta_u$')
ax2.plot(times, 360 + l - u, color='purple', ls='dotted', lw=1, label=r'$\theta_l-\theta_u$')
ax2.plot(times, -l, color='red', ls='dashed', lw=1, label=r'$360-\theta_l$')
fy_function = interp1d(t, fy, kind='cubic')
fx_function = interp1d(t, fx, kind='cubic')
fy = fy_function(times)
fx = fx_function(times)
ax3.scatter(fy, u + l, s=10, linewidths=1, color='black')
# dis = {}
# dis['torch'] = times
# dis['C_L'] = fy
# dis['C_D'] = fx
# dis[r'\theta_u'] = u
# dis[r'360-\theta_l'] = -l
# df = pd.DataFrame.from_dict(dis)
# df.to_csv('spreadsheets/figure7b.csv', index=False)
# dis = {}
# dis['torch'] = times
# dis['C_L'] = fy
# dis['C_D'] = fx
# dis[r'\theta_u'] = u
# dis[r'360-\theta_l'] = -l
# df = pd.DataFrame.from_dict(dis)
# df.to_csv('spreadsheets/figure7b.csv', index=False)
ax3.axhline(0, color='darkgrey', lw=0.1)
ax3.axvline(0, color='darkgrey', lw=0.1)
ax1.grid(axis='both', color='darkgrey', lw=0.1)
ax2.grid(axis='both', color='darkgrey', lw=0.1)
ax1.tick_params(bottom=True, top=True, right=True, which='both', direction='in', length=2)
ax2.tick_params(bottom=True, top=True, right=True, which='both', direction='in', length=2)
ax3.tick_params(bottom=True, top=True, right=True, which='both', direction='in', length=2)
ax2.set_xlim(min(t), max(t))
ax1.set_ylim(-2, 2)
ax1.yaxis.set_ticks([-1, 0, 1])
plt.setp(ax1.get_xticklabels(), visible=False)
ax2.set_ylim(90, 165)
ax2.yaxis.set_ticks([100, 120, 140, 160])
ax2.set_xlabel(r'$tU/length_scale$')
ax3.set_xlabel(r'$C_L$')
ax3.set_ylabel(r'$\theta_l+\theta_u$') # labelpad=-3 for 0.5
ax3.set_ylim(-24, 24) # 0.5
ax3.set_xlim(-1.8, 1.8) # 0.5
# ax3.set_ylim(-9,9) #pie
# ax3.set_xlim(-0.8,0.8) #pie
leg1 = ax1.legend(loc='lower left')
leg1.get_frame().set_edgecolor('black')
leg1.get_frame().set_facecolor('white')
leg1.get_frame().set_linewidth(0.5)
leg1.get_frame().set_alpha(0.85)
leg2 = ax2.legend(loc=(0.0375, 0.45), numpoints=1, ncol=2, columnspacing=1, labelspacing=0.1, fontsize=9)
leg2.get_frame().set_edgecolor('black')
leg2.get_frame().set_facecolor('white')
leg2.get_frame().set_linewidth(0.5)
leg2.get_frame().set_alpha(0.85)
fig_size = fig.get_size_inches()
fig.set_size_inches(3.5, 8.5)
fig.tight_layout()
plt.savefig(fname, transparent=True, bbox_inches='tight')
return
def plotCL(fy, t, file, colour='red', label=None, **kwargs):
"""
Plot the lift force as a time series.
:param fy: Lift force [numpy 1D array]
:param t: Time [numpy 1D array]
:param file: output fn name [string]
:param colour: colour...
:param label: label...
:param kwargs: Select which additional information you want to include in the plot: 'St', 'CL_rms', 'CD_rms', 'n_periods',
passing the corresponding values. E.g. 'St=0.2'.
:return: -
"""
ax = plt.gca()
fig = plt.gcf()
# Show lines
plt.plot(t, fy, color=colour, lw=1, label=label)
# Set limits
ax.set_xlim(min(t), max(t))
# ax.set_ylim(1.5*min(fy), 1.5*max(fy))
# ax.set_ylim(-2.5, 2.5)
# Edit frame, labels and legend
# ax.axhline(linewidth=1)
# ax.axvline(linewidth=1)
plt.xlabel(r'$torch/length_scale$')
plt.ylabel(r'$C_L$')
leg = plt.legend(loc='upper right')
# leg.get_frame().set_edgecolor('black')
# Anotations
for key, value in kwargs.items():
if key == 'St':
St_str = '{:.2f}'.format(value)
my_str = r'$S_t=' + St_str + '$'
plt.text(x=1.02 * max(t), y=1.4 * max(fy), s=my_str, color='black')
if key == 'CL_rms':
CL_rms_str = '{:.2f}'.format(value)
my_str = r'$\overline{C}_L=' + CL_rms_str + '$'
plt.text(x=1.02 * max(t), y=1.2 * max(fy), s=my_str, color='black')
if key == 'CD_rms':
CD_rms_str = '{:.2f}'.format(value)
my_str = r'$\overline{C}_D=' + CD_rms_str + '$'
plt.text(x=1.02 * max(t), y=1.0 * max(fy), s=my_str, color='black')
if key == 'n_periods':
n_periods = str(value)
my_str = r'$\textrm{periods}=' + n_periods + '$'
plt.text(x=1.02 * max(t), y=0.8 * max(fy), s=my_str, color='black')
# Show plot and save figure
plt.savefig(file, transparent=True, bbox_inches='tight')
return
# ------------------------------------------------------ TKE
def plotTKEspatial(tke, file, **kwargs):
"""
1D plot of the TKE in space
:param tke: Turbulent kinetic energy [numpy 1D array]
:param file: output fn name [string]
:param kwargs: 'x' coordinates [numpy 1D array]
:return: -
"""
ax = plt.gca()
fig = plt.gcf()
N = tke.shape[0]
if not 'x' in kwargs:
xmin, xmax = 0, N - 1
else:
xmin, xmax = kwargs['x'][0], kwargs['x'][1]
x = np.linspace(xmin, xmax, N)
ylog = kwargs.get('ylog', False)
# Show lines
plt.plot(x, tke, color='black', lw=1.5, label='$L_z = 1D$')
# Set limits
ax.set_xlim(min(x), max(x))
ax.set_ylim(min(tke), max(tke) * 1.1)
fig, ax = makeSquare(fig, ax)
if ylog:
ax.set_yscale('log')
ax.set_ylim(min(tke), max(tke) * 2)
# Edit frame, labels and legend
plt.xlabel('$x/length_scale$')
plt.ylabel('$K$')
leg = plt.legend(loc='upper right')
leg.get_frame().set_edgecolor('white')
# Show plot and save figure
plt.show()
plt.savefig(file, transparent=True, bbox_inches='tight')
return
def plotTKEspatial_list(file, tke_tuple_list, **kwargs):
"""
Generate a plot of a TKE list of tuples like (case, tke) in space
:param file: output fn name [string]
:param tke_tuple_list: list containing the tuple as ('case', tke), where 'case' is a string and 'tke' is a 1D numpy array
:param kwargs: 'x' coordinates [numpy 1D array]
:return: -
"""
ax = plt.gca()
fig = plt.gcf()
if not tke_tuple_list:
raise ValueError("No TKE series passed to the function.")
else:
N = tke_tuple_list[0][1].shape[0]
if not 'x' in kwargs:
xmin, xmax = 0, N - 1
else:
xmin, xmax = kwargs['x'][0], kwargs['x'][1]
ylog = kwargs.get('ylog', False)
ylabel = '$' + kwargs.get('ylabel', 'K') + '$'
x = np.linspace(xmin, xmax, N)
# Show lines
tke_list = []
i = 0
d = {}
for tke_tuple in tke_tuple_list:
label = tke_tuple[0][:-1]
tke = tke_tuple[1]
if 'xD_min' in kwargs:
x = x[x > kwargs['xD_min']]
tke = tke[-x.size:]
if 'pie' in label:
label = '\pi'
label = '$' + label + '$'
color = colors[i]
plt.plot(x, tke, color=color, lw=1.5, label=label, marker=markers[i], markevery=50, markersize=4)
tke_list.append(tke)
d['x'] = x
d[label[1:-1]] = tke
i += 1
df = pd.DataFrame.from_dict(d)
df.to_csv('spreadsheets/figure5b.csv', index=False)
# Set limits
ylims = kwargs.get('ylims', [np.min(tke_list), np.max(tke_list)])
print(ylims)
ax.set_xlim(min(x), 12)
ax.set_ylim(ylims[0], ylims[1])
ax.xaxis.set_ticks([0, 2, 4, 6, 8, 10, 12])
fig, ax = makeSquare(fig, ax)
if ylog:
ax.set_yscale('log')
ax.set_ylim(ylims[0], ylims[1])
plt.minorticks_off()
# Edit frame, labels and legend
plt.xlabel('$x$')
plt.ylabel(ylabel)
# leg = plt.legend(loc=(0.75,0.16))
leg = plt.legend(loc='lower right')
leg.get_frame().set_edgecolor('black')
leg.get_frame().set_facecolor('white')
leg.get_frame().set_linewidth(0.5)
leg.get_frame().set_alpha(0.85)
# ax.yaxis.set_ticks([-2, 0, 2])
ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
# Show plot and save figure
# plt.show()
plt.savefig(file, transparent=True, bbox_inches='tight')
plt.clf()
return
def plotProfiles(file, profiles_tuple_list, **kwargs):
ax = plt.gca()
fig = plt.gcf()
if not profiles_tuple_list:
raise ValueError("No profile series passed to the function.")
else:
M = profiles_tuple_list[0][1].shape[0]
if not 'Y' in kwargs:
ymin, ymax = 0, M - 1
else:
ymin, ymax = kwargs['Y'][0], kwargs['Y'][1]
scaling = kwargs.get('scaling', 1)
yshift = kwargs.get('yshift', 0)
ylabel = '$' + kwargs.get('ylabel', 'Y') + '$'
y = np.linspace(ymin, ymax, M) / scaling + yshift
# Show lines
profiles_list = []
for i, profile_tuple in enumerate(profiles_tuple_list):
label = profile_tuple[0]
if 'piD' in label:
label = '\pi'
else:
label = label[:-1]
label = '$' + label + '$'
color = colors[i]
profile = profile_tuple[1]
plot = plt.plot(profile, y, color=color, lw=1.5, label=label, marker=markers[i], markevery=50, markersize=4)
profiles_list.append(profile)
# Set limits
ax.set_ylim(min(y), max(y))
fig, ax = makeSquare(fig, ax)
# Edit frame, labels and legend
plt.xlabel(r'$\left\langle u \right\rangle$')
plt.ylabel(ylabel, rotation=0)
leg = plt.legend(loc='lower left')
leg.get_frame().set_edgecolor('black')
leg.get_frame().set_facecolor('white')
leg.get_frame().set_linewidth(0.5)
leg.get_frame().set_alpha(0.85)
# ax.yaxis.set_ticks([-2, 0, 2])
ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
# Show plot and save figure
plt.show()
plt.savefig(file, transparent=True, bbox_inches='tight')
plt.clf()
return
def plotProfiles_multiple(file, tuple_profiles_tuple_list, **kwargs):
from collections import OrderedDict
fig = plt.gcf()
ax = plt.gca(projection='3d')
if not tuple_profiles_tuple_list:
raise ValueError("No profile series passed to the function.")
else:
M = tuple_profiles_tuple_list[0][1][0][1].shape[0]
if not 'Y' in kwargs:
ymin, ymax = 0, M - 1
else:
ymin, ymax = kwargs['Y'][0], kwargs['Y'][1]
scaling = kwargs.get('scaling', 1)
yshift = kwargs.get('yshift', 0)
ylabel = '$' + kwargs.get('ylabel', 'Y') + '$'
y = np.linspace(ymin, ymax, M) / scaling + yshift
# Show lines
for e in tuple_profiles_tuple_list:
x_loc = e[0]
profiles_tuple_list = e[1]
for i, profile_tuple in enumerate(profiles_tuple_list):
label = profile_tuple[0]
if 'piD' in label:
label = '\pi'
elif 'D9' in label:
label = '2\mathrm{length_scale}'
else:
label = label[:-1]
label = '$' + label + '$'
color = colors[i]
profile = profile_tuple[1]
plot = plt.plot(profile, y, x_loc, color=color, lw=1.5, label=label, markevery=50, markersize=4)
# Set limits
ax.set_xlim(0.35, 1.1)
ax.set_ylim(-3, 3)
ax.set_zlim(2, 10.5)
# fig, ax = makeSquare(fig,ax)
# Edit frame, labels and legend
ax.set_xlabel(r'$\overline{u}$', rotation=0)
ax.set_ylabel(ylabel, rotation=0)
ax.set_zlabel('$x$', rotation=0)
handles, labels = plt.gca().get_legend_handles_labels()
by_label = OrderedDict(zip(labels, handles))
leg = plt.legend(by_label.values(), by_label.keys(), loc=(0.8, 0.15))
ax.view_init(azim=0, elev=140)
leg.get_frame().set_edgecolor('black')
leg.get_frame().set_facecolor('white')
leg.get_frame().set_linewidth(0.75)
leg.get_frame().set_alpha(0.75)
ax.xaxis.set_ticks([0.4, 0.6, 0.8, 1])
ax.yaxis.set_ticks([-2, 0, 2])
ax.zaxis.set_ticks([4, 6, 8, 10])
# ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
# plt.switch_backend('PDF') #pdf
# ax.autoscale(enable=False, axis='both') # you will need this line to change the Z-axis
# Show plot and save figure
# plt.show()
fig.tight_layout()
plt.savefig(file, transparent=True, bbox_inches='tight')
plt.clf()
return
# ------------------------------------------------------ x-Y
def plotXY(y, **kwargs):
"""
Generate a x-Y plot in space
:param y: series to plot [1D numpy array]
:param label: Y axis label [string]
:param file: output fn name
:param kwargs: 'x' coordinates [numpy 1D array], 'xD_min' left x limit, 'ylog' log plot [boolean]
:return: -
"""
fig, ax = plt.subplots(1, 1)
N = y.shape[0]
x = kwargs.get('x', np.arange(N))
file = kwargs.get('fn', 'test.pdf')
x_label = kwargs.get('x_label', None)
y_label = kwargs.get('y_label', None)
ylog = kwargs.get('ylog', False)
xlog = kwargs.get('xlog', False)
# Show lines
plt.plot(x, y, color='black', lw=1, label=y_label)
# Edit figure, axis, limits
ax.set_xlim(min(x), max(x))
if xlog:
ax.set_xscale('log')
if ylog:
ax.set_yscale('log')
fig, ax = makeSquare(fig, ax)
plt.xlabel(x_label)
plt.ylabel(y_label)
# Show plot and save figure
plt.savefig(file, transparent=True, bbox_inches='tight')
return
def plotXYSpatial(y, label, file, **kwargs):
"""
Generate a x-Y plot in space
:param y: series to plot [1D numpy array]
:param label: Y axis label [string]
:param file: output fn name
:param kwargs: 'x' coordinates [numpy 1D array], 'xD_min' left x limit, 'ylog' log plot [boolean]
:return: -
"""
ax = plt.gca()
fig = plt.gcf()
N = y.shape[0]
if not 'x' in kwargs:
xmin, xmax = 0, N - 1
else:
xmin, xmax = kwargs['x'][0], kwargs['x'][1]
x = np.linspace(xmin, xmax, N)
if 'xD_min' in kwargs:
x = x[x > kwargs['xD_min']]
y = y[-x.size:]
ylog = kwargs.get('ylog', False)
# Show lines
plt.plot(x, y, color='black', lw=0.5, label='$L_z = 1D$')
# Edit figure, axis, limits
ax.set_xlim(min(x), max(x))
if ylog:
ax.set_yscale('log')
fig, ax = makeSquare(fig, ax)
# Edit frame, labels and legend
y_label = '$' + label + '$'
plt.xlabel('$x/length_scale$')
plt.ylabel(y_label)
leg = plt.legend(loc='upper right')
leg.get_frame().set_edgecolor('white')
# Show plot and save figure
plt.show()
plt.savefig(file, transparent=True, bbox_inches='tight')
return
def plotScatter(x, y, cases, file):
"""
Generate a x-Y plot in space
:param x: series to plot [1D numpy array]
:param y: series to plot [1D numpy array]
:param label: Y axis label [string]
:param file: output fn name
:return: -
"""
ax = plt.gca()
fig = plt.gcf()
# Show lines
for i, case in enumerate(cases):
print(i)
ax.scatter(x[i], y[i], c=colors[i], marker=markers[i], s=30, linewidths=1, label=case)
# Edit figure, axis, limits
ax.set_xlim(0.06, 0.15)
ax.set_ylim(0.1, 1.4)
ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
fig, ax = makeSquare(fig, ax)
# Edit frame, labels and legend
plt.xlabel('$\mathrm{max}(TKE|_{Y})$')
plt.ylabel('$\overline{C}_L$')
leg = plt.legend(loc='lower right')
leg.get_frame().set_edgecolor('black')
leg.get_frame().set_facecolor('white')
leg.get_frame().set_linewidth(0.5)
leg.get_frame().set_alpha(0.85)
# Show plot and save figure
plt.savefig(file, transparent=True, bbox_inches='tight')
return
def plotScatter2(x1, x2, y, cases, file):
"""
Generate a x-Y plot in space
:param x: series to plot [1D numpy array]
:param y: series to plot [1D numpy array]
:param label: Y axis label [string]
:param file: output fn name
:return: -
"""
ax1 = plt.gca()
fig = plt.gcf()
ax2 = ax1.twiny()
# Show lines
for i, case in enumerate(cases):
ax1.scatter(x1[i], y[i], c='red', marker=markers[i], s=10, linewidths=1, label=case)
ax2.scatter(x2[i], y[i], c='blue', marker=markers[i], s=10, linewidths=1, label=case)
# Edit figure, axis, limits
ax1.set_xlim(1, 9)
ax2.set_xlim(1, 9)
ax1.set_ylim(0.2, 1.3)
# ax.set_ylim(0.1, 1.4)
ax1.tick_params(bottom="on", top="off", right="on", which='both', direction='in', length=2)
ax2.tick_params(bottom="off", top="on", right="on", which='both', direction='in', length=2)
fig, ax1 = makeSquare(fig, ax1)
# Edit frame, labels and legend
ax1.set_xlabel('$\sigma_l$', color='red')
ax2.set_xlabel('$\sigma_u$', color='blue')
ax1.set_ylabel('$\overline{C}_L$')
leg = ax1.legend(loc='lower right')
for q in leg.legendHandles:
q.set_color('grey')
leg.get_frame().set_edgecolor('black')
leg.get_frame().set_facecolor('white')
leg.get_frame().set_linewidth(0.5)
leg.get_frame().set_alpha(0.85)
# Show plot and save figure
# plt.show()
plt.savefig(file, transparent=True, bbox_inches='tight')
return
def plotXYSpatial_list(file, y_tuple_list, **kwargs):
"""
Generate a x-Y plot in space of multiples Y series
:param file: output fn name
:param y_tuple_list: list of tuples as (case, Y) where 'case' is the name of the case [string] and 'Y' the series [1D numpy array]
:param kwargs: 'x' coordinates [numpy 1D array], 'xD_min' left x limit, 'ylog' log plot [boolean]
:return: -
"""
"""
Generate a XY plot
"""
ax = plt.gca()
fig = plt.gcf()
if not y_tuple_list:
raise ValueError("No TKE series passed to the function.")
else:
N = y_tuple_list[0][1].shape[0]
if not 'x' in kwargs:
xmin, xmax = 0, N - 1
else:
xmin, xmax = kwargs['x'][0], kwargs['x'][1]
ylog = kwargs.get('ylog', False)
ylabel = '$' + kwargs.get('ylabel', 'K') + '$'
# xmax=11.83
# print(xmin, xmax, N)
x = np.linspace(xmin, xmax, N)
# Show lines
y_list = []
d = {}
for y_tuple in enumerate(y_tuple_list):
label = y_tuple[0]
if 'piD' in label:
label = '\pi'
else:
label = label[:-1]
y = y_tuple[1]
label = '$' + label + '$'
color = colors[y_tuple[0]]
if 'xD_min' in kwargs:
x = x[x > kwargs['xD_min']]
y = y[-x.size:]
plt.plot(x, y, color=color, lw=1, label=label, marker=markers[y_tuple[0]],
markevery=50, markersize=4) # , markeredgecolor = 'black', markeredgewidth=0.1)
y_list.append(y)
# dis['x'] = x
# dis[label[1:-1]] = Y
# df = pd.DataFrame.from_dict(dis)
# df.to_csv('spreadsheets/figure9b.csv', index=False)
# Edit figure, axis, limits
ax.set_xlim(min(x), max(x))
if ylog:
ax.set_yscale('log')
plt.minorticks_off()
fig, ax = makeSquare(fig, ax)
# Edit frame, labels and legend
plt.xlabel('$x$')
plt.ylabel(ylabel, rotation=0)
if 'R' in ylabel:
leg = plt.legend(loc='upper left')
# ax.yaxis.set_ticks([0.2, 0.4, 0.6, 0.8, 1.0, 1.2])
ax.yaxis.set_ticks([0.0, 0.4, 0.8, 1.2])
else:
leg = plt.legend(loc='upper right')
leg.get_frame().set_edgecolor('black')
leg.get_frame().set_facecolor('white')
leg.get_frame().set_linewidth(0.5)
leg.get_frame().set_alpha(0.85)
# ax.set_xlim(min(x), 12)
# ax.set_ylim(ylims[0], ylims[1])
ax.xaxis.set_ticks([2, 4, 6, 8, 10, 12])
ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
# Save figure
plt.savefig(file, transparent=True, bbox_inches='tight')
plt.clf()
return
def velocity_profiles(file, profiles_tuple_list, **kwargs):
"""
Similar to plotXYSpatial_list just for a specific test case
:param file: output fn name
:param profiles_tuple_list: list of tuples of format(u,Y)
"""
ax = plt.gca()
fig = plt.gcf()
ylabel = '$' + kwargs.get('ylabel', 'r') + '$'
# Show lines
profiles = []
for i, profile_tuple in enumerate(profiles_tuple_list):
label, profile, y = profile_tuple[0], profile_tuple[1], profile_tuple[2]
p = np.where((np.array(y) > 0.45) & ((np.array(y) < 0.85)))
profile = np.array(profile)[p]
y = np.array(y)[p]
label = '$' + label + '$'
if 'pie' in label:
label = '$\pi$'
color = colors[i]
# plt.plot(profile, Y, color=color, lw=1, label=label, marker=markers[i], markevery=10, markersize=4)
plt.plot(profile, y, color=color, lw=1, label=label)
profiles.append(profile)
# Edit figure, axis, limits
# ax.set_xlim(min(x), max(x))
fig, ax = makeSquare(fig, ax)
# Edit frame, labels and legend
plt.xlabel(r'$\omega_z|_z$')
plt.ylabel(ylabel, rotation=0)
ax.set_ylim(np.min([np.min(s) for s in y]), np.max([np.max(s) for s in y]))
leg = plt.legend(loc='upper right')
leg.get_frame().set_edgecolor('black')
leg.get_frame().set_facecolor('white')
leg.get_frame().set_linewidth(0.75)
leg.get_frame().set_alpha(0.75)
ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
# Show plot and save figure
plt.savefig(file, transparent=True, bbox_inches='tight')
plt.clf()
return
def plotCp_list(file, y_tuple_list, x_list, **kwargs):
"""
Similar to plotXYSpatial_list just for a specific test case
"""
ax = plt.gca()
fig = plt.gcf()
if not y_tuple_list:
raise ValueError("No series passed to the function.")
else:
N = y_tuple_list[0][1].shape[0]
ylabel = '$' + kwargs.get('ylabel', '') + '$'
# Show lines
y_list = []
i = 0
for y_tuple in y_tuple_list:
label = y_tuple[0]
if 'piD' in label: label = '\pi length_scale'
y = y_tuple[1]
label = '$' + label + '$'
color = colors[i]
# if i==1:
# plt.scatter(x_list[i], Y, marker='^', facecolors='none', edgecolors='black', s=25, linewidths=0.5, label=label)
# plt.plot(x_list[i], Y, color='black', lw=1, label=label)
if i == 0:
plt.scatter(x_list[i], y, marker='o', facecolors='none', edgecolors='black', s=25, linewidths=0.5,
label=label)
# plt.plot(x_list[i], Y, markerfacecolor='none', lw=1.5, label=label, marker='o', color='black')
else:
plt.plot(x_list[i], y, color='black', lw=1, label=label)
y_list.append(y)
i += 1
# Edit figure, axis, limits
fig, ax = makeSquare(fig, ax)
ax.set_xlim(0, 180)
ax.xaxis.set_ticks(np.arange(0, 181, 30))
# Edit frame, labels and legend
plt.xlabel(r'$\theta$')
plt.ylabel(ylabel, rotation=0)
leg = plt.legend(loc='upper right')
leg.get_frame().set_edgecolor('white')
ax.tick_params(direction='in')
# Show plot and save figure
plt.show()
plt.savefig(file, transparent=True, bbox_inches='tight')
return
# ------------------------------------------------------ LogLog Spatial
def plot_fft(file, xs, ys, x_label=r'$ f/U D $', y_label=None, title=None,
colour='black', colours=None, l_label=None, marker=None,
xlim=None, ylim=None):
plt.style.use(['science', 'grid'])
fig, ax = plt.subplots(figsize=(9, 7))
ax.set_title(title)
ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
# Edit frame, labels and legend
ax.set_xlabel(x_label)
ax.set_ylabel(y_label)
if xlim is not None: ax.set_xlim(xlim)
if ylim is not None: ax.set_ylim(ylim)
# Make legend manually
if l_label and colours is not None:
legend_elements = []
for idx, loop in enumerate(l_label):
legend_elements.append(Line2D([0], [0], color=colours[idx], lw=4, label=loop))
ax.legend(handles=legend_elements, loc='upper right')
for idx, (x, y) in enumerate(zip(xs, ys)):
ax.plot(y, x, color=colours[idx], marker=marker)
plt.savefig(file, bbox_inches='tight', transparent=True)
return
def plotLogLogSpatialSpectra(file, wn, uk):
"""
Generate a loglog plot of a 1D spatial signal
:param file: output fn name
:param wn: frequency [1D numpy array]
:param uk: transformed u: uk = FFT(u). [1D numpy array]
:return: -
"""
ax = plt.gca()
fig = plt.gcf()
# Show lines
plt.loglog(wn, uk, color='black', lw=1.5, label='$L_z = piD$')
x, y = loglogLine(p2=(max(wn), 5e-4), p1x=min(wn) * 10, m=-5 / 3)
plt.loglog(x, y, color='black', lw=1, ls='dotted')
x, y = loglogLine(p2=(max(wn), 4e-4), p1x=min(wn) * 10, m=-3)
plt.loglog(x, y, color='black', lw=1, ls='dashdot')
# Set limits
# ax.set_xlim(min(wn)*10, max(wn))
# ax.set_ylim(1e-5, 1e-1)
fig, ax = makeSquare(fig, ax)
# Edit frame, labels and legend
plt.xlabel('$kD$')
plt.ylabel('$tke$')
leg = plt.legend(loc='upper right')
leg.get_frame().set_edgecolor('white')
# Anotations
# plt.text(x=5e-3, Y=2e-1, s='$-5/3$', color='black')
# plt.text(x=1e-2, Y=1, s='$-3$', color='black')
# Show plot and save figure
plt.show()
plt.savefig(file, transparent=True, bbox_inches='tight')
return
def plotLogLogSpatialSpectra_list(file, uk_tuple_list, wn_list):
"""
Generate a loglog plot of a list of 1D spatial signals
:param file: output fn name
:param tke_tuple_list: list of tuples as (case, uk), where 'case' is the case name [string] and 'uk' is
the transformed u: uk = FFT(u). [1D numpy array]
:param wn_list: list of frequencies for the different cases
:return: -
"""
ax = plt.gca()
fig = plt.gcf()
# Show lines
for i, uk_tuple in enumerate(uk_tuple_list):
label = uk_tuple[0]
if 'piD' in label: label = '\pi length_scale'
uk = uk_tuple[1]
label = '$' + label + '$'
color = colors[i]
plt.loglog(wn_list[i], uk, color=color, lw=0.5, label=label)
# x, Y = loglogLine(p2=(3,1e-4), p1x=1e-2, m=-5/3)
# plt.loglog(x, Y, color='black', lw=1, ls='dotted')
# x, Y = loglogLine(p2=(4, 2e-5), p1x=1e-2, m=-3)
# plt.loglog(x, Y, color='black', lw=1, ls='dashdot')
# x, Y = loglogLine(p2=(4, 2e-5), p1x=1e-2, m=-11/3)
# plt.loglog(x, Y, color='black', lw=1, ls='dashed')
x, y = loglogLine(p2=(3, 1e-7), p1x=1e-2, m=-5 / 3)
plt.loglog(x, y, color='black', lw=1, ls='dotted')
x, y = loglogLine(p2=(4, 1e-9), p1x=1e-2, m=-3)
plt.loglog(x, y, color='black', lw=1, ls='dashdot')
x, y = loglogLine(p2=(4, 1e-9), p1x=1e-2, m=-11 / 3)
plt.loglog(x, y, color='black', lw=1, ls='dashed')
# Set limits
# ax.set_xlim(1e-3, 1.5)
ax.set_ylim(1e-13, 10)
fig, ax = makeSquare(fig, ax)
# ax.xaxis.set_tick_params(labeltop='on')
ax.tick_params(bottom="on", top="on", which='both')
# Edit frame, labels and legend
plt.xlabel('$kD$')
plt.ylabel('$tke$')
leg = plt.legend(loc='upper right')
leg.get_frame().set_edgecolor('white')
# Anotations
# plt.text(x=1e-2, Y=1e1, s='$-5/3$', color='black')
# plt.text(x=1e-2, Y=3e5, s='$-3$', color='black')
# plt.text(x=2e-2, Y=4e2, s='$-11/3$', color='black')
# Show plot and save figure
# plt.show()
plt.savefig(file, transparent=False, bbox_inches='tight')
return
# ------------------------------------------------------ LogLog Time
def plotLogLogTimeSpectra(freqs, uk, file):
"""
Generate a loglog plot of a time spectra series
:param freqs: frequency [1D numpy array]
:param uk: power signal of the time series u [1D numpy array]
:param file: output fn name
:return: -
"""
ax = plt.gca()
fig = plt.gcf()
# Show lines
plt.loglog(freqs, uk, color='black', lw=1.5, label='$L_z = 1D$')
x, y = loglogLine(p2=(1, 1e-4), p1x=1e-3, m=-5 / 3)
plt.loglog(x, y, color='black', lw=1, ls='dotted')
x, y = loglogLine(p2=(1, 1e-6), p1x=1e-3, m=-3)
plt.loglog(x, y, color='black', lw=1, ls='dashdot')
# Set limits
ax.set_xlim(min(freqs[freqs > 0.5 * 1e-3]), max(freqs[freqs < 0.5]))
ax.set_ylim(min(uk) * 1e-1, max(uk) * 1e1)
# fig, ax = makeSquare(fig,ax)
ax.xaxis.set_tick_params(labeltop='on')
# Edit frame, labels and legend
plt.xlabel(r'$f$')
plt.ylabel(r'$F(v)$')
leg = plt.legend(loc='upper right')
leg.get_frame().set_edgecolor('white')
# Anotations
plt.text(x=2e-3, y=1e-1, s='$-5/3$', color='black')
plt.text(x=7e-3, y=2e-1, s='$-3$', color='black')
plt.text(x=1e-2, y=4e-1, s='$-11/3$', color='black')
# Show plot and save figure
plt.savefig(file, transparent=False, bbox_inches='tight')
return
def plotTimeSpectra_list(file, uk_tuple_list, freqs_list, **kwargs):
"""
Generate a loglog plot of a list of time spectra series
:param file: output fn name
:param uk_tuple_list: list of tuples as (case, uk), where 'case' is the case name [string] and 'uk' is
power signal of the time series u [1D numpy array]
:param freqs_list: list containing the frequencies [1D numpy array] for each case
:return: -
"""
title = kwargs.get('title', None)
xlim = kwargs.get('xlim', None)
ylim = kwargs.get('ylim', None)
ylabel = kwargs.get('ylabel', None)
xlabel = kwargs.get('xlabel', None)
plt.style.use(['science', 'grid'])
fig, ax = plt.subplots(figsize=(7, 5))
# Show lines
colors = sns.color_palette("husl", len(uk_tuple_list))
# colors = sns.color_palette("RdBu", len(uk_tuple_list))
for i, uk_tuple in enumerate(uk_tuple_list):
label = uk_tuple[0]
if 'pie' in label:
label = '\pi'
uk = uk_tuple[1]
label = '$' + label + '$'
color = colors[i]
ax.bar(freqs_list[i], uk, color=color, lw=0.5, label=label)
# Set limits
# ax.set_xlim(np.min(freqs_list[0]), 2e-1)
if title is not None: plt.title(title)
if xlim is not None: ax.set_xlim(xlim) # Window
if ylim is not None: ax.set_ylim(ylim) # Window
fig, ax = makeSquare(fig, ax)
# ax.xaxis.set_tick_params(labeltop='on')
ax.tick_params(bottom="on", top="on", which='both')
# Edit frame, labels and legend
if xlabel is not None: plt.xlabel(xlabel)
if ylabel is not None: plt.ylabel(ylabel)
leg = plt.legend(loc='upper right')
leg.get_frame().set_edgecolor('white')
# Anotations
# plt.text(x=3e-4, Y=5e-1, s='$-5/3$', color='black', fontsize=10) # Power
# plt.text(x=4e-3, Y=1e0, s='$-3$', color='black', fontsize=10)
# plt.text(x=1e-2, Y=4e-1, s='$-11/3$', color='black', fontsize=10)
# plt.text(x=3e-4, Y=5e-1, s='$-5/3$', color='black', fontsize=10) # No Power
# plt.text(x=4e-3, Y=1e0, s='$-3$', color='black', fontsize=10)
# plt.text(x=1e-2, Y=4e-1, s='$-11/3$', color='black', fontsize=10)
# Show plot and save figure
# plt.show()
plt.savefig(file, transparent=False, bbox_inches='tight')
return
def plotLogLogTimeSpectra_list(file, uk_tuple_list, freqs_list, **kwargs):
"""
Generate a loglog plot of a list of time spectra series
:param file: output fn name
:param uk_tuple_list: list of tuples as (case, uk), where 'case' is the case name [string] and 'uk' is
power signal of the time series u [1D numpy array]
:param freqs_list: list containing the frequencies [1D numpy array] for each case
:return: -
"""
title = kwargs.get('title', None)
xlim = kwargs.get('xlim', None)
ylim = kwargs.get('ylim', None)
ylabel = kwargs.get('ylabel', None)
xlabel = kwargs.get('xlabel', None)
colors = kwargs.get('colors', sns.color_palette("husl", len(uk_tuple_list)))
plt.style.use(['science', 'grid'])
fig, ax = plt.subplots(figsize=(6, 4))
# Show lines
for i, uk_tuple in enumerate(uk_tuple_list):
label = uk_tuple[0]
if 'pie' in label: label = '\pi'
uk = uk_tuple[1]
color = colors[i]
ax.plot(freqs_list[i], uk, color=color, lw=0.5, label=label)
ax.loglog()
# x, Y = loglogLine(p2=(1.e2, 1e-7), p1x=1e-2, m=-5 / 3)
# plt.loglog(x, Y, color='black', lw=1, ls='dotted')
# x, Y = loglogLine(p2=(1.2e2, 1e-9), p1x=1e-2, m=-3)
# plt.loglog(x, Y, color='black', lw=1, ls='dashdot')
# x, Y = loglogLine(p2=(1e0, 1e-8), p1x=1e-3, m=-11/3)
# plt.loglog(x, Y, color='black', lw=1, ls='dashed')
if title is not None: plt.title(title)
if xlim is not None: ax.set_xlim(xlim) # Window
if ylim is not None: ax.set_ylim(ylim) # Window
# Set limits
# ax.set_xlim(np.min(freqs_list[0]), 2e-1)
# ax.set_ylim(1e-8, 1e-1)
# ax.set_xlim(1e-2, 1e2) # Window
# ax.set_ylim(1e-11, 1e-1)
fig, ax = makeSquare(fig, ax)
# ax.xaxis.set_tick_params(labeltop='on')
ax.tick_params(bottom="on", top="on", which='both')
# Edit frame, labels and legend
if xlabel is not None: plt.xlabel(xlabel)
if ylabel is not None: plt.ylabel(ylabel)
leg = plt.legend(loc='upper right')
leg.get_frame().set_edgecolor('white')
# Anotations
# plt.text(x=3e-4, Y=5e-1, s='$-5/3$', color='black', fontsize=10) # Power
# plt.text(x=4e-3, Y=1e0, s='$-3$', color='black', fontsize=10)
# plt.text(x=1e-2, Y=4e-1, s='$-11/3$', color='black', fontsize=10)
# plt.text(x=3e-4, Y=5e-1, s='$-5/3$', color='black', fontsize=10) # No Power
# plt.text(x=4e-3, Y=1e0, s='$-3$', color='black', fontsize=10)
# plt.text(x=1e-2, Y=4e-1, s='$-11/3$', color='black', fontsize=10)
# Show plot and save figure
# plt.show()
ax.axvline(22, c='k', ls='--')
plt.savefig(file, bbox_inches='tight', transparent=True, dpi=300)
return
def plotLogLogTimeSpectra_list_cascade(file, uk_tuple_list, freqs_list,
ylabel=r'$\mathrm{PS}\left(v\right)$', title=None):
"""
Same as 'plotLogLogTimeSpectra_list' but the spectra are separated a factor of 10 among them for visualization purposes
"""
plt.style.use(['science', 'grid'])
fig, ax = plt.subplots(figsize=(7, 5))
if title is not None: plt.title(title)
colors = sns.color_palette("husl", len(uk_tuple_list))
for i, uk_tup in enumerate(uk_tuple_list):
uk = uk_tup[1] * 10 ** (-i)
uk_tuple_list[i] = (uk_tuple_list[i][0], uk)
# Show lines
for i, uk_tuple in enumerate(uk_tuple_list):
label = uk_tuple[0]
if 'pie' in label: label = '\pi'
if '2D' in label or 'D9' in label: label = '2\mathrm{length_scale}'
uk = uk_tuple[1]
color = colors[i]
plt.loglog(freqs_list[i], uk, color=color, lw=0.5, label=label)
# for i in np.arange(5):
# x, Y = loglogLine(p2=(1.e2, 1e-11 * 10 ** i), p1x=1e-2, m=-5 / 3)
# # plt.loglog(x, Y, color='black', lw=0.5, ls='dotted', alpha=0.3)
# plt.loglog(x, Y, color='darkgrey', lw=0.3, ls='dotted')
# for i in np.arange(2):
# # x, Y = loglogLine(p2=(1.2e2, 1e-16 * 100 ** i), p1x=1e-3, m=-3)
# # plt.loglog(x, Y, color='black', lw=0.5, ls='dashdot', alpha=0.3)
# # plt.loglog(x, Y, color='darkgrey', lw=0.2, ls='dashdot')
# x, Y = loglogLine(p2=(1.2e2, 1e-17 * 100 ** i), p1x=1e-2, m=-3.66)
# # plt.loglog(x, Y, color='black', lw=0.5, ls='dashed', alpha=0.3)
# plt.loglog(x, Y, color='darkgrey', lw=0.3, ls='dashed')
# Set limits
# ax.set_xlim(1e-2, 7e1) # Window
# ax.set_ylim(9e-16, 1e-1)
# ax.set_ylim(1e-11, 1e4)
fig, ax = makeSquare(fig, ax)
# Edit frame, labels and legend
ax.tick_params(bottom="on", top="on", which='both', direction='in')
plt.xlabel(r'$fD/U$')
plt.ylabel(ylabel)
leg = plt.legend(loc='lower left')
leg.get_frame().set_edgecolor('black')
leg.get_frame().set_facecolor('white')
leg.get_frame().set_linewidth(0.5)
leg.get_frame().set_alpha(0.85)
# ax.yaxis.set_ticks([-2, 0, 2])
ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
# ax.get_yaxis().set_ticks([], minor=True)
# ax.set_xticks([1.1, 1.2, 1.3, 1.4, 1.5, 1.6 ,1.7, 1.8, 1.9 ,2], minor=True)
# ax.set_yticks([0.3, 0.55, 0.7], minor=True)
# ax.xaxis.grid(True, which='major')
# Show plot and save figure
plt.savefig(file, transparent=False, bbox_inches='tight', dpi=600)
plt.clf()
return
def plotLogLogSpatialSpectra_list_cascade(file, uk_tuple_list, freqs_list):
"""
Same as 'plotLogLogSpatialSpectra_list' but the spectras are separated a factor of 10 among them for visualization purposes
"""
ax = plt.gca()
fig = plt.gcf()
for i, uk_tup in enumerate(uk_tuple_list):
uk = uk_tup[1] * 10 ** (-i)
uk_tuple_list[i] = (uk_tuple_list[i][0], uk)
# Show lines
for i, uk_tuple in enumerate(uk_tuple_list):
label = uk_tuple[0]
print(label)
if 'pie' in label: label = '\pi'
if '2D' in label: label = '2\mathrm{length_scale}'
uk = uk_tuple[1]
label = '$' + label + '$'
color = colors[i]
plt.loglog(freqs_list[i], uk, color=color, lw=0.8, label=label)
for i in np.arange(5):
x, y = loglogLine(p2=(1e3, 1e-10 * 10 ** i), p1x=1e-2, m=-5 / 3)
plt.loglog(x, y, color='black', lw=0.5, ls='dotted', alpha=0.3)
x, y = loglogLine(p2=(1e3, 1e-13 * 10 ** i), p1x=1e-2, m=-3)
plt.loglog(x, y, color='black', lw=0.5, ls='dashdot', alpha=0.3)
# Set limits
# ax.set_xlim(2e0, 3e2) # Window
ax.set_xlim(2e0, 5e2) # Window
ax.set_ylim(1e-15, 1e-1)
# ax.set_ylim(1e-11, 1e4)
fig, ax = makeSquare(fig, ax)
# Edit frame, labels and legend
ax.tick_params(bottom="on", top="on", which='both', direction='in')
plt.xlabel(r'$\kappa length_scale$')
leg = plt.legend(loc='lower left')
leg.get_frame().set_edgecolor('white')
ax.get_yaxis().set_ticks([])
# Show plot and save figure
plt.show()
plt.savefig(file, transparent=False, bbox_inches='tight')
return
# ------------------------------------------------------ Lumley's Triangle
def plotLumleysTriangle(eta, xi, file):
"""
Generate a plot of the Reynolds stresses anisotropy tensor in the form of the Lumley's triangle
:param eta: Invariant of the anisotropy tensor (displayed on the vertical axis) [1D array of points in space, i.e. Y triangle coordinates]
:param xi: Invariant of the anisotropy tensor (displayed on the horizontal axis) [1D array of points in space, i.e. x triangle coordinates]
:param file: output fn name
:return: -
"""
ax = plt.gca()
fig = plt.gcf()
x = np.linspace(-1 / 6, 1 / 3, 500)
y = np.sqrt(1 / 27 + 2 * x ** 3)
# Show lines
plt.plot(x, y, color='black', lw=1.5)
plt.plot([-1 / 6, 0], [1 / 6, 0], color='black', lw=1.5)
plt.plot([0, 1 / 3], [0, 1 / 3], color='black', lw=1.5)
plt.scatter(xi, eta, marker='o', c='green', s=1, linewidths=0.1)
# Set limits
ax.set_ylim(0, 0.35)
ax.set_xlim(-0.2, 0.4)
# Make figure squared
fig, ax = makeSquare(fig, ax)
# Edit frame, labels and legend
plt.xlabel(r'$\eta$')
plt.ylabel(r'$\xi$')
leg = plt.legend(loc='upper left')
leg.get_frame().set_edgecolor('black')
leg.get_frame().set_facecolor('white')
leg.get_frame().set_linewidth(0.5)
leg.get_frame().set_alpha(0.85)
# Show plot and save figure
plt.show()
plt.savefig(file, transparent=True, bbox_inches='tight')
return
def plotLumleysTriangle_list(file, eta_tuple_list, xi_tuple_list):
"""
Generate a plot of the Reynolds stresses anisotropy tensor in the form of the Lumley's triangle for different cases
:param file: output fn name
:param eta_tuple_list: list of tuples as (case, eta) for the 'eta' invariant
:param xi_tuple_list: list of tuples as (case, xi) for the 'xi' invariant
:return:
"""
ax = plt.gca()
fig = plt.gcf()
x = np.linspace(-1 / 6, 1 / 3, 500)
y = np.sqrt(1 / 27 + 2 * x ** 3)
# Show lines
plt.plot(x, y, color='black', lw=0.5)
plt.plot([-1 / 6, 0], [1 / 6, 0], color='black', lw=0.5)
plt.plot([0, 1 / 3], [0, 1 / 3], color='black', lw=0.5)
# Show lines
# d0 = {}
for i, eta in enumerate(eta_tuple_list):
label = eta[0]
if 'piD' in label:
label = '\pi'
else:
label = label[:-1]
eta = eta[1]
xi = xi_tuple_list[i][1]
label = r'$' + label + '$'
plt.scatter(xi, eta, marker=markers[i], c=colors[i], s=10, linewidths=0.1, label=label, edgecolor='black')
# d0[label[1:-1]] = (xi, eta)
# dis = {}
# for k,v in d0.items():
# dis[r'\xi'] = v[0]
# dis[r'\eta'] = v[1]
# df = pd.DataFrame.from_dict(dis)
# df.to_csv('spreadsheets/figure8d_'+k+'.csv', index=False)
# Set limits
ax.set_ylim(0, 0.35)
ax.set_xlim(-0.2, 0.4)
# Make figure squared
fig, ax = makeSquare(fig, ax)
# Edit frame, labels and legend
plt.xlabel(r'$\xi$')
plt.ylabel('$ \eta $', rotation=0)
leg = plt.legend(loc='lower right')
leg.get_frame().set_edgecolor('black')
leg.get_frame().set_facecolor('white')
leg.get_frame().set_linewidth(0.5)
leg.get_frame().set_alpha(0.85)
ax.xaxis.set_ticks([-0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4])
ax.tick_params(direction='in', length=2)
ax.tick_params(bottom="on", top="on", right='on', which='both', direction='in')
# plt.minorticks_off()
# Show plot and save figure
plt.savefig(file, transparent=True, bbox_inches='tight')
return
# ------------------------------------------------------ GC plots
# def error_order(fn, x, Y):
# """
# Generate a loglog plot of a time spectra series using the matplotlib library given the arguments
# """
# # Basic definitions
# ax = plt.gca()
# fig = plt.gcf()
#
# plt.loglog(x, Y, color='b', lw=0.5)
#
# x, Y = loglogLine(p2=(np.max(x), np.max(Y)), p1x=np.min(x), m=2)
# plt.loglog(x, Y, color='black', lw=1, ls='dotted')
# x, Y = loglogLine(p2=(np.max(x), np.max(Y)), p1x=np.min(x), m=1)
# plt.loglog(x, Y, color='black', lw=1, ls='dotted')
# # x, Y = loglogLine(p2=(1.2e2, 1e-9), p1x=1e-2, m=-3)
# # plt.loglog(x, Y, color='black', lw=1, ls='dashdot')
# # x, Y = loglogLine(p2=(1e0, 1e-8), p1x=1e-3, m=-11/3)
# # plt.loglog(x, Y, color='black', lw=1, ls='dashed')
#
# # Set limits
# # ax.set_xlim(np.min(freqs_list[0]), 2e-1)
# # ax.set_ylim(1e-8, 1e-1)
# # ax.set_xlim(1e-2, 1e2) # Window
# # ax.set_ylim(1e-11, 1e-1)
#
# # fig, ax = makeSquare(fig,ax)
# # ax.xaxis.set_tick_params(labeltop='on')
# # ax.tick_params(bottom="on", top="on", which='both')
#
# # Edit frame, labels and legend
#
# # Show plot and save figure
# plt.show()
# plt.savefig(fn, transparent=True, bbox_inches='tight')
# return
# ------------------------------------------------------ Utils
def loglogLine(p2, p1x, m):
b = np.log10(p2[1]) - m * np.log10(p2[0])
p1y = p1x ** m * 10 ** b
return [p1x, p2[0]], [p1y, p2[1]]
def makeSquare(fig, ax):
fwidth = fig.get_figwidth()
fheight = fig.get_figheight()
# get the axis size and position in relative coordinates
# this gives a BBox object
bb = ax.get_position()
# calculate them into real world coordinates
axwidth = fwidth * (bb.x1 - bb.x0)
axheight = fheight * (bb.y1 - bb.y0)
# if the axis is wider than tall, then it has to be narrowe
if axwidth > axheight:
# calculate the narrowing relative to the figure
narrow_by = (axwidth - axheight) / fwidth
# move bounding box edges inwards the same amount to give the correct width
bb.x0 += narrow_by / 2
bb.x1 -= narrow_by / 2
# else if the axis is taller than wide, make it vertically smaller
# works the same as above
elif axheight > axwidth:
shrink_by = (axheight - axwidth) / fheight
bb.y0 += shrink_by / 2
bb.y1 -= shrink_by / 2
ax.set_position(bb)
return fig, ax
def max_min_loc(a, x, y):
a_max = np.amax(a)
a_min = np.amin(a)
i, j = np.unravel_index(a.argmax(), a.shape)
x_max_loc, y_max_loc = x[i, j], y[i, j]
i, j = np.unravel_index(a.argmin(), a.shape)
x_min_loc, y_min_loc = x[i, j], y[i, j]
my_str = 'max val: {:.2e}, max loc: ({:.3f},{:.3f})\n' \
'min val: {:.2e}, min loc: ({:.3f},{:.3f})' \
.format(a_max, x_max_loc, y_max_loc, a_min, x_min_loc, y_min_loc)
return my_str
def multiple_formatter(denominator=2, number=np.pi, latex='\pi'):
def gcd(a, b):
while b:
a, b = b, a % b
return a
def _multiple_formatter(x, pos):
den = denominator
num = np.int(np.rint(den * x / number))
com = gcd(num, den)
(num, den) = (int(num / com), int(den / com))
if den == 1:
if num == 0:
return r'$0$'
if num == 1:
return r'$%s$' % latex
elif num == -1:
return r'$-%s$' % latex
else:
return r'$%s%s$' % (num, latex)
else:
if num == 1:
return r'$\frac{%s}{%s}$' % (latex, den)
elif num == -1:
return r'$\frac{-%s}{%s}$' % (latex, den)
else:
return r'$\frac{%s%s}{%s}$' % (num, latex, den)
return _multiple_formatter
# def plot_poincare(x, Y, fn, **kwargs):
# """
# Generate a x-Y plot in space
# :param x: series to plot [1D numpy array]
# :param Y: series to plot [1D numpy array]
# :param label: Y axis label [string]
# :param fn: output fn name
# :return: -
# """
# ax = plt.gca()
# fig = plt.gcf()
#
# # Show lines
# for i, case in enumerate(cases):
# print(i)
# ax.scatter(x[i], Y[i], length_scale=colors[i], marker=markers[i], s=30, linewidths=1, label=case)
#
# # Edit figure, axis, limits
# ax.set_xlim(0.06, 0.15)
# ax.set_ylim(0.1, 1.4)
#
# ax.tick_params(bottom="on", top="on", right="on", which='both', direction='in', length=2)
# fig, ax = makeSquare(fig, ax)
#
# # Edit frame, labels and legend
# plt.xlabel('$\mathrm{max}(TKE|_{Y})$')
# plt.ylabel('$\overline{C}_L$')
# leg = plt.legend(loc='lower right')
# leg.get_frame().set_edgecolor('black')
# leg.get_frame().set_facecolor('white')
# leg.get_frame().set_linewidth(0.5)
# leg.get_frame().set_alpha(0.85)
#
# # Show plot and save figure
# plt.savefig(fn, transparent=True, bbox_inches='tight')
# return
class Multiple:
def __init__(self, denominator=2, number=np.pi, latex='\pi'):
self.denominator = denominator
self.number = number
self.latex = latex
def locator(self):
return plt.MultipleLocator(self.number / self.denominator)
def formatter(self):
return plt.FuncFormatter(multiple_formatter(self.denominator, self.number, self.latex))
| 34.870135 | 140 | 0.594239 | 13,937 | 87,803 | 3.654373 | 0.058764 | 0.004594 | 0.01879 | 0.015118 | 0.810292 | 0.786378 | 0.757437 | 0.726237 | 0.697512 | 0.674972 | 0 | 0.038447 | 0.228033 | 87,803 | 2,517 | 141 | 34.883989 | 0.712958 | 0.255994 | 0 | 0.632314 | 0 | 0 | 0.076896 | 0.003305 | 0 | 0 | 0 | 0 | 0 | 1 | 0.03258 | false | 0.003989 | 0.021941 | 0.00133 | 0.09109 | 0.007979 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 5 |
9a2219f4cf0919aa6cf1cc262ad0d2d335cf9fe5 | 293 | py | Python | pycalphad/__init__.py | anilkunwar/pycalphad | eb3a074d5285b0bd76feddd1529e7edc6208c278 | [
"MIT"
] | 1 | 2021-05-27T16:18:46.000Z | 2021-05-27T16:18:46.000Z | pycalphad/__init__.py | anilkunwar/pycalphad | eb3a074d5285b0bd76feddd1529e7edc6208c278 | [
"MIT"
] | null | null | null | pycalphad/__init__.py | anilkunwar/pycalphad | eb3a074d5285b0bd76feddd1529e7edc6208c278 | [
"MIT"
] | null | null | null | from pycalphad.model import Model
from pycalphad.io.database import Database
from pycalphad.eq.equilibrium import Equilibrium
from pycalphad.eq.energy_surf import energy_surf
from pycalphad.plot.isotherm import isotherm
from pycalphad.plot.binary import binplot
import pycalphad.variables as v | 41.857143 | 48 | 0.866894 | 42 | 293 | 6 | 0.404762 | 0.309524 | 0.119048 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09215 | 293 | 7 | 49 | 41.857143 | 0.947368 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 5 |
9a31752564848a9a935f9d5a1ba0c99155d8e1b6 | 178 | py | Python | symposion/proposals/apps.py | theofanislekkas/updated-symp | 2bf5fa85ef2adb71325cbdd2bdfef2b0742b614a | [
"BSD-3-Clause"
] | null | null | null | symposion/proposals/apps.py | theofanislekkas/updated-symp | 2bf5fa85ef2adb71325cbdd2bdfef2b0742b614a | [
"BSD-3-Clause"
] | null | null | null | symposion/proposals/apps.py | theofanislekkas/updated-symp | 2bf5fa85ef2adb71325cbdd2bdfef2b0742b614a | [
"BSD-3-Clause"
] | null | null | null | from django.apps import AppConfig
class ProposalsConfig(AppConfig):
name = "symposion.proposals"
label = "symposion_proposals"
verbose_name = "Symposion Proposals"
| 22.25 | 40 | 0.752809 | 18 | 178 | 7.333333 | 0.666667 | 0.409091 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.168539 | 178 | 7 | 41 | 25.428571 | 0.891892 | 0 | 0 | 0 | 0 | 0 | 0.320225 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 1 | 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 | 1 | 0 | 0 | 5 |
7be16117c578dcb01112ba5c116cb0528338e0d9 | 368 | py | Python | task2/mock.py | rokimaru/rest_api_autotests | d4009b813b064681250671ec515646dc3554bc5d | [
"Apache-2.0"
] | null | null | null | task2/mock.py | rokimaru/rest_api_autotests | d4009b813b064681250671ec515646dc3554bc5d | [
"Apache-2.0"
] | null | null | null | task2/mock.py | rokimaru/rest_api_autotests | d4009b813b064681250671ec515646dc3554bc5d | [
"Apache-2.0"
] | null | null | null | """ Mock объекты для тестирования сайта https://jsonplaceholder.typicode.com/ """
import requests
def get_photos():
""" Mock ответ запроса сайта https://jsonplaceholder.typicode.com/"""
return requests.get("https://jsonplaceholder.typicode.com/albums/1/photos/")
def mock_data_json():
""" Возвращает пустой список """
data = []
return data
| 20.444444 | 81 | 0.692935 | 42 | 368 | 6 | 0.571429 | 0.238095 | 0.333333 | 0.369048 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003247 | 0.163043 | 368 | 17 | 82 | 21.647059 | 0.814935 | 0.440217 | 0 | 0 | 0 | 0 | 0.284946 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.166667 | 0 | 0.833333 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 5 |
7be6f2435f4cf9f83ce1f3914e3df47d01a0ccbd | 1,154 | py | Python | src/pymyinstall/installcustom/__init__.py | sdpython/pymyinstall | 72b3a56a29def0694e34ccae910bf288a95cf4a5 | [
"MIT"
] | 8 | 2015-08-24T21:01:49.000Z | 2018-01-04T06:34:51.000Z | src/pymyinstall/installcustom/__init__.py | sdpython/pymyinstall | 72b3a56a29def0694e34ccae910bf288a95cf4a5 | [
"MIT"
] | 66 | 2015-06-14T22:04:58.000Z | 2021-11-11T13:46:03.000Z | src/pymyinstall/installcustom/__init__.py | sdpython/pymyinstall | 72b3a56a29def0694e34ccae910bf288a95cf4a5 | [
"MIT"
] | 5 | 2016-09-13T18:14:46.000Z | 2021-08-23T12:03:28.000Z | """
@file
@brief Shortuts
"""
from .install_custom_exceptions import ManualDownloadException
from .install_custom import download_page, where_in_path
from .install_custom_7z import install_7z
from .install_custom_chromedriver import install_chromedriver
from .install_custom_git import install_git
from .install_custom_graphviz import install_graphviz
from .install_custom_javajdk import install_javajdk
from .install_custom_jenkins import install_jenkins
from .install_custom_julia import install_julia
from .install_custom_inkscape import install_inkscape
from .install_custom_miktex import install_miktex
from .install_custom_mingw import install_mingw
from .install_custom_operadriver import install_operadriver
from .install_custom_pandoc import install_pandoc
from .install_custom_putty import install_putty
from .install_custom_python import install_python, folder_older_than
from .install_custom_R import install_R
from .install_custom_scite import install_scite, modify_scite_properties
from .install_custom_sqlitespy import install_sqlitespy
from .install_custom_sbt import install_scala_sbt
from .install_custom_tdm_gcc import install_tdm_gcc
| 44.384615 | 72 | 0.892548 | 160 | 1,154 | 6 | 0.25 | 0.240625 | 0.371875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001883 | 0.079723 | 1,154 | 25 | 73 | 46.16 | 0.902072 | 0.018198 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
d00931cb9d6789fd80459d5c6fee0f9846aad818 | 1,592 | py | Python | python/anyascii/_data/_0b5.py | casept/anyascii | d4f426b91751254b68eaa84c6cd23099edd668e6 | [
"ISC"
] | null | null | null | python/anyascii/_data/_0b5.py | casept/anyascii | d4f426b91751254b68eaa84c6cd23099edd668e6 | [
"ISC"
] | null | null | null | python/anyascii/_data/_0b5.py | casept/anyascii | d4f426b91751254b68eaa84c6cd23099edd668e6 | [
"ISC"
] | null | null | null | b='Duil Duilg Duilm Duilb Duils Duilt Duilp Duilh Duim Duib Duibs Duis Duiss Duing Duij Duich Duik Duit Duip Duih Di Dig Dikk Digs Din Dinj Dinh Did Dil Dilg Dilm Dilb Dils Dilt Dilp Dilh Dim Dib Dibs Dis Diss Ding Dij Dich Dik Dit Dip Dih Tta Ttag Ttakk Ttags Ttan Ttanj Ttanh Ttad Ttal Ttalg Ttalm Ttalb Ttals Ttalt Ttalp Ttalh Ttam Ttab Ttabs Ttas Ttass Ttang Ttaj Ttach Ttak Ttat Ttap Ttah Ttae Ttaeg Ttaekk Ttaegs Ttaen Ttaenj Ttaenh Ttaed Ttael Ttaelg Ttaelm Ttaelb Ttaels Ttaelt Ttaelp Ttaelh Ttaem Ttaeb Ttaebs Ttaes Ttaess Ttaeng Ttaej Ttaech Ttaek Ttaet Ttaep Ttaeh Ttya Ttyag Ttyakk Ttyags Ttyan Ttyanj Ttyanh Ttyad Ttyal Ttyalg Ttyalm Ttyalb Ttyals Ttyalt Ttyalp Ttyalh Ttyam Ttyab Ttyabs Ttyas Ttyass Ttyang Ttyaj Ttyach Ttyak Ttyat Ttyap Ttyah Ttyae Ttyaeg Ttyaekk Ttyaegs Ttyaen Ttyaenj Ttyaenh Ttyaed Ttyael Ttyaelg Ttyaelm Ttyaelb Ttyaels Ttyaelt Ttyaelp Ttyaelh Ttyaem Ttyaeb Ttyaebs Ttyaes Ttyaess Ttyaeng Ttyaej Ttyaech Ttyaek Ttyaet Ttyaep Ttyaeh Tteo Tteog Tteokk Tteogs Tteon Tteonj Tteonh Tteod Tteol Tteolg Tteolm Tteolb Tteols Tteolt Tteolp Tteolh Tteom Tteob Tteobs Tteos Tteoss Tteong Tteoj Tteoch Tteok Tteot Tteop Tteoh Tte Tteg Ttekk Ttegs Tten Ttenj Ttenh Tted Ttel Ttelg Ttelm Ttelb Ttels Ttelt Ttelp Ttelh Ttem Tteb Ttebs Ttes Ttess Tteng Ttej Ttech Ttek Ttet Ttep Tteh Ttyeo Ttyeog Ttyeokk Ttyeogs Ttyeon Ttyeonj Ttyeonh Ttyeod Ttyeol Ttyeolg Ttyeolm Ttyeolb Ttyeols Ttyeolt Ttyeolp Ttyeolh Ttyeom Ttyeob Ttyeobs Ttyeos Ttyeoss Ttyeong Ttyeoj Ttyeoch Ttyeok Ttyeot Ttyeop Ttyeoh Ttye Ttyeg Ttyekk Ttyegs Ttyen Ttyenj Ttyenh Ttyed Ttyel Ttyelg Ttyelm Ttyelb' | 1,592 | 1,592 | 0.83794 | 257 | 1,592 | 5.190661 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.160176 | 1,592 | 1 | 1,592 | 1,592 | 0.997756 | 0 | 0 | 0 | 0 | 1 | 0.996861 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
d018cca90da6fb9fbb8903ea2496fa8029901769 | 88 | py | Python | rmclino_preprocessor/__init__.py | rmclino/preprocessor | 056f42e946a29c1d431628ed1044787f1237dd51 | [
"MIT"
] | 1 | 2019-05-22T20:10:57.000Z | 2019-05-22T20:10:57.000Z | rmclino_preprocessor/__init__.py | rmclino/preprocessor | 056f42e946a29c1d431628ed1044787f1237dd51 | [
"MIT"
] | null | null | null | rmclino_preprocessor/__init__.py | rmclino/preprocessor | 056f42e946a29c1d431628ed1044787f1237dd51 | [
"MIT"
] | null | null | null | from .fillna import FillNa
from .rescale import Rescale
from .normalize import Normalize | 29.333333 | 32 | 0.840909 | 12 | 88 | 6.166667 | 0.416667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 88 | 3 | 32 | 29.333333 | 0.961039 | 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 | 1 | 0 | 0 | 5 |
d0297d8aa63a851afd671e29c1e6fcdb2997286e | 783 | py | Python | ucb_cs61A/quiz/quiz03/tests/no-repeats.py | tavaresdong/courses-notes | 7fb89103bca679f5ef9b14cbc777152daac1402e | [
"MIT"
] | null | null | null | ucb_cs61A/quiz/quiz03/tests/no-repeats.py | tavaresdong/courses-notes | 7fb89103bca679f5ef9b14cbc777152daac1402e | [
"MIT"
] | 1 | 2017-07-31T08:15:26.000Z | 2017-07-31T08:15:26.000Z | ucb_cs61A/quiz/quiz03/tests/no-repeats.py | tavaresdong/courses-notes | 7fb89103bca679f5ef9b14cbc777152daac1402e | [
"MIT"
] | 1 | 2019-10-06T16:52:31.000Z | 2019-10-06T16:52:31.000Z | test = {
'name': 'no-repeats',
'points': 1,
'suites': [
{
'type': 'scheme',
'cases': [
{
'code': r"""
scm> (no-repeats (list 5 4 5 4 2 2))
(5 4 2)
"""
},
{
'code': r"""
scm> (no-repeats '(1 2 3 4))
(1 2 3 4)
""",
},
{
'code': r"""
scm> (no-repeats '(1 1 3 3 5 5))
(1 3 5)
""",
},
{
'code': r"""
scm> (no-repeats '(3 2 1 2 3))
(3 2 1)
""",
},
{
'code': r"""
scm> (no-repeats '(4 2 4 5))
(4 2 5)
""",
},
],
'setup': r"""
scm> (load 'quiz03)
""",
},
]
}
| 17.4 | 46 | 0.247765 | 82 | 783 | 2.365854 | 0.256098 | 0.278351 | 0.206186 | 0.257732 | 0.448454 | 0.185567 | 0 | 0 | 0 | 0 | 0 | 0.125714 | 0.553001 | 783 | 44 | 47 | 17.795455 | 0.428571 | 0 | 0 | 0.227273 | 0 | 0 | 0.581098 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
d06c35d5efebe86b8581ccf791aa1d95dfe626a8 | 226 | py | Python | src/inherit.py | ligang945/pyInterview | dde214a16f670cb7e83d5f81e8f911ce25edc43f | [
"MIT"
] | null | null | null | src/inherit.py | ligang945/pyInterview | dde214a16f670cb7e83d5f81e8f911ce25edc43f | [
"MIT"
] | null | null | null | src/inherit.py | ligang945/pyInterview | dde214a16f670cb7e83d5f81e8f911ce25edc43f | [
"MIT"
] | null | null | null | class A(object):
def foo1(self):
print("A")
class B(A):
def foo2(self):
pass
class C(A):
def foo1(self):
print("C")
class D(B, C):
pass
d = D()
d.foo1()
| 9.416667 | 20 | 0.415929 | 32 | 226 | 2.9375 | 0.375 | 0.148936 | 0.234043 | 0.340426 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030769 | 0.424779 | 226 | 23 | 21 | 9.826087 | 0.692308 | 0 | 0 | 0.307692 | 0 | 0 | 0.009852 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0.153846 | 0 | 0 | 0.538462 | 0.153846 | 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 | 1 | 0 | 0 | 5 |
d072c1bf6dc232deb7f7d56e082be519299a8fba | 54 | py | Python | enthought/traits/ui/wx/range_editor.py | enthought/etsproxy | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | [
"BSD-3-Clause"
] | 3 | 2016-12-09T06:05:18.000Z | 2018-03-01T13:00:29.000Z | enthought/traits/ui/wx/range_editor.py | enthought/etsproxy | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | [
"BSD-3-Clause"
] | 1 | 2020-12-02T00:51:32.000Z | 2020-12-02T08:48:55.000Z | enthought/traits/ui/wx/range_editor.py | enthought/etsproxy | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | [
"BSD-3-Clause"
] | null | null | null | # proxy module
from traitsui.wx.range_editor import *
| 18 | 38 | 0.796296 | 8 | 54 | 5.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12963 | 54 | 2 | 39 | 27 | 0.893617 | 0.222222 | 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 | 1 | 0 | 0 | 5 |
d0a2ead47d830aad59dfec16f77428211050c94b | 7,599 | py | Python | test/test_ballquerry.py | duducheng/torch-points-kernels | aed9cf56ca61fe34b4880159951760e5dcb3a1db | [
"MIT"
] | 52 | 2020-04-14T14:55:18.000Z | 2021-07-19T12:36:22.000Z | test/test_ballquerry.py | hzxie/torch-points-kernels | a52ea03bdd62e890320c592282ebd89de659534f | [
"MIT"
] | 32 | 2020-04-21T10:43:22.000Z | 2021-07-29T12:27:28.000Z | test/test_ballquerry.py | hzxie/torch-points-kernels | a52ea03bdd62e890320c592282ebd89de659534f | [
"MIT"
] | 12 | 2020-06-03T03:14:33.000Z | 2021-07-25T21:50:31.000Z | import unittest
import torch
import numpy.testing as npt
import numpy as np
from sklearn.neighbors import KDTree
import os
import sys
ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")
sys.path.insert(0, ROOT)
from test import run_if_cuda
from torch_points_kernels import ball_query
class TestBall(unittest.TestCase):
@run_if_cuda
def test_simple_gpu(self):
a = torch.tensor([[[0, 0, 0], [1, 0, 0], [2, 0, 0]], [[0, 0, 0], [1, 0, 0], [2, 0, 0]]]).to(torch.float).cuda()
b = torch.tensor([[[0, 0, 0]], [[3, 0, 0]]]).to(torch.float).cuda()
idx, dist = ball_query(1.01, 2, a, b)
torch.testing.assert_allclose(idx.cpu(), torch.tensor([[[0, 1]], [[2, 2]]]))
torch.testing.assert_allclose(dist.cpu(), torch.tensor([[[0, 1]], [[1, -1]]]).float())
def test_simple_cpu(self):
a = torch.tensor([[[0, 0, 0], [1, 0, 0], [2, 0, 0]], [[0, 0, 0], [1, 0, 0], [2, 0, 0]]]).to(torch.float)
b = torch.tensor([[[0, 0, 0]], [[3, 0, 0]]]).to(torch.float)
idx, dist = ball_query(1.01, 2, a, b, sort=True)
torch.testing.assert_allclose(idx, torch.tensor([[[0, 1]], [[2, 2]]]))
torch.testing.assert_allclose(dist, torch.tensor([[[0, 1]], [[1, -1]]]).float())
a = torch.tensor([[[0, 0, 0], [1, 0, 0], [1, 1, 0]]]).to(torch.float)
idx, dist = ball_query(1.01, 3, a, a, sort=True)
torch.testing.assert_allclose(idx, torch.tensor([[[0, 1, 0], [1, 0, 2], [2, 1, 2]]]))
@run_if_cuda
def test_larger_gpu(self):
a = torch.randn(32, 4096, 3).to(torch.float).cuda()
idx, dist = ball_query(1, 64, a, a)
self.assertGreaterEqual(idx.min(), 0)
@run_if_cuda
def test_cpu_gpu_equality(self):
a = torch.randn(5, 1000, 3)
b = torch.randn(5, 500, 3)
res_cpu = ball_query(1, 500, a, b)[0].detach().numpy()
res_cuda = ball_query(1, 500, a.cuda(), b.cuda())[0].cpu().detach().numpy()
for i in range(b.shape[0]):
for j in range(b.shape[1]):
# Because it is not necessary the same order
assert set(res_cpu[i][j]) == set(res_cuda[i][j])
res_cpu = ball_query(0.01, 500, a, b)[0].detach().numpy()
res_cuda = ball_query(0.01, 500, a.cuda(), b.cuda())[0].cpu().detach().numpy()
for i in range(b.shape[0]):
for j in range(b.shape[1]):
# Because it is not necessary the same order
assert set(res_cpu[i][j]) == set(res_cuda[i][j])
class TestBallPartial(unittest.TestCase):
@run_if_cuda
def test_simple_gpu(self):
x = torch.tensor([[10, 0, 0], [0.1, 0, 0], [0.2, 0, 0], [0.1, 0, 0]]).to(torch.float).cuda()
y = torch.tensor([[0, 0, 0]]).to(torch.float).cuda()
batch_x = torch.from_numpy(np.asarray([0, 0, 0, 1])).long().cuda()
batch_y = torch.from_numpy(np.asarray([0])).long().cuda()
idx, dist2 = ball_query(0.2, 4, x, y, mode="PARTIAL_DENSE", batch_x=batch_x, batch_y=batch_y)
idx = idx.detach().cpu().numpy()
dist2 = dist2.detach().cpu().numpy()
idx_answer = np.asarray([[1, 2, -1, -1]])
dist2_answer = np.asarray([[0.0100, 0.04, -1, -1]]).astype(np.float32)
npt.assert_array_almost_equal(idx, idx_answer)
npt.assert_array_almost_equal(dist2, dist2_answer)
def test_simple_cpu(self):
x = torch.tensor([[10, 0, 0], [0.1, 0, 0], [10, 0, 0], [10.1, 0, 0]]).to(torch.float)
y = torch.tensor([[0, 0, 0]]).to(torch.float)
batch_x = torch.from_numpy(np.asarray([0, 0, 0, 0])).long()
batch_y = torch.from_numpy(np.asarray([0])).long()
idx, dist2 = ball_query(1.0, 2, x, y, mode="PARTIAL_DENSE", batch_x=batch_x, batch_y=batch_y)
idx = idx.detach().cpu().numpy()
dist2 = dist2.detach().cpu().numpy()
idx_answer = np.asarray([[1, -1]])
dist2_answer = np.asarray([[0.0100, -1.0000]]).astype(np.float32)
npt.assert_array_almost_equal(idx, idx_answer)
npt.assert_array_almost_equal(dist2, dist2_answer)
def test_breaks(self):
x = torch.tensor([[10, 0, 0], [0.1, 0, 0], [10, 0, 0], [10.1, 0, 0]]).to(torch.float)
y = torch.tensor([[0, 0, 0]]).to(torch.float)
batch_x = torch.from_numpy(np.asarray([0, 0, 1, 1])).long()
batch_y = torch.from_numpy(np.asarray([0])).long()
with self.assertRaises(RuntimeError):
idx, dist2 = ball_query(1.0, 2, x, y, mode="PARTIAL_DENSE", batch_x=batch_x, batch_y=batch_y)
def test_random_cpu(self, cuda=False):
a = torch.randn(100, 3).to(torch.float)
b = torch.randn(50, 3).to(torch.float)
batch_a = torch.tensor([0 for i in range(a.shape[0] // 2)] + [1 for i in range(a.shape[0] // 2, a.shape[0])])
batch_b = torch.tensor([0 for i in range(b.shape[0] // 2)] + [1 for i in range(b.shape[0] // 2, b.shape[0])])
R = 1
idx, dist = ball_query(
R,
15,
a,
b,
mode="PARTIAL_DENSE",
batch_x=batch_a,
batch_y=batch_b,
sort=True,
)
idx1, dist = ball_query(
R,
15,
a,
b,
mode="PARTIAL_DENSE",
batch_x=batch_a,
batch_y=batch_b,
sort=True,
)
torch.testing.assert_allclose(idx1, idx)
with self.assertRaises(AssertionError):
idx, dist = ball_query(
R,
15,
a,
b,
mode="PARTIAL_DENSE",
batch_x=batch_a,
batch_y=batch_b,
sort=False,
)
idx1, dist = ball_query(
R,
15,
a,
b,
mode="PARTIAL_DENSE",
batch_x=batch_a,
batch_y=batch_b,
sort=False,
)
torch.testing.assert_allclose(idx1, idx)
self.assertEqual(idx.shape[0], b.shape[0])
self.assertEqual(dist.shape[0], b.shape[0])
self.assertLessEqual(idx.max().item(), len(batch_a))
# Comparison to see if we have the same result
tree = KDTree(a.detach().numpy())
idx3_sk = tree.query_radius(b.detach().numpy(), r=R)
i = np.random.randint(len(batch_b))
for p in idx[i].detach().numpy():
if p >= 0 and p < len(batch_a):
assert p in idx3_sk[i]
@run_if_cuda
def test_random_gpu(self):
a = torch.randn(100, 3).to(torch.float).cuda()
b = torch.randn(50, 3).to(torch.float).cuda()
batch_a = torch.tensor(
[0 for i in range(a.shape[0] // 2)] + [1 for i in range(a.shape[0] // 2, a.shape[0])]
).cuda()
batch_b = torch.tensor(
[0 for i in range(b.shape[0] // 2)] + [1 for i in range(b.shape[0] // 2, b.shape[0])]
).cuda()
R = 1
idx, dist = ball_query(
R,
15,
a,
b,
mode="PARTIAL_DENSE",
batch_x=batch_a,
batch_y=batch_b,
sort=False,
)
# Comparison to see if we have the same result
tree = KDTree(a.cpu().detach().numpy())
idx3_sk = tree.query_radius(b.cpu().detach().numpy(), r=R)
i = np.random.randint(len(batch_b))
for p in idx[i].cpu().detach().numpy():
if p >= 0 and p < len(batch_a):
assert p in idx3_sk[i]
if __name__ == "__main__":
unittest.main()
| 37.068293 | 119 | 0.529017 | 1,164 | 7,599 | 3.313574 | 0.114261 | 0.029038 | 0.017112 | 0.037075 | 0.831994 | 0.793363 | 0.760954 | 0.743842 | 0.685507 | 0.64895 | 0 | 0.063128 | 0.293328 | 7,599 | 204 | 120 | 37.25 | 0.655121 | 0.023029 | 0 | 0.526946 | 0 | 0 | 0.015366 | 0 | 0 | 0 | 0 | 0 | 0.125749 | 1 | 0.053892 | false | 0 | 0.053892 | 0 | 0.11976 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 5 |
d0bed27deea304d34e869a0d5d678aba9eb6cffe | 87 | py | Python | indico_toolkit/auto_review/__init__.py | IndicoDataSolutions/Indico-Solutions-Toolkit | c9a38681c84e86a48bcde0867359ddd2f52ce236 | [
"MIT"
] | 6 | 2021-05-20T16:48:27.000Z | 2022-03-15T15:43:40.000Z | indico_toolkit/auto_review/__init__.py | IndicoDataSolutions/Indico-Solutions-Toolkit | c9a38681c84e86a48bcde0867359ddd2f52ce236 | [
"MIT"
] | 25 | 2021-06-25T13:37:21.000Z | 2022-01-03T15:54:26.000Z | indico_toolkit/auto_review/__init__.py | IndicoDataSolutions/Indico-Solutions-Toolkit | c9a38681c84e86a48bcde0867359ddd2f52ce236 | [
"MIT"
] | null | null | null | from .review_config import ReviewConfiguration
from .auto_reviewer import AutoReviewer
| 29 | 46 | 0.885057 | 10 | 87 | 7.5 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.091954 | 87 | 2 | 47 | 43.5 | 0.949367 | 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 | 1 | 0 | 0 | 5 |
d0f543da85e5a5992a9016d7bea1421fad60688c | 107 | py | Python | apps/mixins/db_admin/__init__.py | Eudorajab1/websaw | 7c3a369789d23ac699868fa1eff6c63e3e5c1e36 | [
"MIT"
] | 1 | 2022-03-29T00:12:12.000Z | 2022-03-29T00:12:12.000Z | apps/mixins/db_admin/__init__.py | Eudorajab1/websaw | 7c3a369789d23ac699868fa1eff6c63e3e5c1e36 | [
"MIT"
] | null | null | null | apps/mixins/db_admin/__init__.py | Eudorajab1/websaw | 7c3a369789d23ac699868fa1eff6c63e3e5c1e36 | [
"MIT"
] | null | null | null | from .controllers import app, Context
from . import db_admin
# this is mixin, do not mount it
#app.mount()
| 21.4 | 37 | 0.747664 | 18 | 107 | 4.388889 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.168224 | 107 | 4 | 38 | 26.75 | 0.88764 | 0.383178 | 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 | 1 | 0 | 0 | 5 |
1906d06b249b10beca9f90107007a96a883a90f8 | 55 | py | Python | ex112/UtilidadesCeV/__init__.py | LucasIdalino/Exerc-cios-do-Curso | 4ca4610d1acfe4672c20114f891b6aabae816049 | [
"MIT"
] | null | null | null | ex112/UtilidadesCeV/__init__.py | LucasIdalino/Exerc-cios-do-Curso | 4ca4610d1acfe4672c20114f891b6aabae816049 | [
"MIT"
] | null | null | null | ex112/UtilidadesCeV/__init__.py | LucasIdalino/Exerc-cios-do-Curso | 4ca4610d1acfe4672c20114f891b6aabae816049 | [
"MIT"
] | null | null | null | from Pythonexercicios.ex111.UtilidadesCeV import moeda
| 27.5 | 54 | 0.890909 | 6 | 55 | 8.166667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058824 | 0.072727 | 55 | 1 | 55 | 55 | 0.901961 | 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 | 1 | 0 | 0 | 5 |
ef75285e686ad1b3b09424a1584b25dd3d32cddb | 6,170 | py | Python | tests/test_normalexp_dist.py | jab0707/UncertainSCI | 569c978c4f67dd7bb37e730276f2a376b8639235 | [
"MIT"
] | 1 | 2021-07-25T17:02:36.000Z | 2021-07-25T17:02:36.000Z | tests/test_normalexp_dist.py | jab0707/UncertainSCI | 569c978c4f67dd7bb37e730276f2a376b8639235 | [
"MIT"
] | 70 | 2020-04-09T17:38:12.000Z | 2022-03-18T17:06:09.000Z | tests/test_normalexp_dist.py | jab0707/UncertainSCI | 569c978c4f67dd7bb37e730276f2a376b8639235 | [
"MIT"
] | 7 | 2020-05-28T17:26:05.000Z | 2021-08-13T21:41:10.000Z | import unittest
import numpy as np
from numpy.linalg import norm
from UncertainSCI.distributions import NormalDistribution, ExponentialDistribution
class DistTestCase(unittest.TestCase):
"""
Tests for parameters for distributons.
"""
def test_exp_dist(self):
"""Test for exponential distribution"""
# lbd is None, mean and stdev are iterables
n = np.random.randint(1, 10)
num = 10 * np.random.rand(n,)
mean = [num[i] for i in range(len(num))]
stdev = mean
loc = 0.
E = ExponentialDistribution(lbd=None, loc=loc, mean=mean, stdev=stdev)
delta = 1e-3
errstr = 'Failed for n = {}, mean = {} and stdev = {}'.format(n, mean, stdev)
self.assertAlmostEqual(E.lbd, [1/num[i] for i in range(len(num))], delta=delta, msg=errstr)
self.assertAlmostEqual(E.loc, [0. for i in range(len(num))], delta=delta, msg=errstr)
self.assertAlmostEqual(E.dim, n, delta=delta, msg=errstr)
# lbd is not None, mean and stdev are None
lbd = [num[i] for i in range(len(num))]
loc = 0.
E = ExponentialDistribution(lbd=lbd, loc=loc)
delta = 1e-3
errstr = 'Failed for n = {}, mean = {} and stdev = {}'.format(n, mean, stdev)
self.assertAlmostEqual(E.lbd, [num[i] for i in range(len(num))], delta=delta, msg=errstr)
self.assertAlmostEqual(E.loc, [0. for i in range(len(num))], delta=delta, msg=errstr)
self.assertAlmostEqual(E.dim, n, delta=delta, msg=errstr)
# Test for MC_samples
lbd = -n * np.random.rand(2,)
loc = -n * np.random.rand(2,)
E = ExponentialDistribution(flag=False, lbd=[lbd[0], lbd[1]], loc=[loc[0], loc[1]])
x = E.MC_samples(M=int(1e7))
F1 = np.mean(x, axis=0)
F2 = 1 / lbd + loc
# F1 = np.var(x, axis=0)
# F2 = 1 / lbd**2
delta = 1e-2
ind = np.where(np.abs(F1-F2) > delta)[:2][0]
if ind.size > 0:
errstr = 'Failed'
else:
errstr = ''
self.assertAlmostEqual(np.linalg.norm(F1-F2, ord=np.inf), 0., delta=delta, msg=errstr)
def test_normal_dist(self):
"""Test for Normal distribution."""
# cov is None and meaniter
n = np.random.randint(2, 10)
mean = [0.] * n
cov = None
N = NormalDistribution(mean=mean, cov=cov)
delta = 1e-3
errstr = 'Failed for n = {}, mean = {} and cov = {}'.format(n, mean, cov)
self.assertAlmostEqual(N.mean(), mean, delta=delta, msg=errstr)
self.assertAlmostEqual(norm(N.cov()-np.eye(len(mean))), 0, delta=delta, msg=errstr)
self.assertAlmostEqual(N.dim, len(mean), delta=delta, msg=errstr)
# cov is None and mean is None
mean = None
cov = None
N = NormalDistribution(mean=mean, cov=cov)
errstr = 'Failed for n = {}, mean = {} and cov = {}'.format(n, mean, cov)
self.assertAlmostEqual(N.mean(), 0., delta=delta, msg=errstr)
self.assertAlmostEqual(norm(N.cov()-np.eye(1)), 0, delta=delta, msg=errstr)
self.assertAlmostEqual(N.dim, 1, delta=delta, msg=errstr)
# cov is None and mean is a scalar
mean = np.random.randn()
cov = None
N = NormalDistribution(mean=mean, cov=cov)
errstr = 'Failed for n = {}, mean = {} and cov = {}'.format(n, mean, cov)
self.assertAlmostEqual(N.mean(), mean, delta=delta, msg=errstr)
self.assertAlmostEqual(norm(N.cov()-np.eye(1)), 0, delta=delta, msg=errstr)
self.assertAlmostEqual(N.dim, 1, delta=delta, msg=errstr)
# len(mean) > 1 and cov.shape[0] > 1
mean = [0]*(n)
cov = np.eye(n)
N = NormalDistribution(mean=mean, cov=cov)
errstr = 'Failed for n = {}, mean = {} and cov = {}'.format(n, mean, cov)
self.assertAlmostEqual(N.mean(), mean, delta=delta, msg=errstr)
self.assertAlmostEqual(norm(N.cov()-cov), 0, delta=delta, msg=errstr)
self.assertAlmostEqual(N.dim, cov.shape[0], delta=delta, msg=errstr)
# len(mean) == 1 and cov.shape[0] > 1
mean = [0.]
cov = np.eye(n)
N = NormalDistribution(mean=mean, cov=cov)
errstr = 'Failed for n = {}, mean = {} and cov = {}'.format(n, mean, cov)
self.assertAlmostEqual(N.mean(), [mean[0] for i in range(cov.shape[0])], delta=delta, msg=errstr)
self.assertAlmostEqual(norm(N.cov()-cov), 0, delta=delta, msg=errstr)
self.assertAlmostEqual(N.dim, cov.shape[0], delta=delta, msg=errstr)
# mean is None and cov.shape[0] > 1
mean = None
cov = np.eye(n)
N = NormalDistribution(mean=mean, cov=cov)
errstr = 'Failed for n = {}, mean = {} and cov = {}'.format(n, mean, cov)
self.assertAlmostEqual(N.mean(), [0. for i in range(cov.shape[0])], delta=delta, msg=errstr)
self.assertAlmostEqual(norm(N.cov()-cov), 0, delta=delta, msg=errstr)
self.assertAlmostEqual(N.dim, cov.shape[0], delta=delta, msg=errstr)
# mean is a scalar and cov.shape[0] > 1
mean = 0
cov = np.eye(n)
N = NormalDistribution(mean=mean, cov=cov)
errstr = 'Failed for n = {}, mean = {} and cov = {}'.format(n, mean, cov)
self.assertAlmostEqual(N.mean(), [mean for i in range(cov.shape[0])], delta=delta, msg=errstr)
self.assertAlmostEqual(norm(N.cov()-cov), 0, delta=delta, msg=errstr)
self.assertAlmostEqual(N.dim, cov.shape[0], delta=delta, msg=errstr)
# Test for MC_samples
mean = np.random.rand(2,)
var = np.random.rand(2,)
N = NormalDistribution(mean=[mean[0], mean[1]], cov=np.array([[var[0], 0], [0, var[1]]]))
x = N.MC_samples(M=int(1e6))
# F1 = np.mean(x, axis=0)
# F2 = mean
F1 = np.var(x, axis=0)
F2 = var
delta = 1e-2
ind = np.where(np.abs(F1-F2) > delta)[:2][0]
if ind.size > 0:
errstr = 'Failed'
else:
errstr = ''
self.assertAlmostEqual(np.linalg.norm(F1-F2, ord=np.inf), 0., delta=delta, msg=errstr)
if __name__ == "__main__":
unittest.main(verbosity=2)
| 40.592105 | 105 | 0.578444 | 873 | 6,170 | 4.069874 | 0.105384 | 0.171404 | 0.106108 | 0.15508 | 0.793695 | 0.756544 | 0.749507 | 0.732057 | 0.704757 | 0.683085 | 0 | 0.023757 | 0.263209 | 6,170 | 151 | 106 | 40.860927 | 0.757809 | 0.090924 | 0 | 0.6 | 0 | 0 | 0.070569 | 0 | 0 | 0 | 0 | 0 | 0.27619 | 1 | 0.019048 | false | 0 | 0.038095 | 0 | 0.066667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
efb6d230dfc5867f6e357d1e15a58c95a38cfa5a | 4,212 | py | Python | main.py | gohan-chan69/price-alert-bot | 75c8e4e83e3706b2da1e2b13e2fa41acc8ce8768 | [
"Apache-2.0"
] | null | null | null | main.py | gohan-chan69/price-alert-bot | 75c8e4e83e3706b2da1e2b13e2fa41acc8ce8768 | [
"Apache-2.0"
] | null | null | null | main.py | gohan-chan69/price-alert-bot | 75c8e4e83e3706b2da1e2b13e2fa41acc8ce8768 | [
"Apache-2.0"
] | null | null | null | '''import requests
api_key = 'api key'
def get_price(symbol):
api_url = f'https://min-api.cryptocompare.com/data/price?fsym={symbol}&tsyms=USD&api_key={api_key}'
r = requests.get(api_url).json()
return r['USD']
def get_data(symbol):
base_url = 'https://www.cryptocompare.com'
api_url = f'https://min-api.cryptocompare.com/data/blockchain/mining/calculator?fsyms={symbol}&tsyms=USD&api_key={api_key}'
r = requests.get(api_url).json()
full_name = r['Data'][symbol]['CoinInfo']['FullName']
img_url = r['Data'][symbol]['CoinInfo']['ImageUrl']
full_img_url = base_url+img_url
url = r['Data'][symbol]['CoinInfo']['Url']
chrt_url = base_url+url
coines_Mined = r['Data'][symbol]['CoinInfo']['TotalCoinsMined']
Launch_Date = r['Data'][symbol]['CoinInfo']['AssetLaunchDate']
supply = r['Data'][symbol]['CoinInfo']['MaxSupply']
return full_name, full_img_url, chrt_url,coines_Mined,Launch_Date,supply
def send_to_discord(symbol):
price = get_price(symbol)
full_name, full_img_url, chrt_url,coines_Mined,Launch_Date,supply = get_data(symbol)
json1 = {"content": "@here","tts": False,'avatar_url': "https://cdn.discordapp.com/attachments/929686954726031393/949732158195527700/gojo_1.png","embeds": [{"type": "rich","title": symbol,"description": "all info was scraped from cryptocompare api","url": chrt_url,"color": 0xdaa6f6,"fields": [{"name": 'info!',"value": f"full_name: {full_name}\nprice: {price}\ncoines Mined: {coines_Mined}\nLaunch Date: Launch_Date\n Max Supply: {supply}"}],"author": {"author": {"url": chrt_url}},"thumbnail": {"url": full_img_url},"footer": {"text": symbol}}]}
r = requests.post('https://discord.com/api/webhooks/934629182581907546/cGgGjwBzNT0ksETDyVfpVZsHJLyifDXhL1Da1tsaiHOt_bTVQ24T_p8FCe1uqjMozOxv',json=json1)
print(r.json)
send_to_discord('ETH')'''
from email import header
from http import client
import requests
import discord
from discord.ext import commands
token = 'token here'
client = commands.Bot(command_prefix='!')
header = {
"Authorization": f'Bot {token}'
}
api_key = 'your key here'
async def get_price(symbol):
try:
api_url = f'https://min-api.cryptocompare.com/data/price?fsym={symbol}&tsyms=USD&api_key={api_key}'
r = requests.get(api_url).json()
return r['USD']
except:
pass
async def get_data(symbol):
try:
base_url = 'https://www.cryptocompare.com'
api_url = f'https://min-api.cryptocompare.com/data/blockchain/mining/calculator?fsyms={symbol}&tsyms=USD&api_key={api_key}'
r = requests.get(api_url).json()
full_name = r['Data'][symbol]['CoinInfo']['FullName']
img_url = r['Data'][symbol]['CoinInfo']['ImageUrl']
full_img_url = base_url+img_url
url = r['Data'][symbol]['CoinInfo']['Url']
chrt_url = base_url+url
coines_Mined = r['Data'][symbol]['CoinInfo']['TotalCoinsMined']
Launch_Date = r['Data'][symbol]['CoinInfo']['AssetLaunchDate']
supply = r['Data'][symbol]['CoinInfo']['MaxSupply']
return full_name, full_img_url, chrt_url,coines_Mined,Launch_Date,supply
except:
pass
@client.command()
async def price(ctx,chan_id, symbol):
price = await get_price(symbol)
full_name, full_img_url, chrt_url,coines_Mined,Launch_Date,supply = await get_data(symbol)
json1 = {"content": None,"tts": False,'avatar_url': "https://cdn.discordapp.com/attachments/929686954726031393/949732158195527700/gojo_1.png","embeds": [{"type": "rich","title": symbol,"description": "all info was scraped from cryptocompare api","url": chrt_url,"color": 0xdaa6f6,"fields": [{"name": 'info!',"value": f"full_name: {full_name}\nprice: {price}\ncoins Mined: {coines_Mined}\nLaunch Date: {Launch_Date}\n Max Supply: {supply}"}],"author": {"author": {"url": chrt_url}},"thumbnail": {"url": full_img_url},"footer": {"text": symbol}}]}
r = requests.post(f'https://discord.com/api/v9/channels/{chan_id}/messages',json=json1, headers=header)
@commands.Cog.listener()
async def on_Command_error(ctx,error):
if isinstance(error, commands.BadArgument):
await ctx.send('I could not find that member. Please try again.')
client.run(token)
| 55.421053 | 551 | 0.692783 | 577 | 4,212 | 4.878683 | 0.22877 | 0.056838 | 0.046892 | 0.080995 | 0.724689 | 0.706927 | 0.706927 | 0.706927 | 0.706927 | 0.706927 | 0 | 0.030014 | 0.129867 | 4,212 | 75 | 552 | 56.16 | 0.738063 | 0.437797 | 0 | 0.177778 | 0 | 0.066667 | 0.368957 | 0.00933 | 0 | 0 | 0.003393 | 0 | 0 | 1 | 0 | false | 0.044444 | 0.111111 | 0 | 0.155556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
efd3898d6ce09666aaced91c47b15108026efc77 | 150 | py | Python | rest_models/__init__.py | LCOGT/django-rest-models | bb0b507cfedd8f6cc71b6532c629ef9e86784103 | [
"BSD-2-Clause"
] | null | null | null | rest_models/__init__.py | LCOGT/django-rest-models | bb0b507cfedd8f6cc71b6532c629ef9e86784103 | [
"BSD-2-Clause"
] | null | null | null | rest_models/__init__.py | LCOGT/django-rest-models | bb0b507cfedd8f6cc71b6532c629ef9e86784103 | [
"BSD-2-Clause"
] | null | null | null | __VERSION__ = '1.9.3'
try:
from rest_models.checks import register_checks
register_checks()
except ImportError: # pragma: no cover
pass
| 18.75 | 50 | 0.72 | 20 | 150 | 5.05 | 0.85 | 0.277228 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025 | 0.2 | 150 | 7 | 51 | 21.428571 | 0.816667 | 0.106667 | 0 | 0 | 0 | 0 | 0.037879 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.166667 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 5 |
efe96ffa7d9e9c1beb6de953be48164f35987a8c | 203 | py | Python | core_lib/error_handling/status_code_exception.py | shubham-surya/core-lib | 543db80706746a937e5ed16bd50f2de8d58b32e4 | [
"MIT"
] | null | null | null | core_lib/error_handling/status_code_exception.py | shubham-surya/core-lib | 543db80706746a937e5ed16bd50f2de8d58b32e4 | [
"MIT"
] | 9 | 2021-03-11T02:29:17.000Z | 2022-03-22T19:01:18.000Z | core_lib/error_handling/status_code_exception.py | shubham-surya/core-lib | 543db80706746a937e5ed16bd50f2de8d58b32e4 | [
"MIT"
] | 2 | 2022-01-27T11:19:00.000Z | 2022-02-11T11:33:09.000Z | class StatusCodeException(Exception):
def __init__(self, status_code: int, *args, **kwargs):
self.status_code = status_code
super(StatusCodeException, self).__init__(*args, **kwargs)
| 40.6 | 66 | 0.70936 | 22 | 203 | 6.045455 | 0.545455 | 0.225564 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.167488 | 203 | 4 | 67 | 50.75 | 0.786982 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
4bd0172262391410d8f6ecd51b20153e472e6f0a | 51 | py | Python | clock.py | varianone/sample-python-app | d03324a4ff54bb662013a7f6fe701e38551250a5 | [
"MIT"
] | 8 | 2019-09-02T15:34:18.000Z | 2022-02-21T03:56:24.000Z | clock.py | varianone/sample-python-app | d03324a4ff54bb662013a7f6fe701e38551250a5 | [
"MIT"
] | 2 | 2020-09-25T05:43:24.000Z | 2021-06-25T15:24:56.000Z | clock.py | varianone/sample-python-app | d03324a4ff54bb662013a7f6fe701e38551250a5 | [
"MIT"
] | 2 | 2021-05-19T11:03:19.000Z | 2021-06-11T19:18:04.000Z | print('This job is run every day at 6pm by uWSGI')
| 25.5 | 50 | 0.72549 | 11 | 51 | 3.363636 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02439 | 0.196078 | 51 | 1 | 51 | 51 | 0.878049 | 0 | 0 | 0 | 0 | 0 | 0.803922 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
4bd8cafbc13d2d57cb60bc29c6ac98bc654d198d | 94 | py | Python | test.py | JaksoSoftware/jakso-ml | 5720ea557ca2fcf9ae16e329c198acd8e31258c4 | [
"MIT"
] | null | null | null | test.py | JaksoSoftware/jakso-ml | 5720ea557ca2fcf9ae16e329c198acd8e31258c4 | [
"MIT"
] | 3 | 2020-09-25T18:40:52.000Z | 2021-08-25T14:44:30.000Z | test.py | JaksoSoftware/jakso-ml | 5720ea557ca2fcf9ae16e329c198acd8e31258c4 | [
"MIT"
] | null | null | null | from tests.training_data.sample_image import TestSampleImage
import unittest
unittest.main()
| 18.8 | 60 | 0.861702 | 12 | 94 | 6.583333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.085106 | 94 | 4 | 61 | 23.5 | 0.918605 | 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 | 1 | 0 | 0 | 5 |
4bf10162900625be45f02bd494892ae7b3a16109 | 203 | py | Python | bubblekicker/__init__.py | gbellandi/bubble_size_analysis | 6627f516f65c7d9900e4932913583e1283198f07 | [
"MIT"
] | 4 | 2017-08-03T03:48:59.000Z | 2022-03-24T10:51:48.000Z | bubblekicker/__init__.py | gbellandi/bubble_size_analysis | 6627f516f65c7d9900e4932913583e1283198f07 | [
"MIT"
] | 6 | 2016-10-26T14:25:39.000Z | 2021-04-12T15:26:03.000Z | bubblekicker/__init__.py | gbellandi/bubble_size_analysis | 6627f516f65c7d9900e4932913583e1283198f07 | [
"MIT"
] | 6 | 2016-12-20T10:13:23.000Z | 2021-04-16T21:57:51.000Z |
from bubblekicker import BubbleKicker
from pipelines import CannyPipeline, AdaptiveThresholdPipeline
from utils import (calculate_convexity,
calculate_circularity_reciprocal)
| 29 | 63 | 0.773399 | 17 | 203 | 9.058824 | 0.647059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.206897 | 203 | 6 | 64 | 33.833333 | 0.956522 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
4bf823dba4cac29f89ffc8baa0ce25aa1bee1439 | 106 | py | Python | other_tests/imports.py | nuua-io/Nuua | d74bec22d09d25f2bc0ced8d7c9a154ff84a874d | [
"MIT"
] | 43 | 2018-11-17T02:08:09.000Z | 2022-03-03T14:50:02.000Z | other_tests/imports.py | nuua-io/Nuua | d74bec22d09d25f2bc0ced8d7c9a154ff84a874d | [
"MIT"
] | 2 | 2019-08-07T03:16:51.000Z | 2021-05-17T03:05:08.000Z | other_tests/imports.py | nuua-io/Nuua | d74bec22d09d25f2bc0ced8d7c9a154ff84a874d | [
"MIT"
] | 3 | 2019-01-07T18:43:35.000Z | 2021-07-21T12:12:23.000Z | from sample_import import sample, sample2
import imports2
print(f"Sample: {sample}, Sample2: {sample2}")
| 21.2 | 46 | 0.773585 | 14 | 106 | 5.785714 | 0.5 | 0.320988 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.042553 | 0.113208 | 106 | 4 | 47 | 26.5 | 0.819149 | 0 | 0 | 0 | 0 | 0 | 0.339623 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0.333333 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
4bfa5001622a87d0c541dc27547faabfbf409823 | 166 | py | Python | tests/conftest.py | Mendes11/micro_framework | dfb9f7a55922284e70f6937dd478a1edaacd83b7 | [
"Apache-2.0"
] | 7 | 2020-05-20T21:19:02.000Z | 2021-12-28T17:50:50.000Z | tests/conftest.py | Mendes11/micro_framework | dfb9f7a55922284e70f6937dd478a1edaacd83b7 | [
"Apache-2.0"
] | 30 | 2020-06-07T20:20:11.000Z | 2021-06-03T14:58:41.000Z | tests/conftest.py | Mendes11/micro_framework | dfb9f7a55922284e70f6937dd478a1edaacd83b7 | [
"Apache-2.0"
] | null | null | null | import pytest
from micro_framework.config import DEFAULT_CONFIG
from micro_framework.runner import Runner
@pytest.fixture
def config():
return DEFAULT_CONFIG
| 15.090909 | 49 | 0.819277 | 22 | 166 | 6 | 0.5 | 0.136364 | 0.272727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138554 | 166 | 10 | 50 | 16.6 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | true | 0 | 0.5 | 0.166667 | 0.833333 | 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 | 0 | 1 | 1 | 0 | 0 | 0 | 5 |
ef11ffb86400b42d7cb25303b4c95d2b102cc590 | 96 | py | Python | venv/lib/python3.8/site-packages/urllib3/util/queue.py | GiulianaPola/select_repeats | 17a0d053d4f874e42cf654dd142168c2ec8fbd11 | [
"MIT"
] | 2 | 2022-03-13T01:58:52.000Z | 2022-03-31T06:07:54.000Z | venv/lib/python3.8/site-packages/urllib3/util/queue.py | DesmoSearch/Desmobot | b70b45df3485351f471080deb5c785c4bc5c4beb | [
"MIT"
] | 19 | 2021-11-20T04:09:18.000Z | 2022-03-23T15:05:55.000Z | venv/lib/python3.8/site-packages/urllib3/util/queue.py | DesmoSearch/Desmobot | b70b45df3485351f471080deb5c785c4bc5c4beb | [
"MIT"
] | null | null | null | /home/runner/.cache/pip/pool/9d/18/17/f3f797fbf564bf1a17d3de905a8cfc3ecd101d4004c482c263fecf9dc3 | 96 | 96 | 0.895833 | 9 | 96 | 9.555556 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | 0 | 96 | 1 | 96 | 96 | 0.520833 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
ef274829300a533f55be65269109b1638459b7cf | 115 | py | Python | metabolite_database/main/__init__.py | lparsons/metabolite_database | f1a5aa3e31d00e13ba4862e5cbb666b44dc67ce0 | [
"MIT"
] | null | null | null | metabolite_database/main/__init__.py | lparsons/metabolite_database | f1a5aa3e31d00e13ba4862e5cbb666b44dc67ce0 | [
"MIT"
] | 9 | 2018-12-20T18:17:53.000Z | 2019-03-08T22:25:10.000Z | metabolite_database/main/__init__.py | lparsons/metabolite_database | f1a5aa3e31d00e13ba4862e5cbb666b44dc67ce0 | [
"MIT"
] | 1 | 2020-12-04T14:21:37.000Z | 2020-12-04T14:21:37.000Z | from flask import Blueprint
bp = Blueprint('main', __name__)
from metabolite_database.main import routes # noqa
| 19.166667 | 51 | 0.782609 | 15 | 115 | 5.666667 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147826 | 115 | 5 | 52 | 23 | 0.867347 | 0.034783 | 0 | 0 | 0 | 0 | 0.036697 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0.666667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 5 |
3227746c4e02a056e50c39a8d2bf3662f4fe383f | 65 | py | Python | ktg2/models/enums/__init__.py | kkristof200/py_telegram_2 | 6be1940d836f1c262e148b782c3f7c483c901b0b | [
"MIT"
] | null | null | null | ktg2/models/enums/__init__.py | kkristof200/py_telegram_2 | 6be1940d836f1c262e148b782c3f7c483c901b0b | [
"MIT"
] | null | null | null | ktg2/models/enums/__init__.py | kkristof200/py_telegram_2 | 6be1940d836f1c262e148b782c3f7c483c901b0b | [
"MIT"
] | null | null | null | from .chat_type import ChatType
from .parse_mode import ParseMode | 32.5 | 33 | 0.861538 | 10 | 65 | 5.4 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.107692 | 65 | 2 | 33 | 32.5 | 0.931034 | 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 | 1 | 0 | 0 | 5 |
32853a60a60c70ef58615bb73525854eb204b329 | 74 | py | Python | mister/__init__.py | guillochon/mister | 346bc06232625a16f1f1af8268fe8afc1cbddbb9 | [
"MIT"
] | null | null | null | mister/__init__.py | guillochon/mister | 346bc06232625a16f1f1af8268fe8afc1cbddbb9 | [
"MIT"
] | null | null | null | mister/__init__.py | guillochon/mister | 346bc06232625a16f1f1af8268fe8afc1cbddbb9 | [
"MIT"
] | null | null | null | """Initialize mister package."""
from .mister import * # noqa: F401,F403
| 24.666667 | 40 | 0.689189 | 9 | 74 | 5.666667 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.095238 | 0.148649 | 74 | 2 | 41 | 37 | 0.714286 | 0.581081 | 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 | 1 | 0 | 0 | 5 |
3292dbc291dbf8d6535daa9836a94c4c41bcbbdb | 105 | py | Python | ShaderDemo/game/shader/gpu/__init__.py | bitsawer/renpy-shader | 6c750689a3d7952494a3b98a3297762bb4933308 | [
"MIT"
] | 45 | 2016-10-04T05:03:23.000Z | 2022-02-09T13:20:38.000Z | ShaderDemo/game/shader/gpu/__init__.py | bitsawer/renpy-shader | 6c750689a3d7952494a3b98a3297762bb4933308 | [
"MIT"
] | 4 | 2016-10-04T13:35:15.000Z | 2020-07-13T10:46:31.000Z | ShaderDemo/game/shader/gpu/__init__.py | bitsawer/renpy-shader | 6c750689a3d7952494a3b98a3297762bb4933308 | [
"MIT"
] | 10 | 2017-02-16T04:36:53.000Z | 2021-04-10T08:31:29.000Z |
from framebuffer import FrameBuffer
from shaderprogram import ShaderProgram
from texture import Texture
| 21 | 39 | 0.87619 | 12 | 105 | 7.666667 | 0.416667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12381 | 105 | 4 | 40 | 26.25 | 1 | 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 | 1 | 0 | 0 | 5 |
32b079caf1aa85cc50ffbc5768ac82373e59c000 | 176 | py | Python | pyhaversion/__init__.py | bdraco/pyhaversion | 87851f8fe868c1a5d5cdcdd56a1064031d37e220 | [
"MIT"
] | 4 | 2020-12-30T23:34:37.000Z | 2021-11-08T09:13:45.000Z | pyhaversion/__init__.py | bdraco/pyhaversion | 87851f8fe868c1a5d5cdcdd56a1064031d37e220 | [
"MIT"
] | 27 | 2019-08-27T08:05:18.000Z | 2022-03-18T06:05:49.000Z | pyhaversion/__init__.py | bdraco/pyhaversion | 87851f8fe868c1a5d5cdcdd56a1064031d37e220 | [
"MIT"
] | 9 | 2019-07-02T06:19:46.000Z | 2021-11-04T16:18:42.000Z | """pyhaversion package."""
from .consts import HaVersionChannel, HaVersionSource
from .version import HaVersion
__all__ = ["HaVersion", "HaVersionChannel", "HaVersionSource"]
| 29.333333 | 62 | 0.784091 | 15 | 176 | 8.933333 | 0.666667 | 0.462687 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096591 | 176 | 5 | 63 | 35.2 | 0.842767 | 0.113636 | 0 | 0 | 0 | 0 | 0.266667 | 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 | 1 | 0 | 0 | 5 |
0865c95571d4efba71126b7e333489daa9f2d532 | 58 | py | Python | notetool/database/__init__.py | notechats/noteutil | bf58e0e3575dac18fff2f4cfcd7fa5ae2f1662fb | [
"Apache-2.0"
] | 1 | 2020-08-05T07:45:00.000Z | 2020-08-05T07:45:00.000Z | notetool/database/__init__.py | notechats/notetool | bf58e0e3575dac18fff2f4cfcd7fa5ae2f1662fb | [
"Apache-2.0"
] | null | null | null | notetool/database/__init__.py | notechats/notetool | bf58e0e3575dac18fff2f4cfcd7fa5ae2f1662fb | [
"Apache-2.0"
] | null | null | null | from notetool.database.core import BaseTable, SqliteTable
| 29 | 57 | 0.862069 | 7 | 58 | 7.142857 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.086207 | 58 | 1 | 58 | 58 | 0.943396 | 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 | 1 | 0 | 0 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.