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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c7349ec685ce1af0110178abaaf2eb1878a5bd71
| 106
|
py
|
Python
|
Src/main.py
|
DukeA/DAT02X-19-03-MachineLearning-Starcraft2
|
ade31deb4cf6cacd0c411c39310aeb1300561936
|
[
"MIT"
] | null | null | null |
Src/main.py
|
DukeA/DAT02X-19-03-MachineLearning-Starcraft2
|
ade31deb4cf6cacd0c411c39310aeb1300561936
|
[
"MIT"
] | null | null | null |
Src/main.py
|
DukeA/DAT02X-19-03-MachineLearning-Starcraft2
|
ade31deb4cf6cacd0c411c39310aeb1300561936
|
[
"MIT"
] | null | null | null |
from absl import app
from mainLoop import main
if __name__ == '__main__':
app.run(main)
| 13.25
| 27
| 0.632075
| 14
| 106
| 4.214286
| 0.642857
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.292453
| 106
| 7
| 28
| 15.142857
| 0.786667
| 0
| 0
| 0
| 0
| 0
| 0.081633
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
c7508c28b649dccba896625618759517bbe0fd13
| 161
|
py
|
Python
|
pyclustering/container/examples/__init__.py
|
JosephChataignon/pyclustering
|
bf4f51a472622292627ec8c294eb205585e50f52
|
[
"BSD-3-Clause"
] | 1,013
|
2015-01-26T19:50:14.000Z
|
2022-03-31T07:38:48.000Z
|
pyclustering/container/examples/__init__.py
|
peterlau0626/pyclustering
|
bf4f51a472622292627ec8c294eb205585e50f52
|
[
"BSD-3-Clause"
] | 542
|
2015-01-20T16:44:32.000Z
|
2022-01-29T14:57:20.000Z
|
pyclustering/container/examples/__init__.py
|
peterlau0626/pyclustering
|
bf4f51a472622292627ec8c294eb205585e50f52
|
[
"BSD-3-Clause"
] | 262
|
2015-03-19T07:28:12.000Z
|
2022-03-30T07:28:24.000Z
|
"""!
@brief Collection of examples devoted to containers.
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
"""
| 17.888889
| 53
| 0.714286
| 20
| 161
| 5.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.067164
| 0.167702
| 161
| 9
| 54
| 17.888889
| 0.791045
| 0.900621
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c7651286d18c5a48356115767024669710aad666
| 29
|
py
|
Python
|
python/testData/intentions/PyAnnotateVariableTypeIntentionTest/annotationTupleType.py
|
truthiswill/intellij-community
|
fff88cfb0dc168eea18ecb745d3e5b93f57b0b95
|
[
"Apache-2.0"
] | 2
|
2019-04-28T07:48:50.000Z
|
2020-12-11T14:18:08.000Z
|
python/testData/intentions/PyAnnotateVariableTypeIntentionTest/annotationTupleType.py
|
truthiswill/intellij-community
|
fff88cfb0dc168eea18ecb745d3e5b93f57b0b95
|
[
"Apache-2.0"
] | 173
|
2018-07-05T13:59:39.000Z
|
2018-08-09T01:12:03.000Z
|
python/testData/intentions/PyAnnotateVariableTypeIntentionTest/annotationTupleType.py
|
truthiswill/intellij-community
|
fff88cfb0dc168eea18ecb745d3e5b93f57b0b95
|
[
"Apache-2.0"
] | 2
|
2020-03-15T08:57:37.000Z
|
2020-04-07T04:48:14.000Z
|
v<caret>ar = (1, 'foo', None)
| 29
| 29
| 0.551724
| 6
| 29
| 2.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.04
| 0.137931
| 29
| 1
| 29
| 29
| 0.6
| 0
| 0
| 0
| 0
| 0
| 0.1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c79748fa89a41d17ad6e31fcee8a32474231a1c4
| 27
|
py
|
Python
|
tests/unit/providers/callables/__init__.py
|
YelloFam/python-dependency-injector
|
541131e33858ee1b8b5a7590d2bb9f929740ea1e
|
[
"BSD-3-Clause"
] | null | null | null |
tests/unit/providers/callables/__init__.py
|
YelloFam/python-dependency-injector
|
541131e33858ee1b8b5a7590d2bb9f929740ea1e
|
[
"BSD-3-Clause"
] | null | null | null |
tests/unit/providers/callables/__init__.py
|
YelloFam/python-dependency-injector
|
541131e33858ee1b8b5a7590d2bb9f929740ea1e
|
[
"BSD-3-Clause"
] | null | null | null |
"""Tests for callables."""
| 13.5
| 26
| 0.62963
| 3
| 27
| 5.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 27
| 1
| 27
| 27
| 0.708333
| 0.740741
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c7aa99e86ce9b9941bb3c2dee52be602130563cd
| 200
|
py
|
Python
|
app/__init__.py
|
geirowew/SapAPI
|
dda0d839722d28c7a30d58c8b3d5076a503fd837
|
[
"MIT"
] | 1
|
2021-10-11T20:20:50.000Z
|
2021-10-11T20:20:50.000Z
|
app/__init__.py
|
geirowew/SapAPI
|
dda0d839722d28c7a30d58c8b3d5076a503fd837
|
[
"MIT"
] | null | null | null |
app/__init__.py
|
geirowew/SapAPI
|
dda0d839722d28c7a30d58c8b3d5076a503fd837
|
[
"MIT"
] | 2
|
2021-01-22T10:52:04.000Z
|
2021-10-06T10:28:07.000Z
|
from flask import Flask
#from config import Config
import config
app = Flask(__name__)
#app.config.from_object(Config)
app.config.from_object(config)
#from app import routes
from app import gettoken
| 20
| 31
| 0.81
| 31
| 200
| 5.032258
| 0.290323
| 0.192308
| 0.230769
| 0.24359
| 0.320513
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12
| 200
| 10
| 32
| 20
| 0.886364
| 0.385
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.6
| 0
| 0.6
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
c7ba815c300287faa117210ec887325390625523
| 114
|
py
|
Python
|
nautapy/__init__.py
|
armandofcom/nautapy
|
6907e350021752b54998f6b0b5674dccc8ca9ddd
|
[
"MIT"
] | 25
|
2020-03-20T05:02:09.000Z
|
2022-03-29T13:24:36.000Z
|
nautapy/__init__.py
|
armandofcom/nautapy
|
6907e350021752b54998f6b0b5674dccc8ca9ddd
|
[
"MIT"
] | 7
|
2020-01-22T23:10:25.000Z
|
2021-06-02T21:41:27.000Z
|
nautapy/__init__.py
|
armandofcom/nautapy
|
6907e350021752b54998f6b0b5674dccc8ca9ddd
|
[
"MIT"
] | 14
|
2020-03-20T05:02:18.000Z
|
2022-03-29T13:24:39.000Z
|
import os
appdata_path = os.path.expanduser("~/.local/share/nautapy")
os.makedirs(appdata_path, exist_ok=True)
| 16.285714
| 59
| 0.763158
| 17
| 114
| 4.941176
| 0.705882
| 0.261905
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.087719
| 114
| 6
| 60
| 19
| 0.807692
| 0
| 0
| 0
| 0
| 0
| 0.19469
| 0.19469
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
c7cb28d53e6c7e1382fc471314a689bf2b0e9252
| 172
|
py
|
Python
|
athena/athena/errors.py
|
aculich/openmappr
|
c9e5b4cfc974a6eda9cbc8a0ea6f8a96ce35efba
|
[
"MIT"
] | 19
|
2018-04-05T23:33:33.000Z
|
2022-03-24T00:18:20.000Z
|
athena/athena/errors.py
|
aculich/openmappr
|
c9e5b4cfc974a6eda9cbc8a0ea6f8a96ce35efba
|
[
"MIT"
] | 13
|
2018-01-10T23:31:11.000Z
|
2018-07-20T12:55:02.000Z
|
athena/athena/errors.py
|
aculich/openmappr
|
c9e5b4cfc974a6eda9cbc8a0ea6f8a96ce35efba
|
[
"MIT"
] | 5
|
2018-02-12T05:33:19.000Z
|
2019-09-21T22:43:02.000Z
|
class AthenaError(Exception):
"""base class for all athena exceptions"""
pass
class AthenaMongoError(AthenaError):
"""Class for all mongo related errors"""
pass
| 21.5
| 46
| 0.726744
| 20
| 172
| 6.25
| 0.65
| 0.128
| 0.176
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.168605
| 172
| 8
| 47
| 21.5
| 0.874126
| 0.412791
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
c7f39bdc2218cef3b2fe963ee01b122a395a8bc3
| 227
|
py
|
Python
|
tests/repositories/helpers/methods/test_reinstall_if_needed.py
|
traibnn/integration
|
cf5920a677fdaa8408074e533371141828b0b30f
|
[
"MIT"
] | 1
|
2021-07-31T00:34:30.000Z
|
2021-07-31T00:34:30.000Z
|
tests/repositories/helpers/methods/test_reinstall_if_needed.py
|
traibnn/integration
|
cf5920a677fdaa8408074e533371141828b0b30f
|
[
"MIT"
] | 45
|
2021-07-21T13:32:44.000Z
|
2022-03-28T06:15:40.000Z
|
tests/repositories/helpers/methods/test_reinstall_if_needed.py
|
traibnn/integration
|
cf5920a677fdaa8408074e533371141828b0b30f
|
[
"MIT"
] | null | null | null |
import pytest
@pytest.mark.asyncio
async def test_reinstall_if_needed(repository):
repository.content.path.local = "/non/existing/dir"
repository.data.installed = True
await repository.async_reinstall_if_needed()
| 25.222222
| 55
| 0.784141
| 29
| 227
| 5.931034
| 0.724138
| 0.127907
| 0.197674
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.123348
| 227
| 8
| 56
| 28.375
| 0.864322
| 0
| 0
| 0
| 0
| 0
| 0.07489
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.166667
| 0
| 0.166667
| 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
| 0
| 0
| 0
| 0
|
0
| 4
|
1bf0738223b67b02abba6e6aa0c92e93cd84b652
| 470
|
py
|
Python
|
mtstub.py
|
shimniok/rockblock
|
7a84d7da7df34c2dbe1a288fb6de24558eb4485f
|
[
"MIT"
] | 1
|
2020-05-30T01:29:06.000Z
|
2020-05-30T01:29:06.000Z
|
mtstub.py
|
shimniok/rockblock
|
7a84d7da7df34c2dbe1a288fb6de24558eb4485f
|
[
"MIT"
] | 1
|
2017-10-16T03:30:55.000Z
|
2018-01-14T19:05:43.000Z
|
mtstub.py
|
shimniok/rockblock
|
7a84d7da7df34c2dbe1a288fb6de24558eb4485f
|
[
"MIT"
] | 1
|
2019-08-05T10:31:46.000Z
|
2019-08-05T10:31:46.000Z
|
#!/usr/bin/env python
##################################################################################################
## mtstub.py
##
## emulates rockblock api so I don't have to burn credits testing...
##################################################################################################
import cgi
#import cgitb; cgitb.enable() # for troubleshooting
import config
print "Content-type: plain/text"
print
form = cgi.FieldStorage()
print "OK,12345"
| 24.736842
| 98
| 0.417021
| 40
| 470
| 4.9
| 0.85
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011737
| 0.093617
| 470
| 18
| 99
| 26.111111
| 0.448357
| 0.310638
| 0
| 0
| 0
| 0
| 0.268908
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.333333
| null | null | 0.5
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 1
|
0
| 4
|
1bf69ac1479d462fb413d5e64a7b2f979173894e
| 5,091
|
py
|
Python
|
t_core/tc_python/xrule.py
|
levilucio/SyVOLT
|
7526ec794d21565e3efcc925a7b08ae8db27d46a
|
[
"MIT"
] | 3
|
2017-06-02T19:26:27.000Z
|
2021-06-14T04:25:45.000Z
|
t_core/tc_python/xrule.py
|
levilucio/SyVOLT
|
7526ec794d21565e3efcc925a7b08ae8db27d46a
|
[
"MIT"
] | 8
|
2016-08-24T07:04:07.000Z
|
2017-05-26T16:22:47.000Z
|
t_core/tc_python/xrule.py
|
levilucio/SyVOLT
|
7526ec794d21565e3efcc925a7b08ae8db27d46a
|
[
"MIT"
] | 1
|
2019-10-31T06:00:23.000Z
|
2019-10-31T06:00:23.000Z
|
from util.infinity import INFINITY
from tc_python.arule import ARule
from t_core.rollbacker import Rollbacker
from t_core.resolver import Resolver
class XRule(ARule):
'''
Applies the transformation on one match with roll-back capability.
'''
def __init__(self, LHS, RHS, max_iterations=INFINITY):
'''
Applies the transformation on one match with roll-back capability.
@param LHS: The pre-condition pattern (LHS + NACs).
@param RHS: The post-condition pattern (RHS).
'''
# external_matches_only=True because further matches of this rule are only processed after a roll-back
super(XRule, self).__init__(LHS, RHS)
self.M.max = max_iterations
self.I.max_iterations = max_iterations
self.B = Rollbacker(condition=LHS, max_iterations=max_iterations)
def packet_in(self, packet):
self.exception = None
self.is_success = False
# Checkpoint the original packet
self.B.packet_in(packet)
if not self.B.is_success:
self.exception = self.B.exception
return packet
# Match
packet = self.M.packet_in(packet)
if not self.M.is_success:
packet = self.B.restore(packet)
if self.M.exception:
self.exception = self.M.exception
elif self.B.exception:
self.exception = self.B.exception
return packet
# Choose one match
packet = self.I.packet_in(packet)
if not self.I.is_success:
packet = self.B.restore(packet)
if self.I.exception:
self.exception = self.I.exception
elif self.B.exception:
self.exception = self.B.exception
return packet
# Rewrite
packet = self.W.packet_in(packet)
if not self.W.is_success:
packet = self.B.restore(packet)
if self.W.exception:
self.exception = self.W.exception
elif self.B.exception:
self.exception = self.B.exception
return packet
self.is_success = True
return packet
def next_in(self, packet):
self.exception = None
self.is_success = False
packet = self.B.next_in(packet)
if not self.B.is_success:
self.exception = self.B.exception
return packet
# Choose the next match
packet = self.I.packet_in(packet)
if not self.I.is_success:
packet = self.B.next_in(packet)
if self.I.exception:
self.exception = self.I.exception
elif self.B.exception:
self.exception = self.B.exception
return packet
# Rewrite
packet = self.W.packet_in(packet)
if not self.W.is_success:
packet = self.B.next_in(packet)
if self.W.exception:
self.exception = self.W.exception
elif self.B.exception:
self.exception = self.B.exception
return packet
# Output success packet
self.is_success = True
return packet
class XRule_r(XRule):
'''
Applies the transformation on one match with roll-back capability.
'''
def __init__(self, LHS, RHS, external_matches_only=False, custom_resolution=lambda packet: False):
'''
Applies the transformation on one match with roll-back capability.
@param LHS: The pre-condition pattern (LHS + NACs).
@param RHS: The post-condition pattern (RHS).
@param external_matches_only: Resolve conflicts ignoring the matches found in this ARule.
@param custom_resolution: Override the default resolution function.
'''
super(XRule_r, self).__init__()
self.R = Resolver(external_matches_only=external_matches_only,
custom_resolution=custom_resolution)
def packet_in(self, packet):
packet = super(XRule_r, self).packet_in(packet)
# is_success is True
if self.exception is None:
# Resolve any conflicts if necessary
packet = self.R.packet_in(packet)
if not self.R.is_success:
self.exception = self.R.exception
return packet
# Output success packet
else:
self.is_success = False
return packet
def next_in(self, packet):
packet = super(XRule_r, self).next_in(packet)
# is_success is True
if self.exception is None:
# Resolve any conflicts if necessary
packet = self.R.packet_in(packet)
if not self.R.is_success:
self.exception = self.R.exception
return packet
# Output success packet
else:
self.is_success = False
return packet
| 37.433824
| 111
| 0.575329
| 593
| 5,091
| 4.809444
| 0.145025
| 0.109397
| 0.08345
| 0.091164
| 0.72791
| 0.721599
| 0.706872
| 0.674264
| 0.646914
| 0.628331
| 0
| 0
| 0.351208
| 5,091
| 135
| 112
| 37.711111
| 0.863457
| 0.194264
| 0
| 0.763441
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.064516
| false
| 0
| 0.043011
| 0
| 0.268817
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
1bff3ce09a664d524ed5b17fd85a06acad12da24
| 195
|
py
|
Python
|
libs/imgutils.py
|
EpicKiwi/projet-datascience
|
90b59fc674fc2146634d1c1681f9b65083a7aa91
|
[
"MIT"
] | null | null | null |
libs/imgutils.py
|
EpicKiwi/projet-datascience
|
90b59fc674fc2146634d1c1681f9b65083a7aa91
|
[
"MIT"
] | null | null | null |
libs/imgutils.py
|
EpicKiwi/projet-datascience
|
90b59fc674fc2146634d1c1681f9b65083a7aa91
|
[
"MIT"
] | 2
|
2020-01-14T07:53:50.000Z
|
2020-01-14T12:24:35.000Z
|
import cv2
def img_path2array(path):
return cv2.cvtColor(cv2.imread(path, 10), cv2.COLOR_BGR2RGB)
def img_array2file(path, array):
cv2.imwrite(path, cv2.cvtColor(array, cv2.COLOR_RGB2BGR))
| 27.857143
| 64
| 0.769231
| 30
| 195
| 4.866667
| 0.533333
| 0.082192
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.074286
| 0.102564
| 195
| 7
| 65
| 27.857143
| 0.76
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0.2
| 0.2
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
402e10f9fc439179bd0a8ffc8b3cd706de061b93
| 251
|
py
|
Python
|
tfl_data.py
|
dongyan1024/overtime
|
4f722a823585890026fe9584ba5985963b2a586c
|
[
"MIT"
] | 9
|
2020-10-15T13:53:36.000Z
|
2022-03-08T12:08:09.000Z
|
tfl_data.py
|
dongyan1024/overtime
|
4f722a823585890026fe9584ba5985963b2a586c
|
[
"MIT"
] | 6
|
2021-02-07T15:43:12.000Z
|
2021-04-24T04:03:39.000Z
|
tfl_data.py
|
dongyan1024/overtime
|
4f722a823585890026fe9584ba5985963b2a586c
|
[
"MIT"
] | 7
|
2020-10-15T13:55:12.000Z
|
2022-03-12T03:54:02.000Z
|
import overtime as ot
times = ['14:00','14:05', '14:10', '14:15', '14:20', '14:25', '14:30', '14:35', '14:40', '14:45', '14:50', '14:55']
tfl_data = ot.TflInput(['victoria', 'central', 'bakerloo', 'piccadilly'], ['inbound', 'outbound'], times)
| 41.833333
| 116
| 0.565737
| 40
| 251
| 3.525
| 0.675
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.220183
| 0.131474
| 251
| 5
| 117
| 50.2
| 0.426606
| 0
| 0
| 0
| 0
| 0
| 0.440816
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
404408dcaaf3ec9278595ad0836bc4bc90af7ec0
| 81
|
py
|
Python
|
asf_search/constants/DATASET/__init__.py
|
jhkennedy/Discovery-asf_search
|
4ec45e8a85cd626ea92f83937df9f8f04e0f7f4f
|
[
"BSD-3-Clause"
] | null | null | null |
asf_search/constants/DATASET/__init__.py
|
jhkennedy/Discovery-asf_search
|
4ec45e8a85cd626ea92f83937df9f8f04e0f7f4f
|
[
"BSD-3-Clause"
] | 1
|
2021-04-01T16:30:56.000Z
|
2021-04-01T16:30:56.000Z
|
asf_search/constants/DATASET/__init__.py
|
jhkennedy/Discovery-asf_search
|
4ec45e8a85cd626ea92f83937df9f8f04e0f7f4f
|
[
"BSD-3-Clause"
] | null | null | null |
"""Datasets to be used in search and related functions"""
from .DATASET import *
| 27
| 57
| 0.740741
| 12
| 81
| 5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.160494
| 81
| 3
| 58
| 27
| 0.882353
| 0.62963
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
406b1ddec2cc13a47e3515d6e9a2b41aa445fd1b
| 76
|
py
|
Python
|
cookietemple/create/templates/cli/cli_python/{{ cookiecutter.project_slug_no_hyphen }}/tests/__init__.py
|
e2jk/cookietemple
|
86af5622cdabe9ae446048536571898716939f29
|
[
"Apache-2.0"
] | 117
|
2020-11-23T02:07:23.000Z
|
2022-03-21T16:14:53.000Z
|
cookietemple/create/templates/cli/cli_python/{{ cookiecutter.project_slug_no_hyphen }}/tests/__init__.py
|
e2jk/cookietemple
|
86af5622cdabe9ae446048536571898716939f29
|
[
"Apache-2.0"
] | 226
|
2020-10-19T19:58:13.000Z
|
2022-03-27T18:54:30.000Z
|
cookietemple/create/templates/cli/cli_python/{{ cookiecutter.project_slug_no_hyphen }}/tests/__init__.py
|
e2jk/cookietemple
|
86af5622cdabe9ae446048536571898716939f29
|
[
"Apache-2.0"
] | 9
|
2020-11-24T12:45:10.000Z
|
2022-03-13T15:58:23.000Z
|
"""Test suite for the {{ cookiecutter.project_slug_no_hyphen }} package."""
| 38
| 75
| 0.736842
| 10
| 76
| 5.3
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 76
| 1
| 76
| 76
| 0.779412
| 0.907895
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
407dc792a754cf8c4cf33cd4fb3c31fe49507ba3
| 9,201
|
py
|
Python
|
sample-input/homogeneous/geometry.py
|
AI-Pranto/OpenMOC
|
7f6ce4797aec20ddd916981a56a4ba54ffda9a06
|
[
"MIT"
] | 97
|
2015-01-02T02:13:45.000Z
|
2022-03-09T14:12:45.000Z
|
sample-input/homogeneous/geometry.py
|
AI-Pranto/OpenMOC
|
7f6ce4797aec20ddd916981a56a4ba54ffda9a06
|
[
"MIT"
] | 325
|
2015-01-07T17:43:14.000Z
|
2022-02-21T17:22:00.000Z
|
sample-input/homogeneous/geometry.py
|
AI-Pranto/OpenMOC
|
7f6ce4797aec20ddd916981a56a4ba54ffda9a06
|
[
"MIT"
] | 73
|
2015-01-17T19:11:58.000Z
|
2022-03-24T16:31:37.000Z
|
import openmoc
import openmoc.log as log
import openmoc.plotter as plotter
import openmoc.materialize as materialize
log.set_log_level('NORMAL')
###############################################################################
########################### Creating Materials ############################
###############################################################################
log.py_printf('NORMAL', 'Importing materials data from HDF5...')
materials = openmoc.materialize.load_from_hdf5('c5g7-mgxs.h5', '../')
###############################################################################
########################### Creating Surfaces #############################
###############################################################################
log.py_printf('NORMAL', 'Creating surfaces...')
xmin = openmoc.XPlane(x=-5.0, name='xmin')
xmax = openmoc.XPlane(x= 5.0, name='xmax')
ymin = openmoc.YPlane(y=-5.0, name='ymin')
ymax = openmoc.YPlane(y= 5.0, name='ymax')
zmin = openmoc.ZPlane(z=-5.0, name='zmin')
zmax = openmoc.ZPlane(z= 5.0, name='zmax')
xmin.setBoundaryType(openmoc.REFLECTIVE)
xmax.setBoundaryType(openmoc.REFLECTIVE)
ymin.setBoundaryType(openmoc.REFLECTIVE)
ymax.setBoundaryType(openmoc.REFLECTIVE)
zmin.setBoundaryType(openmoc.REFLECTIVE)
zmax.setBoundaryType(openmoc.REFLECTIVE)
###############################################################################
############################# Creating Cells ##############################
###############################################################################
log.py_printf('NORMAL', 'Creating cells...')
fuel = openmoc.Cell(name='fuel')
fuel.setFill(materials['UO2'])
moderator = openmoc.Cell(name='moderator')
moderator.setFill(materials['UO2'])
root_cell = openmoc.Cell(name='root cell')
root_cell.addSurface(halfspace=+1, surface=xmin)
root_cell.addSurface(halfspace=-1, surface=xmax)
root_cell.addSurface(halfspace=+1, surface=ymin)
root_cell.addSurface(halfspace=-1, surface=ymax)
root_cell.addSurface(halfspace=+1, surface=zmin)
root_cell.addSurface(halfspace=-1, surface=zmax)
###############################################################################
########################### Creating Universes ############################
###############################################################################
log.py_printf('NORMAL', 'Creating universes...')
fue_univ = openmoc.Universe(name='homogeneous fue cell')
fue_univ.addCell(fuel)
mod_univ = openmoc.Universe(name='homogeneous mod cell')
mod_univ.addCell(moderator)
root_universe = openmoc.Universe(name='root universe')
root_universe.addCell(root_cell)
###############################################################################
########################### Creating Lattices #############################
###############################################################################
log.py_printf('NORMAL', 'Creating simple 10 x 10 lattice...')
f = fue_univ
lattice = openmoc.Lattice(name='10x10 lattice')
lattice.setWidth(width_x=1.0, width_y=1.0, width_z=1.0)
lattice.setUniverses([[[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f]],
[[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f]],
[[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f]],
[[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f]],
[[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f]],
[[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f]],
[[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f]],
[[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f]],
[[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f]],
[[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f],
[f, f, f, f, f, f, f, f, f, f]]])
root_cell.setFill(lattice)
###############################################################################
########################## Creating the Geometry ##########################
###############################################################################
log.py_printf('NORMAL', 'Creating geometry...')
geometry = openmoc.Geometry()
geometry.setRootUniverse(root_universe)
geometry.initializeFlatSourceRegions()
| 46.705584
| 79
| 0.29236
| 1,300
| 9,201
| 2.046154
| 0.053846
| 0.751128
| 1.125564
| 1.499248
| 0.572556
| 0.5
| 0.37594
| 0.37594
| 0.37594
| 0.37594
| 0
| 0.007078
| 0.401152
| 9,201
| 196
| 80
| 46.943878
| 0.475681
| 0.014672
| 0
| 0.662162
| 0
| 0
| 0.041651
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.033784
| 0
| 0.033784
| 0.040541
| 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
| 0
|
0
| 4
|
408169e338ef415cc1c1cefeaa3179019885ca4e
| 79
|
py
|
Python
|
Schemas/Subject.py
|
esot0/jmsa-tutoring-backend
|
f35000c73fbbb31f9b4dcca36e40854dc2e06d23
|
[
"MIT"
] | null | null | null |
Schemas/Subject.py
|
esot0/jmsa-tutoring-backend
|
f35000c73fbbb31f9b4dcca36e40854dc2e06d23
|
[
"MIT"
] | null | null | null |
Schemas/Subject.py
|
esot0/jmsa-tutoring-backend
|
f35000c73fbbb31f9b4dcca36e40854dc2e06d23
|
[
"MIT"
] | null | null | null |
from mongoengine import *
class Subject(Document):
subject = StringField()
| 19.75
| 27
| 0.746835
| 8
| 79
| 7.375
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.164557
| 79
| 4
| 27
| 19.75
| 0.893939
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
409191dc8e0d6b6abf220bc3d47860d3cfbeff3a
| 31,078
|
py
|
Python
|
vehicle/views.py
|
BernardAli/vehicle-service-mgt
|
242d9797f9138a23d1c649d63660c2ee0b6cc462
|
[
"MIT"
] | 105
|
2020-09-27T16:10:44.000Z
|
2022-03-31T18:08:36.000Z
|
vehicle/views.py
|
BernardAli/vehicle-service-mgt
|
242d9797f9138a23d1c649d63660c2ee0b6cc462
|
[
"MIT"
] | 1
|
2021-07-15T21:36:09.000Z
|
2021-07-15T21:36:09.000Z
|
vehicle/views.py
|
BernardAli/vehicle-service-mgt
|
242d9797f9138a23d1c649d63660c2ee0b6cc462
|
[
"MIT"
] | 87
|
2020-10-02T11:45:42.000Z
|
2022-03-25T16:43:22.000Z
|
from django.shortcuts import render,redirect,reverse
from . import forms,models
from django.db.models import Sum
from django.contrib.auth.models import Group
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required,user_passes_test
from django.conf import settings
from django.db.models import Q
def home_view(request):
if request.user.is_authenticated:
return HttpResponseRedirect('afterlogin')
return render(request,'vehicle/index.html')
#for showing signup/login button for customer
def customerclick_view(request):
if request.user.is_authenticated:
return HttpResponseRedirect('afterlogin')
return render(request,'vehicle/customerclick.html')
#for showing signup/login button for mechanics
def mechanicsclick_view(request):
if request.user.is_authenticated:
return HttpResponseRedirect('afterlogin')
return render(request,'vehicle/mechanicsclick.html')
#for showing signup/login button for ADMIN(by sumit)
def adminclick_view(request):
if request.user.is_authenticated:
return HttpResponseRedirect('afterlogin')
return HttpResponseRedirect('adminlogin')
def customer_signup_view(request):
userForm=forms.CustomerUserForm()
customerForm=forms.CustomerForm()
mydict={'userForm':userForm,'customerForm':customerForm}
if request.method=='POST':
userForm=forms.CustomerUserForm(request.POST)
customerForm=forms.CustomerForm(request.POST,request.FILES)
if userForm.is_valid() and customerForm.is_valid():
user=userForm.save()
user.set_password(user.password)
user.save()
customer=customerForm.save(commit=False)
customer.user=user
customer.save()
my_customer_group = Group.objects.get_or_create(name='CUSTOMER')
my_customer_group[0].user_set.add(user)
return HttpResponseRedirect('customerlogin')
return render(request,'vehicle/customersignup.html',context=mydict)
def mechanic_signup_view(request):
userForm=forms.MechanicUserForm()
mechanicForm=forms.MechanicForm()
mydict={'userForm':userForm,'mechanicForm':mechanicForm}
if request.method=='POST':
userForm=forms.MechanicUserForm(request.POST)
mechanicForm=forms.MechanicForm(request.POST,request.FILES)
if userForm.is_valid() and mechanicForm.is_valid():
user=userForm.save()
user.set_password(user.password)
user.save()
mechanic=mechanicForm.save(commit=False)
mechanic.user=user
mechanic.save()
my_mechanic_group = Group.objects.get_or_create(name='MECHANIC')
my_mechanic_group[0].user_set.add(user)
return HttpResponseRedirect('mechaniclogin')
return render(request,'vehicle/mechanicsignup.html',context=mydict)
#for checking user customer, mechanic or admin(by sumit)
def is_customer(user):
return user.groups.filter(name='CUSTOMER').exists()
def is_mechanic(user):
return user.groups.filter(name='MECHANIC').exists()
def afterlogin_view(request):
if is_customer(request.user):
return redirect('customer-dashboard')
elif is_mechanic(request.user):
accountapproval=models.Mechanic.objects.all().filter(user_id=request.user.id,status=True)
if accountapproval:
return redirect('mechanic-dashboard')
else:
return render(request,'vehicle/mechanic_wait_for_approval.html')
else:
return redirect('admin-dashboard')
#============================================================================================
# ADMIN RELATED views start
#============================================================================================
@login_required(login_url='adminlogin')
def admin_dashboard_view(request):
enquiry=models.Request.objects.all().order_by('-id')
customers=[]
for enq in enquiry:
customer=models.Customer.objects.get(id=enq.customer_id)
customers.append(customer)
dict={
'total_customer':models.Customer.objects.all().count(),
'total_mechanic':models.Mechanic.objects.all().count(),
'total_request':models.Request.objects.all().count(),
'total_feedback':models.Feedback.objects.all().count(),
'data':zip(customers,enquiry),
}
return render(request,'vehicle/admin_dashboard.html',context=dict)
@login_required(login_url='adminlogin')
def admin_customer_view(request):
return render(request,'vehicle/admin_customer.html')
@login_required(login_url='adminlogin')
def admin_view_customer_view(request):
customers=models.Customer.objects.all()
return render(request,'vehicle/admin_view_customer.html',{'customers':customers})
@login_required(login_url='adminlogin')
def delete_customer_view(request,pk):
customer=models.Customer.objects.get(id=pk)
user=models.User.objects.get(id=customer.user_id)
user.delete()
customer.delete()
return redirect('admin-view-customer')
@login_required(login_url='adminlogin')
def update_customer_view(request,pk):
customer=models.Customer.objects.get(id=pk)
user=models.User.objects.get(id=customer.user_id)
userForm=forms.CustomerUserForm(instance=user)
customerForm=forms.CustomerForm(request.FILES,instance=customer)
mydict={'userForm':userForm,'customerForm':customerForm}
if request.method=='POST':
userForm=forms.CustomerUserForm(request.POST,instance=user)
customerForm=forms.CustomerForm(request.POST,request.FILES,instance=customer)
if userForm.is_valid() and customerForm.is_valid():
user=userForm.save()
user.set_password(user.password)
user.save()
customerForm.save()
return redirect('admin-view-customer')
return render(request,'vehicle/update_customer.html',context=mydict)
@login_required(login_url='adminlogin')
def admin_add_customer_view(request):
userForm=forms.CustomerUserForm()
customerForm=forms.CustomerForm()
mydict={'userForm':userForm,'customerForm':customerForm}
if request.method=='POST':
userForm=forms.CustomerUserForm(request.POST)
customerForm=forms.CustomerForm(request.POST,request.FILES)
if userForm.is_valid() and customerForm.is_valid():
user=userForm.save()
user.set_password(user.password)
user.save()
customer=customerForm.save(commit=False)
customer.user=user
customer.save()
my_customer_group = Group.objects.get_or_create(name='CUSTOMER')
my_customer_group[0].user_set.add(user)
return HttpResponseRedirect('/admin-view-customer')
return render(request,'vehicle/admin_add_customer.html',context=mydict)
@login_required(login_url='adminlogin')
def admin_view_customer_enquiry_view(request):
enquiry=models.Request.objects.all().order_by('-id')
customers=[]
for enq in enquiry:
customer=models.Customer.objects.get(id=enq.customer_id)
customers.append(customer)
return render(request,'vehicle/admin_view_customer_enquiry.html',{'data':zip(customers,enquiry)})
@login_required(login_url='adminlogin')
def admin_view_customer_invoice_view(request):
enquiry=models.Request.objects.values('customer_id').annotate(Sum('cost'))
print(enquiry)
customers=[]
for enq in enquiry:
print(enq)
customer=models.Customer.objects.get(id=enq['customer_id'])
customers.append(customer)
return render(request,'vehicle/admin_view_customer_invoice.html',{'data':zip(customers,enquiry)})
@login_required(login_url='adminlogin')
def admin_mechanic_view(request):
return render(request,'vehicle/admin_mechanic.html')
@login_required(login_url='adminlogin')
def admin_approve_mechanic_view(request):
mechanics=models.Mechanic.objects.all().filter(status=False)
return render(request,'vehicle/admin_approve_mechanic.html',{'mechanics':mechanics})
@login_required(login_url='adminlogin')
def approve_mechanic_view(request,pk):
mechanicSalary=forms.MechanicSalaryForm()
if request.method=='POST':
mechanicSalary=forms.MechanicSalaryForm(request.POST)
if mechanicSalary.is_valid():
mechanic=models.Mechanic.objects.get(id=pk)
mechanic.salary=mechanicSalary.cleaned_data['salary']
mechanic.status=True
mechanic.save()
else:
print("form is invalid")
return HttpResponseRedirect('/admin-approve-mechanic')
return render(request,'vehicle/admin_approve_mechanic_details.html',{'mechanicSalary':mechanicSalary})
@login_required(login_url='adminlogin')
def delete_mechanic_view(request,pk):
mechanic=models.Mechanic.objects.get(id=pk)
user=models.User.objects.get(id=mechanic.user_id)
user.delete()
mechanic.delete()
return redirect('admin-approve-mechanic')
@login_required(login_url='adminlogin')
def admin_add_mechanic_view(request):
userForm=forms.MechanicUserForm()
mechanicForm=forms.MechanicForm()
mechanicSalary=forms.MechanicSalaryForm()
mydict={'userForm':userForm,'mechanicForm':mechanicForm,'mechanicSalary':mechanicSalary}
if request.method=='POST':
userForm=forms.MechanicUserForm(request.POST)
mechanicForm=forms.MechanicForm(request.POST,request.FILES)
mechanicSalary=forms.MechanicSalaryForm(request.POST)
if userForm.is_valid() and mechanicForm.is_valid() and mechanicSalary.is_valid():
user=userForm.save()
user.set_password(user.password)
user.save()
mechanic=mechanicForm.save(commit=False)
mechanic.user=user
mechanic.status=True
mechanic.salary=mechanicSalary.cleaned_data['salary']
mechanic.save()
my_mechanic_group = Group.objects.get_or_create(name='MECHANIC')
my_mechanic_group[0].user_set.add(user)
return HttpResponseRedirect('admin-view-mechanic')
else:
print('problem in form')
return render(request,'vehicle/admin_add_mechanic.html',context=mydict)
@login_required(login_url='adminlogin')
def admin_view_mechanic_view(request):
mechanics=models.Mechanic.objects.all()
return render(request,'vehicle/admin_view_mechanic.html',{'mechanics':mechanics})
@login_required(login_url='adminlogin')
def delete_mechanic_view(request,pk):
mechanic=models.Mechanic.objects.get(id=pk)
user=models.User.objects.get(id=mechanic.user_id)
user.delete()
mechanic.delete()
return redirect('admin-view-mechanic')
@login_required(login_url='adminlogin')
def update_mechanic_view(request,pk):
mechanic=models.Mechanic.objects.get(id=pk)
user=models.User.objects.get(id=mechanic.user_id)
userForm=forms.MechanicUserForm(instance=user)
mechanicForm=forms.MechanicForm(request.FILES,instance=mechanic)
mydict={'userForm':userForm,'mechanicForm':mechanicForm}
if request.method=='POST':
userForm=forms.MechanicUserForm(request.POST,instance=user)
mechanicForm=forms.MechanicForm(request.POST,request.FILES,instance=mechanic)
if userForm.is_valid() and mechanicForm.is_valid():
user=userForm.save()
user.set_password(user.password)
user.save()
mechanicForm.save()
return redirect('admin-view-mechanic')
return render(request,'vehicle/update_mechanic.html',context=mydict)
@login_required(login_url='adminlogin')
def admin_view_mechanic_salary_view(request):
mechanics=models.Mechanic.objects.all()
return render(request,'vehicle/admin_view_mechanic_salary.html',{'mechanics':mechanics})
@login_required(login_url='adminlogin')
def update_salary_view(request,pk):
mechanicSalary=forms.MechanicSalaryForm()
if request.method=='POST':
mechanicSalary=forms.MechanicSalaryForm(request.POST)
if mechanicSalary.is_valid():
mechanic=models.Mechanic.objects.get(id=pk)
mechanic.salary=mechanicSalary.cleaned_data['salary']
mechanic.save()
else:
print("form is invalid")
return HttpResponseRedirect('/admin-view-mechanic-salary')
return render(request,'vehicle/admin_approve_mechanic_details.html',{'mechanicSalary':mechanicSalary})
@login_required(login_url='adminlogin')
def admin_request_view(request):
return render(request,'vehicle/admin_request.html')
@login_required(login_url='adminlogin')
def admin_view_request_view(request):
enquiry=models.Request.objects.all().order_by('-id')
customers=[]
for enq in enquiry:
customer=models.Customer.objects.get(id=enq.customer_id)
customers.append(customer)
return render(request,'vehicle/admin_view_request.html',{'data':zip(customers,enquiry)})
@login_required(login_url='adminlogin')
def change_status_view(request,pk):
adminenquiry=forms.AdminApproveRequestForm()
if request.method=='POST':
adminenquiry=forms.AdminApproveRequestForm(request.POST)
if adminenquiry.is_valid():
enquiry_x=models.Request.objects.get(id=pk)
enquiry_x.mechanic=adminenquiry.cleaned_data['mechanic']
enquiry_x.cost=adminenquiry.cleaned_data['cost']
enquiry_x.status=adminenquiry.cleaned_data['status']
enquiry_x.save()
else:
print("form is invalid")
return HttpResponseRedirect('/admin-view-request')
return render(request,'vehicle/admin_approve_request_details.html',{'adminenquiry':adminenquiry})
@login_required(login_url='adminlogin')
def admin_delete_request_view(request,pk):
requests=models.Request.objects.get(id=pk)
requests.delete()
return redirect('admin-view-request')
@login_required(login_url='adminlogin')
def admin_add_request_view(request):
enquiry=forms.RequestForm()
adminenquiry=forms.AdminRequestForm()
mydict={'enquiry':enquiry,'adminenquiry':adminenquiry}
if request.method=='POST':
enquiry=forms.RequestForm(request.POST)
adminenquiry=forms.AdminRequestForm(request.POST)
if enquiry.is_valid() and adminenquiry.is_valid():
enquiry_x=enquiry.save(commit=False)
enquiry_x.customer=adminenquiry.cleaned_data['customer']
enquiry_x.mechanic=adminenquiry.cleaned_data['mechanic']
enquiry_x.cost=adminenquiry.cleaned_data['cost']
enquiry_x.status='Approved'
enquiry_x.save()
else:
print("form is invalid")
return HttpResponseRedirect('admin-view-request')
return render(request,'vehicle/admin_add_request.html',context=mydict)
@login_required(login_url='adminlogin')
def admin_approve_request_view(request):
enquiry=models.Request.objects.all().filter(status='Pending')
return render(request,'vehicle/admin_approve_request.html',{'enquiry':enquiry})
@login_required(login_url='adminlogin')
def approve_request_view(request,pk):
adminenquiry=forms.AdminApproveRequestForm()
if request.method=='POST':
adminenquiry=forms.AdminApproveRequestForm(request.POST)
if adminenquiry.is_valid():
enquiry_x=models.Request.objects.get(id=pk)
enquiry_x.mechanic=adminenquiry.cleaned_data['mechanic']
enquiry_x.cost=adminenquiry.cleaned_data['cost']
enquiry_x.status=adminenquiry.cleaned_data['status']
enquiry_x.save()
else:
print("form is invalid")
return HttpResponseRedirect('/admin-approve-request')
return render(request,'vehicle/admin_approve_request_details.html',{'adminenquiry':adminenquiry})
@login_required(login_url='adminlogin')
def admin_view_service_cost_view(request):
enquiry=models.Request.objects.all().order_by('-id')
customers=[]
for enq in enquiry:
customer=models.Customer.objects.get(id=enq.customer_id)
customers.append(customer)
print(customers)
return render(request,'vehicle/admin_view_service_cost.html',{'data':zip(customers,enquiry)})
@login_required(login_url='adminlogin')
def update_cost_view(request,pk):
updateCostForm=forms.UpdateCostForm()
if request.method=='POST':
updateCostForm=forms.UpdateCostForm(request.POST)
if updateCostForm.is_valid():
enquiry_x=models.Request.objects.get(id=pk)
enquiry_x.cost=updateCostForm.cleaned_data['cost']
enquiry_x.save()
else:
print("form is invalid")
return HttpResponseRedirect('/admin-view-service-cost')
return render(request,'vehicle/update_cost.html',{'updateCostForm':updateCostForm})
@login_required(login_url='adminlogin')
def admin_mechanic_attendance_view(request):
return render(request,'vehicle/admin_mechanic_attendance.html')
@login_required(login_url='adminlogin')
def admin_take_attendance_view(request):
mechanics=models.Mechanic.objects.all().filter(status=True)
aform=forms.AttendanceForm()
if request.method=='POST':
form=forms.AttendanceForm(request.POST)
if form.is_valid():
Attendances=request.POST.getlist('present_status')
date=form.cleaned_data['date']
for i in range(len(Attendances)):
AttendanceModel=models.Attendance()
AttendanceModel.date=date
AttendanceModel.present_status=Attendances[i]
print(mechanics[i].id)
print(int(mechanics[i].id))
mechanic=models.Mechanic.objects.get(id=int(mechanics[i].id))
AttendanceModel.mechanic=mechanic
AttendanceModel.save()
return redirect('admin-view-attendance')
else:
print('form invalid')
return render(request,'vehicle/admin_take_attendance.html',{'mechanics':mechanics,'aform':aform})
@login_required(login_url='adminlogin')
def admin_view_attendance_view(request):
form=forms.AskDateForm()
if request.method=='POST':
form=forms.AskDateForm(request.POST)
if form.is_valid():
date=form.cleaned_data['date']
attendancedata=models.Attendance.objects.all().filter(date=date)
mechanicdata=models.Mechanic.objects.all().filter(status=True)
mylist=zip(attendancedata,mechanicdata)
return render(request,'vehicle/admin_view_attendance_page.html',{'mylist':mylist,'date':date})
else:
print('form invalid')
return render(request,'vehicle/admin_view_attendance_ask_date.html',{'form':form})
@login_required(login_url='adminlogin')
def admin_report_view(request):
reports=models.Request.objects.all().filter(Q(status="Repairing Done") | Q(status="Released"))
dict={
'reports':reports,
}
return render(request,'vehicle/admin_report.html',context=dict)
@login_required(login_url='adminlogin')
def admin_feedback_view(request):
feedback=models.Feedback.objects.all().order_by('-id')
return render(request,'vehicle/admin_feedback.html',{'feedback':feedback})
#============================================================================================
# ADMIN RELATED views END
#============================================================================================
#============================================================================================
# CUSTOMER RELATED views start
#============================================================================================
@login_required(login_url='customerlogin')
@user_passes_test(is_customer)
def customer_dashboard_view(request):
customer=models.Customer.objects.get(user_id=request.user.id)
work_in_progress=models.Request.objects.all().filter(customer_id=customer.id,status='Repairing').count()
work_completed=models.Request.objects.all().filter(customer_id=customer.id).filter(Q(status="Repairing Done") | Q(status="Released")).count()
new_request_made=models.Request.objects.all().filter(customer_id=customer.id).filter(Q(status="Pending") | Q(status="Approved")).count()
bill=models.Request.objects.all().filter(customer_id=customer.id).filter(Q(status="Repairing Done") | Q(status="Released")).aggregate(Sum('cost'))
print(bill)
dict={
'work_in_progress':work_in_progress,
'work_completed':work_completed,
'new_request_made':new_request_made,
'bill':bill['cost__sum'],
'customer':customer,
}
return render(request,'vehicle/customer_dashboard.html',context=dict)
@login_required(login_url='customerlogin')
@user_passes_test(is_customer)
def customer_request_view(request):
customer=models.Customer.objects.get(user_id=request.user.id)
return render(request,'vehicle/customer_request.html',{'customer':customer})
@login_required(login_url='customerlogin')
@user_passes_test(is_customer)
def customer_view_request_view(request):
customer=models.Customer.objects.get(user_id=request.user.id)
enquiries=models.Request.objects.all().filter(customer_id=customer.id , status="Pending")
return render(request,'vehicle/customer_view_request.html',{'customer':customer,'enquiries':enquiries})
@login_required(login_url='customerlogin')
@user_passes_test(is_customer)
def customer_delete_request_view(request,pk):
customer=models.Customer.objects.get(user_id=request.user.id)
enquiry=models.Request.objects.get(id=pk)
enquiry.delete()
return redirect('customer-view-request')
@login_required(login_url='customerlogin')
@user_passes_test(is_customer)
def customer_view_approved_request_view(request):
customer=models.Customer.objects.get(user_id=request.user.id)
enquiries=models.Request.objects.all().filter(customer_id=customer.id).exclude(status='Pending')
return render(request,'vehicle/customer_view_approved_request.html',{'customer':customer,'enquiries':enquiries})
@login_required(login_url='customerlogin')
@user_passes_test(is_customer)
def customer_view_approved_request_invoice_view(request):
customer=models.Customer.objects.get(user_id=request.user.id)
enquiries=models.Request.objects.all().filter(customer_id=customer.id).exclude(status='Pending')
return render(request,'vehicle/customer_view_approved_request_invoice.html',{'customer':customer,'enquiries':enquiries})
@login_required(login_url='customerlogin')
@user_passes_test(is_customer)
def customer_add_request_view(request):
customer=models.Customer.objects.get(user_id=request.user.id)
enquiry=forms.RequestForm()
if request.method=='POST':
enquiry=forms.RequestForm(request.POST)
if enquiry.is_valid():
customer=models.Customer.objects.get(user_id=request.user.id)
enquiry_x=enquiry.save(commit=False)
enquiry_x.customer=customer
enquiry_x.save()
else:
print("form is invalid")
return HttpResponseRedirect('customer-dashboard')
return render(request,'vehicle/customer_add_request.html',{'enquiry':enquiry,'customer':customer})
@login_required(login_url='customerlogin')
@user_passes_test(is_customer)
def customer_profile_view(request):
customer=models.Customer.objects.get(user_id=request.user.id)
return render(request,'vehicle/customer_profile.html',{'customer':customer})
@login_required(login_url='customerlogin')
@user_passes_test(is_customer)
def edit_customer_profile_view(request):
customer=models.Customer.objects.get(user_id=request.user.id)
user=models.User.objects.get(id=customer.user_id)
userForm=forms.CustomerUserForm(instance=user)
customerForm=forms.CustomerForm(request.FILES,instance=customer)
mydict={'userForm':userForm,'customerForm':customerForm,'customer':customer}
if request.method=='POST':
userForm=forms.CustomerUserForm(request.POST,instance=user)
customerForm=forms.CustomerForm(request.POST,instance=customer)
if userForm.is_valid() and customerForm.is_valid():
user=userForm.save()
user.set_password(user.password)
user.save()
customerForm.save()
return HttpResponseRedirect('customer-profile')
return render(request,'vehicle/edit_customer_profile.html',context=mydict)
@login_required(login_url='customerlogin')
@user_passes_test(is_customer)
def customer_invoice_view(request):
customer=models.Customer.objects.get(user_id=request.user.id)
enquiries=models.Request.objects.all().filter(customer_id=customer.id).exclude(status='Pending')
return render(request,'vehicle/customer_invoice.html',{'customer':customer,'enquiries':enquiries})
@login_required(login_url='customerlogin')
@user_passes_test(is_customer)
def customer_feedback_view(request):
customer=models.Customer.objects.get(user_id=request.user.id)
feedback=forms.FeedbackForm()
if request.method=='POST':
feedback=forms.FeedbackForm(request.POST)
if feedback.is_valid():
feedback.save()
else:
print("form is invalid")
return render(request,'vehicle/feedback_sent_by_customer.html',{'customer':customer})
return render(request,'vehicle/customer_feedback.html',{'feedback':feedback,'customer':customer})
#============================================================================================
# CUSTOMER RELATED views END
#============================================================================================
#============================================================================================
# MECHANIC RELATED views start
#============================================================================================
@login_required(login_url='mechaniclogin')
@user_passes_test(is_mechanic)
def mechanic_dashboard_view(request):
mechanic=models.Mechanic.objects.get(user_id=request.user.id)
work_in_progress=models.Request.objects.all().filter(mechanic_id=mechanic.id,status='Repairing').count()
work_completed=models.Request.objects.all().filter(mechanic_id=mechanic.id,status='Repairing Done').count()
new_work_assigned=models.Request.objects.all().filter(mechanic_id=mechanic.id,status='Approved').count()
dict={
'work_in_progress':work_in_progress,
'work_completed':work_completed,
'new_work_assigned':new_work_assigned,
'salary':mechanic.salary,
'mechanic':mechanic,
}
return render(request,'vehicle/mechanic_dashboard.html',context=dict)
@login_required(login_url='mechaniclogin')
@user_passes_test(is_mechanic)
def mechanic_work_assigned_view(request):
mechanic=models.Mechanic.objects.get(user_id=request.user.id)
works=models.Request.objects.all().filter(mechanic_id=mechanic.id)
return render(request,'vehicle/mechanic_work_assigned.html',{'works':works,'mechanic':mechanic})
@login_required(login_url='mechaniclogin')
@user_passes_test(is_mechanic)
def mechanic_update_status_view(request,pk):
mechanic=models.Mechanic.objects.get(user_id=request.user.id)
updateStatus=forms.MechanicUpdateStatusForm()
if request.method=='POST':
updateStatus=forms.MechanicUpdateStatusForm(request.POST)
if updateStatus.is_valid():
enquiry_x=models.Request.objects.get(id=pk)
enquiry_x.status=updateStatus.cleaned_data['status']
enquiry_x.save()
else:
print("form is invalid")
return HttpResponseRedirect('/mechanic-work-assigned')
return render(request,'vehicle/mechanic_update_status.html',{'updateStatus':updateStatus,'mechanic':mechanic})
@login_required(login_url='mechaniclogin')
@user_passes_test(is_mechanic)
def mechanic_attendance_view(request):
mechanic=models.Mechanic.objects.get(user_id=request.user.id)
attendaces=models.Attendance.objects.all().filter(mechanic=mechanic)
return render(request,'vehicle/mechanic_view_attendance.html',{'attendaces':attendaces,'mechanic':mechanic})
@login_required(login_url='mechaniclogin')
@user_passes_test(is_mechanic)
def mechanic_feedback_view(request):
mechanic=models.Mechanic.objects.get(user_id=request.user.id)
feedback=forms.FeedbackForm()
if request.method=='POST':
feedback=forms.FeedbackForm(request.POST)
if feedback.is_valid():
feedback.save()
else:
print("form is invalid")
return render(request,'vehicle/feedback_sent.html',{'mechanic':mechanic})
return render(request,'vehicle/mechanic_feedback.html',{'feedback':feedback,'mechanic':mechanic})
@login_required(login_url='mechaniclogin')
@user_passes_test(is_mechanic)
def mechanic_salary_view(request):
mechanic=models.Mechanic.objects.get(user_id=request.user.id)
workdone=models.Request.objects.all().filter(mechanic_id=mechanic.id).filter(Q(status="Repairing Done") | Q(status="Released"))
return render(request,'vehicle/mechanic_salary.html',{'workdone':workdone,'mechanic':mechanic})
@login_required(login_url='mechaniclogin')
@user_passes_test(is_mechanic)
def mechanic_profile_view(request):
mechanic=models.Mechanic.objects.get(user_id=request.user.id)
return render(request,'vehicle/mechanic_profile.html',{'mechanic':mechanic})
@login_required(login_url='mechaniclogin')
@user_passes_test(is_mechanic)
def edit_mechanic_profile_view(request):
mechanic=models.Mechanic.objects.get(user_id=request.user.id)
user=models.User.objects.get(id=mechanic.user_id)
userForm=forms.MechanicUserForm(instance=user)
mechanicForm=forms.MechanicForm(request.FILES,instance=mechanic)
mydict={'userForm':userForm,'mechanicForm':mechanicForm,'mechanic':mechanic}
if request.method=='POST':
userForm=forms.MechanicUserForm(request.POST,instance=user)
mechanicForm=forms.MechanicForm(request.POST,request.FILES,instance=mechanic)
if userForm.is_valid() and mechanicForm.is_valid():
user=userForm.save()
user.set_password(user.password)
user.save()
mechanicForm.save()
return redirect('mechanic-profile')
return render(request,'vehicle/edit_mechanic_profile.html',context=mydict)
#============================================================================================
# MECHANIC RELATED views start
#============================================================================================
# for aboutus and contact
def aboutus_view(request):
return render(request,'vehicle/aboutus.html')
def contactus_view(request):
sub = forms.ContactusForm()
if request.method == 'POST':
sub = forms.ContactusForm(request.POST)
if sub.is_valid():
email = sub.cleaned_data['Email']
name=sub.cleaned_data['Name']
message = sub.cleaned_data['Message']
send_mail(str(name)+' || '+str(email),message,settings.EMAIL_HOST_USER, settings.EMAIL_RECEIVING_USER, fail_silently = False)
return render(request, 'vehicle/contactussuccess.html')
return render(request, 'vehicle/contactus.html', {'form':sub})
| 41.327128
| 150
| 0.702491
| 3,514
| 31,078
| 6.03671
| 0.056346
| 0.035261
| 0.051949
| 0.071088
| 0.814453
| 0.770094
| 0.740772
| 0.688587
| 0.646726
| 0.61269
| 0
| 0.00015
| 0.142512
| 31,078
| 751
| 151
| 41.382157
| 0.795865
| 0.047847
| 0
| 0.597663
| 0
| 0
| 0.150196
| 0.068351
| 0
| 0
| 0
| 0
| 0
| 1
| 0.103506
| false
| 0.046745
| 0.013356
| 0.011686
| 0.267112
| 0.03172
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
4093599c05b72acbbffdbf768053f07822e78e65
| 124
|
py
|
Python
|
library/favourite/api/pagination.py
|
furkan-34/library-DRF-django-api
|
3634133b7c543d6d05845dd8fa1f206386c1badb
|
[
"MIT"
] | null | null | null |
library/favourite/api/pagination.py
|
furkan-34/library-DRF-django-api
|
3634133b7c543d6d05845dd8fa1f206386c1badb
|
[
"MIT"
] | null | null | null |
library/favourite/api/pagination.py
|
furkan-34/library-DRF-django-api
|
3634133b7c543d6d05845dd8fa1f206386c1badb
|
[
"MIT"
] | null | null | null |
from rest_framework.pagination import PageNumberPagination
class FavouritePagination(PageNumberPagination):
page_size=4
| 31
| 58
| 0.870968
| 12
| 124
| 8.833333
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.00885
| 0.08871
| 124
| 4
| 59
| 31
| 0.929204
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
40b2c91082ea21890c36b449104ec87a0b8d9b4b
| 266
|
py
|
Python
|
tests/test_app/rest_app/rest_app/controllers/config_controller.py
|
jadbin/guniflask
|
36253a962c056abf34884263c6919b02b921ad9c
|
[
"MIT"
] | 12
|
2018-09-06T06:14:59.000Z
|
2021-04-18T06:30:44.000Z
|
tests/test_app/rest_app/rest_app/controllers/config_controller.py
|
jadbin/guniflask
|
36253a962c056abf34884263c6919b02b921ad9c
|
[
"MIT"
] | null | null | null |
tests/test_app/rest_app/rest_app/controllers/config_controller.py
|
jadbin/guniflask
|
36253a962c056abf34884263c6919b02b921ad9c
|
[
"MIT"
] | 2
|
2019-09-08T22:01:26.000Z
|
2020-08-03T07:23:29.000Z
|
from guniflask.config import settings
from guniflask.web import blueprint, get_route
@blueprint
class ConfigController:
def __init__(self):
pass
@get_route('/settings/<name>')
def get_setting(self, name):
return {name: settings[name]}
| 20.461538
| 46
| 0.703008
| 32
| 266
| 5.625
| 0.5625
| 0.144444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.199248
| 266
| 12
| 47
| 22.166667
| 0.84507
| 0
| 0
| 0
| 0
| 0
| 0.06015
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0.111111
| 0.222222
| 0.111111
| 0.666667
| 0.222222
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
40ee9a52429bac1502e511dda17968ae00643dd6
| 41
|
py
|
Python
|
ez_sten/__init__.py
|
deadlift1226/ez-sten
|
7f754e5648ce6b7d5207a901618b77a8e4382c86
|
[
"MIT"
] | null | null | null |
ez_sten/__init__.py
|
deadlift1226/ez-sten
|
7f754e5648ce6b7d5207a901618b77a8e4382c86
|
[
"MIT"
] | null | null | null |
ez_sten/__init__.py
|
deadlift1226/ez-sten
|
7f754e5648ce6b7d5207a901618b77a8e4382c86
|
[
"MIT"
] | null | null | null |
name = "module"
from .module import func
| 13.666667
| 24
| 0.731707
| 6
| 41
| 5
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.170732
| 41
| 2
| 25
| 20.5
| 0.882353
| 0
| 0
| 0
| 0
| 0
| 0.146341
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
40f3ddcdfc03bc9856328d9f89786ad5e9dd0772
| 88
|
py
|
Python
|
src/models/__init__.py
|
DwaraknathT/sparsity
|
705f2cba074e6ab4f7655c6af98882773cd826bf
|
[
"MIT"
] | null | null | null |
src/models/__init__.py
|
DwaraknathT/sparsity
|
705f2cba074e6ab4f7655c6af98882773cd826bf
|
[
"MIT"
] | null | null | null |
src/models/__init__.py
|
DwaraknathT/sparsity
|
705f2cba074e6ab4f7655c6af98882773cd826bf
|
[
"MIT"
] | null | null | null |
__all__ = ["transformers", "vision"]
from .transformers import *
from .vision import *
| 17.6
| 36
| 0.715909
| 9
| 88
| 6.555556
| 0.555556
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.147727
| 88
| 4
| 37
| 22
| 0.786667
| 0
| 0
| 0
| 0
| 0
| 0.204545
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
906d400738f33dc206c78e71d946859aba32483a
| 97
|
py
|
Python
|
python/760.find-anagram-mappings.py
|
stavanmehta/leetcode
|
1224e43ce29430c840e65daae3b343182e24709c
|
[
"Apache-2.0"
] | null | null | null |
python/760.find-anagram-mappings.py
|
stavanmehta/leetcode
|
1224e43ce29430c840e65daae3b343182e24709c
|
[
"Apache-2.0"
] | null | null | null |
python/760.find-anagram-mappings.py
|
stavanmehta/leetcode
|
1224e43ce29430c840e65daae3b343182e24709c
|
[
"Apache-2.0"
] | null | null | null |
class Solution:
def anagramMappings(self, A: List[int], B: List[int]) -> List[int]:
| 24.25
| 71
| 0.597938
| 13
| 97
| 4.461538
| 0.692308
| 0.362069
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.237113
| 97
| 3
| 72
| 32.333333
| 0.783784
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
906d8e08da166b6c85abfbc022b056f7f3eb7ea0
| 1,547
|
py
|
Python
|
src/jdk.internal.vm.compiler/.mx.graal/mx_graal.py
|
siweilxy/openjdkstudy
|
8597674ec1d6809faf55cbee1f45f4e9149d670d
|
[
"Apache-2.0"
] | 2
|
2018-06-19T05:43:32.000Z
|
2018-06-23T10:04:56.000Z
|
src/jdk.internal.vm.compiler/.mx.graal/mx_graal.py
|
siweilxy/openjdkstudy
|
8597674ec1d6809faf55cbee1f45f4e9149d670d
|
[
"Apache-2.0"
] | null | null | null |
src/jdk.internal.vm.compiler/.mx.graal/mx_graal.py
|
siweilxy/openjdkstudy
|
8597674ec1d6809faf55cbee1f45f4e9149d670d
|
[
"Apache-2.0"
] | null | null | null |
#
# ----------------------------------------------------------------------------------------------------
#
# Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# ----------------------------------------------------------------------------------------------------
import mx
if mx.get_jdk(tag='default').javaCompliance < "1.9":
mx.abort('JAVA_HOME is not a JDK9: ' + mx.get_jdk(tag='default').home)
from mx_graal_9 import mx_post_parse_cmd_line, run_vm, get_vm, isJVMCIEnabled # pylint: disable=unused-import
import mx_graal_bench # pylint: disable=unused-import
| 45.5
| 109
| 0.66128
| 221
| 1,547
| 4.570136
| 0.588235
| 0.023762
| 0.038614
| 0.056436
| 0.140594
| 0.104951
| 0.104951
| 0.071287
| 0
| 0
| 0
| 0.025777
| 0.147382
| 1,547
| 33
| 110
| 46.878788
| 0.739955
| 0.808662
| 0
| 0
| 0
| 0
| 0.156716
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.6
| 0
| 0.6
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
906e0d5d4effa98640d75d6a7be5cc83893d3c38
| 84
|
py
|
Python
|
pygments_lexer_solidity/__init__.py
|
veox/pygments-lexer-solidity
|
e99ccf980337ceaad4fbc7ee11795e91d7fab0ae
|
[
"BSD-2-Clause"
] | 2
|
2018-05-24T14:36:59.000Z
|
2019-06-29T23:50:08.000Z
|
pygments_lexer_solidity/__init__.py
|
veox/pygments-lexer-solidity
|
e99ccf980337ceaad4fbc7ee11795e91d7fab0ae
|
[
"BSD-2-Clause"
] | null | null | null |
pygments_lexer_solidity/__init__.py
|
veox/pygments-lexer-solidity
|
e99ccf980337ceaad4fbc7ee11795e91d7fab0ae
|
[
"BSD-2-Clause"
] | 1
|
2019-11-11T23:24:17.000Z
|
2019-11-11T23:24:17.000Z
|
from .lexer import SolidityLexer, YulLexer
__all__ = ['SolidityLexer', 'YulLexer']
| 21
| 42
| 0.761905
| 8
| 84
| 7.5
| 0.75
| 0.7
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.119048
| 84
| 3
| 43
| 28
| 0.810811
| 0
| 0
| 0
| 0
| 0
| 0.25
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
90988846045a582c1eb61f51d1fdf6a5c9b664f2
| 312
|
py
|
Python
|
examples/admin.py
|
kimbackdoo/Web-Cralwer
|
6a92ec00ea2273f228b8c304cd596ad9120c4709
|
[
"MIT"
] | null | null | null |
examples/admin.py
|
kimbackdoo/Web-Cralwer
|
6a92ec00ea2273f228b8c304cd596ad9120c4709
|
[
"MIT"
] | null | null | null |
examples/admin.py
|
kimbackdoo/Web-Cralwer
|
6a92ec00ea2273f228b8c304cd596ad9120c4709
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
# Register your models here.
#models에서 Shop을 임폴트
from .models import Shop
from .models import Parsed_data
from .models import Img_data
from .models import Other
admin.site.register(Shop)
admin.site.register(Parsed_data)
admin.site.register(Img_data)
admin.site.register(Other)
| 22.285714
| 32
| 0.814103
| 48
| 312
| 5.208333
| 0.375
| 0.16
| 0.256
| 0.16
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.108974
| 312
| 13
| 33
| 24
| 0.899281
| 0.141026
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.555556
| 0
| 0.555556
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
90b067d91d1317f4e26b80f4ccf8b819d42bc981
| 206
|
py
|
Python
|
{{cookiecutter.project_name}}/tests/conftest.py
|
nelsonHolic/common-fastapi-microservice
|
06a995264ced42a59565f1f703bab7bfed8e7cc1
|
[
"MIT"
] | 1
|
2021-12-14T17:08:24.000Z
|
2021-12-14T17:08:24.000Z
|
{{cookiecutter.project_name}}/tests/conftest.py
|
nelsonHolic/common-fastapi-microservice
|
06a995264ced42a59565f1f703bab7bfed8e7cc1
|
[
"MIT"
] | null | null | null |
{{cookiecutter.project_name}}/tests/conftest.py
|
nelsonHolic/common-fastapi-microservice
|
06a995264ced42a59565f1f703bab7bfed8e7cc1
|
[
"MIT"
] | null | null | null |
import pytest
from fastapi.testclient import TestClient
from {{cookiecutter.project_name}}.app import app
@pytest.fixture()
def app_client() -> TestClient:
client = TestClient(app)
return client
| 18.727273
| 49
| 0.757282
| 25
| 206
| 6.16
| 0.52
| 0.207792
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.150485
| 206
| 10
| 50
| 20.6
| 0.88
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.428571
| null | null | 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
90d7c582c62cd57d3012bffede812a95aec2d89a
| 378
|
py
|
Python
|
tests/plot_profile/test_utils.py
|
mizeller/plot_profile
|
832f1d47a182d65747f18cf1ac90afc9a3b821c1
|
[
"MIT"
] | null | null | null |
tests/plot_profile/test_utils.py
|
mizeller/plot_profile
|
832f1d47a182d65747f18cf1ac90afc9a3b821c1
|
[
"MIT"
] | 3
|
2021-11-10T15:37:27.000Z
|
2022-03-28T13:29:42.000Z
|
tests/plot_profile/test_utils.py
|
MeteoSwiss-APN/plot_profile
|
832f1d47a182d65747f18cf1ac90afc9a3b821c1
|
[
"MIT"
] | null | null | null |
"""Test module ``plot_profile/utils.py``."""
# Standard library
import logging
# First-party
from plot_profile.utils import count_to_log_level
def test_count_to_log_level():
assert count_to_log_level(0) == logging.ERROR
assert count_to_log_level(1) == logging.WARNING
assert count_to_log_level(2) == logging.INFO
assert count_to_log_level(3) == logging.DEBUG
| 27
| 51
| 0.759259
| 59
| 378
| 4.508475
| 0.457627
| 0.157895
| 0.225564
| 0.338346
| 0.315789
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012232
| 0.134921
| 378
| 13
| 52
| 29.076923
| 0.801223
| 0.179894
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.571429
| 1
| 0.142857
| true
| 0
| 0.285714
| 0
| 0.428571
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
90f47be06645ba00851f14cd7c007a7d8432d2b8
| 1,705
|
py
|
Python
|
phonenumbers/data/region_AC.py
|
ayushgoel/FixGoogleContacts
|
e49e58db6718bef8f95b6f767241605441c7fe41
|
[
"MIT"
] | 2
|
2019-02-22T05:27:22.000Z
|
2020-12-30T19:33:18.000Z
|
phonenumbers/data/region_AC.py
|
ayushgoel/FixGoogleContacts
|
e49e58db6718bef8f95b6f767241605441c7fe41
|
[
"MIT"
] | null | null | null |
phonenumbers/data/region_AC.py
|
ayushgoel/FixGoogleContacts
|
e49e58db6718bef8f95b6f767241605441c7fe41
|
[
"MIT"
] | null | null | null |
"""Auto-generated file, do not edit by hand. AC metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_AC = PhoneMetadata(id='AC', country_code=247, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[2-467]\\d{3}', possible_number_pattern='\\d{4}'),
fixed_line=PhoneNumberDesc(national_number_pattern='(?:[267]\\d|3[0-5]|4[4-69])\\d{2}', possible_number_pattern='\\d{4}', example_number='6889'),
mobile=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
toll_free=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
premium_rate=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
shared_cost=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
personal_number=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
voip=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
pager=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
uan=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
emergency=PhoneNumberDesc(national_number_pattern='911', possible_number_pattern='\\d{3}', example_number='911'),
voicemail=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
short_code=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
standard_rate=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
no_international_dialling=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'))
| 85.25
| 149
| 0.794721
| 209
| 1,705
| 6.119617
| 0.291866
| 0.304926
| 0.28147
| 0.422205
| 0.614543
| 0.578577
| 0.578577
| 0.578577
| 0.578577
| 0.101642
| 0
| 0.021357
| 0.066276
| 1,705
| 19
| 150
| 89.736842
| 0.782035
| 0.031085
| 0
| 0
| 1
| 0.058824
| 0.076549
| 0.020049
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.058824
| 0
| 0.058824
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
2903a87ca8ef20b939b217181d37a2379c18a9f6
| 693
|
py
|
Python
|
extras/scripts/finish_ci.py
|
connornishijima/PixieChroma
|
4812c72087550797d17f6fe4d003eda2ce1cc25a
|
[
"MIT"
] | 20
|
2021-10-30T19:15:27.000Z
|
2022-03-22T14:59:13.000Z
|
extras/scripts/finish_ci.py
|
connornishijima/PixieChroma
|
4812c72087550797d17f6fe4d003eda2ce1cc25a
|
[
"MIT"
] | 39
|
2021-10-29T22:21:53.000Z
|
2022-02-06T17:50:05.000Z
|
extras/scripts/finish_ci.py
|
connornishijima/PixieChroma
|
4812c72087550797d17f6fe4d003eda2ce1cc25a
|
[
"MIT"
] | 5
|
2021-10-30T23:55:41.000Z
|
2022-01-07T09:05:47.000Z
|
# This is just for GitHub, and is used to clean up leftover files after
# automatic testing has completed, and generate developer reports about
# anything left undocumented!
# run: "sudo python ./extras/scripts/finish_ci.py"
import os
import sys
os.system("sudo python ./extras/scripts/generate_doxygen_report.py")
os.system("sudo python ./extras/scripts/generate_keywords_report.py")
os.system("sudo python ./extras/scripts/generate_overview_report.py")
print("Cleaning up CI junk...")
os.system("ls .")
os.system("git add *")
os.system("sudo rm -r *.tar*")
os.system("sudo rm -r examples/*/build")
os.system("git commit -a -m 'Automated Cleanup'")
os.system("git push")
print("Done!" )
| 30.130435
| 71
| 0.74026
| 107
| 693
| 4.728972
| 0.542056
| 0.142292
| 0.118577
| 0.181818
| 0.322134
| 0.262846
| 0.262846
| 0.185771
| 0.185771
| 0
| 0
| 0
| 0.113997
| 693
| 22
| 72
| 31.5
| 0.824104
| 0.311688
| 0
| 0
| 1
| 0
| 0.625
| 0.277542
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.153846
| 0
| 0.153846
| 0.153846
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
2910c5c59d8ba3a8c530e8551e58a52db38377c4
| 254
|
py
|
Python
|
grafana_api/api/__init__.py
|
sedan07/grafana_api
|
4cc0b85e8660d9f21c8bd1997c5163a730ac2ee3
|
[
"MIT"
] | null | null | null |
grafana_api/api/__init__.py
|
sedan07/grafana_api
|
4cc0b85e8660d9f21c8bd1997c5163a730ac2ee3
|
[
"MIT"
] | null | null | null |
grafana_api/api/__init__.py
|
sedan07/grafana_api
|
4cc0b85e8660d9f21c8bd1997c5163a730ac2ee3
|
[
"MIT"
] | null | null | null |
from .base import Base
from .admin import Admin
from .dashboard import Dashboard
from .datasource import Datasource
from .folder import Folder
from .organisation import Organisation, Organisations
from .search import Search
from .user import User, Users
| 28.222222
| 53
| 0.826772
| 34
| 254
| 6.176471
| 0.352941
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.133858
| 254
| 8
| 54
| 31.75
| 0.954545
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
2911bd336905b53ebe454ea6d5b0bca66ffa304e
| 347
|
py
|
Python
|
SimMuon/GEMDigitizer/python/muonGEMDigi_cff.py
|
NTrevisani/cmssw
|
a212a27526f34eb9507cf8b875c93896e6544781
|
[
"Apache-2.0"
] | 3
|
2018-08-24T19:10:26.000Z
|
2019-02-19T11:45:32.000Z
|
SimMuon/GEMDigitizer/python/muonGEMDigi_cff.py
|
NTrevisani/cmssw
|
a212a27526f34eb9507cf8b875c93896e6544781
|
[
"Apache-2.0"
] | 7
|
2016-07-17T02:34:54.000Z
|
2019-08-13T07:58:37.000Z
|
SimMuon/GEMDigitizer/python/muonGEMDigi_cff.py
|
NTrevisani/cmssw
|
a212a27526f34eb9507cf8b875c93896e6544781
|
[
"Apache-2.0"
] | 5
|
2018-08-21T16:37:52.000Z
|
2020-01-09T13:33:17.000Z
|
import FWCore.ParameterSet.Config as cms
from SimMuon.GEMDigitizer.muonGEMDigis_cfi import *
from SimMuon.GEMDigitizer.muonGEMPadDigis_cfi import *
from SimMuon.GEMDigitizer.muonGEMPadDigiClusters_cfi import *
muonGEMDigiTask = cms.Task(simMuonGEMDigis, simMuonGEMPadDigis, simMuonGEMPadDigiClusters)
muonGEMDigi = cms.Sequence(muonGEMDigiTask)
| 38.555556
| 90
| 0.864553
| 34
| 347
| 8.735294
| 0.588235
| 0.111111
| 0.232323
| 0.13468
| 0.215488
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.074928
| 347
| 8
| 91
| 43.375
| 0.925234
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
29320044fb1e6ea2d550bb85edcedd897afb61eb
| 28,020
|
py
|
Python
|
flask_app.py
|
mdaeron/clumpycrunch
|
463d9241477acc557c4635b4d4f1f5338bf37617
|
[
"BSD-3-Clause"
] | null | null | null |
flask_app.py
|
mdaeron/clumpycrunch
|
463d9241477acc557c4635b4d4f1f5338bf37617
|
[
"BSD-3-Clause"
] | 1
|
2020-05-27T21:09:16.000Z
|
2020-05-27T21:09:16.000Z
|
flask_app.py
|
mdaeron/clumpycrunch
|
463d9241477acc557c4635b4d4f1f5338bf37617
|
[
"BSD-3-Clause"
] | null | null | null |
#! /usr/bin/env python3
# from datetime import datetime
# from random import choices
# from string import ascii_lowercase
from flask import Flask, request, render_template, Response, send_file
from flaskext.markdown import Markdown
from D47crunch import D47data, pretty_table, make_csv, smart_type
from D47crunch import __version__ as vD47crunch
import zipfile, io, time
from pylab import *
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
import base64
from werkzeug.wsgi import FileWrapper
from matplotlib import rcParams
# rcParams['backend'] = 'Agg'
# rcParams['interactive'] = False
rcParams['font.family'] = 'Helvetica'
rcParams['font.sans-serif'] = 'Helvetica'
rcParams['font.size'] = 10
rcParams['mathtext.fontset'] = 'custom'
rcParams['mathtext.rm'] = 'sans'
rcParams['mathtext.bf'] = 'sans:bold'
rcParams['mathtext.it'] = 'sans:italic'
rcParams['mathtext.cal'] = 'sans:italic'
rcParams['mathtext.default'] = 'rm'
rcParams['xtick.major.size'] = 4
rcParams['xtick.major.width'] = 1
rcParams['ytick.major.size'] = 4
rcParams['ytick.major.width'] = 1
rcParams['axes.grid'] = False
rcParams['axes.linewidth'] = 1
rcParams['grid.linewidth'] = .75
rcParams['grid.linestyle'] = '-'
rcParams['grid.alpha'] = .15
rcParams['savefig.dpi'] = 150
__author__ = 'Mathieu Daëron'
__contact__ = 'daeron@lsce.ipsl.fr'
__copyright__ = 'Copyright (c) 2020 Mathieu Daëron'
__license__ = 'Modified BSD License - https://opensource.org/licenses/BSD-3-Clause'
__date__ = '2020-04-22'
__version__ = '2.1.dev2'
rawdata_input_str = '''UID\tSession\tSample\td45\td46\td47\tNominal_d13C_VPDB\tNominal_d18O_VPDB
A01\tSession01\tETH-1\t5.795017\t11.627668\t16.893512\t2.02\t-2.19
A02\tSession01\tIAEA-C1\t6.219070\t11.491072\t17.277490
A03\tSession01\tETH-2\t-6.058681\t-4.817179\t-11.635064\t-10.17\t-18.69
A04\tSession01\tIAEA-C2\t-3.861839\t4.941839\t0.606117
A05\tSession01\tETH-3\t5.543654\t12.052277\t17.405548\t1.71\t-1.78
A06\tSession01\tMERCK\t-35.929352\t-2.087501\t-39.548484
A07\tSession01\tETH-4\t-6.222218\t-5.194170\t-11.944111
A08\tSession01\tETH-2\t-6.067055\t-4.877104\t-11.699265\t-10.17\t-18.69
A09\tSession01\tMERCK\t-35.930739\t-2.080798\t-39.545632
A10\tSession01\tETH-1\t5.788207\t11.559104\t16.801908\t2.02\t-2.19
A11\tSession01\tETH-4\t-6.217508\t-5.221407\t-11.987503
A12\tSession01\tIAEA-C2\t-3.876921\t4.868892\t0.521845
A13\tSession01\tETH-3\t5.539840\t12.013444\t17.368631\t1.71\t-1.78
A14\tSession01\tIAEA-C1\t6.219046\t11.447846\t17.234280
A15\tSession01\tMERCK\t-35.932060\t-2.088659\t-39.531627
A16\tSession01\tETH-3\t5.516658\t11.978320\t17.295740\t1.71\t-1.78
A17\tSession01\tETH-4\t-6.223370\t-5.253980\t-12.025298
A18\tSession01\tETH-2\t-6.069734\t-4.868368\t-11.688559\t-10.17\t-18.69
A19\tSession01\tIAEA-C1\t6.213642\t11.465109\t17.244547
A20\tSession01\tETH-1\t5.789982\t11.535603\t16.789811\t2.02\t-2.19
A21\tSession01\tETH-4\t-6.205703\t-5.144529\t-11.909160
A22\tSession01\tIAEA-C1\t6.212646\t11.406548\t17.187214
A23\tSession01\tETH-3\t5.531413\t11.976697\t17.332700\t1.71\t-1.78
A24\tSession01\tMERCK\t-35.926347\t-2.124579\t-39.582201
A25\tSession01\tETH-1\t5.786979\t11.527864\t16.775547\t2.02\t-2.19
A26\tSession01\tIAEA-C2\t-3.866505\t4.874630\t0.525332
A27\tSession01\tETH-2\t-6.076302\t-4.922424\t-11.753283\t-10.17\t-18.69
A28\tSession01\tIAEA-C2\t-3.878438\t4.818588\t0.467595
A29\tSession01\tETH-3\t5.546458\t12.133931\t17.501646\t1.71\t-1.78
A30\tSession01\tETH-1\t5.802916\t11.642685\t16.904286\t2.02\t-2.19
A31\tSession01\tETH-2\t-6.069274\t-4.847919\t-11.677722\t-10.17\t-18.69
A32\tSession01\tETH-3\t5.523018\t12.007363\t17.362080\t1.71\t-1.78
A33\tSession01\tETH-1\t5.802333\t11.616032\t16.884255\t2.02\t-2.19
A34\tSession01\tETH-3\t5.537375\t12.000263\t17.350856\t1.71\t-1.78
A35\tSession01\tETH-2\t-6.060713\t-4.893088\t-11.728465\t-10.17\t-18.69
A36\tSession01\tETH-3\t5.532342\t11.990022\t17.342273\t1.71\t-1.78
A37\tSession01\tETH-3\t5.533622\t11.980853\t17.342245\t1.71\t-1.78
A38\tSession01\tIAEA-C2\t-3.867587\t4.893554\t0.540404
A39\tSession01\tIAEA-C1\t6.201760\t11.406628\t17.189625
A40\tSession01\tETH-1\t5.802150\t11.563414\t16.836189\t2.02\t-2.19
A41\tSession01\tETH-2\t-6.068598\t-4.897545\t-11.722343\t-10.17\t-18.69
A42\tSession01\tMERCK\t-35.928359\t-2.098440\t-39.577150
A43\tSession01\tETH-4\t-6.219175\t-5.168031\t-11.936923
A44\tSession01\tIAEA-C2\t-3.871671\t4.871517\t0.518290
B01\tSession02\tETH-1\t5.800180\t11.640916\t16.939044\t2.02\t-2.19
B02\tSession02\tETH-1\t5.799584\t11.631297\t16.917656\t2.02\t-2.19
B03\tSession02\tIAEA-C1\t6.225135\t11.512637\t17.335876
B04\tSession02\tETH-2\t-6.030415\t-4.746444\t-11.525506\t-10.17\t-18.69
B05\tSession02\tIAEA-C2\t-3.837017\t4.992780\t0.675292
B06\tSession02\tETH-3\t5.536997\t12.048918\t17.420228\t1.71\t-1.78
B07\tSession02\tMERCK\t-35.928379\t-2.105615\t-39.594573
B08\tSession02\tETH-4\t-6.218801\t-5.185168\t-11.964407
B09\tSession02\tETH-2\t-6.068197\t-4.840037\t-11.686296\t-10.17\t-18.69
B10\tSession02\tMERCK\t-35.926951\t-2.071047\t-39.546767
B11\tSession02\tETH-1\t5.782634\t11.571818\t16.835185\t2.02\t-2.19
B12\tSession02\tETH-2\t-6.070168\t-4.877700\t-11.703876\t-10.17\t-18.69
B13\tSession02\tETH-4\t-6.214873\t-5.190550\t-11.967040
B14\tSession02\tIAEA-C2\t-3.853550\t4.919425\t0.584634
B15\tSession02\tETH-3\t5.522265\t12.011737\t17.368407\t1.71\t-1.78
B16\tSession02\tIAEA-C1\t6.219374\t11.447014\t17.264258
B17\tSession02\tMERCK\t-35.927733\t-2.103033\t-39.603494
B18\tSession02\tETH-3\t5.527002\t11.984062\t17.332660\t1.71\t-1.78
B19\tSession02\tIAEA-C2\t-3.850358\t4.889230\t0.562794
B20\tSession02\tETH-4\t-6.222398\t-5.263817\t-12.033650
B21\tSession02\tETH-3\t5.525478\t11.970096\t17.340498\t1.71\t-1.78
B22\tSession02\tETH-2\t-6.070129\t-4.941487\t-11.773824\t-10.17\t-18.69
B23\tSession02\tIAEA-C1\t6.217001\t11.434152\t17.232308
B24\tSession02\tETH-1\t5.793421\t11.533191\t16.810838\t2.02\t-2.19
B25\tSession02\tETH-4\t-6.217740\t-5.198048\t-11.977179
B26\tSession02\tIAEA-C1\t6.216912\t11.425200\t17.234224
B27\tSession02\tETH-3\t5.522238\t11.932174\t17.286903\t1.71\t-1.78
B28\tSession02\tMERCK\t-35.914404\t-2.133955\t-39.614612
B29\tSession02\tETH-1\t5.784156\t11.517244\t16.786548\t2.02\t-2.19
B30\tSession02\tIAEA-C2\t-3.852750\t4.884339\t0.551587
B31\tSession02\tETH-2\t-6.068631\t-4.924103\t-11.764507\t-10.17\t-18.69
B32\tSession02\tETH-4\t-6.220238\t-5.231375\t-12.009300
B33\tSession02\tIAEA-C2\t-3.855245\t4.866571\t0.534914
B34\tSession02\tETH-1\t5.788790\t11.544306\t16.809117\t2.02\t-2.19
B35\tSession02\tMERCK\t-35.935017\t-2.173682\t-39.664046
B36\tSession02\tETH-3\t5.518320\t11.955048\t17.300668\t1.71\t-1.78
B37\tSession02\tETH-1\t5.790564\t11.521174\t16.781304\t2.02\t-2.19
B38\tSession02\tETH-4\t-6.218809\t-5.205256\t-11.979998
B39\tSession02\tIAEA-C1\t6.204774\t11.391335\t17.181310
B40\tSession02\tETH-2\t-6.076424\t-4.967973\t-11.815466\t-10.17\t-18.69
C01\tSession03\tETH-3\t5.541868\t12.129615\t17.503738\t1.71\t-1.78
C02\tSession03\tETH-3\t5.534395\t12.034601\t17.391274\t1.71\t-1.78
C03\tSession03\tETH-1\t5.797568\t11.563575\t16.857871\t2.02\t-2.19
C04\tSession03\tETH-3\t5.529415\t11.969512\t17.342673\t1.71\t-1.78
C05\tSession03\tETH-1\t5.794026\t11.526540\t16.806934\t2.02\t-2.19
C06\tSession03\tETH-3\t5.527210\t11.937462\t17.294015\t1.71\t-1.78
C07\tSession03\tIAEA-C1\t6.220521\t11.430197\t17.242458
C08\tSession03\tETH-2\t-6.064061\t-4.900852\t-11.732976\t-10.17\t-18.69
C09\tSession03\tIAEA-C2\t-3.846482\t4.889242\t0.558395
C10\tSession03\tETH-1\t5.789644\t11.520663\t16.795837\t2.02\t-2.19
C11\tSession03\tETH-4\t-6.219385\t-5.258604\t-12.036476
C12\tSession03\tMERCK\t-35.936631\t-2.161769\t-39.693775
C13\tSession03\tETH-2\t-6.076357\t-4.939912\t-11.803553\t-10.17\t-18.69
C14\tSession03\tIAEA-C2\t-3.862518\t4.850015\t0.499777
C15\tSession03\tETH-3\t5.515822\t11.928316\t17.287739\t1.71\t-1.78
C16\tSession03\tETH-4\t-6.216625\t-5.252914\t-12.033781
C17\tSession03\tETH-1\t5.792540\t11.537788\t16.801906\t2.02\t-2.19
C18\tSession03\tIAEA-C1\t6.218853\t11.447394\t17.270859
C19\tSession03\tETH-2\t-6.070107\t-4.944520\t-11.806885\t-10.17\t-18.69
C20\tSession03\tMERCK\t-35.935001\t-2.155577\t-39.675070
C21\tSession03\tETH-3\t5.542309\t12.082338\t17.471951\t1.71\t-1.78
C22\tSession03\tETH-4\t-6.209017\t-5.137393\t-11.920935
C23\tSession03\tETH-1\t5.796781\t11.621197\t16.905496\t2.02\t-2.19
C24\tSession03\tMERCK\t-35.926449\t-2.053921\t-39.576918
C25\tSession03\tETH-2\t-6.057158\t-4.797641\t-11.644824\t-10.17\t-18.69
C26\tSession03\tIAEA-C1\t6.221982\t11.501725\t17.321709
C27\tSession03\tETH-3\t5.535162\t12.023486\t17.396560\t1.71\t-1.78
C28\tSession03\tIAEA-C2\t-3.836934\t4.984196\t0.665651
C29\tSession03\tETH-3\t5.531331\t11.991300\t17.353622\t1.71\t-1.78
C30\tSession03\tIAEA-C2\t-3.844008\t4.926554\t0.601156
C31\tSession03\tETH-2\t-6.063163\t-4.907454\t-11.765065\t-10.17\t-18.69
C32\tSession03\tMERCK\t-35.941566\t-2.163022\t-39.704731
C33\tSession03\tETH-3\t5.523894\t11.992718\t17.363902\t1.71\t-1.78
C34\tSession03\tIAEA-C1\t6.220801\t11.462090\t17.282153
C35\tSession03\tETH-1\t5.794369\t11.563017\t16.845673\t2.02\t-2.19
C36\tSession03\tETH-4\t-6.221257\t-5.272969\t-12.055444
C37\tSession03\tETH-3\t5.517832\t11.957180\t17.312487\t1.71\t-1.78
C38\tSession03\tETH-2\t-6.053330\t-4.909476\t-11.740852\t-10.17\t-18.69
C39\tSession03\tIAEA-C1\t6.217139\t11.440085\t17.244787
C40\tSession03\tETH-1\t5.794091\t11.541948\t16.826158\t2.02\t-2.19
C41\tSession03\tIAEA-C2\t-3.803466\t4.894953\t0.624184
C42\tSession03\tETH-3\t5.513788\t11.933062\t17.286883\t1.71\t-1.78
C43\tSession03\tETH-1\t5.793334\t11.569668\t16.844535\t2.02\t-2.19
C44\tSession03\tETH-2\t-6.064928\t-4.935031\t-11.786336\t-10.17\t-18.69
C45\tSession03\tETH-4\t-6.216796\t-5.300373\t-12.075033
C46\tSession03\tETH-3\t5.521772\t11.933713\t17.283775\t1.71\t-1.78
C47\tSession03\tMERCK\t-35.937762\t-2.181553\t-39.739636
D01\tSession04\tETH-4\t-6.218867\t-5.242334\t-12.032129
D02\tSession04\tIAEA-C1\t6.218458\t11.435622\t17.238776
D03\tSession04\tETH-3\t5.522006\t11.946540\t17.300601\t1.71\t-1.78
D04\tSession04\tMERCK\t-35.931765\t-2.175265\t-39.716152
D05\tSession04\tETH-1\t5.786884\t11.560397\t16.823187\t2.02\t-2.19
D06\tSession04\tIAEA-C2\t-3.846071\t4.861980\t0.534465
D07\tSession04\tETH-2\t-6.072653\t-4.917987\t-11.786215\t-10.17\t-18.69
D08\tSession04\tETH-3\t5.516592\t11.923729\t17.275641\t1.71\t-1.78
D09\tSession04\tETH-1\t5.789889\t11.531354\t16.804221\t2.02\t-2.19
D10\tSession04\tIAEA-C2\t-3.845074\t4.865635\t0.546284
D11\tSession04\tETH-1\t5.795006\t11.507829\t16.772751\t2.02\t-2.19
D12\tSession04\tETH-1\t5.791371\t11.540606\t16.822704\t2.02\t-2.19
D13\tSession04\tETH-2\t-6.074029\t-4.937379\t-11.786614\t-10.17\t-18.69
D14\tSession04\tETH-4\t-6.216977\t-5.273352\t-12.057294
D15\tSession04\tIAEA-C1\t6.214304\t11.412869\t17.227005
D16\tSession04\tETH-2\t-6.071021\t-4.966406\t-11.812116\t-10.17\t-18.69
D17\tSession04\tETH-3\t5.543181\t12.065648\t17.455042\t1.71\t-1.78
D18\tSession04\tETH-1\t5.805793\t11.632212\t16.937561\t2.02\t-2.19
D19\tSession04\tIAEA-C1\t6.230425\t11.518038\t17.342943
D20\tSession04\tETH-2\t-6.049292\t-4.811109\t-11.639895\t-10.17\t-18.69
D21\tSession04\tIAEA-C2\t-3.829436\t4.967992\t0.665451
D22\tSession04\tETH-3\t5.538827\t12.064780\t17.438156\t1.71\t-1.78
D23\tSession04\tMERCK\t-35.935604\t-2.092229\t-39.632228
D24\tSession04\tETH-4\t-6.215430\t-5.166894\t-11.939419
D25\tSession04\tETH-2\t-6.068214\t-4.868420\t-11.716099\t-10.17\t-18.69
D26\tSession04\tMERCK\t-35.918898\t-2.041585\t-39.566777
D27\tSession04\tETH-1\t5.786924\t11.584138\t16.861248\t2.02\t-2.19
D28\tSession04\tETH-2\t-6.062115\t-4.820423\t-11.664703\t-10.17\t-18.69
D29\tSession04\tETH-4\t-6.210819\t-5.160997\t-11.943417
D30\tSession04\tIAEA-C2\t-3.842542\t4.937635\t0.603831
D31\tSession04\tETH-3\t5.527648\t11.985083\t17.353603\t1.71\t-1.78
D32\tSession04\tIAEA-C1\t6.221429\t11.481788\t17.284825
D33\tSession04\tMERCK\t-35.922066\t-2.113682\t-39.642962
D34\tSession04\tETH-3\t5.521955\t11.989323\t17.345179\t1.71\t-1.78
D35\tSession04\tIAEA-C2\t-3.838229\t4.937180\t0.617586
D36\tSession04\tETH-4\t-6.215638\t-5.221584\t-11.999819
D37\tSession04\tETH-2\t-6.067508\t-4.893477\t-11.754488\t-10.17\t-18.69
D38\tSession04\tIAEA-C1\t6.214580\t11.440629\t17.254051'''
app = Flask(__name__)
Markdown(app, extensions = [
'markdown.extensions.tables',
# 'pymdownx.magiclink',
# 'pymdownx.betterem',
'pymdownx.highlight',
'pymdownx.tilde',
'pymdownx.caret',
# 'pymdownx.emoji',
# 'pymdownx.tasklist',
'pymdownx.superfences'
])
default_payload = {
'display_results': False,
'error_msg': '',
'rawdata_input_str': rawdata_input_str,
'o17_R13_VPDB': 0.01118,
'o17_R18_VSMOW': 0.0020052,
'o17_R17_VSMOW': 0.00038475,
'o17_lambda': 0.528,
'd13C_stdz_setting': 'd13C_stdz_setting_2pt',
'd18O_stdz_setting': 'd18O_stdz_setting_2pt',
'wg_setting': 'wg_setting_fromsamples',
# 'wg_setting_fromsample_samplename': 'ETH-3',
# 'wg_setting_fromsample_d13C': 1.71,
# 'wg_setting_fromsample_d18O': -1.78,
'acidfrac_setting': 1.008129,
'rf_input_str': '0.258\tETH-1\n0.256\tETH-2\n0.691\tETH-3',
'stdz_method_setting': 'stdz_method_setting_pooled',
}
@app.route('/faq/')
def faq():
with open(f'{app.root_path}/faq.md') as fid:
md = fid.read()
return render_template('faq.html', md = md, vD47crunch = vD47crunch)
@app.route('/readme/')
def readme():
with open(f'{app.root_path}/README.md') as fid:
md = fid.read()
headless_md = md[md.find('\n'):]
return render_template('readme.html', md = headless_md, vD47crunch = vD47crunch)
@app.route('/', methods = ['GET', 'POST'])
def main():
if request.method == 'GET':
return start()
else:
if request.form['action'] == 'Process':
return proceed()
elif request.form['action'] == 'Download zipped results':
return zipresults()
def start():
payload = default_payload.copy()
# payload['token'] = datetime.now().strftime('%y%m%d') + ''.join(choices(ascii_lowercase, k=5))
return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
def proceed():
payload = dict(request.form)
data = D47data()
if payload['d13C_stdz_setting'] == 'd13C_stdz_setting_2pt':
data.d13C_STANDARDIZATION_METHOD = '2pt'
elif payload['d13C_stdz_setting'] == 'd13C_stdz_setting_1pt':
data.d13C_STANDARDIZATION_METHOD = '1pt'
elif payload['d13C_stdz_setting'] == 'd13C_stdz_setting_none':
data.d13C_STANDARDIZATION_METHOD = 'none'
if payload['d18O_stdz_setting'] == 'd18O_stdz_setting_2pt':
data.d18O_STANDARDIZATION_METHOD = '2pt'
elif payload['d18O_stdz_setting'] == 'd18O_stdz_setting_1pt':
data.d18O_STANDARDIZATION_METHOD = '1pt'
elif payload['d18O_stdz_setting'] == 'd18O_stdz_setting_none':
data.d18O_STANDARDIZATION_METHOD = 'none'
anchors = [l.split('\t') for l in payload['rf_input_str'].splitlines() if '\t' in l]
data.Nominal_D47 = {l[1]: float(l[0]) for l in anchors}
try:
data.R13_VPDB = float(payload['o17_R13_VPDB'])
except:
payload['error_msg'] = 'Check the value of R13_VPDB in oxygen-17 correction settings.'
return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
try:
data.R18_VSMOW = float(payload['o17_R18_VSMOW'])
except:
payload['error_msg'] = 'Check the value of R18_VSMOW in oxygen-17 correction settings.'
return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
try:
data.R17_VSMOW = float(payload['o17_R17_VSMOW'])
except:
payload['error_msg'] = 'Check the value of R17_VSMOW in oxygen-17 correction settings.'
return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
try:
data.lambda_17 = float(payload['o17_lambda'])
except:
payload['error_msg'] = 'Check the value of λ in oxygen-17 correction settings.'
return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
data.input(payload['rawdata_input_str'])
# try:
# data.input(payload['rawdata_input_str'], '\t')
# except:
# payload['error_msg'] = 'Raw data input failed for some reason.'
# return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
for r in data:
for k in ['UID', 'Sample', 'Session', 'd45', 'd46', 'd47']:
if k not in r or r[k] == '':
payload['error_msg'] = f'Analysis "{r["UID"]}" is missing field "{k}".'
return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
for k in ['d45', 'd46', 'd47']:
if not isinstance(r[k], (int, float)):
payload['error_msg'] = f'Analysis "{r["UID"]}" should have a valid number for field "{k}".'
return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
if payload['wg_setting'] == 'wg_setting_fromsamples':
# if payload['wg_setting_fromsample_samplename'] == '':
# payload['error_msg'] = 'Empty sample name in WG settings.'
# return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
#
# wg_setting_fromsample_samplename = payload['wg_setting_fromsample_samplename']
#
# for s in data.sessions:
# if wg_setting_fromsample_samplename not in [r['Sample'] for r in data.sessions[s]['data']]:
# payload['error_msg'] = f'Sample name from WG settings ("{wg_setting_fromsample_samplename}") not found in session "{s}".'
# return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
#
# try:
# wg_setting_fromsample_d13C = float(payload['wg_setting_fromsample_d13C'])
# except:
# payload['error_msg'] = 'Check the δ13C value in WG settings.'
# return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
#
# try:
# wg_setting_fromsample_d18O = float(payload['wg_setting_fromsample_d18O'])
# except:
# payload['error_msg'] = 'Check the δ18O value in WG settings.'
# return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
try:
acidfrac = float(payload['acidfrac_setting'])
except:
payload['error_msg'] = 'Check the acid fractionation value.'
return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
if acidfrac == 0:
payload['error_msg'] = 'Acid fractionation value should be greater than zero.'
return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
if payload['wg_setting'] == 'wg_setting_fromsamples':
data.Nominal_d13C_VPDB = {}
data.Nominal_d18O_VPDB = {}
for r in data:
if 'Nominal_d13C_VPDB' in r:
if r['Sample'] in data.Nominal_d13C_VPDB:
if data.Nominal_d13C_VPDB[r['Sample']] != r['Nominal_d13C_VPDB']:
payload['error_msg'] = f"Inconsistent <span class='field'>Nominal_d13C_VPDB</span> value for {r['Sample']} (analysis: {r['UID']})."
return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
else:
data.Nominal_d13C_VPDB[r['Sample']] = r['Nominal_d13C_VPDB']
if 'Nominal_d18O_VPDB' in r:
if r['Sample'] in data.Nominal_d18O_VPDB:
if data.Nominal_d18O_VPDB[r['Sample']] != r['Nominal_d18O_VPDB']:
payload['error_msg'] = f"Inconsistent <span class='field'>Nominal_d18O_VPDB</span> value for {r['Sample']} (analysis {r['UID']})."
return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
else:
data.Nominal_d18O_VPDB[r['Sample']] = r['Nominal_d18O_VPDB']
try:
data.wg(a18_acid = acidfrac)
except:
payload['error_msg'] = 'WG computation failed for some reason.'
return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
if payload['wg_setting'] == 'wg_setting_explicit':
for r in data:
for k in ['d13Cwg_VPDB', 'd18Owg_VSMOW']:
if k not in r:
payload['error_msg'] = f'Analysis "{r["UID"]}" is missing field "{k}".'
return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
try:
data.crunch()
except:
payload['error_msg'] = 'Crunching step failed for some reason.'
return render_template('main.html', payload = payload, vD47crunch = vD47crunch)
method = {
'stdz_method_setting_pooled': 'pooled',
'stdz_method_setting_indep_sessions': 'indep_sessions',
}[payload['stdz_method_setting']]
data.standardize(
consolidate_tables = False,
consolidate_plots = False,
method = method)
csv = 'Session,a,b,c,va,vb,vc,covab,covac,covbc,Xa,Ya,Xu,Yu'
for session in data.sessions:
s = data.sessions[session]
Ga = [r for r in s['data'] if r['Sample'] in data.anchors]
Gu = [r for r in s['data'] if r['Sample'] in data.unknowns]
csv += f"\n{session},{s['a']},{s['b']},{s['c']},{s['CM'][0,0]},{s['CM'][1,1]},{s['CM'][2,2]},{s['CM'][0,1]},{s['CM'][0,2]},{s['CM'][1,2]},{';'.join([str(r['d47']) for r in Ga])},{';'.join([str(r['D47']) for r in Ga])},{';'.join([str(r['d47']) for r in Gu])},{';'.join([str(r['D47']) for r in Gu])}"
# payload['error_msg'] = 'Foo bar.'
# return str(payload).replace(', ','\n')
payload['display_results'] = True
payload['csv_of_sessions'] = csv
summary = data.summary(save_to_file = False, print_out = False)
tosessions = data.table_of_sessions(save_to_file = False, print_out = False)
payload['summary'] = pretty_table(summary, header = 0)
payload['summary_rows'] = len(payload['summary'].splitlines())+2
payload['summary_cols'] = len(payload['summary'].splitlines()[0])
payload['table_of_sessions'] = pretty_table(tosessions)
payload['table_of_sessions_rows'] = len(payload['table_of_sessions'].splitlines())+1
payload['table_of_sessions_cols'] = len(payload['table_of_sessions'].splitlines()[0])
payload['table_of_sessions_csv'] = make_csv(tosessions)
tosamples = data.table_of_samples(save_to_file = False, print_out = False)
payload['table_of_samples'] = pretty_table(tosamples)
payload['table_of_samples'] = payload['table_of_samples'][:] + 'NB: d18O_VSMOW is the composition of the analyzed CO2.'
payload['table_of_samples_rows'] = len(payload['table_of_samples'].splitlines())
payload['table_of_samples_cols'] = len(payload['table_of_samples'].splitlines()[0])+1
payload['table_of_samples_csv'] = make_csv(tosamples)
toanalyses = data.table_of_analyses(save_to_file = False, print_out = False)
payload['table_of_analyses'] = pretty_table(toanalyses)
payload['table_of_analyses_rows'] = len(payload['table_of_analyses'].splitlines())+1
payload['table_of_analyses_cols'] = len(payload['table_of_analyses'].splitlines()[0])
payload['table_of_analyses_csv'] = make_csv(toanalyses)
covars = "\n\nCOVARIANCE BETWEEN SAMPLE Δ47 VALUES:\n\n"
txt = [['Sample #1', 'Sample #2', 'Covariance', 'Correlation']]
unknowns = [k for k in data.unknowns]
for k, s1 in enumerate(unknowns):
for s2 in unknowns[k+1:]:
txt += [[
s1,
s2,
f"{data.sample_D47_covar(s1,s2):.4e}",
f"{data.sample_D47_covar(s1,s2)/data.samples[s1]['SE_D47']/data.samples[s2]['SE_D47']:.6f}",
]]
covars += pretty_table(txt, align = '<<>>')
payload['report'] = f"Report generated on {time.asctime()}\nClumpyCrunch v{__version__} using D47crunch v{vD47crunch}"
payload['report'] += "\n\nOXYGEN-17 CORRECTION PARAMETERS:\n" + pretty_table([['R13_VPDB', 'R18_VSMOW', 'R17_VSMOW', 'lambda_17'], [payload['o17_R13_VPDB'], payload['o17_R18_VSMOW'], payload['o17_R17_VSMOW'], payload['o17_lambda']]], align = '<<<<')
if payload['wg_setting'] == 'wg_setting_fromsample':
payload['report'] += f"\n\nWG compositions constrained by sample {wg_setting_fromsample_samplename} with:"
payload['report'] += f"\n δ13C_VPDB = {wg_setting_fromsample_d13C}"
payload['report'] += f"\n δ18O_VPDB = {wg_setting_fromsample_d18O}"
payload['report'] += f"\n(18O/16O) AFF = {wg_setting_fromsample_acidfrac}\n"
elif payload['wg_setting'] == 'wg_setting_explicit':
payload['report'] += f"\n\nWG compositions specified by user.\n"
payload['report'] += f"\n\nSUMMARY:\n{payload['summary']}"
payload['report'] += f"\n\nSAMPLES:\n{payload['table_of_samples']}\n"
payload['report'] += f"\n\nSESSIONS:\n{payload['table_of_sessions']}"
payload['report'] += f"\n\nANALYSES:\n{payload['table_of_analyses']}"
payload['report'] += covars
txt = payload['csv_of_sessions']
txt = [[x.strip() for x in l.split(',')] for l in txt.splitlines() if l.strip()]
sessions = [{k: smart_type(v) for k,v in zip(txt[0], l)} for l in txt[1:]]
payload['plots'] = []
for s in sessions:
s['Xa'] = [float(x) for x in s['Xa'].split(';')]
s['Ya'] = [float(x) for x in s['Ya'].split(';')]
s['Xu'] = [float(x) for x in s['Xu'].split(';')]
s['Yu'] = [float(x) for x in s['Yu'].split(';')]
for s in sessions:
fig = figure(figsize = (3,3))
subplots_adjust(.2,.15,.95,.9)
plot_session(s)
pngImage = io.BytesIO()
FigureCanvas(fig).print_png(pngImage)
pngImageB64String = "data:image/png;base64,"
pngImageB64String += base64.b64encode(pngImage.getvalue()).decode('utf8')
payload['plots'] += [pngImageB64String]
close(fig)
return(render_template('main.html', payload = payload, vD47crunch = vD47crunch))
# @app.route("/csv/<foo>/<filename>", methods = ['POST'])
# def get_file(foo, filename):
# payload = dict(request.form)
# return Response(
# payload[foo],
# mimetype='text/plain',
# headers={'Content-Disposition': f'attachment;filename="{filename}"'}
# )
def normalization_error(a, b, c, CM, d47, D47):
V = array([-D47, -d47, -1]) /a
return float((V @ CM @ V.T) ** .5)
def zipresults():
payload = dict(request.form)
# return str(payload).replace(', ','\n')
mem = io.BytesIO()
with zipfile.ZipFile(mem, 'w') as zf:
for k, filename in [
('report', 'report.txt'),
('table_of_sessions_csv', 'csv/sessions.csv'),
('table_of_samples_csv', 'csv/samples.csv'),
('table_of_analyses_csv', 'csv/analyses.csv'),
]:
data = zipfile.ZipInfo(f'/{filename}')
data.date_time = time.localtime(time.time())[:6]
data.compress_type = zipfile.ZIP_DEFLATED
zf.writestr(data, payload[k])
txt = payload['csv_of_sessions']
txt = [[x.strip() for x in l.split(',')] for l in txt.splitlines() if l.strip()]
sessions = [{k: smart_type(v) for k,v in zip(txt[0], l)} for l in txt[1:]]
for s in sessions:
s['Xa'] = [float(x) for x in s['Xa'].split(';')]
s['Ya'] = [float(x) for x in s['Ya'].split(';')]
s['Xu'] = [float(x) for x in s['Xu'].split(';')]
s['Yu'] = [float(x) for x in s['Yu'].split(';')]
X = [x for s in sessions for k in ['Xa', 'Xu'] for x in s[k]]
Y = [y for s in sessions for k in ['Ya', 'Yu'] for y in s[k]]
xmin, xmax, ymin, ymax = [min(X), max(X), min(Y), max(Y)]
dx = xmax - xmin
dy = ymax - ymin
xmin -= dx/20
xmax += dx/20
ymin -= dy/20
ymax += dy/20
for s in sessions:
fig = figure(figsize = (5,5))
subplots_adjust(.15,.15,.9,.9)
plot_session(s, [xmin, xmax, ymin, ymax])
buf = io.BytesIO()
savefig(buf, format = 'pdf')
close(fig)
zf.writestr(f"/sessions/{s['Session']}.pdf", buf.getvalue())
mem.seek(0)
response = Response(FileWrapper(mem), mimetype="application/zip", direct_passthrough=True)
response.headers['Content-Disposition'] = 'attachment; filename=ClumpyCrunch.zip'
return response
def plot_session(s, axislimits = []):
kw = dict(mfc = 'None', mec = (.9,0,0), mew = .75, ms = 4)
plot(s['Xa'], s['Ya'], 'x', **kw)
kw['mec'] = 'k'
plot(s['Xu'], s['Yu'], 'x', **kw)
if axislimits:
xmin, xmax, ymin, ymax = axislimits
else:
xmin, xmax, ymin, ymax = axis()
XI,YI = meshgrid(linspace(xmin, xmax), linspace(ymin, ymax))
CM = array([[s['va'], s['covab'], s['covac']], [s['covab'], s['vb'], s['covbc']], [s['covac'], s['covbc'], s['vc']]])
a, b, c = s['a'], s['b'], s['c']
SI = array([[normalization_error(a, b, c, CM, xi, yi) for xi in XI[0,:]] for yi in YI[:,0]])
rng = SI.max() - SI.min()
if rng <= 0.01:
cinterval = 0.001
elif rng <= 0.03:
cinterval = 0.004
elif rng <= 0.1:
cinterval = 0.01
elif rng <= 0.3:
cinterval = 0.03
else:
cinterval = 0.1
cval = [ceil(SI.min() / .001) * .001 + k * cinterval for k in range(int(ceil((SI.max() - SI.min()) / cinterval)))]
cs = contour(XI, YI, SI, cval, colors = 'r', alpha = .5, linewidths = .75)
clabel(cs)
axis([xmin, xmax, ymin, ymax])
xlabel('δ$_{47}$ (‰ WG)')
ylabel('Δ$_{47}$ (‰)')
title(s['Session'])
grid(alpha = .15)
| 44.975923
| 300
| 0.715667
| 4,869
| 28,020
| 4.028137
| 0.236394
| 0.004895
| 0.011778
| 0.010095
| 0.349207
| 0.228012
| 0.180034
| 0.160812
| 0.145924
| 0.132463
| 0
| 0.227334
| 0.093076
| 28,020
| 622
| 301
| 45.048232
| 0.544388
| 0.076838
| 0
| 0.127745
| 0
| 0.309381
| 0.608057
| 0.466008
| 0
| 0
| 0
| 0
| 0
| 1
| 0.015968
| false
| 0.001996
| 0.01996
| 0
| 0.077844
| 0.00998
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
2951af032672242812dfd6a7fa6b331872d27c9b
| 210
|
py
|
Python
|
prepare_sets.py
|
mechtal/Vaccination_UK
|
f3ad91c128b8b7711fc03d12a115cbf3e660318f
|
[
"MIT"
] | null | null | null |
prepare_sets.py
|
mechtal/Vaccination_UK
|
f3ad91c128b8b7711fc03d12a115cbf3e660318f
|
[
"MIT"
] | 17
|
2022-03-12T11:19:44.000Z
|
2022-03-28T08:26:38.000Z
|
prepare_sets.py
|
mechtal/Vaccination_UK
|
f3ad91c128b8b7711fc03d12a115cbf3e660318f
|
[
"MIT"
] | null | null | null |
def prepare_sets(dataset, feature_columns, y_column):
train_X, val_X, train_y, val_y = train_test_split(dataset[feature_columns], dataset[y_column], random_state=1)
return train_X, val_X, train_y, val_y
| 70
| 114
| 0.785714
| 37
| 210
| 4.027027
| 0.459459
| 0.187919
| 0.281879
| 0.134228
| 0.268456
| 0.268456
| 0.268456
| 0.268456
| 0
| 0
| 0
| 0.005376
| 0.114286
| 210
| 3
| 115
| 70
| 0.795699
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
29589b62fc1cb372684ea22b3b76f315253769f1
| 219
|
py
|
Python
|
message_handlers/location_handler.py
|
pratyushmore/lunch-tag-bot
|
e0a055a2ee914c3bc5434244b17cfb7e3b1a7a9a
|
[
"MIT"
] | null | null | null |
message_handlers/location_handler.py
|
pratyushmore/lunch-tag-bot
|
e0a055a2ee914c3bc5434244b17cfb7e3b1a7a9a
|
[
"MIT"
] | 1
|
2019-10-21T15:15:48.000Z
|
2019-10-21T19:28:10.000Z
|
message_handlers/location_handler.py
|
pratyushmore/lunch-tag-bot
|
e0a055a2ee914c3bc5434244b17cfb7e3b1a7a9a
|
[
"MIT"
] | null | null | null |
def location(messaging_adaptor, user, channel, location):
message = "Your location has been set to `{}`. You are ready to be matched for Lunch Tag :)".format(location)
messaging_adaptor.send_message(channel, message)
| 54.75
| 110
| 0.767123
| 31
| 219
| 5.322581
| 0.709677
| 0.206061
| 0.290909
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.127854
| 219
| 3
| 111
| 73
| 0.863874
| 0
| 0
| 0
| 0
| 0
| 0.365297
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0
| 0.333333
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
297cba1ed48f76e8524cfa4c59799c094d9928a0
| 368
|
py
|
Python
|
test.py
|
jdonovanCS/CS-352-Evolutionary-Computation
|
dca64068c1824dac8ec3983d7215effa426bc3bc
|
[
"BSD-3-Clause"
] | null | null | null |
test.py
|
jdonovanCS/CS-352-Evolutionary-Computation
|
dca64068c1824dac8ec3983d7215effa426bc3bc
|
[
"BSD-3-Clause"
] | null | null | null |
test.py
|
jdonovanCS/CS-352-Evolutionary-Computation
|
dca64068c1824dac8ec3983d7215effa426bc3bc
|
[
"BSD-3-Clause"
] | null | null | null |
import argparse
import collections
import os
import random
import json
from copy import deepcopy
import ConfigSpace
import numpy as np
# from tabular_benchmarks import FCNetProteinStructureBenchmark, FCNetSliceLocalizationBenchmark,\
# FCNetNavalPropulsionBenchmark, FCNetParkinsonsTelemonitoringBenchmark
from tabular_benchmarks import NASCifar10A, NASCifar10B
| 26.285714
| 98
| 0.872283
| 34
| 368
| 9.382353
| 0.617647
| 0.068966
| 0.131661
| 0.169279
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012195
| 0.108696
| 368
| 14
| 99
| 26.285714
| 0.960366
| 0.461957
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
462677ff68dd069f07b9a100cb78c22fa238e35f
| 360
|
py
|
Python
|
Interview/langTrans.py
|
dnootana/Python
|
2881bafe8bc378fa3cae50a747fcea1a55630c63
|
[
"MIT"
] | 1
|
2021-02-19T11:00:11.000Z
|
2021-02-19T11:00:11.000Z
|
Interview/langTrans.py
|
dnootana/Python
|
2881bafe8bc378fa3cae50a747fcea1a55630c63
|
[
"MIT"
] | null | null | null |
Interview/langTrans.py
|
dnootana/Python
|
2881bafe8bc378fa3cae50a747fcea1a55630c63
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python3.8
table="".maketrans("0123456789","\N{Devanagari digit zero}\N{Devanagari digit one}"
"\N{Devanagari digit two}\N{Devanagari digit three}"
"\N{Devanagari digit four}\N{Devanagari digit five}"
"\N{Devanagari digit six}\N{Devanagari digit seven}"
"\N{Devanagari digit eight}\N{Devanagari digit nine}")
print("0123456789".translate(table))
| 45
| 83
| 0.75
| 52
| 360
| 5.192308
| 0.442308
| 0.407407
| 0.592593
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.066265
| 0.077778
| 360
| 8
| 84
| 45
| 0.746988
| 0.063889
| 0
| 0
| 0
| 0
| 0.801187
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.166667
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
4636eb5b9d65657cf6249aa635cf51cca2defbb9
| 244
|
py
|
Python
|
prickly-pufferfish/python_questions/add_to_zero.py
|
Vthechamp22/summer-code-jam-2021
|
0a8bf1f22f6c73300891fd779da36efd8e1304c1
|
[
"MIT"
] | 40
|
2020-08-02T07:38:22.000Z
|
2021-07-26T01:46:50.000Z
|
prickly-pufferfish/python_questions/add_to_zero.py
|
Vthechamp22/summer-code-jam-2021
|
0a8bf1f22f6c73300891fd779da36efd8e1304c1
|
[
"MIT"
] | 134
|
2020-07-31T12:15:45.000Z
|
2020-12-13T04:42:19.000Z
|
prickly-pufferfish/python_questions/add_to_zero.py
|
Vthechamp22/summer-code-jam-2021
|
0a8bf1f22f6c73300891fd779da36efd8e1304c1
|
[
"MIT"
] | 101
|
2020-07-31T12:00:47.000Z
|
2021-11-01T09:06:58.000Z
|
"""
Write a function with a list of ints as a paramter. /
Return True if any two nums sum to 0. /
>>> add_to_zero([]) /
False /
>>> add_to_zero([1]) /
False /
>>> add_to_zero([1, 2, 3]) /
False /
>>> add_to_zero([1, 2, 3, -2]) /
True /
"""
| 14.352941
| 53
| 0.569672
| 44
| 244
| 2.977273
| 0.545455
| 0.152672
| 0.274809
| 0.320611
| 0.374046
| 0.259542
| 0.259542
| 0
| 0
| 0
| 0
| 0.04712
| 0.217213
| 244
| 16
| 54
| 15.25
| 0.638743
| 0.963115
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
466460f359120dda2e7fd00e3c8bae00cdec4a39
| 4,930
|
py
|
Python
|
ginga/canvas/coordmap.py
|
saimn/ginga
|
9daf1875b4c1b0fad0a053c5f258bf7d4c0f3455
|
[
"BSD-3-Clause"
] | null | null | null |
ginga/canvas/coordmap.py
|
saimn/ginga
|
9daf1875b4c1b0fad0a053c5f258bf7d4c0f3455
|
[
"BSD-3-Clause"
] | null | null | null |
ginga/canvas/coordmap.py
|
saimn/ginga
|
9daf1875b4c1b0fad0a053c5f258bf7d4c0f3455
|
[
"BSD-3-Clause"
] | null | null | null |
#
# coordmap.py -- coordinate mappings.
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
from ginga import trcalc
from ginga.util import wcs
from ginga.util.six.moves import map
__all__ = ['CanvasMapper', 'DataMapper', 'OffsetMapper', 'WCSMapper']
class CanvasMapper(object):
"""A coordinate mapper that maps to the viewer's canvas in
canvas coordinates.
"""
def __init__(self, viewer):
# record the viewer just in case
self.viewer = viewer
def to_canvas(self, canvas_x, canvas_y):
return (canvas_x, canvas_y)
def to_data(self, canvas_x, canvas_y):
return self.viewer.get_data_xy(canvas_x, canvas_y)
def data_to(self, data_x, data_y):
return self.viewer.get_canvas_xy(data_x, data_y)
def offset_pt(self, pt, xoff, yoff):
x, y = pt
return x + xoff, y + yoff
def rotate_pt(self, x, y, theta, xoff=0, yoff=0):
# TODO? Not sure if it is needed with this mapper type
return x, y
class CartesianMapper(object):
"""A coordinate mapper that maps to the viewer's canvas
in Cartesian coordinates that do not scale (unlike DataMapper).
"""
def __init__(self, viewer):
self.viewer = viewer
def to_canvas(self, crt_x, crt_y):
return self.viewer.offset_to_window(crt_x, crt_y)
def to_data(self, crt_x, crt_y):
return self.viewer.offset_to_data(crt_x, crt_y)
def data_to(self, data_x, data_y):
return self.viewer.data_to_offset(data_x, data_y)
def offset_pt(self, pt, xoff, yoff):
x, y = pt
return x + xoff, y + yoff
def rotate_pt(self, x, y, theta, xoff=0, yoff=0):
return trcalc.rotate_pt(x, y, theta, xoff=xoff, yoff=yoff)
class DataMapper(object):
"""A coordinate mapper that maps to the viewer's canvas
in data coordinates.
"""
def __init__(self, viewer):
self.viewer = viewer
def to_canvas(self, data_x, data_y):
return self.viewer.canvascoords(data_x, data_y)
def to_data(self, data_x, data_y):
return data_x, data_y
def data_to(self, data_x, data_y):
return data_x, data_y
def offset_pt(self, pt, xoff, yoff):
x, y = pt
return x + xoff, y + yoff
def rotate_pt(self, x, y, theta, xoff=0, yoff=0):
return trcalc.rotate_pt(x, y, theta, xoff=xoff, yoff=yoff)
class OffsetMapper(object):
"""A coordinate mapper that maps to the viewer's canvas
in data coordinates that are offsets relative to some other
reference object.
"""
def __init__(self, viewer, refobj):
# TODO: provide a keyword arg to specify which point in the obj
self.viewer = viewer
self.refobj = refobj
def calc_offsets(self, points):
ref_x, ref_y = self.refobj.get_reference_pt()
#return map(lambda x, y: x - ref_x, y - ref_y, points)
def _cvt(pt):
x, y = pt
return x - ref_x, y - ref_y
return map(_cvt, points)
def to_canvas(self, delta_x, delta_y):
data_x, data_y = self.to_data(delta_x, delta_y)
return self.viewer.canvascoords(data_x, data_y)
def to_data(self, delta_x, delta_y):
ref_x, ref_y = self.refobj.get_reference_pt()
data_x, data_y = self.refobj.crdmap.to_data(ref_x, ref_y)
return data_x + delta_x, data_y + delta_y
## def data_to(self, data_x, data_y):
## ref_x, ref_y = self.refobj.get_reference_pt()
## return data_x - ref_data_x, data_y - ref_data_y
def offset_pt(self, pt, xoff, yoff):
# A no-op because this object's points are always considered
# relative to the reference object
return pt
def rotate_pt(self, x, y, theta, xoff=0, yoff=0):
# TODO? Not sure if it is needed with this mapper type
return x, y
class WCSMapper(DataMapper):
"""A coordinate mapper that maps to the viewer's canvas
in WCS coordinates.
"""
def to_canvas(self, lon, lat):
data_x, data_y = self.to_data(lon, lat)
return super(WCSMapper, self).to_canvas(data_x, data_y)
def to_data(self, lon, lat):
image = self.viewer.get_image()
data_x, data_y = image.radectopix(lon, lat)
return data_x, data_y
def data_to(self, data_x, data_y):
image = self.viewer.get_image()
lon, lat = image.pixtoradec(data_x, data_y)
return lon, lat
def offset_pt(self, pt, xoff, yoff):
x, y = pt
return wcs.add_offset_radec(x, y, xoff, yoff)
def rotate_pt(self, x, y, theta, xoff=0, yoff=0):
# TODO: optomize by rotating in WCS space
xoff, yoff = self.to_data(xoff, yoff)
x, y = super(WCSMapper, self).rotate_pt(x, y, theta,
xoff=xoff, yoff=yoff)
x, y = self.data_to(x, y)
return x, y
#END
| 30.245399
| 71
| 0.631034
| 776
| 4,930
| 3.801546
| 0.154639
| 0.038983
| 0.044746
| 0.071186
| 0.643729
| 0.560678
| 0.538983
| 0.514915
| 0.504068
| 0.475593
| 0
| 0.002769
| 0.267546
| 4,930
| 162
| 72
| 30.432099
| 0.814179
| 0.230629
| 0
| 0.488636
| 0
| 0
| 0.011628
| 0
| 0
| 0
| 0
| 0.018519
| 0
| 1
| 0.340909
| false
| 0
| 0.034091
| 0.159091
| 0.727273
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
46750d2f3ef713a053808ca00fc559cb70158512
| 283
|
py
|
Python
|
Phase-2/Linked List/Day-70.py
|
CodedLadiesInnovateTech/python-challenges
|
22ce26c68fea6c7c243ada831e47c52e27a62127
|
[
"MIT"
] | 11
|
2020-05-11T08:41:21.000Z
|
2022-02-27T08:21:37.000Z
|
Phase-2/Linked List/Day-70.py
|
CodedLadiesInnovateTech/python-challenges
|
22ce26c68fea6c7c243ada831e47c52e27a62127
|
[
"MIT"
] | 9
|
2020-05-12T10:46:06.000Z
|
2020-05-28T17:37:19.000Z
|
Phase-2/Linked List/Day-70.py
|
CodedLadiesInnovateTech/python-challenges
|
22ce26c68fea6c7c243ada831e47c52e27a62127
|
[
"MIT"
] | 44
|
2020-05-10T20:53:32.000Z
|
2021-04-25T18:47:08.000Z
|
'''
1. Write a Python program to access a specific item in a singly linked list using index value.
2. Write a Python program to set a new value of an item in a singly linked list using index value.
3. Write a Python program to delete the first item from a singly linked list.
'''
| 31.444444
| 98
| 0.749117
| 54
| 283
| 3.925926
| 0.481481
| 0.084906
| 0.169811
| 0.268868
| 0.65566
| 0.358491
| 0.358491
| 0.358491
| 0.358491
| 0
| 0
| 0.013393
| 0.208481
| 283
| 8
| 99
| 35.375
| 0.933036
| 0.964664
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
46759a54fd059282243dcf32a6f899667fd72ec3
| 25
|
py
|
Python
|
ngboost/version.py
|
dsharpc/ngboost
|
8c05e0cb3b95bb23d8f30f17042d2fd8926c4014
|
[
"Apache-2.0"
] | null | null | null |
ngboost/version.py
|
dsharpc/ngboost
|
8c05e0cb3b95bb23d8f30f17042d2fd8926c4014
|
[
"Apache-2.0"
] | null | null | null |
ngboost/version.py
|
dsharpc/ngboost
|
8c05e0cb3b95bb23d8f30f17042d2fd8926c4014
|
[
"Apache-2.0"
] | null | null | null |
__version__ = "0.3.4dev"
| 12.5
| 24
| 0.68
| 4
| 25
| 3.25
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.136364
| 0.12
| 25
| 1
| 25
| 25
| 0.454545
| 0
| 0
| 0
| 0
| 0
| 0.32
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
467ab5f703a873dbd5ce9a6760742fdfbfa8b614
| 30
|
py
|
Python
|
tests/resources/accepted/res_0_minpyversion_3_0.py
|
matteogabburo/python-ast-utils
|
5069e9e53e8ed1f5305167254139b95967102aeb
|
[
"MIT"
] | 3
|
2020-12-22T10:43:39.000Z
|
2021-01-01T16:42:32.000Z
|
tests/resources/accepted/res_0_minpyversion_3_0.py
|
matteogabburo/python-ast-utils
|
5069e9e53e8ed1f5305167254139b95967102aeb
|
[
"MIT"
] | null | null | null |
tests/resources/accepted/res_0_minpyversion_3_0.py
|
matteogabburo/python-ast-utils
|
5069e9e53e8ed1f5305167254139b95967102aeb
|
[
"MIT"
] | null | null | null |
import os
x = 7
print(x + 1)
| 6
| 12
| 0.566667
| 7
| 30
| 2.428571
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.095238
| 0.3
| 30
| 4
| 13
| 7.5
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0.333333
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
46812ee3bdef976af898f29d2c99337fc3788ea0
| 91
|
py
|
Python
|
virtual/lib/python3.6/site-packages/macaroonbakery/tests/__init__.py
|
marknesh/pitches
|
0a480d9bc2beafaefa0121393b1502cc05edab89
|
[
"MIT"
] | null | null | null |
virtual/lib/python3.6/site-packages/macaroonbakery/tests/__init__.py
|
marknesh/pitches
|
0a480d9bc2beafaefa0121393b1502cc05edab89
|
[
"MIT"
] | 11
|
2020-06-05T20:57:31.000Z
|
2021-09-22T18:35:03.000Z
|
flask/lib/python3.6/site-packages/macaroonbakery/tests/__init__.py
|
JOFLIX/grapevines
|
34576e01184570d79cc140b42ffb71d322132da6
|
[
"MIT",
"Unlicense"
] | 1
|
2020-11-04T06:48:34.000Z
|
2020-11-04T06:48:34.000Z
|
# Copyright 2017 Canonical Ltd.
# Licensed under the LGPLv3, see LICENCE file for details.
| 30.333333
| 58
| 0.78022
| 13
| 91
| 5.461538
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.065789
| 0.164835
| 91
| 2
| 59
| 45.5
| 0.868421
| 0.945055
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
46955a61d6eda18fd04e0a7384414c8a588922bf
| 85
|
py
|
Python
|
File/admin.py
|
alstn2468/Likelion_DRF_Project
|
35a359a05185f551ed2e999ab17e0108a69d6b57
|
[
"MIT"
] | 28
|
2019-10-15T13:15:26.000Z
|
2021-11-08T08:23:45.000Z
|
15_LikeLionDRFProject/File/admin.py
|
jhleed/LikeLion_Django_Study_Summary
|
c788182af5bcfd16bdd4b57235a48659758e494b
|
[
"MIT"
] | 1
|
2021-05-22T18:27:01.000Z
|
2021-05-22T18:27:01.000Z
|
15_LikeLionDRFProject/File/admin.py
|
jhleed/LikeLion_Django_Study_Summary
|
c788182af5bcfd16bdd4b57235a48659758e494b
|
[
"MIT"
] | 17
|
2019-09-09T00:15:36.000Z
|
2021-01-28T13:08:51.000Z
|
from django.contrib import admin
from .models import File
admin.site.register(File)
| 17
| 32
| 0.811765
| 13
| 85
| 5.307692
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.117647
| 85
| 4
| 33
| 21.25
| 0.92
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
469e17c0eac34c546af54d506129856bf3802b70
| 83
|
py
|
Python
|
05_Practice1/Step06/yj.py
|
StudyForCoding/BEAKJOON
|
84e1c5e463255e919ccf6b6a782978c205420dbf
|
[
"MIT"
] | null | null | null |
05_Practice1/Step06/yj.py
|
StudyForCoding/BEAKJOON
|
84e1c5e463255e919ccf6b6a782978c205420dbf
|
[
"MIT"
] | 3
|
2020-11-04T05:38:53.000Z
|
2021-03-02T02:15:19.000Z
|
05_Practice1/Step06/yj.py
|
StudyForCoding/BEAKJOON
|
84e1c5e463255e919ccf6b6a782978c205420dbf
|
[
"MIT"
] | null | null | null |
a = int(input())
for i in range(a):
print('* '*(a-a//2))
print(' *'*(a//2))
| 20.75
| 24
| 0.433735
| 15
| 83
| 2.4
| 0.6
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.030769
| 0.216867
| 83
| 4
| 25
| 20.75
| 0.523077
| 0
| 0
| 0
| 0
| 0
| 0.047619
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
469f11caff52684e1427825fdf274cfe729dc55b
| 231
|
py
|
Python
|
greydot/errors.py
|
TralahM/greydot-api
|
34982c34bf878b2728e934147ca4ea38a78523e4
|
[
"MIT"
] | null | null | null |
greydot/errors.py
|
TralahM/greydot-api
|
34982c34bf878b2728e934147ca4ea38a78523e4
|
[
"MIT"
] | null | null | null |
greydot/errors.py
|
TralahM/greydot-api
|
34982c34bf878b2728e934147ca4ea38a78523e4
|
[
"MIT"
] | null | null | null |
class NoMessageRecipients(Exception):
"""
Raised when Message Recipients are not specified.
"""
pass
class InvalidAmount(Exception):
"""
Raised when an invalid currency amount is specified
"""
pass
| 19.25
| 55
| 0.666667
| 23
| 231
| 6.695652
| 0.73913
| 0.194805
| 0.246753
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.251082
| 231
| 11
| 56
| 21
| 0.890173
| 0.437229
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
46a2b9041cbdb5a67a2d23664c83d5328cdf8c09
| 260
|
py
|
Python
|
apps/tasks/api/views.py
|
dayvidemerson/django-rest-example
|
85eabb1e154cfd8ebc0019080b37cd3f1302c206
|
[
"MIT"
] | null | null | null |
apps/tasks/api/views.py
|
dayvidemerson/django-rest-example
|
85eabb1e154cfd8ebc0019080b37cd3f1302c206
|
[
"MIT"
] | null | null | null |
apps/tasks/api/views.py
|
dayvidemerson/django-rest-example
|
85eabb1e154cfd8ebc0019080b37cd3f1302c206
|
[
"MIT"
] | null | null | null |
from rest_framework import viewsets
from rest_framework import generics
from ..models import Task
from .serializers import TaskSerializer
class TaskViewSet(viewsets.ModelViewSet):
serializer_class = TaskSerializer
queryset = Task.objects.all()
| 21.666667
| 41
| 0.796154
| 29
| 260
| 7.034483
| 0.586207
| 0.078431
| 0.166667
| 0.22549
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.153846
| 260
| 12
| 42
| 21.666667
| 0.927273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.571429
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
d3dd8c075e4b425fd099e7113200bcfa2c88d3c5
| 152
|
py
|
Python
|
seisflows/system/lsf_sm.py
|
jpvantassel/seisflows
|
5155ec177b5df0218e1fb5204f1fcd6969c66f20
|
[
"BSD-2-Clause"
] | 97
|
2016-11-18T21:19:28.000Z
|
2022-03-31T15:02:42.000Z
|
seisflows/system/lsf_sm.py
|
SuwenJunliu/seisflows
|
14d246691acf8e8549487a5db7c7cd877d23a2ae
|
[
"BSD-2-Clause"
] | 30
|
2017-02-21T14:54:14.000Z
|
2021-08-30T01:44:39.000Z
|
seisflows/system/lsf_sm.py
|
SuwenJunliu/seisflows
|
14d246691acf8e8549487a5db7c7cd877d23a2ae
|
[
"BSD-2-Clause"
] | 78
|
2017-03-01T15:32:29.000Z
|
2022-01-31T09:09:17.000Z
|
#
# This is Seisflows
#
# See LICENCE file
#
###############################################################################
raise NotImplementedError
| 16.888889
| 79
| 0.348684
| 8
| 152
| 6.625
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098684
| 152
| 8
| 80
| 19
| 0.386861
| 0.223684
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d3f286f3f58a2b5e1d9a8943be97eb809e75f53c
| 19,191
|
py
|
Python
|
qa/char_analyze.py
|
JinkelaCrops/t2t-learning
|
5d9b5a5164af763c24f1cbce9d97561e9f2b772c
|
[
"Apache-2.0"
] | 5
|
2019-03-28T03:52:32.000Z
|
2021-02-24T07:09:26.000Z
|
qa/char_analyze.py
|
JinkelaCrops/t2t-learning
|
5d9b5a5164af763c24f1cbce9d97561e9f2b772c
|
[
"Apache-2.0"
] | null | null | null |
qa/char_analyze.py
|
JinkelaCrops/t2t-learning
|
5d9b5a5164af763c24f1cbce9d97561e9f2b772c
|
[
"Apache-2.0"
] | 2
|
2018-08-07T03:43:09.000Z
|
2019-12-09T06:41:40.000Z
|
# 所有的unicode字符
from collections import Counter
import qa.regex_utils as regutil
import re
resource_path = "/media/tmxmall/a36811aa-0e87-4ba1-b14f-370134452449/data/medicine.txt"
with open(resource_path, "r", encoding="utf8") as f:
char_stream = f.read()
char_dictionary = Counter(list(char_stream))
med_unicodes = regutil.expr_converter("[[%s]]" % "".join(char_dictionary.keys()).replace("\n", "") + "#[[\\u4e00-\\u9fff]]")
format_med_unicodes = re.sub("(?<!-)(?=\\\\u)", "\n", med_unicodes)
print(format_med_unicodes)
lines = char_stream.split("\n")
unknown_char = "[^\\u0020-\\u007e\\u4e00-\\u9fff]"
def regex_filter_line(regex, lines):
filter_sentence = list(filter(lambda x: re.search(regex, x) is not None, lines))
print("%20s" % regex, len(filter_sentence))
return len(filter_sentence)
regutil.uu_enum("\\u0020-\\u007e")
regex_filter_line("[\\u0020-\\u007e]", lines)
regex_filter_line("[\\u00a0-\\u00ff]", lines)
regex_filter_line("[\\u0100-\\u01ff]", lines)
regex_filter_line("[\\u0251]", lines)
regex_filter_line("[\\u025b]", lines)
regex_filter_line("[\\u0261]", lines)
regex_filter_line("[\\u028a]", lines)
regex_filter_line("[\\u02c6-\\u02cb]", lines)
regex_filter_line("[\\u02d0]", lines)
regex_filter_line("[\\u02d8-\\u02da]", lines)
regex_filter_line("[\\u02dc]", lines)
regex_filter_line("[\\u037a]", lines)
regex_filter_line("[\\u037e]", lines)
regex_filter_line("[\\u038a]", lines)
regex_filter_line("[\\u038c]", lines)
regex_filter_line("[\\u03cb]", lines)
regex_filter_line("[\\u03d6]", lines)
regex_filter_line("[\\u0384-\\u0385]", lines)
regex_filter_line("[\\u0387-\\u0388]", lines)
regex_filter_line("[\\u038e-\\u038f]", lines)
regex_filter_line("[\\u0391-\\u03c9]", lines)
regex_filter_line("[\\u0400-\\u04ff]", lines)
regex_filter_line("[\\u0590-\\u05ff]", lines)
regex_filter_line("[\\u0652]", lines)
regex_filter_line("[\\u11bc]", lines)
regex_filter_line("[\\u1868]", lines)
regex_filter_line("[\\u1d31]", lines)
regex_filter_line("[\\u1d52]", lines)
regex_filter_line("[\\u1d5b]", lines)
regex_filter_line("[\\u1ef7]", lines)
regex_filter_line("[\\u2016-\\u206a]", lines)
regex_filter_line("[\\u2070]", lines)
regex_filter_line("[\\u2074-\\u2075]", lines)
regex_filter_line("[\\u2077-\\u2078]", lines)
regex_filter_line("[\\u2082-\\u2084]", lines)
regex_filter_line("[\\u20ac]", lines)
regex_filter_line("[\\u2103]", lines)
regex_filter_line("[\\u2105]", lines)
regex_filter_line("[\\u2109]", lines)
regex_filter_line("[\\u2116]", lines)
regex_filter_line("[\\u2122]", lines)
regex_filter_line("[\\u212b]", lines)
regex_filter_line("[\\u2160-\\u216b]", lines)
regex_filter_line("[\\u2170-\\u2179]", lines)
regex_filter_line("[\\u21d2]", lines)
regex_filter_line("[\\u2190-\\u2193]", lines)
regex_filter_line("[\\u2206]", lines)
regex_filter_line("[\\u2208]", lines)
regex_filter_line("[\\u2211-\\u2212]", lines)
regex_filter_line("[\\u2217-\\u221a]", lines)
regex_filter_line("[\\u221d-\\u2220]", lines)
regex_filter_line("[\\u2223]", lines)
regex_filter_line("[\\u2225]", lines)
regex_filter_line("[\\u2227-\\u222b]", lines)
regex_filter_line("[\\u222e]", lines)
regex_filter_line("[\\u2234]", lines)
regex_filter_line("[\\u2237]", lines)
regex_filter_line("[\\u223c-\\u223d]", lines)
regex_filter_line("[\\u2245]", lines)
regex_filter_line("[\\u224c]", lines)
regex_filter_line("[\\u2252]", lines)
regex_filter_line("[\\u2260-\\u2261]", lines)
regex_filter_line("[\\u2264-\\u2267]", lines)
regex_filter_line("[\\u226f]", lines)
regex_filter_line("[\\u2295]", lines)
regex_filter_line("[\\u2299]", lines)
regex_filter_line("[\\u22a5]", lines)
regex_filter_line("[\\u22bf]", lines)
regex_filter_line("[\\u2312]", lines)
regex_filter_line("[\\u2395]", lines)
regex_filter_line("[\\u2460-\\u2473]", lines)
regex_filter_line("[\\u2474-\\u2487]", lines)
regex_filter_line("[\\u2488-\\u249b]", lines)
regex_filter_line("[\\u2500-\\u257f]", lines)
regex_filter_line("[\\u25a0-\\u25a1]", lines)
regex_filter_line("[\\u25b2-\\u25b4]", lines)
regex_filter_line("[\\u25c6-\\u25c7]", lines)
regex_filter_line("[\\u25ca-\\u25cb]", lines)
regex_filter_line("[\\u25ce-\\u25cf]", lines)
regex_filter_line("[\\u2605-\\u2606]", lines)
regex_filter_line("[\\u2609]", lines)
regex_filter_line("[\\u2610]", lines)
regex_filter_line("[\\u2640]", lines)
regex_filter_line("[\\u2642]", lines)
regex_filter_line("[\\u2666]", lines)
regex_filter_line("[\\u266a-\\u266b]", lines)
regex_filter_line("[\\u2714]", lines)
regex_filter_line("[\\u2717]", lines)
regex_filter_line("[\\u274f]", lines)
regex_filter_line("[\\u2751]", lines)
regex_filter_line("[\\u279f]", lines)
regex_filter_line("[\\u27a2]", lines)
regex_filter_line("[\\u27a5]", lines)
regex_filter_line("[\\u2a7d]", lines)
regex_filter_line("[\\u2fd4]", lines)
regex_filter_line("[\\u3001-\\u301e]", lines)
regex_filter_line("[\\u3022-\\u3025]", lines)
regex_filter_line("[\\u3105-\\u3107]", lines)
regex_filter_line("[\\u310a]", lines)
regex_filter_line("[\\u3111]", lines)
regex_filter_line("[\\u3113]", lines)
regex_filter_line("[\\u3116-\\u3117]", lines)
regex_filter_line("[\\u311a-\\u311b]", lines)
regex_filter_line("[\\u3122]", lines)
regex_filter_line("[\\u3125]", lines)
regex_filter_line("[\\u3127-\\u3128]", lines)
regex_filter_line("[\\u3220-\\u3229]", lines)
regex_filter_line("[\\u32a3]", lines)
regex_filter_line("[\\u338e-\\u338f]", lines)
regex_filter_line("[\\u339c-\\u339d]", lines)
regex_filter_line("[\\u33a1]", lines)
regex_filter_line("[\\u33a5]", lines)
regex_filter_line("[\\u33d5]", lines)
regex_filter_line("[\\u33d1-\\u33d2]", lines)
regex_filter_line("[\\u359e]", lines)
regex_filter_line("[\\u39d1]", lines)
regex_filter_line("[\\u41f2]", lines)
regex_filter_line("[\\u4341]", lines)
regex_filter_line("[\\u4d13]", lines)
regex_filter_line("[\\u4d15]", lines)
regex_filter_line("[\\u4e00-\\u9fff]", lines)
regex_filter_line("[\\uacf3]", lines)
regex_filter_line("[\\ucd38]", lines)
regex_filter_line("[\\ue20c-\\ue2ff]", lines)
regex_filter_line("[\\uf900-\\ufaff]", lines)
regex_filter_line("[\\ufb03]", lines)
regex_filter_line("[\\ufe30-\\ufe31]", lines)
regex_filter_line("[\\ufe33]", lines)
regex_filter_line("[\\ufe38]", lines)
regex_filter_line("[\\ufe3c-\\ufe3d]", lines)
regex_filter_line("[\\ufe3f-\\ufe41]", lines)
regex_filter_line("[\\ufe4d-\\ufe4e]", lines)
regex_filter_line("[\\ufe55-\\ufe57]", lines)
regex_filter_line("[\\ufe59-\\ufe5c]", lines)
regex_filter_line("[\\ufe5f]", lines)
regex_filter_line("[\\ufe63]", lines)
regex_filter_line("[\\ufe65-\\ufe66]", lines)
regex_filter_line("[\\ufe6a-\\ufe6b]", lines)
regex_filter_line("[\\ufeff]", lines)
regex_filter_line("[\\uff01]", lines)
regex_filter_line("[\\uff08-\\uff09]", lines)
regex_filter_line("[\\uff0c]", lines)
regex_filter_line("[\\uff1a]", lines)
regex_filter_line("[\\uff1f]", lines)
regex_filter_line("[\\uff61]", lines)
regex_filter_line("[\\uff63]", lines)
regex_filter_line("[\\uff65]", lines)
regex_filter_line("[\\uff6c]", lines)
regex_filter_line("[\\uff72]", lines)
regex_filter_line("[\\uff86]", lines)
regex_filter_line("[\\uff89]", lines)
regex_filter_line("[\\uffe0-\\uffe1]", lines)
regex_filter_line("[\\uffe3]", lines)
regex_filter_line("[\\uffe5]", lines)
regex_filter_line("[\\uffed]", lines)
regex_filter_line("[\\ufffc]", lines)
"""
[\u0020-\u007e] 13056272 \\u0020-\\u007e Latin
[\u00a0-\u00ff] 258619 \\u00a0-\\u00ff Latin ++
[\u0100-\u01ff] 353 \\u0100-\\u01ff Latin ++
[\u0251] 302 \\u0251 ɑ
[\u025b] 2 \\u025b ɛ
[\u0261] 25 \\u0261 ɡ
[\u028a] 1 \\u028a ʊ
[\u02c6-\u02cb] 870 \\u02c6-\\u02cb ˆˇˈˉˊˋ
[\u02d0] 1 \\u02d0 ː
[\u02d8-\u02da] 25 \\u02d8-\\u02da ˘˙˚
[\u02dc] 10 \\u02dc ˜
[\u037a] 1 \\u037a ͺ
[\u037e] 4 \\u037e ;
[\u038a] 3 \\u038a Ί
[\u038c] 1 \\u038c Ό
[\u03cb] 3 \\u03cb ϋ
[\u03d6] 2 \\u03d6 ϖ
[\u0384-\u0385] 8 \\u0384-\\u0385 ΄΅
[\u0387-\u0388] 2 \\u0387-\\u0388 ·Έ
[\u038e-\u038f] 2 \\u038e-\\u038f ΎΏ
[\u0391-\u03c9] 567276 \\u0391-\\u03c9 希腊
[\u0400-\u04ff] 2058 \\u0400-\\u04ff 西里尔
[\u0590-\u05ff] 34 \\u0590-\\u05ff 希伯来
[\u0652] 1 \\u0652 阿拉伯
[\u11bc] 3 \\u11bc 朝鲜
[\u1868] 1 \\u1868 ᡨ 蒙古
[\u1d31] 1 \\u1d31 ᴱ
[\u1d52] 1 \\u1d52 ᵒ
[\u1d5b] 1 \\u1d5b ᵛ
[\u1ef7] 1 \\u1ef7 ỷ Latin ++
[\u2016-\u206a] 323353 \\u2016-\\u206a punc++
[\u2070] 4 \\u2070 ⁰
[\u2074-\u2075] 9 \\u2074-\\u2075 ⁴⁵
[\u2077-\u2078] 11 \\u2077-\\u2078 ⁷⁸
[\u2082-\u2084] 13 \\u2082-\\u2084 ₂₃₄
[\u20ac] 58 \\u20ac €
[\u2103] 132218 \\u2103 ℃
[\u2105] 64 \\u2105 ℅
[\u2109] 45 \\u2109 ℉
[\u2116] 559 \\u2116 №
[\u2122] 348 \\u2122 ™
[\u212b] 5 \\u212b Å
[\u2160-\u216b] 235239 \\u2160-\\u216b ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫ
[\u2170-\u2179] 1557 \\u2170-\\u2179 ⅰⅱⅲⅳⅴⅵⅶⅷⅸ
[\u21d2] 3 \\u21d2 ⇒
[\u2190-\u2193] 15107 \\u2190-\\u2193 ←↑→↓
[\u2206] 5 \\u2206 ∆
[\u2208] 281 \\u2208 ∈
[\u2211-\u2212] 839 \\u2211-\\u2212 ∑−
[\u2217-\u221a] 75 \\u2217-\\u221a ∗∘∙√
[\u221d-\u2220] 861 \\u221d-\\u2220 ∝∞∟∠
[\u2223] 1 \\u2223 ∣
[\u2225] 80 \\u2225 ∥
[\u2227-\u222b] 226 \\u2227-\\u222b ∧∨∩∪∫
[\u222e] 8 \\u222e ∮
[\u2234] 46 \\u2234 ∴
[\u2237] 333 \\u2237 ∷
[\u223c-\u223d] 29 \\u223c-\\u223d ∼∽
[\u2245] 1 \\u2245 ≅
[\u224c] 33 \\u224c ≌
[\u2252] 4 \\u2252 ≒
[\u2260-\u2261] 555 \\u2260-\\u2261 ≠≡
[\u2264-\u2267] 31397 \\u2264-\\u2267 ≤≥≦≧
[\u226f] 3 \\u226f ≯
[\u2295] 4 \\u2295 ⊕
[\u2299] 17 \\u2299 ⊙
[\u22a5] 41 \\u22a5 ⊥
[\u22bf] 116 \\u22bf ⊿
[\u2312] 5 \\u2312 ⌒
[\u2395] 4 \\u2395 ⎕
[\u2460-\u2473] 48470 \\u2460-\\u2473 ①②③④⑤⑥⑦⑧⑨⑩ ⑳
[\u2474-\u2487] 1267 \\u2474-\\u2487 ⑴⑵⑶⑷⑸⑹⑺⑻⑼⑽ ⒇
[\u2488-\u249b] 107 \\u2488-\\u249b ⒈⒉⒊⒋⒌⒍⒎⒏⒐⒑ ⒛
[\u2500-\u257f] 566 \\u2500-\\u257f ─━│┃┄┅┆┇┈┉┊
[\u25a0-\u25a1] 1052 \\u25a0-\\u25a1 ■□
[\u25b2-\u25b4] 3695 \\u25b2-\\u25b4 ▲△▴
[\u25c6-\u25c7] 205 \\u25c6-\\u25c7 ◆◇
[\u25ca-\u25cb] 339 \\u25ca-\\u25cb ◊○
[\u25ce-\u25cf] 767 \\u25ce-\\u25cf ◎●
[\u2605-\u2606] 196 \\u2605-\\u2606 ★☆
[\u2609] 3 \\u2609 ☉
[\u2610] 35 \\u2610 ☐
[\u2640] 1017 \\u2640 ♀
[\u2642] 1108 \\u2642 ♂
[\u2666] 2 \\u2666 ♦
[\u266a-\u266b] 9 \\u266a-\\u266b ♪♫
[\u2714] 4 \\u2714 ✔
[\u2717] 1 \\u2717 ✗
[\u274f] 1 \\u274f ❏
[\u2751] 2 \\u2751 ❑
[\u279f] 1 \\u279f ➟
[\u27a2] 6 \\u27a2 ➢
[\u27a5] 1 \\u27a5 ➥
[\u2a7d] 3 \\u2a7d ⩽
[\u2fd4] 2 \\u2fd4 ⿔ CJK++
[\u3001-\u301e] 7028921 \\u3001-\\u301e CJK punc
[\u3022-\u3025] 8 \\u3022-\\u3025 〢〣〤〥
[\u3105-\u3107] 8 \\u3105-\\u3107 ㄅㄆ
[\u310a] 1 \\u310a ㄊ
[\u3111] 1 \\u3111 ㄑ
[\u3113] 2 \\u3113 ㄓ
[\u3116-\u3117] 6 \\u3116-\\u3117 ㄖㄗ
[\u311a-\u311b] 2 \\u311a-\\u311b ㄚㄛ
[\u3122] 1 \\u3122 ㄢ
[\u3125] 1 \\u3125 ㄥ
[\u3127-\u3128] 11 \\u3127-\\u3128 ㄧㄨ
[\u3220-\u3229] 312 \\u3220-\\u3229 ㈠㈡㈢㈣㈤㈥㈦㈧㈨
[\u32a3] 6 \\u32a3 ㊣
[\u338e-\u338f] 125 \\u338e-\\u338f ㎎㎏
[\u339c-\u339d] 75 \\u339c-\\u339d ㎜㎝
[\u33a1] 59 \\u33a1 ㎡
[\u33a5] 1 \\u33a5 ㎥
[\u33d5] 24 \\u33d5 ㏕
[\u33d1-\u33d2] 9 \\u33d1-\\u33d2 ㏑㏒
[\u359e] 6 \\u359e 㖞
[\u39d1] 3 \\u39d1 㧑
[\u41f2] 13 \\u41f2 䇲
[\u4341] 2 \\u4341 䍁
[\u4d13] 2 \\u4d13 䴓
[\u4d15] 1 \\u4d15 䴕
[\u4e00-\u9fff] 13056199 \\u4e00-\\u9fff CJK
[\uacf3] 2 \\uacf3 곳 朝鲜++
[\ucd38] 1 \\ucd38 촸 朝鲜++
[\ue20c-\ue2ff] 1305 \\ue20c-\\ue2ff ???
[\uf900-\ufaff] 136 \\uf900-\\ufaff CJK ++
[\ufb03] 1 \\ufb03 ffi
[\ufe30-\ufe31] 941 \\ufe30-\\ufe31 ︰︱
[\ufe33] 2 \\ufe33 ︳
[\ufe38] 4 \\ufe38 ︸
[\ufe3c-\ufe3d] 33 \\ufe3c-\\ufe3d ︼︽
[\ufe3f-\ufe41] 19 \\ufe3f-\\ufe41 ︿﹀﹁
[\ufe4d-\ufe4e] 7 \\ufe4d-\\ufe4e ﹍﹎
[\ufe55-\ufe57] 102 \\ufe55-\\ufe57 ﹕﹖﹗
[\ufe59-\ufe5c] 185 \\ufe59-\\ufe5c ﹙﹚﹛
[\ufe5f] 10 \\ufe5f ﹟
[\ufe63] 70 \\ufe63 ﹣
[\ufe65-\ufe66] 551 \\ufe65-\\ufe66 ﹥﹦
[\ufe6a-\ufe6b] 233 \\ufe6a-\\ufe6b ﹪﹫
[\ufeff] 4 \\ufeff arabic ++ # FE70-FEFF
[\uff01] 886 \\uff01 !
[\uff08-\uff09] 622070 \\uff08-\\uff09 ()
[\uff0c] 3445520 \\uff0c ,
[\uff1a] 471609 \\uff1a :
[\uff1f] 9822 \\uff1f ?
[\uff61] 2 \\uff61 。
[\uff63] 1 \\uff63 」
[\uff65] 8 \\uff65 ・
[\uff6c] 2 \\uff6c ャ
[\uff72] 1 \\uff72 イ
[\uff86] 1 \\uff86 ニ
[\uff89] 1 \\uff89 ノ
[\uffe0-\uffe1] 160 \\uffe0-\\uffe1 ¢£
[\uffe3] 7143 \\uffe3  ̄
[\uffe5] 57 \\uffe5 ¥
[\uffed] 9 \\uffed ■
[\ufffc] 1 \\ufffc 
"""
"""
\\u0020-\\u007e Latin
\\u00a0-\\u00ff Latin ++
\\u0100-\\u01ff Latin ++
\\u0251 ɑ
\\u025b ɛ
\\u0261 ɡ
\\u028a ʊ
\\u02c6-\\u02cb ˆˇˈˉˊˋ
\\u02d0 ː
\\u02d8-\\u02da ˘˙˚
\\u02dc ˜
\\u037a ͺ
\\u037e ;
\\u038a Ί
\\u038c Ό
\\u03cb ϋ
\\u03d6 ϖ
\\u0384-\\u0385 ΄΅
\\u0387-\\u0388 ·Έ
\\u038e-\\u038f ΎΏ
\\u0391-\\u03c9 希腊
\\u0400-\\u04ff 西里尔
\\u0590-\\u05ff 希伯来
\\u0652 阿拉伯
\\u11bc 朝鲜
\\u1868 ᡨ 蒙古
\\u1d31 ᴱ
\\u1d52 ᵒ
\\u1d5b ᵛ
\\u1ef7 ỷ Latin ++
\\u2016-\\u206a punc++
\\u2070 ⁰
\\u2074-\\u2075 ⁴⁵
\\u2077-\\u2078 ⁷⁸
\\u2082-\\u2084 ₂₃₄
\\u20ac €
\\u2103 ℃
\\u2105 ℅
\\u2109 ℉
\\u2116 №
\\u2122 ™
\\u212b Å
\\u2160-\\u216b ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫ
\\u2170-\\u2179 ⅰⅱⅲⅳⅴⅵⅶⅷⅸ
\\u21d2 ⇒
\\u2190-\\u2193 ←↑→↓
\\u2206 ∆
\\u2208 ∈
\\u2211-\\u2212 ∑−
\\u2217-\\u221a ∗∘∙√
\\u221d-\\u2220 ∝∞∟∠
\\u2223 ∣
\\u2225 ∥
\\u2227-\\u222b ∧∨∩∪∫
\\u222e ∮
\\u2234 ∴
\\u2237 ∷
\\u223c-\\u223d ∼∽
\\u2245 ≅
\\u224c ≌
\\u2252 ≒
\\u2260-\\u2261 ≠≡
\\u2264-\\u2267 ≤≥≦≧
\\u226f ≯
\\u2295 ⊕
\\u2299 ⊙
\\u22a5 ⊥
\\u22bf ⊿
\\u2312 ⌒
\\u2395 ⎕
\\u2460-\\u2473 ①②③④⑤⑥⑦⑧⑨⑩ ⑳
\\u2474-\\u2487 ⑴⑵⑶⑷⑸⑹⑺⑻⑼⑽ ⒇
\\u2488-\\u249b ⒈⒉⒊⒋⒌⒍⒎⒏⒐⒑ ⒛
\\u2500-\\u257f ─━│┃┄┅┆┇┈┉┊
\\u25a0-\\u25a1 ■□
\\u25b2-\\u25b4 ▲△▴
\\u25c6-\\u25c7 ◆◇
\\u25ca-\\u25cb ◊○
\\u25ce-\\u25cf ◎●
\\u2605-\\u2606 ★☆
\\u2609 ☉
\\u2610 ☐
\\u2640 ♀
\\u2642 ♂
\\u2666 ♦
\\u266a-\\u266b ♪♫
\\u2714 ✔
\\u2717 ✗
\\u274f ❏
\\u2751 ❑
\\u279f ➟
\\u27a2 ➢
\\u27a5 ➥
\\u2a7d ⩽
\\u2fd4 ⿔ CJK++
\\u3001-\\u301e CJK punc
\\u3022-\\u3025 〢〣〤〥
\\u3105-\\u3107 ㄅㄆ
\\u310a ㄊ
\\u3111 ㄑ
\\u3113 ㄓ
\\u3116-\\u3117 ㄖㄗ
\\u311a-\\u311b ㄚㄛ
\\u3122 ㄢ
\\u3125 ㄥ
\\u3127-\\u3128 ㄧㄨ
\\u3220-\\u3229 ㈠㈡㈢㈣㈤㈥㈦㈧㈨
\\u32a3 ㊣
\\u338e-\\u338f ㎎㎏
\\u339c-\\u339d ㎜㎝
\\u33a1 ㎡
\\u33a5 ㎥
\\u33d5 ㏕
\\u33d1-\\u33d2 ㏑㏒
\\u359e 㖞
\\u39d1 㧑
\\u41f2 䇲
\\u4341 䍁
\\u4d13 䴓
\\u4d15 䴕
\\u4e00-\\u9fff CJK
\\uacf3 곳 朝鲜++
\\ucd38 촸 朝鲜++
\\ue20c-\\ue2ff ???
\\uf900-\\ufaff CJK ++
\\ufb03 ffi
\\ufe30-\\ufe31 ︰︱
\\ufe33 ︳
\\ufe38 ︸
\\ufe3c-\\ufe3d ︼︽
\\ufe3f-\\ufe41 ︿﹀﹁
\\ufe4d-\\ufe4e ﹍﹎
\\ufe55-\\ufe57 ﹕﹖﹗
\\ufe59-\\ufe5c ﹙﹚﹛
\\ufe5f ﹟
\\ufe63 ﹣
\\ufe65-\\ufe66 ﹥﹦
\\ufe6a-\\ufe6b ﹪﹫
\\ufeff arabic ++ # FE70-FEFF
\\uff01 !
\\uff08-\\uff09 ()
\\uff0c ,
\\uff1a :
\\uff1f ?
\\uff61 。
\\uff63 」
\\uff65 ・
\\uff6c ャ
\\uff72 イ
\\uff86 ニ
\\uff89 ノ
\\uffe0-\\uffe1 ¢£
\\uffe3  ̄
\\uffe5 ¥
\\uffed ■
\\ufffc 
"""
| 35.604824
| 124
| 0.472617
| 2,215
| 19,191
| 4.164334
| 0.237923
| 0.187229
| 0.255312
| 0.33608
| 0.189722
| 0.05399
| 0.029488
| 0.029488
| 0.029488
| 0.029488
| 0
| 0.236075
| 0.33672
| 19,191
| 538
| 125
| 35.671004
| 0.443947
| 0.000625
| 0
| 0
| 0
| 0
| 0.282933
| 0.014085
| 0
| 0
| 0
| 0
| 0
| 1
| 0.00578
| false
| 0
| 0.017341
| 0
| 0.028902
| 0.011561
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d3f53c7bfc8c69e3589a13dbe7ec8f22516451e9
| 622
|
py
|
Python
|
challenges/largest_product_array/test_largest_product.py
|
jayadams011/data-structures-and-algorithms
|
b9a49c65ca769c82b2a34d840bd1e4dd626be025
|
[
"MIT"
] | null | null | null |
challenges/largest_product_array/test_largest_product.py
|
jayadams011/data-structures-and-algorithms
|
b9a49c65ca769c82b2a34d840bd1e4dd626be025
|
[
"MIT"
] | 4
|
2018-03-22T16:56:06.000Z
|
2018-03-28T23:30:29.000Z
|
challenges/largest_product_array/test_largest_product.py
|
jayadams011/data-structures-and-algorithms
|
b9a49c65ca769c82b2a34d840bd1e4dd626be025
|
[
"MIT"
] | null | null | null |
from largest_product.py import largest_product
import pytest
def test_product_returns():
"""test if return is a single product """
assert largest_product.largest([[2, 2]]) is 4
def test_returns_largest():
""" test if return is the largest of longer array """
assert largest_product.largest([[1, 3], [6, 10], [4, 5]]) is 60
def test_empty_list():
""" test if returns msg if empty list """
assert largest_product.largest([]) == 'empty arr used'
def test_check_if_syb_has_only_1_el():
"""test for one value"""
arr = [3]
val = 0
assert largest_product.node_inside(arr, val) == 3
| 24.88
| 67
| 0.672026
| 96
| 622
| 4.145833
| 0.458333
| 0.211055
| 0.201005
| 0.203518
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.032129
| 0.199357
| 622
| 24
| 68
| 25.916667
| 0.767068
| 0
| 0
| 0
| 0
| 0
| 0.030238
| 0
| 0
| 0
| 0
| 0
| 0.333333
| 0
| null | null | 0
| 0.166667
| null | null | 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d3ffb66f226d9d5f6c6c34d8eb1cb0a764f6d67e
| 255
|
py
|
Python
|
passagens/models/classe_viagem.py
|
carlosrjhoe/Aplicacao_Formulario_com_Django
|
e16b8bc99aeb120e89c615a34261372bc81f6528
|
[
"MIT"
] | null | null | null |
passagens/models/classe_viagem.py
|
carlosrjhoe/Aplicacao_Formulario_com_Django
|
e16b8bc99aeb120e89c615a34261372bc81f6528
|
[
"MIT"
] | null | null | null |
passagens/models/classe_viagem.py
|
carlosrjhoe/Aplicacao_Formulario_com_Django
|
e16b8bc99aeb120e89c615a34261372bc81f6528
|
[
"MIT"
] | null | null | null |
from django.db import models
from django.utils.translation import gettext_lazy as _
class ClasseViagem(models.TextChoices):
ECONOMICA = 'ECO', _('Econômica')
EXECUTIVA = 'EXE', _('Executiva')
PRIMEIRA_CLASSE = 'PRI', _('Primeira')
| 36.428571
| 54
| 0.690196
| 27
| 255
| 6.296296
| 0.777778
| 0.117647
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.188235
| 255
| 7
| 55
| 36.428571
| 0.821256
| 0
| 0
| 0
| 0
| 0
| 0.136719
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
3101d2087b21203c5098923bc3b4dd50b2a5f5c1
| 616
|
py
|
Python
|
app/requests/users.py
|
codingedward/book-a-meal-api
|
36756abc225bf7e8306330f2c3e223dc32af7869
|
[
"MIT"
] | null | null | null |
app/requests/users.py
|
codingedward/book-a-meal-api
|
36756abc225bf7e8306330f2c3e223dc32af7869
|
[
"MIT"
] | null | null | null |
app/requests/users.py
|
codingedward/book-a-meal-api
|
36756abc225bf7e8306330f2c3e223dc32af7869
|
[
"MIT"
] | 2
|
2018-10-01T17:45:19.000Z
|
2020-12-07T13:48:25.000Z
|
from .base import JsonRequest
class PostRequest(JsonRequest):
@staticmethod
def rules():
return {
'email': 'required|email|unique:User,email',
'password': 'required|string|confirmed|least_string:6',
'username': 'required|alpha|least_string:3',
'role': 'integer|positive|found_in:1,2',
}
class PutRequest(JsonRequest):
@staticmethod
def rules():
return {
'password': 'string|confirmed|least_string:6',
'username': 'alpha|least_string:3',
'role': 'integer|positive|found_in:1,2',
}
| 26.782609
| 67
| 0.586039
| 62
| 616
| 5.725806
| 0.483871
| 0.123944
| 0.146479
| 0.174648
| 0.659155
| 0.450704
| 0.253521
| 0.253521
| 0.253521
| 0.253521
| 0
| 0.017937
| 0.275974
| 616
| 22
| 68
| 28
| 0.778027
| 0
| 0
| 0.444444
| 0
| 0
| 0.413961
| 0.308442
| 0
| 0
| 0
| 0
| 0
| 1
| 0.111111
| true
| 0.111111
| 0.055556
| 0.111111
| 0.388889
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 0
|
0
| 4
|
3103a85a9b3f81384b162df662d084203f7e48e2
| 3,037
|
py
|
Python
|
testing/test_input.py
|
arunumd/Rover
|
622ed4775827514a5add787ffb25b338e8faacf3
|
[
"MIT"
] | 1
|
2020-11-22T12:01:25.000Z
|
2020-11-22T12:01:25.000Z
|
testing/test_input.py
|
arunumd/Rover
|
622ed4775827514a5add787ffb25b338e8faacf3
|
[
"MIT"
] | null | null | null |
testing/test_input.py
|
arunumd/Rover
|
622ed4775827514a5add787ffb25b338e8faacf3
|
[
"MIT"
] | 2
|
2020-05-16T13:41:35.000Z
|
2021-12-30T10:28:04.000Z
|
import unittest
from modules.Input import *
class CommandInputTest(unittest.TestCase):
def setUp(self):
self.field_a_locations = ["gOtOFieldAroW8",
" go to fieLDA RoW 18 ",
"gOTOfield A rOW88"]
self.field_b_locations = ["gOtOFieldBroW8",
" go to fieLDB RoW 18 ",
"gOTOfield B rOW88"]
self.charger_locations = ["gotocharGeR",
" goTo cHaRgeR ",
" go toCHARGER "]
self.planting_locations = ["plantPotaToes inFieLDA rOW7",
" plANt caRRottsin fieldBRow 88"]
def tearDown(self):
self.field_a_locations = []
self.field_b_locations = []
self.charger_locations = []
self.planting_locations = []
def test_field_a_rows(self):
self.assertEqual(user_input(self.field_a_locations[0])[0], "FAR8")
self.assertEqual(user_input(self.field_a_locations[0])[1], "N/A")
self.assertEqual(user_input(self.field_a_locations[1])[0], "FAR18")
self.assertEqual(user_input(self.field_a_locations[1])[1], "N/A")
self.assertEqual(user_input(self.field_a_locations[2])[0], "FAR88")
self.assertEqual(user_input(self.field_a_locations[2])[1], "N/A")
def test_field_b_rows(self):
self.assertEqual(user_input(self.field_b_locations[0])[0], "FBR8")
self.assertEqual(user_input(self.field_b_locations[0])[1], "N/A")
self.assertEqual(user_input(self.field_b_locations[1])[0], "FBR18")
self.assertEqual(user_input(self.field_b_locations[1])[1], "N/A")
self.assertEqual(user_input(self.field_b_locations[2])[0], "FBR88")
self.assertEqual(user_input(self.field_b_locations[2])[1], "N/A")
def test_charger(self):
self.assertEqual(user_input(self.charger_locations[0])[0], "Charger")
self.assertEqual(user_input(self.charger_locations[0])[1], "N/A")
self.assertEqual(user_input(self.charger_locations[1])[0], "Charger")
self.assertEqual(user_input(self.charger_locations[1])[1], "N/A")
self.assertEqual(user_input(self.charger_locations[2])[0], "Charger")
self.assertEqual(user_input(self.charger_locations[2])[1], "N/A")
def test_bad_input(self):
self.assertEqual(user_input("")[0], "Invalid task")
self.assertEqual(user_input("")[1], "N/A")
self.assertEqual(user_input("fg73f37g")[0], "Invalid task")
self.assertEqual(user_input("fg73f37g")[1], "N/A")
def test_planting_instructions(self):
self.assertEqual(user_input(self.planting_locations[0])[0], "FAR7")
self.assertEqual(user_input(self.planting_locations[0])[1], "PotaToes")
self.assertEqual(user_input(self.planting_locations[1])[0], "FBR88")
self.assertEqual(user_input(self.planting_locations[1])[1], "caRRotts")
if __name__ == '__main__':
unittest.main()
| 46.723077
| 79
| 0.622654
| 376
| 3,037
| 4.787234
| 0.167553
| 0.216667
| 0.274444
| 0.346667
| 0.716111
| 0.660556
| 0.656111
| 0.577778
| 0.44
| 0.187778
| 0
| 0.035163
| 0.232137
| 3,037
| 64
| 80
| 47.453125
| 0.736707
| 0
| 0
| 0
| 0
| 0
| 0.120514
| 0
| 0
| 0
| 0
| 0
| 0.490566
| 1
| 0.132075
| false
| 0
| 0.037736
| 0
| 0.188679
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
3136a4ea2bcd00c8806e57580d4c6c2d114d3d2d
| 68
|
py
|
Python
|
11024/11024.py3.py
|
isac322/BOJ
|
35959dd1a63d75ebca9ed606051f7a649d5c0c7b
|
[
"MIT"
] | 14
|
2017-05-02T02:00:42.000Z
|
2021-11-16T07:25:29.000Z
|
11024/11024.py3.py
|
isac322/BOJ
|
35959dd1a63d75ebca9ed606051f7a649d5c0c7b
|
[
"MIT"
] | 1
|
2017-12-25T14:18:14.000Z
|
2018-02-07T06:49:44.000Z
|
11024/11024.py3.py
|
isac322/BOJ
|
35959dd1a63d75ebca9ed606051f7a649d5c0c7b
|
[
"MIT"
] | 9
|
2016-03-03T22:06:52.000Z
|
2020-04-30T22:06:24.000Z
|
for _ in range(int(input())):
print(sum(map(int, input().split())))
| 34
| 38
| 0.632353
| 11
| 68
| 3.818182
| 0.818182
| 0.380952
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.088235
| 68
| 2
| 38
| 34
| 0.677419
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
314a686b41ad5ce98c4fc71d262791e5baa688cc
| 117
|
py
|
Python
|
python/testData/completion/notImportedQualifiedName/UseImportPriorityWhenAddingImport/main.py
|
06needhamt/intellij-community
|
63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b
|
[
"Apache-2.0"
] | null | null | null |
python/testData/completion/notImportedQualifiedName/UseImportPriorityWhenAddingImport/main.py
|
06needhamt/intellij-community
|
63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b
|
[
"Apache-2.0"
] | null | null | null |
python/testData/completion/notImportedQualifiedName/UseImportPriorityWhenAddingImport/main.py
|
06needhamt/intellij-community
|
63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b
|
[
"Apache-2.0"
] | null | null | null |
import subprocess
import sys
import django.conf
import django.utils.encoding
subprocess.Popen
sys.argv
plt.<caret>
| 11.7
| 28
| 0.820513
| 17
| 117
| 5.647059
| 0.647059
| 0.25
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 117
| 10
| 29
| 11.7
| 0.923077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.571429
| null | null | 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
314ff3ce95a071becc9963a4bf86bce7daa74c66
| 2,465
|
py
|
Python
|
integration-test/830-windmill-zoom.py
|
roman-ianivskyy/vector-datasource
|
3d59c0d9856d6bc2a78c4a9273b4e850c2e41d92
|
[
"MIT"
] | null | null | null |
integration-test/830-windmill-zoom.py
|
roman-ianivskyy/vector-datasource
|
3d59c0d9856d6bc2a78c4a9273b4e850c2e41d92
|
[
"MIT"
] | null | null | null |
integration-test/830-windmill-zoom.py
|
roman-ianivskyy/vector-datasource
|
3d59c0d9856d6bc2a78c4a9273b4e850c2e41d92
|
[
"MIT"
] | null | null | null |
# -*- encoding: utf-8 -*-
import dsl
from shapely.wkt import loads as wkt_loads
from . import FixtureTest
class WindmillZoom(FixtureTest):
def test_windmill_with_attraction(self):
# update windmill zoom to 15 and if attraction zoom to 14
# windmill with tourism = attraction
self.generate_fixtures(dsl.way(287921407, wkt_loads('POLYGON ((-122.50950954605 37.77044960028441, -122.509500293403 37.77047580268178, -122.509480889793 37.77049817057459, -122.509461037025 37.770509816078, -122.509468493042 37.77057535750521, -122.509461126856 37.770575996587, -122.509454030166 37.7705140056184, -122.509453311513 37.77051436066419, -122.509420523006 37.77052259772597, -122.50938611753 37.77052195864368, -122.509353868011 37.7705125144261, -122.509327277879 37.77049540121677, -122.50930913191 37.77047232323118, -122.50930149623 37.77044576578648, -122.509305089492 37.7704187822768, -122.509319642199 37.77039407105399, -122.509343537386 37.77037461451069, -122.509374080105 37.77036218788359, -122.509408126255 37.7703583533811, -122.50943723167 37.77036268494871, -122.509432290936 37.7702980664548, -122.509441274089 37.77029771140798, -122.509446484317 37.7703654543115, -122.509471726977 37.770376886808, -122.509494364522 37.77039726647121, -122.509507479925 37.77042247475761, -122.50950954605 37.77044960028441))'), {
u'building': u'yes', u'name': u'North Windmill', u'gnis:reviewed': u'no', u'wikipedia': u'en:Golden Gate Park windmills', u'way_area': u'433.646', u'man_made': u'windmill', u'addr:state': u'CA', u'height': u'13', u'source': u'openstreetmap.org', u'gnis:import_uuid': u'57871b70-0100-4405-bb30-88b2e001a944', u'gnis:feature_id': u'1655473', u'ele': u'11', u'tourism': u'attraction', u'gnis:county_name': u'San Francisco'}))
self.assert_has_feature(
14, 2616, 6333, 'pois',
{'id': 287921407, 'kind': 'windmill'})
def test_windmill_without_attraction(self):
# windmill without tourism = attraction
self.generate_fixtures(dsl.way(2304462088, wkt_loads(
'POINT (-121.222603731272 36.38242898668528)'), {u'source': u'openstreetmap.org', u'man_made': u'windmill'}))
self.assert_no_matching_feature(
14, 2675, 6412, 'pois',
{'id': 2304462088, 'kind': 'windmill'})
self.assert_has_feature(
15, 5350, 12824, 'pois',
{'id': 2304462088, 'kind': 'windmill'})
| 79.516129
| 1,057
| 0.714807
| 305
| 2,465
| 5.698361
| 0.47541
| 0.032221
| 0.017261
| 0.033372
| 0.129459
| 0.078251
| 0.049482
| 0
| 0
| 0
| 0
| 0.465682
| 0.148884
| 2,465
| 30
| 1,058
| 82.166667
| 0.362726
| 0.061663
| 0
| 0.210526
| 0
| 0.052632
| 0.610052
| 0.015598
| 0
| 0
| 0
| 0
| 0.157895
| 1
| 0.105263
| false
| 0
| 0.210526
| 0
| 0.368421
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
31642639391c00a85e1a2f3c4f186e8a38649689
| 5,572
|
py
|
Python
|
scripts/v.py
|
NatashaChopper/stage
|
b33654b6bfaa7d291e80327d83cd6849271cc656
|
[
"BSD-2-Clause"
] | null | null | null |
scripts/v.py
|
NatashaChopper/stage
|
b33654b6bfaa7d291e80327d83cd6849271cc656
|
[
"BSD-2-Clause"
] | null | null | null |
scripts/v.py
|
NatashaChopper/stage
|
b33654b6bfaa7d291e80327d83cd6849271cc656
|
[
"BSD-2-Clause"
] | null | null | null |
import numpy
with open ("dic.txt", "w", encoding="utf-8") as dic:
for x in range(5, 790, 1):
if 92 < x <= 113:
dic.write('"'+str(x)+'"'+":"+ '"'+'1'+'",')
elif 113 < x <= 133:
dic.write('"'+str(x)+'"'+":"+ '"'+'2'+'",')
elif 133 < x <= 153:
dic.write('"'+str(x)+'"'+":"+ '"'+'3'+'",')
elif 153 < x <= 173:
dic.write('"'+str(x)+'"'+":"+ '"'+'4'+'",')
elif 173 < x <= 193:
dic.write('"'+str(x)+'"'+":"+ '"'+'5'+'",')
elif 193 < x <= 213:
dic.write('"'+str(x)+'"'+":"+ '"'+'6'+'",')
elif 213 < x <= 233:
dic.write('"'+str(x)+'"'+":"+ '"'+'7'+'",')
elif 233 < x <= 253:
dic.write('"'+str(x)+'"'+":"+ '"'+'8'+'",')
elif 253 < x <= 273:
dic.write('"'+str(x)+'"'+":"+ '"'+'9'+'",')
elif 273 < x <= 293:
dic.write('"'+str(x)+'"'+":"+ '"'+'10'+'",')
elif 293 < x <= 313:
dic.write('"'+str(x)+'"'+":"+ '"'+'11'+'",')
elif 313 < x <= 333:
dic.write('"'+str(x)+'"'+":"+ '"'+'12'+'",')
elif 333 < x <= 353:
dic.write('"'+str(x)+'"'+":"+ '"'+'13'+'",')
elif 353 < x <= 373:
dic.write('"'+str(x)+'"'+":"+ '"'+'14'+'",')
elif 373 < x <= 393:
dic.write('"'+str(x)+'"'+":"+ '"'+'15'+'",')
elif 393 < x <= 413:
dic.write('"'+str(x)+'"'+":"+ '"'+'16'+'",')
elif 413 < x <= 433:
dic.write('"'+str(x)+'"'+":"+ '"'+'17'+'",')
elif 433 < x <= 453:
dic.write('"'+str(x)+'"'+":"+ '"'+'18'+'",')
elif 453 < x <= 473:
dic.write('"'+str(x)+'"'+":"+ '"'+'19'+'",')
elif 473 < x <= 493:
dic.write('"'+str(x)+'"'+":"+ '"'+'20'+'",')
elif 493 < x <= 513:
dic.write('"'+str(x)+'"'+":"+ '"'+'21'+'",')
elif 513 < x <= 533:
dic.write('"'+str(x)+'"'+":"+ '"'+'22'+'",')
elif 533 < x <= 553:
dic.write('"'+str(x)+'"'+":"+ '"'+'23'+'",')
elif 553 < x <= 573:
dic.write('"'+str(x)+'"'+":"+ '"'+'24'+'",')
elif 573 < x <= 593:
dic.write('"'+str(x)+'"'+":"+ '"'+'25'+'",')
elif 593 < x <= 613:
dic.write('"'+str(x)+'"'+":"+ '"'+'26'+'",')
elif 613 < x <= 633:
dic.write('"'+str(x)+'"'+":"+ '"'+'27'+'",')
elif 633 < x <= 653:
dic.write('"'+str(x)+'"'+":"+ '"'+'28'+'",')
elif 653 < x <= 673:
dic.write('"'+str(x)+'"'+":"+ '"'+'29'+'",')
elif 673 < x <= 693:
dic.write('"'+str(x)+'"'+":"+ '"'+'30'+'",')
elif 693 < x <= 713:
dic.write('"'+str(x)+'"'+":"+ '"'+'31'+'",')
elif 713 < x <= 733:
dic.write('"'+str(x)+'"'+":"+ '"'+'32'+'",')
elif 733 < x <= 753:
dic.write('"'+str(x)+'"'+":"+ '"'+'33'+'",')
elif 753 < x <= 773:
dic.write('"'+str(x)+'"'+":"+ '"'+'34'+'",')
elif 773 < x <= 793:
dic.write('"'+str(x)+'"'+":"+ '"'+'35'+'",')
elif 4 < x <= 15:
dic.write('"'+str(x)+'"'+":"+ '"'+'36'+'",')
elif 15 < x <= 25:
dic.write('"'+str(x)+'"'+":"+ '"'+'37'+'",')
elif 25 < x <= 35:
dic.write('"'+str(x)+'"'+":"+ '"'+'38'+'",')
elif 35 < x <= 45:
dic.write('"'+str(x)+'"'+":"+ '"'+'39'+'",')
elif 45 < x <= 55:
dic.write('"'+str(x)+'"'+":"+ '"'+'40'+'",')
elif 55 < x <= 65:
dic.write('"'+str(x)+'"'+":"+ '"'+'41'+'",')
elif 65 < x <= 75:
dic.write('"'+str(x)+'"'+":"+ '"'+'42'+'",')
elif 75 < x <= 85:
dic.write('"'+str(x)+'"'+":"+ '"'+'43'+'",')
elif 85 < x <= 92:
dic.write('"'+str(x)+'"'+":"+ '"'+'44'+'",')
with open ("time.txt", "w", encoding="utf-8") as duree:
for y in numpy.arange(0, 1.7, 0.01):
if 0 < y <= 0.1:
duree.write('"'+str(y)+'"'+":"+ '"'+'80'+'",')
elif 0.1 < y <= 0.2:
duree.write('"'+str(y)+'"'+":"+ '"'+'81'+'",')
elif 0.2 < y <= 0.3:
duree.write('"'+str(y)+'"'+":"+ '"'+'82'+'",')
elif 0.3 < y <= 0.4:
duree.write('"'+str(y)+'"'+":"+ '"'+'83'+'",')
elif 0.4 < y <= 0.5:
duree.write('"'+str(y)+'"'+":"+ '"'+'84'+'",')
elif 0.5 < y <= 0.6:
duree.write('"'+str(y)+'"'+":"+ '"'+'85'+'",')
elif 0.6 < y <= 0.7:
duree.write('"'+str(y)+'"'+":"+ '"'+'86'+'",')
elif 0.7 < y <= 0.8:
duree.write('"'+str(y)+'"'+":"+ '"'+'87'+'",')
elif 0.8 < y <= 0.9:
duree.write('"'+str(y)+'"'+":"+ '"'+'88'+'",')
elif 0.9 < y <= 1:
duree.write('"'+str(y)+'"'+":"+ '"'+'89'+'",')
elif 1 < y <= 1.1:
duree.write('"'+str(y)+'"'+":"+ '"'+'90'+'",')
elif 1.1 < y <= 1.2:
duree.write('"'+str(y)+'"'+":"+ '"'+'91'+'",')
elif 1.2 < y <= 1.3:
duree.write('"'+str(y)+'"'+":"+ '"'+'92'+'",')
elif 1.3 < y <= 1.4:
duree.write('"'+str(y)+'"'+":"+ '"'+'93'+'",')
elif 1.4 < y <= 1.5:
duree.write('"'+str(y)+'"'+":"+ '"'+'94'+'",')
elif 1.5 < y <= 1.6:
duree.write('"'+str(y)+'"'+":"+ '"'+'95'+'",')
elif 1.6 < y <= 1.7:
duree.write('"'+str(y)+'"'+":"+ '"'+'96'+'",')
| 43.193798
| 59
| 0.288227
| 619
| 5,572
| 2.594507
| 0.201939
| 0.303861
| 0.30137
| 0.328767
| 0.162516
| 0.022416
| 0
| 0
| 0
| 0
| 0
| 0.117854
| 0.337581
| 5,572
| 129
| 60
| 43.193798
| 0.317258
| 0
| 0
| 0
| 0
| 0
| 0.092929
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.007874
| 0
| 0.007874
| 0
| 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
| 0
|
0
| 4
|
317ed9d058dadae1ec740f0850b99974ce2e984d
| 293
|
py
|
Python
|
retratodefases/phase_diagrams/__init__.py
|
Loracio/retrato-de-fases
|
a2d870a69b911af3b78288708cb569c957506940
|
[
"MIT"
] | 3
|
2021-03-22T00:07:28.000Z
|
2021-03-22T12:11:18.000Z
|
retratodefases/phase_diagrams/__init__.py
|
Loracio/retrato-de-fases
|
a2d870a69b911af3b78288708cb569c957506940
|
[
"MIT"
] | null | null | null |
retratodefases/phase_diagrams/__init__.py
|
Loracio/retrato-de-fases
|
a2d870a69b911af3b78288708cb569c957506940
|
[
"MIT"
] | 2
|
2021-03-20T19:00:53.000Z
|
2021-03-22T12:19:52.000Z
|
try:
__PHASE_DIAGRAMS_IMPORTED__
except NameError:
__PHASE_DIAGRAMS_IMPORTED__= False
if not __PHASE_DIAGRAMS_IMPORTED__:
from .phase_portrait import PhasePortrait
from .funcion1D import Funcion1D
from .nullclines import Nullcline2D
__PHASE_DIAGRAMS_IMPORTED__ = True
| 26.636364
| 45
| 0.805461
| 32
| 293
| 6.59375
| 0.53125
| 0.246446
| 0.398104
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012295
| 0.167235
| 293
| 11
| 46
| 26.636364
| 0.852459
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.777778
| 0
| 0.777778
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
3198fc009ad14ca016fe53373d72241bd818e6a1
| 231
|
py
|
Python
|
PythonExercicios/ex031.py
|
Caio-Moretti/115.Exercicios-Python
|
7e66fb1f44ea3eb4ade63f37d843242ac42ade84
|
[
"MIT"
] | null | null | null |
PythonExercicios/ex031.py
|
Caio-Moretti/115.Exercicios-Python
|
7e66fb1f44ea3eb4ade63f37d843242ac42ade84
|
[
"MIT"
] | null | null | null |
PythonExercicios/ex031.py
|
Caio-Moretti/115.Exercicios-Python
|
7e66fb1f44ea3eb4ade63f37d843242ac42ade84
|
[
"MIT"
] | null | null | null |
dis = float(input('Digite a distância da sua viagem em Km: '))
if dis <= 200:
print('O valor da sua passagem será {:.2f} reais'.format(dis * 0.5))
else:
print('O valor da sua passagem será {:.2f} reais'.format(dis * 0.45))
| 38.5
| 73
| 0.645022
| 41
| 231
| 3.634146
| 0.609756
| 0.100671
| 0.147651
| 0.174497
| 0.604027
| 0.604027
| 0.604027
| 0.604027
| 0.604027
| 0.604027
| 0
| 0.053476
| 0.190476
| 231
| 5
| 74
| 46.2
| 0.743316
| 0
| 0
| 0
| 0
| 0
| 0.528139
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.4
| 0
| 0
| 0
| 0.4
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
319aeea582f12d05f825c637fc9e26f9381d34d7
| 94
|
py
|
Python
|
TWITOFF/__init__.py
|
DSPT3/Twitoff
|
ba4a0359942a9981c9d985fa0a30cd0b44dd1d98
|
[
"MIT"
] | null | null | null |
TWITOFF/__init__.py
|
DSPT3/Twitoff
|
ba4a0359942a9981c9d985fa0a30cd0b44dd1d98
|
[
"MIT"
] | 4
|
2021-06-08T21:03:37.000Z
|
2022-03-12T00:21:25.000Z
|
TWITOFF/__init__.py
|
DSPT3/Twitoff
|
ba4a0359942a9981c9d985fa0a30cd0b44dd1d98
|
[
"MIT"
] | 2
|
2020-02-28T11:59:32.000Z
|
2021-07-12T02:28:34.000Z
|
""" Entry Point for Our Twitoff Flask App """
from .app import create_app
APP = create_app()
| 18.8
| 45
| 0.712766
| 15
| 94
| 4.333333
| 0.666667
| 0.276923
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.180851
| 94
| 5
| 46
| 18.8
| 0.844156
| 0.393617
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
31bc16b72d793c3793926c951b8b26eb5b85e70b
| 43
|
py
|
Python
|
python/testData/intentions/convertLambdaToFunction.py
|
jnthn/intellij-community
|
8fa7c8a3ace62400c838e0d5926a7be106aa8557
|
[
"Apache-2.0"
] | 2
|
2019-04-28T07:48:50.000Z
|
2020-12-11T14:18:08.000Z
|
python/testData/intentions/convertLambdaToFunction.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 173
|
2018-07-05T13:59:39.000Z
|
2018-08-09T01:12:03.000Z
|
python/testData/intentions/convertLambdaToFunction.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 2
|
2020-03-15T08:57:37.000Z
|
2020-04-07T04:48:14.000Z
|
newlist = lambda x<caret>, y: (x+y)/y
x = 1
| 21.5
| 37
| 0.581395
| 10
| 43
| 2.5
| 0.6
| 0.16
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.028571
| 0.186047
| 43
| 2
| 38
| 21.5
| 0.685714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
9ec518765538fd6d2d3d18e0ed23d60b0ac69f7f
| 58
|
py
|
Python
|
tests/__init__.py
|
bio2bel/famplex
|
3a1dfb0f3da3eb33c2b4de658cf02ffb6b5bebaa
|
[
"MIT"
] | null | null | null |
tests/__init__.py
|
bio2bel/famplex
|
3a1dfb0f3da3eb33c2b4de658cf02ffb6b5bebaa
|
[
"MIT"
] | 3
|
2018-07-24T14:32:41.000Z
|
2018-08-10T11:17:49.000Z
|
tests/__init__.py
|
bio2bel/famplex
|
3a1dfb0f3da3eb33c2b4de658cf02ffb6b5bebaa
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
"""Tests for Bio2BEL FamPlex."""
| 14.5
| 32
| 0.551724
| 7
| 58
| 4.571429
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.041667
| 0.172414
| 58
| 3
| 33
| 19.333333
| 0.625
| 0.844828
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
9ec6363df3d16f3e41bfd55d3ca8396d912ca17a
| 160
|
py
|
Python
|
mazeexperiment/__main__.py
|
NickAnderegg/rpacr-mazeexperiment
|
3afe6afb10b4ad61a169645e59f2ad0d0f92f565
|
[
"MIT"
] | null | null | null |
mazeexperiment/__main__.py
|
NickAnderegg/rpacr-mazeexperiment
|
3afe6afb10b4ad61a169645e59f2ad0d0f92f565
|
[
"MIT"
] | null | null | null |
mazeexperiment/__main__.py
|
NickAnderegg/rpacr-mazeexperiment
|
3afe6afb10b4ad61a169645e59f2ad0d0f92f565
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
"""mazeexperiment.__main__: executed when mazeexperiment directory is called as script."""
from .mazeexperiment import main
main()
| 20
| 90
| 0.71875
| 18
| 160
| 6.166667
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007353
| 0.15
| 160
| 7
| 91
| 22.857143
| 0.808824
| 0.66875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
9ec95a1a1ec287a29e316037c8a1f39e97c4bff8
| 97
|
py
|
Python
|
funolympics/apps.py
|
codeema/Yokiyo
|
2e710bca487ee393784c116b7db2db7337f73d40
|
[
"MIT"
] | null | null | null |
funolympics/apps.py
|
codeema/Yokiyo
|
2e710bca487ee393784c116b7db2db7337f73d40
|
[
"MIT"
] | 6
|
2020-05-20T15:29:55.000Z
|
2021-09-08T02:02:43.000Z
|
funolympics/apps.py
|
codeema/Yokiyo
|
2e710bca487ee393784c116b7db2db7337f73d40
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class FunolympicsConfig(AppConfig):
name = 'funolympics'
| 16.166667
| 35
| 0.773196
| 10
| 97
| 7.5
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.154639
| 97
| 5
| 36
| 19.4
| 0.914634
| 0
| 0
| 0
| 0
| 0
| 0.113402
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
9ecf156b5761ad136db575bc3923db3ea214ba15
| 5,939
|
py
|
Python
|
mmtbx/validation/regression/tst_restraints.py
|
dperl-sol/cctbx_project
|
b9e390221a2bc4fd00b9122e97c3b79c632c6664
|
[
"BSD-3-Clause-LBNL"
] | 155
|
2016-11-23T12:52:16.000Z
|
2022-03-31T15:35:44.000Z
|
mmtbx/validation/regression/tst_restraints.py
|
dperl-sol/cctbx_project
|
b9e390221a2bc4fd00b9122e97c3b79c632c6664
|
[
"BSD-3-Clause-LBNL"
] | 590
|
2016-12-10T11:31:18.000Z
|
2022-03-30T23:10:09.000Z
|
mmtbx/validation/regression/tst_restraints.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 libtbx.utils import null_out
from libtbx import easy_pickle
from six.moves import cStringIO as StringIO
def run_validation(pdb_file, ignore_hd=True):
from mmtbx.validation import restraints
import mmtbx.command_line
cmdline = mmtbx.command_line.load_model_and_data(
args=[pdb_file],
master_phil=mmtbx.command_line.generic_simple_input_phil(),
process_pdb_file=True,
require_data=False,
out=null_out())
validation = restraints.combined(
pdb_hierarchy=cmdline.pdb_hierarchy,
xray_structure=cmdline.xray_structure,
geometry_restraints_manager=cmdline.geometry,
ignore_hd=ignore_hd)
return validation
def exercise_simple():
# extracted from 1lyz, with hydrogens from reduce
pdb_in = """
ATOM 1 N LYS A 1 3.296 9.888 10.739 1.00 7.00 N
ATOM 2 CA LYS A 1 2.439 10.217 9.791 1.00 6.00 C
ATOM 3 C LYS A 1 2.439 11.997 9.160 1.00 6.00 C
ATOM 4 O LYS A 1 2.637 12.656 10.107 1.00 8.00 O
ATOM 5 CB LYS A 1 0.659 10.086 8.844 1.00 6.00 C
ATOM 6 CG LYS A 1 0.198 10.415 8.086 1.00 6.00 C
ATOM 7 CD LYS A 1 -1.187 10.086 8.212 1.00 6.00 C
ATOM 8 CE LYS A 1 -2.175 10.086 7.264 1.00 6.00 C
ATOM 9 NZ LYS A 1 -3.527 9.869 7.288 1.00 7.00 N
ATOM 0 H1 LYS A 1 3.156 9.045 10.986 1.00 7.00 H
ATOM 0 H2 LYS A 1 4.127 9.972 10.431 1.00 7.00 H
ATOM 0 H3 LYS A 1 3.184 10.425 11.440 1.00 7.00 H
ATOM 0 HA LYS A 1 2.772 9.314 9.912 1.00 6.00 H
ATOM 0 HB2 LYS A 1 0.584 9.128 8.712 1.00 6.00 H
ATOM 0 HB3 LYS A 1 0.046 10.323 9.557 1.00 6.00 H
ATOM 0 HG2 LYS A 1 0.310 11.376 8.015 1.00 6.00 H
ATOM 0 HG3 LYS A 1 0.563 10.027 7.276 1.00 6.00 H
ATOM 0 HD2 LYS A 1 -1.193 9.186 8.573 1.00 6.00 H
ATOM 0 HD3 LYS A 1 -1.516 10.674 8.910 1.00 6.00 H
ATOM 0 HE2 LYS A 1 -2.097 10.964 6.860 1.00 6.00 H
ATOM 0 HE3 LYS A 1 -1.857 9.444 6.610 1.00 6.00 H
ATOM 0 HZ1 LYS A 1 -3.725 9.170 6.774 1.00 7.00 H
ATOM 0 HZ2 LYS A 1 -3.787 9.706 8.123 1.00 7.00 H
ATOM 0 HZ3 LYS A 1 -3.949 10.590 6.982 1.00 7.00 H
ATOM 10 N VAL A 2 2.637 12.722 7.707 1.00 7.00 N
ATOM 11 CA VAL A 2 2.307 14.172 7.580 1.00 6.00 C
ATOM 12 C VAL A 2 0.857 14.041 6.949 1.00 6.00 C
ATOM 13 O VAL A 2 0.659 13.843 5.875 1.00 8.00 O
ATOM 14 CB VAL A 2 3.625 14.172 6.759 1.00 6.00 C
ATOM 15 CG1 VAL A 2 3.494 15.491 6.317 1.00 6.00 C
ATOM 16 CG2 VAL A 2 4.746 13.843 7.580 1.00 6.00 C
ATOM 0 H VAL A 2 2.920 12.338 6.992 1.00 7.00 H
ATOM 0 HA VAL A 2 2.195 14.925 8.181 1.00 6.00 H
ATOM 0 HB VAL A 2 3.767 13.528 6.048 1.00 6.00 H
ATOM 0 HG11 VAL A 2 4.250 15.721 5.755 1.00 6.00 H
ATOM 0 HG12 VAL A 2 2.674 15.582 5.808 1.00 6.00 H
ATOM 0 HG13 VAL A 2 3.467 16.087 7.081 1.00 6.00 H
ATOM 0 HG21 VAL A 2 5.554 13.850 7.043 1.00 6.00 H
ATOM 0 HG22 VAL A 2 4.827 14.495 8.294 1.00 6.00 H
ATOM 0 HG23 VAL A 2 4.620 12.960 7.962 1.00 6.00 H
END
"""
pdb_file = "tst_validate_restraints_simple.pdb"
open(pdb_file, "w").write(pdb_in)
v1 = run_validation(pdb_file, ignore_hd=True)
out1 = StringIO()
v1.show(out=out1)
assert ("""
----------Chiral volumes----------
atoms ideal model delta sigma residual deviation
A 1 LYS CA
A 1 LYS N
A 1 LYS C
A 1 LYS CB 2.57 1.12 1.45 2.00e-01 5.25e+01 7.2*sigma
""" in "\n".join([ l.rstrip() for l in out1.getvalue().splitlines() ]))
s = easy_pickle.dumps(v1)
v1p = easy_pickle.loads(s)
out1p = StringIO()
v1p.show(out=out1p)
assert (out1.getvalue() == out1p.getvalue())
v2 = run_validation(pdb_file, ignore_hd=False)
out2 = StringIO()
v2.show(out=out2)
assert (out2.getvalue() != out1.getvalue())
assert ("""\
A 1 LYS HA 110.00 57.00 53.00 3.00e+00 3.12e+02 17.7*sigma
A 1 LYS N
A 1 LYS CA
""" in "\n".join([ l.rstrip() for l in out2.getvalue().splitlines() ]))
#
# C-alpha-only model (from 3b5d)
pdb_raw = """\
CRYST1 115.100 43.700 76.400 90.00 108.10 90.00 C 1 2 1 8
ATOM 1 CA TYR A 6 -7.551 -11.355 -17.946 1.00148.04 C
ATOM 2 CA LEU A 7 -8.052 -8.804 -20.730 1.00310.75 C
ATOM 3 CA GLY A 8 -10.874 -6.691 -19.353 1.00158.95 C
ATOM 4 CA GLY A 9 -9.359 -7.332 -15.966 1.00217.68 C
ATOM 5 CA ALA A 10 -5.806 -6.508 -16.946 1.00239.12 C
ATOM 6 CA ILE A 11 -7.024 -3.514 -18.905 1.00103.16 C
ATOM 7 CA LEU A 12 -10.023 -2.071 -17.056 1.00230.80 C
ATOM 8 CA ALA A 13 -7.313 -1.820 -14.420 1.00141.04 C
"""
pdb_file = "tst_validate_restraints_calpha.pdb"
open(pdb_file, "w").write(pdb_raw)
v1 = run_validation(pdb_file, ignore_hd=True)
if (__name__ == "__main__"):
exercise_simple()
print("OK")
| 51.198276
| 79
| 0.506651
| 1,132
| 5,939
| 2.597173
| 0.287102
| 0.040816
| 0.038095
| 0.057143
| 0.265306
| 0.237755
| 0.172109
| 0.056463
| 0
| 0
| 0
| 0.329955
| 0.40192
| 5,939
| 115
| 80
| 51.643478
| 0.497748
| 0.013134
| 0
| 0.074766
| 0
| 0.476636
| 0.739583
| 0.011612
| 0
| 0
| 0
| 0
| 0.037383
| 1
| 0.018692
| false
| 0
| 0.056075
| 0
| 0.084112
| 0.018692
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
9ed4d88c4f6045e4df06f3ac9733b88b158d09a9
| 245
|
py
|
Python
|
08-About_scrapy/douban/main.py
|
jiaxiaochu/spider
|
4b0f751f76a31556a91dea719873cf2979e4be94
|
[
"MIT"
] | null | null | null |
08-About_scrapy/douban/main.py
|
jiaxiaochu/spider
|
4b0f751f76a31556a91dea719873cf2979e4be94
|
[
"MIT"
] | 1
|
2020-08-27T10:25:38.000Z
|
2020-08-27T10:25:38.000Z
|
08-About_scrapy/douban/main.py
|
jiaxiaochu/spider
|
4b0f751f76a31556a91dea719873cf2979e4be94
|
[
"MIT"
] | null | null | null |
# !/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
# -*- coding:utf-8 -*-
# @Author : Jiazhixiang
# 导入cmdline模块,可以实现控制终端命令行。
from scrapy import cmdline
# 用execute()方法,输入运行scrapy的命令。
cmdline.execute(['scrapy', 'crawl', 'douban'])
| 24.5
| 64
| 0.726531
| 28
| 245
| 6.357143
| 0.928571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.018018
| 0.093878
| 245
| 9
| 65
| 27.222222
| 0.783784
| 0.644898
| 0
| 0
| 0
| 0
| 0.209877
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
9eedb43deb24d2533fe70662a5b08fab696d08f6
| 500
|
py
|
Python
|
Crypto/py3compat.py
|
eddiejessup/transcrypt
|
1a5894a2c355e1b88626a2b195e132bd7e701981
|
[
"MIT"
] | 14
|
2015-02-15T02:17:07.000Z
|
2020-07-15T03:02:46.000Z
|
Crypto/py3compat.py
|
eddiejessup/Transcrypt
|
1a5894a2c355e1b88626a2b195e132bd7e701981
|
[
"MIT"
] | 12
|
2015-04-11T14:26:14.000Z
|
2021-09-07T09:25:38.000Z
|
Crypto/py3compat.py
|
eddiejessup/Transcrypt
|
1a5894a2c355e1b88626a2b195e132bd7e701981
|
[
"MIT"
] | 4
|
2016-02-27T16:06:59.000Z
|
2019-09-04T04:01:05.000Z
|
__revision__ = "$Id$"
def b(s):
return s.encode("latin-1")
def bchr(s):
return bytes([s])
def bstr(s):
if isinstance(s, str):
return bytes(s, "latin-1")
else:
return bytes(s)
def bord(s):
return s
def tobytes(s):
if isinstance(s, bytes):
return s
else:
if isinstance(s, str):
return s.encode("latin-1")
else:
return bytes(s)
def tostr(bs):
return bs.decode("latin-1")
from io import BytesIO
| 13.513514
| 38
| 0.542
| 72
| 500
| 3.708333
| 0.347222
| 0.104869
| 0.179775
| 0.168539
| 0.449438
| 0.187266
| 0.187266
| 0
| 0
| 0
| 0
| 0.01173
| 0.318
| 500
| 36
| 39
| 13.888889
| 0.771261
| 0
| 0
| 0.478261
| 0
| 0
| 0.064
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.26087
| false
| 0
| 0.043478
| 0.173913
| 0.695652
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
9ef42081bff35de1f92bff97bfccd08e32e6f3d8
| 395
|
py
|
Python
|
studio_ghibli/movies/test_data.py
|
hbansal0122/studio_ghibli_project
|
1a2df853f9d5088aa137f372ab0ee83ce8ba3667
|
[
"MIT"
] | null | null | null |
studio_ghibli/movies/test_data.py
|
hbansal0122/studio_ghibli_project
|
1a2df853f9d5088aa137f372ab0ee83ce8ba3667
|
[
"MIT"
] | null | null | null |
studio_ghibli/movies/test_data.py
|
hbansal0122/studio_ghibli_project
|
1a2df853f9d5088aa137f372ab0ee83ce8ba3667
|
[
"MIT"
] | null | null | null |
""" Test data"""
stub_films = [{
"id": "12345",
"title": "This is film one",
},{
"id": "23456",
"title": "This is film two",
}]
stub_poeple = [{
"name": "person 1",
"films": ["url/12345", "url/23456"]
},{
"name": "person 2",
"films": ["url/23456"]
},{
"name": "person 3",
"films": ["url/12345"]
},{
"name": "person 4",
"films": ["url/12345"]
}]
| 16.458333
| 39
| 0.463291
| 46
| 395
| 3.934783
| 0.456522
| 0.220994
| 0.21547
| 0.165746
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.132203
| 0.253165
| 395
| 24
| 40
| 16.458333
| 0.481356
| 0.022785
| 0
| 0.4
| 0
| 0
| 0.444737
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
9ef4febad34c41f83b4899c15a9e9cfec2b40a27
| 236
|
py
|
Python
|
data_converters/fsdbripper/create_new_db.py
|
osvaldolove/amiberry-api
|
3310592d2411c69f7c225edb3e3907e6a5e6caf8
|
[
"MIT"
] | null | null | null |
data_converters/fsdbripper/create_new_db.py
|
osvaldolove/amiberry-api
|
3310592d2411c69f7c225edb3e3907e6a5e6caf8
|
[
"MIT"
] | null | null | null |
data_converters/fsdbripper/create_new_db.py
|
osvaldolove/amiberry-api
|
3310592d2411c69f7c225edb3e3907e6a5e6caf8
|
[
"MIT"
] | 1
|
2018-08-22T21:55:26.000Z
|
2018-08-22T21:55:26.000Z
|
import sqlite3
from constants import DESTINATION_DB
destination_connection = sqlite3.connect(DESTINATION_DB)
destination_cursor = destination_connection.cursor()
destination_cursor.execute('CREATE TABLE game(uuid, payload)')
| 26.222222
| 63
| 0.817797
| 26
| 236
| 7.192308
| 0.576923
| 0.139037
| 0.256684
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009569
| 0.114407
| 236
| 8
| 64
| 29.5
| 0.885167
| 0
| 0
| 0
| 0
| 0
| 0.140351
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.4
| 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
| 0
| 0
|
0
| 4
|
7303be01ae89f9c41f09c1617f6cea31c52d0cf4
| 347
|
py
|
Python
|
codes_/1189_Maximum_Number_of_Balloons.py
|
SaitoTsutomu/leetcode
|
4656d66ab721a5c7bc59890db9a2331c6823b2bf
|
[
"MIT"
] | null | null | null |
codes_/1189_Maximum_Number_of_Balloons.py
|
SaitoTsutomu/leetcode
|
4656d66ab721a5c7bc59890db9a2331c6823b2bf
|
[
"MIT"
] | null | null | null |
codes_/1189_Maximum_Number_of_Balloons.py
|
SaitoTsutomu/leetcode
|
4656d66ab721a5c7bc59890db9a2331c6823b2bf
|
[
"MIT"
] | null | null | null |
# %% [1189. *Maximum Number of Balloons](https://leetcode.com/problems/maximum-number-of-balloons/)
# 問題:textから'ballon'を構成できる数を返せ
# 解法:collections.Counterを用いる
class Solution:
def maxNumberOfBalloons(self, text: str) -> int:
c = collections.Counter(text)
return min(c[s] // n for s, n in collections.Counter("balloon").items())
| 43.375
| 99
| 0.700288
| 45
| 347
| 5.4
| 0.755556
| 0.106996
| 0.123457
| 0.1893
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.013514
| 0.146974
| 347
| 7
| 100
| 49.571429
| 0.807432
| 0.43804
| 0
| 0
| 0
| 0
| 0.036649
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0
| 0.75
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
73204039a36f632a872aa19aeb8f09ee3f95315d
| 424
|
py
|
Python
|
12-transformar_metro.py
|
tainagirotto/exercicios-py
|
39107c05a0a8e5230cd48876ad8e1ad6f0a2ff59
|
[
"MIT"
] | null | null | null |
12-transformar_metro.py
|
tainagirotto/exercicios-py
|
39107c05a0a8e5230cd48876ad8e1ad6f0a2ff59
|
[
"MIT"
] | null | null | null |
12-transformar_metro.py
|
tainagirotto/exercicios-py
|
39107c05a0a8e5230cd48876ad8e1ad6f0a2ff59
|
[
"MIT"
] | null | null | null |
# Ler um número em metros e mostrar seu valor em cm e mm:
m = float(input('Digite o valor em metros: '))
dm = m * 10
cm = m * 100
mm = m * 1000
km = m/1000
hm = m/100
dam = m/10
print('O valor em cm é {}' .format(cm))
print('O valor em milímetros é {}' .format(mm))
print('O valor em dm é {}' .format(dm))
print('O valor em km é {}' .format(km))
print('O valor em hm {}' .format(hm))
print('O valor em dm {}' .format(dm))
| 24.941176
| 57
| 0.613208
| 85
| 424
| 3.058824
| 0.317647
| 0.215385
| 0.215385
| 0.3
| 0.115385
| 0
| 0
| 0
| 0
| 0
| 0
| 0.053571
| 0.207547
| 424
| 16
| 58
| 26.5
| 0.720238
| 0.129717
| 0
| 0
| 0
| 0
| 0.376022
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.461538
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
7329f5fd535980ef38334fa719dd3596b7005058
| 176
|
py
|
Python
|
python-while/exercise4.py
|
crobert7/Py-Basics
|
c1d1a1441de6cbee409c59ddda2b11bc7ee16df1
|
[
"MIT"
] | null | null | null |
python-while/exercise4.py
|
crobert7/Py-Basics
|
c1d1a1441de6cbee409c59ddda2b11bc7ee16df1
|
[
"MIT"
] | null | null | null |
python-while/exercise4.py
|
crobert7/Py-Basics
|
c1d1a1441de6cbee409c59ddda2b11bc7ee16df1
|
[
"MIT"
] | null | null | null |
word = input('Type a word: ')
while word != 'chupacabra':
word = input('Type a word: ')
if word == 'chupacabra':
print('You are out of the loop')
break
| 25.142857
| 40
| 0.5625
| 24
| 176
| 4.125
| 0.625
| 0.181818
| 0.262626
| 0.282828
| 0.363636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.289773
| 176
| 7
| 41
| 25.142857
| 0.792
| 0
| 0
| 0.333333
| 0
| 0
| 0.389831
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.166667
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
733f199984f8b993cc317085788a45b7c591ad8b
| 1,084
|
py
|
Python
|
Projects/herdimmunity/Person.py
|
Tech-at-DU/ACS-1111.1-Object-Oriented-Programming
|
e4405678282b7fbd78a3b8337116b61083417343
|
[
"MIT"
] | null | null | null |
Projects/herdimmunity/Person.py
|
Tech-at-DU/ACS-1111.1-Object-Oriented-Programming
|
e4405678282b7fbd78a3b8337116b61083417343
|
[
"MIT"
] | null | null | null |
Projects/herdimmunity/Person.py
|
Tech-at-DU/ACS-1111.1-Object-Oriented-Programming
|
e4405678282b7fbd78a3b8337116b61083417343
|
[
"MIT"
] | 1
|
2021-11-01T21:04:52.000Z
|
2021-11-01T21:04:52.000Z
|
import random
from Virus import Virus
class Person:
''' The simulation will contain people who will make up a population.'''
def __init__(self, is_vaccinated, infection=None):
''' We start out with is_alive = True
All other values will be set by the simulation through the parameters when
it instantiates each Person object.
'''
self.is_alive = True #boolean
self.is_vaccinated = is_vaccinated #boolean
self.infection = infection #virus object
def did_survive_infection(self):
''' Generate a random number between 0.0 and 1.0 and compare to the virus's
mortality_num. If the random number is smaller, person dies from the disease.
Set the person's is alive attribute to False If Person survives, they become
vaccinated and they have no infection (set the vaccinated attibute to True
and the infection to None) Return True if they survived the infection and
False if they did not.
'''
#TODO: finish this method
pass
| 37.37931
| 86
| 0.665129
| 150
| 1,084
| 4.726667
| 0.506667
| 0.025388
| 0.045134
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005168
| 0.285978
| 1,084
| 28
| 87
| 38.714286
| 0.910853
| 0.615314
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.035714
| 0
| 1
| 0.222222
| false
| 0.111111
| 0.222222
| 0
| 0.555556
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
b42bbf006e731b294f9bc03e50361e650c57e4a5
| 97
|
py
|
Python
|
17.py
|
yonghuatang/python
|
6d53bf2f1e75ac03b07eb56ff83e26d8b5155bb1
|
[
"MIT"
] | null | null | null |
17.py
|
yonghuatang/python
|
6d53bf2f1e75ac03b07eb56ff83e26d8b5155bb1
|
[
"MIT"
] | null | null | null |
17.py
|
yonghuatang/python
|
6d53bf2f1e75ac03b07eb56ff83e26d8b5155bb1
|
[
"MIT"
] | null | null | null |
from datetime import date
now = date.today()
print('The date today is', now, now.strftime("%A"))
| 24.25
| 51
| 0.701031
| 16
| 97
| 4.25
| 0.6875
| 0.264706
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.134021
| 97
| 3
| 52
| 32.333333
| 0.809524
| 0
| 0
| 0
| 0
| 0
| 0.195876
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 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
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
b4631189d6d2e11cc9e3587fbf8d89019ec14498
| 6,856
|
py
|
Python
|
data_service/api/data_api.py
|
statisticsnorway/microdata-data-service
|
d477b7b75589d4c977771122558c948c040a1106
|
[
"Apache-2.0"
] | null | null | null |
data_service/api/data_api.py
|
statisticsnorway/microdata-data-service
|
d477b7b75589d4c977771122558c948c040a1106
|
[
"Apache-2.0"
] | 7
|
2021-10-08T13:40:33.000Z
|
2022-02-04T10:37:55.000Z
|
data_service/api/data_api.py
|
statisticsnorway/microdata-data-service
|
d477b7b75589d4c977771122558c948c040a1106
|
[
"Apache-2.0"
] | null | null | null |
import logging
import os
import io
from fastapi import APIRouter, Depends, Header
from fastapi.responses import FileResponse, StreamingResponse
from fastapi import HTTPException, status
import pyarrow as pa
import pyarrow.parquet as pq
from data_service.api.query_models import (
InputTimePeriodQuery, InputTimeQuery, InputFixedQuery
)
from data_service.config import config
from data_service.api.response_models import ErrorMessage
from data_service.config.config import get_settings
from data_service.config.dependencies import get_processor
from data_service.core.processor import Processor
from data_service.api.auth import authorize_user
data_router = APIRouter()
log = logging.getLogger(__name__)
@data_router.get("/data/resultSet", responses={
204: {}, 404: {"model": ErrorMessage}})
def retrieve_result_set(file_name: str,
authorization: str = Header(None),
settings: config.BaseSettings = Depends(get_settings)):
"""
Stream a generated result parquet file.
"""
log.info(
f"Entering /data/resultSet with request for file name: {file_name}"
)
user_id = authorize_user(authorization)
log.info(f"Authorized token for user: {user_id}")
file_path = (
f"{settings.RESULTSET_DIR}/{file_name}"
)
if not os.path.isfile(file_path):
log.warning(f"No file found for path: {file_path}")
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail='Result set not found'
)
else:
return FileResponse(
file_path, media_type='application/octet-stream'
)
@data_router.post("/data/event/generate-file",
responses={404: {"model": ErrorMessage}})
def create_result_file_event(input_query: InputTimePeriodQuery,
authorization: str = Header(None),
processor: Processor = Depends(get_processor)):
"""
Create result set of data with temporality type event,
and write result to file. Returns name of file in response.
"""
log.info(
f'Entering /data/event/generate-file with input query: {input_query}'
)
user_id = authorize_user(authorization)
log.info(f"Authorized token for user: {user_id}")
result_data = processor.process_event_request(input_query)
resultset_file_name = processor.write_table(result_data)
log.info(f'File name for event result set: {resultset_file_name}')
return {
'filename': resultset_file_name,
}
@data_router.post("/data/status/generate-file",
responses={404: {"model": ErrorMessage}})
def create_result_file_status(input_query: InputTimeQuery,
authorization: str = Header(None),
processor: Processor = Depends(get_processor)):
"""
Create result set of data with temporality type status,
and write result to file. Returns name of file in response.
"""
log.info(
f'Entering /data/status/generate-file with input query: {input_query}'
)
user_id = authorize_user(authorization)
log.info(f"Authorized token for user: {user_id}")
result_data = processor.process_status_request(input_query)
resultset_file_name = processor.write_table(result_data)
log.info(f'File name for event result set: {resultset_file_name}')
return {
'filename': resultset_file_name,
}
@data_router.post("/data/fixed/generate-file",
responses={404: {"model": ErrorMessage}})
def create_file_result_fixed(input_query: InputFixedQuery,
authorization: str = Header(None),
processor: Processor = Depends(get_processor)):
"""
Create result set of data with temporality type fixed,
and write result to file. Returns name of file in response.
"""
log.info(
f'Entering /data/fixed/generate-file with input query: {input_query}'
)
user_id = authorize_user(authorization)
log.info(f"Authorized token for user: {user_id}")
result_data = processor.process_fixed_request(input_query)
resultset_file_name = processor.write_table(result_data)
log.info(f'File name for event result set: {resultset_file_name}')
return {
'filename': resultset_file_name,
}
@data_router.post("/data/event/stream",
responses={404: {"model": ErrorMessage}})
def stream_result_event(input_query: InputTimePeriodQuery,
authorization: str = Header(None),
processor: Processor = Depends(get_processor)):
"""
Create Result set of data with temporality type event,
and stream result as response.
"""
log.info(f'Entering /data/event/stream with input query: {input_query}')
user_id = authorize_user(authorization)
log.info(f"Authorized token for user: {user_id}")
result_data = processor.process_event_request(input_query)
buffer_stream = pa.BufferOutputStream()
pq.write_table(result_data, buffer_stream)
return StreamingResponse(
io.BytesIO(buffer_stream.getvalue().to_pybytes())
)
@data_router.post("/data/status/stream",
responses={404: {"model": ErrorMessage}})
def stream_result_status(input_query: InputTimeQuery,
authorization: str = Header(None),
processor: Processor = Depends(get_processor)):
"""
Create result set of data with temporality type status,
and stream result as response.
"""
log.info(f'Entering /data/status/stream with input query: {input_query}')
user_id = authorize_user(authorization)
log.info(f"Authorized token for user: {user_id}")
result_data = processor.process_status_request(input_query)
buffer_stream = pa.BufferOutputStream()
pq.write_table(result_data, buffer_stream)
return StreamingResponse(
io.BytesIO(buffer_stream.getvalue().to_pybytes())
)
@data_router.post("/data/fixed/stream",
responses={404: {"model": ErrorMessage}})
def stream_result_fixed(input_query: InputFixedQuery,
authorization: str = Header(None),
processor: Processor = Depends(get_processor)):
"""
Create result set of data with temporality type fixed,
and stream result as response.
"""
log.info(f'Entering /data/fixed/stream with input query: {input_query}')
user_id = authorize_user(authorization)
log.info(f"Authorized token for user: {user_id}")
result_data = processor.process_fixed_request(input_query)
buffer_stream = pa.BufferOutputStream()
pq.write_table(result_data, buffer_stream)
return StreamingResponse(
io.BytesIO(buffer_stream.getvalue().to_pybytes())
)
| 35.708333
| 79
| 0.67605
| 809
| 6,856
| 5.53152
| 0.131026
| 0.053631
| 0.030391
| 0.035978
| 0.764246
| 0.748603
| 0.748603
| 0.741453
| 0.698101
| 0.698101
| 0
| 0.005101
| 0.227976
| 6,856
| 191
| 80
| 35.895288
| 0.840355
| 0.093932
| 0
| 0.507576
| 0
| 0
| 0.1927
| 0.045215
| 0
| 0
| 0
| 0
| 0
| 1
| 0.05303
| false
| 0
| 0.113636
| 0
| 0.219697
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b47abe86e6343865f80d317d811f2885ba219aec
| 122
|
py
|
Python
|
Pacote Dowload/pythonProject/aula020.py
|
J297-hub/exercicios-de-python
|
cde355f9aeb43abce7890cd9879646bfe768190e
|
[
"MIT"
] | null | null | null |
Pacote Dowload/pythonProject/aula020.py
|
J297-hub/exercicios-de-python
|
cde355f9aeb43abce7890cd9879646bfe768190e
|
[
"MIT"
] | null | null | null |
Pacote Dowload/pythonProject/aula020.py
|
J297-hub/exercicios-de-python
|
cde355f9aeb43abce7890cd9879646bfe768190e
|
[
"MIT"
] | null | null | null |
def soma (a,b):
print(f'A = {a} e B = {b}')
s=a+b
print(f'A soma A + B ={s}')
#Programa Principal
soma(4,5)
| 13.555556
| 31
| 0.491803
| 26
| 122
| 2.307692
| 0.461538
| 0.1
| 0.2
| 0.266667
| 0.3
| 0
| 0
| 0
| 0
| 0
| 0
| 0.022727
| 0.278689
| 122
| 8
| 32
| 15.25
| 0.659091
| 0.147541
| 0
| 0
| 0
| 0
| 0.330097
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0
| 0
| 0.2
| 0.4
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b485f966490bf3490f3dba52ae21698a1d35eef4
| 265
|
py
|
Python
|
app/admin.py
|
CS-Hunt/Get-Placed
|
f79f79f2dd37510405a24578b3a91acea00f9244
|
[
"MIT"
] | 14
|
2021-08-28T04:05:55.000Z
|
2022-02-20T07:03:16.000Z
|
app/admin.py
|
CS-Hunt/Get-Placed
|
f79f79f2dd37510405a24578b3a91acea00f9244
|
[
"MIT"
] | null | null | null |
app/admin.py
|
CS-Hunt/Get-Placed
|
f79f79f2dd37510405a24578b3a91acea00f9244
|
[
"MIT"
] | 9
|
2021-08-28T04:06:03.000Z
|
2021-09-26T16:45:28.000Z
|
from django.contrib import admin
from .models import Placement_Company_Detail,Profile,StudentBlogModel,ResorcesModel
admin.site.register(Placement_Company_Detail)
admin.site.register(Profile)
admin.site.register(StudentBlogModel)
admin.site.register(ResorcesModel)
| 37.857143
| 83
| 0.875472
| 32
| 265
| 7.125
| 0.4375
| 0.157895
| 0.298246
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.045283
| 265
| 7
| 84
| 37.857143
| 0.901186
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
81f0785b99135f37da39fd3dcab4612074c70aed
| 718
|
py
|
Python
|
examples/03-interception/api.py
|
nomadsinteractive/migi
|
7ebcd0d362f642b889c309c20618ff36f1448c28
|
[
"Apache-2.0"
] | 3
|
2022-01-09T10:09:55.000Z
|
2022-01-11T03:37:55.000Z
|
examples/03-interception/api.py
|
nomadsinteractive/migi
|
7ebcd0d362f642b889c309c20618ff36f1448c28
|
[
"Apache-2.0"
] | null | null | null |
examples/03-interception/api.py
|
nomadsinteractive/migi
|
7ebcd0d362f642b889c309c20618ff36f1448c28
|
[
"Apache-2.0"
] | null | null | null |
from ctypes import *
from migi.decorators import stdcall
@stdcall('MessageBoxW', 'User32.dll', interceptable=True)
def _native_message_box_w(hwnd: c_void_p, content: c_wchar_p, title: c_wchar_p, flags: c_uint32) -> c_int32:
if wstring_at(content) == "I'm in":
return _native_message_box_w.call_original(hwnd, create_unicode_buffer("We're in"), title, flags)
return _native_message_box_w.call_original(hwnd, content, title, flags)
def message_box(content: str, title: str, flags: int = 0) -> c_int32:
return _native_message_box_w(None, create_unicode_buffer(content), create_unicode_buffer(title), flags)
def restore():
_native_message_box_w.restore()
_native_message_box_w.intercept()
| 32.636364
| 108
| 0.763231
| 109
| 718
| 4.633028
| 0.422018
| 0.138614
| 0.190099
| 0.20198
| 0.29505
| 0.154455
| 0.154455
| 0.154455
| 0
| 0
| 0
| 0.014354
| 0.126741
| 718
| 21
| 109
| 34.190476
| 0.791069
| 0
| 0
| 0
| 0
| 0
| 0.048747
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.166667
| 0.083333
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
81f8404fe9a704d334f1bcd998cf63672186b71f
| 55
|
py
|
Python
|
backend/code/start.py
|
socek/iep
|
793e35ca5304eef7b7dacb5dd8d486622f497759
|
[
"Apache-2.0"
] | null | null | null |
backend/code/start.py
|
socek/iep
|
793e35ca5304eef7b7dacb5dd8d486622f497759
|
[
"Apache-2.0"
] | null | null | null |
backend/code/start.py
|
socek/iep
|
793e35ca5304eef7b7dacb5dd8d486622f497759
|
[
"Apache-2.0"
] | null | null | null |
if __name__ == "__main__":
print("Nothing yet...")
| 18.333333
| 27
| 0.6
| 6
| 55
| 4.166667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 55
| 2
| 28
| 27.5
| 0.555556
| 0
| 0
| 0
| 0
| 0
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
81fb080ba80dc6a4245823877af0ad4179c7b39d
| 87
|
py
|
Python
|
tests/data/program_analysis/PyAST2CAST/import/test_import_3.py
|
rsulli55/automates
|
1647a8eef85c4f03086a10fa72db3b547f1a0455
|
[
"Apache-2.0"
] | 17
|
2018-12-19T16:32:38.000Z
|
2021-10-05T07:58:15.000Z
|
tests/data/program_analysis/PyAST2CAST/import/test_import_3.py
|
rsulli55/automates
|
1647a8eef85c4f03086a10fa72db3b547f1a0455
|
[
"Apache-2.0"
] | 183
|
2018-12-20T17:03:01.000Z
|
2022-02-23T22:21:42.000Z
|
tests/data/program_analysis/PyAST2CAST/import/test_import_3.py
|
rsulli55/automates
|
1647a8eef85c4f03086a10fa72db3b547f1a0455
|
[
"Apache-2.0"
] | 5
|
2019-01-04T22:37:49.000Z
|
2022-01-19T17:34:16.000Z
|
# 'from ... import ...' statement
from sys import exit
def main():
exit(0)
main()
| 12.428571
| 33
| 0.597701
| 12
| 87
| 4.333333
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.014706
| 0.218391
| 87
| 7
| 34
| 12.428571
| 0.75
| 0.356322
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0
| 0.25
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c32db06fd5b31b4a1c0ead0ae4470b3896648d58
| 1,180
|
py
|
Python
|
wonambi/attr/__init__.py
|
wonambi-python/wonambi
|
4e2834cdd799576d1a231ecb48dfe4da1364fe3a
|
[
"BSD-3-Clause"
] | 63
|
2017-12-30T08:11:17.000Z
|
2022-01-28T10:34:20.000Z
|
wonambi/attr/__init__.py
|
wonambi-python/wonambi
|
4e2834cdd799576d1a231ecb48dfe4da1364fe3a
|
[
"BSD-3-Clause"
] | 23
|
2017-09-08T08:29:49.000Z
|
2022-03-17T08:19:13.000Z
|
wonambi/attr/__init__.py
|
wonambi-python/wonambi
|
4e2834cdd799576d1a231ecb48dfe4da1364fe3a
|
[
"BSD-3-Clause"
] | 12
|
2017-09-18T12:48:36.000Z
|
2021-09-22T07:16:07.000Z
|
"""Packages containing all the possible attributes to recordings, such as
- channels (module "chan") with class:
- Chan
- anatomical info (module "anat") with class:
- Surf
- annotations and sleep scores (module "annotations") with class:
- Annotations
Possibly include forward and inverse models.
These attributes are only "attached" to the DataType, there should not be any
consistency check when you load them. The risk is that attributes do not refer
to the correct datatype, but the advantage is that we cannot keep track of all
the possible inconsistencies (f.e. if the channel names are not the same
between the actual channels and those stored in the Channels class).
In addition, these classes are often used in isolation, even without a dataset,
so do not assume that any of the classes in the module can call the main
dataset. In other words, these classes shouldn't have methods calling the
datatype, but there can be functions in the modules that use both the
dataset and the classes below.
"""
from .chan import Channels
from .anat import Brain, Surf, Freesurfer
from .annotations import Annotations, create_empty_annotations
| 43.703704
| 79
| 0.766102
| 180
| 1,180
| 5.011111
| 0.561111
| 0.029933
| 0.031042
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.188983
| 1,180
| 26
| 80
| 45.384615
| 0.942529
| 0.880508
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
c33a308f4b93fcb1577dde001c5501e493e62b57
| 146
|
py
|
Python
|
WeatherPy/config.py.py
|
Brownc03/python-api-challenge
|
24af57a6652b2990e8bdbc1e8e01566a2e7878b8
|
[
"ADSL"
] | null | null | null |
WeatherPy/config.py.py
|
Brownc03/python-api-challenge
|
24af57a6652b2990e8bdbc1e8e01566a2e7878b8
|
[
"ADSL"
] | null | null | null |
WeatherPy/config.py.py
|
Brownc03/python-api-challenge
|
24af57a6652b2990e8bdbc1e8e01566a2e7878b8
|
[
"ADSL"
] | null | null | null |
# OpenWeatherMap API Key
weather_api_key = "ae41fcf95db0d612b74e2b509abe9684"
# Google API Key
g_key = "AIzaSyCuF1rT6NscWq62bcBm0tZM7hKlaeWfONQ"
| 29.2
| 52
| 0.842466
| 13
| 146
| 9.230769
| 0.615385
| 0.15
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.183206
| 0.10274
| 146
| 5
| 53
| 29.2
| 0.732824
| 0.253425
| 0
| 0
| 0
| 0
| 0.663551
| 0.663551
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c34c38cdb59ab3adcb9297c65de4aee9cda600b1
| 1,328
|
py
|
Python
|
py3canvas/tests/shared_brand_configs.py
|
tylerclair/py3canvas
|
7485d458606b65200f0ffa5bbe597a9d0bee189f
|
[
"MIT"
] | null | null | null |
py3canvas/tests/shared_brand_configs.py
|
tylerclair/py3canvas
|
7485d458606b65200f0ffa5bbe597a9d0bee189f
|
[
"MIT"
] | null | null | null |
py3canvas/tests/shared_brand_configs.py
|
tylerclair/py3canvas
|
7485d458606b65200f0ffa5bbe597a9d0bee189f
|
[
"MIT"
] | null | null | null |
"""SharedBrandConfigs API Tests for Version 1.0.
This is a testing template for the generated SharedBrandConfigsAPI Class.
"""
import unittest
import requests
import secrets
from py3canvas.apis.shared_brand_configs import SharedBrandConfigsAPI
from py3canvas.apis.shared_brand_configs import Sharedbrandconfig
class TestSharedBrandConfigsAPI(unittest.TestCase):
"""Tests for the SharedBrandConfigsAPI."""
def setUp(self):
self.client = SharedBrandConfigsAPI(
secrets.instance_address, secrets.access_token
)
def test_share_brandconfig_theme(self):
"""Integration test for the SharedBrandConfigsAPI.share_brandconfig_theme method."""
# This method utilises the POST request method and will make changes to the Canvas instance. This needs consideration.
pass
def test_update_shared_theme(self):
"""Integration test for the SharedBrandConfigsAPI.update_shared_theme method."""
# This method utilises the PUT request method and will make changes to the Canvas instance. This needs consideration.
pass
def test_un_share_brandconfig_theme(self):
"""Integration test for the SharedBrandConfigsAPI.un_share_brandconfig_theme method."""
id = None # Change me!!
r = self.client.un_share_brandconfig_theme(id)
| 37.942857
| 126
| 0.752259
| 156
| 1,328
| 6.237179
| 0.403846
| 0.030832
| 0.107914
| 0.073998
| 0.510791
| 0.510791
| 0.445015
| 0.308325
| 0.308325
| 0.170606
| 0
| 0.0037
| 0.185994
| 1,328
| 34
| 127
| 39.058824
| 0.896392
| 0.481175
| 0
| 0.117647
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.235294
| false
| 0.117647
| 0.294118
| 0
| 0.588235
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
6f0b8327462eef4971df182fcdc4e7e99669fd00
| 210
|
py
|
Python
|
sborl/__init__.py
|
canonical/sborl
|
f821ecfcbf977d0605def66dca19ea5e8e39b5a3
|
[
"Apache-2.0"
] | null | null | null |
sborl/__init__.py
|
canonical/sborl
|
f821ecfcbf977d0605def66dca19ea5e8e39b5a3
|
[
"Apache-2.0"
] | null | null | null |
sborl/__init__.py
|
canonical/sborl
|
f821ecfcbf977d0605def66dca19ea5e8e39b5a3
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
__version__ = "0.0.8"
# flake8: noqa: F401,F402
from . import errors, events, relation, testing
from .relation import EndpointWrapper
| 23.333333
| 47
| 0.761905
| 28
| 210
| 5.571429
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.078652
| 0.152381
| 210
| 8
| 48
| 26.25
| 0.797753
| 0.442857
| 0
| 0
| 0
| 0
| 0.044248
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
6f6a38a0483844a3f770817a9b327db335f9b10a
| 255
|
py
|
Python
|
ssrl/providers/base.py
|
AspirinGeyer/PySSRL
|
bdb27d7ada2fc317b8e2ea18f389e280d58e24ac
|
[
"Apache-2.0"
] | 6
|
2019-06-07T19:25:51.000Z
|
2019-10-30T01:56:29.000Z
|
ssrl/providers/base.py
|
AspirinGeyer/PySSRL
|
bdb27d7ada2fc317b8e2ea18f389e280d58e24ac
|
[
"Apache-2.0"
] | 1
|
2019-08-26T00:05:50.000Z
|
2019-08-26T00:05:50.000Z
|
ssrl/providers/base.py
|
AspirinGeyer/PySSRL
|
bdb27d7ada2fc317b8e2ea18f389e280d58e24ac
|
[
"Apache-2.0"
] | 1
|
2019-10-30T01:56:33.000Z
|
2019-10-30T01:56:33.000Z
|
# -*- coding:utf-8 -*-
class BaseProvider(object):
@staticmethod
def loads(link_url):
raise NotImplementedError("Implemetion required.")
@staticmethod
def dumps(conf):
raise NotImplementedError("Implemetion required.")
| 19.615385
| 58
| 0.670588
| 23
| 255
| 7.391304
| 0.73913
| 0.176471
| 0.411765
| 0.505882
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.004975
| 0.211765
| 255
| 12
| 59
| 21.25
| 0.840796
| 0.078431
| 0
| 0.571429
| 0
| 0
| 0.180258
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0
| 0
| 0.428571
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6f76ec963af630c9f2623b7e32036a92ed42bb1c
| 8,778
|
py
|
Python
|
tests/basic_step_tests.py
|
kodexa-ai/kodexa
|
568466b3dc4758babf2d318dc91b1c09ec60845d
|
[
"Apache-2.0"
] | 1
|
2020-08-31T09:32:39.000Z
|
2020-08-31T09:32:39.000Z
|
tests/basic_step_tests.py
|
kodexa-ai/kodexa
|
568466b3dc4758babf2d318dc91b1c09ec60845d
|
[
"Apache-2.0"
] | 13
|
2020-04-08T10:53:26.000Z
|
2022-03-30T09:51:29.000Z
|
tests/basic_step_tests.py
|
kodexa-ai/kodexa
|
568466b3dc4758babf2d318dc91b1c09ec60845d
|
[
"Apache-2.0"
] | 1
|
2020-04-12T13:10:51.000Z
|
2020-04-12T13:10:51.000Z
|
import os
import pytest
from kodexa import Document, Pipeline, PipelineContext, TagsToKeyValuePairExtractor, RollupTransformer
def get_test_directory():
return os.path.dirname(os.path.abspath(__file__)) + "/../test_documents/"
@pytest.mark.skip
def test_html_rollup():
document = Document.from_msgpack(open(os.path.join(get_test_directory(), 'news.kdxa'), 'rb').read())
# before rollup
assert document.select('//a')[0].content == 'HSBC'
assert document.select('//a')[1].content == 'Hang Seng Index'
assert len(document.select('//*[contentRegex(".*Hang Seng Index.*")]')[0].get_content_parts()) == 1
# Collapse out all the <a> tags
step = RollupTransformer(collapse_type_res=["a"])
step.process(document)
# after rollup
assert len(document.select('//a')) == 0
# see where the href rolled up
assert document.select('//*[contentRegex(".*Hang Seng Index.*")]')[0].get_all_content() == 'The London-headquartered bank is a heavyweight component of the Hang Seng Index . HSBC shares in Hong Kong closed 2.78% lower.'
assert len(document.select('//*[contentRegex(".*Hang Seng Index.*")]')[0].get_content_parts()) == 3
def test_tag_key_value():
document = Document.from_msgpack(open(os.path.join(get_test_directory(), 'news-tagged.kdxa'), 'rb').read())
step = TagsToKeyValuePairExtractor(store_name='test_store')
context = PipelineContext()
step.process(document, context)
assert context.get_store('test_store').count() == 45
assert context.get_store('test_store').rows[14][0] == 'LOC'
assert context.get_store('test_store').rows[14][1] == 'Europe'
def test_tag_key_value_include_exclude():
# Testing include parameter
include_tags = ['DATE', 'LOC']
document = Document.from_msgpack(open(os.path.join(get_test_directory(), 'news-tagged.kdxa'), 'rb').read())
step = TagsToKeyValuePairExtractor(store_name='test_store', include=include_tags)
context = PipelineContext()
step.process(document, context)
assert context.get_store('test_store').count() == 11
# Testing exclude parameter
exclude_tags = ['DATE', 'LOC']
document = Document.from_msgpack(open(os.path.join(get_test_directory(), 'news-tagged.kdxa'), 'rb').read())
step = TagsToKeyValuePairExtractor(store_name='test_store', exclude=exclude_tags)
context = PipelineContext()
step.process(document, context)
assert context.get_store('test_store').count() == 34
# Testing both include and exclude parameters
include_tags = ['LOC']
exclude_tags = ['DATE']
document = Document.from_msgpack(open(os.path.join(get_test_directory(), 'news-tagged.kdxa'), 'rb').read())
step = TagsToKeyValuePairExtractor(store_name='test_store', include=include_tags, exclude=exclude_tags)
context = PipelineContext()
step.process(document, context)
assert context.get_store('test_store').count() == 5
# Testing both include - this should be the same as before as 'exclude' shouldn't have really done anything
include_tags = ['LOC']
document = Document.from_msgpack(open(os.path.join(get_test_directory(), 'news-tagged.kdxa'), 'rb').read())
step = TagsToKeyValuePairExtractor(store_name='test_store', include=include_tags)
context = PipelineContext()
step.process(document, context)
assert context.get_store('test_store').count() == 5
@pytest.mark.skip
def test_rollup_of_pdf():
# first test - collapsing words and lines up to their common parent
test_doc = Document.from_kdxa(get_test_directory() + '20200709.kdxa')
# how many pre-rollup lines?
assert len(test_doc.select('//line')) == 3824
# how many pre-rollup words?
assert len(test_doc.select('//word')) == 52903
# how many pre-rollup content-areas?
assert len(test_doc.select('//content-area')) == 817
# what is the pre-rollup length of ALL the content in the document?
assert len(test_doc.get_root().get_all_content()) == 329792
rollup_pipeline = Pipeline(test_doc)
rollup_pipeline.add_step(RollupTransformer(collapse_type_res=["word", "line"], separator_character=' '))
rollup_pipeline.run()
collapsed_doc = rollup_pipeline.context.output_document
# how many post-rollup lines?
assert len(test_doc.select('//line')) == 0
# how many post-rollup words?
assert len(test_doc.select('//word')) == 0
# how many post-rollup content-areas?
assert len(test_doc.select('//content-area')) == 817
# what is the post-rollup length of ALL the content in the document?
assert len(test_doc.get_root().get_all_content()) == 329792
assert len(collapsed_doc.select("//content-area")[12].get_all_content()) == 235
# second test - just collapse the line up to its parent (content-area) - roll up the line's children
test_doc = Document.from_kdxa(get_test_directory() + '20200709.kdxa')
rollup_pipeline = Pipeline(test_doc)
rollup_pipeline.add_step(
RollupTransformer(collapse_type_res=["line"], separator_character=' ', get_all_content=True))
rollup_pipeline.run()
collapsed_doc = rollup_pipeline.context.output_document
# how many post-rollup lines?
assert len(test_doc.select('//line')) == 0
# how many post-rollup words?
assert len(test_doc.select('//word')) == 0
# how many post-rollup content-areas?
assert len(test_doc.select('//content-area')) == 817
# what is the post-rollup length of ALL the content in the document?
assert len(test_doc.get_root().get_all_content()) == 329792
# verify that we can collapse line nodes AND include their children
assert len(collapsed_doc.select("//content-area")[12].get_all_content()) == 235
# third test - select specific nodes in which we'll do the roll ups
test_doc = Document.from_kdxa(get_test_directory() + '20200709.kdxa')
node_selector = "//content-area[contentRegex('.*LOAN AGREEMENT.*', true)]"
# verify we have 3 nodes match this selector
node_matches = test_doc.select(node_selector)
assert len(node_matches) == 3
# before we rollup, let's make sure the matching nodes conform to known expectations
assert len(node_matches[0].select('//word')) == 2
assert len(node_matches[0].select('//line')) == 1
assert len(node_matches[0].select('//content-area')) == 1
assert len(node_matches[0].get_all_content()) == 14
assert len(node_matches[1].select('//word')) == 2
assert len(node_matches[1].select('//line')) == 1
assert len(node_matches[1].select('//content-area')) == 1
assert len(node_matches[1].get_all_content()) == 14
assert len(node_matches[2].select('//word')) == 71
assert len(node_matches[2].select('//line')) == 6
assert len(node_matches[2].select('//content-area')) == 1
assert len(node_matches[2].get_all_content()) == 500
rollup_pipeline = Pipeline(test_doc)
rollup_pipeline.add_step(RollupTransformer(selector="//content-area[contentRegex('.*LOAN AGREEMENT.*', true)]",
collapse_type_res=["line"], separator_character=' ',
get_all_content=True))
rollup_pipeline.run()
collapsed_doc = rollup_pipeline.context.output_document
# check those matching nodes - we shouldn't have any words or lines, but
# all other node_types should exist and the content should stay the same.
assert len(node_matches[0].select('//word')) == 0
assert len(node_matches[0].select('//line')) == 0
assert len(node_matches[0].select('//content-area')) == 1
assert len(node_matches[0].get_all_content()) == 14
assert len(node_matches[1].select('//word')) == 0
assert len(node_matches[1].select('//line')) == 0
assert len(node_matches[1].select('//content-area')) == 1
assert len(node_matches[1].get_all_content()) == 14
assert len(node_matches[2].select('//word')) == 0
assert len(node_matches[2].select('//line')) == 0
assert len(node_matches[2].select('//content-area')) == 1
assert len(node_matches[2].get_all_content()) == 500
# how many post-rollup lines? (still have some lines, but fewer than we started with)
assert len(test_doc.select('//line')) == 3816
# how many post-rollup words? (still have some words, but fewer than we started with)
assert len(test_doc.select('//word')) == 52828
# how many post-rollup content-areas? (same number of content-areas)
assert len(test_doc.select('//content-area')) == 817
# what is the post-rollup length of ALL the content in the document?
assert len(test_doc.get_root().get_all_content()) == 329792
# verify that we can collapse line nodes AND include their children
assert len(collapsed_doc.select("//content-area")[12].get_all_content()) == 235
| 45.71875
| 224
| 0.691729
| 1,201
| 8,778
| 4.882598
| 0.16403
| 0.072135
| 0.055423
| 0.085266
| 0.7691
| 0.742156
| 0.735846
| 0.675477
| 0.643247
| 0.643247
| 0
| 0.024663
| 0.163933
| 8,778
| 191
| 225
| 45.958115
| 0.774356
| 0.192982
| 0
| 0.534483
| 0
| 0.008621
| 0.144823
| 0.020142
| 0
| 0
| 0
| 0
| 0.491379
| 1
| 0.043103
| false
| 0
| 0.025862
| 0.008621
| 0.077586
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6f79392055980ee88fc9adbd173f470e11c846bf
| 158
|
py
|
Python
|
dftimewolf/lib/containers/__init__.py
|
fooris/dftimewolf
|
5df863dad1518e4c4109f0563efa7458df26f7d2
|
[
"Apache-2.0"
] | 1
|
2021-01-21T19:53:37.000Z
|
2021-01-21T19:53:37.000Z
|
dftimewolf/lib/containers/__init__.py
|
joachimmetz/dftimewolf
|
9181bd9e860a467495ca4ab66e2c3873cbcbf529
|
[
"Apache-2.0"
] | null | null | null |
dftimewolf/lib/containers/__init__.py
|
joachimmetz/dftimewolf
|
9181bd9e860a467495ca4ab66e2c3873cbcbf529
|
[
"Apache-2.0"
] | null | null | null |
"""Make containers available here."""
from .report import Report
from .threat_intelligence import ThreatIntelligence
from .stackdriver import StackdriverLogs
| 31.6
| 51
| 0.835443
| 17
| 158
| 7.705882
| 0.705882
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.101266
| 158
| 4
| 52
| 39.5
| 0.922535
| 0.196203
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
48b9e626c31a3acad3ffc788ac2313af13310a0d
| 120
|
py
|
Python
|
tests/core/test_core_renderer.py
|
timvink/pheasant
|
eb5b0a8b5473baad5ad4903984433fe763f5312e
|
[
"MIT"
] | 24
|
2018-05-25T15:23:30.000Z
|
2021-06-09T10:56:52.000Z
|
tests/core/test_core_renderer.py
|
timvink/pheasant
|
eb5b0a8b5473baad5ad4903984433fe763f5312e
|
[
"MIT"
] | 14
|
2019-04-30T10:51:01.000Z
|
2020-09-16T20:37:30.000Z
|
tests/core/test_core_renderer.py
|
timvink/pheasant
|
eb5b0a8b5473baad5ad4903984433fe763f5312e
|
[
"MIT"
] | 9
|
2019-06-12T10:54:18.000Z
|
2022-01-15T21:19:05.000Z
|
from pheasant.renderers.jupyter.jupyter import Jupyter
jupyter = Jupyter()
jupyter.findall("{{3}}3{{5}}")
jupyter.page
| 20
| 54
| 0.75
| 16
| 120
| 5.625
| 0.5625
| 0.622222
| 0.466667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.027273
| 0.083333
| 120
| 5
| 55
| 24
| 0.790909
| 0
| 0
| 0
| 0
| 0
| 0.091667
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
48bc446a06d58d6a75df610f9236257a1d789475
| 9,669
|
py
|
Python
|
malaya_speech/train/model/fastspeechsplit/model.py
|
ishine/malaya-speech
|
fd34afc7107af1656dff4b3201fa51dda54fde18
|
[
"MIT"
] | 111
|
2020-08-31T04:58:54.000Z
|
2022-03-29T15:44:18.000Z
|
malaya_speech/train/model/fastspeechsplit/model.py
|
ishine/malaya-speech
|
fd34afc7107af1656dff4b3201fa51dda54fde18
|
[
"MIT"
] | 14
|
2020-12-16T07:27:22.000Z
|
2022-03-15T17:39:01.000Z
|
malaya_speech/train/model/fastspeechsplit/model.py
|
ishine/malaya-speech
|
fd34afc7107af1656dff4b3201fa51dda54fde18
|
[
"MIT"
] | 29
|
2021-02-09T08:57:15.000Z
|
2022-03-12T14:09:19.000Z
|
import tensorflow as tf
from ..fastspeech.model import (
TFFastSpeechEncoder,
TFTacotronPostnet,
TFFastSpeechLayer,
)
from ..speechsplit.model import InterpLnr
import numpy as np
import copy
class Encoder_6(tf.keras.layers.Layer):
def __init__(self, config, hparams, **kwargs):
super(Encoder_6, self).__init__(name='Encoder_6', **kwargs)
self.dim_neck_3 = hparams.dim_neck_3
self.freq_3 = hparams.freq_3
self.dim_f0 = hparams.dim_f0
self.dim_enc_3 = hparams.dim_enc_3
self.dim_emb = hparams.dim_spk_emb
self.chs_grp = hparams.chs_grp
self.before_dense_1 = tf.keras.layers.Dense(
units=self.dim_enc_3, dtype=tf.float32, name='before_dense_1'
)
config_1 = copy.deepcopy(config)
config_1.hidden_size = self.dim_enc_3
self.layer_1 = [
TFFastSpeechLayer(config_1, name='layer_._{}'.format(i))
for i in range(config_1.num_hidden_layers)
]
self.encoder_dense_1 = tf.keras.layers.Dense(
units=self.dim_neck_3,
dtype=tf.float32,
name='encoder_dense_1',
)
self.interp = InterpLnr(hparams)
def call(self, x, attention_mask, training=True):
x = self.before_dense_1(x)
for no, layer_module in enumerate(self.layer_1):
x = layer_module([x, attention_mask], training=training)[0]
x = self.interp(
x,
tf.tile([tf.shape(x)[1]], [tf.shape(x)[0]]),
training=training,
)
x = self.encoder_dense_1(x)
return x
class Encoder_7(tf.keras.layers.Layer):
def __init__(self, config, hparams, **kwargs):
super(Encoder_7, self).__init__(name='Encoder_7', **kwargs)
self.config = config
self.dim_neck = hparams.dim_neck
self.dim_neck_3 = hparams.dim_neck_3
self.dim_freq = hparams.dim_freq
self.dim_enc = hparams.dim_enc
self.dim_enc_3 = hparams.dim_enc_3
self.before_dense_1 = tf.keras.layers.Dense(
units=self.dim_enc, dtype=tf.float32, name='before_dense_1'
)
self.before_dense_2 = tf.keras.layers.Dense(
units=self.dim_enc_3, dtype=tf.float32, name='before_dense_2'
)
config_1 = copy.deepcopy(config)
config_1.hidden_size = self.dim_enc
self.layer_1 = [
TFFastSpeechLayer(config_1, name='layer_._{}'.format(i))
for i in range(config_1.num_hidden_layers)
]
config_2 = copy.deepcopy(config)
config_2.hidden_size = self.dim_enc_3
self.layer_2 = [
TFFastSpeechLayer(config_2, name='layer_._{}'.format(i))
for i in range(config_2.num_hidden_layers)
]
self.encoder_dense_1 = tf.keras.layers.Dense(
units=self.dim_neck, dtype=tf.float32, name='encoder_dense_1'
)
self.encoder_dense_2 = tf.keras.layers.Dense(
units=self.dim_neck_3,
dtype=tf.float32,
name='encoder_dense_2',
)
self.interp = InterpLnr(hparams)
def call(self, x_f0, attention_mask, training=True):
x = x_f0[:, :, : self.dim_freq]
f0 = x_f0[:, :, self.dim_freq:]
x = self.before_dense_1(x)
f0 = self.before_dense_2(f0)
seq_length = tf.shape(x_f0)[1]
for no, layer_module in enumerate(self.layer_1):
x = layer_module([x, attention_mask], training=training)[0]
f0 = self.layer_2[no]([f0, attention_mask], training=training)[0]
x_f0 = tf.concat((x, f0), axis=2)
x_f0 = self.interp(
x_f0,
tf.tile([tf.shape(x_f0)[1]], [tf.shape(x)[0]]),
training=training,
)
x = x_f0[:, :, : self.dim_enc]
f0 = x_f0[:, :, self.dim_enc:]
x = x_f0[:, :, : self.dim_enc]
f0 = x_f0[:, :, self.dim_enc:]
x = self.encoder_dense_1(x)
f0 = self.encoder_dense_2(f0)
return x, f0
class Encoder_t(tf.keras.layers.Layer):
def __init__(self, config, hparams, **kwargs):
super(Encoder_t, self).__init__(name='Encoder_t', **kwargs)
self.dim_neck_2 = hparams.dim_neck_2
self.freq_2 = hparams.freq_2
self.dim_freq = hparams.dim_freq
self.dim_enc_2 = hparams.dim_enc_2
self.dim_emb = hparams.dim_spk_emb
self.chs_grp = hparams.chs_grp
config = copy.deepcopy(config)
config.num_hidden_layers = 1
config.hidden_size = self.dim_enc_2
self.config = config
self.before_dense = tf.keras.layers.Dense(
units=self.dim_enc_2, dtype=tf.float32, name='before_dense_1'
)
self.encoder = TFFastSpeechEncoder(config, name='encoder')
self.encoder_dense = tf.keras.layers.Dense(
units=self.dim_neck_2, dtype=tf.float32, name='encoder_dense'
)
def call(self, x, attention_mask, training=True):
x = self.before_dense(x)
seq_length = tf.shape(x)[1]
f = self.encoder([x, attention_mask], training=training)[0]
return self.encoder_dense(f)
class Decoder_3(tf.keras.layers.Layer):
def __init__(self, config, hparams, **kwargs):
super(Decoder_3, self).__init__(name='Decoder_3', **kwargs)
self.config = config
self.encoder = TFFastSpeechEncoder(config, name='encoder')
self.before_dense = tf.keras.layers.Dense(
units=config.hidden_size,
dtype=tf.float32,
name='before_dense_1',
)
self.linear_projection = tf.keras.layers.Dense(
units=hparams.dim_freq,
dtype=tf.float32,
name='self.linear_projection',
)
def call(self, x, attention_mask, training=True):
x = self.before_dense(x)
seq_length = tf.shape(x)[1]
f = self.encoder([x, attention_mask], training=training)[0]
return self.linear_projection(f)
class Decoder_4(tf.keras.layers.Layer):
def __init__(self, config, hparams, **kwargs):
super(Decoder_4, self).__init__(name='Decoder_4', **kwargs)
self.config = config
self.encoder = TFFastSpeechEncoder(config, name='encoder')
self.before_dense = tf.keras.layers.Dense(
units=config.hidden_size,
dtype=tf.float32,
name='before_dense_1',
)
self.linear_projection = tf.keras.layers.Dense(
units=hparams.dim_f0,
dtype=tf.float32,
name='self.linear_projection',
)
def call(self, x, attention_mask, training=True):
x = self.before_dense(x)
seq_length = tf.shape(x)[1]
f = self.encoder([x, attention_mask], training=training)[0]
return self.linear_projection(f)
class Model(tf.keras.Model):
def __init__(self, config, hparams, **kwargs):
super(Model, self).__init__(name='speechsplit', **kwargs)
self.encoder_1 = Encoder_7(
config.encoder_self_attention_params, hparams
)
self.encoder_2 = Encoder_t(
config.encoder_self_attention_params, hparams
)
self.decoder = Decoder_3(config.decoder_self_attention_params, hparams)
self.freq = hparams.freq
self.freq_2 = hparams.freq_2
self.freq_3 = hparams.freq_3
def call(self, x_f0, x_org, c_trg, mel_lengths, training=True):
max_length = tf.cast(tf.reduce_max(mel_lengths), tf.int32)
attention_mask = tf.sequence_mask(
lengths=mel_lengths, maxlen=max_length, dtype=tf.float32
)
attention_mask.set_shape((None, None))
codes_x, codes_f0 = self.encoder_1(
x_f0, attention_mask, training=training
)
codes_2 = self.encoder_2(x_org, attention_mask, training=training)
code_exp_1 = codes_x
code_exp_3 = codes_f0
code_exp_2 = codes_2
c_trg = tf.tile(tf.expand_dims(c_trg, 1), (1, tf.shape(x_f0)[1], 1))
encoder_outputs = tf.concat(
(code_exp_1, code_exp_2, code_exp_3, c_trg), axis=-1
)
mel_outputs = self.decoder(
encoder_outputs, attention_mask, training=training
)
return codes_x, codes_f0, codes_2, encoder_outputs, mel_outputs
class Model_F0(tf.keras.Model):
def __init__(self, config, hparams, **kwargs):
super(Model_F0, self).__init__(name='speechsplit_f0', **kwargs)
self.encoder_2 = Encoder_t(
config.encoder_self_attention_params, hparams
)
self.encoder_3 = Encoder_6(
config.encoder_self_attention_params, hparams
)
self.decoder = Decoder_4(config.decoder_self_attention_params, hparams)
self.freq_2 = hparams.freq_2
self.freq_3 = hparams.freq_3
def call(self, x_org, f0_trg, mel_lengths, training=True):
max_length = tf.cast(tf.reduce_max(mel_lengths), tf.int32)
attention_mask = tf.sequence_mask(
lengths=mel_lengths, maxlen=max_length, dtype=tf.float32
)
attention_mask.set_shape((None, None))
codes_2 = self.encoder_2(x_org, attention_mask, training=training)
code_exp_2 = codes_2
codes_3 = self.encoder_3(f0_trg, attention_mask, training=training)
code_exp_3 = codes_3
self.o = [code_exp_2, code_exp_3]
encoder_outputs = tf.concat((code_exp_2, code_exp_3), axis=-1)
mel_outputs = self.decoder(
encoder_outputs, attention_mask, training=training
)
return codes_2, codes_3, encoder_outputs, mel_outputs
| 34.532143
| 79
| 0.617541
| 1,296
| 9,669
| 4.293981
| 0.077932
| 0.038994
| 0.039712
| 0.038814
| 0.81761
| 0.775202
| 0.726685
| 0.714286
| 0.62965
| 0.576819
| 0
| 0.029487
| 0.270452
| 9,669
| 279
| 80
| 34.655914
| 0.759427
| 0
| 0
| 0.497817
| 0
| 0
| 0.031751
| 0.004551
| 0
| 0
| 0
| 0
| 0
| 1
| 0.061135
| false
| 0
| 0.021834
| 0
| 0.144105
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
48da319d7adab06ea080a4bfe703b82db0fccf2a
| 1,106
|
py
|
Python
|
elliptic_moab/Mesh/MeshQL.py
|
padmec-reservoir/elliptic_moab
|
a3b15f29a621c35a8279fd163326a0895aa67f30
|
[
"MIT"
] | null | null | null |
elliptic_moab/Mesh/MeshQL.py
|
padmec-reservoir/elliptic_moab
|
a3b15f29a621c35a8279fd163326a0895aa67f30
|
[
"MIT"
] | null | null | null |
elliptic_moab/Mesh/MeshQL.py
|
padmec-reservoir/elliptic_moab
|
a3b15f29a621c35a8279fd163326a0895aa67f30
|
[
"MIT"
] | null | null | null |
from typing import Type
from elliptic.Kernel.Context import ContextDelegate
from .Selector import SelectorImplementation
from .Manager import ManagerImplementation
from .Computer import ComputerImplementation
class MeshQLImplementation(ComputerImplementation, ManagerImplementation, SelectorImplementation):
def base_delegate(self) -> Type[ContextDelegate]:
class BaseDelegate(ContextDelegate):
def get_template_file(self):
return 'base.pyx.etp'
def template_kwargs(self):
return {'declare_entityhandles': self.context.context['declare_entityhandle'],
'declare_ranges': self.context.context['declare_range'],
'declare_indexes': self.context.context['declare_index'],
'declare_variables': self.context.context['declare_variable'],
'declare_tags': set(self.context.context['declare_tags'])}
def context_enter(self):
pass
def context_exit(self):
pass
return BaseDelegate
| 34.5625
| 98
| 0.654611
| 98
| 1,106
| 7.22449
| 0.428571
| 0.077684
| 0.127119
| 0.176554
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.264919
| 1,106
| 31
| 99
| 35.677419
| 0.870849
| 0
| 0
| 0.095238
| 0
| 0
| 0.149186
| 0.018987
| 0
| 0
| 0
| 0
| 0
| 1
| 0.238095
| false
| 0.095238
| 0.238095
| 0.095238
| 0.714286
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
48dcecd475c9d9c66ff47a1b76abf99c791428f8
| 805
|
py
|
Python
|
tests/test_268.py
|
sungho-joo/leetcode2github
|
ce7730ef40f6051df23681dd3c0e1e657abba620
|
[
"MIT"
] | null | null | null |
tests/test_268.py
|
sungho-joo/leetcode2github
|
ce7730ef40f6051df23681dd3c0e1e657abba620
|
[
"MIT"
] | null | null | null |
tests/test_268.py
|
sungho-joo/leetcode2github
|
ce7730ef40f6051df23681dd3c0e1e657abba620
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
import pytest
"""
Test 268. Missing Number
"""
@pytest.fixture(scope="session")
def init_variables_268():
from src.leetcode_268_missing_number import Solution
solution = Solution()
def _init_variables_268():
return solution
yield _init_variables_268
class TestClass268:
def test_solution_0(self, init_variables_268):
assert init_variables_268().missingNumber([3, 0, 1]) == 2
def test_solution_1(self, init_variables_268):
assert init_variables_268().missingNumber([0, 1]) == 2
def test_solution_2(self, init_variables_268):
assert init_variables_268().missingNumber([9, 6, 4, 2, 3, 5, 7, 0, 1]) == 8
def test_solution_3(self, init_variables_268):
assert init_variables_268().missingNumber([0]) == 1
| 23.676471
| 83
| 0.696894
| 111
| 805
| 4.738739
| 0.333333
| 0.271863
| 0.334601
| 0.152091
| 0.490494
| 0.490494
| 0.425856
| 0.425856
| 0.425856
| 0.21673
| 0
| 0.099388
| 0.187578
| 805
| 33
| 84
| 24.393939
| 0.704893
| 0.024845
| 0
| 0
| 0
| 0
| 0.009309
| 0
| 0
| 0
| 0
| 0
| 0.235294
| 1
| 0.352941
| false
| 0
| 0.117647
| 0.058824
| 0.588235
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
48f4b8e6c0c1a95b21e6fbc67429a32685a3063d
| 126
|
py
|
Python
|
output/models/ms_data/regex/hangul_compatibility_jamo_xsd/__init__.py
|
tefra/xsdata-w3c-tests
|
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
|
[
"MIT"
] | 1
|
2021-08-14T17:59:21.000Z
|
2021-08-14T17:59:21.000Z
|
output/models/ms_data/regex/hangul_compatibility_jamo_xsd/__init__.py
|
tefra/xsdata-w3c-tests
|
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
|
[
"MIT"
] | 4
|
2020-02-12T21:30:44.000Z
|
2020-04-15T20:06:46.000Z
|
output/models/ms_data/regex/hangul_compatibility_jamo_xsd/__init__.py
|
tefra/xsdata-w3c-tests
|
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
|
[
"MIT"
] | null | null | null |
from output.models.ms_data.regex.hangul_compatibility_jamo_xsd.hangul_compatibility_jamo import Doc
__all__ = [
"Doc",
]
| 21
| 99
| 0.801587
| 17
| 126
| 5.352941
| 0.764706
| 0.417582
| 0.505495
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 126
| 5
| 100
| 25.2
| 0.8125
| 0
| 0
| 0
| 0
| 0
| 0.02381
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
5b1363485151128caf183c9f6b705444acca65c5
| 136
|
py
|
Python
|
src/localsrv/urls.py
|
vladiibine/localsrv
|
7bb8fd2e08f43a1b5adef9ad17ab534a317e0a57
|
[
"MIT"
] | null | null | null |
src/localsrv/urls.py
|
vladiibine/localsrv
|
7bb8fd2e08f43a1b5adef9ad17ab534a317e0a57
|
[
"MIT"
] | 4
|
2015-04-28T08:20:26.000Z
|
2015-06-13T06:32:31.000Z
|
src/localsrv/urls.py
|
vladiibine/localsrv
|
7bb8fd2e08f43a1b5adef9ad17ab534a317e0a57
|
[
"MIT"
] | 1
|
2018-03-04T20:29:27.000Z
|
2018-03-04T20:29:27.000Z
|
from django.conf.urls import url
from .views import serve_all
urlpatterns = (
url(r'^.*$', serve_all, name="localsrv:serve_all"),
)
| 22.666667
| 55
| 0.705882
| 20
| 136
| 4.65
| 0.65
| 0.258065
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.139706
| 136
| 6
| 56
| 22.666667
| 0.794872
| 0
| 0
| 0
| 0
| 0
| 0.160584
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
5b19d3c83fe2ac0f121d05692ca3db02ba4ea908
| 1,848
|
py
|
Python
|
data/scripts/classes/team_row.py
|
matt-waite/lol-reference
|
1042fc0a63f7911ed9434b5bb6ba8f866fc0a9c2
|
[
"MIT"
] | 1
|
2020-08-26T17:29:58.000Z
|
2020-08-26T17:29:58.000Z
|
data/scripts/classes/team_row.py
|
matt-waite/lol-reference
|
1042fc0a63f7911ed9434b5bb6ba8f866fc0a9c2
|
[
"MIT"
] | null | null | null |
data/scripts/classes/team_row.py
|
matt-waite/lol-reference
|
1042fc0a63f7911ed9434b5bb6ba8f866fc0a9c2
|
[
"MIT"
] | null | null | null |
from classes import oracles_headers
class TeamRow:
COLUMNS = oracles_headers.oracles_columns
def __init__(self, row):
self.ROW = row
def GetCell(self, name):
return self.ROW[self.COLUMNS[name]]
def GetDatabaseObject(self):
game = {
"gameId": self.GameId(),
"isComplete": self.IsComplete(),
"league": self.League(),
"year": self.Year(),
"split": self.Split(),
"date": self.Date(),
"patch": self.Patch(),
"side": self.Side(),
"team": self.Team(),
"bans": self.Bans(),
"gameLength": self.GameLength(),
"result": self.Result(),
"kills": self.Kills(),
"deaths": self.Deaths(),
"assists": self.Assists()
}
return game
def GameId(self):
return self.GetCell('GameId')
def IsComplete(self):
return self.GetCell('IsComplete')
def League(self):
return self.GetCell('League')
def Year(self):
return int(self.GetCell('Year'))
def Split(self):
return self.GetCell('Split')
def Date(self):
return self.GetCell('Date')
def Patch(self):
return self.GetCell('Patch')
def Side(self):
return self.GetCell('Side')
def Team(self):
return self.GetCell('Team')
def Bans(self):
return [self.GetCell(f"Ban{i}") for i in range(1, 6)]
def GameLength(self):
return self.GetCell('GameLength')
def Result(self):
return False if self.GetCell('Result') == "0" else True
def Kills(self):
return int(self.GetCell('Kills'))
def Deaths(self):
return int(self.GetCell('Deaths'))
def Assists(self):
return int(self.GetCell('Assists'))
| 24
| 63
| 0.540584
| 202
| 1,848
| 4.910891
| 0.227723
| 0.15121
| 0.141129
| 0.211694
| 0.096774
| 0
| 0
| 0
| 0
| 0
| 0
| 0.002368
| 0.314394
| 1,848
| 77
| 64
| 24
| 0.780584
| 0
| 0
| 0
| 0
| 0
| 0.094646
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.321429
| false
| 0
| 0.017857
| 0.285714
| 0.678571
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
5b2402300dbab63aa021dccf15d38bf7417d131e
| 90
|
py
|
Python
|
python/632.smallest-range-covering-elements-from-k-lists.py
|
stavanmehta/leetcode
|
1224e43ce29430c840e65daae3b343182e24709c
|
[
"Apache-2.0"
] | null | null | null |
python/632.smallest-range-covering-elements-from-k-lists.py
|
stavanmehta/leetcode
|
1224e43ce29430c840e65daae3b343182e24709c
|
[
"Apache-2.0"
] | null | null | null |
python/632.smallest-range-covering-elements-from-k-lists.py
|
stavanmehta/leetcode
|
1224e43ce29430c840e65daae3b343182e24709c
|
[
"Apache-2.0"
] | null | null | null |
class Solution:
def smallestRange(self, nums: List[List[int]]) -> List[int]:
| 22.5
| 64
| 0.611111
| 11
| 90
| 5
| 0.727273
| 0.254545
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.233333
| 90
| 3
| 65
| 30
| 0.797101
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d28a47045a9d4366365cea9cca22f372e578a38f
| 620
|
py
|
Python
|
Exercício feitos pela primeira vez/ex046.py
|
Claayton/pythonExerciciosLinux
|
696cdb16983638418bd0d0d4fe44dc72662b9c97
|
[
"MIT"
] | 1
|
2021-01-23T15:43:34.000Z
|
2021-01-23T15:43:34.000Z
|
Exercício feitos pela primeira vez/ex046.py
|
Claayton/pythonExerciciosLinux
|
696cdb16983638418bd0d0d4fe44dc72662b9c97
|
[
"MIT"
] | null | null | null |
Exercício feitos pela primeira vez/ex046.py
|
Claayton/pythonExerciciosLinux
|
696cdb16983638418bd0d0d4fe44dc72662b9c97
|
[
"MIT"
] | null | null | null |
#Exercício046
from time import sleep
import emoji
print('\033[32mCONTAGEM REGRESSIVA PARA O ANO NOVO:\033[m')
sleep(1)
for c in range(10, 0 - 1, -1):#repete os números de 10 até o 0
print(c)
sleep(1)
print(emoji.emojize("\033[31m:boom::boom::boom:KABUM:boom::boom::boom:", use_aliases=True))
print(emoji.emojize("\033[32m:boom::boom::boom:FOGUETE:boom::boom::boom:", use_aliases=True))
print(emoji.emojize("\033[33m:boom::boom::boom:FOGOS E MAIS FOGOS:boom::boom::boom:", use_aliases=True))
print(emoji.emojize("\033[34m:boom::boom::boom:GUANAGARA VIADO:boom::boom::boom:", use_aliases=True))
print('\033[32mxD')
| 47.692308
| 104
| 0.720968
| 106
| 620
| 4.179245
| 0.415094
| 0.288939
| 0.216704
| 0.180587
| 0.38149
| 0.38149
| 0.38149
| 0.311512
| 0.311512
| 0.311512
| 0
| 0.080844
| 0.082258
| 620
| 13
| 105
| 47.692308
| 0.697715
| 0.069355
| 0
| 0.166667
| 0
| 0.083333
| 0.487847
| 0.368056
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.166667
| 0
| 0.166667
| 0.583333
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
d294d257d8cdf140b519b1d91dd4b68639347768
| 8,235
|
py
|
Python
|
proxy_server/backend_services.py
|
lmanzurv/django_proxy_server
|
20304829ef1ddcbb281e1373d308e5fa826fcd39
|
[
"Apache-2.0"
] | 11
|
2015-07-18T02:23:43.000Z
|
2021-11-15T11:43:21.000Z
|
proxy_server/backend_services.py
|
lmanzurv/django_proxy_server
|
20304829ef1ddcbb281e1373d308e5fa826fcd39
|
[
"Apache-2.0"
] | null | null | null |
proxy_server/backend_services.py
|
lmanzurv/django_proxy_server
|
20304829ef1ddcbb281e1373d308e5fa826fcd39
|
[
"Apache-2.0"
] | 5
|
2015-02-24T15:37:36.000Z
|
2021-10-10T16:42:22.000Z
|
from django.contrib.auth import SESSION_KEY
from django.core.cache import cache
from django.conf import settings
from django.http import HttpResponse, HttpResponseServerError
from proxy_server.response import AJAX_REQUEST
import httplib, json, proxy_server
def invoke_backend_service(method, function_path, json_data=dict(), request=None, response_token=True, public=False, secure=False):
error_message = None
try:
if public is False and request is None:
error_message = 'A private web service must receive Django\'s request'
raise Exception
if response_token is True and request is None:
error_message = 'A web service cannot expect a response token and not receive Django\'s request'
raise Exception
if not hasattr(settings, 'BACKEND_HOST'):
error_message = 'No backend host and/or port specified'
raise Exception
if secure:
if hasattr(settings, 'BACKEND_PORT'):
conn = httplib.HTTPSConnection(settings.BACKEND_HOST, settings.BACKEND_PORT)
else:
conn = httplib.HTTPSConnection(settings.BACKEND_HOST)
else:
if hasattr(settings, 'BACKEND_PORT'):
conn = httplib.HTTPConnection(settings.BACKEND_HOST, settings.BACKEND_PORT)
else:
conn = httplib.HTTPConnection(settings.BACKEND_HOST)
headers = proxy_server.RESTFUL_HEADER
headers[proxy_server.API_KEY] = settings.SECRET_KEY
if request is not None:
pk = cache.get(AJAX_REQUEST, None)
if pk:
request.user.pk = pk
cache.delete(AJAX_REQUEST)
headers[proxy_server.USER_TOKEN] = request.user.pk
headers[proxy_server.CLIENT_IP] = request.META.get(proxy_server.HTTP_FROM)
try:
conn.request(method, function_path, json.dumps(json_data), headers)
except:
error_message = 'Could not connect to service'
raise Exception
response = conn.getresponse()
response_data = response.read()
conn.close()
if response.status == 403:
return 403, None
if response.status == 204:
if response_token is True:
error_message = 'Backend server didn\'t respond with a token'
raise Exception
return 204, None
else:
try:
response_json = json.loads(response_data)
except:
error_message = 'Unknown response format'
raise Exception
if response_token is True:
user_dict = None
if SESSION_KEY in request.session:
user_dict = cache.get(request.session[SESSION_KEY])
cache.delete(request.session[SESSION_KEY])
request.session[SESSION_KEY] = response_json[proxy_server.USER_TOKEN]
request.user.pk = response_json[proxy_server.USER_TOKEN]
request.session[proxy_server.EXPIRATION_DATE] = response_json[proxy_server.EXPIRATION_DATE]
if user_dict:
user_dict['pk'] = request.user.pk
cache.set(request.session[SESSION_KEY], user_dict)
if response.status == 200:
if response_token is True and proxy_server.USER_TOKEN not in response_json:
error_message = 'Server expected user token in response'
raise Exception
result = None
if proxy_server.RESPONSE in response_json:
result = response_json[proxy_server.RESPONSE]
return 200, result
else:
code = response.status
if proxy_server.ERROR in response_json:
error_message = response_json[proxy_server.ERROR][proxy_server.MESSAGE]
raise Exception(code)
else:
error_message = response.reason
raise Exception(code)
except Exception as e:
if error_message is None:
error_message = 'Unknown error in service invocation'
code = int(str(e)) if e is not None and isinstance(str(e), int) else 500
error = {
'error': {
'code': code,
'type': 'ProxyServerError',
'message': error_message
}
}
return code, error
def invoke_backend_service_as_proxy(request, method, function_path, json_data=dict(), response_token=True, secure=False):
error_message = None
try:
if not hasattr(settings, 'BACKEND_HOST'):
error_message = 'No backend host and/or port specified'
raise Exception
if secure:
if hasattr(settings, 'BACKEND_PORT'):
conn = httplib.HTTPSConnection(settings.BACKEND_HOST, settings.BACKEND_PORT)
else:
conn = httplib.HTTPSConnection(settings.BACKEND_HOST)
else:
if hasattr(settings, 'BACKEND_PORT'):
conn = httplib.HTTPConnection(settings.BACKEND_HOST, settings.BACKEND_PORT)
else:
conn = httplib.HTTPConnection(settings.BACKEND_HOST)
headers = proxy_server.RESTFUL_HEADER
headers[proxy_server.USER_TOKEN] = request.META.get(proxy_server.HTTP_USER_TOKEN)
headers[proxy_server.CLIENT_IP] = request.META.get(proxy_server.HTTP_FROM)
headers[proxy_server.API_KEY] = request.META.get(proxy_server.HTTP_API_KEY)
try:
conn.request(method, function_path, json.dumps(json_data), headers)
except:
error_message = 'Could not connect to service'
raise Exception
response = conn.getresponse()
response_data = response.read()
conn.close()
if response.status == 403:
resp = HttpResponse(status=response.status, reason=response.reason)
for header, value in response.getheaders():
resp[header] = value
for header in proxy_server.HOP_BY_HOP:
del resp[header]
resp[proxy_server.HEADER_SERVER] = proxy_server.VALUE_SERVER
return resp
if response.status == 204:
if response_token is True:
error_message = 'Backend server didn\'t respond with a token'
raise Exception
resp = HttpResponse(status=response.status, content_type='application/json', reason=response.reason)
for header, value in response.getheaders():
resp[header] = value
for header in proxy_server.HOP_BY_HOP:
del resp[header]
resp[proxy_server.HEADER_SERVER] = proxy_server.VALUE_SERVER
return resp
else:
try:
response_json = json.loads(response_data)
except:
error_message = 'Unknown response format'
raise Exception
if response.status == 200:
if response_token is True and proxy_server.USER_TOKEN not in response_json:
error_message = 'Server expected user token in response'
raise Exception
resp = HttpResponse(response_data, status=response.status, content_type='application/json', reason=response.reason)
for header, value in response.getheaders():
resp[header] = value
for header in proxy_server.HOP_BY_HOP:
del resp[header]
resp[proxy_server.HEADER_SERVER] = proxy_server.VALUE_SERVER
return resp
except Exception as e:
if error_message is None:
error_message = 'Unknown error in service invocation'
code = int(str(e)) if e is not None and isinstance(str(e), int) else 500
error = {
'error': {
'code': code,
'type': 'ProxyServerError',
'message': error_message
}
}
return HttpResponseServerError(json.dumps(error), content_type='application/json')
| 37.094595
| 131
| 0.600364
| 901
| 8,235
| 5.307436
| 0.134295
| 0.07821
| 0.039732
| 0.02133
| 0.754287
| 0.730238
| 0.702217
| 0.631326
| 0.631326
| 0.631326
| 0
| 0.005967
| 0.328476
| 8,235
| 221
| 132
| 37.262443
| 0.85877
| 0
| 0
| 0.710983
| 0
| 0.011561
| 0.080874
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.011561
| false
| 0
| 0.034682
| 0
| 0.092486
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d2d2f4b2d01e6090619cd23b148cfe0e1bc36f87
| 330
|
py
|
Python
|
core/managers.py
|
Bilal815/ecommerce_storee
|
45e61f1d865a65b4c52d74502b4fcab7ee6c1adf
|
[
"MIT"
] | 95
|
2020-04-13T09:02:30.000Z
|
2022-03-25T14:11:34.000Z
|
core/managers.py
|
Bilal815/ecommerce_api
|
a3d8ce7a9e1fa2528d240d5ab508afe92607c9f8
|
[
"MIT"
] | 87
|
2020-02-21T17:58:56.000Z
|
2022-03-21T21:37:05.000Z
|
core/managers.py
|
Bilal815/ecommerce_api
|
a3d8ce7a9e1fa2528d240d5ab508afe92607c9f8
|
[
"MIT"
] | 33
|
2021-01-18T09:30:29.000Z
|
2022-03-30T01:31:57.000Z
|
from django.db import models
class SoftDeleteManager(models.Manager):
def save_soft_delete(self):
self.is_deleted = True
self.save()
return True
def get_soft_delete(self):
return self.filter(is_deleted=True)
def get_unsoft_delete(self):
return self.filter(is_deleted=False)
| 22
| 44
| 0.681818
| 44
| 330
| 4.909091
| 0.477273
| 0.138889
| 0.12963
| 0.185185
| 0.324074
| 0.324074
| 0.324074
| 0
| 0
| 0
| 0
| 0
| 0.236364
| 330
| 14
| 45
| 23.571429
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.3
| false
| 0
| 0.1
| 0.2
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
d2defb686bfc61f23201cb71e5a9d368779c4dfa
| 98
|
py
|
Python
|
setup.py
|
kuzxnia/typer
|
39007237d552e4f4920b2c6e13e5f0ce482d4427
|
[
"MIT"
] | null | null | null |
setup.py
|
kuzxnia/typer
|
39007237d552e4f4920b2c6e13e5f0ce482d4427
|
[
"MIT"
] | 3
|
2020-04-07T12:39:51.000Z
|
2020-04-09T22:49:16.000Z
|
setup.py
|
kuzxnia/typer
|
39007237d552e4f4920b2c6e13e5f0ce482d4427
|
[
"MIT"
] | null | null | null |
from setuptools import find_packages, setup
setup(
name="typer", packages=find_packages(),
)
| 16.333333
| 43
| 0.744898
| 12
| 98
| 5.916667
| 0.666667
| 0.338028
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 98
| 5
| 44
| 19.6
| 0.845238
| 0
| 0
| 0
| 0
| 0
| 0.05102
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.25
| 0
| 0.25
| 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
| 0
| 0
| 0
| 0
|
0
| 4
|
d2e9b98d6967be78af6014083084b5dab63e624c
| 61
|
py
|
Python
|
nautobot/circuits/__init__.py
|
psmware-ltd/nautobot
|
ac516287fb8edcc3482bd011839de837c6bbf0df
|
[
"Apache-2.0"
] | 384
|
2021-02-24T01:40:40.000Z
|
2022-03-30T10:30:59.000Z
|
nautobot/circuits/__init__.py
|
psmware-ltd/nautobot
|
ac516287fb8edcc3482bd011839de837c6bbf0df
|
[
"Apache-2.0"
] | 1,067
|
2021-02-24T00:58:08.000Z
|
2022-03-31T23:38:23.000Z
|
nautobot/circuits/__init__.py
|
psmware-ltd/nautobot
|
ac516287fb8edcc3482bd011839de837c6bbf0df
|
[
"Apache-2.0"
] | 128
|
2021-02-24T02:45:16.000Z
|
2022-03-20T18:48:36.000Z
|
default_app_config = "nautobot.circuits.apps.CircuitsConfig"
| 30.5
| 60
| 0.852459
| 7
| 61
| 7.142857
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.04918
| 61
| 1
| 61
| 61
| 0.862069
| 0
| 0
| 0
| 0
| 0
| 0.606557
| 0.606557
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d2f36e17b1fe05c90facefa1af9d3583979040ce
| 220
|
py
|
Python
|
src/intervals/once.py
|
Eagerod/tasker
|
b2bfbd6557063da389d1839f4f151bb4ad78b075
|
[
"MIT"
] | null | null | null |
src/intervals/once.py
|
Eagerod/tasker
|
b2bfbd6557063da389d1839f4f151bb4ad78b075
|
[
"MIT"
] | null | null | null |
src/intervals/once.py
|
Eagerod/tasker
|
b2bfbd6557063da389d1839f4f151bb4ad78b075
|
[
"MIT"
] | null | null | null |
from base_interval import BaseInterval
class OnceInterval(BaseInterval):
@staticmethod
def next_interval(start_date):
return start_date
@staticmethod
def approximate_period():
return 0
| 18.333333
| 38
| 0.718182
| 23
| 220
| 6.652174
| 0.695652
| 0.196078
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005917
| 0.231818
| 220
| 11
| 39
| 20
| 0.899408
| 0
| 0
| 0.25
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.125
| 0.25
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.