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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4f6c612b06f4216f779e3c0fea1133c23378f91f
| 28
|
py
|
Python
|
model_resnet/__init__.py
|
jimmy15923/Common_tools
|
3e77dc1509ef8ac5173d41d792a170ba6ed98be0
|
[
"Apache-2.0"
] | 1
|
2018-10-26T09:33:26.000Z
|
2018-10-26T09:33:26.000Z
|
model_resnet/__init__.py
|
jimmy15923/Common_tools
|
3e77dc1509ef8ac5173d41d792a170ba6ed98be0
|
[
"Apache-2.0"
] | null | null | null |
model_resnet/__init__.py
|
jimmy15923/Common_tools
|
3e77dc1509ef8ac5173d41d792a170ba6ed98be0
|
[
"Apache-2.0"
] | null | null | null |
# Init the folder for python
| 28
| 28
| 0.785714
| 5
| 28
| 4.4
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.178571
| 28
| 1
| 28
| 28
| 0.956522
| 0.928571
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
4f79170394b66dd9100b7a21c0dd6cf80577dcb5
| 184
|
py
|
Python
|
localLogs/products/admin.py
|
abhisheksaran/locallogs
|
e0895497c9773f17467da6a7040127d9f285340e
|
[
"MIT"
] | null | null | null |
localLogs/products/admin.py
|
abhisheksaran/locallogs
|
e0895497c9773f17467da6a7040127d9f285340e
|
[
"MIT"
] | null | null | null |
localLogs/products/admin.py
|
abhisheksaran/locallogs
|
e0895497c9773f17467da6a7040127d9f285340e
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
# Register your models here.
from .models import User, Items, Orders
admin.site.register(User)
admin.site.register(Items)
admin.site.register(Orders)
| 23
| 39
| 0.798913
| 27
| 184
| 5.444444
| 0.481481
| 0.183673
| 0.346939
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.103261
| 184
| 8
| 40
| 23
| 0.890909
| 0.141304
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
4f9a4a6f74f2dc443b5ba9c35e99698b42c7cfc1
| 68
|
py
|
Python
|
espnet2/tts/fastspeech3/__init__.py
|
imdanboy/tts_hackaton_2021
|
a7bf848712a2a008e3201d3f2871079fc9c999c5
|
[
"Apache-2.0"
] | 2
|
2022-01-07T14:32:31.000Z
|
2022-01-15T15:31:42.000Z
|
espnet2/tts/fastspeech3/__init__.py
|
imdanboy/tts_hackaton_2021
|
a7bf848712a2a008e3201d3f2871079fc9c999c5
|
[
"Apache-2.0"
] | null | null | null |
espnet2/tts/fastspeech3/__init__.py
|
imdanboy/tts_hackaton_2021
|
a7bf848712a2a008e3201d3f2871079fc9c999c5
|
[
"Apache-2.0"
] | 1
|
2022-01-05T02:09:01.000Z
|
2022-01-05T02:09:01.000Z
|
from espnet2.tts.fastspeech3.fastspeech3 import FastSpeech3 # NOQA
| 34
| 67
| 0.838235
| 8
| 68
| 7.125
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.065574
| 0.102941
| 68
| 1
| 68
| 68
| 0.868852
| 0.058824
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
4f9f9f9f1a52bd27991c39c16f3c5df42388c73f
| 18
|
py
|
Python
|
src/test/data/pa1/AdditionalTestCase/correct_one_assignment_multiple_dest.py
|
Leo-Enrique-Wu/chocopy_compiler_parser
|
b6e94b6a1950407879e921dc379c951ea365f5a4
|
[
"BSD-2-Clause"
] | null | null | null |
src/test/data/pa1/AdditionalTestCase/correct_one_assignment_multiple_dest.py
|
Leo-Enrique-Wu/chocopy_compiler_parser
|
b6e94b6a1950407879e921dc379c951ea365f5a4
|
[
"BSD-2-Clause"
] | null | null | null |
src/test/data/pa1/AdditionalTestCase/correct_one_assignment_multiple_dest.py
|
Leo-Enrique-Wu/chocopy_compiler_parser
|
b6e94b6a1950407879e921dc379c951ea365f5a4
|
[
"BSD-2-Clause"
] | null | null | null |
x = y.f = z[0] = 1
| 18
| 18
| 0.333333
| 6
| 18
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.166667
| 0.333333
| 18
| 1
| 18
| 18
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
4fa3411723a61ccbe1d270a0a497a438e1e4fd04
| 160
|
py
|
Python
|
handlers/__init__.py
|
deven96/face_verify
|
0d5e3db5ea155d27be5dcd9bcda93ccf41b70436
|
[
"MIT"
] | 2
|
2019-01-25T05:15:57.000Z
|
2019-01-25T22:13:52.000Z
|
handlers/__init__.py
|
deven96/face_verify
|
0d5e3db5ea155d27be5dcd9bcda93ccf41b70436
|
[
"MIT"
] | null | null | null |
handlers/__init__.py
|
deven96/face_verify
|
0d5e3db5ea155d27be5dcd9bcda93ccf41b70436
|
[
"MIT"
] | null | null | null |
import os
import sys
from os.path import dirname
sys.path.append(dirname(os.path.realpath(__file__)))
from verify import Verifier
from upload import Uploader
| 17.777778
| 52
| 0.8125
| 25
| 160
| 5.04
| 0.52
| 0.095238
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.11875
| 160
| 9
| 53
| 17.777778
| 0.893617
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.833333
| 0
| 0.833333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
96dcfc86a98c03a152b80fca0f0b9fdac29d95ef
| 49
|
py
|
Python
|
setup.py
|
wpknox/timedoor
|
1282d267847dc9f63a907f6d3c83f0e1bcc5920a
|
[
"MIT"
] | null | null | null |
setup.py
|
wpknox/timedoor
|
1282d267847dc9f63a907f6d3c83f0e1bcc5920a
|
[
"MIT"
] | null | null | null |
setup.py
|
wpknox/timedoor
|
1282d267847dc9f63a907f6d3c83f0e1bcc5920a
|
[
"MIT"
] | null | null | null |
# idk what to do here... will fill out more later
| 49
| 49
| 0.714286
| 10
| 49
| 3.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.204082
| 49
| 1
| 49
| 49
| 0.897436
| 0.959184
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
96eb06ce8f63efdc17033aa267e573db95373c8e
| 88
|
py
|
Python
|
src/modeling/shap_manager/__init__.py
|
NovaSBE-DSKC/retention-evaluation
|
5b68b9282f0b5479a9dc5238faef68067c76b861
|
[
"MIT"
] | null | null | null |
src/modeling/shap_manager/__init__.py
|
NovaSBE-DSKC/retention-evaluation
|
5b68b9282f0b5479a9dc5238faef68067c76b861
|
[
"MIT"
] | null | null | null |
src/modeling/shap_manager/__init__.py
|
NovaSBE-DSKC/retention-evaluation
|
5b68b9282f0b5479a9dc5238faef68067c76b861
|
[
"MIT"
] | null | null | null |
from .meta import get_meta
from .save import *
from .views import *
from .load import *
| 17.6
| 26
| 0.738636
| 14
| 88
| 4.571429
| 0.5
| 0.3125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 88
| 4
| 27
| 22
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
8c17a7e2e09780cd4b4ef4c55fd4983eca58c68f
| 78
|
py
|
Python
|
connectomics/model/__init__.py
|
frommwonderland/pytorch_connectomics
|
95859ec5257d6991ca64782523637f947a8485e2
|
[
"MIT"
] | 99
|
2019-04-22T16:26:05.000Z
|
2022-03-15T18:52:57.000Z
|
connectomics/model/__init__.py
|
frommwonderland/pytorch_connectomics
|
95859ec5257d6991ca64782523637f947a8485e2
|
[
"MIT"
] | 34
|
2019-05-23T16:40:32.000Z
|
2022-03-12T15:41:11.000Z
|
connectomics/model/__init__.py
|
frommwonderland/pytorch_connectomics
|
95859ec5257d6991ca64782523637f947a8485e2
|
[
"MIT"
] | 77
|
2019-05-14T12:15:17.000Z
|
2022-03-04T10:55:04.000Z
|
from .build import build_model, update_state_dict
from .loss import Criterion
| 26
| 49
| 0.846154
| 12
| 78
| 5.25
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115385
| 78
| 2
| 50
| 39
| 0.913043
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
8c413cf438474d74e6a433581f7d45cded1e039d
| 17
|
py
|
Python
|
django_intercom/views.py
|
AnArchkoleptik/django-intercom
|
b552358c5bc1bc8ec606fbb7998a109665f51a87
|
[
"BSD-3-Clause"
] | 35
|
2015-02-09T20:28:38.000Z
|
2021-04-21T08:59:18.000Z
|
django_intercom/views.py
|
AnArchkoleptik/django-intercom
|
b552358c5bc1bc8ec606fbb7998a109665f51a87
|
[
"BSD-3-Clause"
] | 20
|
2016-02-01T19:57:27.000Z
|
2021-06-04T21:35:03.000Z
|
django_intercom/views.py
|
AnArchkoleptik/django-intercom
|
b552358c5bc1bc8ec606fbb7998a109665f51a87
|
[
"BSD-3-Clause"
] | 45
|
2015-01-22T14:10:56.000Z
|
2021-04-21T08:59:23.000Z
|
# no views needed
| 17
| 17
| 0.764706
| 3
| 17
| 4.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.176471
| 17
| 1
| 17
| 17
| 0.928571
| 0.882353
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
8c4332475e62eedb24bd4ff43fd697bb03130f55
| 285
|
py
|
Python
|
home/admin.py
|
JeffreyDrJ/myfirstblog
|
5b1f0fbd6c85027bad7d0e24d67251f41da53fac
|
[
"MIT"
] | null | null | null |
home/admin.py
|
JeffreyDrJ/myfirstblog
|
5b1f0fbd6c85027bad7d0e24d67251f41da53fac
|
[
"MIT"
] | 1
|
2021-05-29T17:09:43.000Z
|
2021-05-29T17:09:43.000Z
|
home/admin.py
|
JeffreyDrJ/myfirstblog
|
5b1f0fbd6c85027bad7d0e24d67251f41da53fac
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
# Register your models here.
# 注册模型以供后台管理:
from home.models import ArticleCategory
from home.models import Article
from home.models import Comment
# 注册模型:
admin.site.register(ArticleCategory)
admin.site.register(Article)
admin.site.register(Comment)
| 21.923077
| 39
| 0.817544
| 38
| 285
| 6.131579
| 0.421053
| 0.103004
| 0.180258
| 0.257511
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 285
| 12
| 40
| 23.75
| 0.913725
| 0.154386
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.571429
| 0
| 0.571429
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
4fb7074dc2154203d4917514507ec4961441bf80
| 189
|
py
|
Python
|
SSH_Homework/ssh_homework/ssh_homework/tictactoe/admin.py
|
MyRookie/TicTacToeAPI
|
43e3aa4b63ad94aa9ee8dc40c8e96998897394b9
|
[
"MIT"
] | 1
|
2021-05-28T21:16:31.000Z
|
2021-05-28T21:16:31.000Z
|
SSH_Homework/ssh_homework/ssh_homework/tictactoe/admin.py
|
MyRookie/TicTacToeAPI
|
43e3aa4b63ad94aa9ee8dc40c8e96998897394b9
|
[
"MIT"
] | null | null | null |
SSH_Homework/ssh_homework/ssh_homework/tictactoe/admin.py
|
MyRookie/TicTacToeAPI
|
43e3aa4b63ad94aa9ee8dc40c8e96998897394b9
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from ssh_homework.tictactoe.models import GamesModel
class GamesModelAdmin(admin.ModelAdmin):
pass
admin.site.register(GamesModel, GamesModelAdmin)
| 18.9
| 52
| 0.825397
| 22
| 189
| 7.045455
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 189
| 10
| 53
| 18.9
| 0.922619
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.2
| 0.4
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
|
0
| 5
|
4fc43206ea976de5fd1673c64650d51905f7c047
| 249
|
py
|
Python
|
p3dpy/__init__.py
|
WillRobotics/p3dpy
|
a607d0840b0871ee3122df7756336316435d0f18
|
[
"MIT"
] | 11
|
2021-05-05T16:02:40.000Z
|
2022-02-02T03:35:29.000Z
|
p3dpy/__init__.py
|
WillRobotics/p3dpy
|
a607d0840b0871ee3122df7756336316435d0f18
|
[
"MIT"
] | 7
|
2021-03-16T14:05:06.000Z
|
2021-06-15T23:08:56.000Z
|
p3dpy/__init__.py
|
WillRobotics/p3dpy
|
a607d0840b0871ee3122df7756336316435d0f18
|
[
"MIT"
] | 1
|
2021-03-29T07:27:15.000Z
|
2021-03-29T07:27:15.000Z
|
from . import (assignment, feature, filter, io, pointcloud, registration,
segmentation)
from .pointcloud import PointCloud
from .rgbdimage import RGBDImage
from .run_vizserver import vizloop, vizspawn
from .vizclient import VizClient
| 35.571429
| 73
| 0.7751
| 27
| 249
| 7.111111
| 0.555556
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.168675
| 249
| 6
| 74
| 41.5
| 0.927536
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.833333
| 0
| 0.833333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
8b27ba31b13f9cc2e6dee79d61537ddf03674f44
| 78
|
py
|
Python
|
scripts/quest/autogen_q32241s.py
|
doriyan13/doristory
|
438caf3b123922da3f5f3b16fcc98a26a8ab85ce
|
[
"MIT"
] | null | null | null |
scripts/quest/autogen_q32241s.py
|
doriyan13/doristory
|
438caf3b123922da3f5f3b16fcc98a26a8ab85ce
|
[
"MIT"
] | null | null | null |
scripts/quest/autogen_q32241s.py
|
doriyan13/doristory
|
438caf3b123922da3f5f3b16fcc98a26a8ab85ce
|
[
"MIT"
] | null | null | null |
# ParentID: 32241
# Character field ID when accessed: 100020000
# ObjectID: 0
| 19.5
| 45
| 0.75641
| 10
| 78
| 5.9
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.230769
| 0.166667
| 78
| 3
| 46
| 26
| 0.676923
| 0.910256
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 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
| 5
|
8c7514f8dfb4cdea3088d05fbe8a109301b6d82e
| 246
|
py
|
Python
|
bool.py
|
codes-by-kiwi/boolean-in-python-
|
5ffc625840bead0dbb6f0f33be11bebc28faca4f
|
[
"MIT"
] | 1
|
2020-04-02T01:31:46.000Z
|
2020-04-02T01:31:46.000Z
|
bool.py
|
codes-by-kiwi/boolean-in-python-
|
5ffc625840bead0dbb6f0f33be11bebc28faca4f
|
[
"MIT"
] | null | null | null |
bool.py
|
codes-by-kiwi/boolean-in-python-
|
5ffc625840bead0dbb6f0f33be11bebc28faca4f
|
[
"MIT"
] | null | null | null |
x = 10
print(x == 2) # prints out false since 10 is not equal to 2
print(x == 3) # prints out False since 10 is not equal to 3
print(x < 3) # prints out false since 10 is not less than 3
print(x>3) # prints out true since 10 is greater than 3
| 41
| 60
| 0.682927
| 53
| 246
| 3.169811
| 0.320755
| 0.142857
| 0.214286
| 0.339286
| 0.738095
| 0.738095
| 0.630952
| 0.630952
| 0.630952
| 0.392857
| 0
| 0.096257
| 0.239837
| 246
| 5
| 61
| 49.2
| 0.802139
| 0.719512
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.8
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
8c82102cbb21a2e0f62e4988e55d1cee3bacdf26
| 70
|
py
|
Python
|
stochman/utilities/__init__.py
|
MachineLearningLifeScience/stochman
|
fd02ab219dcb0a5db5836187ff0f4b0539735f4e
|
[
"Apache-2.0"
] | 25
|
2021-10-21T10:31:30.000Z
|
2022-03-29T12:55:34.000Z
|
stochman/utilities/__init__.py
|
MachineLearningLifeScience/stochman
|
fd02ab219dcb0a5db5836187ff0f4b0539735f4e
|
[
"Apache-2.0"
] | 14
|
2021-10-29T18:40:33.000Z
|
2022-03-17T09:47:20.000Z
|
stochman/utilities/__init__.py
|
MachineLearningLifeScience/stochman
|
fd02ab219dcb0a5db5836187ff0f4b0539735f4e
|
[
"Apache-2.0"
] | 3
|
2021-11-06T00:32:35.000Z
|
2022-03-23T13:05:48.000Z
|
#!/usr/bin/env python
from .distance import squared_manifold_distance
| 23.333333
| 47
| 0.828571
| 10
| 70
| 5.6
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.085714
| 70
| 2
| 48
| 35
| 0.875
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
8c9b225cda03a00f85584306617135c06759b071
| 192
|
py
|
Python
|
auctions/auctions/infrastructure/adapters/dummy_email_gateway.py
|
Enforcer/clean-architecture-example-1
|
a51a2a2a4b8cc38f08305a919b0fa59264a91b20
|
[
"MIT"
] | 34
|
2018-02-02T21:42:09.000Z
|
2022-01-22T20:19:01.000Z
|
auctions/auctions/infrastructure/adapters/dummy_email_gateway.py
|
Enforcer/clean-architecture-example-1
|
a51a2a2a4b8cc38f08305a919b0fa59264a91b20
|
[
"MIT"
] | null | null | null |
auctions/auctions/infrastructure/adapters/dummy_email_gateway.py
|
Enforcer/clean-architecture-example-1
|
a51a2a2a4b8cc38f08305a919b0fa59264a91b20
|
[
"MIT"
] | 10
|
2018-09-18T23:56:59.000Z
|
2020-10-15T15:32:02.000Z
|
from auctions.application.ports import EmailGateway
class DummyEmailGateway(EmailGateway):
def notify_about_winning_auction(self, auction_id: int, winner_id: int) -> None:
pass
| 24
| 84
| 0.770833
| 23
| 192
| 6.217391
| 0.826087
| 0.06993
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15625
| 192
| 7
| 85
| 27.428571
| 0.882716
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0.25
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
8cb43e56767243091a561fdba442490609639f11
| 410
|
py
|
Python
|
user/forms.py
|
TinlokLee/OA
|
ee11343117dcffb28930b6d21c99823c95b8d651
|
[
"MIT"
] | null | null | null |
user/forms.py
|
TinlokLee/OA
|
ee11343117dcffb28930b6d21c99823c95b8d651
|
[
"MIT"
] | null | null | null |
user/forms.py
|
TinlokLee/OA
|
ee11343117dcffb28930b6d21c99823c95b8d651
|
[
"MIT"
] | null | null | null |
from django import forms
__author__ = "Lee"
__date__ = "2018/2/14 0011 19:15"
class LoginForm(forms.Form):
uesrname = forms.CharField(required=True)
password = forms.CharField(required=True, min_length=6)
class RegisterForm(forms.Form):
username = forms.CharField(required=True)
email = forms.EmailField(required=True)
password = forms.CharField(required=True, min_length=6)
| 31.538462
| 60
| 0.721951
| 52
| 410
| 5.5
| 0.538462
| 0.20979
| 0.307692
| 0.363636
| 0.391608
| 0.391608
| 0.391608
| 0.391608
| 0.391608
| 0.391608
| 0
| 0.049708
| 0.165854
| 410
| 13
| 61
| 31.538462
| 0.78655
| 0
| 0
| 0.2
| 0
| 0
| 0.057644
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.2
| 0.1
| 0
| 0.8
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
8ce2910c636a78b2a40a4e2efa9f087bff24b1eb
| 101
|
py
|
Python
|
utils/__init__.py
|
jakobottar/gimondi
|
b6e53036bc09b614ba4c7864f588cd1e1f6c76e0
|
[
"MIT"
] | null | null | null |
utils/__init__.py
|
jakobottar/gimondi
|
b6e53036bc09b614ba4c7864f588cd1e1f6c76e0
|
[
"MIT"
] | null | null | null |
utils/__init__.py
|
jakobottar/gimondi
|
b6e53036bc09b614ba4c7864f588cd1e1f6c76e0
|
[
"MIT"
] | null | null | null |
from .dataloader import SemiSupervisedDataLoader
from .eval import dice_loss, PostProcessing, qScore
| 33.666667
| 51
| 0.861386
| 11
| 101
| 7.818182
| 0.818182
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.09901
| 101
| 2
| 52
| 50.5
| 0.945055
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
507aef9f2afa2867441628d13aff0e023db073d4
| 86
|
py
|
Python
|
alphabot/utils/utils.py
|
djdookie/alphastone
|
2963bb5538d42aeb7789b124496b3ad0c507e2ff
|
[
"Unlicense"
] | 4
|
2019-01-19T05:30:58.000Z
|
2019-06-17T08:43:41.000Z
|
alphabot/utils/utils.py
|
djdookie/alphastone
|
2963bb5538d42aeb7789b124496b3ad0c507e2ff
|
[
"Unlicense"
] | null | null | null |
alphabot/utils/utils.py
|
djdookie/alphastone
|
2963bb5538d42aeb7789b124496b3ad0c507e2ff
|
[
"Unlicense"
] | null | null | null |
# class dotdict(dict):
# def __getattr__(self, name):
# return self[name]
| 21.5
| 34
| 0.604651
| 10
| 86
| 4.8
| 0.8
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.255814
| 86
| 3
| 35
| 28.666667
| 0.75
| 0.918605
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 1
| 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
| 5
|
509018652c5a7d40e8842b1e0ed2cb014063b409
| 31
|
py
|
Python
|
src/foremast/awslambda/s3_event/destroy_s3_event/__init__.py
|
gitter-badger/foremast
|
33530438ba5893a1d5cf822a63e03d7ab49dfcd7
|
[
"Apache-2.0"
] | null | null | null |
src/foremast/awslambda/s3_event/destroy_s3_event/__init__.py
|
gitter-badger/foremast
|
33530438ba5893a1d5cf822a63e03d7ab49dfcd7
|
[
"Apache-2.0"
] | null | null | null |
src/foremast/awslambda/s3_event/destroy_s3_event/__init__.py
|
gitter-badger/foremast
|
33530438ba5893a1d5cf822a63e03d7ab49dfcd7
|
[
"Apache-2.0"
] | null | null | null |
from .destroy_s3_event import *
| 31
| 31
| 0.83871
| 5
| 31
| 4.8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.035714
| 0.096774
| 31
| 1
| 31
| 31
| 0.821429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
50bd30fa354b2e73adbd58ac3a7b5d97f438d07f
| 195
|
py
|
Python
|
__init__.py
|
DavidLSmyth/DroneCoordinatedSearch
|
99173ef63c726049596fb79eda168b4fc3a550a8
|
[
"MIT"
] | 1
|
2018-12-26T04:13:06.000Z
|
2018-12-26T04:13:06.000Z
|
__init__.py
|
DavidLSmyth/DroneCoordinatedSearch
|
99173ef63c726049596fb79eda168b4fc3a550a8
|
[
"MIT"
] | null | null | null |
__init__.py
|
DavidLSmyth/DroneCoordinatedSearch
|
99173ef63c726049596fb79eda168b4fc3a550a8
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 23 21:38:48 2018
@author: 13383861
"""
#from .client import *
from ReinforcementLearning.utils import *
from ReinforcementLearning.types import *
| 17.727273
| 41
| 0.712821
| 25
| 195
| 5.56
| 0.8
| 0.143885
| 0.446043
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.127273
| 0.153846
| 195
| 11
| 42
| 17.727273
| 0.715152
| 0.502564
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
50c9e584220787edf21b969cc53ee536222ea57e
| 55
|
py
|
Python
|
flask_shell2http/__init__.py
|
uday1201/Flask-Shell2HTTP
|
5546a9f007d2a5dd04d578bec823bad654caea94
|
[
"BSD-3-Clause"
] | 1
|
2020-06-28T20:34:34.000Z
|
2020-06-28T20:34:34.000Z
|
flask_shell2http/__init__.py
|
uday1201/Flask-Shell2HTTP
|
5546a9f007d2a5dd04d578bec823bad654caea94
|
[
"BSD-3-Clause"
] | null | null | null |
flask_shell2http/__init__.py
|
uday1201/Flask-Shell2HTTP
|
5546a9f007d2a5dd04d578bec823bad654caea94
|
[
"BSD-3-Clause"
] | null | null | null |
# flake8: noqa
from .base_entrypoint import Shell2HTTP
| 18.333333
| 39
| 0.818182
| 7
| 55
| 6.285714
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.041667
| 0.127273
| 55
| 2
| 40
| 27.5
| 0.875
| 0.218182
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
50cffb22a181880abdcd784f1cbef9cad76f79e7
| 120
|
py
|
Python
|
mmdet/models/backbones/__init__.py
|
zdaxie/SpatiallyAdaptiveInference-Detection
|
323801deac6f0641d00ecb23f6885df8483cc447
|
[
"Apache-2.0"
] | 55
|
2020-08-26T16:30:11.000Z
|
2022-03-08T02:21:36.000Z
|
mmdet/models/backbones/__init__.py
|
zdaxie/SpatiallyAdaptiveInference-Detection
|
323801deac6f0641d00ecb23f6885df8483cc447
|
[
"Apache-2.0"
] | 7
|
2020-10-10T07:10:43.000Z
|
2022-02-10T07:18:31.000Z
|
mmdet/models/backbones/__init__.py
|
zdaxie/SpatiallyAdaptiveInference-Detection
|
323801deac6f0641d00ecb23f6885df8483cc447
|
[
"Apache-2.0"
] | 5
|
2020-09-06T21:48:17.000Z
|
2021-04-19T23:36:57.000Z
|
from .resnet import ResNet, make_res_layer
from .sparse_resnet import SparseResNet
__all__ = ['ResNet', 'SparseResNet']
| 30
| 42
| 0.8
| 15
| 120
| 5.933333
| 0.6
| 0.269663
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.108333
| 120
| 4
| 43
| 30
| 0.831776
| 0
| 0
| 0
| 0
| 0
| 0.14876
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
50df7410824f35aa2af46fb2aea8ad567df9dc63
| 198
|
py
|
Python
|
catalyst/dl/core/__init__.py
|
sergeyshilin/catalyst
|
f4dfaac7bc3fe98b2a0a9cf0b4347b100750f82f
|
[
"Apache-2.0"
] | 3
|
2019-11-02T05:37:06.000Z
|
2020-01-13T02:26:07.000Z
|
catalyst/dl/core/__init__.py
|
sergeyshilin/catalyst
|
f4dfaac7bc3fe98b2a0a9cf0b4347b100750f82f
|
[
"Apache-2.0"
] | null | null | null |
catalyst/dl/core/__init__.py
|
sergeyshilin/catalyst
|
f4dfaac7bc3fe98b2a0a9cf0b4347b100750f82f
|
[
"Apache-2.0"
] | null | null | null |
# flake8: noqa
from .callback import Callback, MetricCallback, MultiMetricCallback, \
CallbackOrder
from .experiment import Experiment
from .runner import Runner
from .state import RunnerState
| 24.75
| 70
| 0.808081
| 21
| 198
| 7.619048
| 0.571429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005882
| 0.141414
| 198
| 7
| 71
| 28.285714
| 0.935294
| 0.060606
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.8
| 0
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
50ed78f4b24485cd732ca742241ce52caf653b28
| 133
|
py
|
Python
|
rover/type-c/screen-service/gccui/__init__.py
|
GamesCreatorsClub/GCC-Rover
|
25a69f62a1bb01fc421924ec39f180f50d6a640b
|
[
"MIT"
] | 3
|
2018-02-13T21:39:55.000Z
|
2018-04-26T18:17:39.000Z
|
rover/type-c/screen-service/gccui/__init__.py
|
GamesCreatorsClub/GCC-Rover
|
25a69f62a1bb01fc421924ec39f180f50d6a640b
|
[
"MIT"
] | null | null | null |
rover/type-c/screen-service/gccui/__init__.py
|
GamesCreatorsClub/GCC-Rover
|
25a69f62a1bb01fc421924ec39f180f50d6a640b
|
[
"MIT"
] | null | null | null |
#
# Copyright 2019 Games Creators Club
#
# MIT License
#
from gccui.components import *
from gccui import FlatTheme, BoxBlueSFTheme
| 14.777778
| 43
| 0.774436
| 16
| 133
| 6.4375
| 0.8125
| 0.174757
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.036036
| 0.165414
| 133
| 9
| 43
| 14.777778
| 0.891892
| 0.345865
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
50f4ee0c4fc628f90a97b07eebc677baaafeaf0b
| 2,347
|
py
|
Python
|
dimod/roof_duality/fix_variables.py
|
pierrelouisp/dimod
|
3db911374825ba211da35a798610b004c54e1c70
|
[
"Apache-2.0"
] | null | null | null |
dimod/roof_duality/fix_variables.py
|
pierrelouisp/dimod
|
3db911374825ba211da35a798610b004c54e1c70
|
[
"Apache-2.0"
] | 24
|
2021-07-09T08:19:47.000Z
|
2022-03-08T08:15:48.000Z
|
dimod/roof_duality/fix_variables.py
|
29rou/dimod
|
ea0426f274241b081a560071fc4eeeb633aa1380
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2018 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ================================================================================================
from dimod.vartypes import Vartype
def fix_variables(bqm, sampling_mode=True):
"""Determine assignments for some variables of a binary quadratic model.
Roof duality finds a lower bound for the minimum of a quadratic polynomial. It
can also find minimizing assignments for some of the polynomial's variables;
these fixed variables take the same values in all optimal solutions [BHT]_ [BH]_.
A quadratic pseudo-Boolean function can be represented as a network to find
the lower bound through network-flow computations. `fix_variables` uses maximum
flow in the implication network to correctly fix variables. Consequently, you can
find an assignment for the remaining variables that attains the optimal value.
Args:
bqm (:obj:`.BinaryQuadraticModel`)
A binary quadratic model.
sampling_mode (bool, optional, default=True):
In sampling mode, only roof-duality is used. When `sampling_mode` is false, strongly
connected components are used to fix more variables, but in some optimal solutions
these variables may take different values.
Returns:
dict: Variable assignments for some variables of the specified binary quadratic model.
.. [BHT] Boros, E., P.L. Hammer, G. Tavares. Preprocessing of Unconstraint Quadratic Binary
Optimization. Rutcor Research Report 10-2006, April, 2006.
.. [BH] Boros, E., P.L. Hammer. Pseudo-Boolean optimization. Discrete Applied Mathematics 123,
(2002), pp. 155-225
"""
# todo: add temporary dependency on dwave-preprocessing
raise NotImplementedError
| 46.019608
| 98
| 0.694504
| 308
| 2,347
| 5.269481
| 0.574675
| 0.036969
| 0.033272
| 0.019717
| 0.052988
| 0
| 0
| 0
| 0
| 0
| 0
| 0.016667
| 0.207499
| 2,347
| 50
| 99
| 46.94
| 0.855914
| 0.896464
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.02
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0
| 0.666667
| 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
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
0fc03b14c9c7c5274d9371268e0e2db2648241a1
| 49
|
py
|
Python
|
python/testData/completion/percentStringWithDictLiteralArg.after.py
|
jnthn/intellij-community
|
8fa7c8a3ace62400c838e0d5926a7be106aa8557
|
[
"Apache-2.0"
] | 2
|
2019-04-28T07:48:50.000Z
|
2020-12-11T14:18:08.000Z
|
python/testData/completion/percentStringWithDictLiteralArg.after.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 173
|
2018-07-05T13:59:39.000Z
|
2018-08-09T01:12:03.000Z
|
python/testData/completion/percentStringWithDictLiteralArg.after.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 2
|
2020-03-15T08:57:37.000Z
|
2020-04-07T04:48:14.000Z
|
"format: %(completion)s" % {"completion": "smth"}
| 49
| 49
| 0.632653
| 5
| 49
| 6.2
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.081633
| 49
| 1
| 49
| 49
| 0.688889
| 0
| 0
| 0
| 0
| 0
| 0.72
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
0fcc91bfd468bb6cd088e813a96ecee1758e1c3e
| 78
|
py
|
Python
|
version_number.py
|
ansasaki/map-checker
|
9618fb28d8a8a4952ed9c013defda011809e4063
|
[
"MIT"
] | 6
|
2019-06-01T12:20:12.000Z
|
2022-03-28T08:30:06.000Z
|
version_number.py
|
ansasaki/map-checker
|
9618fb28d8a8a4952ed9c013defda011809e4063
|
[
"MIT"
] | 38
|
2018-05-02T13:39:46.000Z
|
2018-07-25T13:18:21.000Z
|
version_number.py
|
ansasaki/map-checker
|
9618fb28d8a8a4952ed9c013defda011809e4063
|
[
"MIT"
] | 1
|
2020-12-17T14:43:50.000Z
|
2020-12-17T14:43:50.000Z
|
from version import get_version
if __name__ == "__main__":
get_version()
| 15.6
| 31
| 0.730769
| 10
| 78
| 4.7
| 0.7
| 0.425532
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.179487
| 78
| 4
| 32
| 19.5
| 0.734375
| 0
| 0
| 0
| 0
| 0
| 0.102564
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
0fda3456a410550c67192b2e40c1aa57b7971afc
| 11,072
|
py
|
Python
|
core/pssm2feature.py
|
BILAB/SBRP
|
522c1e03528d50f7b02c9e9bf0f22b8e6df99571
|
[
"MIT"
] | null | null | null |
core/pssm2feature.py
|
BILAB/SBRP
|
522c1e03528d50f7b02c9e9bf0f22b8e6df99571
|
[
"MIT"
] | null | null | null |
core/pssm2feature.py
|
BILAB/SBRP
|
522c1e03528d50f7b02c9e9bf0f22b8e6df99571
|
[
"MIT"
] | null | null | null |
import random
import util
class pssm(object):
def __init__(self,pdbid):
self.pdbid = pdbid
self.pssm = []
def append(self,vec):
if len(vec) != 20:
raise Exception,"pssm.append(): Argument length must be 20. len(vec) == %s" % len(vec)
else:
self.pssm.append(vec)
def parse_pssm(fname):
# parse pssm
"""
>>> {k:v for k,v in parse_pssm(".test.pssm")}
True
"""
prot_pssm = None
with open(fname) as fp:
for rec in (line.strip() for line in iter(fp.readline,"")):
if len(rec) == 0:
continue
if rec[0] == '>':
if prot_pssm is not None:
yield prot_pssm.pdbid,prot_pssm.pssm
prot_pssm = pssm(rec[1:].strip())
else:
try:
prot_pssm.append([float(i) for i in rec.split()])
except Exception:
print rec
print prot_pssm.idch
exit()
yield prot_pssm.pdbid,prot_pssm.pssm
def parse_pssm4pos(fname):
"""
>>> [i for i in parse_pssm4pos(".test.pssm")]
True
"""
# yield idch,start position, sequence
for prot_id,pssm in parse_pssm(fname):
pdbid,ch,start,end = prot_id.split('_')
idch = pdbid + ch
yield idch.replace('_',''),int(start),pssm
def _paste(vec):
out = []
for i in vec:
out+=i
return out
def mkvec(pssm,window,pos):
"""
>>> _pssm = [i for i in parse_pssm4pos(".test.pssm")][0][2]
>>> mkvec(_pssm,10,3)
None
"""
nu = [0]*20
n = pssm[max(0,int(pos - window/2.0)):pos]
c = pssm[pos + 1:min(int(pos + window/2.0) + 1,len(pssm))]
if window%2 == 1:
nu_n = [nu for i in range(int(window/2 - len(n) + 1))]
else:
nu_n = [nu for i in range(int(window/2 - len(n)))]
nu_c = [nu for i in range(int(window/2.0 - len(c)))]
vec = nu_n + n + [pssm[pos]] + c + nu_c
return _paste(vec)
def mkdtst_train(fname,window,answer):
"""
>>> import feature
>>> [i for i in mkdtst_train('.test.pssm',10,answer='.answer.test')]
None
"""
# only binding site For make positive dataet
ans_sgr = util.ans(answer)
# ans2int is function that return +1 if True else return -1
ans2int = lambda idch,pos: 1 if ans_sgr.isans(idch,pos) else -1
for idch,start,pssm in parse_pssm4pos(fname):
idch = idch.strip()
# 2012/1/31 pos -> pos + start
# !!! now nodyfying !!!
yield idch,{pos:(ans2int(idch,start + pos),mkvec(pssm,window,pos))
for pos in range(len(pssm)) if ans_sgr.isans(idch,start + pos)}
def mkdtst_test(fname,window,answer):
# For test
"""
>>> [i for i in mkdtst_test('.test.pssm',10,answer='./.answer.test')]
None
"""
if answer is not None:
ans_sgr = util.ans(answer)
ans2int = lambda idch,pos: 1 if ans_sgr.isans(idch,pos) else -1
for idch,start,pssm in parse_pssm4pos(fname):
idch = idch.strip()
# 2012/1/31 pos -> pos + start
# !!! now nodyfying !!!
yield idch,{pos:(ans2int(idch,start + pos),mkvec(pssm,window,pos))
for pos in range(len(pssm))}
else:
# For negative dataset
for idch,pssm in parse_pssm(fname):
idch = idch.strip()
yield idch,{pos:(-1,mkvec(pssm,window,pos)) for pos in range(len(pssm))}
def mkneg_train(fname,window,size = 8):
"""
>>> import feature
>>> [i for i in mkneg_train('.test.pssm',10)]
None
"""
# To Dataset randomly choiced positions
for negid,pssm in parse_pssm(fname):
_indx = [i for i in range(1,len(pssm))]
random.shuffle(_indx)
yield negid,{pos:(-1,mkvec(pssm,window,pos)) for pos in sorted(_indx[:size])}
def mkneg_train2(fname,window,size = 8):
# For one class SVM
"""
>>> import feature
>>> [i for i in mkneg_train('.test.pssm',10)]
None
"""
# To Dataset randomly choiced positions
for negid,pssm in parse_pssm(fname):
_indx = [i for i in range(1,len(pssm))]
random.shuffle(_indx)
yield negid,[mkvec(pssm,window,pos) for pos in sorted(_indx[:size])]
def mkneg_test(fname,window):
# For test
"""
>>> import feature
>>> [i for i in mkneg_test('.test.pssm',10)]
None
"""
# to Dataset whole seqence
for negid,pssm in parse_pssm(fname):
yield negid,{pos:(-1,mkvec(pssm,window,pos)) for pos in range(len(pssm))}
def mkdtst_near(fname,window,answer,low,up):
# For test
"""
>>> [i for i in mkdtst_test('.test.pssm',10,answer='./.answer.test')]
None
"""
ans_sgr = util.ans(answer)
ans2int = lambda idch,pos: 1 if ans_sgr.isans(idch,pos) else -1
for idch,start,pssm in parse_pssm4pos(fname):
idch = idch.strip()
# 2012/1/31 pos -> pos + start
# !!! now nodyfying !!!
yield idch,{pos:(ans2int(idch,start + pos),mkvec(pssm,window,pos))
for pos in range(len(pssm)) if low <= ans_sgr.get_dist(pos + start,idch) <= up
or ans_sgr.isans(idch,start + pos)}
def mkdtst_near4svr(fname,window,answer,low,up):
# For test
"""
>>> [i for i in mkdtst_test('.test.pssm',10,answer='./.answer.test')]
None
"""
ans_sgr = util.ans(answer)
for idch,start,pssm in parse_pssm4pos(fname):
idch = idch.strip()
# 2012/1/31 pos -> pos + start
# !!! now nodyfying !!!
yield idch,{pos:(ans_sgr.get_dist(start + pos,idch),mkvec(pssm,window,pos))
for pos in range(len(pssm)) if low <= ans_sgr.get_dist(pos + start,idch) <= up
or ans_sgr.isans(idch,start + pos)}
def mkdtst_test4svr(fname,window,answer):
# For test
"""
>>> [i for i in mkdtst_test('.test.pssm',10,answer='./.answer.test')]
None
"""
ans_sgr = util.ans(answer)
for idch,start,pssm in parse_pssm4pos(fname):
idch = idch.strip()
# 2012/1/31 pos -> pos + start
# !!! now nodyfying !!!
yield idch,{pos:(ans_sgr.get_dist(start + pos,idch),mkvec(pssm,window,pos)) for pos in range(len(pssm)) }
def mkdtst(fname,window):
"""
>>> import feature
>>> [i for i in mkdtst_train('.test.pssm',10,answer='.answer.test')]
None
"""
for pdbid,pssm in parse_pssm(fname):
pdbid = pdbid.strip()
# 2012/1/31 pos -> pos + start
# !!! now nodyfying !!!
yield pdbid,{pos:(-1,mkvec(pssm,window,pos)) for pos in range(len(pssm))}
class dataset(object):
# Interface between dataset and libsvm
def __init__(self,ppssm,npssm,answer,window):
# pdata is data source of positive dataset
self._ppssm = ppssm
# ndata is data sourcde of negative dataset.
self._npssm = npssm
# answer is description of position of binding residue
self._ans = answer
# list of id in postive dataset
self.pids = [idch for idch,start,pssm in parse_pssm4pos(ppssm)]
# list of id in negative dataset
self.nids = [idch.strip(".fasta.ckp") for idch,pssm in parse_pssm(npssm)]
self._window = window
def mkTest(self,part_pids,part_nids):
pdatasets = {idch:pvec for idch,pvec in mkdtst_test(self._ppssm,self._window,answer = self._ans) if idch in part_pids}
ndatasets = {idch:pvec for idch,pvec in mkneg_test(self._npssm,self._window) if idch in part_nids}
pdatasets.update(ndatasets)
return pdatasets.items()
def mkTrain(self,part_pids,part_nids,size = 5):
"""
>>> d = dataset(".test.pssm",".test.pssm",".answer.test",10)
>>> d.mkTrain(['148lE'],['1af6_A_1_421'])
None
"""
pdatasets = {idch:pvec for idch,pvec in mkdtst_train(self._ppssm,self._window,answer = self._ans) if idch in part_pids}
ndatasets = {idch:pvec for idch,pvec in mkneg_train(self._npssm,self._window,size = size) if idch in part_nids}
pdatasets.update(ndatasets)
return pdatasets.items()
class dataset2(object):
def __init__(self,pssm,answer,window,low = 5,up = 25):
# pdata is data source of positive dataset
self._ppssm = pssm
# answer is description of position of binding residue
self._ans = answer
self._low = low
self._up = up
# list of id in postive dataset
self.pids = [idch for idch,start,pssm in parse_pssm4pos(pssm)]
self._window = window
def mkTest(self,part_ids):
pdatasets = {idch:pvec for idch,pvec in mkdtst_test(self._ppssm,self._window,answer = self._ans) if idch in part_ids}
return pdatasets.items()
def mkTrain(self,part_ids):
# negative dataset are generate if low <= distance <= up from binding residue in dataset.
"""
>>> d = dataset(".test.pssm",".test.pssm",".answer.test",10)
>>> d.mkTrain(['148lE'],['1af6_A_1_421'])
None
"""
pdatasets = {idch:pvec for idch,pvec in mkdtst_near(self._ppssm,self._window,answer = self._ans,low = self._low,up = self._up) if idch in part_ids}
return pdatasets.items()
class dataset3(dataset2):
# For Test dataset whose answer position is Unkonown
def __init__(self,pssm,window,answer,flg_predict = False):
# pdata is data source of positive dataset
self._ppssm = pssm
# list of id in postive dataset
if not flg_predict:
self.pids = [idch for idch,start,pssm in parse_pssm4pos(pssm)]
#self.pids = [idch.strip(".fasta.ckp") for idch,pssm in parse_pssm(pssm)]
self._ans = answer
else:
# For not formated Fasta : > pdbid_start_end
self.pids = [idch for idch,pssm in parse_pssm(pssm)]
self._ans = None
self._window = window
def mkTest(self,part_ids):
"""
>>> d = dataset3(".test.pssm",8,".answer.test")
>>> d.mkTest(['148lE'])
None
"""
pdatasets = {idch:pvec for idch,pvec in mkdtst_test(self._ppssm,self._window,self._ans) if idch in part_ids}
return pdatasets.items()
def ToPredict(self):
"""
>>> d = dataset3(".test.pssm",8,".answer.test")
>>> d.mkTest(['148lE'])
None
"""
pdatasets = {idch:pvec for idch,pvec in mkdtst(self._ppssm,self._window)}
return pdatasets.items()
class dataset4(object):
# For One class SVM
def __init__(self,pssm,window):
# pdata is data source of positive dataset
self._ppssm = pssm
self.pids = [idch for idch,pssm in parse_pssm(pssm)]
#self.pids = [idch.strip(".fasta.ckp") for idch,pssm in parse_pssm(pssm)]
self._window = window
def mkTrain(self,part_ids):
"""
>>> d = dataset3(".test.pssm",8,".answer.test")
>>> d.mkTest(['148lE'])
None
"""
if part_ids is None:
part_ids = self.pids
return [pvec for idch,pvec in mkneg_train2(self._ppssm,self._window) if idch in part_ids]
def mkTest(self,part_ids):
"""
>>> d = dataset3(".test.pssm",8,".answer.test")
>>> d.mkTest(['148lE'])
None
"""
if part_ids is None:
part_ids = self.pids
return {idch:pvec for idch,pvec in mkneg_test(self._ppssm,self._window) if idch in part_ids}.items()
class dataset5(object):
def __init__(self,pssm,answer,window,low = 5,up = 25):
# pdata is data source of positive dataset
self._ppssm = pssm
# answer is description of position of binding residue
self._ans = answer
self._low = low
self._up = up
# list of id in postive dataset
self.pids = [idch for idch,start,pssm in parse_pssm4pos(pssm)]
self._window = window
def mkTest(self,part_ids):
pdatasets = {idch:pvec for idch,pvec in mkdtst_test4svr(self._ppssm,self._window,answer = self._ans) if idch in part_ids}
return pdatasets.items()
def mkTrain(self,part_ids):
# negative dataset are generate if low <= distance <= up from binding residue in dataset.
"""
>>> d = dataset(".test.pssm",".test.pssm",".answer.test",10)
>>> d.mkTrain(['148lE'],['1af6_A_1_421'])
None
"""
pdatasets = {idch:pvec for idch,pvec in mkdtst_near4svr(self._ppssm,self._window,answer = self._ans,low = self._low,up = self._up) if idch in part_ids}
return pdatasets.items()
if __name__ == "__main__":
import doctest
doctest.testmod()
| 29.525333
| 153
| 0.670972
| 1,770
| 11,072
| 4.069492
| 0.102825
| 0.026239
| 0.030543
| 0.013605
| 0.776482
| 0.760516
| 0.735943
| 0.713175
| 0.695544
| 0.679994
| 0
| 0.021295
| 0.172959
| 11,072
| 374
| 154
| 29.604278
| 0.765316
| 0.15056
| 0
| 0.461957
| 0
| 0
| 0.010251
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.016304
| null | null | 0.01087
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
0ffed6e1e67f2ee99a122097da48000965ee87dc
| 141
|
py
|
Python
|
irctokens/__init__.py
|
A-UNDERSCORE-D/irctokens
|
14d38192cfcb9b38a44da127805dff76493fd84b
|
[
"MIT"
] | 19
|
2020-03-11T13:51:25.000Z
|
2022-03-26T12:43:11.000Z
|
irctokens/__init__.py
|
A-UNDERSCORE-D/irctokens
|
14d38192cfcb9b38a44da127805dff76493fd84b
|
[
"MIT"
] | 4
|
2020-03-11T22:59:44.000Z
|
2022-01-30T18:15:24.000Z
|
irctokens/__init__.py
|
A-UNDERSCORE-D/irctokens
|
14d38192cfcb9b38a44da127805dff76493fd84b
|
[
"MIT"
] | 7
|
2020-03-11T16:51:19.000Z
|
2022-01-29T18:57:04.000Z
|
from .line import Line, build, tokenise
from .hostmask import Hostmask, hostmask
from .stateful import StatefulDecoder, StatefulEncoder
| 28.2
| 54
| 0.801418
| 16
| 141
| 7.0625
| 0.5625
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.148936
| 141
| 4
| 55
| 35.25
| 0.941667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
2cdef5121fc41ae309d6baf2334cb1770650ab00
| 103
|
py
|
Python
|
src/backend/door_api/models/__init__.py
|
xinkecf35/Door_Unlock_Web_GUI
|
3aa2b00c51db525bd0c6fbdc1f3ad3d6fafcdc13
|
[
"MIT"
] | 1
|
2021-09-22T18:08:53.000Z
|
2021-09-22T18:08:53.000Z
|
src/backend/door_api/models/__init__.py
|
xinkecf35/Door_Unlock_Web_GUI
|
3aa2b00c51db525bd0c6fbdc1f3ad3d6fafcdc13
|
[
"MIT"
] | 10
|
2021-03-09T16:03:35.000Z
|
2022-02-18T08:40:39.000Z
|
src/backend/door_api/models/__init__.py
|
Pitt-RAS/Door_Unlock_Web_GUI
|
3aa2b00c51db525bd0c6fbdc1f3ad3d6fafcdc13
|
[
"MIT"
] | null | null | null |
from .UserSchema import UserSchema
from .RoleSchema import RoleSchema
from .JWTSchema import JWTSchema
| 25.75
| 34
| 0.854369
| 12
| 103
| 7.333333
| 0.416667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116505
| 103
| 3
| 35
| 34.333333
| 0.967033
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
2ceee3efae543f5089fc7457f7785d54c680c99f
| 80
|
py
|
Python
|
tasks/finger_tapping_task/utils/__init__.py
|
eduongAZ/tomcat-baseline-tasks
|
a913962d1bb19531e734bfe780b2a8b400224741
|
[
"MIT"
] | 1
|
2022-01-23T19:29:57.000Z
|
2022-01-23T19:29:57.000Z
|
tasks/finger_tapping_task/utils/__init__.py
|
eduongAZ/tomcat-baseline-tasks
|
a913962d1bb19531e734bfe780b2a8b400224741
|
[
"MIT"
] | 34
|
2022-01-18T18:26:15.000Z
|
2022-03-31T19:21:28.000Z
|
tasks/finger_tapping_task/utils/__init__.py
|
eduongAZ/tomcat-baseline-tasks
|
a913962d1bb19531e734bfe780b2a8b400224741
|
[
"MIT"
] | 2
|
2022-01-27T05:31:33.000Z
|
2022-03-29T20:57:23.000Z
|
from .constants import TAPPED, UNTAPPED
from .player_square import PlayerSquare
| 26.666667
| 39
| 0.85
| 10
| 80
| 6.7
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1125
| 80
| 2
| 40
| 40
| 0.943662
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
fa50e328a10c267afe23d7192b05c4acd2f34fb2
| 99,756
|
py
|
Python
|
aospy_user/variables.py
|
spencerahill/aospy-obj-lib
|
76803806e8c6b0042c901735eed1c88042d4e4ed
|
[
"Apache-2.0"
] | 3
|
2015-10-27T19:32:17.000Z
|
2021-05-07T12:41:30.000Z
|
aospy_user/variables.py
|
spencerahill/aospy-obj-lib
|
76803806e8c6b0042c901735eed1c88042d4e4ed
|
[
"Apache-2.0"
] | 11
|
2015-09-25T15:45:59.000Z
|
2020-03-31T13:50:29.000Z
|
aospy_user/variables.py
|
spencerahill/aospy-obj-lib
|
76803806e8c6b0042c901735eed1c88042d4e4ed
|
[
"Apache-2.0"
] | null | null | null |
"""Collection of aospy.Var objects for use in my research."""
from aospy.constants import r_e
from aospy.var import Var
from . import calcs, units
# Define pressure, pressure thickness, and their dependencies first.
p = Var(
name='p',
units=units.Pa,
domain='atmos',
description='Pressure of model half levels.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
ps = Var(
name='ps',
alt_names=['PS'],
units=units.Pa,
domain='atmos',
description='Surface pressure.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
bk = Var(
name='bk',
alt_names=['hybi'],
units=units.Pa,
domain='atmos_level',
description='Sigma part of hybrid sigma coordinate.',
def_time=False,
def_vert=True,
def_lat=False,
def_lon=False,
)
pk = Var(
name='pk',
units=units.Pa,
domain='atmos_level',
description='Pressure part of hybrid sigma coordinate.',
def_time=False,
def_vert=True,
def_lat=False,
def_lon=False,
)
temp = Var(
name='temp',
alt_names=('ta', 'T'),
units=units.K,
domain='atmos',
description='Air temperature.',
def_time=True,
def_vert='pfull',
def_lat=True,
def_lon=True,
)
dp = Var(
name='dp',
domain='atmos',
description=('Pressure thickness of model levels. For data interpolated '
'to uniform pressure levels, this does not vary in time or '
'space. For data on model native coordinates, this varies '
'in space and time due to the spatiotemporal variations in '
'surface pressure.'),
# Last arg is just dummy variable from which to get the pfull coordinate.
variables=(ps, bk, pk, temp),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.dp,
units=units.Pa,
)
# All other variables.
alb_sfc = Var(
name='alb_sfc',
units=units.unitless,
domain='atmos',
description='Surface albedo.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
cld_amt = Var(
name='cld_amt',
alt_names=('cl',),
units=units.unitless,
domain='atmos',
description='Cloud fraction at each level.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
divg = Var(
name='divg',
math_str=r"\nabla\cdot\vec{v}",
units=units.s1,
domain='atmos',
description='Divergence.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
colormap='RdBu'
)
esf = Var(
name='esf',
units=units.kg_s1,
domain='atmos',
description='Eddy streamfunction',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
evap = Var(
name='evap',
alt_names=('ET_mean', 'evspsbl'),
math_str=r"$E$",
units=units.kg_m2_s1,
domain='atmos',
description='Surface evaporation',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
high_cld_amt = Var(
name='high_cld_amt',
units=units.unitless,
domain='atmos',
description='High cloud fraction.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
iwp = Var(
name='IWP',
alt_names=('iwp',),
units=units.kg_m2,
domain='atmos',
description='Ice water path',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
lai = Var(
name='lai',
alt_names=('LAI',),
units=units.unitless,
domain='land',
description='Leaf area index.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
low_cld_amt = Var(
name='low_cld_amt',
units=units.unitless,
domain='atmos',
description='Low cloud fraction.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
lwdn_sfc = Var(
name='lwdn_sfc',
alt_names=('rlds',),
math_str="$R^{LW\downarrow_{sfc}$",
description='All-sky downwelling longwave radiation at the surface.',
domain='atmos',
units=units.W_m2,
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
lwdn_sfc_clr = Var(
name='lwdn_sfc_clr',
alt_names=('rldscs',),
units=units.W_m2,
domain='atmos',
description='Clear-sky downwelling longwave radiation at the surface.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
lwp = Var(
name='LWP',
alt_names=('lwp',),
units=units.kg_m2,
domain='atmos',
description='Liquid water path',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
lwup_sfc = Var(
name='lwup_sfc',
alt_names=('rlus',),
units=units.W_m2,
domain='atmos',
description='All-sky upwelling longwave radiation at the surface.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
lwup_sfc_clr = Var(
name='lwup_sfc_clr',
alt_names=('rluscs',),
units=units.W_m2,
domain='atmos',
description='Clear-sky upwelling longwave radiation at the surface.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
hght = Var(
name='hght',
alt_names=('zg', 'Z3'),
units=units.m,
domain='atmos',
description='Geopotential height.',
def_time=True,
def_vert='phalf',
def_lat=True,
def_lon=True,
)
ice_mask = Var(
name='ice_mask',
units=units.unitless,
domain='atmos',
description='Ice mask.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
ice_wat = Var(
name='ice_wat',
units=units.specific_mass,
domain='atmos',
description='Cloud ice water specific humidity.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
liq_wat = Var(
name='liq_wat',
units=units.specific_mass,
domain='atmos',
description='Cloud liquid water specific humidity.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
mc = Var(
name='mc',
units=units.kg_m2_s1_mass,
domain='atmos',
description='Convective mass flux.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
mc_full = Var(
name='mc_full',
units=units.kg_m2_s1_mass,
domain='atmos',
description='Convective mass flux at full levels.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
mc_half = Var(
name='mc_half',
units=units.kg_m2_s1_mass,
domain='atmos',
description='Convective mass flux at half levels.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
mid_cld_amt = Var(
name='mid_cld_amt',
units=units.unitless,
domain='atmos',
description='Mid-level cloud fraction.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
olr = Var(
name='olr',
alt_names=('rlut',),
units=units.W_m2,
domain='atmos',
description='All-sky outgoing longwave radiation at TOA.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
olr_clr = Var(
name='olr_clr',
alt_names=('rlutcs',),
units=units.W_m2,
domain='atmos',
description='Clear-sky outgoing longwave radiation at TOA.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
omega = Var(
name='omega',
alt_names=('wap',),
units=units.Pa_s1,
domain='atmos',
description='Pressure vertical velocity.',
def_time=True,
def_vert='pfull',
def_lat=True,
def_lon=True,
)
precip = Var(
name='precip',
alt_names=('pr', 'PRECT', 'pre'),
units=units.kg_m2_s1,
domain='atmos',
description='Liquid precipitation reaching surface.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
colormap='BrBG'
)
prec_conv = Var(
name='prec_conv',
alt_names=('prc',),
units=units.kg_m2_s1,
domain='atmos',
description='Liquid precip reaching surface from convection scheme.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
colormap='BrBG'
)
prec_ls = Var(
name='prec_ls',
units=units.kg_m2_s1,
domain='atmos',
description='Liquid precip reaching surface from large scale ascent.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
colormap='BrBG'
)
pv = Var(
name='pv',
units=units.s1,
domain='atmos',
description='Potential vorticity',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
qdt_conv = Var(
name='qdt_conv',
units=units.s1_spec_mass,
domain='atmos',
description='Moisture tendency from convective parameterization.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
qdt_ls = Var(
name='qdt_ls',
units=units.s1_spec_mass,
domain='atmos',
description='Moisture tendency from large-scale condensation.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
qdt_vdif = Var(
name='qdt_vdif',
units=units.s1_spec_mass,
domain='atmos',
description='Moisture tendency from vertical diffusion.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
rh = Var(
name='rh',
alt_names=('hur',),
units=units.unitless,
domain='atmos',
description='Relative humidity',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
rh_ref = Var(
name='rh_ref',
units=units.unitless,
domain='atmos',
description='Relative humidity at 2m above surface',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
shflx = Var(
name='shflx',
alt_names=('hfss',),
units=units.W_m2,
domain='atmos',
description='Surface sensible heat flux into the atmosphere.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
slp = Var(
name='slp',
alt_names=('psl',),
units=units.hPa,
domain='atmos',
description='Sea level pressure.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
snow_conv = Var(
name='snow_conv',
units=units.kg_m2_s1,
domain='atmos',
description='Snow reaching surface from convection scheme.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
snow_ls = Var(
name='snow_ls',
units=units.kg_m2_s1,
domain='atmos',
description='Snow reaching surface from large scale ascent.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
soil_liq = Var(
name='soil_liq',
units=units.kg_m2,
domain='land',
description='Soil liquid in each level of land model',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
soil_moisture = Var(
name='soil_moisture',
alt_names=('water', 'water_soil',),
units=units.kg_m2,
domain='land',
description='Mass of water in land bucket',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
sphum = Var(
name='sphum',
alt_names=('hus', 'Q'),
units=units.specific_mass,
domain='atmos',
description='Specific humidity.',
def_time=True,
def_vert='pfull',
def_lat=True,
def_lon=True,
colormap='Greys'
)
sst = Var(
name='sst',
alt_names=('ts', 'SST'),
units=units.K,
domain='ocean',
description='Sea surface temperature.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
swdn_sfc = Var(
name='swdn_sfc',
alt_names=('rsds',),
units=units.W_m2,
domain='atmos',
description='All-sky downwelling shortwave radiation at the surface.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
swdn_sfc_clr = Var(
name='swdn_sfc_clr',
alt_names=('rsdscs',),
units=units.W_m2,
domain='atmos',
description='Clear-sky downwelling shortwave radiation at the surface.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
swup_sfc = Var(
name='swup_sfc',
alt_names=('rsus',),
units=units.W_m2,
domain='atmos',
description='All-sky upwelling shortwave radiation at the surface.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
swup_sfc_clr = Var(
name='swup_sfc_clr',
alt_names=('rsuscs',),
units=units.W_m2,
domain='atmos',
description='Clear-sky upwelling shortwave radiation at the surface.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
swdn_toa = Var(
name='swdn_toa',
alt_names=('rsdt',),
units=units.W_m2,
domain='atmos',
description='Downwelling shortwave radiation at TOA.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
swdn_toa_clr = Var(
name='swdn_toa_clr',
alt_names=('rsdtcs',),
units=units.W_m2,
domain='atmos',
description='Downwelling shortwave radiation at TOA.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
swup_toa = Var(
name='swup_toa',
alt_names=('rsut',),
units=units.W_m2,
domain='atmos',
description='All-sky Upwelling shortwave radiation at TOA.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
swup_toa_clr = Var(
name='swup_toa_clr',
alt_names=('rsutcs',),
units=units.W_m2,
domain='atmos',
description='Clear-sky upwelling shortwave radiation at TOA.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
t_surf = Var(
name='t_surf',
alt_names=('tas', 'TS', 'tmp'),
units=units.K,
domain='atmos',
description='Surface air temperature.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
tdt_conv = Var(
name='tdt_conv',
units=units.K_s1,
domain='atmos',
description='Convective heating rate.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
valid_range=(-20, 20)
)
tdt_ls = Var(
name='tdt_ls',
units=units.K_s1,
domain='atmos',
description='Large-scale heating rate.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
tdt_lw = Var(
name='tdt_lw',
units=units.K_s1,
domain='atmos',
description='All-sky longwave heating rate.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
tdt_lw_clr = Var(
name='tdt_lw_clr',
units=units.K_s1,
domain='atmos',
description='Clear-sky longwave heating rate.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
tdt_sw = Var(
name='tdt_sw',
units=units.K_s1,
domain='atmos',
description='All-sky shortwave heating rate.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
tdt_sw_clr = Var(
name='tdt_sw_clr',
units=units.K_s1,
domain='atmos',
description='Clear-sky shortwave heating rate.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
tdt_vdif = Var(
name='tdt_vdif',
units=units.K_s1,
domain='atmos',
description='Temperature tendency from vertical diffusion.',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
tot_cld_amt = Var(
name='tot_cld_amt',
alt_names=('clt',),
units=units.unitless,
domain='atmos',
description='Total cloud fraction.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
ucomp = Var(
name='ucomp',
alt_names=('ua', 'U'),
units=units.m_s1,
domain='atmos',
description='Eastward velocity.',
def_time=True,
def_vert='pfull',
def_lat=True,
def_lon=True,
)
u_ref = Var(
name='u_ref',
units=units.m_s1,
domain='atmos',
description='Eastward velocity at 2 meters above ground.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
vcomp = Var(
name='vcomp',
alt_names=('va', 'V'),
units=units.m_s1,
domain='atmos',
description='Northward velocity.',
def_time=True,
def_vert='pfull',
def_lat=True,
def_lon=True,
)
v_ref = Var(
name='v_ref',
units=units.m_s1,
domain='atmos',
description='Northward velocity at 2 meters above ground.',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
)
vort = Var(
name='vort',
units=units.s1_vort,
domain='atmos',
description='Vorticity',
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
)
wvp = Var(
name='WVP',
alt_names=('wvp', 'prw'),
units=units.kg_m2,
domain='atmos',
description='Water vapor path',
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
colormap='Greys'
)
# Grid variables.
land_mask = Var(
name='land_mask',
alt_names=['sftlf'],
units=units.unitless,
description='Land mask',
def_time=False,
def_vert=True,
def_lat=True,
def_lon=False,
)
lat = Var(
name='lat',
units=units.latlon,
description='Latitude',
def_time=False,
def_vert=False,
def_lat=True,
def_lon=False,
)
lon = Var(
name='lon',
units=units.latlon,
description='Longitude.',
def_time=False,
def_vert=False,
def_lat=False,
def_lon=True,
)
level = Var(
name='level',
units=units.hPa,
domain='atmos',
description='Pressure level for data interpolated to uniform pressures.',
def_time=False,
def_vert=True,
def_lat=False,
def_lon=False,
)
pfull = Var(
name='pfull',
alt_names=['lev'],
units=units.hPa,
domain='atmos_level',
description=('Reference pressure of model native coordinate full levels. '
'Importantly, NOT the actual value at a particular lat, lon, '
'or time, which depends on the spatiotemporally varying '
'surface pressure.'),
def_time=False,
def_vert=True,
def_lat=False,
def_lon=False,
)
phalf = Var(
name='phalf',
alt_names=['ilev'],
units=units.hPa,
domain='atmos_level',
description=('Reference pressure of model native coordinate half levels. '
'Importantly, NOT the actual value at a particular lat, lon, '
'or time, which depends on the spatiotemporally varying '
'surface pressure.'),
def_time=False,
def_vert=True,
def_lat=False,
def_lon=False,
)
sfc_area = Var(
name='sfc_area',
alt_names=['areacella'],
units=units.m2,
domain=None,
description='Grid surface area.',
def_time=False,
def_vert=False,
def_lat=True,
def_lon=True,
)
zsurf = Var(
name='zsurf',
units=units.m,
domain=None,
description='Surface elevation.',
def_time=False,
def_vert=False,
def_lat=True,
def_lon=True,
)
# Calculations involving one or more model-native variables.
aht = Var(
name='aht',
domain='atmos',
description='Total northward atmospheric heat transport.',
variables=(swdn_toa, swup_toa, olr, swup_sfc, swdn_sfc, lwup_sfc,
lwdn_sfc, shflx, evap, snow_ls, snow_conv, sfc_area),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=False,
func=calcs.aht,
units=units.W
)
albedo = Var(
name='albedo',
domain='atmos',
description=('Column albedo: fraction of incoming SW at TOA reflected '
'back to space.'),
variables=(swdn_toa, swup_toa),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.albedo,
units=units.unitless
)
ang_mom = Var(
name='ang_mom',
domain='atmos',
description='Angular momentum per unit mass.',
variables=(ucomp),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.ang_mom,
units=units.unitless
)
bowen_ratio = Var(
name='bowen_ratio',
domain='atmos',
description='Bowen Ratio: ratio of surface sensible to latent heat flux',
variables=(shflx, evap),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.bowen_ratio,
units=units.unitless
)
column_energy = Var(
name='column_energy',
math_str=r'$F_\mathrm{net}$',
domain='atmos',
description='Net energy flux into atmosphere at surface and at TOA.',
variables=(swdn_toa, swup_toa, olr, swup_sfc, swdn_sfc,
lwup_sfc, lwdn_sfc, shflx, evap),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.column_energy,
units=units.W_m2,
)
column_lw = Var(
name='column_lw',
domain='atmos',
description='Net LW flux into atmosphere from surface and TOA.',
variables=(olr, lwup_sfc, lwdn_sfc),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.column_lw,
units=units.W_m2,
)
column_sw = Var(
name='column_sw',
domain='atmos',
description='Net SW flux into atmosphere from surface and TOA.',
variables=(swdn_toa, swup_toa, swup_sfc, swdn_sfc),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.column_sw,
units=units.W_m2,
)
cre_lw = Var(
name='cre_lw',
domain='atmos',
description='Cloudy-sky outgoing longwave radiation at TOA.',
variables=(olr, olr_clr),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.cre_lw,
units=units.W_m2
)
cre_net = Var(
name='cre_net',
domain='atmos',
description='Net cloudy-sky top-of-atmosphere radiative flux, signed positive downwards.',
variables=(swup_toa, olr, swup_toa_clr, olr_clr),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.cre_net,
units=units.W_m2
)
cre_sw = Var(
name='cre_sw',
domain='atmos',
description='Net cloudy-sky top-of-atmosphere shortwave radiative flux, signed positive downwards.',
variables=(swup_toa, swup_toa_clr),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.cre_sw,
units=units.W_m2
)
divg_3d = Var(
name='divg_3d',
domain='atmos',
description='3-d divergence',
variables=(ucomp, vcomp, omega, r_e, p),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.divg_3d,
units=units.s1
)
divg_mass_bal = Var(
name='divg_mass_bal',
domain='atmos',
description=('Horizontal divergence, adjusted to exact mass balance in '
'each column integral.'),
variables=(divg, dp),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.field_vert_int_bal,
units=units.s1
)
dry_static_stab = Var(
name='dry_static_stab',
domain='atmos',
description=('Local upper minus lower level DSE for fixed lower level and '
'varying upper level over all levels.'),
variables=(temp, hght, p),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.dry_static_stab,
units=units.K
)
dse = Var(
name='dse',
domain='atmos',
description='Dry static energy.',
variables=(temp, hght),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.dse,
units=units.J_kg1
)
dse_horiz_advec = Var(
name='dse_horiz_advec',
domain='atmos',
description='Horizontal advection of dry static energy.',
variables=(temp, hght, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.dse_horiz_advec,
units=units.J_kg1_s1
)
dse_times_horiz_divg = Var(
name='dse_times_horiz_divg',
domain='atmos',
description='Horizontal mass flux divergence times dry static energy.',
variables=(temp, hght, ucomp, vcomp, r_e, dp),
def_time=True,
def_vert='pfull',
def_lat=True,
def_lon=True,
func=calcs.dse_times_horiz_divg,
units=units.J_kg1_s1
)
dse_horiz_flux_divg = Var(
name='dse_horiz_flux_divg',
domain='atmos',
description='Horizontal flux divergence of dry static energy.',
variables=(temp, hght, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.dse_horiz_flux_divg,
units=units.J_kg1_s1
)
dse_horiz_advec_divg_sum = Var(
name='dse_horiz_advec_divg_sum',
domain='atmos',
description='Sum of DSE horizontal divergence and advection.',
variables=(temp, hght, ucomp, vcomp, r_e, dp),
def_time=True,
def_vert='pfull',
def_lat=True,
def_lon=True,
func=calcs.dse_horiz_advec_divg_sum,
units=units.J_kg1_s1
)
du_dx = Var(
name='du_dx',
domain='atmos',
variables=(ucomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.d_dx_from_latlon,
units=units.s1
)
dv_dy = Var(
name='dv_dy',
domain='atmos',
variables=(vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.d_dy_from_lat,
units=units.s1
)
equiv_pot_temp = Var(
name='equiv_pot_temp',
domain='atmos',
description='Equivalent potential temperature.',
variables=(temp, level, sphum),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.equiv_pot_temp,
units=units.K
)
esf = Var(
name='esf',
domain='atmos',
description='Eddy streamfunction.',
variables=(level, vcomp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=None,
units=units.kg_s1
)
evap_frac = Var(
name='evap_frac',
domain='atmos',
description='Evaporative fraction, i.e. ratio of LH to (LH+SH).',
variables=(evap, shflx),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.evap_frac,
units=units.unitless
)
fmse = Var(
name='fmse',
domain='atmos',
description='Frozen moist static energy.',
variables=(temp, hght, sphum, ice_wat),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.fmse,
units=units.J_kg1,
)
fmse_merid_deriv_eta = Var(
name='fmse_merid_deriv_eta',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.fmse_merid_deriv_eta,
units=units.J_kg1_m1,
)
fmse_zonal_deriv_eta = Var(
name='fmse_zonal_deriv_eta',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.fmse_zonal_deriv_eta,
units=units.J_kg1_m1,
)
fmse_budget_advec_residual = Var(
name='fmse_budget_advec_residual',
domain='atmos',
description=(
'Residual in vertically integrated frozen MSE budget, with frozen '
'MSE transport computed as sum of horizontal and vertical advection '
'terms.'
),
variables=(
temp, hght, sphum, ice_wat, ucomp, vcomp, omega, p, dp,
r_e, swdn_toa, swup_toa, olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc,
shflx, evap
),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.fmse_budget_advec_residual,
units=units.W_m2,
colormap='RdBu'
)
gms_change_est = Var(
name='gms_change_est',
domain='atmos',
description='Gross moist stability estimated as near surface MSE at ITCZ minus at the local latitude.',
variables=(temp, temp, sphum, precip, p),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=False,
func=calcs.gms_change_est,
units=units.K
)
gms_change_est2 = Var(
name='gms_change_est2',
domain='atmos',
description='Gross moist stability estimated as near surface MSE at ITCZ minus at the local latitude.',
variables=(temp, temp, sphum, precip, level, lat),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=False,
func=calcs.gms_change_est2,
units=units.K
)
gms_h01 = Var(
name='gms_h01',
domain='atmos',
description='Gross moist stability estimated as near surface MSE at ITCZ minus at the local latitude.',
variables=(temp, hght, sphum, precip, p),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=False,
func=calcs.gms_h01,
units=units.K
)
gms_h01est = Var(
name='gms_h01est',
domain='atmos',
description='Gross moist stability estimated as near surface MSE at ITCZ minus at the local latitude, but neglecting the geopotential term.',
variables=(temp, sphum, precip, p),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=False,
func=calcs.gms_h01est,
units=units.K
)
gms_h01est2 = Var(
name='gms_h01est2',
domain='atmos',
description='Gross moist stability estimated as MSE aloft at ITCZ minus near surface MSE at the local latitude.',
variables=(temp, hght, sphum, precip, p),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=False,
func=calcs.gms_h01est2,
units=units.K
)
gms_moc = Var(
name='gms_moc',
domain='atmos',
description='Gross moist stability using only MMC MSE transport',
variables=(temp, hght, sphum, precip, p),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=False,
func=calcs.gms_moc,
units=units.K
)
gms_msf = Var(
name='gms_msf',
domain='atmos',
description='Gross moist stability using MMC plus stationary eddy MSE transport.',
variables=(temp, hght, sphum, precip, p),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=False,
func=calcs.gms_msf,
units=units.K
)
gms_up_low = Var(
name='gms_up_low',
domain='atmos',
description='Gross moist stability estimated as uppper minus lower level MSE.',
variables=(temp, hght, sphum, p),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=False,
func=calcs.gms_up_low,
units=units.K
)
gms_each_level = Var(
name='gms_each_level',
domain='atmos',
description='Local upper minus lower level MSE for fixed lower level and varying upper level over all levels.',
variables=(temp, hght, sphum, p),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.gms_each_level,
units=units.K
)
gross_dry_stab = Var(
name='gross_dry_stab',
domain='atmos',
description='Gross dry stability.',
variables=(temp, hght, ucomp, vcomp, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.gross_dry_stab,
units=units.J_kg1
)
gross_moist_stab = Var(
name='gross_moist_stab',
domain='atmos',
description='Gross dry stability.',
variables=(temp, hght, sphum, ucomp, vcomp, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.gross_moist_stab,
units=units.J_kg1
)
gross_moist_strat = Var(
name='gross_moist_strat',
domain='atmos',
variables=(sphum, ucomp, vcomp, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.gross_moist_strat,
units=units.J_kg1
)
hght_horiz_advec = Var(
name='hght_horiz_advec',
domain='atmos',
description='Horizontal advection of geopotential height.',
variables=(hght, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.horiz_advec,
units=units.J_kg1_s1
)
hght_times_horiz_divg = Var(
name='hght_times_horiz_divg',
domain='atmos',
description='Horizontal mass flux divergence times geopotential height.',
variables=(hght, ucomp, vcomp, r_e, dp),
def_time=True,
def_vert='pfull',
def_lat=True,
def_lon=True,
func=calcs.field_times_horiz_divg,
units=units.J_kg1_s1
)
hght_horiz_flux_divg = Var(
name='hght_horiz_flux_divg',
domain='atmos',
description='Horizontal flux divergence of geopotential height.',
variables=(hght, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.field_horiz_flux_divg,
units=units.J_kg1_s1
)
hght_horiz_advec_divg_sum = Var(
name='hght_horiz_advec_divg_sum',
domain='atmos',
description='Sum of geopotential height horizontal divergence and advection.',
variables=(hght, ucomp, vcomp, r_e, dp),
def_time=True,
def_vert='pfull',
def_lat=True,
def_lon=True,
func=calcs.field_horiz_advec_divg_sum,
units=units.J_kg1_s1
)
horiz_divg = Var(
name='horiz_divg',
math_str=r'$\nabla\cdot\mathbf{v}$',
domain='atmos',
description='Horizontal mass divergence',
variables=(ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.horiz_divg,
units=units.s1,
colormap='RdBu'
)
horiz_divg_spharm = Var(
name='horiz_divg_spharm',
math_str=r'$\nabla\cdot\mathbf{v}$',
domain='atmos',
description='Horizontal mass divergence',
variables=(ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.horiz_divg_spharm,
units=units.s1,
colormap='RdBu'
)
horiz_divg_mass_adj = Var(
name='horiz_divg_mass_adj',
domain='atmos',
variables=(ucomp, vcomp, evap, precip, ps, r_e, dp),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.horiz_divg_mass_adj,
units=units.s1_mass,
colormap='RdBu'
)
horiz_divg_mass_adj_spharm = Var(
name='horiz_divg_mass_adj_spharm',
domain='atmos',
variables=(ucomp, vcomp, evap, precip, ps, r_e, dp),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.horiz_divg_mass_adj_spharm,
units=units.s1_mass,
colormap='RdBu'
)
horiz_divg_mass_adj_from_eta = Var(
name='horiz_divg_mass_adj_from_eta',
domain='atmos',
variables=(ucomp, vcomp, evap, precip, ps, r_e, dp, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.horiz_divg_mass_adj_from_eta,
units=units.s1_mass,
colormap='RdBu'
)
horiz_divg_vert_int_max = Var(
name='horiz_divg_vert_int_max',
domain='atmos',
description=('Integral of horizontal divergence from surface to level '
'that maximizes its magnitude'),
variables=(ucomp, vcomp, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.horiz_divg_vert_int_max,
units=units.kg_m2_s1_mass
)
dry_mass_column_tendency = Var(
name='dry_mass_column_tendency',
domain='atmos',
description=('Monthly time-tendency of surface pressure minus gravity '
'times water vapor path monthly time tendency.'),
variables=(ps, sphum, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.dry_mass_column_tendency,
units=units.Pa_s1_mass,
math_str=r'$\partial p_s/\partial t - g\partial \mathrm{WVP}/\partial t$',
)
dry_mass_column_divg = Var(
name='dry_mass_column_divg',
domain='atmos',
description=('Divergence of vertical integral of (one minus specific '
'humidity) times horizontal flow.'),
variables=(ucomp, vcomp, sphum, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.dry_mass_column_divg,
units=units.Pa_s1_mass,
math_str=(r'$\nabla\cdot\int_{p_\mathrm{t}}^{p_\mathrm{s}}'
'(1-q)\mathbf{v}\,\mathrm{d}p$'),
colormap='RdBu'
)
dry_mass_column_budget_residual = Var(
name='dry_mass_column_budget_residual',
domain='atmos',
description=('Divergence of vertical integral of (one minus specific '
'humidity) times horizontal flow.'),
variables=(ps, ucomp, vcomp, sphum, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.dry_mass_column_budget_residual,
units=units.Pa_s1_mass,
colormap='RdBu'
)
dry_mass_column_divg_adj = Var(
name='dry_mass_column_divg_adj',
domain='atmos',
description=('Divergence of vertical integral of (one minus specific '
'humidity) times horizontal flow.'),
variables=(ucomp, vcomp, sphum, ps, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.dry_mass_column_divg_adj,
units=units.Pa_s1_mass,
math_str=(r'$\nabla\cdot\int_{p_\mathrm{t}}^{p_\mathrm{s}}'
'(1-q)\mathbf{v}\,\mathrm{d}p$'),
colormap='RdBu'
)
dry_mass_column_budget_adj_residual = Var(
name='dry_mass_column_budget_adj_residual',
domain='atmos',
description=('Residual of mass budget with explicit correction applied '
'to transport term'),
variables=(ps, ucomp, vcomp, sphum, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.dry_mass_column_budget_adj_residual,
units=units.Pa_s1_mass,
colormap='RdBu'
)
energy_column_source = Var(
name='energy_column_source',
math_str=r'$F_\mathrm{net}$',
domain='atmos',
description='Net energy flux into atmosphere at surface and at TOA.',
variables=(swdn_toa, swup_toa, olr, swup_sfc, swdn_sfc,
lwup_sfc, lwdn_sfc, shflx, evap),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_column_source,
units=units.W_m2,
)
energy_column_divg = Var(
name='energy_column_divg',
domain='atmos',
description='Column flux divergence of energy. No mass adjustment.',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, dp, r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_column_divg,
units=units.W_m2,
colormap='RdBu'
)
energy_column_tendency = Var(
name='energy_column_tendency',
domain='atmos',
description='Monthly time-tendency of column integrated energy.',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_column_tendency,
units=units.W_m2,
)
energy_column_tendency_each_timestep = Var(
name='energy_column_tendency_each_timestep',
domain='atmos',
description='Monthly time-tendency of column integrated energy.',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_column_tendency_each_timestep,
units=units.W_m2,
)
energy_column_budget_residual = Var(
name='energy_column_budget_residual',
domain='atmos',
description='Residual in column-integrated energy budget.',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap, dp,
r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_column_budget_residual,
units=units.W_m2,
)
energy_column_divg_adj = Var(
name='energy_column_divg_adj',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_column_divg_adj,
units=units.W_m2,
colormap='RdBu'
)
energy_column_divg_adj_time_mean = Var(
name='energy_column_divg_adj_time_mean',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_column_divg_adj_time_mean,
units=units.W_m2,
colormap='RdBu'
)
energy_column_divg_adj_eddy = Var(
name='energy_column_divg_adj_eddy',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_column_divg_adj_eddy,
units=units.W_m2,
colormap='RdBu'
)
energy_column_divg_mass_adj = Var(
name='energy_column_divg_mass_adj',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, evap, precip, ps,
dp, r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_column_divg_mass_adj,
units=units.W_m2,
colormap='RdBu'
)
energy_column_budget_adj_residual = Var(
name='energy_column_budget_adj_residual',
domain='atmos',
description='Residual in column-integrated energy budget.',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_column_budget_adj_residual,
units=units.W_m2,
)
energy_column_budget_energy_adj_residual = Var(
name='energy_column_budget_energy_adj_residual',
domain='atmos',
description='Residual in column-integrated energy budget.',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
ps, dp, r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_column_budget_energy_adj_residual,
units=units.W_m2,
)
energy_column_budget_mass_adj_residual = Var(
name='energy_column_budget_mass_adj_residual',
domain='atmos',
description='Residual in column-integrated energy budget.',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_column_budget_mass_adj_residual,
units=units.W_m2,
)
energy_column_budget_dry_mass_adj_residual = Var(
name='energy_column_budget_dry_mass_adj_residual',
domain='atmos',
description='Residual in column-integrated energy budget.',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
ps, dp, r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_column_budget_dry_mass_adj_residual,
units=units.W_m2,
)
energy_ps_horiz_advec = Var(
name='energy_ps_horiz_advec',
domain='atmos',
description='Advection of surface energy times surface pressure',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_sfc_ps_advec,
units=units.W_m2,
colormap='RdBu'
)
energy_ps_horiz_advec_as_resid = Var(
name='energy_ps_horiz_advec_as_resid',
domain='atmos',
description='Advection of surface energy times surface pressure',
# variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
# olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
# precip, ps, dp, r_e, bk, pk),
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp,
evap, precip, ps, dp, r_e, bk, pk),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_sfc_ps_advec_as_resid,
units=units.W_m2,
colormap='RdBu'
)
energy_horiz_advec_eta_adj = Var(
name='energy_horiz_advec_eta_adj',
domain='atmos',
description='Horizontal advection of energy from model coordinates',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_horiz_advec_eta_adj,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_horiz_advec_eta_adj_spharm = Var(
name='energy_horiz_advec_eta_adj_spharm',
domain='atmos',
description='Horizontal advection of energy from model coordinates',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_horiz_advec_eta_adj_spharm,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_horiz_advec_eta_adj_time_mean = Var(
name='energy_horiz_advec_eta_adj_time_mean',
domain='atmos',
description='Horizontal advection of energy from model coordinates',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_horiz_advec_eta_adj_time_mean,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_horiz_advec_eta_upwind_adj_time_mean = Var(
name='energy_horiz_advec_eta_upwind_adj_time_mean',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_horiz_advec_eta_upwind_adj_time_mean,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_horiz_advec_adj = Var(
name='energy_horiz_advec_adj',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_horiz_advec_adj,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_horiz_advec_upwind = Var(
name='energy_horiz_advec_upwind',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_horiz_advec_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_zonal_advec_upwind = Var(
name='energy_zonal_advec_upwind',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_zonal_advec_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_merid_advec_upwind = Var(
name='energy_merid_advec_upwind',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_merid_advec_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_horiz_advec_eta_upwind = Var(
name='energy_horiz_advec_eta_upwind',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_horiz_advec_eta_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_merid_advec_eta_upwind = Var(
name='energy_merid_advec_eta_upwind',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_merid_advec_eta_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_zonal_advec_eta_upwind = Var(
name='energy_zonal_advec_eta_upwind',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_zonal_advec_eta_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_horiz_advec_eta_upwind_thermo = Var(
name='energy_horiz_advec_eta_upwind_thermo',
domain='atmos',
description='Hack to avoid over-long filenames w/ data from mult. runs',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_horiz_advec_eta_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_horiz_advec_eta_upwind_dyn = Var(
name='energy_horiz_advec_eta_upwind_dyn',
domain='atmos',
description='Hack to avoid over-long filenames w/ data from mult. runs',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_horiz_advec_eta_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_horiz_advec_eta_upwind_covar = Var(
name='energy_horiz_advec_eta_upwind_covar',
domain='atmos',
description='Hack to avoid over-long filenames w/ data from mult. runs',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_horiz_advec_eta_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_horiz_advec_eta_upwind_time_mean = Var(
name='energy_horiz_advec_eta_upwind_time_mean',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_horiz_advec_eta_upwind_time_mean,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_horiz_divg_eta = Var(
name='energy_horiz_divg_eta',
domain='atmos',
description='Energy times horizontal divergence from model coordinates',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_horiz_divg_eta,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_column_vert_advec_as_resid_eta_time_mean = Var(
name='energy_column_vert_advec_as_resid_eta_time_mean',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e, bk, pk),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_column_vert_advec_as_resid_eta_time_mean,
units=units.W_m2,
colormap='RdBu'
)
energy_column_vert_advec_as_resid = Var(
name='energy_column_vert_advec_as_resid',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.energy_column_vert_advec_as_resid,
units=units.W_m2,
colormap='RdBu'
)
energy_vert_advec_eta = Var(
name='energy_vert_advec_eta',
domain='atmos',
description='Vertical advection of energy from model coordinates',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, omega, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_vert_advec_eta,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_vert_advec_eta_adj = Var(
name='energy_vert_advec_eta_adj',
domain='atmos',
description='Vertical advection of energy from model coordinates',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, omega, swdn_toa,
swup_toa, olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx,
evap, precip, ps, dp, r_e, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_vert_advec_eta_adj,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_vert_advec = Var(
name='energy_vert_advec',
domain='atmos',
description='Vertical advection of energy',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, omega),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_vert_advec,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_vert_advec_eta_upwind = Var(
name='energy_vert_advec_eta_upwind',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, omega, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_vert_advec_eta_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_vert_advec_eta_upwind_thermo = Var(
name='energy_vert_advec_eta_upwind_thermo',
domain='atmos',
description='Hack to avoid over-long filenames w/ data from mult. runs',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, omega, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_vert_advec_eta_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_vert_advec_eta_upwind_dyn = Var(
name='energy_vert_advec_eta_upwind_dyn',
domain='atmos',
description='Hack to avoid over-long filenames w/ data from mult. runs',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, omega, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_vert_advec_eta_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_vert_advec_eta_upwind_covar = Var(
name='energy_vert_advec_eta_upwind_covar',
domain='atmos',
description='Hack to avoid over-long filenames w/ data from mult. runs',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, omega, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_vert_advec_eta_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_vert_advec_eta_adj = Var(
name='energy_vert_advec_eta_adj',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_vert_advec_eta_adj,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_vert_advec_eta_time_mean = Var(
name='energy_vert_advec_eta_time_mean',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, omega, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_vert_advec_eta_time_mean,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_vert_advec_eta_adj_time_mean = Var(
name='energy_vert_advec_eta_adj_time_mean',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_vert_advec_eta_adj_time_mean,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_vert_advec_eta_upwind_time_mean = Var(
name='energy_vert_advec_eta_upwind_time_mean',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, omega,
ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_vert_advec_eta_upwind_time_mean,
units=units.J_kg1_s1,
colormap='RdBu'
)
energy_vert_advec_eta_upwind_adj_time_mean = Var(
name='energy_vert_advec_eta_upwind_adj_time_mean',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.energy_vert_advec_eta_upwind_adj_time_mean,
units=units.J_kg1_s1,
colormap='RdBu'
)
mass_column = Var(
name='mass_column',
math_str=r'$p_s/g$',
domain='atmos',
description=('Total mass per square meter of the atmospheric column, '
'based on surface pressure.'),
variables=(ps,),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.mass_column,
func_input_dtype='numpy',
units=units.kg_m2,
)
mass_column_integral = Var(
name='mass_column_integral',
math_str=r'$\int^{p_s}_{p_t}\,\mathrm{d}p/g$',
domain='atmos',
description=('Total mass per square meter of the atmospheric column,'
'computed by explicitly integrating pressure. Temperature '
'variable (temp) is a dummy -- aospy.Calc needs at '
'least one netCDF variable per aospy.Var.'),
variables=(temp, dp,),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.mass_column_integral,
units=units.kg_m2,
)
mass_column_divg = Var(
name='mass_column_divg',
domain='atmos',
description='Column mass divergence, computed w/ finite differencing.',
variables=(ucomp, vcomp, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.mass_column_divg,
units=units.Pa_s1_mass,
math_str=(r'$\nabla\cdot\int_{p_\mathrm{t}}^{p_\mathrm{s}}'
'\mathbf{v}\,\mathrm{d}p$'),
colormap='RdBu'
)
mass_column_divg_spharm = Var(
name='mass_column_divg_spharm',
domain='atmos',
description='Column mass divergence, computed spectrally.',
variables=(ucomp, vcomp, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.mass_column_divg_spharm,
units=units.Pa_s1_mass,
math_str=(r'$\nabla\cdot\int_{p_\mathrm{t}}^{p_\mathrm{s}}'
'\mathbf{v}\,\mathrm{d}p$'),
colormap='RdBu'
)
mass_column_divg_adj = Var(
name='mass_column_divg_adj',
domain='atmos',
variables=(ps, ucomp, vcomp, evap, precip, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.mass_column_divg_adj,
units=units.Pa_s1_mass,
math_str=(r'$\nabla\cdot\int_{p_\mathrm{t}}^{p_\mathrm{s}}'
'\mathbf{v}_\mathrm{adj}\,\mathrm{d}p$'),
colormap='RdBu'
)
mass_column_source = Var(
name='mass_column_source',
domain='atmos',
variables=(evap, precip),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.mass_column_source,
units=units.Pa_s1_mass,
math_str=r'$g(E-P)$',
colormap='RdBu'
)
mass_column_tendency = Var(
name='mass_column_tendency',
domain='atmos',
description='Monthly time-tendency of surface pressure.',
variables=(ps,),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.time_tendency_first_to_last,
# func=calcs.time_tendency_each_timestep,
units=units.Pa_s1_mass,
)
mass_column_budget_lhs = Var(
name='mass_column_budget_lhs',
domain='atmos',
description=(
'Tendency plus flux divergence of column integrated mass.'
),
variables=(ps, ucomp, vcomp, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.mass_column_budget_lhs,
units=units.Pa_s1_mass,
)
mass_column_budget_with_adj_lhs = Var(
name='mass_column_budget_with_adj_lhs',
domain='atmos',
description=(
'Tendency plus flux divergence of column integrated mass.'
),
variables=(ps, ucomp, vcomp, sphum, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.mass_column_budget_with_adj_lhs,
units=units.Pa_s1_mass,
)
mass_column_budget_residual = Var(
name='mass_column_budget_residual',
domain='atmos',
description=(
'Residual in vertically integrated mass budget.'
),
variables=(ps, ucomp, vcomp, evap, precip, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.mass_column_budget_residual,
units=units.Pa_s1_mass,
)
mass_column_budget_adj_residual = Var(
name='mass_column_budget_adj_residual',
domain='atmos',
description=(
'Residual in column mass budget with imposed mass balance adjustment.'
),
variables=(ps, ucomp, vcomp, evap, precip, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.mass_column_budget_adj_residual,
units=units.Pa_s1_mass,
)
moisture_column_source = Var(
name='moisture_column_source',
domain='atmos',
description='Column water vapor source, i.e. evap minus precip.',
variables=(precip, evap),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.moisture_column_source,
units=units.kg_m2_s1,
colormap='BrBG'
)
moisture_column_divg = Var(
name='moisture_column_divg',
domain='atmos',
description='Column flux divergence of water vapor. No mass adjustment.',
variables=(sphum, ucomp, vcomp, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.column_flux_divg,
units=units.kg_m2_s1,
colormap='BrBG_r'
)
moisture_column_divg_with_adj = Var(
name='moisture_column_divg_with_adj',
domain='atmos',
description=('Column flux divergence of water vapor. '
'Uses mass adjusted winds.'),
variables=(sphum, ps, ucomp, vcomp, evap, precip, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.column_flux_divg_adj,
units=units.kg_m2_s1,
colormap='BrBG_r'
)
moisture_column_divg_with_adj2 = Var(
name='moisture_column_divg_with_adj2',
domain='atmos',
description=('Column flux divergence of water vapor. '
'Uses mass adjusted winds.'),
variables=(sphum, ps, ucomp, vcomp, evap, precip, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.moisture_column_divg_with_adj2,
units=units.kg_m2_s1,
colormap='BrBG_r'
)
moisture_column_tendency = Var(
name='moisture_column_tendency',
domain='atmos',
description='Monthly time-tendency of column-integrated water vapor.',
variables=(sphum, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.moisture_column_tendency,
units=units.kg_m2_s1
)
moisture_column_budget_lhs = Var(
name='moisture_column_budget_lhs',
domain='atmos',
description=('Left-hand-side of moisture budget with applied mass '
'correction, where LHS = time tendency plus transport.'),
variables=(ucomp, vcomp, sphum, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.moisture_column_budget_lhs,
units=units.kg_m2_s1,
colormap='BrBG_r'
)
moisture_column_budget_with_adj_lhs = Var(
name='moisture_column_budget_with_adj_lhs',
domain='atmos',
description=('Left-hand-side of moisture budget with applied mass '
'correction, where LHS = time tendency plus transport.'),
variables=(ps, ucomp, vcomp, sphum, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.moisture_column_budget_with_adj_lhs,
units=units.kg_m2_s1,
colormap='BrBG_r'
)
moisture_column_budget_with_adj2_lhs = Var(
name='moisture_column_divg_with_adj2_lhs',
domain='atmos',
description=('Column flux divergence of water vapor. '
'Mass adjusted by subtracting off column mass residual times '
'column average specific humidity.'),
variables=(ps, ucomp, vcomp, sphum, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.moisture_column_budget_with_adj2_lhs,
units=units.kg_m2_s1,
colormap='BrBG_r'
)
moisture_column_budget_residual = Var(
name='moisture_column_budget_residual',
domain='atmos',
description=(
'Residual in vertically integrated moisture budget.'
),
variables=(sphum, ucomp, vcomp, omega, dp, r_e, evap, precip),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.moisture_column_budget_residual,
units=units.kg_m2_s1,
colormap='BrBG_r'
)
moist_static_stab = Var(
name='moist_static_stab',
domain='atmos',
variables=(temp, hght, sphum, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.moist_static_stab,
units=units.J_kg1_Pa1,
)
frozen_moist_static_stab = Var(
name='frozen_moist_static_stab',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.frozen_moist_static_stab,
units=units.J_kg1_Pa1,
)
moist_static_stab_p = Var(
name='moist_static_stab_p',
domain='atmos',
variables=(temp, hght, sphum),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.moist_static_stab_p,
units=units.J_kg1_Pa1,
)
frozen_moist_static_stab_p = Var(
name='frozen_moist_static_stab_p',
domain='atmos',
variables=(temp, hght, sphum, ice_wat),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.frozen_moist_static_stab_p,
units=units.J_kg1_Pa1,
)
mse = Var(
name='mse',
domain='atmos',
math_str=r'$h$',
description='Moist static energy.',
variables=(temp, hght, sphum),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse,
units=units.J_kg1,
valid_range=(3.05e5, 5e6),
)
mse_from_hypso = Var(
name='mse_from_hypso',
domain='atmos',
math_str=r'$h$',
variables=(ps, temp, sphum),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_from_hypso,
units=units.J_kg1,
)
z_from_hypso = Var(
name='z_from_hypso',
domain='atmos',
variables=(ps, temp, sphum),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.z_from_hypso,
units=units.m
)
mse_from_hypso_zonal_advec_upwind = Var(
name='mse_from_hypso_zonal_advec_upwind',
variables=(ps, temp, sphum, ucomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_from_hypso_zonal_advec_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
mse_from_hypso_merid_advec_upwind = Var(
name='mse_from_hypso_merid_advec_upwind',
variables=(ps, temp, sphum, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_from_hypso_merid_advec_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
mse_from_hypso_horiz_advec_upwind = Var(
name='mse_from_hypso_horiz_advec_upwind',
variables=(ps, temp, sphum, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_from_hypso_horiz_advec_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
mse_from_hypso_vert_advec_upwind = Var(
name='mse_from_hypso_vert_advec_upwind',
variables=(ps, temp, sphum, omega, p),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_from_hypso_vert_advec_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
cpt_lvq = Var(
name='cpt_lvq',
domain='atmos',
math_str=r'$h$',
variables=(temp, sphum),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.cpt_lvq,
units=units.J_kg1,
)
cpt_lvq_zonal_deriv = Var(
name='cpt_lvq_zonal_deriv',
variables=(temp, sphum),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.cpt_lvq_zonal_deriv,
units=units.J_kg1_m1,
colormap='RdBu'
)
cpt_lvq_merid_deriv = Var(
name='cpt_lvq_merid_deriv',
variables=(temp, sphum),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.cpt_lvq_merid_deriv,
units=units.J_kg1_m1,
colormap='RdBu'
)
cpt_lvq_zonal_advec_upwind = Var(
name='cpt_lvq_zonal_advec_upwind',
variables=(temp, sphum, ucomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.cpt_lvq_zonal_advec_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
cpt_lvq_merid_advec_upwind = Var(
name='cpt_lvq_merid_advec_upwind',
variables=(temp, sphum, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.cpt_lvq_merid_advec_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
cpt_lvq_horiz_advec_upwind = Var(
name='cpt_lvq_horiz_advec_upwind',
variables=(temp, sphum, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.cpt_lvq_horiz_advec_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
mse_tendency = Var(
name='mse_tendency',
domain='atmos',
variables=(tdt_lw, tdt_sw, tdt_conv, tdt_ls, tdt_vdif,
qdt_conv, qdt_ls, qdt_vdif),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_tendency,
units=units.J_kg1_s1
)
mse_horiz_advec = Var(
name='mse_horiz_advec',
math_str=r'$\mathbf{v}\cdot\nabla h$',
domain='atmos',
description='Horizontal advection of moist static energy.',
variables=(temp, hght, sphum, ucomp, vcomp, r_e),
# variables=(temp, hght, sphum, ucomp, vcomp, ps, r_e, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_horiz_advec,
units=units.J_kg1_s1,
colormap='RdBu'
)
mse_times_horiz_divg = Var(
name='mse_times_horiz_divg',
math_str=r'$h\nabla\cdot\mathbf{v}$',
domain='atmos',
description='Horizontal mass flux divergence times moist static energy.',
variables=(temp, hght, sphum, ucomp, vcomp, r_e, dp),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_times_horiz_divg,
units=units.J_kg1_s1,
colormap='RdBu'
)
mse_horiz_flux_divg = Var(
name='mse_horiz_flux_divg',
math_str=r'$\nabla\cdot(h\mathbf{v})$',
domain='atmos',
description='Horizontal flux divergence of moist static energy.',
variables=(temp, hght, sphum, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_horiz_flux_divg,
units=units.J_kg1_s1,
colormap='RdBu'
)
mse_horiz_advec_divg_sum = Var(
name='mse_horiz_advec_divg_sum',
math_str=r'$h\nabla\cdot\mathbf{v}+\mathbf{v}\cdot\nabla h$',
domain='atmos',
description='Sum of MSE horizontal divergence and advection.',
variables=(temp, hght, sphum, ucomp, vcomp, r_e, dp),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_horiz_advec_divg_sum,
units=units.J_kg1_s1,
colormap='RdBu'
)
mse_vert_flux_divg = Var(
name='mse_vert_flux_divg',
domain='atmos',
description='Vertical flux divergence of moist static energy.',
variables=(temp, hght, sphum, omega, p),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_vert_flux_divg,
units=units.J_kg1_s1,
colormap='RdBu'
)
mse_vert_advec = Var(
name='mse_vert_advec',
math_str=r'$h\frac{\partial\omega}{\partial p}$',
domain='atmos',
description='Moist static energy times vertical divergence.',
variables=(temp, hght, sphum, omega, p),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_vert_advec,
units=units.J_kg1_s1,
colormap='RdBu'
)
mse_total_advec = Var(
name='mse_total_advec',
domain='atmos',
description=('MSE transport computed as sum of horizontal and '
'vertical advection terms.'),
variables=(temp, hght, sphum, ucomp, vcomp, omega, p, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_total_advec,
units=units.J_kg1_s1,
colormap='RdBu'
)
mse_budget_advec_residual = Var(
name='mse_budget_advec_residual',
domain='atmos',
description=(
'Residual in vertically integrated MSE budget, with MSE transport '
'computed as sum of horizontal and vertical advection terms.'
),
variables=(
temp, hght, sphum, ucomp, vcomp, omega, p, dp, r_e,
swdn_toa, swup_toa, olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx,
evap
),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.mse_budget_advec_residual,
units=units.W_m2,
colormap='RdBu'
)
mse_horiz_advec_upwind = Var(
name='mse_horiz_advec_upwind',
variables=(temp, hght, sphum, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_horiz_advec_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
mse_zonal_advec_upwind = Var(
name='mse_zonal_advec_upwind',
variables=(temp, hght, sphum, ucomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_zonal_advec_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
mse_merid_advec_upwind = Var(
name='mse_merid_advec_upwind',
variables=(temp, hght, sphum, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_merid_advec_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
mse_vert_advec_upwind = Var(
name='mse_vert_advec_upwind',
domain='atmos',
description=('Vertical advection of moist static energy using upwind '
'finite differencing scheme for derivatives.'),
variables=(temp, hght, sphum, omega, p),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_vert_advec_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
mse_total_advec_upwind = Var(
name='mse_total_advec_upwind',
domain='atmos',
description=('Total advection of moist static energy using upwind '
'finite differencing scheme for derivatives.'),
variables=(temp, hght, sphum, ucomp, vcomp, omega, p, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.mse_total_advec_upwind,
units=units.J_kg1_s1,
colormap='RdBu'
)
msf = Var(
name='msf',
domain='atmos',
description='Eulerian meridional mass streamfunction.',
variables=(level, vcomp),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=False,
func=calcs.msf,
units=units.kg_s1
)
mass_flux = Var(
name='mass_flux',
domain='atmos',
description=('Mass flux: Eulerian meridional mass streamfunction '
'integrated to the level of its maximum magnitude.'),
variables=(level, vcomp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=False,
func=calcs.msf_max,
units=units.kg_s1
)
omega_from_divg_eta = Var(
name='omega_from_divg_eta',
domain='atmos',
variables=(ucomp, vcomp, ps, r_e, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.omega_from_divg_eta,
units=units.Pa_s1
)
omega_from_divg_eta_adj = Var(
name='omega_from_divg_eta_adj',
domain='atmos',
variables=(ucomp, vcomp, ps, r_e, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.omega_from_divg_eta,
units=units.Pa_s1
)
omega_change_from_fmse_budget = Var(
name='omega_change_from_fmse_budget',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, ps,
temp, hght, sphum, ice_wat, ucomp, vcomp, ps,
bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.omega_change_from_fmse_budget,
units=units.Pa_s1
)
p_minus_e = Var(
name='p-e',
domain='atmos',
description='Precipitation minus evaporation',
variables=(precip, evap),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.p_minus_e,
units=units.kg_m2_s1,
colormap='BrBG'
)
pot_temp = Var(
name='pot_temp',
domain='atmos',
description='Potential temperature.',
variables=(temp, p),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.pot_temp,
units=units.K
)
prec_conv_frac = Var(
name='prec_conv_frac',
domain='atmos',
description=('Fraction of liquid precipitation reaching surface '
'originating from convection scheme (as opposed to '
'large-scale condensation.'),
variables=(prec_conv, precip),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.prec_conv_frac,
units=units.unitless
)
precip_large_scale = Var(
name='precip_large_scale',
domain='atmos',
variables=(prec_conv, precip),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.precip_large_scale,
units=units.kg_m2_s1,
colormap='BrBG_r'
)
ps_horiz_advec = Var(
name='ps_horiz_advec',
domain='atmos',
description='Horizontal advection of surface pressure',
variables=(ps, ucomp, vcomp, evap, precip, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.ps_horiz_advec,
units=units.Pa_s1_mass,
colormap='RdBu'
)
q_zonal_advec = Var(
name='q_zonal_advec',
domain='atmos',
description='Zonal advection of specific humidity.',
variables=(sphum, ucomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.zonal_advec,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_merid_advec = Var(
name='q_merid_advec',
domain='atmos',
description='Meridional advection of specific humidity.',
variables=(sphum, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.merid_advec,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_horiz_advec = Var(
name='q_horiz_advec',
domain='atmos',
description='Horizontal advection of specific humidity.',
variables=(sphum, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.horiz_advec,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_horiz_advec_mass_adj = Var(
name='q_horiz_advec_mass_adj',
domain='atmos',
variables=(sphum, ucomp, vcomp, sphum, ps, r_e, dp, p),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.horiz_advec_mass_adj,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_horiz_advec_const_p_from_eta = Var(
name='q_horiz_advec_const_p_from_eta',
domain='atmos',
variables=(sphum, ucomp, vcomp, ps, r_e, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.horiz_advec_const_p_from_eta,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_times_horiz_divg_mass_adj = Var(
name='q_times_horiz_divg_mass_adj',
domain='atmos',
variables=(sphum, ucomp, vcomp, sphum, ps, r_e, dp, p),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.field_times_horiz_divg_mass_adj,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_horiz_flux_divg_mass_adj = Var(
name='q_horiz_flux_divg_mass_adj',
domain='atmos',
variables=(sphum, ucomp, vcomp, sphum, ps, r_e, dp, p),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.field_horiz_flux_divg_mass_adj,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_vert_advec = Var(
name='q_vert_advec',
domain='atmos',
description='Vertical advection of specific humidity.',
variables=(sphum, omega, p),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.vert_advec,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_vert_advec_from_eta = Var(
name='q_vert_advec_from_eta',
domain='atmos',
description='Vertical advection of specific humidity.',
variables=(sphum, omega, ps, bk, pk),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.vert_advec_from_eta,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_zonal_advec_upwind = Var(
name='q_zonal_advec_upwind',
domain='atmos',
description=('Zonal advection of specific humidity using upwind '
'finite differencing scheme for derivatives.'),
variables=(sphum, ucomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.zonal_advec_upwind,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_merid_advec_upwind = Var(
name='q_merid_advec_upwind',
domain='atmos',
description=('Meridional advection of specific humidity using upwind '
'finite differencing scheme for derivatives.'),
variables=(sphum, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.merid_advec_upwind,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_horiz_advec_upwind = Var(
name='q_horiz_advec_upwind',
domain='atmos',
description=('Horizontal advection of specific humidity using upwind '
'finite differencing scheme for derivatives.'),
variables=(sphum, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.horiz_advec_upwind,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_total_advec_upwind = Var(
name='q_total_advec_upwind',
domain='atmos',
description=('Total advection of specific humidity using upwind '
'finite differencing scheme for derivatives.'),
variables=(sphum, ucomp, vcomp, omega, p, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.total_advec_upwind,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_times_horiz_divg = Var(
name='q_times_horiz_divg',
domain='atmos',
description='Horizontal flux divergence times specific humidity.',
variables=(sphum, ucomp, vcomp, r_e, dp),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.field_times_horiz_divg,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_horiz_flux_divg = Var(
name='q_horiz_flux_divg',
domain='atmos',
description='Horizontal flux divergence of specific humidity.',
variables=(sphum, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.field_horiz_flux_divg,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_horiz_advec_divg_sum = Var(
name='q_horiz_advec_divg_sum',
domain='atmos',
description='Sum of Q horizontal divergence and advection.',
variables=(sphum, ucomp, vcomp, r_e, dp),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.field_horiz_advec_divg_sum,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_vert_flux_divg = Var(
name='q_vert_flux_divg',
domain='atmos',
description='Vertical flux divergence of specific humidity.',
variables=(sphum, omega, p),
def_time=True,
def_vert='pfull',
def_lat=True,
def_lon=True,
func=calcs.field_vert_flux_divg,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
q_total_advec = Var(
name='q_total_advec',
domain='atmos',
description=('Moisture transport computed as sum of horizontal and '
'vertical advection terms.'),
variables=(sphum, ucomp, vcomp, omega, p, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.field_total_advec,
units=units.s1_spec_mass,
colormap='BrBG_r'
)
sfc_albedo = Var(
name='sfc_albedo',
domain='atmos',
description='Surface albedo, masked where downwelling surface SW is zero.',
variables=(swdn_sfc, swup_sfc),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.sfc_albedo,
units=units.unitless
)
sfc_energy = Var(
name='sfc_energy',
domain='atmos',
description='Net surface energy flux, signed positive upwards.',
variables=(swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.sfc_energy,
units=units.W_m2
)
sfc_lw = Var(
name='sfc_lw',
domain='atmos',
description='Net all-sky longwave radiative flux at surface, signed positive upwards.',
variables=(lwup_sfc, lwdn_sfc),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.sfc_lw,
units=units.W_m2
)
sfc_lw_cld = Var(
name='sfc_lw_cld',
domain='atmos',
description='Net cloudy-sky longwave radiative flux at surface, signed positive upwards.',
variables=(lwup_sfc, lwup_sfc_clr, lwdn_sfc, lwdn_sfc_clr),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.sfc_lw_cld,
units=units.W_m2
)
sfc_rad = Var(
name='sfc_rad',
domain='atmos',
description='Net all-sky surface radiative flux, signed positive upwards.',
variables=(swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.sfc_rad,
units=units.W_m2
)
sfc_rad_cld = Var(
name='sfc_rad_cld',
domain='atmos',
description='Net cloudy-sky surface radiative flux, signed positive upwards.',
variables=(swup_sfc, swup_sfc_clr, swdn_sfc, swdn_sfc_clr,
lwup_sfc, lwup_sfc_clr, lwdn_sfc, lwdn_sfc_clr),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.sfc_rad_cld,
units=units.W_m2
)
sfc_rad_clr = Var(
name='sfc_rad_clr',
domain='atmos',
description='Net clear-sky surface radiative flux, positive upwards.',
variables=(swup_sfc_clr, swdn_sfc_clr, lwup_sfc_clr, lwdn_sfc_clr),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.sfc_rad,
units=units.W_m2
)
sfc_sw = Var(
name='sfc_sw',
domain='atmos',
description='Net all-sky shortwave radiative flux at surface, signed positive upwards.',
variables=(swup_sfc, swdn_sfc),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.sfc_sw,
units=units.W_m2
)
sfc_sw_cld = Var(
name='sfc_sw_cld',
domain='atmos',
description='Net cloudy-sky shortwave radiative flux at surface, signed positive upwards.',
variables=(swup_sfc, swup_sfc_clr, swdn_sfc, swdn_sfc_clr),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.sfc_sw_cld,
units=units.W_m2
)
temp_horiz_advec = Var(
name='temp_horiz_advec',
domain='atmos',
description='Horizontal advection of temperature.',
variables=(temp, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.horiz_advec,
units=units.K_s1
)
temp_times_horiz_divg = Var(
name='temp_times_horiz_divg',
domain='atmos',
description='Horizontal mass flux divergence times temperature.',
variables=(temp, ucomp, vcomp, r_e, dp),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.field_times_horiz_divg,
units=units.K_s1
)
temp_horiz_flux_divg = Var(
name='temp_horiz_flux_divg',
domain='atmos',
description='Horizontal flux divergence of temperature.',
variables=(temp, ucomp, vcomp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.field_horiz_flux_divg,
units=units.K_s1
)
temp_horiz_advec_divg_sum = Var(
name='temp_horiz_advec_divg_sum',
domain='atmos',
description='Sum of temperature horizontal divergence and advection.',
variables=(temp, ucomp, vcomp, r_e, dp),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.field_horiz_advec_divg_sum,
units=units.K_s1
)
temp_vert_advec = Var(
name='temp_vert_advec',
domain='atmos',
description='Vertical advection of temperature.',
variables=(temp, omega, p),
def_time=True,
def_vert='pfull',
def_lat=True,
def_lon=True,
func=calcs.vert_advec,
units=units.K_s1
)
tdt_diab = Var(
name='tdt_diab',
domain='atmos',
description='Net temperature tendency from diabatic terms: LW, SW, convective, large-scale, and vertical diffusion.',
variables=(tdt_lw, tdt_sw, tdt_conv, tdt_ls),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.tdt_diab,
units=units.K_s1
)
tdt_lw_cld = Var(
name='tdt_lw_cld',
domain='atmos',
description='Cloudy-sky temperature tendency from longwave radiation.' ,
variables=(tdt_lw, tdt_lw_clr),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.tdt_lw_cld,
units=units.K_s1
)
tdt_sw_cld = Var(
name='tdt_sw_cld',
domain='atmos',
description='Cloudy-sky temperature tendency from shortwave radiation.' ,
variables=(tdt_sw, tdt_sw_clr),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.tdt_sw_cld,
units=units.K_s1
)
tdt_moist_diabatic = Var(
name='tdt_moist_diabatic',
domain='atmos',
variables=(tdt_lw, tdt_sw, tdt_vdif),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.tdt_moist_diabatic,
units=units.K_s1
)
toa_rad = Var(
name='toa_rad',
math_str=r'$R_\mathrm{toa}$',
domain='atmos',
description='Net top-of-atmosphere radiative flux, signed positive downwards.',
variables=(swdn_toa, swup_toa, olr),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.toa_rad,
units=units.W_m2,
)
toa_rad_clr = Var(
name='toa_rad_clr',
domain='atmos',
description='Clear-sky TOA radiative flux, positive downwards.',
variables=(swdn_toa, swup_toa_clr, olr_clr),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.toa_rad_clr,
units=units.W_m2
)
toa_sw = Var(
name='toa_sw',
domain='atmos',
description='Net all-sky top-of-atmosphere shortwave radiative flux, signed positive downwards.',
variables=(swdn_toa, swup_toa),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.toa_sw,
units=units.W_m2
)
total_gms = Var(
name='total_gms',
domain='atmos',
description='Total gross moist stability, i.e. GMS using MMC plus stationary and transient eddy MSE transports.',
variables=(temp, hght, sphum, precip, p),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=False,
func=calcs.total_gms,
units=units.K
)
cre_sw_precip_corr = Var(
name='cre_sw_precip_corr',
domain='atmos',
description='Pointwise temporal correlation of SW CRE and precip',
variables=(swup_toa, swup_toa_clr, precip),
def_time=False,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.corr_cre_sw,
units=units.unitless
)
cre_lw_precip_corr = Var(
name='cre_lw_precip_corr',
domain='atmos',
description='Pointwise temporal correlation of LW CRE and precip',
variables=(olr, olr_clr, precip),
def_time=False,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.corr_cre_lw,
units=units.unitless
)
cre_net_precip_corr = Var(
name='cre_net_precip_corr',
domain='atmos',
description='Pointwise temporal correlation of net CRE and precip',
variables=(swup_toa, olr, swup_toa_clr, olr_clr, precip),
def_time=False,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.corr_cre_net,
units=units.unitless
)
evap_precip_corr = Var(
name='evap_precip_corr',
domain='atmos',
description='Pointwise temporal correlation of evap and precip',
variables=(evap, precip),
def_time=False,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.pointwise_corr,
units=units.unitless
)
toa_rad_clr_precip_corr = Var(
name='toa_rad_clr_precip_corr',
domain='atmos',
variables=(swdn_toa_clr, swup_toa_clr, olr_clr, precip),
def_time=False,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.corr_toa_rad_clr,
units=units.unitless
)
t_surf_precip_corr = Var(
name='t_surf_precip_corr',
domain='atmos',
description='Pointwise temporal correlation of t_surf and precip',
variables=(t_surf, precip),
def_time=False,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.pointwise_corr,
units=units.unitless
)
cre_net_precip_lin_regr = Var(
name='cre_net_precip_lin_regr',
domain='atmos',
variables=(swup_toa, olr, swup_toa_clr, olr_clr, precip),
def_time=False,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.lin_regr_cre_net,
units=units.unitless,
)
toa_rad_clr_precip_lin_regr = Var(
name='toa_rad_clr_precip_lin_regr',
domain='atmos',
variables=(swdn_toa_clr, swup_toa_clr, olr_clr, precip),
def_time=False,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.lin_regr_toa_rad_clr,
units=units.unitless,
)
t_surf_precip_lin_regr = Var(
name='t_surf_precip_lin_regr',
domain='atmos',
description=('Pointwise temporal least squares linear regression of '
't_surf and precip'),
variables=(t_surf, precip),
def_time=False,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.pointwise_lin_regr,
units=units.unitless
)
u_energy_adjustment = Var(
name='u_energy_adjustment',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap, dp,
r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.u_energy_adjustment,
units=units.m_s1
)
u_energy_adjusted = Var(
name='u_energy_adjusted',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap, dp,
r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.u_energy_adjusted,
units=units.m_s1
)
u_mass_adjustment = Var(
name='u_mass_adjustment',
domain='atmos',
variables=(ps, ucomp, vcomp, evap, precip, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.u_mass_adjustment,
units=units.m_s1
)
u_mass_adjusted = Var(
name='u_mass_adjusted',
domain='atmos',
variables=(ps, ucomp, vcomp, evap, precip, r_e, dp),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.u_mass_adjusted,
units=units.m_s1
)
u_mass_energy_adjustment = Var(
name='u_mass_energy_adjustment',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.u_mass_energy_adjustment,
units=units.m_s1
)
u_mass_energy_adjusted = Var(
name='u_mass_energy_adjusted',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.u_mass_energy_adjusted,
units=units.m_s1
)
v_energy_adjustment = Var(
name='v_energy_adjustment',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap, dp,
r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.v_energy_adjustment,
units=units.m_s1
)
v_energy_adjusted = Var(
name='v_energy_adjusted',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap, dp,
r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.v_energy_adjusted,
units=units.m_s1
)
v_mass_adjustment = Var(
name='v_mass_adjustment',
domain='atmos',
variables=(ps, ucomp, vcomp, evap, precip, r_e, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.v_mass_adjustment,
units=units.m_s1
)
v_mass_adjusted = Var(
name='v_mass_adjusted',
domain='atmos',
variables=(ps, ucomp, vcomp, evap, precip, r_e, dp),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.v_mass_adjusted,
units=units.m_s1
)
v_mass_energy_adjustment = Var(
name='v_mass_energy_adjustment',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.v_mass_energy_adjustment,
units=units.m_s1
)
v_mass_energy_adjusted = Var(
name='v_mass_energy_adjusted',
domain='atmos',
variables=(temp, hght, sphum, ice_wat, ucomp, vcomp, swdn_toa, swup_toa,
olr, swup_sfc, swdn_sfc, lwup_sfc, lwdn_sfc, shflx, evap,
precip, ps, dp, r_e),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.v_mass_energy_adjusted,
units=units.m_s1
)
v_mid_trop = Var(
name='v_mid_trop',
units=units.m_s1,
domain='atmos',
description='Northward velocity averaged over 400-700 hPa.',
variables=[vcomp],
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.vert_avg,
)
vert_divg = Var(
name='vert_divg',
domain='atmos',
variables=(omega, p),
def_time=True,
def_vert='pfull',
def_lat=True,
def_lon=True,
func=calcs.vert_divg,
units=units.s1
)
vert_divg_vert_int_max = Var(
name='vert_divg_vert_int_max',
domain='atmos',
description=('Integral of vertical divergence from surface to level '
'that maximizes its magnitude'),
variables=(omega, p, dp),
def_time=True,
def_vert=False,
def_lat=True,
def_lon=True,
func=calcs.vert_divg_vert_int_max,
units=units.kg_m2_s1_mass
)
virt_pot_temp = Var(
name='virt_pot_temp',
domain='atmos',
description='Virtual potential temperature.',
variables=(temp, p, sphum, liq_wat),
def_time=True,
def_vert=True,
def_lat=True,
def_lon=True,
func=calcs.virt_pot_temp,
units=units.K
)
| 26.686998
| 145
| 0.66785
| 14,465
| 99,756
| 4.312617
| 0.034843
| 0.081802
| 0.04777
| 0.062101
| 0.860697
| 0.814963
| 0.774262
| 0.730002
| 0.695393
| 0.644288
| 0
| 0.004895
| 0.211616
| 99,756
| 3,737
| 146
| 26.69414
| 0.788305
| 0.005774
| 0
| 0.60817
| 0
| 0.000537
| 0.202884
| 0.035093
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.001344
| 0
| 0.001344
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
3afa38386444455359f3ef63483f68db10168c92
| 205
|
py
|
Python
|
inferno/extensions/criteria/__init__.py
|
0h-n0/inferno
|
f466c84ed72ff92f9113891a96ce58e19eeeff1e
|
[
"Apache-2.0"
] | 204
|
2017-10-10T20:58:52.000Z
|
2021-12-07T03:01:19.000Z
|
inferno/extensions/criteria/__init__.py
|
0h-n0/inferno
|
f466c84ed72ff92f9113891a96ce58e19eeeff1e
|
[
"Apache-2.0"
] | 86
|
2017-10-11T11:32:36.000Z
|
2021-11-15T17:47:25.000Z
|
inferno/extensions/criteria/__init__.py
|
0h-n0/inferno
|
f466c84ed72ff92f9113891a96ce58e19eeeff1e
|
[
"Apache-2.0"
] | 30
|
2017-11-16T23:21:30.000Z
|
2021-11-15T15:11:00.000Z
|
from .set_similarity_measures import *
from .elementwise_measures import *
from .core import *
from .regularized import *
__all__ = ['set_similarity_measures', 'elementwise_measures','core','regularized']
| 34.166667
| 82
| 0.795122
| 23
| 205
| 6.652174
| 0.391304
| 0.196078
| 0.27451
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.097561
| 205
| 6
| 82
| 34.166667
| 0.827027
| 0
| 0
| 0
| 0
| 0
| 0.281553
| 0.11165
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.8
| 0
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
d71cf5741b4d76d2223e601744e3000594eff315
| 1,096
|
py
|
Python
|
7_kyu/Printer Errors.py
|
serembon/Codewars-Python-Kata
|
868f9f5deb991b2c0b7e27dce41a5a20805013dc
|
[
"MIT"
] | null | null | null |
7_kyu/Printer Errors.py
|
serembon/Codewars-Python-Kata
|
868f9f5deb991b2c0b7e27dce41a5a20805013dc
|
[
"MIT"
] | null | null | null |
7_kyu/Printer Errors.py
|
serembon/Codewars-Python-Kata
|
868f9f5deb991b2c0b7e27dce41a5a20805013dc
|
[
"MIT"
] | null | null | null |
"""
In a factory a printer prints labels for boxes. For one kind of boxes the printer has to use colors which, for the sake
of simplicity, are named with letters from a to m.
The colors used by the printer are recorded in a control string. For example a "good" control string would be
aaabbbbhaijjjm meaning that the printer used three times color a, four times color b, one time color h then one time
color a...
Sometimes there are problems: lack of colors, technical malfunction and a "bad" control string is produced e.g.
aaaxbbbbyyhwawiwjjjwwm with letters not from a to m.
You have to write a function printer_error which given a string will output the error rate of the printer as a string
representing a rational whose numerator is the number of errors and the denominator the length of the control string.
Don't reduce this fraction to a simpler expression.
The string has a length greater or equal to one and contains only letters from ato z.
"""
# Mya nd best way solution
def printer_error(s):
return "{}/{}".format(len([x for x in s if x not in "abcdefghijklm"]), len(s))
| 43.84
| 119
| 0.768248
| 195
| 1,096
| 4.307692
| 0.533333
| 0.047619
| 0.016667
| 0.019048
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.184307
| 1,096
| 24
| 120
| 45.666667
| 0.939597
| 0.891423
| 0
| 0
| 0
| 0
| 0.162162
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0.5
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 1
|
0
| 5
|
ad21a6b3be83ad7677f48e1bbf8f78a103b5ac27
| 590
|
py
|
Python
|
brewtarget_ssh/database.py
|
eduncan26/brewtarget-ssh
|
a952c98d39bd8f6f418251c3afc816e86d85c7c7
|
[
"Apache-2.0"
] | null | null | null |
brewtarget_ssh/database.py
|
eduncan26/brewtarget-ssh
|
a952c98d39bd8f6f418251c3afc816e86d85c7c7
|
[
"Apache-2.0"
] | null | null | null |
brewtarget_ssh/database.py
|
eduncan26/brewtarget-ssh
|
a952c98d39bd8f6f418251c3afc816e86d85c7c7
|
[
"Apache-2.0"
] | null | null | null |
import sqlite3
class Database:
"""
DB connection and methods
"""
base_recipe_query = 'SELECT * FROM RECIPE'
def __init__(self, connection_str):
self.connection_str = connection_str
def connect(self):
self.connection = sqlite3.connect(self.connection_str)
return self.connection
def disconnect(self):
return self.connection.close()
def get_recipes(self):
return self.connection.execute(self.base_recipe_query).fetchall()
def get_recipe(self, recipe_name):
return self.connection.execute(self.base_recipe_query + ' WHERE name = "' + recipe_name + '"').fetchone()
| 22.692308
| 107
| 0.749153
| 76
| 590
| 5.578947
| 0.368421
| 0.264151
| 0.188679
| 0.113208
| 0.216981
| 0.216981
| 0.216981
| 0.216981
| 0
| 0
| 0
| 0.003929
| 0.137288
| 590
| 25
| 108
| 23.6
| 0.829077
| 0.042373
| 0
| 0
| 0
| 0
| 0.064982
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.357143
| false
| 0
| 0.071429
| 0.214286
| 0.857143
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
ad993274db63cf2ca06b7e161a41e6809efc4ebe
| 2,590
|
py
|
Python
|
test/utils/poly.py
|
ScottWe/symbaudio
|
4797322acf340553cfd71ac3d63d62254735320e
|
[
"Apache-2.0"
] | null | null | null |
test/utils/poly.py
|
ScottWe/symbaudio
|
4797322acf340553cfd71ac3d63d62254735320e
|
[
"Apache-2.0"
] | null | null | null |
test/utils/poly.py
|
ScottWe/symbaudio
|
4797322acf340553cfd71ac3d63d62254735320e
|
[
"Apache-2.0"
] | null | null | null |
import sympy
import sympy.abc
import unittest
import harness
import symbaudio.utils.poly
class TestMaxCoeff(unittest.TestCase):
""" Tests max_coeff with multiple cases in each domain. """
def test_rational(self):
""" Ensures Q works in the rational case. """
p1 = sympy.Poly([1/100, 0, 20, 4, 9], sympy.abc.x, domain="QQ")
p2 = sympy.Poly([0], sympy.abc.x, domain="QQ")
p3 = sympy.Poly([2/11], sympy.abc.x, domain="QQ")
p4 = sympy.Poly([7/2], sympy.abc.x, domain="QQ")
self.assertEqual(symbaudio.utils.poly.max_coeff(p1), 100)
self.assertEqual(symbaudio.utils.poly.max_coeff(p2), 1)
self.assertEqual(symbaudio.utils.poly.max_coeff(p3), 11)
self.assertEqual(symbaudio.utils.poly.max_coeff(p4), 7)
def test_integer(self):
""" Ensures Z works in the integer case. """
p1 = sympy.Poly([1, 5, 3, 7, 3], sympy.abc.x, domain="ZZ")
p2 = sympy.Poly([0], sympy.abc.x, domain="ZZ")
p3 = sympy.Poly([10], sympy.abc.x, domain="ZZ")
self.assertEqual(symbaudio.utils.poly.max_coeff(p1), 7)
self.assertEqual(symbaudio.utils.poly.max_coeff(p2), 0)
self.assertEqual(symbaudio.utils.poly.max_coeff(p3), 10)
def test_finite_field(self):
""" Ensures finite fields work in the finite field case. """
p1 = sympy.Poly([1, 5, 3, 7, 3], sympy.abc.x, domain=sympy.GF(11))
p2 = sympy.Poly([0], sympy.abc.x, domain=sympy.GF(11))
p3 = sympy.Poly([10], sympy.abc.x, domain=sympy.GF(11))
self.assertEqual(symbaudio.utils.poly.max_coeff(p1), 7)
self.assertEqual(symbaudio.utils.poly.max_coeff(p2), 0)
self.assertEqual(symbaudio.utils.poly.max_coeff(p3), 10)
class TestCountZeros(unittest.TestCase):
""" Tests count_zeros in each domain. """
def test_rational(self):
""" Ensures Q works in the rational case. """
p = sympy.Poly([0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0], sympy.abc.x, domain="QQ")
self.assertEqual(symbaudio.utils.poly.count_zeros(p), 5)
def test_integer(self):
""" Ensures Z works in the integer case. """
p = sympy.Poly([0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0], sympy.abc.x, domain="ZZ")
self.assertEqual(symbaudio.utils.poly.count_zeros(p), 5)
def test_finite_field(self):
""" Ensures finite fields work in the finite field case. """
p = sympy.Poly([0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0], sympy.abc.x, domain=sympy.GF(11))
self.assertEqual(symbaudio.utils.poly.count_zeros(p), 5)
if __name__ == '__main__':
unittest.main()
| 43.166667
| 91
| 0.625869
| 400
| 2,590
| 3.975
| 0.1575
| 0.07044
| 0.158491
| 0.122642
| 0.840881
| 0.810692
| 0.808176
| 0.802516
| 0.642138
| 0.634591
| 0
| 0.053685
| 0.20888
| 2,590
| 59
| 92
| 43.898305
| 0.722304
| 0.134363
| 0
| 0.365854
| 0
| 0
| 0.011861
| 0
| 0
| 0
| 0
| 0
| 0.317073
| 1
| 0.146341
| false
| 0
| 0.121951
| 0
| 0.317073
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
d10aaa3a2f4990c3152ec57972a4a291f1127395
| 1,003
|
py
|
Python
|
tests/optimizers/test_rdkit_optimizers.py
|
stevenkbennett/stko
|
b416fccb3ca849151e27846b6b2d5516f5464190
|
[
"MIT"
] | 8
|
2020-06-09T16:59:20.000Z
|
2022-03-18T23:05:38.000Z
|
tests/optimizers/test_rdkit_optimizers.py
|
stevenkbennett/stko
|
b416fccb3ca849151e27846b6b2d5516f5464190
|
[
"MIT"
] | 60
|
2020-05-22T13:38:54.000Z
|
2022-03-25T09:34:22.000Z
|
tests/optimizers/test_rdkit_optimizers.py
|
stevenkbennett/stko
|
b416fccb3ca849151e27846b6b2d5516f5464190
|
[
"MIT"
] | 4
|
2020-12-02T10:39:54.000Z
|
2021-03-01T18:34:07.000Z
|
import stko
from .utilities import (
inequivalent_position_matrices,
is_equivalent_molecule,
)
def test_MMFF_opt(unoptimized_mol):
optimizer = stko.MMFF()
opt_res = optimizer.optimize(unoptimized_mol)
is_equivalent_molecule(opt_res, unoptimized_mol)
inequivalent_position_matrices(opt_res, unoptimized_mol)
def test_UFF_opt(unoptimized_mol):
optimizer = stko.UFF()
opt_res = optimizer.optimize(unoptimized_mol)
is_equivalent_molecule(opt_res, unoptimized_mol)
inequivalent_position_matrices(opt_res, unoptimized_mol)
def test_ETKDG_opt(unoptimized_mol):
optimizer = stko.ETKDG()
opt_res = optimizer.optimize(unoptimized_mol)
is_equivalent_molecule(opt_res, unoptimized_mol)
inequivalent_position_matrices(opt_res, unoptimized_mol)
optimizer = stko.ETKDG(random_seed=2584)
opt_res = optimizer.optimize(unoptimized_mol)
is_equivalent_molecule(opt_res, unoptimized_mol)
inequivalent_position_matrices(opt_res, unoptimized_mol)
| 31.34375
| 60
| 0.795613
| 124
| 1,003
| 6
| 0.193548
| 0.282258
| 0.182796
| 0.215054
| 0.842742
| 0.69086
| 0.69086
| 0.69086
| 0.69086
| 0.69086
| 0
| 0.004603
| 0.133599
| 1,003
| 31
| 61
| 32.354839
| 0.851554
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.125
| false
| 0
| 0.083333
| 0
| 0.208333
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
66fefaa2c82a1ebb48f8da758e8d10fd42037b56
| 236
|
py
|
Python
|
boa3_test/test_sc/interop_test/runtime/CallingScriptHashCantAssign.py
|
hal0x2328/neo3-boa
|
6825a3533384cb01660773050719402a9703065b
|
[
"Apache-2.0"
] | 25
|
2020-07-22T19:37:43.000Z
|
2022-03-08T03:23:55.000Z
|
boa3_test/test_sc/interop_test/runtime/CallingScriptHashCantAssign.py
|
hal0x2328/neo3-boa
|
6825a3533384cb01660773050719402a9703065b
|
[
"Apache-2.0"
] | 419
|
2020-04-23T17:48:14.000Z
|
2022-03-31T13:17:45.000Z
|
boa3_test/test_sc/interop_test/runtime/CallingScriptHashCantAssign.py
|
hal0x2328/neo3-boa
|
6825a3533384cb01660773050719402a9703065b
|
[
"Apache-2.0"
] | 15
|
2020-05-21T21:54:24.000Z
|
2021-11-18T06:17:24.000Z
|
from boa3.builtin.interop.runtime import calling_script_hash
from boa3.builtin.type import UInt160
def Main(example: UInt160) -> UInt160:
global calling_script_hash
calling_script_hash = example
return calling_script_hash
| 26.222222
| 60
| 0.805085
| 32
| 236
| 5.6875
| 0.5
| 0.285714
| 0.373626
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.054455
| 0.144068
| 236
| 8
| 61
| 29.5
| 0.846535
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.333333
| 0
| 0.666667
| 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
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
66ffa7196796ab819c578822ab7d050f28d58f2e
| 153
|
py
|
Python
|
art/detection/subsetscanning/__init__.py
|
virkt25/adversarial-robustness-toolbox
|
3cfa6de196cb32a3efafab2ff6bbf44247c9ddbd
|
[
"MIT"
] | 2
|
2019-11-05T17:23:37.000Z
|
2021-07-26T15:09:44.000Z
|
art/detection/subsetscanning/__init__.py
|
virkt25/adversarial-robustness-toolbox
|
3cfa6de196cb32a3efafab2ff6bbf44247c9ddbd
|
[
"MIT"
] | 1
|
2020-03-09T07:04:39.000Z
|
2020-03-09T07:04:39.000Z
|
art/detection/subsetscanning/__init__.py
|
virkt25/adversarial-robustness-toolbox
|
3cfa6de196cb32a3efafab2ff6bbf44247c9ddbd
|
[
"MIT"
] | 1
|
2019-12-22T22:18:15.000Z
|
2019-12-22T22:18:15.000Z
|
"""
This module implements the fast generalized subset scan based detector.
"""
from art.detection.subsetscanning.detector import SubsetScanningDetector
| 30.6
| 72
| 0.830065
| 17
| 153
| 7.470588
| 0.941176
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.104575
| 153
| 4
| 73
| 38.25
| 0.927007
| 0.464052
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
0f048b264084308a6067cada5a5c9a203186a761
| 2,163
|
py
|
Python
|
tests/aat/api/v1/client/__init__.py
|
saurabh-dua/openperf
|
43fb850725a0afc563a5d75c3395d3de46c3129a
|
[
"Apache-2.0"
] | null | null | null |
tests/aat/api/v1/client/__init__.py
|
saurabh-dua/openperf
|
43fb850725a0afc563a5d75c3395d3de46c3129a
|
[
"Apache-2.0"
] | null | null | null |
tests/aat/api/v1/client/__init__.py
|
saurabh-dua/openperf
|
43fb850725a0afc563a5d75c3395d3de46c3129a
|
[
"Apache-2.0"
] | null | null | null |
# coding: utf-8
# flake8: noqa
"""
OpenPerf API
REST API interface for OpenPerf # noqa: E501
OpenAPI spec version: 1
Contact: support@spirent.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# import apis into sdk package
from client.api.interfaces_api import InterfacesApi
from client.api.modules_api import ModulesApi
from client.api.ports_api import PortsApi
from client.api.stacks_api import StacksApi
# import ApiClient
from client.api_client import ApiClient
from client.configuration import Configuration
# import models into sdk package
from client.models.bulk_create_interfaces_request import BulkCreateInterfacesRequest
from client.models.bulk_create_interfaces_response import BulkCreateInterfacesResponse
from client.models.bulk_delete_interfaces_request import BulkDeleteInterfacesRequest
from client.models.interface import Interface
from client.models.interface_config import InterfaceConfig
from client.models.interface_protocol_config import InterfaceProtocolConfig
from client.models.interface_protocol_config_eth import InterfaceProtocolConfigEth
from client.models.interface_protocol_config_ipv4 import InterfaceProtocolConfigIpv4
from client.models.interface_protocol_config_ipv4_dhcp import InterfaceProtocolConfigIpv4Dhcp
from client.models.interface_protocol_config_ipv4_static import InterfaceProtocolConfigIpv4Static
from client.models.interface_stats import InterfaceStats
from client.models.module import Module
from client.models.module_version import ModuleVersion
from client.models.port import Port
from client.models.port_config import PortConfig
from client.models.port_config_bond import PortConfigBond
from client.models.port_config_dpdk import PortConfigDpdk
from client.models.port_stats import PortStats
from client.models.port_status import PortStatus
from client.models.stack import Stack
from client.models.stack_element_stats import StackElementStats
from client.models.stack_memory_stats import StackMemoryStats
from client.models.stack_protocol_stats import StackProtocolStats
from client.models.stack_stats import StackStats
| 41.596154
| 97
| 0.869163
| 274
| 2,163
| 6.671533
| 0.313869
| 0.164114
| 0.210066
| 0.109409
| 0.216083
| 0.152626
| 0.070569
| 0
| 0
| 0
| 0
| 0.006098
| 0.090153
| 2,163
| 51
| 98
| 42.411765
| 0.922764
| 0.130837
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
0f6a245711226223a016cfc6fa5a59715dcd10f1
| 94
|
py
|
Python
|
py_tdlib/constructors/update_new_message.py
|
Mr-TelegramBot/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 24
|
2018-10-05T13:04:30.000Z
|
2020-05-12T08:45:34.000Z
|
py_tdlib/constructors/update_new_message.py
|
MrMahdi313/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 3
|
2019-06-26T07:20:20.000Z
|
2021-05-24T13:06:56.000Z
|
py_tdlib/constructors/update_new_message.py
|
MrMahdi313/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 5
|
2018-10-05T14:29:28.000Z
|
2020-08-11T15:04:10.000Z
|
from ..factory import Type
class updateNewMessage(Type):
message = None # type: "message"
| 15.666667
| 34
| 0.723404
| 11
| 94
| 6.181818
| 0.727273
| 0.323529
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.170213
| 94
| 5
| 35
| 18.8
| 0.871795
| 0.159574
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
0f77a59bba014bb184b87bd8083d2f9e7c31e7be
| 82
|
py
|
Python
|
python/src/shipping_allocation/envs/__init__.py
|
jotaporras/ts_mcfrl
|
c8c77a8fbd58e80e926e6705320ca8bc1979efdd
|
[
"MIT"
] | null | null | null |
python/src/shipping_allocation/envs/__init__.py
|
jotaporras/ts_mcfrl
|
c8c77a8fbd58e80e926e6705320ca8bc1979efdd
|
[
"MIT"
] | 5
|
2020-09-26T01:26:21.000Z
|
2022-02-10T02:45:51.000Z
|
python/src/shipping_allocation/envs/__init__.py
|
jotaporras/ts_mcfrl
|
c8c77a8fbd58e80e926e6705320ca8bc1979efdd
|
[
"MIT"
] | null | null | null |
from shipping_allocation.envs.network_flow_env import ShippingFacilityEnvironment
| 41
| 81
| 0.926829
| 9
| 82
| 8.111111
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.04878
| 82
| 1
| 82
| 82
| 0.935897
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
7e1632bd27d10d70c690e978c024e9e4ef429ef7
| 57
|
py
|
Python
|
eod/historical_prices/splits_divs_shorts_api/__init__.py
|
gereon/eod-data
|
4286a03cc08bc8b5dc42ebae0bb8eb22bdfa3230
|
[
"Apache-2.0"
] | 19
|
2021-09-18T11:31:45.000Z
|
2022-03-15T20:03:52.000Z
|
eod/historical_prices/splits_divs_shorts_api/__init__.py
|
gereon/eod-data
|
4286a03cc08bc8b5dc42ebae0bb8eb22bdfa3230
|
[
"Apache-2.0"
] | 2
|
2022-02-18T23:37:48.000Z
|
2022-03-01T18:14:06.000Z
|
eod/historical_prices/splits_divs_shorts_api/__init__.py
|
gereon/eod-data
|
4286a03cc08bc8b5dc42ebae0bb8eb22bdfa3230
|
[
"Apache-2.0"
] | 8
|
2021-09-13T16:49:52.000Z
|
2022-03-31T21:09:44.000Z
|
from .hist_splits_divs_shorts import SplitsDividendsShort
| 57
| 57
| 0.929825
| 7
| 57
| 7.142857
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.052632
| 57
| 1
| 57
| 57
| 0.925926
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
7e3c31960fe49ba4957327ef045cd5ac8c64f1b4
| 108
|
py
|
Python
|
isanode/utils.py
|
ShahzadNaser/isanode
|
a33d817b9a9c64b808bef1df04043d7717de5cf5
|
[
"MIT"
] | null | null | null |
isanode/utils.py
|
ShahzadNaser/isanode
|
a33d817b9a9c64b808bef1df04043d7717de5cf5
|
[
"MIT"
] | null | null | null |
isanode/utils.py
|
ShahzadNaser/isanode
|
a33d817b9a9c64b808bef1df04043d7717de5cf5
|
[
"MIT"
] | null | null | null |
import frappe
def after_install():
frappe.db.set_value('System Settings', None, 'app_name', 'Application')
| 27
| 72
| 0.759259
| 15
| 108
| 5.266667
| 0.933333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.092593
| 108
| 4
| 72
| 27
| 0.806122
| 0
| 0
| 0
| 0
| 0
| 0.311927
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| true
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
7e414a484c91ebc768a967fc1ee19b058e939871
| 73
|
py
|
Python
|
user-password.example.py
|
jhsoby/Wikimedia-Commons-uploads
|
ee6920b59b40e615a20fb9a1a0c504ffb78c5ce2
|
[
"MIT"
] | null | null | null |
user-password.example.py
|
jhsoby/Wikimedia-Commons-uploads
|
ee6920b59b40e615a20fb9a1a0c504ffb78c5ce2
|
[
"MIT"
] | 3
|
2018-04-09T09:03:29.000Z
|
2018-12-12T11:12:37.000Z
|
user-password.example.py
|
jhsoby/Wikimedia-Commons-uploads
|
ee6920b59b40e615a20fb9a1a0c504ffb78c5ce2
|
[
"MIT"
] | null | null | null |
(u'ExampleUser', BotPassword(u'ExampleBotSuffix', u'ExampleBotPassword'))
| 73
| 73
| 0.808219
| 7
| 73
| 8.428571
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.027397
| 73
| 1
| 73
| 73
| 0.830986
| 0
| 0
| 0
| 0
| 0
| 0.608108
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
7e41c9938526f361ecc46ed3bfc6da35a706f332
| 57
|
py
|
Python
|
polarmine/decp/__init__.py
|
morpheusthewhite/master-thesis
|
2ab4c0509a119d7b5f332b842a4101470a884351
|
[
"MIT"
] | 1
|
2021-06-15T14:01:29.000Z
|
2021-06-15T14:01:29.000Z
|
polarmine/decp/__init__.py
|
morpheusthewhite/master-thesis
|
2ab4c0509a119d7b5f332b842a4101470a884351
|
[
"MIT"
] | null | null | null |
polarmine/decp/__init__.py
|
morpheusthewhite/master-thesis
|
2ab4c0509a119d7b5f332b842a4101470a884351
|
[
"MIT"
] | null | null | null |
from polarmine.decp.decp_mip_solver import DECPMIPSolver
| 28.5
| 56
| 0.894737
| 8
| 57
| 6.125
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.070175
| 57
| 1
| 57
| 57
| 0.924528
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
0e24d642823acfc392253dfb5c32e57423d5108c
| 58
|
py
|
Python
|
vendor/tree-sitter-python/examples/trailing-whitespace.py
|
Omar-Elrefaei/difftastic
|
cb900c3463caa3ec60f007bb3f8d3e88795b35e6
|
[
"MIT"
] | 146
|
2017-02-13T17:46:27.000Z
|
2022-03-28T03:50:28.000Z
|
vendor/tree-sitter-python/examples/trailing-whitespace.py
|
Omar-Elrefaei/difftastic
|
cb900c3463caa3ec60f007bb3f8d3e88795b35e6
|
[
"MIT"
] | 116
|
2017-04-27T02:47:27.000Z
|
2022-03-30T14:03:47.000Z
|
vendor/tree-sitter-python/examples/trailing-whitespace.py
|
Omar-Elrefaei/difftastic
|
cb900c3463caa3ec60f007bb3f8d3e88795b35e6
|
[
"MIT"
] | 64
|
2017-10-29T04:20:39.000Z
|
2022-03-29T06:56:31.000Z
|
print a
if b:
if c:
d
e
| 8.285714
| 13
| 0.241379
| 8
| 58
| 1.75
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.724138
| 58
| 6
| 14
| 9.666667
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.2
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 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
| 5
|
0e37df8ae6a25322d5e295e82d3dc3114c796fb7
| 208
|
py
|
Python
|
Python/7 - kyu/7 kyu - Alphabetically ordered.py
|
danielbom/codewars
|
d45b5a813c6f1d952a50d22f0b2fcea4ef3d0e27
|
[
"MIT"
] | null | null | null |
Python/7 - kyu/7 kyu - Alphabetically ordered.py
|
danielbom/codewars
|
d45b5a813c6f1d952a50d22f0b2fcea4ef3d0e27
|
[
"MIT"
] | null | null | null |
Python/7 - kyu/7 kyu - Alphabetically ordered.py
|
danielbom/codewars
|
d45b5a813c6f1d952a50d22f0b2fcea4ef3d0e27
|
[
"MIT"
] | null | null | null |
# https://www.codewars.com/kata/alphabetically-ordered/train/python
# My solution
def alphabetic(s):
return sorted(s) == list(s)
# def alphabetic(s):
return all(a<=b for a,b in zip(s, s[1:]))
| 26
| 68
| 0.649038
| 34
| 208
| 3.970588
| 0.705882
| 0.192593
| 0.207407
| 0.296296
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005848
| 0.177885
| 208
| 7
| 69
| 29.714286
| 0.783626
| 0.461538
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
0e513a95afa970745e0fc306ce84827cded8abb9
| 182
|
py
|
Python
|
projects/clusterctrl/src/python/clusterctrl/cmd/led.py
|
arrdem/source
|
df9aae1253ed415ade3a2b59e8a0996ff659543d
|
[
"MIT"
] | 4
|
2021-08-17T15:47:38.000Z
|
2021-10-06T01:59:32.000Z
|
projects/clusterctrl/src/python/clusterctrl/cmd/led.py
|
arrdem/source
|
df9aae1253ed415ade3a2b59e8a0996ff659543d
|
[
"MIT"
] | 8
|
2021-08-14T17:47:08.000Z
|
2021-09-20T20:22:47.000Z
|
projects/clusterctrl/src/python/clusterctrl/cmd/led.py
|
arrdem/source
|
df9aae1253ed415ade3a2b59e8a0996ff659543d
|
[
"MIT"
] | 1
|
2021-10-09T21:24:35.000Z
|
2021-10-09T21:24:35.000Z
|
"""Enable or disable all status LEDs."""
import click
@click.group()
def led():
pass
@led.command("on")
def led_on():
pass
@led.command("off")
def led_off():
pass
| 9.578947
| 40
| 0.60989
| 27
| 182
| 4.037037
| 0.555556
| 0.165138
| 0.256881
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.214286
| 182
| 18
| 41
| 10.111111
| 0.762238
| 0.186813
| 0
| 0.3
| 0
| 0
| 0.035211
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.3
| true
| 0.3
| 0.1
| 0
| 0.4
| 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
| 1
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
0e7ea1c38563a08edfc3579ae1b6ec719dcbfeb2
| 344
|
py
|
Python
|
gaiavision/model_space/model_samplers/__init__.py
|
NickChang97/GAIA-cv
|
b691af89813ffa6a1d1e1719c6dd0ec4c253d2bf
|
[
"Apache-2.0"
] | 49
|
2021-06-21T06:20:40.000Z
|
2022-01-03T14:01:01.000Z
|
gaiavision/model_space/model_samplers/__init__.py
|
NickChang97/GAIA-cv
|
b691af89813ffa6a1d1e1719c6dd0ec4c253d2bf
|
[
"Apache-2.0"
] | null | null | null |
gaiavision/model_space/model_samplers/__init__.py
|
NickChang97/GAIA-cv
|
b691af89813ffa6a1d1e1719c6dd0ec4c253d2bf
|
[
"Apache-2.0"
] | 5
|
2021-07-13T09:52:34.000Z
|
2022-03-21T04:18:39.000Z
|
from .builder import build_model_sampler
from .base_model_sampler import MODEL_SAMPLERS, BaseModelSampler
from .functional_model_sampler import (ConcatModelSampler, CompositeModelSampler,
RepeatModelSampler, AnchorModelSampler)
from .random_model_sampler import (RangeModelSampler, CandidateModelSampler)
| 57.333333
| 81
| 0.787791
| 30
| 344
| 8.733333
| 0.566667
| 0.183206
| 0.206107
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.174419
| 344
| 5
| 82
| 68.8
| 0.922535
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.8
| 0
| 0.8
| 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
| 1
| 0
|
0
| 5
|
7ece609a12cadf4706acf8e2a94f6eda688f1b61
| 87
|
py
|
Python
|
pyaudio_mixer/__init__.py
|
bossauh/pyaudiomixer
|
9fd8f8b893541864ab994472aaae4bac26706d1e
|
[
"MIT"
] | null | null | null |
pyaudio_mixer/__init__.py
|
bossauh/pyaudiomixer
|
9fd8f8b893541864ab994472aaae4bac26706d1e
|
[
"MIT"
] | null | null | null |
pyaudio_mixer/__init__.py
|
bossauh/pyaudiomixer
|
9fd8f8b893541864ab994472aaae4bac26706d1e
|
[
"MIT"
] | null | null | null |
from .output import OutputTrack
from .input import InputTrack
from .mixer import Mixer
| 21.75
| 31
| 0.827586
| 12
| 87
| 6
| 0.583333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.137931
| 87
| 3
| 32
| 29
| 0.96
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
7ed5000dae12f8b2d291ef92f38f0cfa056a5ded
| 165
|
py
|
Python
|
bin/othersPsutilMapper.py
|
SeppPenner/SystemMonitor
|
347a6178ed8d635ff3a9d3ceddd014ba5ca13632
|
[
"MIT"
] | 1
|
2019-03-03T15:08:09.000Z
|
2019-03-03T15:08:09.000Z
|
bin/othersPsutilMapper.py
|
SeppPenner/SystemMonitor
|
347a6178ed8d635ff3a9d3ceddd014ba5ca13632
|
[
"MIT"
] | null | null | null |
bin/othersPsutilMapper.py
|
SeppPenner/SystemMonitor
|
347a6178ed8d635ff3a9d3ceddd014ba5ca13632
|
[
"MIT"
] | null | null | null |
import psutil
class OthersPsutilMapper:
def __init__(self):
pass
def readBootTime(self):
"Reads the system boot time from psutil"
return psutil.boot_time()
| 18.333333
| 42
| 0.763636
| 22
| 165
| 5.5
| 0.727273
| 0.132231
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.163636
| 165
| 9
| 43
| 18.333333
| 0.876812
| 0.230303
| 0
| 0
| 0
| 0
| 0.228916
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0.142857
| 0.142857
| 0
| 0.714286
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
7eeb8fa11e34eb3e458b796ce428acd34a2461c4
| 51
|
py
|
Python
|
__init__.py
|
wwakabobik/openweather_pws
|
bda08b550982b7e3d797a57c23ae97d4d4ececf7
|
[
"MIT"
] | null | null | null |
__init__.py
|
wwakabobik/openweather_pws
|
bda08b550982b7e3d797a57c23ae97d4d4ececf7
|
[
"MIT"
] | null | null | null |
__init__.py
|
wwakabobik/openweather_pws
|
bda08b550982b7e3d797a57c23ae97d4d4ececf7
|
[
"MIT"
] | null | null | null |
from .openweather_pws import Station, Measurements
| 25.5
| 50
| 0.862745
| 6
| 51
| 7.166667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098039
| 51
| 1
| 51
| 51
| 0.934783
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
7efd783ad3b255bcb6c026045fb4e0382344fd69
| 73
|
py
|
Python
|
raha/tools/__init__.py
|
adrianlut/raha
|
027ebeaf0ac4b524dc49df94e7bbc7be4391213d
|
[
"Apache-2.0"
] | 30
|
2019-07-05T12:03:45.000Z
|
2022-03-07T07:44:58.000Z
|
raha/tools/__init__.py
|
adrianlut/raha
|
027ebeaf0ac4b524dc49df94e7bbc7be4391213d
|
[
"Apache-2.0"
] | 1
|
2019-07-05T12:52:58.000Z
|
2019-07-23T09:49:12.000Z
|
raha/tools/__init__.py
|
adrianlut/raha
|
027ebeaf0ac4b524dc49df94e7bbc7be4391213d
|
[
"Apache-2.0"
] | 16
|
2019-04-21T12:28:33.000Z
|
2022-02-28T06:42:36.000Z
|
from .KATARA.katara import *
from .dBoost.dboost.imported_dboost import *
| 36.5
| 44
| 0.808219
| 10
| 73
| 5.8
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.09589
| 73
| 2
| 44
| 36.5
| 0.878788
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
7d16dcc3dc56a57caeb15f13daeed0de033c12a9
| 38
|
py
|
Python
|
os_v4_hek/defs/sily.py
|
holy-crust/reclaimer
|
0aa693da3866ce7999c68d5f71f31a9c932cdb2c
|
[
"MIT"
] | null | null | null |
os_v4_hek/defs/sily.py
|
holy-crust/reclaimer
|
0aa693da3866ce7999c68d5f71f31a9c932cdb2c
|
[
"MIT"
] | null | null | null |
os_v4_hek/defs/sily.py
|
holy-crust/reclaimer
|
0aa693da3866ce7999c68d5f71f31a9c932cdb2c
|
[
"MIT"
] | null | null | null |
from ...os_v3_hek.defs.sily import *
| 19
| 37
| 0.710526
| 7
| 38
| 3.571429
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.030303
| 0.131579
| 38
| 1
| 38
| 38
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
7d1cd37642e00cc6875c4badd48e4c5c79068852
| 81
|
py
|
Python
|
python/testData/types/FunctionTypeCommentInStubs/module.py
|
jnthn/intellij-community
|
8fa7c8a3ace62400c838e0d5926a7be106aa8557
|
[
"Apache-2.0"
] | 2
|
2019-04-28T07:48:50.000Z
|
2020-12-11T14:18:08.000Z
|
python/testData/types/FunctionTypeCommentInStubs/module.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 173
|
2018-07-05T13:59:39.000Z
|
2018-08-09T01:12:03.000Z
|
python/testData/types/FunctionTypeCommentInStubs/module.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 2
|
2020-03-15T08:57:37.000Z
|
2020-04-07T04:48:14.000Z
|
class MyClass(object):
pass
def func():
# type: () -> MyClass
pass
| 10.125
| 25
| 0.54321
| 9
| 81
| 4.888889
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.308642
| 81
| 7
| 26
| 11.571429
| 0.785714
| 0.234568
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| 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
| 1
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
7d401fbc4bb5a74157d6fb4f6949afeefdfdcf27
| 68,968
|
py
|
Python
|
scenarios/SinglePlayer/Modern/New_Russia_1_SSN_Seawolf.py
|
dhanin/friendly-bassoon
|
fafcfd3921805baddc1889dc0ee2fa367ad882f8
|
[
"BSD-3-Clause"
] | 2
|
2021-11-17T10:59:38.000Z
|
2021-11-17T10:59:45.000Z
|
scenarios/SinglePlayer/Modern/New_Russia_1_SSN_Seawolf.py
|
dhanin/nws
|
87a3f24a7887d84b9884635064b48d456b4184e2
|
[
"BSD-3-Clause"
] | null | null | null |
scenarios/SinglePlayer/Modern/New_Russia_1_SSN_Seawolf.py
|
dhanin/nws
|
87a3f24a7887d84b9884635064b48d456b4184e2
|
[
"BSD-3-Clause"
] | null | null | null |
# Created on 12/08/14 05:47:33
from math import *
from random import *
from UnitCommands import *
def CreateScenario(SM):
SM.SetScenarioDescription("""New Russia Part 1: The Lone Wolf\n\nEight weeks ago, the Russian - Ukrainian conflict escalated. Russian \ntroops invaded the Ukraine and overtook all critical facilities in two \nweeks. \n\nFour weeks ago, Russia started massing troops along their border with \nPoland.\n\nThe Crimea is under Russian control for months now and the Russians \nmoved several of their capital ships towards Sevastopol Harbor.\n\nNow it is time for a Silent Hunter to deliver a counter blow, and thus to \nregain the initiative. \n\nIt is time for the fabulous Seawolf SSN. \n\n\n\n\n\n""")
SM.SetScenarioName("""New Russia 1 SSN Seawolf""")
SM.CreateAlliance(1, 'Russia')
SM.SetAllianceDefaultCountry(1, 'Russia')
SM.SetAlliancePlayable(1, 0)
SM.CreateAlliance(2, 'USA')
SM.SetAllianceDefaultCountry(2, 'USA')
SM.SetAlliancePlayable(2, 1)
SM.CreateAlliance(3, 'Neutral Shipping')
SM.SetAllianceDefaultCountry(3, 'Neutral Shipping')
SM.SetAlliancePlayable(3, 0)
SM.SetAllianceRelationship(1, 3, 'Neutral')
SM.SetAllianceRelationship(2, 3, 'Neutral')
SM.SetUserAlliance(2)
SM.SetDateTime(2014,10,17,0,0,0)
SM.SetStartTheater(32.116665, 41.883335) # (lon, lat) in degrees, negative is West or South
SM.SetScenarioLoaded(1)
SM.SetSeaState(3)
SM.SetSVP('0.000000,1515.000000,200.000000,1500.000000,300.000000,1510.000000,500.000000,1520.000000,5000.000000,1600.000000')
####################
SM.SetSimpleBriefing(1, """No briefing found""")
####################
SM.SetSimpleBriefing(2, """TASKING ORDERS FOR CMDR US OPERATIONS\n\nINTELLIGENCE\n\nThe Ukraine has fallen. Russian troops have massed along their border \nwith Poland and are about to attack. \n\nThe Russians must be convinced that attacking Poland would be a bad \nidea and Nato can regain the initiative at will. \n\nThus maybe an all out war can be prevented. \n\nMISSION\n\nYou are to send a strong, but silent message to the Russians.\n\nStrike them in their backyard with our most advanced sub. \n\nAttack their Black Sea Fleet in the Lion's dent close to Sevastopol Harbor. \n\n\nEXECUTION\n\nLocate the Russian SAG, centered around the Slava Class Cruiser \nMoskva. \n\nSink at least two ships, one of them must be the Moskva.\n\nProceed with care, expect heavy resistance. \n\nUse your land based air assets to locate the Russian warships and to \nsupport the Seawolf.\n\n\nCOMMAND AND SIGNAL\n\nSSN 21 Seawolf\n\nEMCON passive.\n\n\n""")
####################
SM.SetSimpleBriefing(3, """No briefing found""")
##############################
### Alliance 1 units
##############################
unit = SM.GetDefaultUnit()
unit.className = 'Pr 1164 Atlant'
unit.unitName = "Moskva"
unit.SetPosition(33.266502, 44.449666, 0.0)
unit.heading = -137.49
unit.speed = 3.0
unit.cost = 0.0
SM.AddUnitToAlliance(unit, 1)
SM.SetUnitLauncherItem(unit.unitName, 0, '5V55RM', 64)
SM.SetUnitLauncherItem(unit.unitName, 1, '9M33M', 20)
SM.SetUnitLauncherItem(unit.unitName, 2, '9M33M', 20)
SM.SetUnitLauncherItem(unit.unitName, 3, '130mm F-44 HE', 100)
SM.SetUnitLauncherItem(unit.unitName, 4, '30mm OF-84 HE-FRAG AK-630M', 59)
SM.SetUnitLauncherItem(unit.unitName, 5, '30mm OF-84 HE-FRAG AK-630M', 59)
SM.SetUnitLauncherItem(unit.unitName, 6, '30mm OF-84 HE-FRAG AK-630M', 59)
SM.SetUnitLauncherItem(unit.unitName, 7, '30mm OF-84 HE-FRAG AK-630M', 59)
SM.SetUnitLauncherItem(unit.unitName, 8, '30mm OF-84 HE-FRAG AK-630M', 59)
SM.SetUnitLauncherItem(unit.unitName, 9, '30mm OF-84 HE-FRAG AK-630M', 59)
SM.SetUnitLauncherItem(unit.unitName, 10, '53-56', 5)
SM.SetUnitLauncherItem(unit.unitName, 11, '53-56', 5)
SM.SetUnitLauncherItem(unit.unitName, 12, '3M45 Granit', 16)
UI = SM.GetUnitInterface(unit.unitName)
SM.AddToUnitMagazine("Moskva", 'AT-1', 28)
SM.AddToUnitMagazine("Moskva", 'DICASS (105) Sonobuoy', 201)
SM.AddToUnitMagazine("Moskva", 'DIFAR (105) Sonobuoy', 490)
SM.AddToUnitMagazine("Moskva", 'Fuel', 68850)
SM.AddToUnitMagazine("Moskva", 'LOFAR (105) Sonobuoy', 175)
SM.AddToUnitMagazine("Moskva", '30mm OF-84 HE-FRAG AK-630M', 1416)
SM.AddToUnitMagazine("Moskva", '130mm F-44 HE', 500)
SM.AddToUnitMagazine("Moskva", '53-65M', 30)
UI.AddTask('EngageAll', 2.000000, 0)
UI.AddTask('MissileWarning', 3.000000, 3)
UI.AddTask('Nav', 1.000000, 0)
UI.AddNavWaypointAdvanced(0.576273, 0.775771, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.583167, 0.772199, 0.000000, 0.000000)
UI.SetNavLoopState(1)
UI.AddTask('PointDefense', 3.000000, 3)
UI.AddTask('RefuelAllAircraft', 3.000000, 3)
BB = UI.GetBlackboardInterface()
BB.Write('129_EngageLimit', '1')
BB.Write('16_EngageLimit', '4')
BB.Write('17_EngageLimit', '6')
BB.Write('18_EngageLimit', '12')
BB.Write('22_EngageLimit', '24')
BB.Write('256_EngageLimit', '2')
BB.Write('257_EngageLimit', '24')
BB.Write('258_EngageLimit', '2')
BB.Write('32_EngageLimit', '1')
BB.Write('33_EngageLimit', '1')
BB.Write('34_EngageLimit', '1')
BB.Write('64_EngageLimit', '1')
BB.Write('ID_EngageLimit', '{"15.0": 0.0, "12.0": 0.0, "14.0": 0.0, "13.0": 0.0, "16.0": 0.0}')
BB.Write('MissionTarget', '["Target", 14]')
BB.Write('Selected', '{"RotaryWing": 2, "Speed-": 100, "Alt+": 4000.0, "Speed+": 10, "RadarMast+": 0, "RadarMast-": 1, "34_EngageLimit": "1", "257_EngageLimit": "24", "17_EngageLimit": "6", "UnitCount": 9, "HasECM": 0, "HasTarget": 0, "TargetDatum": 0, "Alliance0_EngageLimit": -1, "FixedLand": 1, "Launchers": 1, "Periscope-": 1, "FixedWing": 0, "MagWeaponList": {"9M32M Strela 3": 6, "AT-2M": 0, "TEST-68": 0, "TEST-71ME": 0, "AT-1": 0, "RPK-6 Vodopod": 0, "SAET-60M": 0, "9M311 Kashtan": 96, "130mm F-44 HE": 1000, "*DICASS*": 0, "SET-65M": 120, "*buoy": 0, "100mm OF-58 FRAG": 1400, "9M330 Kinzhal": 0, "3M80 Moskit": 0, "TEST-71MKE": 0, "3M45 Granit": 0, "V-611": 0, "30mm OP-84 FRAG Tracer AK-630M": 0, "Yu-7": 0, "Yu-6": 0, "130mm ZS-44 AA": 0, "RPK-3 Metel": 0, "SET-65": 0, "TEST-71": 0, "53-56V": 0, "5V55RM": 0, "APR-2E": 0, "3M10 Granat(n)": 0, "3M10 Granat": 0, "*LOFAR*": 0, "*DIFAR*": 0, "30mm OF-84 HE-FRAG AK-630M": 13216, "76.2mm OS-62 FRAG": 0, "9M33M": 0, "53-56": 0, "100mm ZS-58 AA": 0, "130mm ZS-44P AA": 0, "3M54E Klub Alfa": 0, "76.2mm ZS-63 AA": 0, "100mm ZS-58P AA": 0, "53-65KE": 0, "3M80M Moskit-M": 0, "USET-80": 0, "VTT-1": 0, "Shkval": 0, "53-65M": 224}, "Air": 2, "64_EngageLimit": "1", "HasAIWeap": 0, "18_EngageLimit": "12", "256_EngageLimit": "2", "Depth+": 250.0, "MobileLand": 0, "CanStrafe": 0, "Depth-": 0, "HasSonarP": 1, "HasThrottle": 0, "PeriDeep": 0, "Sub": 2, "HasSonarA": 1, "HasFlightPort": 1, "HasMagazine": 1, "DieselSub": 1, "HasGBU": 0, "HasAINav": 0, "FormMember": 2, "Alliance1_EngageLimit": -1, "HasBombs": 0, "Snorkel-": 1, "TargetTrack": 1, "Snorkel+": 0, "16_EngageLimit": "4", "Alliance2_EngageLimit": -1, "258_EngageLimit": "2", "FormLeader": 1, "129_EngageLimit": "1", "HasESM": 1, "Periscope+": 0, "22_EngageLimit": "24", "FormModeSprint": 2, "32_EngageLimit": "1", "Tasks": {"Nav": 5, "PatrolCircle": 1, "EngageAll": 8}, "HasOptical": 1, "33_EngageLimit": "1", "HasRadar": 1, "Ship": 4, "TargetSet": 1, "FormModePace": 0, "WeaponList": {"APR-2E": [4, 4], "9M330 Kinzhal": [64, 64], "DICASS (105) Sonobuoy": [10, 10], "9M32M Strela 3": [1, 1], "3M80 Moskit": [8, 8], "5V55RM": [64, 64], "9M311 Kashtan": [16, 16], "3M45 Granit": [16, 16], "3M10 Granat": [1, 1], "DIFAR (105) Sonobuoy": [15, 15], "SET-65M": [7, 7], "130mm F-44 HE": [200, 200], "V-611": [72, 72], "LOFAR (105) Sonobuoy": [5, 5], "30mm OF-84 HE-FRAG AK-630M": [708, 708], "76.2mm OS-62 FRAG": [500, 500], "9M33M": [120, 120], "53-56": [20, 20], "100mm OF-58 FRAG": [92, 92], "53-65M": [16, 16], "RPK-3 Metel": [12, 12]}}')
SM.AddUnitToFlightDeck('Moskva', 'Ka-27A', 'Atlant Ka-27 101', 1)
SM.SetFlightDeckUnitLoadout('Moskva', 'Atlant Ka-27 101', '5 DIFAR (100) Sonobuoy;5 DICASS (100) Sonobuoy;5 LOFAR (100) Sonobuoy;2 APR-2E;')
FP = UI.GetFlightPortInfo()
base_track = UI.GetTrackById(UI.GetPlatformId())
mission_id = FP.AddGenericMission()
FP.AddAircraftToMission(mission_id, 'Atlant Ka-27 101')
FP.SetMissionLaunchTime(mission_id, '01:00:00+0m+R1.0')
FP.SetMissionDatum(mission_id, 0.0000000, 0.0000000)
FP.SetMissionLandingTarget(mission_id, '')
FP.SetMissionWaveQuantity(mission_id, 1)
FP.SetMissionType(mission_id, 'ASW-Helo')
FP.SetMissionPatrolArea(mission_id, '-0.0015771,0.0020704,-0.0033946,0.0029715,0.0028799,0.0031142,0.0014214,0.0021586,')
FP.SetMissionPatrolAnchor(mission_id, 'Moskva', 2)
FP.AddMissionWaypointAdvanced(mission_id, 0.5816100, 0.7767930, 2000.0, 200.0)
FP.SetMissionWaypointTasks(mission_id, 0, 'WaitForGroup,EngageAll')
FP.AddMissionWaypointAdvanced(mission_id, 0.5802787, 0.7732011, 3000.0, 300.0)
FP.SetMissionWaypointTasks(mission_id, 1, 'AirPatrolArea,EngageAll')
unit = SM.GetDefaultUnit()
unit.className = 'Pr 641B Som'
unit.unitName = "B-380 Gorkovsky Komsomolets"
boxes = [[32.2834, 33.0489, 43.6710, 43.9938]]
box = boxes[int(1*random())]
lon_deg = random()*(box[1]-box[0]) + box[0]
lat_deg = random()*(box[3]-box[2]) + box[2]
unit.SetPosition(lon_deg, lat_deg, -100.0)
unit.heading = 222.27
unit.speed = 3.0
unit.cost = 0.0
SM.AddUnitToAlliance(unit, 1)
SM.SetUnitLauncherItem(unit.unitName, 0, 'SET-65M', 1)
SM.SetUnitLauncherItem(unit.unitName, 1, 'SET-65M', 1)
SM.SetUnitLauncherItem(unit.unitName, 2, 'SET-65M', 1)
SM.SetUnitLauncherItem(unit.unitName, 3, 'SET-65M', 1)
SM.SetUnitLauncherItem(unit.unitName, 4, '53-65M', 1)
SM.SetUnitLauncherItem(unit.unitName, 5, '53-65M', 1)
UI = SM.GetUnitInterface(unit.unitName)
SM.AddToUnitMagazine("B-380 Gorkovsky Komsomolets", '53-65M', 6)
SM.AddToUnitMagazine("B-380 Gorkovsky Komsomolets", 'SET-65M', 12)
UI.SetSensorState(0, 0)
UI.SetSensorState(4, 0)
UI.AddTask('AvoidCav', 3.000000, 3)
UI.AddTask('EngageAll', 2.000000, 0)
UI.AddTask('Nav', 1.000000, 0)
UI.AddNavWaypointAdvanced(0.562933, 0.768069, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.575766, 0.762650, 0.000000, 0.000000)
UI.SetNavLoopState(1)
UI.AddTask('SubBattery', 4.000000, 3)
UI.AddTask('SubEvade', 3.000000, 3)
BB = UI.GetBlackboardInterface()
BB.Write('129_EngageLimit', '1')
BB.Write('16_EngageLimit', '4')
BB.Write('17_EngageLimit', '6')
BB.Write('18_EngageLimit', '12')
BB.Write('22_EngageLimit', '24')
BB.Write('256_EngageLimit', '2')
BB.Write('257_EngageLimit', '24')
BB.Write('258_EngageLimit', '2')
BB.Write('32_EngageLimit', '1')
BB.Write('33_EngageLimit', '1')
BB.Write('34_EngageLimit', '1')
BB.Write('64_EngageLimit', '1')
BB.Write('ID_EngageLimit', '{"15.0": 0.0, "12.0": 0.0, "14.0": 0.0, "13.0": 0.0, "16.0": 0.0}')
BB.Write('MissionTarget', '["Target", 14]')
BB.Write('Selected', '{"RotaryWing": 2, "Speed-": 100, "Alt+": 4000.0, "Speed+": 10, "RadarMast+": 0, "RadarMast-": 1, "34_EngageLimit": "1", "257_EngageLimit": "24", "17_EngageLimit": "6", "UnitCount": 9, "HasECM": 0, "HasTarget": 0, "TargetDatum": 0, "Alliance0_EngageLimit": -1, "FixedLand": 1, "Launchers": 1, "Periscope-": 1, "FixedWing": 0, "MagWeaponList": {"9M32M Strela 3": 6, "AT-2M": 0, "TEST-68": 0, "TEST-71ME": 0, "AT-1": 0, "RPK-6 Vodopod": 0, "SAET-60M": 0, "9M311 Kashtan": 96, "130mm F-44 HE": 1000, "*DICASS*": 0, "SET-65M": 120, "*buoy": 0, "100mm OF-58 FRAG": 1400, "9M330 Kinzhal": 0, "3M80 Moskit": 0, "TEST-71MKE": 0, "3M45 Granit": 0, "V-611": 0, "30mm OP-84 FRAG Tracer AK-630M": 0, "Yu-7": 0, "Yu-6": 0, "130mm ZS-44 AA": 0, "RPK-3 Metel": 0, "SET-65": 0, "TEST-71": 0, "53-56V": 0, "5V55RM": 0, "APR-2E": 0, "3M10 Granat(n)": 0, "3M10 Granat": 0, "*LOFAR*": 0, "*DIFAR*": 0, "30mm OF-84 HE-FRAG AK-630M": 13216, "76.2mm OS-62 FRAG": 0, "9M33M": 0, "53-56": 0, "100mm ZS-58 AA": 0, "130mm ZS-44P AA": 0, "3M54E Klub Alfa": 0, "76.2mm ZS-63 AA": 0, "100mm ZS-58P AA": 0, "53-65KE": 0, "3M80M Moskit-M": 0, "USET-80": 0, "VTT-1": 0, "Shkval": 0, "53-65M": 224}, "Air": 2, "64_EngageLimit": "1", "HasAIWeap": 0, "18_EngageLimit": "12", "256_EngageLimit": "2", "Depth+": 250.0, "MobileLand": 0, "CanStrafe": 0, "Depth-": 0, "HasSonarP": 1, "HasThrottle": 0, "PeriDeep": 0, "Sub": 2, "HasSonarA": 1, "HasFlightPort": 1, "HasMagazine": 1, "DieselSub": 1, "HasGBU": 0, "HasAINav": 0, "FormMember": 2, "Alliance1_EngageLimit": -1, "HasBombs": 0, "Snorkel-": 1, "TargetTrack": 1, "Snorkel+": 0, "16_EngageLimit": "4", "Alliance2_EngageLimit": -1, "258_EngageLimit": "2", "FormLeader": 1, "129_EngageLimit": "1", "HasESM": 1, "Periscope+": 0, "22_EngageLimit": "24", "FormModeSprint": 2, "32_EngageLimit": "1", "Tasks": {"Nav": 5, "PatrolCircle": 1, "EngageAll": 8}, "HasOptical": 1, "33_EngageLimit": "1", "HasRadar": 1, "Ship": 4, "TargetSet": 1, "FormModePace": 0, "WeaponList": {"APR-2E": [4, 4], "9M330 Kinzhal": [64, 64], "DICASS (105) Sonobuoy": [10, 10], "9M32M Strela 3": [1, 1], "3M80 Moskit": [8, 8], "5V55RM": [64, 64], "9M311 Kashtan": [16, 16], "3M45 Granit": [16, 16], "3M10 Granat": [1, 1], "DIFAR (105) Sonobuoy": [15, 15], "SET-65M": [7, 7], "130mm F-44 HE": [200, 200], "V-611": [72, 72], "LOFAR (105) Sonobuoy": [5, 5], "30mm OF-84 HE-FRAG AK-630M": [708, 708], "76.2mm OS-62 FRAG": [500, 500], "9M33M": [120, 120], "53-56": [20, 20], "100mm OF-58 FRAG": [92, 92], "53-65M": [16, 16], "RPK-3 Metel": [12, 12]}}')
unit = SM.GetDefaultUnit()
unit.className = 'Pr 877V Alrossa'
unit.unitName = "B-871 Alrossa"
boxes = [[31.9861, 32.3177, 43.1599, 43.3017]]
box = boxes[int(1*random())]
lon_deg = random()*(box[1]-box[0]) + box[0]
lat_deg = random()*(box[3]-box[2]) + box[2]
unit.SetPosition(lon_deg, lat_deg, -150.0)
unit.heading = 213.69
unit.speed = 3.0
unit.cost = 0.0
SM.AddUnitToAlliance(unit, 1)
SM.SetUnitLauncherItem(unit.unitName, 0, '9M32M Strela 3', 1)
SM.SetUnitLauncherItem(unit.unitName, 1, 'SET-65M', 1)
SM.SetUnitLauncherItem(unit.unitName, 2, 'SET-65M', 1)
SM.SetUnitLauncherItem(unit.unitName, 3, 'SET-65M', 1)
SM.SetUnitLauncherItem(unit.unitName, 4, '53-65M', 1)
SM.SetUnitLauncherItem(unit.unitName, 5, '53-65M', 1)
SM.SetUnitLauncherItem(unit.unitName, 6, '3M10 Granat', 1)
UI = SM.GetUnitInterface(unit.unitName)
SM.AddToUnitMagazine("B-871 Alrossa", '53-65M', 4)
SM.AddToUnitMagazine("B-871 Alrossa", 'SET-65M', 8)
SM.AddToUnitMagazine("B-871 Alrossa", '9M32M Strela 3', 6)
UI.SetSensorState(0, 0)
UI.SetSensorState(4, 0)
UI.AddTask('AvoidCav', 3.000000, 3)
UI.AddTask('EngageAll', 2.000000, 0)
UI.AddTask('Nav', 1.000000, 0)
UI.AddNavWaypointAdvanced(0.554453, 0.760482, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.569349, 0.754730, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.563506, 0.765401, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.579662, 0.763483, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.573818, 0.771487, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.581151, 0.770903, 0.000000, 0.000000)
UI.SetNavLoopState(1)
UI.AddTask('SubBattery', 4.000000, 3)
UI.AddTask('SubEvade', 3.000000, 3)
BB = UI.GetBlackboardInterface()
BB.Write('129_EngageLimit', '1')
BB.Write('16_EngageLimit', '4')
BB.Write('17_EngageLimit', '6')
BB.Write('18_EngageLimit', '12')
BB.Write('22_EngageLimit', '24')
BB.Write('256_EngageLimit', '2')
BB.Write('257_EngageLimit', '24')
BB.Write('258_EngageLimit', '2')
BB.Write('32_EngageLimit', '1')
BB.Write('33_EngageLimit', '1')
BB.Write('34_EngageLimit', '1')
BB.Write('64_EngageLimit', '1')
BB.Write('ID_EngageLimit', '{"15.0": 0.0, "12.0": 0.0, "14.0": 0.0, "13.0": 0.0, "16.0": 0.0}')
BB.Write('MissionTarget', '["Target", 14]')
BB.Write('Selected', '{"RotaryWing": 2, "Speed-": 100, "Alt+": 4000.0, "Speed+": 10, "RadarMast+": 0, "RadarMast-": 1, "34_EngageLimit": "1", "257_EngageLimit": "24", "17_EngageLimit": "6", "UnitCount": 9, "HasECM": 0, "HasTarget": 0, "TargetDatum": 0, "Alliance0_EngageLimit": -1, "FixedLand": 1, "Launchers": 1, "Periscope-": 1, "FixedWing": 0, "MagWeaponList": {"9M32M Strela 3": 6, "AT-2M": 0, "TEST-68": 0, "TEST-71ME": 0, "AT-1": 0, "RPK-6 Vodopod": 0, "SAET-60M": 0, "9M311 Kashtan": 96, "130mm F-44 HE": 1000, "*DICASS*": 0, "SET-65M": 120, "*buoy": 0, "100mm OF-58 FRAG": 1400, "9M330 Kinzhal": 0, "3M80 Moskit": 0, "TEST-71MKE": 0, "3M45 Granit": 0, "V-611": 0, "30mm OP-84 FRAG Tracer AK-630M": 0, "Yu-7": 0, "Yu-6": 0, "130mm ZS-44 AA": 0, "RPK-3 Metel": 0, "SET-65": 0, "TEST-71": 0, "53-56V": 0, "5V55RM": 0, "APR-2E": 0, "3M10 Granat(n)": 0, "3M10 Granat": 0, "*LOFAR*": 0, "*DIFAR*": 0, "30mm OF-84 HE-FRAG AK-630M": 13216, "76.2mm OS-62 FRAG": 0, "9M33M": 0, "53-56": 0, "100mm ZS-58 AA": 0, "130mm ZS-44P AA": 0, "3M54E Klub Alfa": 0, "76.2mm ZS-63 AA": 0, "100mm ZS-58P AA": 0, "53-65KE": 0, "3M80M Moskit-M": 0, "USET-80": 0, "VTT-1": 0, "Shkval": 0, "53-65M": 224}, "Air": 2, "64_EngageLimit": "1", "HasAIWeap": 0, "18_EngageLimit": "12", "256_EngageLimit": "2", "Depth+": 250.0, "MobileLand": 0, "CanStrafe": 0, "Depth-": 0, "HasSonarP": 1, "HasThrottle": 0, "PeriDeep": 0, "Sub": 2, "HasSonarA": 1, "HasFlightPort": 1, "HasMagazine": 1, "DieselSub": 1, "HasGBU": 0, "HasAINav": 0, "FormMember": 2, "Alliance1_EngageLimit": -1, "HasBombs": 0, "Snorkel-": 1, "TargetTrack": 1, "Snorkel+": 0, "16_EngageLimit": "4", "Alliance2_EngageLimit": -1, "258_EngageLimit": "2", "FormLeader": 1, "129_EngageLimit": "1", "HasESM": 1, "Periscope+": 0, "22_EngageLimit": "24", "FormModeSprint": 2, "32_EngageLimit": "1", "Tasks": {"Nav": 5, "PatrolCircle": 1, "EngageAll": 8}, "HasOptical": 1, "33_EngageLimit": "1", "HasRadar": 1, "Ship": 4, "TargetSet": 1, "FormModePace": 0, "WeaponList": {"APR-2E": [4, 4], "9M330 Kinzhal": [64, 64], "DICASS (105) Sonobuoy": [10, 10], "9M32M Strela 3": [1, 1], "3M80 Moskit": [8, 8], "5V55RM": [64, 64], "9M311 Kashtan": [16, 16], "3M45 Granit": [16, 16], "3M10 Granat": [1, 1], "DIFAR (105) Sonobuoy": [15, 15], "SET-65M": [7, 7], "130mm F-44 HE": [200, 200], "V-611": [72, 72], "LOFAR (105) Sonobuoy": [5, 5], "30mm OF-84 HE-FRAG AK-630M": [708, 708], "76.2mm OS-62 FRAG": [500, 500], "9M33M": [120, 120], "53-56": [20, 20], "100mm OF-58 FRAG": [92, 92], "53-65M": [16, 16], "RPK-3 Metel": [12, 12]}}')
unit = SM.GetDefaultUnit()
unit.className = 'Pr 11551 Fregat-M'
unit.unitName = "Admiral Chabanenko"
boxes = [[31.4026, 31.7581, 43.3295, 43.3669]]
box = boxes[int(1*random())]
lon_deg = random()*(box[1]-box[0]) + box[0]
lat_deg = random()*(box[3]-box[2]) + box[2]
unit.SetPosition(lon_deg, lat_deg, 0.0)
unit.heading = -135.00
unit.speed = 15.9
unit.cost = 0.0
SM.AddUnitToAlliance(unit, 1)
SM.SetUnitLauncherItem(unit.unitName, 0, '130mm F-44 HE', 100)
SM.SetUnitLauncherItem(unit.unitName, 1, '53-65M', 4)
SM.SetUnitLauncherItem(unit.unitName, 2, '53-65M', 4)
SM.SetUnitLauncherItem(unit.unitName, 3, '30mm OF-84 HE-FRAG AK-630M', 59)
SM.SetUnitLauncherItem(unit.unitName, 4, '30mm OF-84 HE-FRAG AK-630M', 59)
SM.SetUnitLauncherItem(unit.unitName, 5, '9M311 Kashtan', 8)
SM.SetUnitLauncherItem(unit.unitName, 6, '9M311 Kashtan', 8)
SM.SetUnitLauncherItem(unit.unitName, 7, '9M330 Kinzhal', 64)
SM.SetUnitLauncherItem(unit.unitName, 8, '3M80 Moskit', 8)
UI = SM.GetUnitInterface(unit.unitName)
SM.AddToUnitMagazine("Admiral Chabanenko", 'Fuel', 45900)
SM.AddToUnitMagazine("Admiral Chabanenko", 'LOFAR (100) Sonobuoy', 5)
SM.AddToUnitMagazine("Admiral Chabanenko", 'DICASS (105) Sonobuoy', 10)
SM.AddToUnitMagazine("Admiral Chabanenko", 'DIFAR (110) Sonobuoy', 6)
SM.AddToUnitMagazine("Admiral Chabanenko", 'DICASS (110) Sonobuoy', 20)
SM.AddToUnitMagazine("Admiral Chabanenko", 'LOFAR (110) Sonobuoy', 20)
SM.AddToUnitMagazine("Admiral Chabanenko", 'AT-1', 16)
SM.AddToUnitMagazine("Admiral Chabanenko", '30mm OF-84 HE-FRAG AK-630M', 472)
SM.AddToUnitMagazine("Admiral Chabanenko", '9M311 Kashtan', 48)
SM.AddToUnitMagazine("Admiral Chabanenko", '130mm F-44 HE', 500)
SM.AddToUnitMagazine("Admiral Chabanenko", '53-65M', 24)
UI.AddTask('EngageAll', 2.000000, 0)
UI.AddTask('MissileWarning', 3.000000, 3)
UI.AddTask('PointDefense', 3.000000, 3)
UI.AddTask('RefuelAllAircraft', 3.000000, 3)
BB = UI.GetBlackboardInterface()
BB.Write('129_EngageLimit', '1')
BB.Write('16_EngageLimit', '4')
BB.Write('17_EngageLimit', '6')
BB.Write('18_EngageLimit', '12')
BB.Write('22_EngageLimit', '24')
BB.Write('256_EngageLimit', '2')
BB.Write('257_EngageLimit', '24')
BB.Write('258_EngageLimit', '2')
BB.Write('32_EngageLimit', '1')
BB.Write('33_EngageLimit', '1')
BB.Write('34_EngageLimit', '1')
BB.Write('64_EngageLimit', '1')
BB.Write('ID_EngageLimit', '{"15.0": 0.0, "12.0": 0.0, "14.0": 0.0, "13.0": 0.0, "16.0": 0.0}')
BB.Write('MissionTarget', '["Target", 14]')
BB.Write('Selected', '{"RotaryWing": 2, "Speed-": 100, "Alt+": 4000.0, "Speed+": 10, "RadarMast+": 0, "RadarMast-": 1, "34_EngageLimit": "1", "257_EngageLimit": "24", "17_EngageLimit": "6", "UnitCount": 9, "HasECM": 0, "HasTarget": 0, "TargetDatum": 0, "Alliance0_EngageLimit": -1, "FixedLand": 1, "Launchers": 1, "Periscope-": 1, "FixedWing": 0, "MagWeaponList": {"9M32M Strela 3": 6, "AT-2M": 0, "TEST-68": 0, "TEST-71ME": 0, "AT-1": 0, "RPK-6 Vodopod": 0, "SAET-60M": 0, "9M311 Kashtan": 96, "130mm F-44 HE": 1000, "*DICASS*": 0, "SET-65M": 120, "*buoy": 0, "100mm OF-58 FRAG": 1400, "9M330 Kinzhal": 0, "3M80 Moskit": 0, "TEST-71MKE": 0, "3M45 Granit": 0, "V-611": 0, "30mm OP-84 FRAG Tracer AK-630M": 0, "Yu-7": 0, "Yu-6": 0, "130mm ZS-44 AA": 0, "RPK-3 Metel": 0, "SET-65": 0, "TEST-71": 0, "53-56V": 0, "5V55RM": 0, "APR-2E": 0, "3M10 Granat(n)": 0, "3M10 Granat": 0, "*LOFAR*": 0, "*DIFAR*": 0, "30mm OF-84 HE-FRAG AK-630M": 13216, "76.2mm OS-62 FRAG": 0, "9M33M": 0, "53-56": 0, "100mm ZS-58 AA": 0, "130mm ZS-44P AA": 0, "3M54E Klub Alfa": 0, "76.2mm ZS-63 AA": 0, "100mm ZS-58P AA": 0, "53-65KE": 0, "3M80M Moskit-M": 0, "USET-80": 0, "VTT-1": 0, "Shkval": 0, "53-65M": 224}, "Air": 2, "64_EngageLimit": "1", "HasAIWeap": 0, "18_EngageLimit": "12", "256_EngageLimit": "2", "Depth+": 250.0, "MobileLand": 0, "CanStrafe": 0, "Depth-": 0, "HasSonarP": 1, "HasThrottle": 0, "PeriDeep": 0, "Sub": 2, "HasSonarA": 1, "HasFlightPort": 1, "HasMagazine": 1, "DieselSub": 1, "HasGBU": 0, "HasAINav": 0, "FormMember": 2, "Alliance1_EngageLimit": -1, "HasBombs": 0, "Snorkel-": 1, "TargetTrack": 1, "Snorkel+": 0, "16_EngageLimit": "4", "Alliance2_EngageLimit": -1, "258_EngageLimit": "2", "FormLeader": 1, "129_EngageLimit": "1", "HasESM": 1, "Periscope+": 0, "22_EngageLimit": "24", "FormModeSprint": 2, "32_EngageLimit": "1", "Tasks": {"Nav": 5, "PatrolCircle": 1, "EngageAll": 8}, "HasOptical": 1, "33_EngageLimit": "1", "HasRadar": 1, "Ship": 4, "TargetSet": 1, "FormModePace": 0, "WeaponList": {"APR-2E": [4, 4], "9M330 Kinzhal": [64, 64], "DICASS (105) Sonobuoy": [10, 10], "9M32M Strela 3": [1, 1], "3M80 Moskit": [8, 8], "5V55RM": [64, 64], "9M311 Kashtan": [16, 16], "3M45 Granit": [16, 16], "3M10 Granat": [1, 1], "DIFAR (105) Sonobuoy": [15, 15], "SET-65M": [7, 7], "130mm F-44 HE": [200, 200], "V-611": [72, 72], "LOFAR (105) Sonobuoy": [5, 5], "30mm OF-84 HE-FRAG AK-630M": [708, 708], "76.2mm OS-62 FRAG": [500, 500], "9M33M": [120, 120], "53-56": [20, 20], "100mm OF-58 FRAG": [92, 92], "53-65M": [16, 16], "RPK-3 Metel": [12, 12]}}')
SM.AddUnitToFlightDeck('Admiral Chabanenko', 'Ka-27A', 'Fregat-M Ka-27 2', 1)
SM.SetFlightDeckUnitLoadout('Admiral Chabanenko', 'Fregat-M Ka-27 2', '5 DIFAR (110) Sonobuoy;5 LOFAR (100) Sonobuoy;5 DICASS (100) Sonobuoy;2 APR-2E;')
unit = SM.GetDefaultUnit()
unit.className = 'Airstrip'
unit.unitName = "Sevastopol AB"
unit.SetPosition(33.572501, 44.688333, -0.0)
unit.heading = 270.00
unit.speed = 0.0
unit.cost = 20000000.0
SM.AddUnitToAlliance(unit, 1)
UI = SM.GetUnitInterface(unit.unitName)
SM.AddToUnitMagazine("Sevastopol AB", 'Fuel', 1000000)
SM.AddToUnitMagazine("Sevastopol AB", 'AT-2M', 50)
SM.AddToUnitMagazine("Sevastopol AB", 'DIFAR (105) Sonobuoy', 200)
SM.AddToUnitMagazine("Sevastopol AB", 'LOFAR (105) Sonobuoy', 400)
SM.AddToUnitMagazine("Sevastopol AB", 'DICASS (105) Sonobuoy', 166)
SM.AddToUnitMagazine("Sevastopol AB", '1150 Liter Tank', 62)
SM.AddToUnitMagazine("Sevastopol AB", '1520 Liter Tank', 44)
SM.AddToUnitMagazine("Sevastopol AB", 'R-27R', 124)
SM.AddToUnitMagazine("Sevastopol AB", 'R-73M', 50)
SM.AddToUnitMagazine("Sevastopol AB", '30mm NR-30 HEI', 80)
SM.AddToUnitMagazine("Sevastopol AB", 'Chaff-1', 120)
SM.AddToUnitMagazine("Sevastopol AB", 'Flare-1', 20)
SM.AddToUnitMagazine("Sevastopol AB", 'R-73M2', 138)
SM.AddToUnitMagazine("Sevastopol AB", 'R-77', 202)
SM.AddToUnitMagazine("Sevastopol AB", 'R-27RE', 38)
SM.AddToUnitMagazine("Sevastopol AB", 'R-27T', 50)
SM.AddToUnitMagazine("Sevastopol AB", 'R-27TE', 38)
SM.AddToUnitMagazine("Sevastopol AB", 'FAB-100', 36)
UI.AddTask('RefuelAllAircraft', 3.000000, 3)
BB = UI.GetBlackboardInterface()
BB.Write('129_EngageLimit', '1')
BB.Write('16_EngageLimit', '4')
BB.Write('17_EngageLimit', '6')
BB.Write('18_EngageLimit', '12')
BB.Write('22_EngageLimit', '24')
BB.Write('256_EngageLimit', '2')
BB.Write('257_EngageLimit', '24')
BB.Write('258_EngageLimit', '2')
BB.Write('32_EngageLimit', '1')
BB.Write('33_EngageLimit', '1')
BB.Write('34_EngageLimit', '1')
BB.Write('64_EngageLimit', '1')
BB.Write('ID_EngageLimit', '{"15.0": 0.0, "12.0": 0.0, "14.0": 0.0, "13.0": 0.0, "16.0": 0.0}')
BB.Write('MissionTarget', '["Target", 14]')
BB.Write('Selected', '{"RotaryWing": 2, "Speed-": 100, "Alt+": 4000.0, "Speed+": 10, "RadarMast+": 0, "RadarMast-": 1, "34_EngageLimit": "1", "257_EngageLimit": "24", "17_EngageLimit": "6", "UnitCount": 9, "HasECM": 0, "HasTarget": 0, "TargetDatum": 0, "Alliance0_EngageLimit": -1, "FixedLand": 1, "Launchers": 1, "Periscope-": 1, "FixedWing": 0, "MagWeaponList": {"9M32M Strela 3": 6, "AT-2M": 0, "TEST-68": 0, "TEST-71ME": 0, "AT-1": 0, "RPK-6 Vodopod": 0, "SAET-60M": 0, "9M311 Kashtan": 96, "130mm F-44 HE": 1000, "*DICASS*": 0, "SET-65M": 120, "*buoy": 0, "100mm OF-58 FRAG": 1400, "9M330 Kinzhal": 0, "3M80 Moskit": 0, "TEST-71MKE": 0, "3M45 Granit": 0, "V-611": 0, "30mm OP-84 FRAG Tracer AK-630M": 0, "Yu-7": 0, "Yu-6": 0, "130mm ZS-44 AA": 0, "RPK-3 Metel": 0, "SET-65": 0, "TEST-71": 0, "53-56V": 0, "5V55RM": 0, "APR-2E": 0, "3M10 Granat(n)": 0, "3M10 Granat": 0, "*LOFAR*": 0, "*DIFAR*": 0, "30mm OF-84 HE-FRAG AK-630M": 13216, "76.2mm OS-62 FRAG": 0, "9M33M": 0, "53-56": 0, "100mm ZS-58 AA": 0, "130mm ZS-44P AA": 0, "3M54E Klub Alfa": 0, "76.2mm ZS-63 AA": 0, "100mm ZS-58P AA": 0, "53-65KE": 0, "3M80M Moskit-M": 0, "USET-80": 0, "VTT-1": 0, "Shkval": 0, "53-65M": 224}, "Air": 2, "64_EngageLimit": "1", "HasAIWeap": 0, "18_EngageLimit": "12", "256_EngageLimit": "2", "Depth+": 250.0, "MobileLand": 0, "CanStrafe": 0, "Depth-": 0, "HasSonarP": 1, "HasThrottle": 0, "PeriDeep": 0, "Sub": 2, "HasSonarA": 1, "HasFlightPort": 1, "HasMagazine": 1, "DieselSub": 1, "HasGBU": 0, "HasAINav": 0, "FormMember": 2, "Alliance1_EngageLimit": -1, "HasBombs": 0, "Snorkel-": 1, "TargetTrack": 1, "Snorkel+": 0, "16_EngageLimit": "4", "Alliance2_EngageLimit": -1, "258_EngageLimit": "2", "FormLeader": 1, "129_EngageLimit": "1", "HasESM": 1, "Periscope+": 0, "22_EngageLimit": "24", "FormModeSprint": 2, "32_EngageLimit": "1", "Tasks": {"Nav": 5, "PatrolCircle": 1, "EngageAll": 8}, "HasOptical": 1, "33_EngageLimit": "1", "HasRadar": 1, "Ship": 4, "TargetSet": 1, "FormModePace": 0, "WeaponList": {"APR-2E": [4, 4], "9M330 Kinzhal": [64, 64], "DICASS (105) Sonobuoy": [10, 10], "9M32M Strela 3": [1, 1], "3M80 Moskit": [8, 8], "5V55RM": [64, 64], "9M311 Kashtan": [16, 16], "3M45 Granit": [16, 16], "3M10 Granat": [1, 1], "DIFAR (105) Sonobuoy": [15, 15], "SET-65M": [7, 7], "130mm F-44 HE": [200, 200], "V-611": [72, 72], "LOFAR (105) Sonobuoy": [5, 5], "30mm OF-84 HE-FRAG AK-630M": [708, 708], "76.2mm OS-62 FRAG": [500, 500], "9M33M": [120, 120], "53-56": [20, 20], "100mm OF-58 FRAG": [92, 92], "53-65M": [16, 16], "RPK-3 Metel": [12, 12]}}')
SM.AddUnitToFlightDeck('Sevastopol AB', 'Il-38', 'Hammer-1', 2)
SM.SetFlightDeckUnitLoadout('Sevastopol AB', 'Hammer-1', '17 DICASS (105) Sonobuoy;17 LOFAR (105) Sonobuoy;41 DIFAR (105) Sonobuoy;4 AT-2M;')
SM.AddUnitToFlightDeck('Sevastopol AB', 'Il-38', 'Hammer-2', 2)
SM.SetFlightDeckUnitLoadout('Sevastopol AB', 'Hammer-2', '17 DICASS (105) Sonobuoy;17 LOFAR (105) Sonobuoy;41 DIFAR (105) Sonobuoy;4 AT-2M;')
SM.AddUnitToFlightDeck('Sevastopol AB', 'Il-38', 'Hammer-3', 2)
SM.SetFlightDeckUnitLoadout('Sevastopol AB', 'Hammer-3', '17 DICASS (105) Sonobuoy;17 LOFAR (105) Sonobuoy;41 DIFAR (105) Sonobuoy;4 AT-2M;')
SM.AddUnitToFlightDeck('Sevastopol AB', 'Il-38', 'Hammer-4', 2)
SM.SetFlightDeckUnitLoadout('Sevastopol AB', 'Hammer-4', '17 DICASS (105) Sonobuoy;17 LOFAR (105) Sonobuoy;41 DIFAR (105) Sonobuoy;4 AT-2M;')
SM.AddUnitToFlightDeck('Sevastopol AB', 'MiG-29M', 'Arrow-1', 2)
SM.SetFlightDeckUnitLoadout('Sevastopol AB', 'Arrow-1', '1 1520 Liter Tank;2 R-27RE;2 R-27TE;2 R-77;2 R-73M2;20 30mm NR-30 HEI;30 Chaff-1;30 Flare-1;')
SM.AddUnitToFlightDeck('Sevastopol AB', 'MiG-29M', 'Arrow-2', 2)
SM.SetFlightDeckUnitLoadout('Sevastopol AB', 'Arrow-2', '1 1520 Liter Tank;2 R-27RE;2 R-27TE;2 R-77;2 R-73M2;20 30mm NR-30 HEI;30 Chaff-1;30 Flare-1;')
SM.AddUnitToFlightDeck('Sevastopol AB', 'MiG-29M', 'Arrow-3', 2)
SM.SetFlightDeckUnitLoadout('Sevastopol AB', 'Arrow-3', '1 1520 Liter Tank;2 R-27RE;2 R-27TE;2 R-77;2 R-73M2;20 30mm NR-30 HEI;30 Chaff-1;30 Flare-1;')
SM.AddUnitToFlightDeck('Sevastopol AB', 'MiG-29M', 'Arrow-4', 2)
SM.SetFlightDeckUnitLoadout('Sevastopol AB', 'Arrow-4', '1 1520 Liter Tank;2 R-27RE;2 R-27TE;2 R-77;2 R-73M2;20 30mm NR-30 HEI;30 Chaff-1;30 Flare-1;')
SM.AddUnitToFlightDeck('Sevastopol AB', 'MiG-29M', 'Arrow-5', 2)
SM.SetFlightDeckUnitLoadout('Sevastopol AB', 'Arrow-5', '1 1520 Liter Tank;2 R-27RE;2 R-27TE;2 R-77;2 R-73M2;20 30mm NR-30 HEI;30 Chaff-1;30 Flare-1;')
SM.AddUnitToFlightDeck('Sevastopol AB', 'MiG-29M', 'Arrow-6', 2)
SM.SetFlightDeckUnitLoadout('Sevastopol AB', 'Arrow-6', '1 1520 Liter Tank;2 R-27RE;2 R-27TE;2 R-77;2 R-73M2;20 30mm NR-30 HEI;30 Chaff-1;30 Flare-1;')
SM.AddUnitToFlightDeck('Sevastopol AB', 'A-50', 'Sky-1', 2)
SM.SetFlightDeckUnitLoadout('Sevastopol AB', 'Sky-1', '')
SM.AddUnitToFlightDeck('Sevastopol AB', 'A-50', 'Sky-2', 2)
SM.SetFlightDeckUnitLoadout('Sevastopol AB', 'Sky-2', '')
SM.AddUnitToFlightDeck('Sevastopol AB', 'A-50', 'Sky-3', 1)
SM.SetFlightDeckUnitLoadout('Sevastopol AB', 'Sky-3', '')
FP = UI.GetFlightPortInfo()
base_track = UI.GetTrackById(UI.GetPlatformId())
mission_id = FP.AddGenericMission()
FP.AddAircraftToMission(mission_id, 'Hammer-1')
FP.AddAircraftToMission(mission_id, 'Hammer-2')
FP.AddAircraftToMission(mission_id, 'Hammer-3')
FP.AddAircraftToMission(mission_id, 'Hammer-4')
FP.SetMissionLaunchTime(mission_id, '01:00:00+0m+R2.0')
FP.SetMissionDatum(mission_id, 0.0000000, 0.0000000)
FP.SetMissionLandingTarget(mission_id, '')
FP.SetMissionWaveQuantity(mission_id, 1)
FP.SetMissionType(mission_id, '')
FP.AddMissionWaypointAdvanced(mission_id, 0.5869507, 0.7809585, 2000.0, 200.0)
FP.SetMissionWaypointTasks(mission_id, 0, 'WaitForGroup')
FP.AddMissionWaypointAdvanced(mission_id, 0.5590360, 0.7686830, 2000.0, 300.0)
FP.SetMissionWaypointTasks(mission_id, 1, 'BarrierPatrol,EngageAll,RTB')
FP.AddMissionWaypointAdvanced(mission_id, 0.5435780, 0.7735660, 2000.0, 300.0)
FP.AddMissionWaypointAdvanced(mission_id, 0.5558020, 0.7677130, 2000.0, 300.0)
FP.AddMissionWaypointAdvanced(mission_id, 0.5726180, 0.7585450, 10000.0, 300.0)
FP.SetMissionWaypointTasks(mission_id, 4, 'Land')
mission_id = FP.AddGenericMission()
FP.AddAircraftToMission(mission_id, 'Arrow-1')
FP.AddAircraftToMission(mission_id, 'Arrow-2')
FP.AddAircraftToMission(mission_id, 'Arrow-3')
FP.AddAircraftToMission(mission_id, 'Arrow-4')
FP.AddAircraftToMission(mission_id, 'Arrow-5')
FP.AddAircraftToMission(mission_id, 'Arrow-6')
FP.SetMissionLaunchTime(mission_id, '01:00:00+0m+R2.0')
FP.SetMissionDatum(mission_id, 0.0000000, 0.0000000)
FP.SetMissionLandingTarget(mission_id, '')
FP.SetMissionWaveQuantity(mission_id, 2)
FP.SetMissionType(mission_id, '')
FP.SetMissionPatrolArea(mission_id, '0.5658959,0.7351649,0.5000790,0.7487700,0.5218041,0.7587565,0.5555376,0.7509148,')
FP.AddMissionWaypointAdvanced(mission_id, 0.5869507, 0.7809585, 2000.0, 200.0)
FP.SetMissionWaypointTasks(mission_id, 0, 'WaitForGroup,EngageAll')
FP.AddMissionWaypointAdvanced(mission_id, 0.5358350, 0.7476260, 3000.0, 300.0)
FP.SetMissionWaypointTasks(mission_id, 1, 'AirPatrolArea,EngageAll')
mission_id = FP.AddGenericMission()
FP.AddAircraftToMission(mission_id, 'Sky-1')
FP.AddAircraftToMission(mission_id, 'Sky-2')
FP.AddAircraftToMission(mission_id, 'Sky-3')
FP.SetMissionLaunchTime(mission_id, '01:00:00+0m+R4.0')
FP.SetMissionDatum(mission_id, 0.0000000, 0.0000000)
FP.SetMissionLandingTarget(mission_id, '')
FP.SetMissionWaveQuantity(mission_id, 1)
FP.SetMissionType(mission_id, '')
FP.SetMissionPatrolArea(mission_id, '0.5563372,0.7750031,0.5480769,0.7907056,0.5664279,0.7917435,0.5691501,0.7770454,')
FP.AddMissionWaypointAdvanced(mission_id, 0.5869507, 0.7809585, 2000.0, 200.0)
FP.SetMissionWaypointTasks(mission_id, 0, 'WaitForGroup,EngageAll')
FP.AddMissionWaypointAdvanced(mission_id, 0.5633610, 0.7780460, 3000.0, 300.0)
FP.SetMissionWaypointTasks(mission_id, 1, 'AirPatrolArea,EngageAll')
unit = SM.GetDefaultUnit()
unit.className = 'Ka-27A'
unit.unitName = "Fregat-M Ka-27 1"
unit.SetPosition(31.554849, 43.291317, 510.2)
unit.heading = 227.36
unit.speed = 100.0
unit.cost = 20000000.0
SM.AddUnitToAlliance(unit, 1)
SM.SetUnitLauncherItem(unit.unitName, 0, 'DIFAR (105) Sonobuoy', 5)
SM.SetUnitLauncherItem(unit.unitName, 1, 'DICASS (105) Sonobuoy', 5)
SM.SetUnitLauncherItem(unit.unitName, 2, 'DIFAR (105) Sonobuoy', 5)
SM.SetUnitLauncherItem(unit.unitName, 3, 'APR-2E', 2)
UI = SM.GetUnitInterface(unit.unitName)
UI.AddTask('AirEvade', 3.000000, 3)
UI.AddTask('EngageAll', 2.000000, 0)
UI.AddTask('Nav', 1.000000, 0)
UI.AddNavWaypointAdvanced(0.546133, 0.749507, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.557133, 0.746778, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.560433, 0.750363, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.550020, 0.753734, 0.000000, 0.000000)
UI.SetNavLoopState(1)
UI.AddTask('PatrolCircle', 1.000000, 0)
UI.AddTask('RTB', 2.000000, 3)
BB = UI.GetBlackboardInterface()
BB.Write('129_EngageLimit', '1')
BB.Write('16_EngageLimit', '4')
BB.Write('17_EngageLimit', '6')
BB.Write('18_EngageLimit', '12')
BB.Write('22_EngageLimit', '24')
BB.Write('256_EngageLimit', '2')
BB.Write('257_EngageLimit', '24')
BB.Write('258_EngageLimit', '2')
BB.Write('32_EngageLimit', '1')
BB.Write('33_EngageLimit', '1')
BB.Write('34_EngageLimit', '1')
BB.Write('64_EngageLimit', '1')
BB.Write('Home', 'Admiral Chabanenko')
BB.Write('ID_EngageLimit', '{"15.0": 0.0, "12.0": 0.0, "14.0": 0.0, "13.0": 0.0, "16.0": 0.0}')
BB.Write('MissionTarget', '["Target", 14]')
BB.Write('Selected', '{"RotaryWing": 2, "Speed-": 100, "Alt+": 4000.0, "Speed+": 10, "RadarMast+": 0, "RadarMast-": 1, "34_EngageLimit": "1", "257_EngageLimit": "24", "17_EngageLimit": "6", "UnitCount": 9, "HasECM": 0, "HasTarget": 0, "TargetDatum": 0, "Alliance0_EngageLimit": -1, "FixedLand": 1, "Launchers": 1, "Periscope-": 1, "FixedWing": 0, "MagWeaponList": {"9M32M Strela 3": 6, "AT-2M": 0, "TEST-68": 0, "TEST-71ME": 0, "AT-1": 0, "RPK-6 Vodopod": 0, "SAET-60M": 0, "9M311 Kashtan": 96, "130mm F-44 HE": 1000, "*DICASS*": 0, "SET-65M": 120, "*buoy": 0, "100mm OF-58 FRAG": 1400, "9M330 Kinzhal": 0, "3M80 Moskit": 0, "TEST-71MKE": 0, "3M45 Granit": 0, "V-611": 0, "30mm OP-84 FRAG Tracer AK-630M": 0, "Yu-7": 0, "Yu-6": 0, "130mm ZS-44 AA": 0, "RPK-3 Metel": 0, "SET-65": 0, "TEST-71": 0, "53-56V": 0, "5V55RM": 0, "APR-2E": 0, "3M10 Granat(n)": 0, "3M10 Granat": 0, "*LOFAR*": 0, "*DIFAR*": 0, "30mm OF-84 HE-FRAG AK-630M": 13216, "76.2mm OS-62 FRAG": 0, "9M33M": 0, "53-56": 0, "100mm ZS-58 AA": 0, "130mm ZS-44P AA": 0, "3M54E Klub Alfa": 0, "76.2mm ZS-63 AA": 0, "100mm ZS-58P AA": 0, "53-65KE": 0, "3M80M Moskit-M": 0, "USET-80": 0, "VTT-1": 0, "Shkval": 0, "53-65M": 224}, "Air": 2, "64_EngageLimit": "1", "HasAIWeap": 0, "18_EngageLimit": "12", "256_EngageLimit": "2", "Depth+": 250.0, "MobileLand": 0, "CanStrafe": 0, "Depth-": 0, "HasSonarP": 1, "HasThrottle": 0, "PeriDeep": 0, "Sub": 2, "HasSonarA": 1, "HasFlightPort": 1, "HasMagazine": 1, "DieselSub": 1, "HasGBU": 0, "HasAINav": 0, "FormMember": 2, "Alliance1_EngageLimit": -1, "HasBombs": 0, "Snorkel-": 1, "TargetTrack": 1, "Snorkel+": 0, "16_EngageLimit": "4", "Alliance2_EngageLimit": -1, "258_EngageLimit": "2", "FormLeader": 1, "129_EngageLimit": "1", "HasESM": 1, "Periscope+": 0, "22_EngageLimit": "24", "FormModeSprint": 2, "32_EngageLimit": "1", "Tasks": {"Nav": 5, "PatrolCircle": 1, "EngageAll": 8}, "HasOptical": 1, "33_EngageLimit": "1", "HasRadar": 1, "Ship": 4, "TargetSet": 1, "FormModePace": 0, "WeaponList": {"APR-2E": [4, 4], "9M330 Kinzhal": [64, 64], "DICASS (105) Sonobuoy": [10, 10], "9M32M Strela 3": [1, 1], "3M80 Moskit": [8, 8], "5V55RM": [64, 64], "9M311 Kashtan": [16, 16], "3M45 Granit": [16, 16], "3M10 Granat": [1, 1], "DIFAR (105) Sonobuoy": [15, 15], "SET-65M": [7, 7], "130mm F-44 HE": [200, 200], "V-611": [72, 72], "LOFAR (105) Sonobuoy": [5, 5], "30mm OF-84 HE-FRAG AK-630M": [708, 708], "76.2mm OS-62 FRAG": [500, 500], "9M33M": [120, 120], "53-56": [20, 20], "100mm OF-58 FRAG": [92, 92], "53-65M": [16, 16], "RPK-3 Metel": [12, 12]}}')
BB.Write('StationLatitude', '0.751326')
BB.Write('StationLongitude', '0.551780')
unit = SM.GetDefaultUnit()
unit.className = 'Ka-27A'
unit.unitName = "Berkut-B Ka-27 1"
unit.SetPosition(33.085792, 44.406636, 506.4)
unit.heading = 224.34
unit.speed = 100.0
unit.cost = 20000000.0
SM.AddUnitToAlliance(unit, 1)
SM.SetUnitLauncherItem(unit.unitName, 0, 'DIFAR (105) Sonobuoy', 5)
SM.SetUnitLauncherItem(unit.unitName, 1, 'DICASS (105) Sonobuoy', 5)
SM.SetUnitLauncherItem(unit.unitName, 2, 'LOFAR (105) Sonobuoy', 5)
SM.SetUnitLauncherItem(unit.unitName, 3, 'APR-2E', 2)
UI = SM.GetUnitInterface(unit.unitName)
UI.AddTask('AirEvade', 3.000000, 3)
UI.AddTask('EngageAll', 2.000000, 0)
UI.AddTask('Nav', 1.000000, 0)
UI.AddNavWaypointAdvanced(0.572946, 0.775202, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.579175, 0.772313, 0.000000, 0.000000)
UI.SetNavLoopState(1)
UI.AddTask('RTB', 2.000000, 3)
BB = UI.GetBlackboardInterface()
BB.Write('129_EngageLimit', '1')
BB.Write('16_EngageLimit', '4')
BB.Write('17_EngageLimit', '6')
BB.Write('18_EngageLimit', '12')
BB.Write('22_EngageLimit', '24')
BB.Write('256_EngageLimit', '2')
BB.Write('257_EngageLimit', '24')
BB.Write('258_EngageLimit', '2')
BB.Write('32_EngageLimit', '1')
BB.Write('33_EngageLimit', '1')
BB.Write('34_EngageLimit', '1')
BB.Write('64_EngageLimit', '1')
BB.Write('Home', 'Kerch')
BB.Write('ID_EngageLimit', '{"15.0": 0.0, "12.0": 0.0, "14.0": 0.0, "13.0": 0.0, "16.0": 0.0}')
BB.Write('MissionTarget', '["Target", 14]')
BB.Write('Selected', '{"RotaryWing": 2, "Speed-": 100, "Alt+": 4000.0, "Speed+": 10, "RadarMast+": 0, "RadarMast-": 1, "34_EngageLimit": "1", "257_EngageLimit": "24", "17_EngageLimit": "6", "UnitCount": 9, "HasECM": 0, "HasTarget": 0, "TargetDatum": 0, "Alliance0_EngageLimit": -1, "FixedLand": 1, "Launchers": 1, "Periscope-": 1, "FixedWing": 0, "MagWeaponList": {"9M32M Strela 3": 6, "AT-2M": 0, "TEST-68": 0, "TEST-71ME": 0, "AT-1": 0, "RPK-6 Vodopod": 0, "SAET-60M": 0, "9M311 Kashtan": 96, "130mm F-44 HE": 1000, "*DICASS*": 0, "SET-65M": 120, "*buoy": 0, "100mm OF-58 FRAG": 1400, "9M330 Kinzhal": 0, "3M80 Moskit": 0, "TEST-71MKE": 0, "3M45 Granit": 0, "V-611": 0, "30mm OP-84 FRAG Tracer AK-630M": 0, "Yu-7": 0, "Yu-6": 0, "130mm ZS-44 AA": 0, "RPK-3 Metel": 0, "SET-65": 0, "TEST-71": 0, "53-56V": 0, "5V55RM": 0, "APR-2E": 0, "3M10 Granat(n)": 0, "3M10 Granat": 0, "*LOFAR*": 0, "*DIFAR*": 0, "30mm OF-84 HE-FRAG AK-630M": 13216, "76.2mm OS-62 FRAG": 0, "9M33M": 0, "53-56": 0, "100mm ZS-58 AA": 0, "130mm ZS-44P AA": 0, "3M54E Klub Alfa": 0, "76.2mm ZS-63 AA": 0, "100mm ZS-58P AA": 0, "53-65KE": 0, "3M80M Moskit-M": 0, "USET-80": 0, "VTT-1": 0, "Shkval": 0, "53-65M": 224}, "Air": 2, "64_EngageLimit": "1", "HasAIWeap": 0, "18_EngageLimit": "12", "256_EngageLimit": "2", "Depth+": 250.0, "MobileLand": 0, "CanStrafe": 0, "Depth-": 0, "HasSonarP": 1, "HasThrottle": 0, "PeriDeep": 0, "Sub": 2, "HasSonarA": 1, "HasFlightPort": 1, "HasMagazine": 1, "DieselSub": 1, "HasGBU": 0, "HasAINav": 0, "FormMember": 2, "Alliance1_EngageLimit": -1, "HasBombs": 0, "Snorkel-": 1, "TargetTrack": 1, "Snorkel+": 0, "16_EngageLimit": "4", "Alliance2_EngageLimit": -1, "258_EngageLimit": "2", "FormLeader": 1, "129_EngageLimit": "1", "HasESM": 1, "Periscope+": 0, "22_EngageLimit": "24", "FormModeSprint": 2, "32_EngageLimit": "1", "Tasks": {"Nav": 5, "PatrolCircle": 1, "EngageAll": 8}, "HasOptical": 1, "33_EngageLimit": "1", "HasRadar": 1, "Ship": 4, "TargetSet": 1, "FormModePace": 0, "WeaponList": {"APR-2E": [4, 4], "9M330 Kinzhal": [64, 64], "DICASS (105) Sonobuoy": [10, 10], "9M32M Strela 3": [1, 1], "3M80 Moskit": [8, 8], "5V55RM": [64, 64], "9M311 Kashtan": [16, 16], "3M45 Granit": [16, 16], "3M10 Granat": [1, 1], "DIFAR (105) Sonobuoy": [15, 15], "SET-65M": [7, 7], "130mm F-44 HE": [200, 200], "V-611": [72, 72], "LOFAR (105) Sonobuoy": [5, 5], "30mm OF-84 HE-FRAG AK-630M": [708, 708], "76.2mm OS-62 FRAG": [500, 500], "9M33M": [120, 120], "53-56": [20, 20], "100mm OF-58 FRAG": [92, 92], "53-65M": [16, 16], "RPK-3 Metel": [12, 12]}}')
unit = SM.GetDefaultUnit()
unit.className = 'Pr 1135M Burevestnik-M'
unit.unitName = "Pytlivyy"
UI = SM.GetUnitInterface('Moskva')
leader_track = UI.GetTrackById(UI.GetPlatformId())
lon_deg = 57.296*leader_track.Lon + -0.0043
lat_deg = 57.296*leader_track.Lat + -0.0941
unit.SetPosition(lon_deg, lat_deg, 0.0)
unit.heading = -139.40
unit.speed = 3.0
unit.cost = 0.0
SM.AddUnitToAlliance(unit, 1)
SM.SetUnitLauncherItem(unit.unitName, 0, '100mm OF-58 FRAG', 46)
SM.SetUnitLauncherItem(unit.unitName, 1, '100mm OF-58 FRAG', 46)
SM.SetUnitLauncherItem(unit.unitName, 2, '53-65M', 2)
SM.SetUnitLauncherItem(unit.unitName, 3, '53-65M', 2)
SM.SetUnitLauncherItem(unit.unitName, 4, '9M33M', 20)
SM.SetUnitLauncherItem(unit.unitName, 5, '9M33M', 20)
SM.SetUnitLauncherItem(unit.unitName, 6, 'RPK-3 Metel', 4)
UI = SM.GetUnitInterface(unit.unitName)
SM.AddToUnitMagazine("Pytlivyy", '100mm OF-58 FRAG', 700)
SM.AddToUnitMagazine("Pytlivyy", '53-65M', 8)
UI.AddTask('EngageAll', 2.000000, 0)
UI.AddTask('MissileWarning', 3.000000, 3)
UI.AddTask('PointDefense', 3.000000, 3)
BB = UI.GetBlackboardInterface()
BB.Write('129_EngageLimit', '1')
BB.Write('16_EngageLimit', '4')
BB.Write('17_EngageLimit', '6')
BB.Write('18_EngageLimit', '12')
BB.Write('22_EngageLimit', '24')
BB.Write('256_EngageLimit', '2')
BB.Write('257_EngageLimit', '24')
BB.Write('258_EngageLimit', '2')
BB.Write('32_EngageLimit', '1')
BB.Write('33_EngageLimit', '1')
BB.Write('34_EngageLimit', '1')
BB.Write('64_EngageLimit', '1')
BB.Write('ID_EngageLimit', '{"15.0": 0.0, "12.0": 0.0, "14.0": 0.0, "13.0": 0.0, "16.0": 0.0}')
BB.Write('MissionTarget', '["Target", 14]')
BB.Write('Selected', '{"RotaryWing": 2, "Speed-": 100, "Alt+": 4000.0, "Speed+": 10, "RadarMast+": 0, "RadarMast-": 1, "34_EngageLimit": "1", "257_EngageLimit": "24", "17_EngageLimit": "6", "UnitCount": 9, "HasECM": 0, "HasTarget": 0, "TargetDatum": 0, "Alliance0_EngageLimit": -1, "FixedLand": 1, "Launchers": 1, "Periscope-": 1, "FixedWing": 0, "MagWeaponList": {"9M32M Strela 3": 6, "AT-2M": 0, "TEST-68": 0, "TEST-71ME": 0, "AT-1": 0, "RPK-6 Vodopod": 0, "SAET-60M": 0, "9M311 Kashtan": 96, "130mm F-44 HE": 1000, "*DICASS*": 0, "SET-65M": 120, "*buoy": 0, "100mm OF-58 FRAG": 1400, "9M330 Kinzhal": 0, "3M80 Moskit": 0, "TEST-71MKE": 0, "3M45 Granit": 0, "V-611": 0, "30mm OP-84 FRAG Tracer AK-630M": 0, "Yu-7": 0, "Yu-6": 0, "130mm ZS-44 AA": 0, "RPK-3 Metel": 0, "SET-65": 0, "TEST-71": 0, "53-56V": 0, "5V55RM": 0, "APR-2E": 0, "3M10 Granat(n)": 0, "3M10 Granat": 0, "*LOFAR*": 0, "*DIFAR*": 0, "30mm OF-84 HE-FRAG AK-630M": 13216, "76.2mm OS-62 FRAG": 0, "9M33M": 0, "53-56": 0, "100mm ZS-58 AA": 0, "130mm ZS-44P AA": 0, "3M54E Klub Alfa": 0, "76.2mm ZS-63 AA": 0, "100mm ZS-58P AA": 0, "53-65KE": 0, "3M80M Moskit-M": 0, "USET-80": 0, "VTT-1": 0, "Shkval": 0, "53-65M": 224}, "Air": 2, "64_EngageLimit": "1", "HasAIWeap": 0, "18_EngageLimit": "12", "256_EngageLimit": "2", "Depth+": 250.0, "MobileLand": 0, "CanStrafe": 0, "Depth-": 0, "HasSonarP": 1, "HasThrottle": 0, "PeriDeep": 0, "Sub": 2, "HasSonarA": 1, "HasFlightPort": 1, "HasMagazine": 1, "DieselSub": 1, "HasGBU": 0, "HasAINav": 0, "FormMember": 2, "Alliance1_EngageLimit": -1, "HasBombs": 0, "Snorkel-": 1, "TargetTrack": 1, "Snorkel+": 0, "16_EngageLimit": "4", "Alliance2_EngageLimit": -1, "258_EngageLimit": "2", "FormLeader": 1, "129_EngageLimit": "1", "HasESM": 1, "Periscope+": 0, "22_EngageLimit": "24", "FormModeSprint": 2, "32_EngageLimit": "1", "Tasks": {"Nav": 5, "PatrolCircle": 1, "EngageAll": 8}, "HasOptical": 1, "33_EngageLimit": "1", "HasRadar": 1, "Ship": 4, "TargetSet": 1, "FormModePace": 0, "WeaponList": {"APR-2E": [4, 4], "9M330 Kinzhal": [64, 64], "DICASS (105) Sonobuoy": [10, 10], "9M32M Strela 3": [1, 1], "3M80 Moskit": [8, 8], "5V55RM": [64, 64], "9M311 Kashtan": [16, 16], "3M45 Granit": [16, 16], "3M10 Granat": [1, 1], "DIFAR (105) Sonobuoy": [15, 15], "SET-65M": [7, 7], "130mm F-44 HE": [200, 200], "V-611": [72, 72], "LOFAR (105) Sonobuoy": [5, 5], "30mm OF-84 HE-FRAG AK-630M": [708, 708], "76.2mm OS-62 FRAG": [500, 500], "9M33M": [120, 120], "53-56": [20, 20], "100mm OF-58 FRAG": [92, 92], "53-65M": [16, 16], "RPK-3 Metel": [12, 12]}}')
leader_id = UI.LookupFriendlyId('Moskva')
UI.SetFormationLeader(leader_id)
UI.SetFormationMode(2)
UI.SetFormationPosition(10.689, 3.128, 5.565, 0.239)
UI.SetFormationAltitudeOffset(0.0)
UI.SetFormationUseNorthBearing(0)
unit = SM.GetDefaultUnit()
unit.className = 'Pr 1134B Berkut B'
unit.unitName = "Kerch"
UI = SM.GetUnitInterface('Moskva')
leader_track = UI.GetTrackById(UI.GetPlatformId())
lon_deg = 57.296*leader_track.Lon + -0.1186
lat_deg = 57.296*leader_track.Lat + -0.0023
unit.SetPosition(lon_deg, lat_deg, 0.0)
unit.heading = -138.01
unit.speed = 3.0
unit.cost = 0.0
SM.AddUnitToAlliance(unit, 1)
SM.SetUnitLauncherItem(unit.unitName, 0, '9M33M', 20)
SM.SetUnitLauncherItem(unit.unitName, 1, '9M33M', 20)
SM.SetUnitLauncherItem(unit.unitName, 2, 'V-611', 36)
SM.SetUnitLauncherItem(unit.unitName, 3, 'V-611', 36)
SM.SetUnitLauncherItem(unit.unitName, 4, '30mm OF-84 HE-FRAG AK-630M', 59)
SM.SetUnitLauncherItem(unit.unitName, 5, '30mm OF-84 HE-FRAG AK-630M', 59)
SM.SetUnitLauncherItem(unit.unitName, 6, '30mm OF-84 HE-FRAG AK-630M', 59)
SM.SetUnitLauncherItem(unit.unitName, 7, '30mm OF-84 HE-FRAG AK-630M', 59)
SM.SetUnitLauncherItem(unit.unitName, 8, '76.2mm OS-62 FRAG', 250)
SM.SetUnitLauncherItem(unit.unitName, 9, '76.2mm OS-62 FRAG', 250)
SM.SetUnitLauncherItem(unit.unitName, 10, 'RPK-3 Metel', 8)
SM.SetUnitLauncherItem(unit.unitName, 11, '53-56', 5)
SM.SetUnitLauncherItem(unit.unitName, 12, '53-56', 5)
UI = SM.GetUnitInterface(unit.unitName)
SM.AddToUnitMagazine("Kerch", 'AT-1', 33)
SM.AddToUnitMagazine("Kerch", 'DICASS (105) Sonobuoy', 203)
SM.AddToUnitMagazine("Kerch", 'DIFAR (105) Sonobuoy', 567)
SM.AddToUnitMagazine("Kerch", 'Fuel', 45900)
SM.AddToUnitMagazine("Kerch", 'LOFAR (105) Sonobuoy', 203)
SM.AddToUnitMagazine("Kerch", '30mm OF-84 HE-FRAG AK-630M', 944)
SM.AddToUnitMagazine("Kerch", '53-65M', 20)
UI.AddTask('EngageAll', 2.000000, 0)
UI.AddTask('MissileWarning', 3.000000, 3)
UI.AddTask('PointDefense', 3.000000, 3)
UI.AddTask('RefuelAllAircraft', 3.000000, 3)
BB = UI.GetBlackboardInterface()
BB.Write('129_EngageLimit', '1')
BB.Write('16_EngageLimit', '4')
BB.Write('17_EngageLimit', '6')
BB.Write('18_EngageLimit', '12')
BB.Write('22_EngageLimit', '24')
BB.Write('256_EngageLimit', '2')
BB.Write('257_EngageLimit', '24')
BB.Write('258_EngageLimit', '2')
BB.Write('32_EngageLimit', '1')
BB.Write('33_EngageLimit', '1')
BB.Write('34_EngageLimit', '1')
BB.Write('64_EngageLimit', '1')
BB.Write('ID_EngageLimit', '{"15.0": 0.0, "12.0": 0.0, "14.0": 0.0, "13.0": 0.0, "16.0": 0.0}')
BB.Write('MissionTarget', '["Target", 14]')
BB.Write('Selected', '{"RotaryWing": 2, "Speed-": 100, "Alt+": 4000.0, "Speed+": 10, "RadarMast+": 0, "RadarMast-": 1, "34_EngageLimit": "1", "257_EngageLimit": "24", "17_EngageLimit": "6", "UnitCount": 9, "HasECM": 0, "HasTarget": 0, "TargetDatum": 0, "Alliance0_EngageLimit": -1, "FixedLand": 1, "Launchers": 1, "Periscope-": 1, "FixedWing": 0, "MagWeaponList": {"9M32M Strela 3": 6, "AT-2M": 0, "TEST-68": 0, "TEST-71ME": 0, "AT-1": 0, "RPK-6 Vodopod": 0, "SAET-60M": 0, "9M311 Kashtan": 96, "130mm F-44 HE": 1000, "*DICASS*": 0, "SET-65M": 120, "*buoy": 0, "100mm OF-58 FRAG": 1400, "9M330 Kinzhal": 0, "3M80 Moskit": 0, "TEST-71MKE": 0, "3M45 Granit": 0, "V-611": 0, "30mm OP-84 FRAG Tracer AK-630M": 0, "Yu-7": 0, "Yu-6": 0, "130mm ZS-44 AA": 0, "RPK-3 Metel": 0, "SET-65": 0, "TEST-71": 0, "53-56V": 0, "5V55RM": 0, "APR-2E": 0, "3M10 Granat(n)": 0, "3M10 Granat": 0, "*LOFAR*": 0, "*DIFAR*": 0, "30mm OF-84 HE-FRAG AK-630M": 13216, "76.2mm OS-62 FRAG": 0, "9M33M": 0, "53-56": 0, "100mm ZS-58 AA": 0, "130mm ZS-44P AA": 0, "3M54E Klub Alfa": 0, "76.2mm ZS-63 AA": 0, "100mm ZS-58P AA": 0, "53-65KE": 0, "3M80M Moskit-M": 0, "USET-80": 0, "VTT-1": 0, "Shkval": 0, "53-65M": 224}, "Air": 2, "64_EngageLimit": "1", "HasAIWeap": 0, "18_EngageLimit": "12", "256_EngageLimit": "2", "Depth+": 250.0, "MobileLand": 0, "CanStrafe": 0, "Depth-": 0, "HasSonarP": 1, "HasThrottle": 0, "PeriDeep": 0, "Sub": 2, "HasSonarA": 1, "HasFlightPort": 1, "HasMagazine": 1, "DieselSub": 1, "HasGBU": 0, "HasAINav": 0, "FormMember": 2, "Alliance1_EngageLimit": -1, "HasBombs": 0, "Snorkel-": 1, "TargetTrack": 1, "Snorkel+": 0, "16_EngageLimit": "4", "Alliance2_EngageLimit": -1, "258_EngageLimit": "2", "FormLeader": 1, "129_EngageLimit": "1", "HasESM": 1, "Periscope+": 0, "22_EngageLimit": "24", "FormModeSprint": 2, "32_EngageLimit": "1", "Tasks": {"Nav": 5, "PatrolCircle": 1, "EngageAll": 8}, "HasOptical": 1, "33_EngageLimit": "1", "HasRadar": 1, "Ship": 4, "TargetSet": 1, "FormModePace": 0, "WeaponList": {"APR-2E": [4, 4], "9M330 Kinzhal": [64, 64], "DICASS (105) Sonobuoy": [10, 10], "9M32M Strela 3": [1, 1], "3M80 Moskit": [8, 8], "5V55RM": [64, 64], "9M311 Kashtan": [16, 16], "3M45 Granit": [16, 16], "3M10 Granat": [1, 1], "DIFAR (105) Sonobuoy": [15, 15], "SET-65M": [7, 7], "130mm F-44 HE": [200, 200], "V-611": [72, 72], "LOFAR (105) Sonobuoy": [5, 5], "30mm OF-84 HE-FRAG AK-630M": [708, 708], "76.2mm OS-62 FRAG": [500, 500], "9M33M": [120, 120], "53-56": [20, 20], "100mm OF-58 FRAG": [92, 92], "53-65M": [16, 16], "RPK-3 Metel": [12, 12]}}')
leader_id = UI.LookupFriendlyId('Moskva')
UI.SetFormationLeader(leader_id)
UI.SetFormationMode(2)
UI.SetFormationPosition(9.520, 2.545, 0.786, 0.372)
UI.SetFormationAltitudeOffset(0.0)
UI.SetFormationUseNorthBearing(0)
FP = UI.GetFlightPortInfo()
base_track = UI.GetTrackById(UI.GetPlatformId())
mission_id = FP.AddGenericMission()
FP.SetMissionLaunchTime(mission_id, '01:00:00+0m')
FP.SetMissionDatum(mission_id, 0.0000000, 0.0000000)
FP.SetMissionLandingTarget(mission_id, '')
FP.SetMissionWaveQuantity(mission_id, 24)
FP.SetMissionType(mission_id, '')
##############################
### Alliance 2 units
##############################
unit = SM.GetDefaultUnit()
unit.className = 'Airstrip'
unit.unitName = "AB Istanbul-Ataturk"
unit.SetPosition(28.816667, 41.000000, -0.0)
unit.heading = 219.81
unit.speed = 0.0
unit.cost = 20000000.0
SM.AddUnitToAlliance(unit, 2)
UI = SM.GetUnitInterface(unit.unitName)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'Fuel', 1000000)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", '20mm PGU', 758)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", '20mm PGU-28/B', 758)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", '600 gallon tank', 12)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'AGM-65D', 12)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'AGM-65J', 12)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'AGM-84F Harpoon', 46)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'AGM-84H SLAM-ER', 38)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'AIM-120C7', 136)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'AIM-120D', 126)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'AIM-9P4', 64)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'AIM-9X', 56)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'Chaff-1', 1066)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'DICASS (110) Sonobuoy', 187)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'DIFAR (110) Sonobuoy', 550)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'Flare-1', 1066)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'LOFAR (110) Sonobuoy', 204)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'Mk 16 Zuni FFAR', 52)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'Mk 71 Zuni WAFAR', 52)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'Mk-36 DST', 16)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'Mk-40 DST', 4)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'Mk-41 DST', 4)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'Mk-54', 272)
SM.AddToUnitMagazine("AB Istanbul-Ataturk", 'Mk-56 Mine', 18)
UI.AddTask('RefuelAllAircraft', 3.000000, 3)
BB = UI.GetBlackboardInterface()
BB.Write('129_EngageLimit', '1')
BB.Write('16_EngageLimit', '4')
BB.Write('17_EngageLimit', '6')
BB.Write('18_EngageLimit', '12')
BB.Write('22_EngageLimit', '24')
BB.Write('256_EngageLimit', '2')
BB.Write('257_EngageLimit', '24')
BB.Write('258_EngageLimit', '2')
BB.Write('32_EngageLimit', '1')
BB.Write('33_EngageLimit', '1')
BB.Write('34_EngageLimit', '1')
BB.Write('64_EngageLimit', '1')
BB.Write('InvMulti', '1')
BB.Write('MagTonnage', '35')
BB.Write('Selected', '{"RotaryWing": 0, "Speed-": 0, "Alt+": 0, "Speed+": 0, "RadarMast+": 0, "RadarMast-": 0, "34_EngageLimit": "1", "257_EngageLimit": "24", "17_EngageLimit": "6", "UnitCount": 1, "HasECM": 0, "HasTarget": 0, "TargetDatum": 0, "Alliance0_EngageLimit": -1, "FixedLand": 1, "Launchers": 0, "Periscope-": 0, "FixedWing": 0, "MagWeaponList": {}, "Air": 0, "64_EngageLimit": "1", "HasAIWeap": 0, "18_EngageLimit": "12", "256_EngageLimit": "2", "Depth+": 0, "MobileLand": 0, "CanStrafe": 0, "Depth-": 0, "HasSonarP": 0, "HasThrottle": 0, "PeriDeep": 0, "Sub": 0, "HasSonarA": 0, "HasFlightPort": 1, "HasMagazine": 1, "DieselSub": 0, "HasGBU": 0, "HasAINav": 0, "FormMember": 0, "Alliance1_EngageLimit": -1, "HasBombs": 0, "Snorkel-": 0, "TargetTrack": 0, "Snorkel+": 0, "16_EngageLimit": "4", "Alliance2_EngageLimit": -1, "258_EngageLimit": "2", "FormLeader": 0, "129_EngageLimit": "1", "HasESM": 0, "Periscope+": 0, "22_EngageLimit": "24", "FormModeSprint": 0, "32_EngageLimit": "1", "Tasks": {}, "HasOptical": 1, "33_EngageLimit": "1", "HasRadar": 1, "Ship": 0, "TargetSet": 0, "FormModePace": 0, "WeaponList": {}}')
SM.AddUnitToFlightDeck('AB Istanbul-Ataturk', 'KC-130F', 'Cow-5', 2)
SM.SetFlightDeckUnitLoadout('AB Istanbul-Ataturk', 'Cow-5', '')
SM.AddUnitToFlightDeck('AB Istanbul-Ataturk', 'KC-130F', 'Cow-6', 2)
SM.SetFlightDeckUnitLoadout('AB Istanbul-Ataturk', 'Cow-6', '')
SM.AddUnitToFlightDeck('AB Istanbul-Ataturk', 'P-3C III Orion', 'Nail-1', 2)
SM.SetFlightDeckUnitLoadout('AB Istanbul-Ataturk', 'Nail-1', '17 DICASS (100) Sonobuoy;17 LOFAR (100) Sonobuoy;50 DIFAR (100) Sonobuoy;2 AIM-9X;2 AGM-84H SLAM-ER;2 AGM-84H SLAM-ER;2 Mk-54;2 Mk-54;8 Mk-54;30 Flare-1;30 Chaff-1;')
SM.AddUnitToFlightDeck('AB Istanbul-Ataturk', 'P-3C III Orion', 'Nail-2', 2)
SM.SetFlightDeckUnitLoadout('AB Istanbul-Ataturk', 'Nail-2', '17 DICASS (110) Sonobuoy;17 LOFAR (105) Sonobuoy;50 DIFAR (110) Sonobuoy;2 AIM-9X;2 AGM-84H SLAM-ER;2 AGM-84H SLAM-ER;2 Mk-54;2 Mk-54;8 Mk-54;30 Flare-1;30 Chaff-1;')
SM.AddUnitToFlightDeck('AB Istanbul-Ataturk', 'F-15C', 'Ambush-1', 2)
SM.SetFlightDeckUnitLoadout('AB Istanbul-Ataturk', 'Ambush-1', '4 AIM-120D;2 AIM-9X;2 AIM-120C7;3 600 gallon tank;30 Chaff-1;30 Flare-1;46 20mm PGU;')
SM.AddUnitToFlightDeck('AB Istanbul-Ataturk', 'F-15C', 'Ambush-2', 2)
SM.SetFlightDeckUnitLoadout('AB Istanbul-Ataturk', 'Ambush-2', '4 AIM-120D;2 AIM-9X;2 AIM-120C7;3 600 gallon tank;30 Chaff-1;30 Flare-1;46 20mm PGU;')
SM.AddUnitToFlightDeck('AB Istanbul-Ataturk', 'E-3D/F', 'Hole-1', 2)
SM.SetFlightDeckUnitLoadout('AB Istanbul-Ataturk', 'Hole-1', '')
unit = SM.GetDefaultUnit()
unit.className = 'SSN 21 Seawolf'
unit.unitName = "USS Seawolf"
boxes = [[30.6764, 32.3636, 42.1574, 43.0012]]
box = boxes[int(1*random())]
lon_deg = random()*(box[1]-box[0]) + box[0]
lat_deg = random()*(box[3]-box[2]) + box[2]
unit.SetPosition(lon_deg, lat_deg, -325.0)
unit.heading = 28.30
unit.speed = 8.6
unit.cost = 900000000.0
SM.AddUnitToAlliance(unit, 2)
SM.SetUnitLauncherItem(unit.unitName, 0, 'Mk-48 Mod6', 1)
SM.SetUnitLauncherItem(unit.unitName, 1, 'Mk-48 Mod6', 1)
SM.SetUnitLauncherItem(unit.unitName, 2, 'Mk-48 Mod6', 1)
SM.SetUnitLauncherItem(unit.unitName, 3, 'Mk-48 Mod6', 1)
SM.SetUnitLauncherItem(unit.unitName, 4, 'Mk-48 Mod6', 1)
SM.SetUnitLauncherItem(unit.unitName, 5, 'Mk-48 Mod6', 1)
SM.SetUnitLauncherItem(unit.unitName, 6, 'Mk-48 Mod6', 1)
SM.SetUnitLauncherItem(unit.unitName, 7, 'Mk-48 Mod6', 1)
SM.SetUnitLauncherItem(unit.unitName, 8, 'Decoy-1', 10)
SM.SetUnitLauncherItem(unit.unitName, 9, 'Decoy-1', 10)
UI = SM.GetUnitInterface(unit.unitName)
SM.AddToUnitMagazine("USS Seawolf", 'UGM-109C', 12)
SM.AddToUnitMagazine("USS Seawolf", 'Mk-48 Mod6', 20)
SM.AddToUnitMagazine("USS Seawolf", 'Decoy-1', 8)
SM.AddToUnitMagazine("USS Seawolf", 'Noisemaker-1', 6)
SM.AddToUnitMagazine("USS Seawolf", 'UGM-84D Harpoon', 4)
UI.SetSensorState(5, 0)
UI.SetSensorState(6, 0)
UI.AddTask('AvoidCav', 3.000000, 3)
UI.AddTask('Nav', 1.000000, 0)
UI.AddNavWaypointAdvanced(0.562156, 0.754093, 0.000000, 0.000000)
UI.AddTask('SubBattery', 4.000000, 3)
UI.AddTask('SubEvade', 3.000000, 3)
BB = UI.GetBlackboardInterface()
##############################
### Alliance 3 units
##############################
unit = SM.GetDefaultUnit()
unit.className = 'Generic submarine'
unit.unitName = "Neutral Submarine 2"
unit.SetPosition(32.404029, 42.753251, -200.0)
unit.heading = 90.00
unit.speed = 3.0
unit.cost = 1000000000.0
SM.AddUnitToAlliance(unit, 3)
SM.SetUnitLauncherItem(unit.unitName, 0, 'MK-T1', 1)
SM.SetUnitLauncherItem(unit.unitName, 1, 'UGM-84C Harpoon', 8)
UI = SM.GetUnitInterface(unit.unitName)
SM.AddToUnitMagazine("Neutral Submarine 2", 'MK-T1', 16)
UI.SetSensorState(0, 0)
UI.SetSensorState(4, 0)
UI.AddTask('AvoidCav', 3.000000, 3)
UI.AddTask('Nav', 1.000000, 0)
UI.AddNavWaypointAdvanced(0.533382, 0.754320, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.548965, 0.762721, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.608457, 0.753119, 0.000000, 0.000000)
UI.SetNavLoopState(1)
UI.AddTask('SubBattery', 4.000000, 3)
UI.AddTask('SubEvade', 3.000000, 3)
BB = UI.GetBlackboardInterface()
unit = SM.GetDefaultUnit()
unit.className = 'Oil Tanker'
unit.unitName = "Whale"
unit.SetPosition(32.609263, 43.258657, 0.0)
unit.heading = -111.80
unit.speed = 7.8
unit.cost = 0.0
SM.AddUnitToAlliance(unit, 3)
UI = SM.GetUnitInterface(unit.unitName)
UI.AddTask('MissileWarning', 3.000000, 3)
UI.AddTask('Nav', 1.000000, 0)
UI.AddNavWaypointAdvanced(0.559292, 0.749396, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.544969, 0.741047, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.525991, 0.736350, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.502538, 0.724442, 0.000000, 0.000000)
UI.AddTask('PointDefense', 3.000000, 3)
BB = UI.GetBlackboardInterface()
unit = SM.GetDefaultUnit()
unit.className = 'Oil Tanker'
unit.unitName = "Sea Lion"
unit.SetPosition(30.926944, 43.288566, 0.0)
unit.heading = 90.00
unit.speed = 11.0
unit.cost = 0.0
SM.AddUnitToAlliance(unit, 3)
UI = SM.GetUnitInterface(unit.unitName)
UI.AddTask('MissileWarning', 3.000000, 3)
UI.AddTask('Nav', 1.000000, 0)
UI.AddNavWaypointAdvanced(0.605125, 0.752654, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.688556, 0.734822, 0.000000, 0.000000)
UI.AddTask('PointDefense', 3.000000, 3)
BB = UI.GetBlackboardInterface()
unit = SM.GetDefaultUnit()
unit.className = 'Oil Tanker'
unit.unitName = "Black Sea Pearl"
unit.SetPosition(31.829639, 43.849205, 0.0)
unit.heading = 90.00
unit.speed = 7.5
unit.cost = 0.0
SM.AddUnitToAlliance(unit, 3)
UI = SM.GetUnitInterface(unit.unitName)
UI.AddTask('MissileWarning', 3.000000, 3)
UI.AddTask('Nav', 1.000000, 0)
UI.AddNavWaypointAdvanced(0.560545, 0.754384, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.553563, 0.735754, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.507909, 0.725640, 0.000000, 0.000000)
UI.AddTask('PointDefense', 3.000000, 3)
BB = UI.GetBlackboardInterface()
unit = SM.GetDefaultUnit()
unit.className = 'Generic submarine'
unit.unitName = "Neutral Submarine 1"
unit.SetPosition(31.922000, 43.245881, -200.0)
unit.heading = 90.00
unit.speed = 3.0
unit.cost = 1000000000.0
SM.AddUnitToAlliance(unit, 3)
SM.SetUnitLauncherItem(unit.unitName, 0, 'MK-T1', 1)
SM.SetUnitLauncherItem(unit.unitName, 1, 'UGM-84C Harpoon', 8)
UI = SM.GetUnitInterface(unit.unitName)
SM.AddToUnitMagazine("Neutral Submarine 1", 'MK-T1', 15)
UI.SetSensorState(0, 0)
UI.SetSensorState(4, 0)
UI.AddTask('AvoidCav', 3.000000, 3)
UI.AddTask('Nav', 1.000000, 0)
UI.AddNavWaypointAdvanced(0.543000, 0.759308, 0.000000, 0.000000)
UI.AddNavWaypointAdvanced(0.588475, 0.749327, 0.000000, 0.000000)
UI.SetNavLoopState(1)
UI.AddTask('SubBattery', 4.000000, 3)
UI.AddTask('SubEvade', 3.000000, 3)
BB = UI.GetBlackboardInterface()
##############################
### Alliance 1 goals
##############################
goal_temp = SM.DestroyGoal('')
goal_temp.AddTarget('USS Seawolf')
goal_temp.SetQuantity(1)
SM.SetAllianceGoal(1, goal_temp)
SM.SetAllianceROEByType(1, 2, 2, 2, 2)
##############################
### Alliance 2 goals
##############################
goal_temp = SM.DestroyGoal('')
goal_temp.AddTarget('Moskva')
goal_temp.SetQuantity(1)
goal_2_0 = goal_temp
goal_temp = SM.DestroyGoal('')
goal_temp.AddTarget('Kerch')
goal_temp.AddTarget('Moskva')
goal_temp.AddTarget('Pytlivyy')
goal_temp.SetQuantity(2)
goal_2_1 = goal_temp
goal_temp = SM.TimeGoal()
goal_temp.SetPassTimeout(0.0)
goal_temp.SetFailTimeout(31556926.0)
goal_2_2 = goal_temp
goal_temp = SM.CompoundGoal(0)
goal_temp.AddGoal(goal_2_0)
goal_temp.AddGoal(goal_2_1)
goal_temp.AddGoal(goal_2_2)
SM.SetAllianceGoal(2, goal_temp)
SM.SetAllianceROEByType(2, 2, 2, 2, 2)
##############################
### Alliance 3 goals
##############################
goal_temp = SM.TimeGoal()
goal_temp.SetPassTimeout(61200.0)
goal_temp.SetFailTimeout(61200.0)
SM.SetAllianceGoal(3, goal_temp)
SM.SetAllianceROEByType(3, 2, 2, 2, 2)
##############################
### Overlay Graphics
##############################
##############################
### Randomization Info
##############################
SM.SetIncludeProbability('Admiral Chabanenko', 1.000000)
SM.AddRandomBox('Admiral Chabanenko', 31.4026, 31.7581, 43.3295, 43.3669)
SM.SetIncludeProbability('B-290', 1.000000)
SM.AddRandomBox('B-290', -9.5884, -8.2009, 63.7166, 63.7912)
SM.SetIncludeProbability('B-319 Komsomolets Chuvashii', 1.000000)
SM.AddRandomBox('B-319 Komsomolets Chuvashii', -12.6178, -11.9277, 61.9656, 62.2153)
SM.SetIncludeProbability('B-355', 0.500000)
SM.AddRandomBox('B-355', -12.3289, -11.6164, 62.3016, 62.5178)
SM.SetIncludeProbability('B-380 Gorkovsky Komsomolets', 1.000000)
SM.AddRandomBox('B-380 Gorkovsky Komsomolets', 32.2834, 33.0489, 43.6710, 43.9938)
SM.SetIncludeProbability('B-871 Alrossa', 1.000000)
SM.AddRandomBox('B-871 Alrossa', 31.9861, 32.3177, 43.1599, 43.3017)
SM.SetIncludeProbability('HMS Spartan', 1.000000)
SM.AddRandomBox('HMS Spartan', -13.1409, -12.7926, 62.2289, 62.3649)
SM.AddRandomBox('HMS Spartan', -12.9717, -12.9317, 62.2864, 62.3264)
SM.SetIncludeProbability('K-23', 1.000000)
SM.AddRandomBox('K-23', -11.2872, -10.2008, 64.2790, 64.5533)
SM.SetIncludeProbability('K-239 Karp', 1.000000)
SM.AddRandomBox('K-239 Karp', -16.5736, -14.1527, 61.5195, 62.5440)
SM.SetIncludeProbability('K-25', 1.000000)
SM.AddRandomBox('K-25', -7.2552, -7.1306, 64.2225, 64.6639)
SM.SetIncludeProbability('K-284 Akula', 1.000000)
SM.AddRandomBox('K-284 Akula', -9.1701, -9.0127, 64.0996, 64.4044)
SM.SetIncludeProbability('K-373', 1.000000)
SM.AddRandomBox('K-373', -8.6907, -8.0384, 64.6377, 64.8625)
SM.SetIncludeProbability('K-495', 1.000000)
SM.AddRandomBox('K-495', -11.8708, -11.3250, 62.2400, 62.5022)
SM.SetIncludeProbability('K-503', 0.500000)
SM.AddRandomBox('K-503', -14.6953, -12.7976, 62.5479, 62.9397)
SM.AddRandomBox('K-503', -10.7115, -9.5605, 63.0312, 63.1517)
SM.SetIncludeProbability('K-508', 0.500000)
SM.AddRandomBox('K-508', -11.8616, -10.0331, 62.0067, 62.4316)
SM.SetIncludeProbability('Krasny Krym', 1.000000)
SM.AddRandomBox('Krasny Krym', -6.9995, -5.9562, 64.7285, 65.0754)
SM.SetIncludeProbability('Neutral AAW Cruiser', 1.000000)
SM.AddRandomBox('Neutral AAW Cruiser', -10.6864, -9.9700, 63.2589, 63.6332)
SM.SetIncludeProbability('Neutral Sub 1', 1.000000)
SM.AddRandomBox('Neutral Sub 1', -9.1526, -8.3007, 63.9355, 64.1581)
SM.SetIncludeProbability('Neutral Sub 2', 1.000000)
SM.AddRandomBox('Neutral Sub 2', -13.4679, -11.6845, 62.0476, 62.1476)
SM.SetIncludeProbability('Slavny', 1.000000)
SM.AddRandomBox('Slavny', -11.8902, -11.4992, 64.6134, 64.9101)
SM.SetIncludeProbability('USS Bergall', 0.500000)
SM.AddRandomBox('USS Bergall', -10.5761, -9.2939, 63.3368, 63.8419)
SM.SetIncludeProbability('USS Seahorse', 1.000000)
SM.AddRandomBox('USS Seahorse', -10.2092, -9.4574, 63.2602, 63.4337)
SM.SetIncludeProbability('USS Seawolf', 1.000000)
SM.AddRandomBox('USS Seawolf', 30.6764, 32.3636, 42.1574, 43.0012)
| 73.841542
| 2,553
| 0.640021
| 10,083
| 68,968
| 4.335813
| 0.089755
| 0.024658
| 0.044032
| 0.058123
| 0.818976
| 0.771536
| 0.735304
| 0.674573
| 0.639691
| 0.625646
| 0
| 0.170379
| 0.148649
| 68,968
| 933
| 2,554
| 73.920686
| 0.574188
| 0.003117
| 0
| 0.516129
| 0
| 0.048984
| 0.534083
| 0.0193
| 0
| 0
| 0
| 0
| 0
| 1
| 0.001195
| false
| 0.003584
| 0.003584
| 0
| 0.004779
| 0.011947
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
ada304caff7213a3b3644ba35a753e23a5e6fc93
| 527
|
py
|
Python
|
test/conftest.py
|
zbarry/pycudadecon
|
9259a579a3bb2122a2251beb5b910ba2e5828ad3
|
[
"MIT"
] | 46
|
2019-03-04T04:54:39.000Z
|
2022-02-28T04:44:27.000Z
|
test/conftest.py
|
zbarry/pycudadecon
|
9259a579a3bb2122a2251beb5b910ba2e5828ad3
|
[
"MIT"
] | 18
|
2019-03-08T04:31:23.000Z
|
2022-02-07T06:43:15.000Z
|
test/conftest.py
|
zbarry/pycudadecon
|
9259a579a3bb2122a2251beb5b910ba2e5828ad3
|
[
"MIT"
] | 9
|
2019-03-06T03:07:59.000Z
|
2022-03-11T17:02:21.000Z
|
from pathlib import Path
import pytest
from pycudadecon.util import imread
DATA = Path(__file__).parent / "test_data"
@pytest.fixture(scope="session")
def raw_image():
return imread(str(DATA / "im_raw.tif"))
@pytest.fixture(scope="session")
def deskewed_image():
return imread(str(DATA / "im_deskewed.tif"))
@pytest.fixture(scope="session")
def decon_image():
return imread(str(DATA / "im_decon.tif"))
@pytest.fixture(scope="session")
def rotated_image():
return imread(str(DATA / "im_rotated.tif"))
| 18.821429
| 48
| 0.71537
| 73
| 527
| 4.986301
| 0.342466
| 0.142857
| 0.197802
| 0.274725
| 0.618132
| 0.541209
| 0
| 0
| 0
| 0
| 0
| 0
| 0.132827
| 527
| 27
| 49
| 19.518519
| 0.796499
| 0
| 0
| 0.25
| 0
| 0
| 0.166983
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.1875
| 0.25
| 0.6875
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
addd5aabbf4a527dd25b91c8b776720dcb085430
| 130
|
py
|
Python
|
transcript_from_youtube.py
|
LuisAhumada/standup
|
df7a434d8a55f3015a05dbd4fc1ad06538dcb8c0
|
[
"MIT"
] | null | null | null |
transcript_from_youtube.py
|
LuisAhumada/standup
|
df7a434d8a55f3015a05dbd4fc1ad06538dcb8c0
|
[
"MIT"
] | null | null | null |
transcript_from_youtube.py
|
LuisAhumada/standup
|
df7a434d8a55f3015a05dbd4fc1ad06538dcb8c0
|
[
"MIT"
] | null | null | null |
version https://git-lfs.github.com/spec/v1
oid sha256:3f824fb1bff4023ddf795c1ceee20fdf5d6440f6318d958f09d51caf43d33e0d
size 16168
| 32.5
| 75
| 0.884615
| 13
| 130
| 8.846154
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.362903
| 0.046154
| 130
| 3
| 76
| 43.333333
| 0.564516
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
bc04229de85b8d0ad494f6c5bff5f3c908fcb8b3
| 89
|
py
|
Python
|
pyhydrotel/__init__.py
|
mullenkamp/pyhydrotel
|
e16403b59ce345b37c480f043dcd4b03bb3be05a
|
[
"Apache-2.0"
] | 1
|
2020-05-08T10:18:55.000Z
|
2020-05-08T10:18:55.000Z
|
pyhydrotel/__init__.py
|
mullenkamp/pyhydrotel
|
e16403b59ce345b37c480f043dcd4b03bb3be05a
|
[
"Apache-2.0"
] | null | null | null |
pyhydrotel/__init__.py
|
mullenkamp/pyhydrotel
|
e16403b59ce345b37c480f043dcd4b03bb3be05a
|
[
"Apache-2.0"
] | 1
|
2020-09-29T01:22:42.000Z
|
2020-09-29T01:22:42.000Z
|
from pyhydrotel.core import get_sites_mtypes, get_ts_data, get_mtypes, create_site_mtype
| 44.5
| 88
| 0.876404
| 15
| 89
| 4.733333
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.078652
| 89
| 1
| 89
| 89
| 0.865854
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
bc1103f28a0c6cccd751e278a8e5e4ad8d011b9b
| 72
|
py
|
Python
|
PATH/stanford_path.py
|
visionshao/TerminologyExtraction
|
ff23d7794e8bbfbc6c576fd5d46b37b40a652b67
|
[
"MIT"
] | 1
|
2021-04-26T21:44:20.000Z
|
2021-04-26T21:44:20.000Z
|
PATH/stanford_path.py
|
visionshao/TerminologyExtraction
|
ff23d7794e8bbfbc6c576fd5d46b37b40a652b67
|
[
"MIT"
] | null | null | null |
PATH/stanford_path.py
|
visionshao/TerminologyExtraction
|
ff23d7794e8bbfbc6c576fd5d46b37b40a652b67
|
[
"MIT"
] | null | null | null |
stanford_corenlp = r'D:\Codes\Wos_IE\stanford-corenlp-full-2018-02-27'
| 36
| 71
| 0.777778
| 13
| 72
| 4.153846
| 0.846154
| 0.555556
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.117647
| 0.055556
| 72
| 1
| 72
| 72
| 0.676471
| 0
| 0
| 0
| 0
| 0
| 0.676056
| 0.676056
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 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
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
bc117bfc697dab606cdbcf68e65e72a3d3e7fb73
| 284
|
py
|
Python
|
BootGridApp/views.py
|
cs-fullstack-2019-spring/django-bootstrap-grid-cw-Joshtg1104
|
30bd02aa8d398da01eea7c5a87858f9b118f1328
|
[
"Apache-2.0"
] | null | null | null |
BootGridApp/views.py
|
cs-fullstack-2019-spring/django-bootstrap-grid-cw-Joshtg1104
|
30bd02aa8d398da01eea7c5a87858f9b118f1328
|
[
"Apache-2.0"
] | null | null | null |
BootGridApp/views.py
|
cs-fullstack-2019-spring/django-bootstrap-grid-cw-Joshtg1104
|
30bd02aa8d398da01eea7c5a87858f9b118f1328
|
[
"Apache-2.0"
] | null | null | null |
from django.shortcuts import render
# Create your views here.
def index(request):
return render(request, "BootGridApp/index.html")
def page2(request):
return render(request, "BootGridApp/page2.html")
def page3(request):
return render(request, "BootGridApp/page3.html")
| 23.666667
| 52
| 0.746479
| 36
| 284
| 5.888889
| 0.472222
| 0.183962
| 0.268868
| 0.367925
| 0.523585
| 0
| 0
| 0
| 0
| 0
| 0
| 0.016327
| 0.137324
| 284
| 12
| 53
| 23.666667
| 0.84898
| 0.080986
| 0
| 0
| 0
| 0
| 0.253846
| 0.253846
| 0
| 0
| 0
| 0
| 0
| 1
| 0.428571
| false
| 0
| 0.142857
| 0.428571
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
bc1225d47b08ec115c7523f15d5637db02c93400
| 233
|
py
|
Python
|
tis_catch_weight/models/res_config_settings.py
|
guadaltech/jdvp-odoo
|
e399ecf4c66e15a60a8561edec359e75be08140b
|
[
"ADSL"
] | null | null | null |
tis_catch_weight/models/res_config_settings.py
|
guadaltech/jdvp-odoo
|
e399ecf4c66e15a60a8561edec359e75be08140b
|
[
"ADSL"
] | 1
|
2020-04-02T06:39:18.000Z
|
2020-04-02T06:39:18.000Z
|
tis_catch_weight/models/res_config_settings.py
|
guadaltech/jdvp-odoo
|
e399ecf4c66e15a60a8561edec359e75be08140b
|
[
"ADSL"
] | null | null | null |
from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
group_catch_weight = fields.Boolean("Catch Weight", implied_group='tis_catch_weight.group_catch_weight')
| 33.285714
| 108
| 0.793991
| 29
| 233
| 6.103448
| 0.655172
| 0.248588
| 0.180791
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.111588
| 233
| 7
| 108
| 33.285714
| 0.855072
| 0
| 0
| 0
| 0
| 0
| 0.282051
| 0.149573
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
70ae9f056bda2d40375afc027308415004a1e261
| 99
|
py
|
Python
|
ufdl-core-app/src/ufdl/core_app/migrations/cuda/__init__.py
|
waikato-ufdl/ufdl-backend
|
776fc906c61eba6c2f2e6324758e7b8a323e30d7
|
[
"Apache-2.0"
] | null | null | null |
ufdl-core-app/src/ufdl/core_app/migrations/cuda/__init__.py
|
waikato-ufdl/ufdl-backend
|
776fc906c61eba6c2f2e6324758e7b8a323e30d7
|
[
"Apache-2.0"
] | 85
|
2020-07-24T00:04:28.000Z
|
2022-02-10T10:35:15.000Z
|
ufdl-core-app/src/ufdl/core_app/migrations/cuda/__init__.py
|
waikato-ufdl/ufdl-backend
|
776fc906c61eba6c2f2e6324758e7b8a323e30d7
|
[
"Apache-2.0"
] | null | null | null |
"""
Functions for working with the set of known CUDA versions.
"""
from ._cuda import iterate_cuda
| 19.8
| 58
| 0.757576
| 15
| 99
| 4.866667
| 0.866667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.161616
| 99
| 4
| 59
| 24.75
| 0.879518
| 0.585859
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
70b74fa5a9a92eca9ef6d305ce42a87ec11ea328
| 3,887
|
py
|
Python
|
tests/unit/p2p/messages/data.py
|
btclib-org/btclib_node
|
3e5b2a55195e60e1d30505b52bc1ddd8d51c74cf
|
[
"MIT"
] | 4
|
2021-01-25T23:39:13.000Z
|
2021-08-08T06:27:53.000Z
|
tests/unit/p2p/messages/data.py
|
btclib-org/btclib_node
|
3e5b2a55195e60e1d30505b52bc1ddd8d51c74cf
|
[
"MIT"
] | null | null | null |
tests/unit/p2p/messages/data.py
|
btclib-org/btclib_node
|
3e5b2a55195e60e1d30505b52bc1ddd8d51c74cf
|
[
"MIT"
] | 1
|
2020-12-18T06:28:18.000Z
|
2020-12-18T06:28:18.000Z
|
from btclib import script
from btclib.blocks import Block as BlockData
from btclib.blocks import BlockHeader, _generate_merkle_root
from btclib.tx import Tx as TxData
from btclib.tx import TxIn, TxOut
from btclib.tx_in import OutPoint
from btclib_node.p2p.messages import get_payload
from btclib_node.p2p.messages.data import Block, Blocktxn, Headers, Inv, Tx
def test_tx():
tx_in = TxIn(
prevout=OutPoint(),
scriptSig=script.serialize(["00"]),
sequence=0xFFFFFFFF,
txinwitness=[],
)
tx_out = TxOut(
value=50 * 10 ** 8,
scriptPubKey=script.serialize(["00"]),
)
tx = TxData(
version=1,
locktime=0,
vin=[tx_in],
vout=[tx_out],
)
msg = Tx(tx)
msg_bytes = bytes.fromhex("00" * 4) + msg.serialize()
assert msg == Tx.deserialize(get_payload(msg_bytes)[1])
def test_block():
transactions = []
for x in range(10):
tx_in = TxIn(
prevout=OutPoint(),
scriptSig=script.serialize([f"{x}{x}"]),
sequence=0xFFFFFFFF,
txinwitness=[],
)
tx_out = TxOut(
value=50 * 10 ** 8,
scriptPubKey=script.serialize([f"{x}{x}"]),
)
tx = TxData(
version=1,
locktime=0,
vin=[tx_in],
vout=[tx_out],
)
transactions.append(tx)
header = BlockHeader(
version=1,
previousblockhash="00" * 32,
merkleroot="00" * 32,
time=1,
bits=b"\x23\x00\x00\x01",
nonce=1,
)
header.merkleroot = _generate_merkle_root(transactions)
msg = Block(BlockData(header, transactions))
msg_bytes = bytes.fromhex("00" * 4) + msg.serialize()
assert msg == Block.deserialize(get_payload(msg_bytes)[1])
def test_empty_headers():
msg = Headers([])
msg_bytes = bytes.fromhex("00" * 4) + msg.serialize()
assert msg == Headers.deserialize(get_payload(msg_bytes)[1])
def test_headers():
headers = []
for x in range(10):
headers.append(
BlockHeader(
version=70015,
previousblockhash=f"{x}{x}" * 32,
merkleroot="00" * 32,
time=1,
bits=b"\x23\x00\x00\x01",
nonce=1,
)
)
msg = Headers(headers)
msg_bytes = bytes.fromhex("00" * 4) + msg.serialize()
assert msg == Headers.deserialize(get_payload(msg_bytes)[1])
def test_empty_blocktxn():
msg = Blocktxn("00" * 32, [])
msg_bytes = bytes.fromhex("00" * 4) + msg.serialize()
assert msg == Blocktxn.deserialize(get_payload(msg_bytes)[1])
def test_blocktxn():
transactions = []
for x in range(10):
tx_in = TxIn(
prevout=OutPoint(),
scriptSig=script.serialize([f"{x}{x}"]),
sequence=0xFFFFFFFF,
txinwitness=[],
)
tx_out = TxOut(
value=50 * 10 ** 8,
scriptPubKey=script.serialize([f"{x}{x}"]),
)
tx = TxData(
version=1,
locktime=0,
vin=[tx_in],
vout=[tx_out],
)
transactions.append(tx)
msg = Blocktxn("00" * 32, transactions)
msg_bytes = bytes.fromhex("00" * 4) + msg.serialize()
assert msg == Blocktxn.deserialize(get_payload(msg_bytes)[1])
def test_empty_inv():
msg = Inv([])
msg_bytes = bytes.fromhex("00" * 4) + msg.serialize()
assert msg == Inv.deserialize(get_payload(msg_bytes)[1])
def test_filled_inv():
msg = Inv([(1, "00" * 32)])
msg_bytes = bytes.fromhex("00" * 4) + msg.serialize()
assert msg == Inv.deserialize(get_payload(msg_bytes)[1])
def test_invalid_inv():
msg = Inv([(1, "00"), (1, "00")])
msg_bytes = bytes.fromhex("00" * 4) + msg.serialize()
assert msg != Inv.deserialize(get_payload(msg_bytes)[1])
| 27.964029
| 75
| 0.565732
| 464
| 3,887
| 4.603448
| 0.161638
| 0.067416
| 0.054775
| 0.08427
| 0.743914
| 0.70412
| 0.70412
| 0.70412
| 0.664794
| 0.640449
| 0
| 0.047584
| 0.291742
| 3,887
| 138
| 76
| 28.166667
| 0.728296
| 0
| 0
| 0.571429
| 1
| 0
| 0.025727
| 0
| 0
| 0
| 0.007718
| 0
| 0.07563
| 1
| 0.07563
| false
| 0
| 0.067227
| 0
| 0.142857
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
70d440eab0afb6826305284f8d73d72e72ca39da
| 313
|
py
|
Python
|
whosaidwhat/candidates/models.py
|
shun-liang/whosaidwhat
|
66a593abf74f414d05481514887d4cd84cf99d78
|
[
"MIT"
] | null | null | null |
whosaidwhat/candidates/models.py
|
shun-liang/whosaidwhat
|
66a593abf74f414d05481514887d4cd84cf99d78
|
[
"MIT"
] | null | null | null |
whosaidwhat/candidates/models.py
|
shun-liang/whosaidwhat
|
66a593abf74f414d05481514887d4cd84cf99d78
|
[
"MIT"
] | null | null | null |
from django.db import models
class ElectionCandidate(models.Model):
name = models.CharField(max_length=255)
image_url = models.CharField(blank=True, max_length=255)
twitter_username = models.CharField(blank=True, max_length=255)
facebook_page_url = models.CharField(blank=True, max_length=255)
| 31.3
| 68
| 0.773163
| 43
| 313
| 5.44186
| 0.488372
| 0.25641
| 0.205128
| 0.307692
| 0.487179
| 0.487179
| 0.487179
| 0.333333
| 0
| 0
| 0
| 0.043956
| 0.127796
| 313
| 9
| 69
| 34.777778
| 0.813187
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.166667
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
70d66e5ca3e06e303a666bc69c7d4b036fbf8141
| 45
|
py
|
Python
|
tests/__init__.py
|
sonigovi/random_customer
|
96b702ac2b5ab406c19ad5c5cff028ae4f0a6f60
|
[
"MIT"
] | null | null | null |
tests/__init__.py
|
sonigovi/random_customer
|
96b702ac2b5ab406c19ad5c5cff028ae4f0a6f60
|
[
"MIT"
] | null | null | null |
tests/__init__.py
|
sonigovi/random_customer
|
96b702ac2b5ab406c19ad5c5cff028ae4f0a6f60
|
[
"MIT"
] | null | null | null |
"""Unit test package for random_customer."""
| 22.5
| 44
| 0.733333
| 6
| 45
| 5.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 45
| 1
| 45
| 45
| 0.8
| 0.844444
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
70e41db6ca153acd788b0ac86ea4e74f49508b58
| 65
|
py
|
Python
|
example_SetlX_stat_code/stat_python_code/stat_weibull.py
|
leonmutschke/setlX
|
a10333405cba3d9d814d7de9e160561bd5fa4f76
|
[
"BSD-3-Clause"
] | 28
|
2015-01-14T11:12:02.000Z
|
2022-02-15T21:06:05.000Z
|
example_SetlX_stat_code/stat_python_code/stat_weibull.py
|
leonmutschke/setlX
|
a10333405cba3d9d814d7de9e160561bd5fa4f76
|
[
"BSD-3-Clause"
] | 6
|
2016-08-01T14:21:37.000Z
|
2018-06-03T17:15:00.000Z
|
example_SetlX_stat_code/stat_python_code/stat_weibull.py
|
leonmutschke/setlX
|
a10333405cba3d9d814d7de9e160561bd5fa4f76
|
[
"BSD-3-Clause"
] | 18
|
2015-02-11T21:10:18.000Z
|
2018-05-02T07:41:41.000Z
|
from scipy.stats import exponweib
print(exponweib.pdf(2,1,3,0,4))
| 32.5
| 33
| 0.784615
| 13
| 65
| 3.923077
| 0.923077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.081967
| 0.061538
| 65
| 2
| 34
| 32.5
| 0.754098
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0.5
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
|
0
| 5
|
cb08c2edbb08c9bbfdacf71e626b762d53387df1
| 36
|
py
|
Python
|
resources/neurons/kalliopempd/kalliope_new_module_temp_name/__init__.py
|
lya-corp/lya
|
04b32f3191072ed21f20b93397015dbfcf9e7bb3
|
[
"MIT"
] | 3
|
2020-06-19T20:08:54.000Z
|
2021-06-30T11:25:41.000Z
|
resources/neurons/kalliopempd/kalliope_new_module_temp_name/__init__.py
|
flolep2607/Lya
|
669072b6b80ef493591b28ecc29bebd587913af0
|
[
"MIT"
] | null | null | null |
resources/neurons/kalliopempd/kalliope_new_module_temp_name/__init__.py
|
flolep2607/Lya
|
669072b6b80ef493591b28ecc29bebd587913af0
|
[
"MIT"
] | 1
|
2018-04-04T16:10:22.000Z
|
2018-04-04T16:10:22.000Z
|
from kalliopempd import Kalliopempd
| 18
| 35
| 0.888889
| 4
| 36
| 8
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 36
| 1
| 36
| 36
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
cb0961d8d254caebee110b970abdf8813fe93861
| 474
|
py
|
Python
|
SimGeneral/TrackingAnalysis/python/trackingParticleNumberOfLayersProducer_cff.py
|
pasmuss/cmssw
|
566f40c323beef46134485a45ea53349f59ae534
|
[
"Apache-2.0"
] | null | null | null |
SimGeneral/TrackingAnalysis/python/trackingParticleNumberOfLayersProducer_cff.py
|
pasmuss/cmssw
|
566f40c323beef46134485a45ea53349f59ae534
|
[
"Apache-2.0"
] | null | null | null |
SimGeneral/TrackingAnalysis/python/trackingParticleNumberOfLayersProducer_cff.py
|
pasmuss/cmssw
|
566f40c323beef46134485a45ea53349f59ae534
|
[
"Apache-2.0"
] | null | null | null |
from SimGeneral.TrackingAnalysis.trackingParticleNumberOfLayersProducer_cfi import *
from Configuration.Eras.Modifier_fastSim_cff import fastSim
fastSim.toModify(trackingParticleNumberOfLayersProducer, simHits=['famosSimHits:TrackerHits'])
from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
phase2_tracker.toModify(trackingParticleNumberOfLayersProducer, simHits = ["g4SimHits:TrackerHitsPixelBarrelLowTof", "g4SimHits:TrackerHitsPixelEndcapLowTof"])
| 79
| 159
| 0.894515
| 39
| 474
| 10.666667
| 0.512821
| 0.09375
| 0.100962
| 0.139423
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010989
| 0.040084
| 474
| 5
| 160
| 94.8
| 0.903297
| 0
| 0
| 0
| 0
| 0
| 0.21097
| 0.21097
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.6
| 0
| 0.6
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
cb23be59c23de9632ce4447a4552e1068bafa56b
| 379
|
py
|
Python
|
pal/writer/print_mechanism/none.py
|
mars-research/pal
|
5977394cda8750ff5dcb89c2bf193ec1ef4cd137
|
[
"MIT"
] | 26
|
2020-01-06T23:53:17.000Z
|
2022-02-01T08:58:21.000Z
|
pal/writer/print_mechanism/none.py
|
mars-research/pal
|
5977394cda8750ff5dcb89c2bf193ec1ef4cd137
|
[
"MIT"
] | 30
|
2019-11-13T00:55:22.000Z
|
2022-01-06T08:09:35.000Z
|
pal/writer/print_mechanism/none.py
|
mars-research/pal
|
5977394cda8750ff5dcb89c2bf193ec1ef4cd137
|
[
"MIT"
] | 14
|
2019-11-15T16:56:22.000Z
|
2021-12-22T10:14:17.000Z
|
from pal.writer.print_mechanism.print_mechanism import PrintMechanismWriter
class NonePrintMechanismWriter(PrintMechanismWriter):
def declare_print_mechanism_dependencies(self, outfile, register):
pass
def print_value_as_register(self, outfile, register, value):
pass
def print_value_as_field(self, outfile, register, field, value):
pass
| 27.071429
| 75
| 0.765172
| 42
| 379
| 6.642857
| 0.452381
| 0.150538
| 0.204301
| 0.121864
| 0.136201
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.171504
| 379
| 13
| 76
| 29.153846
| 0.888535
| 0
| 0
| 0.375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.375
| false
| 0.375
| 0.125
| 0
| 0.625
| 0.5
| 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
| 1
| 0
| 1
| 0
| 0
| 1
| 1
|
0
| 5
|
cb4cd4772a24dc51c1592126451aeaf9599d0240
| 13,971
|
py
|
Python
|
appengine/findit/handlers/test/check_reverted_cls_test.py
|
allaparthi/monorail
|
e18645fc1b952a5a6ff5f06e0c740d75f1904473
|
[
"BSD-3-Clause"
] | 2
|
2021-04-13T21:22:18.000Z
|
2021-09-07T02:11:57.000Z
|
appengine/findit/handlers/test/check_reverted_cls_test.py
|
allaparthi/monorail
|
e18645fc1b952a5a6ff5f06e0c740d75f1904473
|
[
"BSD-3-Clause"
] | 16
|
2020-09-07T11:55:09.000Z
|
2022-03-02T05:47:58.000Z
|
appengine/findit/handlers/test/check_reverted_cls_test.py
|
allaparthi/monorail
|
e18645fc1b952a5a6ff5f06e0c740d75f1904473
|
[
"BSD-3-Clause"
] | null | null | null |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from datetime import datetime
import mock
import webapp2
from common import constants
from handlers import check_reverted_cls
from infra_api_clients.codereview import cl_info
from infra_api_clients.codereview import codereview_util
from infra_api_clients.codereview.gerrit import Gerrit
from libs import time_util
from model import revert_cl_status
from model.base_suspected_cl import RevertCL
from model.wf_suspected_cl import WfSuspectedCL
from services import git
from waterfall.test import wf_testcase
_MOCKED_FINDIT_REVERTING_CL = cl_info.ClInfo('codereview.chromium.org', '456')
_MOCKED_FINDIT_REVERTING_CL.commits = [
cl_info.Commit('1001', 'e5f6a7b8', [], datetime(2017, 3, 15, 1, 10))
]
_MOCKED_FINDIT_REVERTING_CL.commit_attempts = {
'1001':
cl_info.CommitAttempt('1001', 'sheriff@chromium.org',
datetime(2017, 3, 15, 0, 7)),
}
_MOCKED_FINDIT_REVERTED_CL_INFO = cl_info.ClInfo('codereview.chromium.org',
'123')
_MOCKED_FINDIT_REVERTED_CL_INFO.commits = [
cl_info.Commit('1000', 'a1b2c3d4', [], 1)
]
_MOCKED_FINDIT_REVERTED_CL_INFO.reverts = [
cl_info.Revert('1000', _MOCKED_FINDIT_REVERTING_CL,
constants.DEFAULT_SERVICE_ACCOUNT, datetime(
2017, 3, 15, 1, 9))
]
_MOCKED_SHERIFF_REVERTING_CL = cl_info.ClInfo('codereview.chromium.org', '456')
_MOCKED_SHERIFF_REVERTING_CL.commits = [
cl_info.Commit('1001', 'e5f6a7b8', [], datetime(2017, 3, 15, 0, 8))
]
_MOCKED_SHERIFF_REVERTING_CL.commit_attempts = {
'1001':
cl_info.CommitAttempt('1001', 'sheriff@chromium.org',
datetime(2017, 3, 15, 0, 7)),
}
_MOCKED_SHERIFF_REVERTED_CL_INFO = cl_info.ClInfo('codereview.chromium.org',
'123')
_MOCKED_SHERIFF_REVERTED_CL_INFO.commits = [
cl_info.Commit('1000', 'a1b2c3d4', [], 1)
]
_MOCKED_SHERIFF_REVERTED_CL_INFO.reverts = [
cl_info.Revert('1000', _MOCKED_SHERIFF_REVERTING_CL, 'sheriff@chromium.org',
datetime(2017, 3, 15, 1, 7)),
cl_info.Revert('1000', _MOCKED_FINDIT_REVERTING_CL,
constants.DEFAULT_SERVICE_ACCOUNT, datetime(
2017, 3, 15, 1, 9))
] # Findit slower.
_MOCKED_SHERIFF_FAST_REVERTING_CL = cl_info.ClInfo('codereview.chromium.org',
'456')
_MOCKED_SHERIFF_FAST_REVERTING_CL.commits = [
cl_info.Commit('1001', 'e5f6a7b8', [], datetime(2017, 3, 15, 0, 8))
]
_MOCKED_SHERIFF_FAST_REVERTED_CL_INFO = cl_info.ClInfo(
'codereview.chromium.org', '123')
_MOCKED_SHERIFF_FAST_REVERTED_CL_INFO.commits = [
cl_info.Commit('1000', 'a1b2c3d4', [], 1)
]
_MOCKED_SHERIFF_FAST_REVERTED_CL_INFO.reverts = [
cl_info.Revert('1000', _MOCKED_SHERIFF_REVERTING_CL, 'sheriff@chromium.org',
datetime(2017, 3, 15, 1, 7))
]
_MOCKED_FINDIT_FALSE_POSITIVE_REVERT_CL = cl_info.ClInfo(
'codereview.chromium.org', '456')
_MOCKED_FINDIT_FALSE_POSITIVE_REVERT_CL.commits = [] # Never committed.
_MOCKED_FINDIT_FALSE_POSITIVE_CL_INFO = cl_info.ClInfo(
'codereview.chromium.org', '123')
_MOCKED_FINDIT_FALSE_POSITIVE_CL_INFO.commits = [
cl_info.Commit('1000', 'a1b2c3d4', [], 1)
]
_MOCKED_FINDIT_FALSE_POSITIVE_CL_INFO.reverts = [
cl_info.Revert('1000', _MOCKED_FINDIT_FALSE_POSITIVE_REVERT_CL,
constants.DEFAULT_SERVICE_ACCOUNT, datetime(
2017, 3, 15, 1, 9))
]
class CheckRevertedCLsTest(wf_testcase.WaterfallTestCase):
app_module = webapp2.WSGIApplication(
[
('/check-reverted-cls', check_reverted_cls.CheckRevertedCLs),
],
debug=True,
)
def testUpdateSuspectedCLBailOut(self):
suspected_cl = WfSuspectedCL.Create('chromium', 'a1b2c3d4', 1)
suspected_cl.sheriff_action_time = datetime(2017, 4, 6, 0, 0)
check_reverted_cls._UpdateSuspectedCL(suspected_cl,
datetime(2017, 4, 6, 0, 1))
self.assertEqual(
datetime(2017, 4, 6, 0, 0), suspected_cl.sheriff_action_time)
def testCheckRevertStatusOfSuspectedCLNoRevert(self):
suspected_cl = WfSuspectedCL.Create('chromium', 'a1b2c3d4', 1)
self.assertEqual(
(False, None, None),
check_reverted_cls._CheckRevertStatusOfSuspectedCL(suspected_cl))
@mock.patch.object(codereview_util, 'IsCodeReviewGerrit', return_value=False)
@mock.patch.object(git, 'GetCodeReviewInfoForACommit')
def testCheckRevertStatusOfSuspectedCLRevertedNoCodeReview(self, mock_fn, _):
mock_fn.return_value = {
'commit_position': 1,
'code_review_url': 'badhost.org/123',
'review_server_host': 'badhost.org/123',
'review_change_id': '123'
}
suspected_cl = WfSuspectedCL.Create('chromium', 'a1b2c3d4', 1)
suspected_cl.revert_cl = RevertCL()
self.assertEqual(
(None, None, None),
check_reverted_cls._CheckRevertStatusOfSuspectedCL(suspected_cl))
@mock.patch.object(codereview_util, 'IsCodeReviewGerrit', return_value=True)
@mock.patch.object(Gerrit, 'GetClDetails', return_value=None)
@mock.patch.object(git, 'GetCodeReviewInfoForACommit')
def testCheckRevertStatusOfSuspectedCLNoClDetails(self, mock_fn, *_):
mock_fn.return_value = {
'commit_position': 1,
'code_review_url': 'codereview.chromium.org/123',
'review_server_host': 'codereview.chromium.org',
'review_change_id': '123'
}
suspected_cl = WfSuspectedCL.Create('chromium', 'a1b2c3d4', 1)
suspected_cl.should_be_reverted = True
self.assertEqual(
(None, 'https://codereview.chromium.org/q/123', None),
check_reverted_cls._CheckRevertStatusOfSuspectedCL(suspected_cl))
@mock.patch.object(codereview_util, 'IsCodeReviewGerrit', return_value=True)
@mock.patch.object(
Gerrit,
'GetClDetails',
return_value=_MOCKED_SHERIFF_FAST_REVERTED_CL_INFO)
@mock.patch(
'infra_api_clients.codereview.cl_info.ClInfo.GetRevertCLsByRevision',
mock.Mock(return_value=None))
@mock.patch.object(git, 'GetCodeReviewInfoForACommit')
def testCheckRevertStatusOfSuspectedCLNoRevertCLsByRevision(self, mock_f, *_):
mock_f.return_value = {
'commit_position': 1,
'code_review_url': 'codereview.chromium.org/123',
'review_server_host': 'codereview.chromium.org',
'review_change_id': '123'
}
suspected_cl = WfSuspectedCL.Create('chromium', 'a1b2c3d4', 1)
suspected_cl.should_be_reverted = True
self.assertEqual(
(None, 'https://codereview.chromium.org/q/123', None),
check_reverted_cls._CheckRevertStatusOfSuspectedCL(suspected_cl))
@mock.patch.object(codereview_util, 'IsCodeReviewGerrit', return_value=True)
@mock.patch.object(
Gerrit, 'GetClDetails', return_value=_MOCKED_FINDIT_REVERTED_CL_INFO)
@mock.patch.object(git, 'GetCodeReviewInfoForACommit')
def testCheckRevertStatusOfSuspectedCLReverted(self, mock_fn, *_):
mock_fn.return_value = {
'commit_position': 1,
'code_review_url': 'codereview.chromium.org/q/123',
'review_server_host': 'codereview.chromium.org',
'review_change_id': '123'
}
suspected_cl = WfSuspectedCL.Create('chromium', 'a1b2c3d4', 1)
suspected_cl.revert_cl = RevertCL()
result = check_reverted_cls._CheckRevertStatusOfSuspectedCL(suspected_cl)
self.assertTrue(result[0])
self.assertEqual(result[1], 'https://codereview.chromium.org/q/123')
self.assertEqual(result[2], revert_cl_status.COMMITTED)
self.assertEqual(revert_cl_status.COMMITTED, suspected_cl.revert_cl.status)
@mock.patch.object(codereview_util, 'IsCodeReviewGerrit', return_value=True)
@mock.patch.object(
Gerrit, 'GetClDetails', return_value=_MOCKED_SHERIFF_REVERTED_CL_INFO)
@mock.patch.object(git, 'GetCodeReviewInfoForACommit')
def testCheckRevertStatusOfSuspectedCLSheriffIgnored(self, mock_fn, *_):
mock_fn.return_value = {
'commit_position': 1,
'code_review_url': 'codereview.chromium.org/123',
'review_server_host': 'codereview.chromium.org',
'review_change_id': '123'
}
suspected_cl = WfSuspectedCL.Create('chromium', 'a1b2c3d4', 1)
suspected_cl.revert_cl = RevertCL()
check_reverted_cls._CheckRevertStatusOfSuspectedCL(suspected_cl)
self.assertEqual(revert_cl_status.DUPLICATE, suspected_cl.revert_cl.status)
@mock.patch.object(codereview_util, 'IsCodeReviewGerrit', return_value=True)
@mock.patch.object(
Gerrit,
'GetClDetails',
return_value=_MOCKED_SHERIFF_FAST_REVERTED_CL_INFO)
@mock.patch.object(git, 'GetCodeReviewInfoForACommit')
def testCheckRevertStatusOfSuspectedCLSheriffMuchFaster(self, mock_fn, *_):
mock_fn.return_value = {
'commit_position': 1,
'code_review_url': 'codereview.chromium.org/123',
'review_server_host': 'codereview.chromium.org',
'review_change_id': '123'
}
suspected_cl = WfSuspectedCL.Create('chromium', 'a1b2c3d4', 1)
suspected_cl.should_be_reverted = True
check_reverted_cls._CheckRevertStatusOfSuspectedCL(suspected_cl)
self.assertEqual(
datetime(2017, 3, 15, 1, 7), suspected_cl.sheriff_action_time)
@mock.patch.object(codereview_util, 'IsCodeReviewGerrit', return_value=True)
@mock.patch.object(
Gerrit,
'GetClDetails',
return_value=_MOCKED_FINDIT_FALSE_POSITIVE_CL_INFO)
@mock.patch.object(git, 'GetCodeReviewInfoForACommit')
def testCheckRevertStatusOfSuspectedCLFalsePositive(self, mock_fn, *_):
mock_fn.return_value = {
'commit_position': 1,
'code_review_url': 'codereview.chromium.org/123',
'review_server_host': 'codereview.chromium.org',
'review_change_id': '123'
}
suspected_cl = WfSuspectedCL.Create('chromium', 'a1b2c3d4', 1)
suspected_cl.revert_cl = RevertCL()
check_reverted_cls._CheckRevertStatusOfSuspectedCL(suspected_cl)
self.assertEqual(revert_cl_status.FALSE_POSITIVE,
suspected_cl.revert_cl.status)
@mock.patch.object(
check_reverted_cls,
'_CheckRevertStatusOfSuspectedCL',
return_value=(True, 'https://codereview.chromium.org/q/123/',
revert_cl_status.COMMITTED))
def testGetRevertCLData(self, _):
start_date = datetime(2017, 4, 4, 0, 0)
end_date = datetime(2017, 4, 6, 0, 0)
suspected_cl = WfSuspectedCL.Create('chromium', 'a1b2c3d4', 1)
suspected_cl.identified_time = start_date
suspected_cl.cr_notification_time = datetime(2017, 4, 5, 0, 0)
suspected_cl.put()
self.assertEqual({
'start_date':
'2017-04-04 00:00:00 UTC',
'end_date':
'2017-04-06 00:00:00 UTC',
'processed': [{
'cr_notification_time': '2017-04-05 00:00:00 UTC',
'outcome': 'committed',
'url': 'https://codereview.chromium.org/q/123/',
}],
'undetermined': []
}, check_reverted_cls._GetRevertCLData(start_date, end_date))
@mock.patch.object(
check_reverted_cls,
'_CheckRevertStatusOfSuspectedCL',
return_value=(None, 'https://codereview.chromium.org/123/', None))
def testGetRevertCLDataFailedToDetermine(self, _):
start_date = datetime(2017, 4, 4, 0, 0)
end_date = datetime(2017, 4, 6, 0, 0)
suspected_cl = WfSuspectedCL.Create('chromium', 'a1b2c3d4', 1)
suspected_cl.identified_time = start_date
suspected_cl.cr_notification_time = datetime(2017, 4, 5, 0, 0)
suspected_cl.put()
self.assertEqual({
'start_date':
'2017-04-04 00:00:00 UTC',
'end_date':
'2017-04-06 00:00:00 UTC',
'undetermined': [{
'cr_notification_time': '2017-04-05 00:00:00 UTC',
'url': 'https://codereview.chromium.org/123/',
'outcome': None,
}],
'processed': []
}, check_reverted_cls._GetRevertCLData(start_date, end_date))
@mock.patch.object(
time_util,
'GetMostRecentUTCMidnight',
return_value=datetime(2017, 4, 16, 0, 0, 0))
def testGetNoStartEndDates(self, _):
response = self.test_app.get(
'/check-reverted-cls',
params={'format': 'json'},
headers={'X-AppEngine-Cron': 'true'},
)
self.assertEquals(response.status_int, 200)
expected_response = {
'start_date': '2017-04-14 00:00:00 UTC',
'end_date': '2017-04-15 00:00:00 UTC',
'processed': [],
'undetermined': []
}
self.assertEquals(expected_response, response.json_body)
@mock.patch.object(
time_util,
'GetMostRecentUTCMidnight',
return_value=datetime(2017, 4, 16, 0, 0, 0))
@mock.patch.object(
check_reverted_cls,
'_GetRevertCLData',
return_value={
'start_date':
'2017-04-08 00:00:00 UTC',
'end_date':
'2017-04-16 00:00:00 UTC',
'processed': [{
'cr_notification_time': '2017-04-15 00:00:01 UTC',
'outcome': 'reverted',
'url': 'url'
}],
'undetermined': []
})
def testGet(self, *_):
response = self.test_app.get(
'/check-reverted-cls?start_date=2017-04-08&end_date=2017-04-16',
params={'format': 'json'},
headers={'X-AppEngine-Cron': 'true'},
)
self.assertEquals(response.status_int, 200)
expected_response = {
'start_date':
'2017-04-08 00:00:00 UTC',
'end_date':
'2017-04-16 00:00:00 UTC',
'processed': [{
'cr_notification_time': '2017-04-15 00:00:01 UTC',
'outcome': 'reverted',
'url': 'url'
}],
'undetermined': []
}
self.assertEquals(expected_response, response.json_body)
| 38.06812
| 80
| 0.67633
| 1,594
| 13,971
| 5.624843
| 0.117315
| 0.027437
| 0.063239
| 0.012046
| 0.818648
| 0.783739
| 0.737006
| 0.730203
| 0.689717
| 0.62157
| 0
| 0.059788
| 0.201489
| 13,971
| 366
| 81
| 38.172131
| 0.743905
| 0.013385
| 0
| 0.597523
| 0
| 0.003096
| 0.221367
| 0.066192
| 0
| 0
| 0
| 0
| 0.055728
| 1
| 0.040248
| false
| 0
| 0.043344
| 0
| 0.089783
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
cb538a00c789fa0c2039ce9a94f7841b878e7908
| 258
|
py
|
Python
|
admin_servers/models.py
|
Frieda0315/404
|
27c2c5bd804d4582192320138c3457592067943f
|
[
"Apache-2.0"
] | 3
|
2021-09-15T04:02:59.000Z
|
2021-11-03T07:18:35.000Z
|
admin_servers/models.py
|
Frieda0315/404
|
27c2c5bd804d4582192320138c3457592067943f
|
[
"Apache-2.0"
] | 36
|
2021-09-22T05:28:14.000Z
|
2021-12-05T18:10:08.000Z
|
admin_servers/models.py
|
Frieda0315/404
|
27c2c5bd804d4582192320138c3457592067943f
|
[
"Apache-2.0"
] | 2
|
2021-09-15T04:17:54.000Z
|
2022-01-11T17:13:51.000Z
|
from django.db import models
# Create your models here.
class Node(models.Model):
url = models.CharField(primary_key=True,unique=True,max_length=180)
user_name = models.CharField(max_length=120)
password = models.CharField(max_length=120)
| 21.5
| 71
| 0.748062
| 37
| 258
| 5.081081
| 0.648649
| 0.239362
| 0.191489
| 0.255319
| 0.287234
| 0
| 0
| 0
| 0
| 0
| 0
| 0.041096
| 0.151163
| 258
| 12
| 72
| 21.5
| 0.817352
| 0.093023
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.2
| 0.2
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
cb5978a9d34eace8977026d03e4e45ddbd40fbdb
| 107
|
py
|
Python
|
practice_atcoder/abs/product.py
|
powerpenguincat/practice-atcoder
|
6c656d0ebe3fc12d7df50112af2ef5c946bbaf46
|
[
"MIT"
] | null | null | null |
practice_atcoder/abs/product.py
|
powerpenguincat/practice-atcoder
|
6c656d0ebe3fc12d7df50112af2ef5c946bbaf46
|
[
"MIT"
] | null | null | null |
practice_atcoder/abs/product.py
|
powerpenguincat/practice-atcoder
|
6c656d0ebe3fc12d7df50112af2ef5c946bbaf46
|
[
"MIT"
] | null | null | null |
def question(ab):
exa, exb = map(int, ab.split())
return "Odd" if exa * exb % 2 == 1 else "Even"
| 17.833333
| 50
| 0.551402
| 18
| 107
| 3.277778
| 0.833333
| 0.20339
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.025641
| 0.271028
| 107
| 5
| 51
| 21.4
| 0.730769
| 0
| 0
| 0
| 0
| 0
| 0.066038
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
cb9fe7597bda0efb393d23609c23c263b1f57c72
| 103
|
py
|
Python
|
presentations/admin.py
|
kofakira/website-fk
|
2d44a65dd32959a768f0f9d7dc826d193e78bfb6
|
[
"WTFPL"
] | 1
|
2020-02-07T17:38:14.000Z
|
2020-02-07T17:38:14.000Z
|
presentations/admin.py
|
kofakira/website-fk
|
2d44a65dd32959a768f0f9d7dc826d193e78bfb6
|
[
"WTFPL"
] | null | null | null |
presentations/admin.py
|
kofakira/website-fk
|
2d44a65dd32959a768f0f9d7dc826d193e78bfb6
|
[
"WTFPL"
] | null | null | null |
from django.contrib import admin
from .models import Presentation
admin.site.register(Presentation)
| 14.714286
| 33
| 0.825243
| 13
| 103
| 6.538462
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116505
| 103
| 6
| 34
| 17.166667
| 0.934066
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
cbae14598ff37341c35e8b8adca1f3938cba890e
| 239
|
py
|
Python
|
corehq/apps/hqadmin/tasks.py
|
johan--/commcare-hq
|
86ee99c54f55ee94e4c8f2f6f30fc44e10e69ebd
|
[
"BSD-3-Clause"
] | null | null | null |
corehq/apps/hqadmin/tasks.py
|
johan--/commcare-hq
|
86ee99c54f55ee94e4c8f2f6f30fc44e10e69ebd
|
[
"BSD-3-Clause"
] | 1
|
2022-03-12T01:03:25.000Z
|
2022-03-12T01:03:25.000Z
|
corehq/apps/hqadmin/tasks.py
|
johan--/commcare-hq
|
86ee99c54f55ee94e4c8f2f6f30fc44e10e69ebd
|
[
"BSD-3-Clause"
] | null | null | null |
from celery.schedules import crontab
from celery.task.base import periodic_task
from .utils import pillow_seq_store
@periodic_task(run_every=crontab(hour=0), queue='background_queue')
def pillow_seq_store_task():
pillow_seq_store()
| 23.9
| 67
| 0.8159
| 36
| 239
| 5.111111
| 0.527778
| 0.146739
| 0.228261
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.004651
| 0.100418
| 239
| 9
| 68
| 26.555556
| 0.851163
| 0
| 0
| 0
| 0
| 0
| 0.066946
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| true
| 0
| 0.5
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
1dd88083c7811c9ecb4d47ce01a4dd0e737e91f0
| 290
|
py
|
Python
|
Packet.py
|
FernandoKtatal/Redes
|
d823e5362e11251b98979fe74a459d30900cb97b
|
[
"MIT"
] | null | null | null |
Packet.py
|
FernandoKtatal/Redes
|
d823e5362e11251b98979fe74a459d30900cb97b
|
[
"MIT"
] | null | null | null |
Packet.py
|
FernandoKtatal/Redes
|
d823e5362e11251b98979fe74a459d30900cb97b
|
[
"MIT"
] | null | null | null |
class Packet(object):
def __init__(self, ip_origin, ip_destination, data):
self.ip_origin = ip_origin
self.ip_destination = ip_destination
self.data = data
def __str__(self):
return '{0}{1}{2}'.format(self.ip_origin, self.ip_destination, self.data)
| 36.25
| 81
| 0.665517
| 40
| 290
| 4.425
| 0.4
| 0.169492
| 0.20339
| 0.158192
| 0.282486
| 0
| 0
| 0
| 0
| 0
| 0
| 0.013216
| 0.217241
| 290
| 8
| 81
| 36.25
| 0.76652
| 0
| 0
| 0
| 0
| 0
| 0.030928
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0
| 0.142857
| 0.571429
| 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
| 1
| 1
| 0
|
0
| 5
|
1df382c4dacc1773d9561532ea4919f030fc236b
| 2,516
|
py
|
Python
|
setup.py
|
WRY-learning/k3stopwatch
|
8b2d041480cbb5f153796404bbeb19dde2cd1a99
|
[
"MIT"
] | null | null | null |
setup.py
|
WRY-learning/k3stopwatch
|
8b2d041480cbb5f153796404bbeb19dde2cd1a99
|
[
"MIT"
] | 2
|
2021-10-16T11:39:53.000Z
|
2022-03-23T07:02:27.000Z
|
setup.py
|
WRY-learning/k3stopwatch
|
8b2d041480cbb5f153796404bbeb19dde2cd1a99
|
[
"MIT"
] | 1
|
2021-08-20T07:35:49.000Z
|
2021-08-20T07:35:49.000Z
|
# DO NOT EDIT!!! built with `python _building/build_setup.py`
import setuptools
setuptools.setup(
name="k3stopwatch",
packages=["k3stopwatch"],
version="0.1.1",
license='MIT',
description='StopWatch - library for adding timers and tags in your code for performance monitoring',
long_description='# k3stopwatch\n\n[](https://github.com/pykit3/k3stopwatch/actions/workflows/python-package.yml)\n[](https://travis-ci.com/pykit3/k3stopwatch)\n[](https://k3stopwatch.readthedocs.io/en/stable/?badge=stable)\n[](https://pypi.org/project/k3stopwatch)\n\nStopWatch - library for adding timers and tags in your code for performance monitoring\n\nk3stopwatch is a component of [pykit3] project: a python3 toolkit set.\n\n\nStopWatch operates on a notion of "spans" which represent scopes of code for which we\nwant to measure timing. Spans can be nested and placed inside loops for aggregation.\n\nStopWatch requires a root scope which upon completion signifies the end of the round\nof measurements. On a server, you might use a single request as your root scope.\n\nStopWatch produces two kinds of reports.\n1) Aggregated (see _reported_values).\n2) Non-aggregated or "tracing" (see _reported_traces).\n\n\n\n# Install\n\n```\npip install k3stopwatch\n```\n\n# Synopsis\n\n```python\n\nimport k3stopwatch\nsw = k3stopwatch.StopWatch()\n\nwith sw.timer(\'rwoot\'):\n for i in range(50):\n with sw.timer(\'inner_task\'):\n print("do_inner_task(i)")\n\n```\n\n# Author\n\nZhang Yanpo (张炎泼) <drdr.xp@gmail.com>\n\n# Copyright and License\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>\n\n\n[pykit3]: https://github.com/pykit3',
long_description_content_type="text/markdown",
author='Zhang Yanpo',
author_email='drdr.xp@gmail.com',
url='https://github.com/pykit3/k3stopwatch',
keywords=['python', 'stopwatch'],
python_requires='>=3.0',
install_requires=['k3ut>=0.1.15,<0.2'],
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries',
] + ['Programming Language :: Python :: 3'],
)
| 104.833333
| 1,733
| 0.72496
| 365
| 2,516
| 4.953425
| 0.476712
| 0.016593
| 0.009956
| 0.044248
| 0.21958
| 0.202434
| 0.165929
| 0.165929
| 0.139381
| 0.139381
| 0
| 0.021238
| 0.120429
| 2,516
| 23
| 1,734
| 109.391304
| 0.795752
| 0.02345
| 0
| 0
| 1
| 0.095238
| 0.837882
| 0.112831
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.095238
| 0
| 0.095238
| 0.047619
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
3807d8e7fcd01dda3ebca6d60fadf1af1ec8adcf
| 428
|
py
|
Python
|
linguine/untokenize.py
|
ritlinguine/linguine-python
|
5dee96dea64523d673ae1efc88d50e9309f4dd5e
|
[
"MIT"
] | 1
|
2018-11-26T18:01:32.000Z
|
2018-11-26T18:01:32.000Z
|
linguine/untokenize.py
|
ritlinguine/linguine-python
|
5dee96dea64523d673ae1efc88d50e9309f4dd5e
|
[
"MIT"
] | null | null | null |
linguine/untokenize.py
|
ritlinguine/linguine-python
|
5dee96dea64523d673ae1efc88d50e9309f4dd5e
|
[
"MIT"
] | 1
|
2018-11-26T18:01:33.000Z
|
2018-11-26T18:01:33.000Z
|
import string
def untokenize(tokens):
# Joins all tokens in the list into a single string.
# If a token doesn't start with an apostrophe and isn't a punctuation mark, add a space in front of it before joining.
# Then strip the total string so that leading spaces and trailing spaces are removed.
return "".join([" " + i if not i.startswith("'") and i not in string.punctuation else i for i in tokens]).strip()
| 47.555556
| 122
| 0.714953
| 73
| 428
| 4.191781
| 0.671233
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.21028
| 428
| 8
| 123
| 53.5
| 0.905325
| 0.586449
| 0
| 0
| 0
| 0
| 0.011561
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 5
|
3818f1213da95efb8426fe36884b06b0debee722
| 4,826
|
py
|
Python
|
app/rvp.py
|
tanansatpal/CollegePredictor
|
5435b8877c2738d7f52b5099900364c69d6c8da5
|
[
"MIT"
] | null | null | null |
app/rvp.py
|
tanansatpal/CollegePredictor
|
5435b8877c2738d7f52b5099900364c69d6c8da5
|
[
"MIT"
] | null | null | null |
app/rvp.py
|
tanansatpal/CollegePredictor
|
5435b8877c2738d7f52b5099900364c69d6c8da5
|
[
"MIT"
] | null | null | null |
def pvr(perc,pwd,category):
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
rvp=pd.read_csv('rvp_cleaned.csv')
rvp_g=rvp[rvp['CATEGORY']=='GEN']
rvp_gp=rvp[rvp['CATEGORY']=='GEN-PwD']
rvp_e=rvp[rvp['CATEGORY']=='EWS']
rvp_ep=rvp[rvp['CATEGORY']=='EWS-PwD']
rvp_sc=rvp[rvp['CATEGORY']=='SC']
rvp_scp=rvp[rvp['CATEGORY']=='SC-PwD']
rvp_st=rvp[rvp['CATEGORY']=='ST']
rvp_stp=rvp[rvp['CATEGORY']=='ST-PwD']
rvp_ob=rvp[rvp['CATEGORY']=='OBC-NCL']
rvp_obp=rvp[rvp['CATEGORY']=='OBC-NCL-PwD']
if(pwd=='YES'):
if(category=='GEN'):
X=rvp_gp['PERCENTILE'].values.reshape(-1,1)
y=rvp_gp['RANK'].values.reshape(-1,1)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
regressor = LinearRegression()
regressor.fit(X_train, y_train)
x=pd.Series([perc])
z=regressor.predict(x.values.reshape(-1,1))
elif(category=='SC'):
X=rvp_scp['PERCENTILE'].values.reshape(-1,1)
y=rvp_scp['RANK'].values.reshape(-1,1)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
regressor = LinearRegression()
regressor.fit(X_train, y_train)
x=pd.Series([perc])
z=regressor.predict(x.values.reshape(-1,1))
elif(category=='ST'):
X=rvp_stp['PERCENTILE'].values.reshape(-1,1)
y=rvp_stp['RANK'].values.reshape(-1,1)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
regressor = LinearRegression()
regressor.fit(X_train, y_train)
x=pd.Series([perc])
z=regressor.predict(x.values.reshape(-1,1))
elif(category=='EWS'):
X=rvp_ep['PERCENTILE'].values.reshape(-1,1)
y=rvp_ep['RANK'].values.reshape(-1,1)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
regressor = LinearRegression()
regressor.fit(X_train, y_train)
x=pd.Series([perc])
z=regressor.predict(x.values.reshape(-1,1))
else:
X=rvp_obp['PERCENTILE'].values.reshape(-1,1)
y=rvp_obp['RANK'].values.reshape(-1,1)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
regressor = LinearRegression()
regressor.fit(X_train, y_train)
x=pd.Series([perc])
z=regressor.predict(x.values.reshape(-1,1))
else:
if(category=='GEN'):
X=rvp_g['PERCENTILE'].values.reshape(-1,1)
y=rvp_g['RANK'].values.reshape(-1,1)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
regressor = LinearRegression()
regressor.fit(X_train, y_train)
x=pd.Series([perc])
z=regressor.predict(x.values.reshape(-1,1))
elif(category=='SC'):
X=rvp_sc['PERCENTILE'].values.reshape(-1,1)
y=rvp_sc['RANK'].values.reshape(-1,1)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
regressor = LinearRegression()
regressor.fit(X_train, y_train)
x=pd.Series([perc])
z=regressor.predict(x.values.reshape(-1,1))
elif(category=='ST'):
X=rvp_st['PERCENTILE'].values.reshape(-1,1)
y=rvp_st['RANK'].values.reshape(-1,1)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
regressor = LinearRegression()
regressor.fit(X_train, y_train)
x=pd.Series([perc])
z=regressor.predict(x.values.reshape(-1,1))
elif(category=='EWS'):
X=rvp_e['PERCENTILE'].values.reshape(-1,1)
y=rvp_e['RANK'].values.reshape(-1,1)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
regressor = LinearRegression()
regressor.fit(X_train, y_train)
x=pd.Series([perc])
z=regressor.predict(x.values.reshape(-1,1))
else:
X=rvp_ob['PERCENTILE'].values.reshape(-1,1)
y=rvp_ob['RANK'].values.reshape(-1,1)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
regressor = LinearRegression()
regressor.fit(X_train, y_train)
x=pd.Series([perc])
z=regressor.predict(x.values.reshape(-1,1))
k=float(np.round(z))
if(k<=0):
k=15
return k
| 46.403846
| 100
| 0.582677
| 703
| 4,826
| 3.806543
| 0.091038
| 0.14574
| 0.156951
| 0.168161
| 0.834828
| 0.807175
| 0.807175
| 0.698804
| 0.698804
| 0.698804
| 0
| 0.025898
| 0.255906
| 4,826
| 103
| 101
| 46.854369
| 0.719298
| 0
| 0
| 0.598039
| 0
| 0
| 0.06465
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.009804
| false
| 0
| 0.039216
| 0
| 0.058824
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 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
| 5
|
381f1565d1f90275e7e8e9607f8c3172d88c2dfc
| 163
|
py
|
Python
|
update.py
|
connornishijima/electropi2
|
df1d21021adcac9ed8fac626d5f5b2dc6963d81a
|
[
"MIT"
] | null | null | null |
update.py
|
connornishijima/electropi2
|
df1d21021adcac9ed8fac626d5f5b2dc6963d81a
|
[
"MIT"
] | null | null | null |
update.py
|
connornishijima/electropi2
|
df1d21021adcac9ed8fac626d5f5b2dc6963d81a
|
[
"MIT"
] | null | null | null |
import os
print "Enter commit message:"
commit = raw_input();
os.system("git add *")
os.system("git commit -m '"+commit+"'")
os.system("git push origin master")
| 18.111111
| 39
| 0.680982
| 25
| 163
| 4.4
| 0.6
| 0.218182
| 0.3
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.134969
| 163
| 8
| 40
| 20.375
| 0.780142
| 0
| 0
| 0
| 0
| 0
| 0.417178
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.166667
| null | null | 0.166667
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
382c3ddf8c3ba8de69d210879347121831b66e27
| 181
|
py
|
Python
|
app/helpers.py
|
Simobergius/starter-snake-python
|
d9ad718c78389125be679938fa362d73b19a1084
|
[
"MIT"
] | null | null | null |
app/helpers.py
|
Simobergius/starter-snake-python
|
d9ad718c78389125be679938fa362d73b19a1084
|
[
"MIT"
] | null | null | null |
app/helpers.py
|
Simobergius/starter-snake-python
|
d9ad718c78389125be679938fa362d73b19a1084
|
[
"MIT"
] | null | null | null |
import point
dirs_matrices = {'up': point.point(0,-1), 'down': point.point(0,1), 'left': point.point(-1,0), 'right': point.point(1,0)}
basic_dirs = ['up', 'down', 'left', 'right']
| 36.2
| 121
| 0.618785
| 30
| 181
| 3.666667
| 0.366667
| 0.363636
| 0.2
| 0.218182
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.049383
| 0.104972
| 181
| 5
| 122
| 36.2
| 0.62963
| 0
| 0
| 0
| 0
| 0
| 0.164835
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
3847636ff421aa51bb16fb63c859b116ee75e515
| 85
|
py
|
Python
|
web-server/quiz/admin.py
|
ApLight/groenlandicus
|
61d230d2b1de0674424c2ea00d2d256f7a68db2e
|
[
"MIT"
] | null | null | null |
web-server/quiz/admin.py
|
ApLight/groenlandicus
|
61d230d2b1de0674424c2ea00d2d256f7a68db2e
|
[
"MIT"
] | 14
|
2018-09-01T07:41:10.000Z
|
2018-09-01T19:41:11.000Z
|
web-server/quiz/admin.py
|
ApLight/groenlandicus
|
61d230d2b1de0674424c2ea00d2d256f7a68db2e
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Quiz
admin.site.register(Quiz)
| 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
| 1
| 0
|
0
| 5
|
384ab7a964dbfadac4757fd7b270a03e27cc328c
| 51
|
py
|
Python
|
neptune/internal/cli/__init__.py
|
jiji-online/neptune-cli
|
50cf680a80d141497f9331ab7cdaee49fcb90b0c
|
[
"Apache-2.0"
] | null | null | null |
neptune/internal/cli/__init__.py
|
jiji-online/neptune-cli
|
50cf680a80d141497f9331ab7cdaee49fcb90b0c
|
[
"Apache-2.0"
] | null | null | null |
neptune/internal/cli/__init__.py
|
jiji-online/neptune-cli
|
50cf680a80d141497f9331ab7cdaee49fcb90b0c
|
[
"Apache-2.0"
] | null | null | null |
from neptune.internal.cli.enums import MLFramework
| 25.5
| 50
| 0.862745
| 7
| 51
| 6.285714
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.078431
| 51
| 1
| 51
| 51
| 0.93617
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
6982d78b3355da4939415b4bd91464199479db92
| 150
|
py
|
Python
|
common/moudle/waf_plugins/hyperguard.py
|
ziizhuwy/cify
|
627ae74f6a27d803521df213e8644366dbba183f
|
[
"Apache-2.0"
] | 8
|
2018-10-11T16:05:14.000Z
|
2020-12-30T08:21:15.000Z
|
common/moudle/waf_plugins/hyperguard.py
|
keven1z/cify
|
627ae74f6a27d803521df213e8644366dbba183f
|
[
"Apache-2.0"
] | 1
|
2020-04-22T03:36:59.000Z
|
2020-06-11T06:42:42.000Z
|
common/moudle/waf_plugins/hyperguard.py
|
ziizhuwy/cify
|
627ae74f6a27d803521df213e8644366dbba183f
|
[
"Apache-2.0"
] | 4
|
2019-07-10T06:51:45.000Z
|
2020-04-19T09:52:09.000Z
|
#!/usr/bin/env python
NAME = 'Art of Defence HyperGuard'
def is_waf(self):
# credit goes to W3AF
return self.match_cookie('^WODSESSION=')
| 15
| 44
| 0.68
| 22
| 150
| 4.545455
| 0.954545
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.008264
| 0.193333
| 150
| 9
| 45
| 16.666667
| 0.818182
| 0.266667
| 0
| 0
| 0
| 0
| 0.342593
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0.333333
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
6989d00f45a137ecc8eea55fcfb25e23dece25c6
| 400
|
py
|
Python
|
build/lib/Kronos_heureka_code/Zeit/Datum/Jahr/JahrException.py
|
heureka-code/Kronos-heureka-code
|
0ddbc93ec69f0bc50075071e6a3e406c9cc97737
|
[
"MIT"
] | null | null | null |
build/lib/Kronos_heureka_code/Zeit/Datum/Jahr/JahrException.py
|
heureka-code/Kronos-heureka-code
|
0ddbc93ec69f0bc50075071e6a3e406c9cc97737
|
[
"MIT"
] | null | null | null |
build/lib/Kronos_heureka_code/Zeit/Datum/Jahr/JahrException.py
|
heureka-code/Kronos-heureka-code
|
0ddbc93ec69f0bc50075071e6a3e406c9cc97737
|
[
"MIT"
] | null | null | null |
try:
from ..DatumException import DatumException
except ImportError:
from Kronos_heureka_code.Zeit.Datum.DatumException import DatumException
class JahrException(DatumException):
pass
class JahrKeineGanzeZahl(JahrException):
"""Wird geworfen, wenn etwas anderes als eine ganze Zahl als Jahr gegeben wird:
z.B.: 1,234; 42,1337 bzw. 1.234; 42.1337 Je nach Notation"""
pass
| 25
| 83
| 0.7525
| 51
| 400
| 5.862745
| 0.705882
| 0.133779
| 0.227425
| 0.06689
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.060241
| 0.17
| 400
| 15
| 84
| 26.666667
| 0.840361
| 0.3375
| 0
| 0.25
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.25
| 0.375
| 0
| 0.625
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
|
0
| 5
|
69cb3a759e922d163cade2ae2117ef500a69085a
| 11,780
|
py
|
Python
|
python/turbodbc_test/test_select_arrow.py
|
fjetter/turbodbc
|
b11f0a1bc7d67bc3cbc60f564594f0e735f524f4
|
[
"MIT"
] | null | null | null |
python/turbodbc_test/test_select_arrow.py
|
fjetter/turbodbc
|
b11f0a1bc7d67bc3cbc60f564594f0e735f524f4
|
[
"MIT"
] | null | null | null |
python/turbodbc_test/test_select_arrow.py
|
fjetter/turbodbc
|
b11f0a1bc7d67bc3cbc60f564594f0e735f524f4
|
[
"MIT"
] | null | null | null |
from collections import OrderedDict
from mock import patch
import datetime
import gc
import pytest
import sys
import turbodbc
from query_fixture import query_fixture
from helpers import open_cursor, for_each_database, for_one_database, generate_microseconds_with_precision
# Skip all parquet tests if we can't import pyarrow.parquet
pa = pytest.importorskip('pyarrow')
# Ignore these with pytest ... -m 'not parquet'
pyarrow = pytest.mark.pyarrow
def _fix_case(configuration, string):
"""
some databases return column names in upper case
"""
capabilities = configuration['capabilities']
if capabilities['reports_column_names_as_upper_case']:
return string.upper()
else:
return string
@for_one_database
@pyarrow
def test_no_arrow_support(dsn, configuration):
with open_cursor(configuration) as cursor:
cursor.execute("SELECT 42")
with patch('turbodbc.cursor._has_arrow_support', return_value=False):
with pytest.raises(turbodbc.Error):
cursor.fetchallarrow()
@for_one_database
@pyarrow
def test_arrow_without_result_set_raises(dsn, configuration):
with open_cursor(configuration) as cursor:
with pytest.raises(turbodbc.InterfaceError):
cursor.fetchallarrow()
@for_each_database
@pyarrow
def test_arrow_empty_column(dsn, configuration):
with open_cursor(configuration) as cursor:
with query_fixture(cursor, configuration, 'INSERT INTEGER') as table_name:
cursor.execute("SELECT a FROM {}".format(table_name))
result = cursor.fetchallarrow()
assert isinstance(result, pa.Table)
assert result.num_columns == 1
assert result.num_rows == 0
@for_each_database
@pyarrow
def test_arrow_reference_count(dsn, configuration):
with open_cursor(configuration) as cursor:
with query_fixture(cursor, configuration, 'INSERT INTEGER') as table_name:
cursor.execute("SELECT a FROM {}".format(table_name))
result = cursor.fetchallarrow()
gc.collect()
assert sys.getrefcount(result) == 2
@for_each_database
@pyarrow
def test_arrow_int_column(dsn, configuration):
with open_cursor(configuration) as cursor:
cursor.execute("SELECT 42 AS a")
result = cursor.fetchallarrow()
assert isinstance(result, pa.Table)
assert result.num_columns == 1
assert result.num_rows == 1
assert result.column(0).name == _fix_case(configuration, "a")
assert str(result.column(0).type) == "int64"
assert result.column(0).to_pylist() == [42]
@for_each_database
@pyarrow
def test_arrow_int_column_adaptive(dsn, configuration):
with open_cursor(configuration) as cursor:
cursor.execute("SELECT 42 AS a")
result = cursor.fetchallarrow(adaptive_integers=True)
assert str(result.column(0).type) == "int8"
assert result.column(0).to_pylist() == [42]
@for_each_database
@pyarrow
def test_arrow_double_column(dsn, configuration):
with open_cursor(configuration) as cursor:
with query_fixture(cursor, configuration, 'SELECT DOUBLE') as query:
cursor.execute(query)
result = cursor.fetchallarrow()
assert isinstance(result, pa.Table)
assert result.num_columns == 1
assert result.num_rows == 1
assert result.column(0).name == _fix_case(configuration, "a")
assert str(result.column(0).type) == "double"
assert result.column(0).to_pylist() == [3.14]
@for_each_database
@pyarrow
def test_arrow_boolean_column(dsn, configuration):
with open_cursor(configuration) as cursor:
with query_fixture(cursor, configuration, 'INSERT INDEXED BOOL') as table_name:
cursor.executemany('INSERT INTO {} VALUES (?, ?)'.format(table_name),
[[True, 1], [False, 2], [True, 3]])
cursor.execute('SELECT a FROM {} ORDER BY b'.format(table_name))
result = cursor.fetchallarrow()
assert isinstance(result, pa.Table)
assert result.num_columns == 1
assert result.num_rows == 3
assert result.column(0).name == _fix_case(configuration, "a")
assert str(result.column(0).type) == "bool"
assert result.column(0).to_pylist() == [True, False, True]
@for_each_database
@pyarrow
def test_arrow_binary_column_with_null(dsn, configuration):
with open_cursor(configuration) as cursor:
with query_fixture(cursor, configuration, 'INSERT TWO INTEGER COLUMNS') as table_name:
cursor.executemany("INSERT INTO {} VALUES (?, ?)".format(table_name),
[[42, 1], [None, 2]]) # second column to enforce ordering
cursor.execute("SELECT a FROM {} ORDER BY b".format(table_name))
result = cursor.fetchallarrow()
assert isinstance(result, pa.Table)
assert result.num_columns == 1
assert result.num_rows == 2
assert result.column(0).name == _fix_case(configuration, "a")
assert str(result.column(0).type) == "int64"
assert result.column(0).to_pylist() == [42, None]
assert result.column(0).null_count == 1
@for_each_database
@pyarrow
def test_arrow_binary_column_larger_than_batch_size(dsn, configuration):
with open_cursor(configuration, rows_to_buffer=2) as cursor:
with query_fixture(cursor, configuration, 'INSERT INTEGER') as table_name:
cursor.executemany("INSERT INTO {} VALUES (?)".format(table_name),
[[1], [2], [3], [4], [5]])
cursor.execute("SELECT a FROM {} ORDER BY a".format(table_name))
result = cursor.fetchallarrow()
assert isinstance(result, pa.Table)
assert result.column(0).to_pylist() == [1, 2, 3, 4, 5]
@for_each_database
@pyarrow
def test_arrow_timestamp_column(dsn, configuration):
supported_digits = configuration['capabilities']['fractional_second_digits']
fractional = generate_microseconds_with_precision(supported_digits)
timestamp = datetime.datetime(2015, 12, 31, 1, 2, 3, fractional)
with open_cursor(configuration) as cursor:
with query_fixture(cursor, configuration, 'INSERT TIMESTAMP') as table_name:
cursor.execute('INSERT INTO {} VALUES (?)'.format(table_name), [timestamp])
cursor.execute('SELECT a FROM {}'.format(table_name))
result = cursor.fetchallarrow()
assert result.column(0).to_pylist() == [timestamp]
@for_each_database
@pyarrow
def test_arrow_date_column(dsn, configuration):
date = datetime.date(2015, 12, 31)
with open_cursor(configuration) as cursor:
with query_fixture(cursor, configuration, 'INSERT DATE') as table_name:
cursor.execute('INSERT INTO {} VALUES (?)'.format(table_name), [date])
cursor.execute('SELECT a FROM {}'.format(table_name))
result = cursor.fetchallarrow()
result.column(0).to_pylist() == [datetime.date(2015, 12, 31)]
@for_each_database
@pyarrow
def test_arrow_timelike_column_with_null(dsn, configuration):
fill_value = 0;
with open_cursor(configuration) as cursor:
with query_fixture(cursor, configuration, 'INSERT TIMESTAMP') as table_name:
cursor.execute('INSERT INTO {} VALUES (?)'.format(table_name), [None])
cursor.execute('SELECT a FROM {}'.format(table_name))
result = cursor.fetchallarrow()
assert result.column(0).to_pylist() == [None]
@for_each_database
@pyarrow
def test_arrow_timelike_column_larger_than_batch_size(dsn, configuration):
timestamps = [datetime.datetime(2015, 12, 31, 1, 2, 3),
datetime.datetime(2016, 1, 5, 4, 5, 6),
datetime.datetime(2017, 2, 6, 7, 8, 9),
datetime.datetime(2018, 3, 7, 10, 11, 12),
datetime.datetime(2019, 4, 8, 13, 14, 15)]
with open_cursor(configuration, rows_to_buffer=2) as cursor:
with query_fixture(cursor, configuration, 'INSERT TIMESTAMP') as table_name:
cursor.executemany('INSERT INTO {} VALUES (?)'.format(table_name),
[[timestamp] for timestamp in timestamps])
cursor.execute('SELECT a FROM {} ORDER BY a'.format(table_name))
result = cursor.fetchallarrow()
assert result.column(0).to_pylist() == timestamps
@for_each_database
@pyarrow
@pytest.mark.parametrize("strings_as_dictionary", [True, False])
def test_arrow_string_column(dsn, configuration, strings_as_dictionary):
with open_cursor(configuration) as cursor:
with query_fixture(cursor, configuration, 'INSERT UNICODE') as table_name:
cursor.execute('INSERT INTO {} VALUES (?)'.format(table_name), [u'unicode \u2665'])
cursor.execute('SELECT a FROM {}'.format(table_name))
result = cursor.fetchallarrow(strings_as_dictionary=strings_as_dictionary)
assert result.column(0).to_pylist() == [u'unicode \u2665']
@for_each_database
@pyarrow
@pytest.mark.parametrize("strings_as_dictionary", [True, False])
def test_arrow_string_column_with_null(dsn, configuration, strings_as_dictionary):
with open_cursor(configuration) as cursor:
with query_fixture(cursor, configuration, 'INSERT STRING') as table_name:
cursor.execute('INSERT INTO {} VALUES (?)'.format(table_name), [None])
cursor.execute('SELECT a FROM {}'.format(table_name))
result = cursor.fetchallarrow(strings_as_dictionary=strings_as_dictionary)
result.column(0).null_count == 1
result.column(0).to_pylist() == [None]
@for_each_database
@pyarrow
@pytest.mark.parametrize("strings_as_dictionary", [True, False])
def test_arrow_string_column_larger_than_batch_size(dsn, configuration, strings_as_dictionary):
strings = [u'abc',
u'def',
u'ghi',
u'jkl',
u'mno']
with open_cursor(configuration, rows_to_buffer=2) as cursor:
with query_fixture(cursor, configuration, 'INSERT STRING') as table_name:
cursor.executemany('INSERT INTO {} VALUES (?)'.format(table_name),
[[string] for string in strings])
cursor.execute('SELECT a FROM {} ORDER BY a'.format(table_name))
result = cursor.fetchallarrow(strings_as_dictionary=strings_as_dictionary)
result.column(0).to_pylist() == strings
@for_each_database
@pyarrow
def test_arrow_two_columns(dsn, configuration):
with open_cursor(configuration) as cursor:
with query_fixture(cursor, configuration, 'INSERT TWO INTEGER COLUMNS') as table_name:
cursor.executemany("INSERT INTO {} VALUES (?, ?)".format(table_name),
[[1, 42], [2, 41]])
cursor.execute("SELECT a, b FROM {} ORDER BY a".format(table_name))
result = cursor.fetchallarrow()
assert result.to_pydict() == OrderedDict([
(_fix_case(configuration, 'a'), [1, 2]),
(_fix_case(configuration, 'b'), [42, 41])]
)
@for_each_database
@pyarrow
def test_arrow_two_columns(dsn, configuration):
with open_cursor(configuration, rows_to_buffer=1) as cursor:
with query_fixture(cursor, configuration, 'INSERT TWO INTEGER COLUMNS') as table_name:
cursor.executemany("INSERT INTO {} VALUES (?, ?)".format(table_name),
[[1, 42], [2, 41]])
cursor.execute("SELECT a, b FROM {} ORDER BY a".format(table_name))
result = list(cursor.fetcharrowbatches())
assert len(result) == 2
| 41.188811
| 106
| 0.660102
| 1,415
| 11,780
| 5.290459
| 0.118021
| 0.04809
| 0.052097
| 0.068528
| 0.792413
| 0.773444
| 0.745258
| 0.708255
| 0.701042
| 0.660834
| 0
| 0.020451
| 0.227929
| 11,780
| 285
| 107
| 41.333333
| 0.802639
| 0.015874
| 0
| 0.568966
| 0
| 0
| 0.100734
| 0.013391
| 0
| 0
| 0
| 0
| 0.168103
| 1
| 0.086207
| false
| 0
| 0.043103
| 0
| 0.137931
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
69dcb1a77724eaa2228d1012ed392c1fefc1f7f6
| 279
|
py
|
Python
|
scrtbp/exceptions.py
|
mmlanger/scrtbp
|
65b2877f2037df09a8e28b0b4e421bf87affdde6
|
[
"MIT"
] | 1
|
2018-10-25T09:06:48.000Z
|
2018-10-25T09:06:48.000Z
|
scrtbp/exceptions.py
|
mmlanger/scrtbp
|
65b2877f2037df09a8e28b0b4e421bf87affdde6
|
[
"MIT"
] | null | null | null |
scrtbp/exceptions.py
|
mmlanger/scrtbp
|
65b2877f2037df09a8e28b0b4e421bf87affdde6
|
[
"MIT"
] | 1
|
2018-10-25T09:14:06.000Z
|
2018-10-25T09:14:06.000Z
|
class MaxStepsExceeded(Exception):
pass
class MaxTimeExceeded(Exception):
pass
class StepControlFailure(Exception):
pass
class ConditionExit(Exception):
pass
class InvalidBrackets(Exception):
pass
class TransformationNotDefined(Exception):
pass
| 12.130435
| 42
| 0.749104
| 24
| 279
| 8.708333
| 0.375
| 0.373206
| 0.430622
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.18638
| 279
| 22
| 43
| 12.681818
| 0.920705
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 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
| 5
|
69e95b14c910755a6142d43800cf5d5488cacc73
| 125,244
|
py
|
Python
|
tests/app/main/test_suppliers.py
|
uk-gov-mirror/alphagov.digitalmarketplace-supplier-frontend
|
cf9d06cffe95c436f056cc9c967e9ef8a25381a4
|
[
"MIT"
] | 7
|
2015-11-21T20:43:37.000Z
|
2020-07-22T13:20:18.000Z
|
tests/app/main/test_suppliers.py
|
uk-gov-mirror/alphagov.digitalmarketplace-supplier-frontend
|
cf9d06cffe95c436f056cc9c967e9ef8a25381a4
|
[
"MIT"
] | 783
|
2015-04-07T16:34:57.000Z
|
2021-07-27T12:13:02.000Z
|
tests/app/main/test_suppliers.py
|
uk-gov-mirror/alphagov.digitalmarketplace-supplier-frontend
|
cf9d06cffe95c436f056cc9c967e9ef8a25381a4
|
[
"MIT"
] | 20
|
2015-06-13T15:37:23.000Z
|
2021-04-10T18:02:09.000Z
|
# coding=utf-8
from datetime import datetime
from urllib.parse import urlparse
from flask import session, current_app
from lxml import html
import mock
import pytest
from werkzeug.exceptions import ServiceUnavailable
from dmapiclient import APIError, HTTPError
from dmapiclient.audit import AuditTypes
from dmtestutils.api_model_stubs import FrameworkStub, SupplierFrameworkStub
from dmutils import direct_plus_client
from tests.app.helpers import BaseApplicationTest, assert_args_and_return
from app.main.forms.suppliers import CompanyOrganisationSizeForm, CompanyTradingStatusForm
def framework_stub_dates(month):
return {
'applications_close_at': datetime(2000, month, 3),
'intention_to_award_at': datetime(2000, month, 4),
'clarifications_close_at': datetime(2000, month, 1),
'clarifications_publish_at': datetime(2000, month, 2),
'framework_live_at': datetime(2000, month, 5),
}
FIND_FRAMEWORKS_RETURN_VALUE = {
"frameworks": [
FrameworkStub(
status='expired',
slug='h-cloud-88',
name='H-Cloud 88',
framework_family='g-cloud',
**framework_stub_dates(1)
).response(),
FrameworkStub(status='live', slug='g-cloud-6', **framework_stub_dates(2)).response(),
FrameworkStub(status='open', slug='digital-outcomes-and-specialists', **framework_stub_dates(4)).response(),
FrameworkStub(
status='live',
slug='digital-rhymes-and-reasons',
name='Digital Rhymes and Reasons',
framework_family='digital-outcomes-and-specialists',
**framework_stub_dates(3)
).response(),
FrameworkStub(status='open', slug='g-cloud-7', **framework_stub_dates(5)).response(),
]
}
def get_supplier(*args, **kwargs):
supplier_info = {
"id": 1234,
"dunsNumber": "987654321",
"companiesHouseNumber": "CH123456",
"registeredName": "Official Name Inc",
"registrationCountry": "country:BZ",
"otherCompanyRegistrationNumber": "BEL153",
"organisationSize": "small",
"tradingStatus": "Open for business",
"name": "Supplier Name",
"description": "Supplier Description",
"companyDetailsConfirmed": True,
"contactInformation": [{
"id": 2,
"website": "supplier.dmdev",
"email": "supplier@user.dmdev",
"contactName": "Supplier Person",
"phoneNumber": "0800123123",
"address1": "1 Street",
"address2": "2 Building",
"city": "Supplierville",
"country": "Supplierland",
"postcode": "11 AB",
}],
"service_counts": {
"G-Cloud 6": 12,
"G-Cloud 5": 34
}
}
supplier_info.update(kwargs)
return {"suppliers": dict(
filter(lambda x: x[1] is not None, supplier_info.items())
)}
def get_user():
return [{
'id': 123,
'name': "User Name",
'emailAddress': "email@email.com",
'loggedInAt': "2015-05-06T11:57:28.008690Z",
'locked': False,
'active': True,
'role': 'supplier',
'supplier': {
'name': "Supplier Name",
'supplierId': 1234,
'supplierOrganisationSize': 'small'
}
}]
class TestSuppliersDashboard(BaseApplicationTest):
def setup_method(self, method):
super().setup_method(method)
self.data_api_client_patch = mock.patch('app.main.views.suppliers.data_api_client', autospec=True)
self.data_api_client = self.data_api_client_patch.start()
def teardown_method(self, method):
self.data_api_client_patch.stop()
super().teardown_method(method)
def test_error_and_success_flashed_messages_only_are_shown_in_banner_messages(self):
with self.client.session_transaction() as session:
session['_flashes'] = [
('error', 'This is an error'),
('success', 'This is a success'),
]
self.data_api_client.get_framework.return_value = self.framework('open')
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.find_audit_events.return_value = {
"auditEvents": []
}
self.login()
res = self.client.get("/suppliers")
doc = html.fromstring(res.get_data(as_text=True))
assert doc.cssselect(".dm-alert:contains('This is an error')")
assert doc.cssselect(".dm-alert:contains('This is a success')")
def test_shows_edit_buttons(self):
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.find_frameworks.return_value = FIND_FRAMEWORKS_RETURN_VALUE
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [
{
'frameworkSlug': 'h-cloud-88',
'services_count': 12,
"onFramework": True,
"agreementReturned": True,
},
{
'frameworkSlug': 'g-cloud-6',
'services_count': 99,
"onFramework": True,
"agreementReturned": True,
},
],
}
self.login()
res = self.client.get("/suppliers")
assert res.status_code == 200
document = html.fromstring(res.get_data(as_text=True))
assert document.xpath(
"//*[(.//h3)[1][normalize-space(string())=$f]][.//a[normalize-space(string())=$t][@href=$u]]",
f="G-Cloud 6",
t="View services",
u="/suppliers/frameworks/g-cloud-6/services",
)
assert not document.xpath(
"//*[(.//h3)[1][normalize-space(string())=$f]][.//a[normalize-space(string())=$t]]",
f="G-Cloud 7",
t="View services",
)
assert not document.xpath("//a[@href=$u]", u="/suppliers/frameworks/g-cloud-7/services")
assert not document.xpath(
"//*[(.//h3)[1][normalize-space(string())=$f]][.//a[normalize-space(string())=$t]]",
f="H-Cloud 88",
t="View services",
)
assert not document.xpath("//a[@href=$u]", u="/suppliers/frameworks/h-cloud-88/services")
assert not document.xpath(
"//*[(.//h3)[1][normalize-space(string())=$f]][.//a[normalize-space(string())=$t]]",
f="Digital Rhymes and Reasons",
t="View services",
)
assert not document.xpath("//a[@href=$u]", u="/suppliers/frameworks/digital-rhymes-and-reasons/services")
@pytest.mark.parametrize('on_framework', (True, False))
def test_only_shows_expired_dos3_if_supplier_was_on_framework(self, on_framework):
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(status='expired', slug='digital-outcomes-and-specialists-3').response(),
]
}
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [
{
'frameworkSlug': 'digital-outcomes-and-specialists-3',
'onFramework': on_framework,
}
]
}
self.login()
response = self.client.get("/suppliers")
assert response.status_code == 200
document = html.fromstring(response.get_data(as_text=True))
if on_framework:
assert document.xpath(
"//h3[normalize-space(string())=$f]"
"[(following::a)[1][normalize-space(string())=$t1][@href=$u1]]",
f="Digital Outcomes and Specialists 3",
t1="View your opportunities",
u1="/suppliers/opportunities/frameworks/digital-outcomes-and-specialists-3",
)
assert not document.xpath(
"//h3[normalize-space(string())=$f]"
"/..//a[normalize-space(string())=$t1]",
f="Digital Outcomes and Specialists 3",
t1="View services",
)
assert not document.xpath(
"//h3[normalize-space(string())=$f]"
"/..//a[normalize-space(string())=$t1]",
f="Digital Outcomes and Specialists 3",
t1="View documents",
)
else:
assert not document.xpath("//h3[normalize-space(string())='Digital Outcomes and Specialists 3']")
def test_shows_correct_expired_framework(self):
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(
status='expired',
slug='digital-outcomes-and-specialists-2',
frameworkExpiresAtUTC='2000-01-01T01:00:00.000000Z'
).response(),
FrameworkStub(
status='expired',
slug='digital-outcomes-and-specialists-1',
frameworkExpiresAtUTC='2001-01-01T01:00:00.000000Z'
).response(),
]
}
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [
{'frameworkSlug': 'digital-outcomes-and-specialists-1', 'onFramework': True},
{'frameworkSlug': 'digital-outcomes-and-specialists-2', 'onFramework': True},
]
}
self.login()
response = self.client.get("/suppliers")
assert response.status_code == 200
document = html.fromstring(response.get_data(as_text=True))
assert document.xpath("//h3[normalize-space(string())='Digital Outcomes and Specialists 1']")
assert not document.xpath("//h3[normalize-space(string())='Digital Outcomes and Specialists 2']")
def test_shows_gcloud_7_application_button(self):
self.data_api_client.get_framework_interest.return_value = {'frameworks': []}
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(status='expired', slug='digital-outcomes-and-specialists').response(),
FrameworkStub(status='open', slug='g-cloud-7').response(),
]
}
self.login()
response = self.client.get("/suppliers")
document = html.fromstring(response.get_data(as_text=True))
assert response.status_code == 200
apply_button = document.xpath(
"//h2[normalize-space()='G-Cloud 7 is open for applications']/following::input[1]"
)[0]
assert apply_button.value == "Apply"
def test_shows_gcloud_7_continue_link(self):
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [
{'frameworkSlug': 'g-cloud-7'}
]
}
self.data_api_client.find_frameworks.return_value = FIND_FRAMEWORKS_RETURN_VALUE
self.login()
response = self.client.get("/suppliers")
document = html.fromstring(response.get_data(as_text=True))
assert response.status_code == 200
continue_link = document.xpath(
"//h2[normalize-space()='Your G-Cloud 7 application']"
"/following::a[1][normalize-space()='Continue your application']"
)
assert continue_link
assert continue_link[0].values()[0] == "/suppliers/frameworks/g-cloud-7"
def test_shows_gcloud_7_closed_message_if_pending_and_no_interest(self): # noqa
self.data_api_client.get_framework.return_value = self.framework('pending')
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.get_supplier_frameworks.return_value = {'frameworkInterest': []}
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(status='pending', slug='g-cloud-7').response(),
]
}
self.login()
res = self.client.get("/suppliers")
doc = html.fromstring(res.get_data(as_text=True))
message = doc.xpath('//aside[@class="temporary-message"]')
assert len(message) > 0
assert u"G-Cloud 7 is closed for applications" in message[0].xpath('h2/text()')[0]
def test_shows_gcloud_7_closed_message_if_pending_and_no_application(self): # noqa
self.data_api_client.get_framework.return_value = self.framework('pending')
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [
{
'frameworkSlug': 'g-cloud-7',
'declaration': {'status': 'started'},
'drafts_count': 1,
'complete_drafts_count': 0
}
]
}
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(status='pending', slug='g-cloud-7').response(),
]
}
self.login()
res = self.client.get("/suppliers")
doc = html.fromstring(res.get_data(as_text=True))
message = doc.xpath('//aside[@class="temporary-message"]')
assert len(message) > 0
assert u"G-Cloud 7 is closed for applications" in message[0].xpath('h2/text()')[0]
assert u"You didn’t submit an application" in message[0].xpath('p[1]/text()')[0]
assert len(message[0].xpath('p[2]/a[contains(@href, "suppliers/frameworks/g-cloud-7")]')) > 0
def test_shows_gcloud_7_closed_message_if_pending_and_application_done(self):
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [
{
'frameworkSlug': 'g-cloud-7',
'declaration': {'status': 'complete'},
'drafts_count': 0,
'complete_drafts_count': 99
}
]
}
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(status='pending', slug='g-cloud-7').response(),
]
}
self.login()
res = self.client.get("/suppliers")
doc = html.fromstring(res.get_data(as_text=True))
headings = doc.xpath('//h2[@class="summary-item-heading"]')
assert len(headings) > 0
assert u"G-Cloud 7 is closed for applications" in headings[0].xpath('text()')[0]
assert u"You submitted 99 services for consideration" in headings[0].xpath('../p[1]/text()')[0]
assert len(headings[0].xpath('../p[1]/a[contains(@href, "suppliers/frameworks/g-cloud-7")]')) > 0
assert u"View your submitted application" in headings[0].xpath('../p[1]/a/text()')[0]
def test_shows_gcloud_7_in_standstill_application_passed_with_message(self):
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [
{
'frameworkSlug': 'g-cloud-7',
'declaration': {'status': 'complete'},
'drafts_count': 0,
'complete_drafts_count': 99,
'onFramework': True,
'agreementReturned': False
}
]
}
self.data_api_client.find_frameworks.return_value = {
'frameworks': [self.framework(status='standstill', slug='g-cloud-7')['frameworks']]
}
self.login()
res = self.client.get("/suppliers")
doc = html.fromstring(res.get_data(as_text=True))
headings = doc.xpath('//h2[@class="summary-item-heading"]')
assert u"Pending services" in headings[0].xpath('text()')[0]
first_table = doc.xpath(
'//table[@class="summary-item-body"]'
)
assert u"Pending services" in first_table[0].xpath('caption/text()')[0]
first_row = "".join(first_table[0].xpath('tbody/descendant::*/text()'))
assert u"G-Cloud 7" in first_row
assert u"Live from Monday 23 November 2015" in first_row
assert u"99 services" in first_row
assert u"99 services" in first_row
assert u"You must sign the framework agreement to sell these services" in first_row
def test_shows_gcloud_7_in_standstill_fw_agreement_returned(self):
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [
{
'frameworkSlug': 'g-cloud-7',
'declaration': {'status': 'complete'},
'drafts_count': 0,
'complete_drafts_count': 99,
'onFramework': True,
'agreementReturned': True
}
]
}
self.data_api_client.find_frameworks.return_value = {
"frameworks": [self.framework(status='standstill', slug='g-cloud-7')['frameworks']]
}
self.login()
res = self.client.get("/suppliers")
doc = html.fromstring(res.get_data(as_text=True))
headings = doc.xpath('//h2[@class="summary-item-heading"]')
assert u"Pending services" in headings[0].xpath('text()')[0]
first_table = doc.xpath(
'//table[@class="summary-item-body"]'
)
assert u"Pending services" in first_table[0].xpath('caption/text()')[0]
first_row = "".join(first_table[0].xpath('tbody/descendant::*/text()'))
assert u"G-Cloud 7" in first_row
assert u"Live from Monday 23 November 2015" in first_row
assert u"99 services" in first_row
assert u"You must sign the framework agreement to sell these services" not in first_row
def test_shows_gcloud_7_in_standstill_no_application(self):
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': []
}
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(status='standstill', slug='g-cloud-7').response(),
]
}
self.login()
res = self.client.get("/suppliers")
doc = html.fromstring(res.get_data(as_text=True))
assert not doc.xpath('//h2[normalize-space(string())=$t]', t="Pending services")
def test_shows_gcloud_7_in_standstill_application_failed(self):
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [
{
'frameworkSlug': 'g-cloud-7',
'declaration': {'status': 'complete'},
'drafts_count': 0,
'complete_drafts_count': 99,
'onFramework': False,
'agreementReturned': False
}
]
}
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(status='standstill', slug='g-cloud-7').response(),
]
}
self.login()
res = self.client.get("/suppliers")
doc = html.fromstring(res.get_data(as_text=True))
headings = doc.xpath('//h2[@class="summary-item-heading"]')
assert u"Pending services" in headings[0].xpath('text()')[0]
first_table = doc.xpath(
'//table[@class="summary-item-body"]'
)
assert u"Pending services" in first_table[0].xpath('caption/text()')[0]
first_row = "".join(first_table[0].xpath('tbody/descendant::*/text()'))
assert u"G-Cloud 7" in first_row
assert u"Live from Monday 23 November 2015" not in first_row
assert u"99 services submitted" in first_row
assert u"You must sign the framework agreement to sell these services" not in first_row
assert u"View your services" in first_row
def test_shows_gcloud_7_in_standstill_application_passed(self):
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [
{
'frameworkSlug': 'g-cloud-7',
'declaration': {'status': 'complete'},
'drafts_count': 0,
'complete_drafts_count': 99,
'onFramework': True,
'agreementReturned': True
}
]
}
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(
status='standstill', slug='g-cloud-7', framework_live_at=datetime(2015, 11, 23)
).response(),
]
}
self.login()
res = self.client.get("/suppliers")
doc = html.fromstring(res.get_data(as_text=True))
headings = doc.xpath('//h2[@class="summary-item-heading"]')
assert u"Pending services" in headings[0].xpath('text()')[0]
first_table = doc.xpath(
'//table[@class="summary-item-body"]'
)
assert u"Pending services" in first_table[0].xpath('caption/text()')[0]
first_row = "".join(first_table[0].xpath('tbody/descendant::*/text()'))
assert u"G-Cloud 7" in first_row
assert u"Live from Monday 23 November 2015" in first_row
assert u"99 services" in first_row
assert u"You must sign the framework agreement to sell these services" not in first_row
def test_shows_register_for_dos_button(self):
self.data_api_client.get_framework.return_value = self.framework(status='other')
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(status='open', slug='digital-outcomes-and-specialists').response(),
FrameworkStub(status='live', slug='g-cloud-7').response(),
]
}
self.login()
response = self.client.get("/suppliers")
document = html.fromstring(response.get_data(as_text=True))
assert response.status_code == 200
apply_button = document.xpath(
"//h2[normalize-space()='Digital Outcomes and Specialists is open for applications']"
"/following::input[1]"
)[0]
assert apply_button.value == "Apply"
def test_shows_continue_with_dos_link(self):
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [
{'frameworkSlug': 'digital-outcomes-and-specialists'}
]
}
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(status='open', slug='digital-outcomes-and-specialists').response(),
FrameworkStub(status='live', slug='g-cloud-7').response(),
]
}
self.login()
response = self.client.get("/suppliers")
document = html.fromstring(response.get_data(as_text=True))
assert response.status_code == 200
continue_link = document.xpath(
"//h2[normalize-space()='Your Digital Outcomes and Specialists application']"
"/following::a[1][normalize-space()='Continue your application']"
)
assert continue_link
assert continue_link[0].values()[0] == "/suppliers/frameworks/digital-outcomes-and-specialists"
class TestSupplierDetails(BaseApplicationTest):
def setup_method(self, method):
super().setup_method(method)
self.data_api_client_patch = mock.patch('app.main.views.suppliers.data_api_client', autospec=True)
self.data_api_client = self.data_api_client_patch.start()
def teardown_method(self, method):
self.data_api_client_patch.stop()
super().teardown_method(method)
def test_shows_supplier_info(self):
self.data_api_client.get_supplier.side_effect = get_supplier
self.login()
res = self.client.get("/suppliers/details")
assert res.status_code == 200
page_html = res.get_data(as_text=True)
document = html.fromstring(page_html)
for property_str in (
# "Company details" section at the top
# Address elements are tested separately in `test_shows_address_details()` due to HTML structure
"Supplier Person", # Contact name
"supplier@user.dmdev", # Contact email
"0800123123", # Phone number
"Supplier Description", # Supplier summary
# "Registration information" section
"Official Name Inc", # Registered company name
"CH123456", # Companies House number
"987654321", # DUNS number
"Open for business", # Trading status
"Small", # Size
):
# Property exists on page
assert document.xpath("//*[normalize-space(string())=$t]", t=property_str), property_str
# Property has associated Change link
assert document.xpath(f"//dd[normalize-space(text())='{property_str}']/following-sibling::dd/a/text()")[0]\
.strip() == 'Edit'
# Registration number not shown if Companies House ID exists
assert "BEL153" not in page_html
self.data_api_client.get_supplier.assert_called_once_with(1234)
def test_registration_number_field_shows_other_registration_num_if_no_companies_house_num(self):
self.data_api_client.get_supplier.return_value = get_supplier(
companiesHouseNumber=None, otherCompanyRegistrationNumber="42, EARTH"
)
self.login()
res = self.client.get("/suppliers/details")
assert res.status_code == 200
page_html = res.get_data(as_text=True)
document = html.fromstring(page_html)
assert document.xpath("//dt[normalize-space(text())='Registration number']/following-sibling::dd")[0]. \
text.strip() == '42, EARTH'
def test_shows_united_kingdom_for_old_style_country_code(self):
self.data_api_client.get_supplier.return_value = get_supplier(
companiesHouseNumber=None, registrationCountry="gb"
)
self.login()
res = self.client.get("/suppliers/details")
assert res.status_code == 200
page_html = res.get_data(as_text=True)
document = html.fromstring(page_html)
# Country United Kingdom is shown
assert document.xpath("//*/node()[normalize-space(string())='United Kingdom']")
def test_handles_supplier_with_no_registration_country_key(self):
supplier = get_supplier()
del supplier['suppliers']['registrationCountry']
self.data_api_client.get_supplier.return_value = supplier
self.login()
res = self.client.get("/suppliers/details")
assert res.status_code == 200
def test_shows_address_details(self):
self.data_api_client.get_supplier.return_value = get_supplier(registrationCountry="country:GB")
self.login()
response = self.client.get("/suppliers/details")
assert response.status_code == 200
page_html = response.get_data(as_text=True)
document = html.fromstring(page_html)
address = (document.
xpath("//dt[normalize-space(text())='Registered company address']/following-sibling::dd/text()"))
assert "1 Street" in address[0]
assert "Supplierville" in address[1]
assert "11 AB" in address[2]
assert "United Kingdom" in address[3]
def test_handles_supplier_with_no_address_details(self):
supplier = get_supplier()
supplier_contact_information = supplier["suppliers"]["contactInformation"][0]
del supplier_contact_information["address1"]
del supplier_contact_information["city"]
del supplier_contact_information["postcode"]
self.data_api_client.get_supplier.return_value = supplier
self.login()
res = self.client.get("/suppliers/details")
assert res.status_code == 200
@pytest.mark.parametrize(
"question,null_attribute,link_address",
[
("Registered company name", {"registeredName": None}, "/suppliers/registered-company-name/edit"),
("Registered company address", {"registrationCountry": None}, "/suppliers/registered-address/edit"),
(
"Registration number",
{"companiesHouseNumber": None, "otherCompanyRegistrationNumber": None},
"/suppliers/registration-number/edit"
),
("Trading status", {"tradingStatus": None}, "/suppliers/trading-status/edit"),
("Company size", {"organisationSize": None}, "/suppliers/organisation-size/edit"),
]
)
def test_question_field_requires_answer_if_empty(self, question, null_attribute, link_address):
self.data_api_client.get_supplier.return_value = get_supplier(**null_attribute)
self.login()
response = self.client.get("/suppliers/details")
assert response.status_code == 200
page_html = response.get_data(as_text=True)
document = html.fromstring(page_html)
answer_required_link = document.xpath(f"//dt[normalize-space(text())='{question}']/following-sibling::dd[2]/a")
assert answer_required_link
assert answer_required_link[0].values()[1] == link_address
assert answer_required_link[0].text.strip() == 'Answer required'
@pytest.mark.parametrize(
"question,filled_in_attribute,link_address",
[
(
"Registered company name", {"companyDetailsConfirmed": True, "registeredName": "Digital Ponies"},
"/suppliers/registered-company-name/edit",
),
(
"Registered company name", {"companyDetailsConfirmed": False, "registeredName": "Digital Ponies"},
"/suppliers/registered-company-name/edit",
),
("Registered company address", {"companyDetailsConfirmed": True, "registrationCountry": "country:GB"},
"/suppliers/registered-address/edit",),
("Registered company address", {"companyDetailsConfirmed": False, "registrationCountry": "country:GB"},
"/suppliers/registered-address/edit",),
(
"Registration number",
{
"companyDetailsConfirmed": True, "companiesHouseNumber": "CH123456",
"otherCompanyRegistrationNumber": None
},
"/suppliers/registration-number/edit",
),
(
"Registration number",
{
"companyDetailsConfirmed": False, "companiesHouseNumber": "CH123456",
"otherCompanyRegistrationNumber": None
},
"/suppliers/registration-number/edit",
),
(
"Registration number",
{
"companyDetailsConfirmed": True, "companiesHouseNumber": None,
"otherCompanyRegistrationNumber": "EQ789"
},
"/suppliers/registration-number/edit",
),
(
"Registration number",
{
"companyDetailsConfirmed": False, "companiesHouseNumber": None,
"otherCompanyRegistrationNumber": "EQ789"
},
"/suppliers/registration-number/edit",
),
("Trading status", {"companyDetailsConfirmed": False, "tradingStatus": "limited company (LTD)"},
"/suppliers/trading-status/edit",),
("Company size", {"companyDetailsConfirmed": False, "organisationSize": "small"},
"/suppliers/organisation-size/edit",),
("DUNS number", {"companyDetailsConfirmed": True, "dunsNumber": "123456789"},
"/suppliers/duns-number/edit",),
("DUNS number", {"companyDetailsConfirmed": False, "dunsNumber": "123456789"},
"/suppliers/duns-number/edit",),
]
)
def test_filled_in_question_field_has_a_change_or_correct_a_mistake_link(
self, question, filled_in_attribute, link_address
):
self.data_api_client.get_supplier.return_value = get_supplier(**filled_in_attribute)
self.login()
response = self.client.get("/suppliers/details")
assert response.status_code == 200
page_html = response.get_data(as_text=True)
document = html.fromstring(page_html)
answer_required_link = document.xpath(
f"//dt[normalize-space(text())='{question}']/following-sibling::dd[2]/a"
)
assert answer_required_link
assert answer_required_link[0].values()[1] == link_address
@pytest.mark.parametrize(
"summary,expected_key",
[
({"description": "Our company is the best for digital ponies."}, 'Summary'),
({"description": ""}, 'Summary (optional)'),
]
)
def test_hint_text_for_summary_only_visible_if_field_empty(self, summary, expected_key):
self.data_api_client.get_supplier.return_value = get_supplier(**summary)
self.login()
response = self.client.get("/suppliers/details")
assert response.status_code == 200
page_html = response.get_data(as_text=True)
document = html.fromstring(page_html)
assert document.xpath(f"*//dt[normalize-space(text())='{expected_key}']")
@pytest.mark.parametrize(
"framework_slug,framework_name,link_address",
[
(
"digital-outcomes-and-specialists-2",
"Digital Outcomes and Specialists 2",
"/suppliers/frameworks/digital-outcomes-and-specialists-2"
),
("g-cloud-9", "G-Cloud 9", "/suppliers/frameworks/g-cloud-9")
]
)
def test_back_to_application_link_is_visible_if_currently_applying_to_in_session(
self, framework_slug, framework_name, link_address
):
self.data_api_client.get_supplier.return_value = get_supplier()
framework = FrameworkStub(name=framework_name, slug=framework_slug, status='open')
self.data_api_client.find_frameworks.return_value = {
"frameworks": [framework.response()],
}
self.data_api_client.get_framework.return_value = framework.single_result_response()
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [
SupplierFrameworkStub(framework_slug=framework_slug).response()
]
}
self.login()
with self.client.session_transaction() as session:
session["currently_applying_to"] = framework_slug
response = self.client.get("/suppliers/details")
assert response.status_code == 200
page_html = response.get_data(as_text=True)
document = html.fromstring(page_html)
return_link = (document.xpath(f"//a[contains(text(), 'Return to your {framework_name} application')]"))
assert return_link
assert return_link[0].attrib["href"] == link_address
def test_back_to_application_link_not_visible_if_currently_applying_to_not_in_session(self):
self.data_api_client.get_supplier.return_value = get_supplier()
self.login()
response = self.client.get("/suppliers/details")
assert response.status_code == 200
page_html = response.get_data(as_text=True)
document = html.fromstring(page_html)
assert "Return to your" not in document.text_content()
def test_currently_applying_to_removed_from_session_after_account_dashboard_visit(self):
self.data_api_client.get_supplier.return_value = get_supplier()
self.login()
with self.client.session_transaction() as session:
session["currently_applying_to"] = 'g-bork-2'
with self.client.session_transaction() as session:
assert "currently_applying_to" in session
response = self.client.get("/suppliers")
assert response.status_code == 200
with self.client.session_transaction() as session:
assert "currently_applying_to" not in session
@pytest.mark.parametrize(
"supplier_details,open_application,button_should_be_shown",
[
# Details complete but not confirmed
(get_supplier(companyDetailsConfirmed=False), False, True),
# Details complete and already confirmed
(get_supplier(companyDetailsConfirmed=True), False, False),
# Details not complete or confirmed
(get_supplier(companyDetailsConfirmed=False, dunsNumber=None), False, False),
]
)
def test_green_button_is_shown_when_details_are_complete_but_not_confirmed(
self, supplier_details, open_application, button_should_be_shown
):
self.data_api_client.get_supplier.return_value = supplier_details
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [
SupplierFrameworkStub().response()
]
}
self.login()
response = self.client.get("/suppliers/details")
assert response.status_code == 200
document = html.fromstring(response.get_data(as_text=True))
submit_button = document.xpath("//form//button[normalize-space(string())=$t]", t="Save and confirm")
assert bool(submit_button) == button_should_be_shown
@pytest.mark.parametrize('application_company_details_confirmed', (False, None))
def test_green_button_is_shown_when_company_details_confirmed_for_account_but_not_application(
self, application_company_details_confirmed
):
self.data_api_client.get_supplier.return_value = get_supplier(companyDetailsConfirmed=True)
self.data_api_client.find_frameworks.return_value = {
"frameworks": [FrameworkStub(status='open', slug='g-cloud-9').response()]
}
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [
SupplierFrameworkStub(
framework_slug='g-cloud-9',
application_company_details_confirmed=application_company_details_confirmed
).response(),
]
}
self.login()
response = self.client.get('/suppliers/details')
assert response.status_code == 200
assert (
"You must confirm that your company details are correct for your application to G-Cloud 9"
in
response.get_data(as_text=True)
)
document = html.fromstring(response.get_data(as_text=True))
submit_button = document.xpath("//form//button[normalize-space(string())=$t]", t="Save and confirm")
assert submit_button
def test_post_confirms_company_details_for_all_open_framework_applications(self):
self.data_api_client.get_supplier.return_value = get_supplier(companyDetailsConfirmed=False)
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(status='live', slug='g-cloud-8').response(),
FrameworkStub(status='open', slug='g-cloud-9').response(),
FrameworkStub(status='live', slug='digital-outcomes-and-specialists').response(),
FrameworkStub(status='open', slug='digital-outcomes-and-specialists-2').response(),
]
}
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [
SupplierFrameworkStub(
framework_slug='g-cloud-8', application_company_details_confirmed=False
).response(),
SupplierFrameworkStub(
framework_slug='g-cloud-9', application_company_details_confirmed=False
).response(),
SupplierFrameworkStub(
framework_slug='digital-outcomes-and-specialists', application_company_details_confirmed=False
).response(),
SupplierFrameworkStub(
framework_slug='digital-outcomes-and-specialists-2', application_company_details_confirmed=False
).response(),
]
}
self.login()
response = self.client.post('/suppliers/details')
assert response.status_code == 302
assert response.location == f"http://localhost/suppliers/details"
assert self.data_api_client.update_supplier.call_args_list == [
mock.call(supplier_id=1234, supplier={'companyDetailsConfirmed': True}, user="email@email.com"),
]
assert self.data_api_client.set_supplier_framework_application_company_details_confirmed.call_args_list == [
mock.call(
supplier_id=1234,
framework_slug='g-cloud-9',
application_company_details_confirmed=True,
user='email@email.com'
),
mock.call(
supplier_id=1234,
framework_slug='digital-outcomes-and-specialists-2',
application_company_details_confirmed=True,
user='email@email.com'
),
]
@pytest.mark.parametrize(
"complete_supplier",
(
get_supplier(),
get_supplier(companiesHouseNumber=None),
get_supplier(otherCompanyRegistrationNumber=None),
)
)
def test_post_route_calls_api_and_redirects_when_details_are_complete(self, complete_supplier):
self.data_api_client.get_supplier.return_value = complete_supplier
self.login()
response = self.client.post("/suppliers/details")
assert response.status_code == 302
assert self.data_api_client.update_supplier.call_args_list == [
mock.call(supplier={'companyDetailsConfirmed': True}, supplier_id=1234, user='email@email.com')
]
@pytest.mark.parametrize(
"incomplete_supplier",
(
get_supplier(organisationSize=None),
get_supplier(dunsNumber=None),
get_supplier(companiesHouseNumber=None, otherCompanyRegistrationNumber=None),
)
)
def test_post_route_does_not_call_api_and_returns_error_if_incomplete(self, incomplete_supplier):
self.data_api_client.get_supplier.return_value = incomplete_supplier
self.login()
response = self.client.post("/suppliers/details")
assert response.status_code == 400
assert self.data_api_client.update_supplier.call_args_list == []
@pytest.mark.parametrize(
"current_fwk,expected_destination",
[
(None, "/suppliers/details"),
("g-things-23", "/suppliers/frameworks/g-things-23"),
("digital-widgets-and-stuff", "/suppliers/frameworks/digital-widgets-and-stuff"),
]
)
def test_post_green_button_redirects_to_the_correct_place(self, current_fwk, expected_destination):
self.data_api_client.get_supplier.return_value = get_supplier()
self.login()
if current_fwk:
with self.client.session_transaction() as session:
session["currently_applying_to"] = current_fwk
response = self.client.post("/suppliers/details")
assert response.status_code == 302
assert response.location == f"http://localhost{expected_destination}"
class TestSupplierOpportunitiesDashboardLink(BaseApplicationTest):
def setup_method(self, method):
super().setup_method(method)
self.get_supplier_frameworks_response = {
'agreementReturned': True,
'complete_drafts_count': 2,
'declaration': {'status': 'complete'},
'frameworkSlug': 'digital-outcomes-and-specialists-4',
'onFramework': True,
'services_count': 2,
'supplierId': 1234
}
self.data_api_client_patch = mock.patch('app.main.views.suppliers.data_api_client', autospec=True)
self.data_api_client = self.data_api_client_patch.start()
def teardown_method(self, method):
self.data_api_client_patch.stop()
super().teardown_method(method)
def find_frameworks_stub(self):
return {'frameworks': [
{
**FrameworkStub(status='live', slug='digital-outcomes-and-specialists-4').response(),
'framework': 'digital-outcomes-and-specialists'
}
]}
def test_opportunities_dashboard_link(self):
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [self.get_supplier_frameworks_response]}
self.data_api_client.find_frameworks.return_value = self.find_frameworks_stub()
self.login()
res = self.client.get("/suppliers")
doc = html.fromstring(res.get_data(as_text=True))
# note how this also tests the ordering of the links
assert doc.xpath(
"//h3[normalize-space(string())=$f]"
"[(following::a)[1][normalize-space(string())=$t1][@href=$u1]]"
"[(following::a)[2][normalize-space(string())=$t2][@href=$u2]]"
"[(following::a)[3][normalize-space(string())=$t3][@href=$u3]]",
f="Digital Outcomes and Specialists 4",
t1="View your opportunities",
u1="/suppliers/opportunities/frameworks/digital-outcomes-and-specialists-4",
t2="View services",
u2="/suppliers/frameworks/digital-outcomes-and-specialists-4/services",
t3="View documents",
u3="/suppliers/frameworks/digital-outcomes-and-specialists-4",
)
@pytest.mark.parametrize(
'incorrect_data',
(
{'onFramework': False},
{'frameworkSlug': 'not-dos'}
)
)
def test_opportunities_dashboard_link_fails_with_incomplete_data(self, incorrect_data):
self.get_supplier_frameworks_response.update(incorrect_data)
self.data_api_client.get_supplier.side_effect = get_supplier
self.data_api_client.get_supplier_frameworks.return_value = {
'frameworkInterest': [self.get_supplier_frameworks_response]}
self.data_api_client.find_frameworks.return_value = self.find_frameworks_stub()
self.login()
res = self.client.get("/suppliers")
doc = html.fromstring(res.get_data(as_text=True))
unexpected_link = "/suppliers/opportunities/frameworks/digital-outcomes-and-specialists-4"
assert not any(filter(lambda i: i[2] == unexpected_link, doc.iterlinks()))
class TestSupplierDashboardLogin(BaseApplicationTest):
def setup_method(self, method):
super().setup_method(method)
self.data_api_client_patch = mock.patch('app.main.views.suppliers.data_api_client', autospec=True)
self.data_api_client = self.data_api_client_patch.start()
def teardown_method(self, method):
self.data_api_client_patch.stop()
super().teardown_method(method)
def test_should_show_supplier_dashboard_logged_in(self):
self.login()
self.data_api_client.authenticate_user.return_value = self.user(
123, "email@email.com", 1234, u'Supplier NĀme', u'Năme')
self.data_api_client.get_user.return_value = self.user(
123, "email@email.com", 1234, u'Supplier NĀme', u'Năme')
self.data_api_client.find_frameworks.return_value = FIND_FRAMEWORKS_RETURN_VALUE
self.data_api_client.get_supplier.side_effect = get_supplier
response = self.client.get("/suppliers")
assert response.status_code == 200
assert self.strip_all_whitespace(u'<h1 class="govuk-heading-xl">Supplier NĀme</h1>') in \
self.strip_all_whitespace(response.get_data(as_text=True))
assert self.strip_all_whitespace("email@email.com") in \
self.strip_all_whitespace(response.get_data(as_text=True))
assert self.strip_all_whitespace("Change your password") in \
self.strip_all_whitespace(response.get_data(as_text=True))
document = html.fromstring(response.get_data(as_text=True))
assert len(document.xpath("//a[contains(@href,'/user/change-password')]")) == 1
# the cookie settings link will appear twice, once in the banner on top
# and again on the side of the page next to account settings
assert len(document.xpath("//a[contains(@href,'/user/cookie-settings')]")) == 2
def test_should_redirect_to_login_if_not_logged_in(self):
res = self.client.get("/suppliers")
assert res.status_code == 302
assert res.location == "http://localhost/user/login?next=%2Fsuppliers"
def test_custom_dimension_supplier_role_and_organisation_size_is_set_if_supplier_logged_in(self):
self.data_api_client.find_frameworks.return_value = FIND_FRAMEWORKS_RETURN_VALUE
self.data_api_client.get_supplier.side_effect = get_supplier
self.login()
res = self.client.get('/suppliers')
doc = html.fromstring(res.get_data(as_text=True))
# The default company details from self.login() should available as attributes of current_user
assert len(doc.xpath('//meta[@data-value="supplier"]')) == 1
assert len(doc.xpath('//meta[@data-value="small"]')) == 1
def test_custom_dimension_supplier_organisation_size_not_set_if_size_is_null(self):
self.data_api_client.find_frameworks.return_value = FIND_FRAMEWORKS_RETURN_VALUE
self.data_api_client.get_supplier.side_effect = get_supplier
self.login(supplier_organisation_size=None)
res = self.client.get('/suppliers')
doc = html.fromstring(res.get_data(as_text=True))
# The default company details from self.login() should available as attributes of current_user
assert len(doc.xpath('//meta[@data-value="supplier"]')) == 1
assert len(doc.xpath('//meta[@data-value="small"]')) == 0
def test_custom_dimension_supplier_role_and_organisation_size_not_set_if_supplier_logged_out(self):
# View that does not require login
res = self.client.get('/suppliers/create/start')
doc = html.fromstring(res.get_data(as_text=True))
assert len(doc.xpath('//meta[@data-id="10"]')) == 0
assert len(doc.xpath('//meta[@data-id="11"]')) == 0
class TestSupplierUpdate(BaseApplicationTest):
def setup_method(self, method):
super().setup_method(method)
self.data_api_client_patch = mock.patch('app.main.views.suppliers.data_api_client', autospec=True)
self.data_api_client = self.data_api_client_patch.start()
def teardown_method(self, method):
self.data_api_client_patch.stop()
super().teardown_method(method)
def post_supplier_edit(self, data=None, **kwargs):
if data is None:
data = {
"description": "New Description",
"email": "supplier@user.dmdev",
"contactName": "Supplier Person",
"phoneNumber": "0800123123",
}
data.update(kwargs)
res = self.client.post("/suppliers/what-buyers-will-see/edit", data=data)
return res.status_code, res.get_data(as_text=True)
def test_should_render_edit_page_with_minimum_data(self):
self.login()
def limited_supplier(self):
return {
'suppliers': {
'contactInformation': [
{
'phoneNumber': '099887',
'id': 1234,
'contactName': 'contact name',
'email': 'email@email.com'
}
],
'dunsNumber': '999999999',
'id': 12345,
'name': 'Supplier Name'
}
}
self.data_api_client.get_supplier.side_effect = limited_supplier
response = self.client.get("/suppliers/what-buyers-will-see/edit")
assert response.status_code == 200
def test_update_all_supplier_fields(self):
self.login()
self.data_api_client.get_supplier.side_effect = get_supplier
status, _ = self.post_supplier_edit()
assert status == 302
self.data_api_client.update_supplier.assert_called_once_with(
1234,
{
'description': u'New Description'
},
'email@email.com'
)
self.data_api_client.update_contact_information.assert_called_once_with(
1234, 2,
{
'email': u'supplier@user.dmdev',
'phoneNumber': u'0800123123',
'contactName': u'Supplier Person',
},
'email@email.com'
)
def test_should_strip_whitespace_surrounding_supplier_update_all_fields(self):
self.login()
self.data_api_client.get_supplier.side_effect = get_supplier
data = {
"description": " New Description ",
"email": " supplier@user.dmdev ",
"contactName": " Supplier Person ",
"phoneNumber": " 0800123123 ",
}
status, _ = self.post_supplier_edit(data=data)
assert status == 302
self.data_api_client.update_supplier.assert_called_once_with(
1234,
{
'description': u'New Description'
},
'email@email.com'
)
self.data_api_client.update_contact_information.assert_called_once_with(
1234, 2,
{
'email': u'supplier@user.dmdev',
'phoneNumber': u'0800123123',
'contactName': u'Supplier Person',
},
'email@email.com'
)
def test_missing_required_supplier_fields(self):
self.login()
status, response = self.post_supplier_edit({
"description": "New Description",
})
assert status == 400
doc = html.fromstring(response)
for xpath_selector, expected_content in [
("[contains(@class, 'govuk-error-summary__list')]/li/a", "Enter a contact name"),
("[contains(@class, 'govuk-error-summary__list')]/li/a", "Enter an email address"),
("[contains(@class, 'govuk-error-summary__list')]/li/a", "Enter a phone number")
]:
assert doc.xpath(
f"//*{xpath_selector}[normalize-space(string())='{expected_content}']"
)
assert self.data_api_client.update_supplier.called is False
assert self.data_api_client.update_contact_information.called is False
assert "New Description" in response
def test_fields_above_character_length(self):
self.login()
status, response = self.post_supplier_edit(
phoneNumber="0" * 21,
contactName="A" * 256,
)
assert status == 400
doc = html.fromstring(response)
for xpath_selector, expected_content in [
("[contains(@class, 'govuk-error-summary__list')]/li/a", "Phone number must be 20 characters or fewer"),
("[contains(@class, 'govuk-error-summary__list')]/li/a", "Contact name must be 255 characters or fewer")
]:
assert doc.xpath(
f"//*{xpath_selector}[normalize-space(string())='{expected_content}']"
)
assert self.data_api_client.update_supplier.called is False
assert self.data_api_client.update_contact_information.called is False
def test_valid_email_address_required(self):
self.login()
status, response = self.post_supplier_edit(
email="This is absolutely not an email address"
)
assert status == 400
doc = html.fromstring(response)
for xpath_selector, expected_content in [
("[contains(@class, 'govuk-error-summary__list')]/li/a",
"Enter an email address in the correct format, like name@example.com")
]:
assert doc.xpath(
f"//*{xpath_selector}[normalize-space(string())='{expected_content}']"
)
assert self.data_api_client.update_supplier.called is False
assert self.data_api_client.update_contact_information.called is False
def test_description_below_word_length(self):
self.login()
status, resp = self.post_supplier_edit(
description="DESCR " * 49
)
assert status == 302
assert self.data_api_client.update_supplier.called is True
assert self.data_api_client.update_contact_information.called is True
def test_description_above_word_length(self):
self.login()
status, resp = self.post_supplier_edit(
description="DESCR " * 51
)
assert status == 400
assert 'must not be more than 50' in resp
assert self.data_api_client.update_supplier.called is False
assert self.data_api_client.update_contact_information.called is False
def test_should_redirect_to_login_if_not_logged_in(self):
res = self.client.get("/suppliers/what-buyers-will-see/edit")
assert res.status_code == 302
assert res.location == "http://localhost/user/login?next=%2Fsuppliers%2Fwhat-buyers-will-see%2Fedit"
class TestEditSupplierRegisteredAddress(BaseApplicationTest):
def setup_method(self, method):
super().setup_method(self)
self.data_api_client_patch = mock.patch("app.main.views.suppliers.data_api_client")
self.data_api_client = self.data_api_client_patch.start()
def teardown_method(self, method):
super().teardown_method(self)
self.data_api_client_patch.stop()
def post_supplier_address_edit(self, data=None, **kwargs):
if data is None:
data = {
"street": "1 Street",
"city": "Supplierville",
"postcode": "11 AB",
"country": "country:GB",
}
data.update(kwargs)
res = self.client.post("/suppliers/registered-address/edit", data=data)
return res.status_code, res.get_data(as_text=True)
def test_should_render_edit_address_page_with_minimum_data(self):
self.login()
self.data_api_client.get_supplier.return_value = {
'suppliers': {
'contactInformation': [{'id': 5678}],
'dunsNumber': '999999999',
'id': 1234,
'name': 'Supplier Name',
'registrationCountry': "",
}
}
response = self.client.get("/suppliers/registered-address/edit")
assert response.status_code == 200
def test_should_prepopulate_country_field(self):
self.login()
self.data_api_client.get_supplier.return_value = {
'suppliers': {
'contactInformation': [{'id': 5678}],
'dunsNumber': '999999999',
'id': 1234,
'registrationCountry': 'country:GB',
'name': 'Supplier Name'
}
}
response = self.client.get("/suppliers/registered-address/edit")
assert response.status_code == 200
doc = html.fromstring(response.get_data(as_text=True))
assert doc.xpath("//option[@selected='selected'][@value='country:GB']")
def test_update_all_supplier_address_fields(self):
self.login()
self.data_api_client.get_supplier.return_value = {
'suppliers': {
'contactInformation': [{'id': 5678}],
'dunsNumber': '999999999',
'id': 1234,
'name': 'Supplier Name',
'registrationCountry': "",
}
}
status, _ = self.post_supplier_address_edit()
assert status == 302
self.data_api_client.update_supplier.assert_called_once_with(
1234,
{
'registrationCountry': 'country:GB'
},
'email@email.com'
)
self.data_api_client.update_contact_information.assert_called_once_with(
1234,
5678,
{
'city': 'Supplierville',
'address1': '1 Street',
'postcode': '11 AB',
},
'email@email.com'
)
def test_should_strip_whitespace_surrounding_supplier_update_all_fields(self):
self.login()
self.data_api_client.get_supplier.return_value = {
'suppliers': {
'contactInformation': [{'id': 5678}],
'dunsNumber': '999999999',
'id': 1234,
'name': 'Supplier Name',
'registrationCountry': "",
}
}
data = {
"street": " 1 Street ",
"city": " Supplierville ",
"postcode": " 11 AB ",
"country": "country:GB",
}
status, _ = self.post_supplier_address_edit(data=data)
assert status == 302
self.data_api_client.update_contact_information.assert_called_once_with(
1234,
5678,
{
'city': 'Supplierville',
'address1': '1 Street',
'postcode': '11 AB',
},
'email@email.com'
)
def test_validation_on_required_supplier_address_fields(self):
self.login()
status, response = self.post_supplier_address_edit({
"street": "SomeStreet",
"city": "",
"postcode": "11 AB",
"registeredCountry": "",
})
assert status == 400
assert "Enter a town or city" in response
assert "Enter a country" in response
assert self.data_api_client.update_supplier.called is False
assert self.data_api_client.update_contact_information.called is False
assert 'value="11 AB"' in response
assert 'value="SomeStreet"' in response
@pytest.mark.parametrize(
'length, validation_error_returned, status_code',
(
(255, False, 302),
(256, True, 400),
),
)
def test_validation_on_length_of_supplier_address_fields(self, length, validation_error_returned, status_code):
self.login()
status, response = self.post_supplier_address_edit({
"street": "A" * length,
"city": "C" * length,
"postcode": "P" * (length - 240),
"country": "country:GB",
})
assert status == status_code
validation_messages = [
"Building and street name must be 255 characters or fewer",
"Town or city name must be 255 characters or fewer",
"Postcode must be 15 characters or fewer",
]
for message in validation_messages:
assert (message in response) == validation_error_returned
assert self.data_api_client.update_supplier.called is not validation_error_returned
assert self.data_api_client.update_contact_information.called is not validation_error_returned
data_values = [
f"value=\"{'A' * length}\"",
f"value=\"{'C' * length}\"",
f"value=\"{'P' * (length - 240)}\"",
]
for value in data_values:
assert (value in response) == validation_error_returned
def test_validation_fails_for_invalid_country(self):
self.login()
status, response = self.post_supplier_address_edit({
"street": "SomeStreet",
"city": "Florence",
"postcode": "11 AB",
"registeredCountry": "country:BLAH",
})
assert status == 400
assert "Enter a country" in response
assert self.data_api_client.update_supplier.called is False
assert self.data_api_client.update_contact_information.called is False
def test_should_redirect_to_login_if_not_logged_in(self):
res = self.client.get("/suppliers/registered-address/edit")
assert res.status_code == 302
assert res.location == "http://localhost/user/login?next=%2Fsuppliers%2Fregistered-address%2Fedit"
def test_handles_api_errors_when_updating_supplier_or_contact_information(self):
self.login()
self.data_api_client.update_supplier.side_effect = HTTPError(400, "I'm an error from the API")
status, response = self.post_supplier_address_edit()
assert status == 503
def test_handles_api_errors_when_updating_contact_information(self):
self.login()
self.data_api_client.update_contact_information.side_effect = HTTPError(400, "I'm an error from the API")
status, response = self.post_supplier_address_edit()
assert status == 503
class TestCreateSupplier(BaseApplicationTest):
direct_plus_api_method = 'app.main.views.suppliers.direct_plus_client.get_organization_by_duns_number'
@pytest.fixture
def get_organization_by_duns_number(self):
with self.app.app_context(), mock.patch(
self.direct_plus_api_method, return_value={"primaryName": "COMPANY NAME LTD"}
) as get_organization_by_duns_number:
yield get_organization_by_duns_number
def setup_method(self, method):
super().setup_method(method)
self.data_api_client_patch = mock.patch('app.main.views.suppliers.data_api_client', autospec=True)
self.data_api_client = self.data_api_client_patch.start()
def teardown_method(self, method):
self.data_api_client_patch.stop()
super().teardown_method(method)
def test_old_create_start_page_redirects_to_new_start_page(self):
res = self.client.get("/suppliers/create")
assert res.status_code == 301
assert res.location == "http://localhost/suppliers/create/start"
def test_create_start_page_get_ok(self):
res = self.client.get("/suppliers/create/start")
assert res.status_code == 200
def test_create_duns_number_page_get_ok(self):
res = self.client.get("/suppliers/create/duns-number")
assert res.status_code == 200
def test_create_company_details_page_get_ok(self):
res = self.client.get("/suppliers/create/company-details")
assert res.status_code == 200
@pytest.mark.parametrize(
"duns_number,expected_message",
[(None, 'Enter your 9 digit DUNS number'),
('invalid', 'Your DUNS number must be 9 digits'),
('12345678', 'Your DUNS number must be 9 digits'),
('1234567890', 'Your DUNS number must be 9 digits'),
],
)
def test_should_be_an_error_if_missing_or_invalid_duns_number(self, duns_number, expected_message):
"""Ensures that validation on duns number prevents submission of:
1) No value
2) Non-numerics
3) Numerics shorter/longer than 9 characters"""
res = self.client.post(
"/suppliers/create/duns-number",
data={'duns_number': duns_number} if duns_number else {}
)
self.assert_single_question_page_validation_errors(res, validation_message=expected_message)
def test_should_be_an_error_if_duns_number_in_use(self, get_organization_by_duns_number):
self.data_api_client.find_suppliers.return_value = {"suppliers": ["one supplier", "two suppliers"]}
res = self.client.post("/suppliers/create/duns-number", data={'duns_number': "123456789"})
assert res.status_code == 400
page = res.get_data(as_text=True)
assert "A supplier account already exists with that DUNS number" in page
assert "DUNS number already used" in page
assert "If you no longer have your account details, or if you think this may be an error," in page
def test_direct_plus_api_call(self, get_organization_by_duns_number):
self.client.post("/suppliers/create/duns-number", data={'duns_number': "123456789"})
get_organization_by_duns_number.assert_called_once_with('123456789')
def test_marketplace_data_api_call(self, get_organization_by_duns_number):
self.client.post("/suppliers/create/duns-number", data={'duns_number': "123456789"})
self.data_api_client.find_suppliers.assert_called_once_with(duns_number="123456789")
def test_should_be_an_error_if_duns_number_not_found(self, get_organization_by_duns_number):
get_organization_by_duns_number.side_effect = direct_plus_client.DUNSNumberNotFound
res = self.client.post("/suppliers/create/duns-number", data={'duns_number': "123456789"})
assert res.status_code == 400
page = res.get_data(as_text=True)
assert "DUNS number not found" in page
def test_skips_dnb_api_validation_if_unexpected_error(self, get_organization_by_duns_number):
get_organization_by_duns_number.side_effect = direct_plus_client.DirectPlusError
self.data_api_client.find_suppliers.return_value = {"suppliers": []}
res = self.client.post("/suppliers/create/duns-number", data={'duns_number': "123456789"})
assert res.status_code == 302
assert res.location == 'http://localhost/suppliers/create/company-details'
def test_duns_added_to_session_if_unexpected_error(self, get_organization_by_duns_number):
get_organization_by_duns_number.side_effect = direct_plus_client.DirectPlusError
with self.client as c:
with c.session_transaction() as sess:
with pytest.raises(KeyError):
sess['duns_number']
self.data_api_client.find_suppliers.return_value = {"suppliers": []}
c.post("/suppliers/create/duns-number", data={'duns_number': "123456789"})
assert session['duns_number'] == '123456789'
def test_should_allow_nine_digit_duns_number(self, get_organization_by_duns_number):
self.data_api_client.find_suppliers.return_value = {"suppliers": []}
res = self.client.post("/suppliers/create/duns-number", data={'duns_number': "123456789"})
assert res.status_code == 302
assert res.location == 'http://localhost/suppliers/create/confirm-company'
def test_should_allow_duns_numbers_that_start_with_zero(self, get_organization_by_duns_number):
self.data_api_client.find_suppliers.return_value = {"suppliers": []}
res = self.client.post("/suppliers/create/duns-number", data={'duns_number': "012345678"})
assert res.status_code == 302
assert res.location == 'http://localhost/suppliers/create/confirm-company'
def test_should_strip_whitespace_surrounding_duns_number_field(self):
self.data_api_client.find_suppliers.return_value = {"suppliers": []}
with self.app.app_context(), self.client as c:
with mock.patch(self.direct_plus_api_method, return_value={'primaryName': '0 COMPANY LTD'}):
c.post("/suppliers/create/duns-number", data={'duns_number': " 012345678 "})
assert "duns_number" in session
assert session.get("duns_number") == "012345678"
def test_should_add_company_name_to_session(self):
with self.app.app_context(), self.client as c:
with mock.patch(self.direct_plus_api_method, return_value={'primaryName': '0 COMPANY LTD'}):
with c.session_transaction() as sess:
with pytest.raises(KeyError):
sess['company_name']
self.data_api_client.find_suppliers.return_value = {"suppliers": []}
c.post("/suppliers/create/duns-number", data={'duns_number': "123456789"})
assert session['company_name'] == '0 COMPANY LTD'
def test_should_not_add_company_name_to_session_if_unexpected_error(self):
with self.app.app_context(), self.client as c:
with mock.patch(self.direct_plus_api_method, side_effect=direct_plus_client.DirectPlusError):
with c.session_transaction() as sess:
with pytest.raises(KeyError):
sess['company_name']
self.data_api_client.find_suppliers.return_value = {"suppliers": []}
c.post("/suppliers/create/duns-number", data={'duns_number': "123456789"})
with pytest.raises(KeyError):
session['company_name']
def test_should_allow_valid_company_contact_details(self):
res = self.client.post(
"/suppliers/create/company-details",
data={
'company_name': "My Company",
'contact_name': "Name",
'email_address': "name@email.com",
'phone_number': "999"
}
)
assert res.status_code == 302
assert res.location == 'http://localhost/suppliers/create/account'
def test_should_strip_whitespace_surrounding_contact_details_fields(self):
contact_details = {
'company_name': " My Company ",
'contact_name': " Name ",
'email_address': " name@email.com ",
'phone_number': " 999 "
}
with self.client as c:
c.post(
"/suppliers/create/company-details",
data=contact_details
)
for key, value in contact_details.items():
assert key in session
assert session.get(key) == value.strip()
def test_should_not_allow_contact_details_without_company_name(self):
res = self.client.post(
"/suppliers/create/company-details",
data={
'contact_name': "Name",
'email_address': "name@email.com",
'phone_number': "999"
}
)
assert res.status_code == 400
assert "Enter your company name" in res.get_data(as_text=True)
def test_should_not_allow_contact_details_with_too_long_company_name(self):
twofiftysix = "a" * 256
res = self.client.post(
"/suppliers/create/company-details",
data={
'company_name': twofiftysix,
'contact_name': "Name",
'email_address': "name@email.com",
'phone_number': "999"
}
)
assert res.status_code == 400
assert "Company name must be 255 characters or fewer" in res.get_data(as_text=True)
def test_should_not_allow_contact_details_without_contact_name(self):
res = self.client.post(
"/suppliers/create/company-details",
data={
'company_name': "My Company",
'email_address': "name@email.com",
'phone_number': "999"
}
)
assert res.status_code == 400
assert "Enter a contact name" in res.get_data(as_text=True)
def test_should_not_allow_contact_details_with_too_long_contact_name(self):
twofiftysix = "a" * 256
res = self.client.post(
"/suppliers/create/company-details",
data={
'company_name': "My Company",
'contact_name': twofiftysix,
'email_address': "name@email.com",
'phone_number': "999"
}
)
assert res.status_code == 400
assert "Contact name must be 255 characters or fewer" in res.get_data(as_text=True)
def test_should_not_allow_contact_details_without_email(self):
res = self.client.post(
"/suppliers/create/company-details",
data={
'company_name': "My Company",
'contact_name': "Name",
'phone_number': "999"
}
)
assert res.status_code == 400
assert "Enter an email address" in res.get_data(as_text=True)
def test_should_not_allow_contact_details_with_invalid_email(self):
res = self.client.post(
"/suppliers/create/company-details",
data={
'company_name': "My Company",
'contact_name': "Name",
'email_address': "notrightatall",
'phone_number': "999"
}
)
assert res.status_code == 400
assert "Enter an email address in the correct format, like name@example.com" in res.get_data(as_text=True)
def test_should_not_allow_contact_details_without_phone_number(self):
res = self.client.post(
"/suppliers/create/company-details",
data={
'company_name': "My Company",
'contact_name': "Name",
'email_address': "name@email.com"
}
)
assert res.status_code == 400
assert "Enter a phone number" in res.get_data(as_text=True)
def test_should_not_allow_contact_details_with_too_long_phone_number(self):
twentyone = "a" * 21
res = self.client.post(
"/suppliers/create/company-details",
data={
'company_name': "My Company",
'contact_name': "Name",
'email_address': "name@email.com",
'phone_number': twentyone
}
)
assert res.status_code == 400
assert "Phone number must be 20 characters or fewer" in res.get_data(as_text=True)
def test_should_show_multiple_errors(self):
res = self.client.post(
"/suppliers/create/company-details",
data={}
)
assert res.status_code == 400
assert "Enter your company name" in res.get_data(as_text=True)
assert "Enter a phone number" in res.get_data(as_text=True)
assert "Enter an email address" in res.get_data(as_text=True)
assert "Enter a contact name" in res.get_data(as_text=True)
def test_should_populate_duns_from_session(self):
with self.client.session_transaction() as sess:
sess['duns_number'] = "999"
res = self.client.get("/suppliers/create/duns-number")
assert res.status_code == 200
assert '<inputtype="text"name="duns_number"id="input-duns_number"class="text-box"value="999"' \
in self.strip_all_whitespace(res.get_data(as_text=True))
def test_should_populate_company_name_from_session(self):
with self.client.session_transaction() as sess:
sess['company_name'] = "Name"
res = self.client.get("/suppliers/create/company-details")
assert res.status_code == 200
assert '<inputtype="text"name="company_name"id="input-company_name"class="text-box"value="Name"' \
in self.strip_all_whitespace(res.get_data(as_text=True))
def test_should_populate_contact_details_from_session(self):
with self.client.session_transaction() as sess:
sess['email_address'] = "email_address"
sess['contact_name'] = "contact_name"
sess['phone_number'] = "phone_number"
res = self.client.get("/suppliers/create/company-details")
assert res.status_code == 200
stripped_page = self.strip_all_whitespace(res.get_data(as_text=True))
assert '<inputtype="text"name="email_address"id="input-email_address"class="text-box"value="email_address"' \
in stripped_page
assert '<inputtype="text"name="contact_name"id="input-contact_name"class="text-box"value="contact_name"' \
in stripped_page
assert '<inputtype="text"name="phone_number"id="input-phone_number"class="text-box"value="phone_number"' \
in stripped_page
def test_should_be_an_error_to_be_submit_company_with_incomplete_session(self):
res = self.client.post("/suppliers/create/company-summary")
assert res.status_code == 400
assert 'You must answer all the questions' in res.get_data(as_text=True)
@mock.patch("app.main.suppliers.send_user_account_email")
def test_should_redirect_to_create_your_account_if_valid_session(self, send_user_account_email):
with self.client as c:
with c.session_transaction() as sess:
sess['email_address'] = "email_address"
sess['phone_number'] = "phone_number"
sess['contact_name'] = "contact_name"
sess['duns_number'] = "duns_number"
sess['company_name'] = "company_name"
sess['account_email_address'] = "valid@email.com"
self.data_api_client.create_supplier.return_value = self.supplier()
res = c.post("/suppliers/create/company-summary")
assert res.status_code == 302
assert res.location == "http://localhost/suppliers/create/complete"
self.data_api_client.create_supplier.assert_called_once_with({
"contactInformation": [{
"email": "email_address",
"phoneNumber": "phone_number",
"contactName": "contact_name"
}],
"dunsNumber": "duns_number",
"name": "company_name",
})
assert 'email_address' not in session
assert 'phone_number' not in session
assert 'contact_name' not in session
assert 'duns_number' not in session
assert 'company_name' not in session
assert session['email_supplier_id'] == 12345
assert session['email_company_name'] == 'Supplier Name'
@mock.patch("app.main.suppliers.send_user_account_email")
def test_should_allow_missing_companies_house_number(self, send_user_account_email):
with self.client.session_transaction() as sess:
sess['email_address'] = "email_address"
sess['phone_number'] = "phone_number"
sess['contact_name'] = "contact_name"
sess['duns_number'] = "duns_number"
sess['company_name'] = "company_name"
sess['account_email_address'] = "account_email_address"
self.data_api_client.create_supplier.return_value = self.supplier()
res = self.client.post(
"/suppliers/create/company-summary",
data={
'email_address': 'valid@email.com'
}
)
assert res.status_code == 302
assert res.location == "http://localhost/suppliers/create/complete"
self.data_api_client.create_supplier.assert_called_once_with({
"contactInformation": [{
"email": "email_address",
"phoneNumber": "phone_number",
"contactName": "contact_name"
}],
"dunsNumber": "duns_number",
"name": "company_name"
})
def test_should_be_an_error_if_missing_a_field_in_session(self):
with self.client.session_transaction() as sess:
sess['email_address'] = "email_address"
sess['phone_number'] = "phone_number"
sess['contact_name'] = "contact_name"
sess['duns_number'] = "duns_number"
self.data_api_client.create_supplier.return_value = True
res = self.client.post("/suppliers/create/company-summary")
assert res.status_code == 400
assert self.data_api_client.create_supplier.called is False
assert 'You must answer all the questions' in res.get_data(as_text=True)
def test_should_return_503_if_api_error(self):
with self.client.session_transaction() as sess:
sess['email_address'] = "email_address"
sess['phone_number'] = "phone_number"
sess['contact_name'] = "contact_name"
sess['duns_number'] = "duns_number"
sess['company_name'] = "company_name"
sess['account_email_address'] = "account_email_address"
self.data_api_client.create_supplier.side_effect = HTTPError("gone bad")
res = self.client.post("/suppliers/create/company-summary")
assert res.status_code == 503
def test_should_require_an_email_address(self):
with self.client.session_transaction() as sess:
sess['email_company_name'] = "company_name"
sess['email_supplier_id'] = 1234
res = self.client.post(
"/suppliers/create/account",
data={}
)
assert res.status_code == 400
assert "Enter an email address" in res.get_data(as_text=True)
def test_should_not_allow_incorrect_email_address(self):
with self.client.session_transaction() as sess:
sess['email_company_name'] = "company_name"
sess['email_supplier_id'] = 1234
res = self.client.post(
"/suppliers/create/account",
data={
'email_address': "bademail"
}
)
assert res.status_code == 400
assert "Enter an email address in the correct format, like name@example.com" in res.get_data(as_text=True)
@mock.patch("app.main.suppliers.send_user_account_email")
def test_should_allow_correct_email_address(self, send_user_account_email):
with self.client as c:
with c.session_transaction() as sess:
sess['email_address'] = "email_address"
sess['phone_number'] = "phone_number"
sess['contact_name'] = "contact_name"
sess['duns_number'] = "duns_number"
sess['company_name'] = "company_name"
sess['account_email_address'] = "valid@email.com"
self.data_api_client.create_supplier.return_value = self.supplier()
res = c.post("/suppliers/create/company-summary")
send_user_account_email.assert_called_once_with(
'supplier',
'valid@email.com',
current_app.config['NOTIFY_TEMPLATES']['create_user_account'],
extra_token_data={
"supplier_id": 12345,
"supplier_name": "Supplier Name"
}
)
assert res.status_code == 302
assert res.location == 'http://localhost/suppliers/create/complete'
@mock.patch('dmutils.email.user_account_email.DMNotifyClient')
def test_should_correctly_store_email_address_in_session(self, DMNotifyClient):
with self.client as c:
with c.session_transaction() as sess:
sess['email_address'] = "email_address"
sess['phone_number'] = "phone_number"
sess['contact_name'] = "contact_name"
sess['duns_number'] = "duns_number"
sess['company_name'] = "company_name"
sess['account_email_address'] = "valid@email.com"
self.data_api_client.create_supplier.return_value = self.supplier()
c.post("/suppliers/create/company-summary")
assert session['email_sent_to'] == 'valid@email.com'
@mock.patch("app.main.suppliers.send_user_account_email")
def test_should_be_an_error_if_incomplete_session_on_account_creation(self, send_user_account_email):
res = self.client.post(
"/suppliers/create/company-summary"
)
assert send_user_account_email.called is False
assert res.status_code == 400
def test_should_show_email_address_on_create_account_complete(self):
with self.client as c:
with c.session_transaction() as sess:
sess['email_sent_to'] = "my@email.com"
sess['other_stuff'] = True
res = c.get("/suppliers/create/complete")
assert res.status_code == 200
assert 'my@email.com' in res.get_data(as_text=True)
assert 'other_stuff' not in session
def test_should_show_email_address_even_when_refreshed(self):
with self.client as c:
with c.session_transaction() as sess:
sess['email_sent_to'] = 'my-email@example.com'
res = c.get('/suppliers/create/complete')
assert res.status_code == 200
assert 'my-email@example.com' in res.get_data(as_text=True)
res = c.get('/suppliers/create/complete')
assert res.status_code == 200
assert 'my-email@example.com' in res.get_data(as_text=True)
class TestJoinOpenFrameworkNotificationMailingList(BaseApplicationTest):
def setup_method(self, method):
super().setup_method(method)
self.data_api_client_patch = mock.patch('app.main.views.suppliers.data_api_client', autospec=True)
self.data_api_client = self.data_api_client_patch.start()
def teardown_method(self, method):
self.data_api_client_patch.stop()
super().teardown_method(method)
@staticmethod
def _common_page_asserts_and_get_form(doc):
assert tuple(h1.xpath("normalize-space(string())") for h1 in doc.xpath("//h1")) == (
"Sign up for Digital Marketplace email alerts",
)
form = next(
form for form in doc.xpath("//form[@method='POST']")
if urlparse(form.action)[2:] == ("/suppliers/mailing-list", "", "", "",) and
form.xpath(".//input[@name='email_address']")
)
assert form.xpath(".//input[@name='csrf_token']")
assert form.xpath(".//button[normalize-space(string())=$t]", t="Subscribe")
return form
@mock.patch("app.main.views.suppliers.DMMailChimpClient")
def test_get(self, mailchimp_client_class):
self.data_api_client.create_audit_event.side_effect = AssertionError("This should not be called")
mailchimp_client_instance = mock.Mock(spec=("subscribe_new_email_to_list",))
mailchimp_client_instance.subscribe_new_email_to_list.side_effect = AssertionError("This should not be called")
mailchimp_client_class.side_effect = assert_args_and_return(
mailchimp_client_instance,
"not_a_real_username",
"not_a_real_key",
mock.ANY,
)
response = self.client.get(
"/suppliers/mailing-list",
)
assert response.status_code == 200
doc = html.fromstring(response.get_data(as_text=True), base_url="/suppliers/mailing-list")
assert not doc.xpath(
"//*[normalize-space(string())=$t]",
t="Provide a valid email address.",
)
assert not doc.xpath(
"//*[normalize-space(string())=$t]",
t="Provide an email address.",
)
assert not doc.xpath("//*[contains(@class, 'validation-message')]")
form = self._common_page_asserts_and_get_form(doc)
# we have already tested for the existence of input[@name='email_address']
assert not any(inp.value for inp in form.xpath(".//input[@name='email_address']"))
self.assert_no_flashes()
@pytest.mark.parametrize("email_address_value,expected_validation_message", (
("pint@twopence", "Enter an email address in the correct format, like name@example.com",),
("", "Enter an email address",),
))
@mock.patch("app.main.views.suppliers.DMMailChimpClient")
def test_post_invalid_email(
self,
mailchimp_client_class,
email_address_value,
expected_validation_message,
):
self.data_api_client.create_audit_event.side_effect = AssertionError("This should not be called")
mailchimp_client_instance = mock.Mock(spec=("subscribe_new_email_to_list",))
mailchimp_client_instance.subscribe_new_email_to_list.side_effect = AssertionError("This should not be called")
mailchimp_client_class.side_effect = assert_args_and_return(
mailchimp_client_instance,
"not_a_real_username",
"not_a_real_key",
mock.ANY,
)
response = self.client.post(
"/suppliers/mailing-list",
data={
"email_address": email_address_value,
},
)
assert response.status_code == 400
doc = html.fromstring(response.get_data(as_text=True), base_url="/suppliers/mailing-list")
form = self._common_page_asserts_and_get_form(doc)
assert tuple(inp.value for inp in form.xpath(".//input[@name='email_address']")) == (
email_address_value,
)
assert doc.xpath(
"//label[@for='input-email_address']//*[contains(@class, 'validation-message')]"
"[normalize-space(string())=$t]",
t=expected_validation_message,
)
self.assert_no_flashes()
@pytest.mark.parametrize("mc_retval, expected_status, expected_message", (
(
{'error_type': 'already_subscribed', 'status_code': 400, 'status': 'error'},
400, "This email address has already been used to sign up"
),
(
{'error_type': 'deleted_user', 'status_code': 400, 'status': 'error'},
400, "This email address cannot be used to sign up"
),
(
{'error_type': 'invalid_email', 'status_code': 400, 'status': 'error'},
400, "This email address cannot be used to sign up"
),
(
{'error_type': 'unexpected_error', 'status_code': 503, 'status': 'error'},
503, "The service is unavailable at the moment"
),
))
@mock.patch("app.main.views.suppliers.DMMailChimpClient")
def test_post_valid_email_failure(self, mailchimp_client_class, mc_retval, expected_status, expected_message):
self.data_api_client.create_audit_event.side_effect = AssertionError("This should not be called")
mailchimp_client_instance = mock.Mock(spec=("subscribe_new_email_to_list",))
mailchimp_client_instance.subscribe_new_email_to_list.side_effect = assert_args_and_return(
mc_retval,
"not_a_real_mailing_list",
"squinting@ger.ty",
)
mailchimp_client_class.side_effect = assert_args_and_return(
mailchimp_client_instance,
"not_a_real_username",
"not_a_real_key",
mock.ANY,
)
with self.app.app_context():
response = self.client.post(
"/suppliers/mailing-list",
data={
"email_address": "squinting@ger.ty",
},
)
assert response.status_code == expected_status
doc = html.fromstring(response.get_data(as_text=True), base_url="/suppliers/mailing-list")
assert mailchimp_client_instance.subscribe_new_email_to_list.called is True
form = self._common_page_asserts_and_get_form(doc)
assert tuple(inp.value for inp in form.xpath(".//input[@name='email_address']")) == (
"squinting@ger.ty",
)
assert not doc.xpath(
"//*[normalize-space(string())=$t]",
t="Provide a valid email address.",
)
assert not doc.xpath(
"//*[normalize-space(string())=$t]",
t="Provide an email address.",
)
assert not doc.xpath("//*[contains(@class, 'validation-message')]")
# test flash message content
flash_messages = doc.cssselect(".dm-alert")
assert len(flash_messages) == 1
assert "dm-alert--error" in flash_messages[0].classes
assert expected_message in flash_messages[0].cssselect(".dm-alert__body")[0].text.strip()
email_address_link = flash_messages[0].cssselect("a")[0]
assert email_address_link.text == current_app.config["SUPPORT_EMAIL_ADDRESS"]
assert email_address_link.attrib["href"] == f"mailto:{current_app.config['SUPPORT_EMAIL_ADDRESS']}"
# flash message should have been consumed by view's own page rendering
self.assert_no_flashes()
@mock.patch("app.main.views.suppliers.DMMailChimpClient")
def test_post_valid_email_success(self, mailchimp_client_class):
self.data_api_client.create_audit_event.side_effect = assert_args_and_return(
{"convincing": "response"},
audit_type=AuditTypes.mailing_list_subscription,
data={
"subscribedEmail": "qu&rt@four.pence",
"mailchimp": {
"id": "cashregister-clanged",
"unique_email_id": "clock-clacked",
"timestamp_opt": None,
"last_changed": "1904-06-16T16:00:00+00:00",
"list_id": "flowered-tables",
},
},
)
mailchimp_client_instance = mock.Mock(spec=("subscribe_new_email_to_list",))
mailchimp_client_instance.subscribe_new_email_to_list.side_effect = assert_args_and_return(
{
"id": "cashregister-clanged",
"unique_email_id": "clock-clacked",
# timestamp_opt deliberately omitted
"last_changed": "1904-06-16T16:00:00+00:00",
"list_id": "flowered-tables",
"has-he-forgotten": "perhaps-a-trick", # should be ignored
"status": "success",
"status_code": 200,
"error_type": None,
},
"not_a_real_mailing_list",
"qu&rt@four.pence",
)
mailchimp_client_class.side_effect = assert_args_and_return(
mailchimp_client_instance,
"not_a_real_username",
"not_a_real_key",
mock.ANY,
)
response = self.client.post(
"/suppliers/mailing-list",
data={
# no, ampersands are probably not valid in this position in an email address but they are accepted
# by our regex and we want to be able to check their escaping in the flash message
"email_address": "qu&rt@four.pence",
},
)
assert response.status_code == 302
assert response.location == "http://localhost/"
assert mailchimp_client_instance.subscribe_new_email_to_list.called is True
assert self.get_flash_messages() == (
("success", "You will receive email notifications to qu&rt@four.pence when applications are opening.",),
)
class TestBecomeASupplier(BaseApplicationTest):
def setup_method(self, method):
super().setup_method(method)
self.data_api_client_patch = mock.patch('app.main.views.suppliers.data_api_client', autospec=True)
self.data_api_client = self.data_api_client_patch.start()
def teardown_method(self, method):
self.data_api_client_patch.stop()
super().teardown_method(method)
def test_become_a_supplier_page_loads_ok(self):
res = self.client.get("/suppliers/supply")
assert res.status_code == 200
assert self.strip_all_whitespace(u'<h1 class="govuk-heading-l">Become a supplier</h1>') in \
self.strip_all_whitespace(res.get_data(as_text=True))
@mock.patch('app.main.suppliers.get_frameworks_closed_and_open_for_applications', autospec=True)
def test_frameworks_are_sorted_correctly(self, get_frameworks_closed_and_open_for_applications):
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(id=3, status='live', slug='g-cloud-9').response(),
FrameworkStub(id=1, status='expired', slug='g-cloud-8').response(),
FrameworkStub(id=5, status='pending', slug='g-cloud-10').response(),
FrameworkStub(id=2, status='live', slug='digital-outcomes-and-specialists').response(),
FrameworkStub(id=4, status='coming', slug='digital-outcomes-and-specialists-2').response(),
]
}
self.client.get("/suppliers/supply")
ordered_framework_slugs = [
fw['slug'] for fw in get_frameworks_closed_and_open_for_applications.call_args_list[0][0][0]
]
assert ordered_framework_slugs == [
'g-cloud-10',
'digital-outcomes-and-specialists-2',
'g-cloud-9',
'digital-outcomes-and-specialists',
'g-cloud-8',
]
def test_all_open_or_coming_frameworks(self):
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(status='open', slug='g-cloud-9').response(),
FrameworkStub(status='live', slug='g-cloud-8').response(),
FrameworkStub(status='coming', slug='digital-outcomes-and-specialists-2').response(),
FrameworkStub(status='live', slug='digital-outcomes-and-specialists').response(),
]
}
res = self.client.get("/suppliers/supply")
data = res.get_data(as_text=True)
self.data_api_client.find_frameworks.assert_called_once_with()
# Check right headings are there
assert 'Services you can apply to sell' in data
assert 'Services you can’t apply to sell at the moment' not in data
assert 'You cannot create a supplier account at the moment' not in data
# Check the right framework content is there
assert 'Digital Outcomes and Specialists is opening for applications.' in data
assert 'G-Cloud is open for applications.' in data
# Check the right calls to action are there
assert 'Create a supplier account' in data
assert 'Get notifications when applications are opening' not in data
def test_all_closed_frameworks(self):
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(status='live', slug='g-cloud-9').response(),
FrameworkStub(status='expired', slug='g-cloud-8').response(),
FrameworkStub(status='standstill', slug='digital-outcomes-and-specialists-2').response(),
FrameworkStub(status='live', slug='digital-outcomes-and-specialists').response(),
]
}
res = self.client.get("/suppliers/supply")
data = res.get_data(as_text=True)
self.data_api_client.find_frameworks.assert_called_once_with()
# Check right headings are there
assert 'You cannot create a supplier account at the moment' in data
assert 'Services you can apply to sell' not in data
assert 'Services you can’t apply to sell at the moment' not in data
# Check the right framework content is there
assert 'Digital Outcomes and Specialists is closed for applications.' in data
assert 'G-Cloud is closed for applications.' in data
# Check the right calls to action are there
assert 'Create a supplier account' not in data
assert 'Get notifications when applications are opening' in data
def test_one_open_one_closed_framework(self):
self.data_api_client.find_frameworks.return_value = {
"frameworks": [
FrameworkStub(status='open', slug='g-cloud-9').response(),
FrameworkStub(status='live', slug='g-cloud-8').response(),
FrameworkStub(status='live', slug='digital-outcomes-and-specialists-2').response(),
FrameworkStub(status='expired', slug='digital-outcomes-and-specialists').response(),
]
}
res = self.client.get("/suppliers/supply")
data = res.get_data(as_text=True)
self.data_api_client.find_frameworks.assert_called_once_with()
# Check right headings are there
assert 'Services you can apply to sell' in data
assert 'Services you can’t apply to sell at the moment' in data
assert 'You cannot create a supplier account at the moment' not in data
# Check the right framework content is there
assert 'Digital Outcomes and Specialists is closed for applications.' in data
assert 'G-Cloud is open for applications.' in data
# Check the right calls to action are there
assert 'Create a supplier account' in data
assert 'Get notifications when applications are opening' in data
class TestSupplierEditOrganisationSize(BaseApplicationTest):
def setup_method(self, method):
super().setup_method(method)
self.data_api_client_patch = mock.patch('app.main.views.suppliers.data_api_client', autospec=True)
self.data_api_client = self.data_api_client_patch.start()
def teardown_method(self, method):
self.data_api_client_patch.stop()
super().teardown_method(method)
def test_edit_organisation_size_page_loads(self):
self.login()
res = self.client.get("/suppliers/organisation-size/edit")
assert res.status_code == 200, 'The edit organisation-size page has not loaded correctly.'
@pytest.mark.parametrize('organisation_size, expected_error',
(
(None, "Select an organisation size"),
('blah', "Not a valid choice")
))
def test_missing_or_invalid_choice_shows_validation(self, organisation_size, expected_error):
self.login()
res = self.client.post("/suppliers/organisation-size/edit",
data={'organisation_size': organisation_size} if organisation_size else {})
doc = html.fromstring(res.get_data(as_text=True))
error = doc.xpath('//span[@id="input-organisation_size-error"]')
assert len(error) == 1, 'Only one validation message should be shown.'
assert error[0].text_content().strip() == f"Error: {expected_error}", \
'The validation message is not as anticipated.'
self.assert_single_question_page_validation_errors(res, validation_message=expected_error)
@pytest.mark.parametrize('size', (None, 'micro', 'small', 'medium', 'large'))
def test_post_choice_triggers_api_supplier_update_and_redirect(self, size):
self.login()
self.client.post("/suppliers/organisation-size/edit", data={'organisation_size': size})
call_args_list = self.data_api_client.update_supplier.call_args_list
if size:
assert call_args_list == [
mock.call(supplier_id=1234, supplier={'organisationSize': size}, user='email@email.com')
], 'update_supplier was called with the wrong arguments'
else:
assert call_args_list == [], 'update_supplier was called with the wrong arguments'
@pytest.mark.parametrize('existing_size, expected_selection',
(
(None, []),
('some unknown value', []),
*[(x['value'], [x['value']]) for x in CompanyOrganisationSizeForm.OPTIONS],
))
def test_existing_org_size_sets_current_selection(self, existing_size, expected_selection):
data = {'organisationSize': existing_size} if existing_size else {}
self.data_api_client.get_supplier.return_value = {'suppliers': data}
self.login()
res = self.client.get("/suppliers/organisation-size/edit")
doc = html.fromstring(res.get_data(as_text=True))
selected_value = doc.xpath('//input[@name="organisation_size" and @checked="checked"]/@value')
assert selected_value == expected_selection, 'The organisation size has not pre-populated correctly.'
class TestSupplierAddRegisteredCompanyName(BaseApplicationTest):
def setup_method(self, method):
super().setup_method(method)
self.data_api_client_patch = mock.patch('app.main.views.suppliers.data_api_client', autospec=True)
self.data_api_client = self.data_api_client_patch.start()
def teardown_method(self, method):
self.data_api_client_patch.stop()
super().teardown_method(method)
def test_add_registered_company_name_page_loads(self):
self.login()
self.data_api_client.get_supplier.return_value = get_supplier(registeredName=None)
res = self.client.get("/suppliers/registered-company-name/edit")
assert res.status_code == 200, 'The add registered company name page has not loaded correctly.'
def test_no_input_triggers_input_required_validation_and_does_not_call_api_update(self):
self.login()
self.data_api_client.get_supplier.return_value = get_supplier(registeredName=None)
res = self.client.post("/suppliers/registered-company-name/edit")
self.assert_single_question_page_validation_errors(res, validation_message="Enter your registered company name")
assert self.data_api_client.update_supplier.call_args_list == []
def test_post_input_triggers_api_supplier_update_and_redirect(self):
self.login()
self.data_api_client.get_supplier.return_value = get_supplier(registeredName=None)
res = self.client.post("/suppliers/registered-company-name/edit", data={'registered_company_name': "K-Inc"})
assert self.data_api_client.update_supplier.call_args_list == [
mock.call(supplier_id=1234, supplier={'registeredName': "K-Inc"}, user='email@email.com')
], 'update_supplier was called with the wrong arguments'
assert res.status_code == 302
assert res.location == 'http://localhost/suppliers/details'
def test_fails_if_api_update_fails(self):
self.login()
self.data_api_client.get_supplier.return_value = get_supplier(registeredName=None)
self.data_api_client.update_supplier.side_effect = APIError(ServiceUnavailable())
res = self.client.post("/suppliers/registered-company-name/edit", data={'registered_company_name': "K-Inc"})
assert res.status_code == 503
@pytest.mark.parametrize('overwrite_supplier_data',
({'companyDetailsConfirmed': False}, {'registeredName': None})
)
def test_get_shows_form_on_page_if_supplier_data_not_complete_and_confirmed(self, overwrite_supplier_data):
self.login()
self.data_api_client.get_supplier.return_value = get_supplier(**overwrite_supplier_data)
res = self.client.get("/suppliers/registered-company-name/edit")
doc = html.fromstring(res.get_data(as_text=True))
page_heading = doc.xpath('//h1')
assert res.status_code == 200
assert page_heading[0].text_content().strip() == "Registered company name"
assert doc.xpath('//form[@action="/suppliers/registered-company-name/edit"]')
assert self.data_api_client.update_supplier.call_args_list == []
def test_get_shows_already_entered_page_and_api_not_called_update_if_data_already_confirmed(self):
self.login()
self.data_api_client.get_supplier.side_effect = get_supplier
res = self.client.get("/suppliers/registered-company-name/edit")
doc = html.fromstring(res.get_data(as_text=True))
page_heading = doc.xpath('//h1')
assert res.status_code == 200
assert page_heading[0].text.strip() == "Correct a mistake in your registered company name"
assert self.data_api_client.update_supplier.call_args_list == []
def test_post_shows_already_entered_page_and_api_not_called_if_data_already_confirmed(self):
self.login()
self.data_api_client.get_supplier.side_effect = get_supplier
res = self.client.post("/suppliers/registered-company-name/edit", data={'registered_company_name': "K-Inc"})
doc = html.fromstring(res.get_data(as_text=True))
page_heading = doc.xpath('//h1')
assert res.status_code == 400
assert page_heading[0].text.strip() == "Correct a mistake in your registered company name"
assert self.data_api_client.update_supplier.call_args_list == []
class TestSupplierEditTradingStatus(BaseApplicationTest):
def setup_method(self, method):
super().setup_method(method)
self.data_api_client_patch = mock.patch('app.main.views.suppliers.data_api_client', autospec=True)
self.data_api_client = self.data_api_client_patch.start()
def teardown_method(self, method):
self.data_api_client_patch.stop()
super().teardown_method(method)
def test_edit_organisation_size_page_loads(self):
self.login()
res = self.client.get("/suppliers/trading-status/edit")
assert res.status_code == 200, 'The edit trading-status page has not loaded correctly.'
@pytest.mark.parametrize('trading_status, expected_error',
(
(None, "Select a trading status"),
('blah', "Not a valid choice")
))
def test_missing_or_invalid_choice_shows_validation(self, trading_status, expected_error):
self.login()
res = self.client.post("/suppliers/trading-status/edit",
data={'trading_status': trading_status} if trading_status else {})
doc = html.fromstring(res.get_data(as_text=True))
error = doc.xpath('//span[@id="input-trading_status-error"]')
assert len(error) == 1, 'Only one validation message should be shown.'
assert error[0].text_content().strip() == f"Error: {expected_error}", \
'The validation message is not as anticipated.'
self.assert_single_question_page_validation_errors(res, validation_message=expected_error)
@pytest.mark.parametrize('trading_status', (None, 'limited company (LTD)', 'other'))
def test_post_choice_triggers_api_supplier_update_and_redirect(self, trading_status):
self.login()
self.client.post("/suppliers/trading-status/edit", data={'trading_status': trading_status})
call_args_list = self.data_api_client.update_supplier.call_args_list
if trading_status:
assert call_args_list == [
mock.call(supplier_id=1234, supplier={'tradingStatus': trading_status}, user='email@email.com')
], 'update_supplier was called with the wrong arguments'
else:
assert call_args_list == [], 'update_supplier was called with the wrong arguments'
@pytest.mark.parametrize('existing_trading_status, expected_selection',
(
(None, []),
('some unknown value', []),
*[(x['value'], [x['value']]) for x in CompanyTradingStatusForm.OPTIONS],
))
def test_existing_org_size_sets_current_selection(self, existing_trading_status, expected_selection):
data = {'tradingStatus': existing_trading_status} if existing_trading_status else {}
self.data_api_client.get_supplier.return_value = {'suppliers': data}
self.login()
res = self.client.get("/suppliers/trading-status/edit")
doc = html.fromstring(res.get_data(as_text=True))
selected_value = doc.xpath('//input[@name="trading_status" and @checked="checked"]/@value')
assert selected_value == expected_selection, 'The trading status has not pre-populated correctly.'
def test_api_error_is_not_suppressed(self):
error_message = 'There was an error with the API'
self.data_api_client.update_supplier.side_effect = APIError('blah', error_message)
self.login()
res = self.client.post("/suppliers/trading-status/edit",
data={'trading_status': CompanyTradingStatusForm.OPTIONS[0]['value']})
assert res.status_code == 503
class TestSupplierAddRegistrationNumber(BaseApplicationTest):
def setup_method(self, method):
super().setup_method(method)
self.data_api_client_patch = mock.patch('app.main.views.suppliers.data_api_client', autospec=True)
self.data_api_client = self.data_api_client_patch.start()
def teardown_method(self, method):
self.data_api_client_patch.stop()
super().teardown_method(method)
def test_add_registration_number_page_loads(self):
self.login()
self.data_api_client.get_supplier.return_value = get_supplier(
companiesHouseNumber=None,
otherCompanyRegistrationNumber=None
)
res = self.client.get("/suppliers/registration-number/edit")
assert res.status_code == 200, 'The add registration number page has not loaded correctly.'
@pytest.mark.parametrize(
'incomplete_data, question_mentioned, validation_message',
(
(
{'has_companies_house_number': '',
'companies_house_number': '',
'other_company_registration_number': ''
},
'Select yes if you are registered with Companies House',
'Select yes if you are registered with Companies House'
),
(
{'has_companies_house_number': 'Yes',
'companies_house_number': '',
'other_company_registration_number': ''
},
'Enter a Companies House number',
'Enter a Companies House number'
),
(
{'has_companies_house_number': 'Yes',
'companies_house_number': '123456789',
'other_company_registration_number': ''
},
"Your Companies House number must be 8 characters",
"Your Companies House number must be 8 characters"
),
(
{'has_companies_house_number': 'No',
'companies_house_number': '',
'other_company_registration_number': 'a' * 256
},
'Registration number must be 255 characters or fewer',
'Registration number must be 255 characters or fewer'
)
)
)
def test_incomplete_or_invalid_input_shows_validation_error_and_does_not_update_api(
self, incomplete_data, question_mentioned, validation_message
):
self.login()
self.data_api_client.get_supplier.return_value = get_supplier(
companiesHouseNumber=None,
otherCompanyRegistrationNumber=None
)
res = self.client.post("/suppliers/registration-number/edit", data=incomplete_data)
self.assert_single_question_page_validation_errors(res, validation_message=validation_message)
assert self.data_api_client.update_supplier.call_args_list == []
# Assert the links in the error summary point to elements on the page
doc = html.fromstring(res.get_data(as_text=True))
summary_link = doc.xpath("//ul[contains(@class, 'govuk-error-summary__list')]/li/a/@href")[0]
assert doc.cssselect(summary_link)
@pytest.mark.parametrize(
'complete_data, expected_post',
(
(
{'has_companies_house_number': 'Yes',
'companies_house_number': 'KK654321',
'other_company_registration_number': ''
},
{'companiesHouseNumber': 'KK654321', 'otherCompanyRegistrationNumber': None}
),
(
{'has_companies_house_number': 'Yes',
'companies_house_number': 'kk654321',
'other_company_registration_number': ''
},
{'companiesHouseNumber': 'KK654321', 'otherCompanyRegistrationNumber': None}
),
(
{'has_companies_house_number': 'No',
'companies_house_number': '',
'other_company_registration_number': 'KK987654321, my special registration number'
},
{'companiesHouseNumber': None,
'otherCompanyRegistrationNumber': 'KK987654321, my special registration number'}
),
)
)
def test_post_input_triggers_api_supplier_update_and_redirect(self, complete_data, expected_post):
self.login()
self.data_api_client.get_supplier.return_value = get_supplier(
companiesHouseNumber=None,
otherCompanyRegistrationNumber=None
)
res = self.client.post("/suppliers/registration-number/edit", data=complete_data)
assert self.data_api_client.update_supplier.call_args_list == [
mock.call(supplier_id=1234, supplier=expected_post, user='email@email.com')
], 'update_supplier was called with the wrong arguments'
assert res.status_code == 302
assert res.location == 'http://localhost/suppliers/details'
def test_fails_if_api_update_fails(self):
self.login()
valid_post_data = {'has_companies_house_number': 'Yes',
'companies_house_number': 'KK654321',
'other_company_registration_number': ''
}
self.data_api_client.get_supplier.return_value = get_supplier(
companiesHouseNumber=None,
otherCompanyRegistrationNumber=None
)
self.data_api_client.update_supplier.side_effect = APIError(ServiceUnavailable())
res = self.client.post("/suppliers/registration-number/edit", data=valid_post_data)
assert res.status_code == 503
@pytest.mark.parametrize('overwrite_supplier_data',
(
{'companyDetailsConfirmed': False},
{'companiesHouseNumber': None, 'otherCompanyRegistrationNumber': None},
))
def test_get_shows_form_on_page_if_supplier_data_not_complete_and_confirmed(self, overwrite_supplier_data):
self.login()
self.data_api_client.get_supplier.return_value = get_supplier(**overwrite_supplier_data)
res = self.client.get("/suppliers/registration-number/edit")
doc = html.fromstring(res.get_data(as_text=True))
page_heading = doc.xpath('//h1')
assert res.status_code == 200
assert page_heading[0].text_content().strip() == "Are you registered with Companies House?"
assert doc.xpath('//form[@action="/suppliers/registration-number/edit"]')
assert self.data_api_client.update_supplier.call_args_list == []
def test_get_shows_already_entered_page_and_api_not_called_update_if_data_already_confirmed(self):
self.login()
# Default get_supplier has companiesHouseNumber and otherCompanyRegistrationNumber complete
self.data_api_client.get_supplier.side_effect = get_supplier
res = self.client.get("/suppliers/registration-number/edit")
doc = html.fromstring(res.get_data(as_text=True))
page_heading = doc.xpath('//h1')
assert res.status_code == 200
assert page_heading[0].text.strip() == "Correct a mistake in your registration number"
assert self.data_api_client.update_supplier.call_args_list == []
def test_post_shows_already_entered_page_and_api_not_called_if_data_already_confirmed(self):
self.login()
valid_post_data = {'has_companies_house_number': 'Yes',
'companies_house_number': 'KK654321',
'other_company_registration_number': ''
}
# Default get_supplier has companiesHouseNumber and otherCompanyRegistrationNumber complete
self.data_api_client.get_supplier.side_effect = get_supplier
res = self.client.post("/suppliers/registration-number/edit", data=valid_post_data)
doc = html.fromstring(res.get_data(as_text=True))
page_heading = doc.xpath('//h1')
assert res.status_code == 400
assert page_heading[0].text.strip() == "Correct a mistake in your registration number"
assert self.data_api_client.update_supplier.call_args_list == []
| 42.283592
| 120
| 0.624389
| 13,968
| 125,244
| 5.335767
| 0.053479
| 0.023762
| 0.043955
| 0.054515
| 0.802952
| 0.772333
| 0.737408
| 0.714638
| 0.682289
| 0.651416
| 0
| 0.016669
| 0.263797
| 125,244
| 2,961
| 121
| 42.297872
| 0.791638
| 0.016895
| 0
| 0.557202
| 0
| 0.006173
| 0.256022
| 0.107962
| 0
| 0
| 0
| 0
| 0.165844
| 1
| 0.069547
| false
| 0.001646
| 0.00535
| 0.001646
| 0.083951
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
0e0672cc55f0036411275f5419d42d2edc05f450
| 165
|
py
|
Python
|
libs/baseclass/about.py
|
jonsonkurt/QR-Code-Generator-and-Class-Attendance-System
|
60590fcb114c39c144cf3a9fa683e0b8c243b461
|
[
"MIT"
] | null | null | null |
libs/baseclass/about.py
|
jonsonkurt/QR-Code-Generator-and-Class-Attendance-System
|
60590fcb114c39c144cf3a9fa683e0b8c243b461
|
[
"MIT"
] | null | null | null |
libs/baseclass/about.py
|
jonsonkurt/QR-Code-Generator-and-Class-Attendance-System
|
60590fcb114c39c144cf3a9fa683e0b8c243b461
|
[
"MIT"
] | null | null | null |
from kivy.lang.builder import Builder
from kivy.uix.screenmanager import Screen
Builder.load_file('./libs/kv/about.kv')
class AboutScreen(Screen):
pass
| 20.625
| 42
| 0.745455
| 23
| 165
| 5.304348
| 0.695652
| 0.131148
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.151515
| 165
| 8
| 43
| 20.625
| 0.871429
| 0
| 0
| 0
| 0
| 0
| 0.113208
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.2
| 0.4
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
|
0
| 5
|
0e0f955a96802c34cb53dddb9a27c583aa4bed0e
| 444
|
py
|
Python
|
final project/sparse matix/clawn_matrix_gen/x.py
|
Yangfan-Jiang/High-Performance-Computing-Fall-2019
|
b0292d17cbf1ce93e8df024a53721f94cefa95e4
|
[
"MIT"
] | null | null | null |
final project/sparse matix/clawn_matrix_gen/x.py
|
Yangfan-Jiang/High-Performance-Computing-Fall-2019
|
b0292d17cbf1ce93e8df024a53721f94cefa95e4
|
[
"MIT"
] | null | null | null |
final project/sparse matix/clawn_matrix_gen/x.py
|
Yangfan-Jiang/High-Performance-Computing-Fall-2019
|
b0292d17cbf1ce93e8df024a53721f94cefa95e4
|
[
"MIT"
] | 1
|
2019-11-16T03:38:31.000Z
|
2019-11-16T03:38:31.000Z
|
x = """0 0 1.0
1 0 1.0
2 0 1.0
0 1 1.0
0 2 1.0
1 1 1.0
1 2 1.0
2 1 1.0
2 2 1.0
3 0 1.0
4 0 1.0
5 0 1.0
6 0 1.0
0 3 1.0
0 4 1.0
0 5 1.0
0 6 1.0
3 1 1.0
1 3 1.0
4 1 1.0
1 4 1.0
5 1 1.0
1 5 1.0
6 1 1.0
1 6 1.0
3 2 1.0
2 3 1.0
4 2 1.0
2 4 1.0
5 2 1.0
2 5 1.0
6 2 1.0
2 6 1.0
3 3 1.0
4 3 1.0
5 3 1.0
6 3 1.0
3 4 1.0
4 4 1.0
5 4 1.0
6 4 1.0
3 5 1.0
4 5 1.0
5 5 1.0
6 5 1.0
3 6 1.0
4 6 1.0
5 6 1.0
6 6 1.0"""
y=x.split('\n')
y = set(y)
print(len(y))
| 8.222222
| 15
| 0.493243
| 207
| 444
| 1.057971
| 0.067633
| 0.456621
| 0.109589
| 0.091324
| 0.031963
| 0
| 0
| 0
| 0
| 0
| 0
| 0.678201
| 0.349099
| 444
| 53
| 16
| 8.377358
| 0.079585
| 0
| 0
| 0
| 0
| 0
| 0.885135
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.019231
| 0
| 0
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
3853bbb0f1a69d9b57a2c3ed2995fed8aecddf65
| 1,467
|
py
|
Python
|
pidal/dservice/table/table.py
|
pi-plan/pidal
|
bfd1b9c4de87bc92565acbcff108270265757e39
|
[
"BSD-3-Clause"
] | 6
|
2021-02-05T04:21:00.000Z
|
2021-11-29T06:46:21.000Z
|
pidal/dservice/table/table.py
|
pi-plan/pidal
|
bfd1b9c4de87bc92565acbcff108270265757e39
|
[
"BSD-3-Clause"
] | 1
|
2021-11-30T06:08:53.000Z
|
2021-11-30T06:08:53.000Z
|
pidal/dservice/table/table.py
|
pi-plan/pidal
|
bfd1b9c4de87bc92565acbcff108270265757e39
|
[
"BSD-3-Clause"
] | null | null | null |
import abc
from typing import List, Dict, Any
from pidal.node.result import result
from pidal.dservice.sqlparse.paser import DML
from pidal.constant.db import DBTableType
from pidal.constant.common import RuleStatus
from pidal.meta.model import DBTable, DBTableStrategyBackend
from pidal.dservice.zone_manager import ZoneManager
class Table(metaclass=abc.ABCMeta):
# TODO 启动后,分析表的主键和唯一性约束.
@classmethod
@abc.abstractclassmethod
def new(cls, zone_manager: ZoneManager, table_conf: DBTable) -> 'Table':
pass
@abc.abstractmethod
async def execute_dml(self, sql: DML, trans_id: int = 0) -> result.Result:
""" 如果是在事务中需要传入 trans_id """
pass
@abc.abstractmethod
def get_node(self, sql: DML) -> List[DBTableStrategyBackend]:
pass
@abc.abstractmethod
def get_name(self) -> str:
pass
@abc.abstractmethod
def get_type(self) -> DBTableType:
pass
@abc.abstractmethod
def get_status(self) -> RuleStatus:
pass
@abc.abstractmethod
def get_real_table(self, row: Dict[str, Any]) -> List[str]:
pass
@abc.abstractmethod
def get_lock_columns(self) -> List[str]:
pass
@abc.abstractmethod
def is_allow_write_zone(self, row: Dict[str, Any]) -> bool:
pass
@abc.abstractmethod
def is_allow_write_sql(self, sql: DML) -> bool:
pass
@abc.abstractmethod
def get_pidal_c_v(self) -> int:
pass
| 24.45
| 78
| 0.675528
| 183
| 1,467
| 5.289617
| 0.355191
| 0.072314
| 0.216942
| 0.223141
| 0.330579
| 0.147727
| 0.07438
| 0
| 0
| 0
| 0
| 0.000884
| 0.229039
| 1,467
| 59
| 79
| 24.864407
| 0.854996
| 0.014997
| 0
| 0.488372
| 0
| 0
| 0.003534
| 0
| 0
| 0
| 0
| 0.016949
| 0
| 1
| 0.232558
| false
| 0.255814
| 0.186047
| 0
| 0.44186
| 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
| 1
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
387c63e244f35ceb1aee72f108dbd23d48ee1e17
| 333
|
py
|
Python
|
Section11/task6.py
|
rstojan/Learning_Python
|
77ce25787021a0c8b2d8e31c1cfd6e939316f4a6
|
[
"MIT"
] | null | null | null |
Section11/task6.py
|
rstojan/Learning_Python
|
77ce25787021a0c8b2d8e31c1cfd6e939316f4a6
|
[
"MIT"
] | null | null | null |
Section11/task6.py
|
rstojan/Learning_Python
|
77ce25787021a0c8b2d8e31c1cfd6e939316f4a6
|
[
"MIT"
] | null | null | null |
# Complete the function to return the number of leap years in the list
import calendar
def countLeapYears(yearList):
# Student code goes here
# expected output: 2
print(countLeapYears([2001, 2018, 2020, 2090, 2233, 2176, 2200, 2982]))
# expected output: 4
print(countLeapYears([2001, 2018, 2020, 2092, 2204, 2176, 2200, 2982]))
| 27.75
| 71
| 0.738739
| 48
| 333
| 5.125
| 0.729167
| 0.113821
| 0.186992
| 0.219512
| 0.252033
| 0
| 0
| 0
| 0
| 0
| 0
| 0.234875
| 0.156156
| 333
| 12
| 72
| 27.75
| 0.640569
| 0.387387
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.25
| null | null | 0.5
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
2a59a67380e21b2b6283ff4a9320c16b46766734
| 215
|
py
|
Python
|
PublisherJiraTestsResults/jiraTestPlansClient.py
|
ismailktami/robotframework-publisher-results-jira
|
26167b6c1881fe0ea8ea492f4b58f63061247a48
|
[
"MIT"
] | null | null | null |
PublisherJiraTestsResults/jiraTestPlansClient.py
|
ismailktami/robotframework-publisher-results-jira
|
26167b6c1881fe0ea8ea492f4b58f63061247a48
|
[
"MIT"
] | null | null | null |
PublisherJiraTestsResults/jiraTestPlansClient.py
|
ismailktami/robotframework-publisher-results-jira
|
26167b6c1881fe0ea8ea492f4b58f63061247a48
|
[
"MIT"
] | null | null | null |
import requests
import json
import base64
from .publisherReport import PublisherReport
from .variables import *
from .logger import logger
from requests.auth import HTTPBasicAuth
class JiraTestPlansClient:
pass
| 21.5
| 44
| 0.837209
| 25
| 215
| 7.2
| 0.52
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010753
| 0.134884
| 215
| 10
| 45
| 21.5
| 0.956989
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.111111
| 0.777778
| 0
| 0.888889
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
|
0
| 5
|
2a8810ddba96d2b7875b80861e9560dfad115f04
| 65
|
py
|
Python
|
python_work/hello_world.py
|
Elektra-2/python_crash_course_2nd
|
1c8beaddfe037faa3a36e7c384a6ea2f9d560060
|
[
"MIT"
] | 1
|
2020-08-25T18:42:30.000Z
|
2020-08-25T18:42:30.000Z
|
python_work/hello_world.py
|
Elektra-2/python_crash_course_2nd
|
1c8beaddfe037faa3a36e7c384a6ea2f9d560060
|
[
"MIT"
] | null | null | null |
python_work/hello_world.py
|
Elektra-2/python_crash_course_2nd
|
1c8beaddfe037faa3a36e7c384a6ea2f9d560060
|
[
"MIT"
] | null | null | null |
# The First and always, Hello, World
print("Hello Python World")
| 21.666667
| 36
| 0.738462
| 10
| 65
| 4.8
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.153846
| 65
| 2
| 37
| 32.5
| 0.872727
| 0.523077
| 0
| 0
| 0
| 0
| 0.62069
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
2a910a5b5b388e1fad054a344c84faee06f855e8
| 167
|
py
|
Python
|
mkt/carriers/context_processors.py
|
clouserw/zamboni
|
c4a568b69c1613f27da41d46328b2975cbdc1c07
|
[
"BSD-3-Clause"
] | 1
|
2021-07-29T00:51:09.000Z
|
2021-07-29T00:51:09.000Z
|
mkt/carriers/context_processors.py
|
clouserw/zamboni
|
c4a568b69c1613f27da41d46328b2975cbdc1c07
|
[
"BSD-3-Clause"
] | 6
|
2021-02-02T23:08:48.000Z
|
2021-09-08T02:47:17.000Z
|
mkt/carriers/context_processors.py
|
clouserw/zamboni
|
c4a568b69c1613f27da41d46328b2975cbdc1c07
|
[
"BSD-3-Clause"
] | 1
|
2021-03-13T00:33:12.000Z
|
2021-03-13T00:33:12.000Z
|
from . import get_carrier
def carrier_data(request):
"""
Context processor that provides CARRIER to all views.
"""
return {'CARRIER': get_carrier()}
| 18.555556
| 57
| 0.670659
| 20
| 167
| 5.45
| 0.75
| 0.183486
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.221557
| 167
| 8
| 58
| 20.875
| 0.838462
| 0.317365
| 0
| 0
| 0
| 0
| 0.071429
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| 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
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
aa4d34fce1edafbc7e71bc98eb56dec8918af414
| 214
|
py
|
Python
|
test_himawari.py
|
pecchi/6S_emulator
|
70cf96e095b932f40bbf0a2ec196d0d0950306c1
|
[
"Apache-2.0"
] | null | null | null |
test_himawari.py
|
pecchi/6S_emulator
|
70cf96e095b932f40bbf0a2ec196d0d0950306c1
|
[
"Apache-2.0"
] | null | null | null |
test_himawari.py
|
pecchi/6S_emulator
|
70cf96e095b932f40bbf0a2ec196d0d0950306c1
|
[
"Apache-2.0"
] | null | null | null |
from Py6S import *
s = SixS("/home/snakano/work/himawari/sixs/6SV1.1/bin/sixsV1.1")
print(Wavelength(PredefinedWavelengths.__dict__["H8_AHI_05"]))
# spectrum = Wavelength(PredefinedWavelengths.__dict__[channel])
| 30.571429
| 64
| 0.785047
| 27
| 214
| 5.851852
| 0.814815
| 0.392405
| 0.443038
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.045
| 0.065421
| 214
| 6
| 65
| 35.666667
| 0.745
| 0.28972
| 0
| 0
| 0
| 0
| 0.406667
| 0.346667
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
aa7ad795833006ab71e75fc8cc9564d6c05fba6a
| 169
|
py
|
Python
|
tests/test_mediator.py
|
wilsonify/design_patterns_python
|
20f493cb8b86d16d2594becbacbcdf682036b6b4
|
[
"MIT"
] | null | null | null |
tests/test_mediator.py
|
wilsonify/design_patterns_python
|
20f493cb8b86d16d2594becbacbcdf682036b6b4
|
[
"MIT"
] | null | null | null |
tests/test_mediator.py
|
wilsonify/design_patterns_python
|
20f493cb8b86d16d2594becbacbcdf682036b6b4
|
[
"MIT"
] | null | null | null |
"""
test mediator pattern
"""
from dpatterns_python.gang_of_four import mediator
def test_main():
"""
call the main
:return:
"""
mediator.main()
| 11.266667
| 50
| 0.627219
| 20
| 169
| 5.1
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.248521
| 169
| 14
| 51
| 12.071429
| 0.80315
| 0.260355
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| true
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
aa8b1dd61cf2dab8cda404718fbabf6d1d6b06ef
| 128
|
py
|
Python
|
api/core/admin.py
|
rabeloalcantaraigor/projeto04-cliente-empresa-funcionario
|
40cec527a2983f72b8b480585d7a0e6bc994c6bc
|
[
"MIT"
] | null | null | null |
api/core/admin.py
|
rabeloalcantaraigor/projeto04-cliente-empresa-funcionario
|
40cec527a2983f72b8b480585d7a0e6bc994c6bc
|
[
"MIT"
] | null | null | null |
api/core/admin.py
|
rabeloalcantaraigor/projeto04-cliente-empresa-funcionario
|
40cec527a2983f72b8b480585d7a0e6bc994c6bc
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Cliente,Empresa
admin.site.register(Cliente)
admin.site.register(Empresa)
| 21.333333
| 35
| 0.828125
| 18
| 128
| 5.888889
| 0.555556
| 0.169811
| 0.320755
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.085938
| 128
| 5
| 36
| 25.6
| 0.905983
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.