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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
974191ebc9b1b546e88978d7ee052537a84a3c0e | 619 | py | Python | good-engineering-practice/src/convention-indent-good.py | giserh/book-python | ebd4e70cea1dd56986aa8efbae3629ba3f1ba087 | [
"MIT"
] | 1 | 2019-01-02T15:04:08.000Z | 2019-01-02T15:04:08.000Z | good-engineering-practice/src/convention-indent-good.py | giserh/book-python | ebd4e70cea1dd56986aa8efbae3629ba3f1ba087 | [
"MIT"
] | null | null | null | good-engineering-practice/src/convention-indent-good.py | giserh/book-python | ebd4e70cea1dd56986aa8efbae3629ba3f1ba087 | [
"MIT"
] | null | null | null | # More indentation included to distinguish this from the rest.
def server(
host='localhost', port=443, secure=True,
username='admin', password='admin'):
return locals()
# Aligned with opening delimiter.
connection = server(host='localhost', port=443, secure=True,
username='admin', password='admin')
# Hanging indents should add a level.
connection = server(
host='localhost', port=443, secure=True,
username='admin', password='admin')
# The best
connection = server(
host='localhost',
username='admin',
password='admin',
port=443,
secure=True,
)
| 24.76 | 62 | 0.657512 | 71 | 619 | 5.732394 | 0.478873 | 0.09828 | 0.186732 | 0.167076 | 0.506143 | 0.506143 | 0.506143 | 0.506143 | 0.506143 | 0.506143 | 0 | 0.02454 | 0.210016 | 619 | 24 | 63 | 25.791667 | 0.807771 | 0.221325 | 0 | 0.375 | 0 | 0 | 0.159329 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | false | 0.25 | 0 | 0.0625 | 0.125 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
9764da8a0bf367f5552e2978024584c16989f62f | 482 | py | Python | draft/vgg_test.py | DTA-UIT/Leukocyle-classification | 2f3ddbc9a206674c3cb1e3279fb7c2821a888016 | [
"MIT"
] | 1 | 2021-12-17T00:55:39.000Z | 2021-12-17T00:55:39.000Z | draft/vgg_test.py | BTrDung/Using-CNNs-for-predicting-disease-via-leukocyle-classification | ff084c2a0f557c9b49fd3157f6048c54c9824806 | [
"MIT"
] | null | null | null | draft/vgg_test.py | BTrDung/Using-CNNs-for-predicting-disease-via-leukocyle-classification | ff084c2a0f557c9b49fd3157f6048c54c9824806 | [
"MIT"
] | null | null | null | # from init_data_train import val_ds
from tensorflow.keras.models import load_model
# ---------------------------------------------
model = load_model("../vgg.h5")
# print(model.metrics_names)
model.summary()
# print('Data: TRAIN')
# print(model.evaluate(data_train, verbose=2))
# print('Data: TEST')
# print(print(model.evaluate(data_test, verbose=2)))
# print('Data: TEST_SIMPLE')
# print(model.evaluate(data_test, verbose=2))
# ---------------------------------------------
| 25.368421 | 52 | 0.591286 | 57 | 482 | 4.824561 | 0.403509 | 0.145455 | 0.196364 | 0.24 | 0.370909 | 0.247273 | 0.247273 | 0 | 0 | 0 | 0 | 0.009091 | 0.087137 | 482 | 18 | 53 | 26.777778 | 0.615909 | 0.748963 | 0 | 0 | 0 | 0 | 0.081818 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
977974015b57845a20cce8837904d05dd250d920 | 291 | py | Python | WebApp/views.py | aarjavjain1/Team-Website | e74e10a95d1ffad89eaebb8cc530f3df1280e691 | [
"Apache-2.0"
] | null | null | null | WebApp/views.py | aarjavjain1/Team-Website | e74e10a95d1ffad89eaebb8cc530f3df1280e691 | [
"Apache-2.0"
] | null | null | null | WebApp/views.py | aarjavjain1/Team-Website | e74e10a95d1ffad89eaebb8cc530f3df1280e691 | [
"Apache-2.0"
] | null | null | null | from django.shortcuts import render
from .models import Timeline
# Create your views here.
def index(request):
return render(request, 'index.html')
def timeline(request):
timeline = Timeline.objects.order_by('-date')
return render(request, 'team.html', {'timeline': timeline})
| 26.454545 | 63 | 0.731959 | 37 | 291 | 5.72973 | 0.567568 | 0.113208 | 0.179245 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.14433 | 291 | 10 | 64 | 29.1 | 0.851406 | 0.079038 | 0 | 0 | 0 | 0 | 0.120301 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.285714 | 0.142857 | 0.857143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
978d1f6e9142b2273432f178ab68877d08811c0d | 2,892 | py | Python | ryu/lib/ofctl_utils.py | alanquillin/ryu | 5552348c7c0a425313e2d5085d40d9729c8cc95e | [
"Apache-2.0"
] | 9 | 2019-12-12T06:57:51.000Z | 2022-01-10T04:01:49.000Z | ryu/lib/ofctl_utils.py | alanquillin/ryu | 5552348c7c0a425313e2d5085d40d9729c8cc95e | [
"Apache-2.0"
] | null | null | null | ryu/lib/ofctl_utils.py | alanquillin/ryu | 5552348c7c0a425313e2d5085d40d9729c8cc95e | [
"Apache-2.0"
] | 1 | 2020-03-26T17:58:28.000Z | 2020-03-26T17:58:28.000Z | # Copyright (C) 2016 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
LOG = logging.getLogger(__name__)
def str_to_int(str_num):
return int(str(str_num), 0)
class OFCtlUtil(object):
def __init__(self, ofproto):
self.ofproto = ofproto
def _reserved_num_from_user(self, num, prefix):
if isinstance(num, int):
return num
else:
if num.startswith(prefix):
return getattr(self.ofproto, num)
else:
return getattr(self.ofproto, prefix + num.upper())
def _reserved_num_to_user(self, num, prefix):
for k, v in self.ofproto.__dict__.items():
if k.startswith(prefix) and v == num:
return k.replace(prefix, '')
return num
def ofp_port_from_user(self, port):
return self._reserved_num_from_user(port, 'OFPP_')
def ofp_port_to_user(self, port):
return self._reserved_num_to_user(port, 'OFPP_')
def ofp_table_from_user(self, table):
return self._reserved_num_from_user(table, 'OFPTT_')
def ofp_table_to_user(self, table):
return self._reserved_num_to_user(table, 'OFPTT_')
def ofp_cml_from_user(self, max_len):
return self._reserved_num_from_user(max_len, 'OFPCML_')
def ofp_cml_to_user(self, max_len):
return self._reserved_num_to_user(max_len, 'OFPCML_')
def ofp_group_from_user(self, group):
return self._reserved_num_from_user(group, 'OFPG_')
def ofp_group_to_user(self, group):
return self._reserved_num_to_user(group, 'OFPG_')
def ofp_buffer_from_user(self, buffer):
if buffer in ['OFP_NO_BUFFER', 'NO_BUFFER']:
return self.ofproto.OFP_NO_BUFFER
else:
return buffer
def ofp_buffer_to_user(self, buffer):
if self.ofproto.OFP_NO_BUFFER == buffer:
return 'NO_BUFFER'
else:
return buffer
def ofp_meter_from_user(self, meter):
return self._reserved_num_from_user(meter, 'OFPM_')
def ofp_meter_to_user(self, meter):
return self._reserved_num_to_user(meter, 'OFPM_')
def ofp_queue_from_user(self, queue):
return self._reserved_num_from_user(queue, 'OFPQ_')
def ofp_queue_to_user(self, queue):
return self._reserved_num_to_user(queue, 'OFPQ_')
| 31.096774 | 69 | 0.679115 | 411 | 2,892 | 4.442822 | 0.277372 | 0.070099 | 0.118291 | 0.138007 | 0.407448 | 0.322015 | 0.256298 | 0.038335 | 0 | 0 | 0 | 0.004047 | 0.230982 | 2,892 | 92 | 70 | 31.434783 | 0.816996 | 0.200553 | 0 | 0.148148 | 0 | 0 | 0.042229 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.018519 | 0.240741 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
97b07b705070db3c9f5cefa5d87ba30a618089b6 | 66 | py | Python | lvs/video_streamer/__init__.py | ksharshveer/lvs | 00fdc0292774c0d96d560cf6dafdc22257795bab | [
"MIT"
] | null | null | null | lvs/video_streamer/__init__.py | ksharshveer/lvs | 00fdc0292774c0d96d560cf6dafdc22257795bab | [
"MIT"
] | null | null | null | lvs/video_streamer/__init__.py | ksharshveer/lvs | 00fdc0292774c0d96d560cf6dafdc22257795bab | [
"MIT"
] | null | null | null | __all__ = ['dataclass_objects', 'socket_utils', 'video_streamer']
| 33 | 65 | 0.757576 | 7 | 66 | 6.142857 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.075758 | 66 | 1 | 66 | 66 | 0.704918 | 0 | 0 | 0 | 0 | 0 | 0.651515 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
97b58b97d74790dd0268c01514019b5515bfd937 | 785 | py | Python | python/decord/bridge/tf.py | wentaozhu/decord | 2e49a9afb312be60aab1785d3002e4080c43da0b | [
"Apache-2.0"
] | null | null | null | python/decord/bridge/tf.py | wentaozhu/decord | 2e49a9afb312be60aab1785d3002e4080c43da0b | [
"Apache-2.0"
] | 1 | 2021-02-24T03:44:57.000Z | 2021-02-24T03:44:57.000Z | python/decord/bridge/tf.py | wentaozhu/decord | 2e49a9afb312be60aab1785d3002e4080c43da0b | [
"Apache-2.0"
] | null | null | null | """DECORD tensorflow bridge"""
from __future__ import absolute_import
from .._ffi._ctypes.ndarray import _from_dlpack
def try_import_tfdl():
"""Try to import tensorflow dlpack at runtime.
Returns
-------
tensorflow dlpack module if found. Raise ImportError otherwise
"""
try:
return __import__('tensorflow.experimental.dlpack', fromlist=[''])
except ImportError as e:
raise ImportError("tensorflow >= 2.2.0 is required.")
def to_tensorflow(decord_arr):
"""from decord to tensorflow, no copy"""
tfdl = try_import_tfdl()
return tfdl.from_dlpack(decord_arr.to_dlpack())
def from_tensorflow(tf_tensor):
"""from tensorflow to decord, no copy"""
tfdl = try_import_tfdl()
return _from_dlpack(tfdl.to_dlpack(tf_tensor))
| 29.074074 | 74 | 0.704459 | 100 | 785 | 5.23 | 0.39 | 0.057361 | 0.07457 | 0.049713 | 0.110899 | 0.110899 | 0.110899 | 0 | 0 | 0 | 0 | 0.00468 | 0.183439 | 785 | 26 | 75 | 30.192308 | 0.811232 | 0.277707 | 0 | 0.153846 | 0 | 0 | 0.117202 | 0.056711 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.615385 | 0 | 1.076923 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
97b6767accd28b5524cbe3ac0b63eedc2f8d9404 | 197 | py | Python | ExerciciosPYTHON/PythonCeV/005.py | Samuel-Melo890/Python-Desafios | 2abc7734d6a6c1f5ab67421f792d6889d93bac94 | [
"MIT"
] | null | null | null | ExerciciosPYTHON/PythonCeV/005.py | Samuel-Melo890/Python-Desafios | 2abc7734d6a6c1f5ab67421f792d6889d93bac94 | [
"MIT"
] | 2 | 2022-03-18T16:06:07.000Z | 2022-03-18T16:55:29.000Z | ExerciciosPYTHON/PythonCeV/005.py | Samuel-Melo890/Python-Desafios | 2abc7734d6a6c1f5ab67421f792d6889d93bac94 | [
"MIT"
] | null | null | null | print('='*8,'Antecessor e Sucessor','='*8)
n = int(input('Digite um numero inteiro qualquer:'))
print('Analisando o valor {}, vemos que seu antecessor e {} e seu sucessor e {}.'.format(n,n-1,n+1))
| 49.25 | 100 | 0.664975 | 33 | 197 | 3.969697 | 0.636364 | 0.167939 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023256 | 0.126904 | 197 | 3 | 101 | 65.666667 | 0.738372 | 0 | 0 | 0 | 0 | 0 | 0.659898 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.666667 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
97c028a875ca38c320287a2ccd808110efe30ffd | 236 | py | Python | greatest_of_3.py | evanascence27/py_prog | d6eb7cc3d399ba3ff5c1214e5aed6f9acc75596c | [
"MIT"
] | null | null | null | greatest_of_3.py | evanascence27/py_prog | d6eb7cc3d399ba3ff5c1214e5aed6f9acc75596c | [
"MIT"
] | null | null | null | greatest_of_3.py | evanascence27/py_prog | d6eb7cc3d399ba3ff5c1214e5aed6f9acc75596c | [
"MIT"
] | null | null | null | #greatest among 3
a=int(input("Enter no:"))
b=int(input("Enter no:"))
c=int(input("Enter no:"))
if a>b:
if a>c:
print(a)
else:
print(c)
else:
if b>c:
print(b)
else:
print(c)
| 15.733333 | 26 | 0.466102 | 38 | 236 | 2.894737 | 0.342105 | 0.218182 | 0.354545 | 0.409091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006579 | 0.355932 | 236 | 14 | 27 | 16.857143 | 0.717105 | 0.067797 | 0 | 0.384615 | 0 | 0 | 0.131707 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.307692 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
97c16fec2fb87150bd173db2e2b97185e95c1291 | 463 | py | Python | create_venv.py | kevinmcaleer/SMARSLab | b847a78a61dc04fcb43d1660a6ea55ec9e84bee0 | [
"Apache-2.0"
] | 10 | 2019-02-03T23:46:08.000Z | 2021-12-26T17:31:21.000Z | create_venv.py | kevinmcaleer/SMARSLab | b847a78a61dc04fcb43d1660a6ea55ec9e84bee0 | [
"Apache-2.0"
] | 27 | 2019-06-09T09:09:24.000Z | 2022-02-11T21:47:33.000Z | create_venv.py | kevinmcaleer/SMARSLab | b847a78a61dc04fcb43d1660a6ea55ec9e84bee0 | [
"Apache-2.0"
] | 5 | 2020-06-24T18:49:40.000Z | 2022-03-08T10:11:48.000Z | """
# create_venv.py
Creates a new virtual environment for SMARSLab
"""
import subprocess
print("Creating Python 3 Virtual Environment")
subprocess.call("python3","-m","venv", "venv")
# subprocess.call(["virtualenv", "-p", "python3", "venv"])
print("")
print("Environment created - To use the virtual environment, type:")
print(" source venv/bin/activate")
print("to activate the environment, and")
print(" deactivate")
print("to deactivate the environment.")
| 28.9375 | 68 | 0.723542 | 58 | 463 | 5.758621 | 0.534483 | 0.161677 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007299 | 0.112311 | 463 | 15 | 69 | 30.866667 | 0.805353 | 0.261339 | 0 | 0 | 0 | 0 | 0.637725 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.111111 | 0 | 0.111111 | 0.777778 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
97c1ff7d1bddd3985417dc87b4811ea681f0a589 | 661 | py | Python | gaphas/painter/__init__.py | gaphor/gaphas | 084a55d31483e895ff26ee4d1f7861a690f25303 | [
"Apache-2.0"
] | 108 | 2018-01-09T00:19:04.000Z | 2022-03-25T05:24:12.000Z | gaphas/painter/__init__.py | AhmedMounir/gaphas | a51f0171796199332da8187411ae2d70dc883e2e | [
"Apache-2.0"
] | 134 | 2018-01-10T03:01:27.000Z | 2022-03-19T19:40:03.000Z | gaphas/painter/__init__.py | AhmedMounir/gaphas | a51f0171796199332da8187411ae2d70dc883e2e | [
"Apache-2.0"
] | 17 | 2018-01-09T02:20:05.000Z | 2021-12-17T18:03:09.000Z | from __future__ import annotations
from typing import TYPE_CHECKING
from gaphas.painter.boundingboxpainter import BoundingBoxPainter
from gaphas.painter.chain import PainterChain
from gaphas.painter.freehand import FreeHandPainter
from gaphas.painter.handlepainter import HandlePainter
from gaphas.painter.itempainter import ItemPainter
from gaphas.painter.painter import Painter
if TYPE_CHECKING:
from gaphas.view import GtkView
def DefaultPainter(view: GtkView) -> Painter:
"""Default painter, containing item, handle and tool painters."""
return (
PainterChain().append(ItemPainter(view.selection)).append(HandlePainter(view))
)
| 31.47619 | 86 | 0.806354 | 75 | 661 | 7.026667 | 0.413333 | 0.132827 | 0.193548 | 0.083491 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12708 | 661 | 20 | 87 | 33.05 | 0.913345 | 0.089259 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0.642857 | 0 | 0.785714 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
97c2cf54e26727ae7eefffa7b1b86ef83489a129 | 226 | py | Python | tk_builder/widgets/widget_wrappers/scale.py | bradh/tk_builder | 15bde02b93a67acf46ad485e7cc345cfe3bcd540 | [
"MIT"
] | null | null | null | tk_builder/widgets/widget_wrappers/scale.py | bradh/tk_builder | 15bde02b93a67acf46ad485e7cc345cfe3bcd540 | [
"MIT"
] | null | null | null | tk_builder/widgets/widget_wrappers/scale.py | bradh/tk_builder | 15bde02b93a67acf46ad485e7cc345cfe3bcd540 | [
"MIT"
] | null | null | null | from tkinter import ttk
from tk_builder.widgets.widget_utils.widget_events import WidgetEvents
class Scale(ttk.Scale, WidgetEvents):
def __init__(self, master=None, **kw):
ttk.Scale.__init__(self, master, **kw)
| 25.111111 | 70 | 0.747788 | 31 | 226 | 5.096774 | 0.612903 | 0.101266 | 0.177215 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146018 | 226 | 8 | 71 | 28.25 | 0.818653 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
c111ed3f7f6639b994f8befedd71bef05fb4f62e | 266 | py | Python | src/core/device.py | ggjersund/ble-central-client | f886ae90a62245baf0ba8235a78bf8b3aeabc0aa | [
"MIT"
] | 1 | 2019-05-06T02:01:35.000Z | 2019-05-06T02:01:35.000Z | src/core/device.py | ggjersund/ble-central-client | f886ae90a62245baf0ba8235a78bf8b3aeabc0aa | [
"MIT"
] | null | null | null | src/core/device.py | ggjersund/ble-central-client | f886ae90a62245baf0ba8235a78bf8b3aeabc0aa | [
"MIT"
] | null | null | null | """
Class: Create peripheral objects whenever a new device is found
Methods: Send connection request to given device, disconnect from given device, handle discovery of advertisments
List all available characteristics (services that contain more characteristics)
"""
| 44.333333 | 113 | 0.819549 | 34 | 266 | 6.411765 | 0.882353 | 0.100917 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135338 | 266 | 5 | 114 | 53.2 | 0.947826 | 0.966165 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 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 | 3 |
c17d297d3e3b1768409a383f1791dd0e2160d9ed | 97 | py | Python | pythonProject/MUNDO 3/Relembrando listas 2.py | lucasjlgc/Aulas-de-Python- | 6aaed1c660487a680e9c449210600ccdfa326612 | [
"MIT"
] | null | null | null | pythonProject/MUNDO 3/Relembrando listas 2.py | lucasjlgc/Aulas-de-Python- | 6aaed1c660487a680e9c449210600ccdfa326612 | [
"MIT"
] | 1 | 2021-06-25T15:29:11.000Z | 2021-06-25T15:29:11.000Z | pythonProject/MUNDO 3/Relembrando listas 2.py | lucasjlgc/Aulas-de-Python- | 6aaed1c660487a680e9c449210600ccdfa326612 | [
"MIT"
] | null | null | null | import pandas as pd
df = pd.read_excel("Média teste.xlsx", sheet_name= "Média")
print(df.head()) | 24.25 | 59 | 0.721649 | 17 | 97 | 4 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113402 | 97 | 4 | 60 | 24.25 | 0.790698 | 0 | 0 | 0 | 0 | 0 | 0.214286 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
c17f1ebac81849c8f6eb6bebb52e23e823c6d545 | 2,428 | py | Python | gc3_query/lib/open_api/swagger_formats/models/sec_ip_list_model.py | ericmharris/gc3-query | 0bf5226130aafbb1974aeb96d93ee1996833e87d | [
"MIT"
] | null | null | null | gc3_query/lib/open_api/swagger_formats/models/sec_ip_list_model.py | ericmharris/gc3-query | 0bf5226130aafbb1974aeb96d93ee1996833e87d | [
"MIT"
] | null | null | null | gc3_query/lib/open_api/swagger_formats/models/sec_ip_list_model.py | ericmharris/gc3-query | 0bf5226130aafbb1974aeb96d93ee1996833e87d | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
gc3-query.sec_ip_list_model [9/12/2018 12:25 PM]
~~~~~~~~~~~~~~~~
<DESCR SHORT>
<DESCR>
"""
################################################################################
## Standard Library Imports
import sys, os
################################################################################
## Third-Party Imports
from dataclasses import dataclass
################################################################################
## Project Imports
from gc3_query.lib import *
from . import *
_debug, _info, _warning, _error, _critical = get_logging(name=__name__)
class SecListFormatModelBase(EmbeddedDocument):
"""
"""
full_name = StringField()
object_name = StringField()
object_type = StringField()
meta = {'allow_inheritance': True}
def __init__(self, *args, **values):
super().__init__(*args, **values)
_debug(f"{self.__class__.__name__}.__init__(args={args}, values={values}):")
def __str__(self):
return self['full_name']
def __repr__(self):
return self.__str__()
def __eq__(self, other):
return self['full_name'] == other['full_name']
def __hash__(self):
return hash(self['full_name'])
class SecIPListFormatModel(SecListFormatModelBase):
"""
"""
# full_name = StringField()
# object_name = StringField()
# object_type = StringField()
#
# meta = {'allow_inheritance': True}
#
# def __init__(self, *args, **values):
# super().__init__(*args, **values)
# _debug(f"{self.__class__.__name__}.__init__(args={args}, values={values}):")
#
#
# def __str__(self):
# return self['full_name']
#
# def __repr__(self):
# return self.__str__()
#
# def __eq__(self, other):
# return self['full_name'] == other['full_name']
#
# def __hash__(self):
# return hash(self['full_name'])
@classmethod
def from_result(cls, result, key: str) -> 'SecIPListFormatModel':
"""Return a SecIPListFormatModel using the values in result['key']
:param result:
:param key:
:return:
"""
_value = result[key]
model = SecIPListFormatModel(full_name=_value.full_name,
object_name=_value.object_name,
object_type=_value.object_type)
return model
| 25.829787 | 86 | 0.534596 | 228 | 2,428 | 5.153509 | 0.315789 | 0.081702 | 0.061277 | 0.061277 | 0.507234 | 0.507234 | 0.507234 | 0.507234 | 0.507234 | 0.507234 | 0 | 0.007547 | 0.235997 | 2,428 | 93 | 87 | 26.107527 | 0.625876 | 0.319193 | 0 | 0 | 0 | 0 | 0.104784 | 0.035687 | 0 | 0 | 0 | 0 | 0 | 1 | 0.206897 | false | 0 | 0.137931 | 0.137931 | 0.724138 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
c1861ac618002e67645320e8393dbf42725df435 | 5,748 | py | Python | mayaSDK/maya/app/stereo/cameraSetTool.py | FXTD-ODYSSEY/vscode-mayapy | 7a21872f80b5b740fc653e79c3f9b5268e87b3c3 | [
"MIT"
] | 20 | 2019-09-20T00:30:22.000Z | 2021-12-26T06:56:16.000Z | mayaSDK/maya/app/stereo/cameraSetTool.py | minjiang999/vscode-mayapy | 7a21872f80b5b740fc653e79c3f9b5268e87b3c3 | [
"MIT"
] | 5 | 2019-12-29T15:19:03.000Z | 2022-03-29T16:54:19.000Z | mayaSDK/maya/app/stereo/cameraSetTool.py | minjiang999/vscode-mayapy | 7a21872f80b5b740fc653e79c3f9b5268e87b3c3 | [
"MIT"
] | 8 | 2019-09-23T05:46:44.000Z | 2022-01-11T14:42:14.000Z | """
This is a dedicated editor for specifying camera set rigs. It allows
the artist to preset a multi-rig type. They can then use the
create menus for quickly creating complicated rigs.
"""
class BaseUI:
"""
Each region of the editor UI is abstracted into a UI class that
contains all of the widgets for that objects and relavant callbacks.
This base class should not be instanced as this is only a container
for common code.
"""
def __init__(self, parent):
"""
Class initialization. We simply hold onto the parent layout.
"""
pass
def control(self):
"""
Return the master control for this UI.
"""
pass
def parent(self):
"""
Return the parent instace of this UI. This can be None.
"""
pass
def setControl(self, control):
"""
Set the pointer to the control handle for this UI. This is
the main control that parents or children can reference
for UI updates.
"""
pass
class NewCameraSetUI(BaseUI):
"""
UI for adding 'new' camera set.
"""
def __init__(self, parent):
"""
Class constructor
"""
pass
def buildLayout(self):
"""
Construct the UI for this class.
"""
pass
def name(self):
"""
Name of this UI component.
"""
pass
def newTemplate(self, *args):
"""
Create a new template and adding the template to the
UI layout for user manipulation.
"""
pass
def rebuild(self):
"""
Rebuild the UI. We find the parent class and tell it
to kickstart the rebuild.
"""
pass
def resetSettings(self, *args):
"""
Reset to the default settings and rebuild the UI.
"""
pass
def resetUI(self):
"""
Tells all ui templates to reset their ui handles. This
is done because this UI templates hold onto some
local data that must be cleared out before rebuilding
"""
pass
def saveSettings(self, *args):
"""
Call the template manager to store its current settings
"""
pass
class NamingTemplateUI(BaseUI):
"""
This class encapsulates all of the UI around multi rig naming templates.
"""
def __init__(self, parent, mgr, template):
"""
Class initializer.
"""
pass
def addLayer(self, *args):
"""
Add a new layer to this object.
"""
pass
def autoCreateCkboxChange(self, args, layer='0'):
"""
Called when the check box is changed.
"""
pass
def buildLayout(self):
"""
Build a new multi-rig template UI.
"""
pass
def cameraSetNameChanged(self, arg):
pass
def createIt(self, *args):
"""
Function called when the user clicks the 'Create' button.
This will force the creation of a new rig.
"""
pass
def deleteLayer(self, args, layer='0'):
"""
Called when the delete layer button is clicked.
"""
pass
def layerCameraChanged(self, args, layer='0'):
"""
Called when the option menu group changes.
"""
pass
def layerPrefixChanged(self, args, layer='0'):
"""
Called when the prefix changes for a layer.
"""
pass
def layoutForLayer(self, layer):
"""
Build the UI for the specified layer. We need to access the
UI data later in callbacks. So we store the data inside
a dictionary for reference layer.
"""
pass
def multiRigNameChanged(self, ui):
"""
Called when the user changes the name of this multi-rig
using the supplied text box.
"""
pass
def namingPrefixChanged(self, arg):
"""
Called when the users changes the prefix name used for the
multi-rig.
"""
pass
def removeDef(self, *args):
"""
Remove this object from the list.
"""
pass
def resetUI(self):
pass
class CameraSetEditor(BaseUI):
"""
Main class for the camera set editor.
"""
def __init__(self, parent='None'):
"""
Class constructor.
"""
pass
def buildLayout(self):
"""
Build the main layout for the class. This will kickstart all
UI creation for the class. You should have a window instance
created for the layouts to parent under.
"""
pass
def create(self):
"""
Create a new instance of the window. If there is already a instance
then show it instead of creating a new instance.
"""
pass
def name(self):
"""
Return the name for this editor.
"""
pass
def rebuild(self):
"""
Force the rebuild of the UI. This happens when
users create new templates.
"""
pass
def createIt():
"""
Create a new window instance of the Camera Set Editor.
"""
pass
gEditorWindowInstance = None
| 18.784314 | 76 | 0.508873 | 616 | 5,748 | 4.722403 | 0.313312 | 0.067377 | 0.031282 | 0.023376 | 0.087659 | 0.063252 | 0.037126 | 0 | 0 | 0 | 0 | 0.001197 | 0.418406 | 5,748 | 305 | 77 | 18.845902 | 0.86898 | 0.435456 | 0 | 0.623188 | 0 | 0 | 0.003388 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.463768 | false | 0.463768 | 0 | 0 | 0.521739 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
c1930795b278c4d3bce4aa1f7d4fedaf52b3eac9 | 277 | py | Python | torch/fx/passes/__init__.py | xiaohanhuang/pytorch | a31aea8eaa99a5ff72b5d002c206cd68d5467a5e | [
"Intel"
] | 60,067 | 2017-01-18T17:21:31.000Z | 2022-03-31T21:37:45.000Z | torch/fx/passes/__init__.py | xiaohanhuang/pytorch | a31aea8eaa99a5ff72b5d002c206cd68d5467a5e | [
"Intel"
] | 66,955 | 2017-01-18T17:21:38.000Z | 2022-03-31T23:56:11.000Z | torch/fx/passes/__init__.py | xiaohanhuang/pytorch | a31aea8eaa99a5ff72b5d002c206cd68d5467a5e | [
"Intel"
] | 19,210 | 2017-01-18T17:45:04.000Z | 2022-03-31T23:51:56.000Z | from . import graph_drawer
from . import graph_manipulation
from . import net_min_base
from . import operator_support
from . import param_fetch
from . import shape_prop
from . import split_module
from . import split_utils
from . import splitter_base
from . import tools_common
| 25.181818 | 32 | 0.819495 | 41 | 277 | 5.268293 | 0.487805 | 0.462963 | 0.138889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144404 | 277 | 10 | 33 | 27.7 | 0.911392 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
c1e36030fb557ca429daa6a8fb40a0f0208a4e4c | 591 | py | Python | hydra-configs-torchvision/hydra_configs/torchvision/models/densenet.py | shivamdb/hydra-torch | 4ef4b03e583fb7b0c36e50185d25f0d91369c1cf | [
"MIT"
] | null | null | null | hydra-configs-torchvision/hydra_configs/torchvision/models/densenet.py | shivamdb/hydra-torch | 4ef4b03e583fb7b0c36e50185d25f0d91369c1cf | [
"MIT"
] | null | null | null | hydra-configs-torchvision/hydra_configs/torchvision/models/densenet.py | shivamdb/hydra-torch | 4ef4b03e583fb7b0c36e50185d25f0d91369c1cf | [
"MIT"
] | null | null | null | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#
# Generated by configen, do not edit.
# See https://github.com/facebookresearch/hydra/tree/master/tools/configen
# fmt: off
# isort:skip_file
# flake8: noqa
from dataclasses import dataclass, field
from typing import Any
@dataclass
class DenseNetConf:
_target_: str = "torchvision.models.densenet.DenseNet"
growth_rate: Any = 32
block_config: Any = (6, 12, 24, 16)
num_init_features: Any = 64
bn_size: Any = 4
drop_rate: Any = 0
num_classes: Any = 1000
memory_efficient: Any = False
| 25.695652 | 74 | 0.715736 | 83 | 591 | 4.963855 | 0.831325 | 0.033981 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037578 | 0.189509 | 591 | 22 | 75 | 26.863636 | 0.822547 | 0.36379 | 0 | 0 | 1 | 0 | 0.097826 | 0.097826 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.166667 | 0 | 0.916667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
c1f55bde2192c6ab8318d85ced287f7259c76bad | 695 | py | Python | Config-Scripts/service.autoexec/resources/de/language-set_de.py | joy-it/MultimediaCase-for-Raspberry-Pi | 909522521b2d53175b8460d9ef5bb1a51cfaec44 | [
"MIT"
] | 9 | 2020-12-29T22:17:13.000Z | 2021-12-14T09:12:47.000Z | Config-Scripts/service.autoexec/resources/de/language-set_de.py | joy-it/MultimediaCase-for-Raspberry-Pi | 909522521b2d53175b8460d9ef5bb1a51cfaec44 | [
"MIT"
] | null | null | null | Config-Scripts/service.autoexec/resources/de/language-set_de.py | joy-it/MultimediaCase-for-Raspberry-Pi | 909522521b2d53175b8460d9ef5bb1a51cfaec44 | [
"MIT"
] | 2 | 2021-12-07T15:55:35.000Z | 2022-03-21T11:43:43.000Z | import os
from time import sleep
os.system("touch /storage/.kodi/temp/temp.txt")
with open("/storage/.kodi/addons/service.autoexec/autoexec.py","r") as log, open("/storage/.kodi/temp/temp.txt","w") as file:
for line in log:
if not "kodi-send --action=" in line:
file.write(line)
os.system("rm /storage/.kodi/addons/service.autoexec/autoexec.py && touch /storage/.kodi/addons/service.autoexec/autoexec.py")
os.system("cp /storage/.kodi/temp/temp.txt /storage/.kodi/addons/service.autoexec/autoexec.py")
os.system("rm /storage/.kodi/temp/temp.txt")
os.system("touch /storage/.kodi/addons/service.autoexec/resources/start-defence_de.txt")
os.system("systemctl stop kodi")
| 46.333333 | 126 | 0.723741 | 108 | 695 | 4.648148 | 0.351852 | 0.197211 | 0.169323 | 0.239044 | 0.691235 | 0.450199 | 0.366534 | 0.199203 | 0.199203 | 0 | 0 | 0 | 0.096403 | 695 | 14 | 127 | 49.642857 | 0.799363 | 0 | 0 | 0 | 0 | 0.166667 | 0.651799 | 0.548201 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c1ff0eb01bbf70406e1549da0474f421fa7d5448 | 162 | py | Python | app/api/sandbox/__init__.py | nccr-itmo/FEDOT.Web | 9b6f7b66de277ea34d6d5ed621b99a3f938db61b | [
"BSD-3-Clause"
] | 23 | 2020-12-24T11:05:01.000Z | 2022-03-31T20:29:12.000Z | app/api/sandbox/__init__.py | nccr-itmo/FedotWeb | 763fb1f39ad2b69104b6568e6f941c4c67762e34 | [
"BSD-3-Clause"
] | 42 | 2021-01-11T09:38:31.000Z | 2022-03-25T17:19:05.000Z | app/api/sandbox/__init__.py | nccr-itmo/FedotWeb | 763fb1f39ad2b69104b6568e6f941c4c67762e34 | [
"BSD-3-Clause"
] | 5 | 2021-03-31T04:38:31.000Z | 2022-03-31T20:29:26.000Z | BASE_ROUTE = 'sandbox'
def register_routes(api, app):
from .controller import api as sandbox_api
api.add_namespace(sandbox_api, path=f"/{BASE_ROUTE}")
| 20.25 | 57 | 0.734568 | 24 | 162 | 4.708333 | 0.666667 | 0.159292 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.154321 | 162 | 7 | 58 | 23.142857 | 0.824818 | 0 | 0 | 0 | 0 | 0 | 0.123457 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
de0db17125bb522f17a4937de38adbee2d05df16 | 69 | py | Python | 03_Day_Operators/16.py | diegofregolente/30-Days-Of-Python | e0cad31f6d5ab1384ad6fa5a5d24a84771d6c267 | [
"Apache-2.0"
] | null | null | null | 03_Day_Operators/16.py | diegofregolente/30-Days-Of-Python | e0cad31f6d5ab1384ad6fa5a5d24a84771d6c267 | [
"Apache-2.0"
] | null | null | null | 03_Day_Operators/16.py | diegofregolente/30-Days-Of-Python | e0cad31f6d5ab1384ad6fa5a5d24a84771d6c267 | [
"Apache-2.0"
] | null | null | null | length = len('python') # 16
print(float(length))
print(str(length))
| 17.25 | 28 | 0.681159 | 10 | 69 | 4.7 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032787 | 0.115942 | 69 | 3 | 29 | 23 | 0.737705 | 0.028986 | 0 | 0 | 0 | 0 | 0.092308 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.666667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
de0e2ef29766137a4639f4f40ea81c68ad5d0eea | 554 | py | Python | TorNodesMap/TorNodesMap/settings/local.py | spantons/tor-nodes-map | 0bdd6cb2e747c3a6a5aa311214fa8683d0453bd3 | [
"MIT"
] | null | null | null | TorNodesMap/TorNodesMap/settings/local.py | spantons/tor-nodes-map | 0bdd6cb2e747c3a6a5aa311214fa8683d0453bd3 | [
"MIT"
] | null | null | null | TorNodesMap/TorNodesMap/settings/local.py | spantons/tor-nodes-map | 0bdd6cb2e747c3a6a5aa311214fa8683d0453bd3 | [
"MIT"
] | null | null | null | # Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
GDAL_LIBRARY_PATH = "/Applications/Postgres.app/Contents/Versions/9.4/lib/libgdal.dylib"
GEOS_LIBRARY_PATH = "/Applications/Postgres.app/Contents/Versions/9.4/lib/libgeos_c.dylib"
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'tor_nodes_map',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
| 26.380952 | 90 | 0.644404 | 68 | 554 | 5.147059 | 0.808824 | 0.062857 | 0.131429 | 0.177143 | 0.314286 | 0.314286 | 0.314286 | 0.314286 | 0.314286 | 0.314286 | 0 | 0.013304 | 0.185921 | 554 | 20 | 91 | 27.7 | 0.762749 | 0.240072 | 0 | 0 | 0 | 0 | 0.533654 | 0.413462 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.076923 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
a9a54f9593e2155a83dbbc6f445784f726fc8357 | 120 | py | Python | hello.py | dpr5ks/cs3240-labdemo | 8c4df0e768a362b18249ad10a736cfb85c0d9fa2 | [
"MIT"
] | null | null | null | hello.py | dpr5ks/cs3240-labdemo | 8c4df0e768a362b18249ad10a736cfb85c0d9fa2 | [
"MIT"
] | null | null | null | hello.py | dpr5ks/cs3240-labdemo | 8c4df0e768a362b18249ad10a736cfb85c0d9fa2 | [
"MIT"
] | null | null | null |
#python program that prints "Hello!"
#Deeksha Reddy (dpr5ks)
import helper
helper.greeting("hello")
| 6.666667 | 36 | 0.641667 | 13 | 120 | 5.923077 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011236 | 0.258333 | 120 | 17 | 37 | 7.058824 | 0.853933 | 0.475 | 0 | 0 | 0 | 0 | 0.096154 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a9c407f198519bb2db1ad7f89e499a2d1c9bee18 | 11,460 | py | Python | cardsFactory.py | Zhipeng-Chang/CoEChatbot | a68b66612c17685715b2a04f9d603a4f4b06cc6b | [
"MIT"
] | null | null | null | cardsFactory.py | Zhipeng-Chang/CoEChatbot | a68b66612c17685715b2a04f9d603a4f4b06cc6b | [
"MIT"
] | null | null | null | cardsFactory.py | Zhipeng-Chang/CoEChatbot | a68b66612c17685715b2a04f9d603a4f4b06cc6b | [
"MIT"
] | 2 | 2019-01-08T16:07:46.000Z | 2020-12-08T21:44:08.000Z | INTERACTIVE_TEXT_BUTTON_ACTION = "doTextButtonAction"
INTERACTIVE_IMAGE_BUTTON_ACTION = "doImageButtonAction"
INTERACTIVE_BUTTON_PARAMETER_KEY = "param_key"
def _respons_text_card(type,title,text):
return {
'actionResponse': {'type': type},
"cards": [
{
'header': {'title': title, 'subtitle': 'City of Edmonton chatbot', 'imageUrl': 'http://www.gwcl.ca/wp-content/uploads/2014/01/IMG_4371.png','imageStyle': 'IMAGE'}
},
{
"sections": [
{
"widgets": [
{"textParagraph": {"text": text}}
]
}]
}
]
}
def _respons_textButton_card(type,title,text, url):
return {
'actionResponse': {'type': type},
"cards": [
{
'header': {'title': title, 'subtitle': 'City of Edmonton chatbot','imageUrl': 'http://www.gwcl.ca/wp-content/uploads/2014/01/IMG_4371.png','imageStyle': 'IMAGE'}
},
{
"sections": [
{
"widgets": [
{"buttons": [{"textButton": {"text": text,"onClick": {"openLink": {"url": url}}}}]}
]
}]
}
]
}
def _respons_text_with_bottom_link_card(type,title,text,buttonText,buttonUrl):
return {
'actionResponse': {'type': type},
"cards": [
{
'header': {'title': title, 'subtitle': 'City of Edmonton chatbot','imageUrl': 'http://www.gwcl.ca/wp-content/uploads/2014/01/IMG_4371.png','imageStyle': 'IMAGE'}
},
{
"sections": [
{
"widgets": [
{"textParagraph": {"text": text}},
{'buttons': [{'textButton': {'text': buttonText, 'onClick': {'openLink': {'url': buttonUrl}}}}]}
]
}]
}
]
}
def _text_with_bottom_link_card(title,text,buttonText,buttonUrl):
return {
"cards": [
{
'header': {'title': title, 'subtitle': 'City of Edmonton chatbot','imageUrl': 'http://www.gwcl.ca/wp-content/uploads/2014/01/IMG_4371.png','imageStyle': 'IMAGE'}
},
{
"sections": [
{
"widgets": [
{"textParagraph": {"text": text}},
{'buttons': [{'textButton': {'text': buttonText, 'onClick': {'openLink': {'url': buttonUrl}}}}]}
]
}]
}
]
}
def _text_card_with_image(headertitle, headerimage,text, widgetimage):
return {
'cards': [{'header': {'title': headertitle, 'subtitle': 'City of Edmonton chatbot','imageUrl': headerimage,'imageStyle': 'IMAGE'}},
{'sections':[{
'widgets': [
{'textParagraph': {'text': text}},
{'image': {'imageUrl': widgetimage}}
]
}
]
}
]
}
def _text_card_with_image_with_two_buttons(headertitle, headerimage,text, widgetimage, button1text, button2text, button1value, button2value):
return {
'cards': [{'header': {'title': headertitle, 'subtitle': 'City of Edmonton chatbot','imageUrl': headerimage,'imageStyle': 'IMAGE'}},
{'sections':[{
'widgets': [
{'image': {'imageUrl': widgetimage}},
{'textParagraph': {'text': text}},
{'buttons': [{'textButton': {'text': button1text,'onClick': {'action': {'actionMethodName': INTERACTIVE_TEXT_BUTTON_ACTION,'parameters': [{'key': INTERACTIVE_BUTTON_PARAMETER_KEY,'value': button1value}]}}}}]},
{'buttons': [{'textButton': {'text': button2text,'onClick': {'action': {'actionMethodName': INTERACTIVE_TEXT_BUTTON_ACTION,'parameters': [{'key': INTERACTIVE_BUTTON_PARAMETER_KEY,'value': button2value}]}}}}]}
]
}
]
}
]
}
def _text_card_with_image_with_three_buttons(headertitle, headerimage,text, widgetimage, button1text, button2text,button3text, button1value, button2value, button3value):
return {
'cards': [{'header': {'title': headertitle, 'subtitle': 'City of Edmonton chatbot','imageUrl': headerimage,'imageStyle': 'IMAGE'}},
{'sections':[{
'widgets': [
{'image': {'imageUrl': widgetimage}},
{'textParagraph': {'text': text}},
{'buttons': [{'textButton': {'text': button1text,'onClick': {'action': {'actionMethodName': INTERACTIVE_TEXT_BUTTON_ACTION,'parameters': [{'key': INTERACTIVE_BUTTON_PARAMETER_KEY,'value': button1value}]}}}}]},
{'buttons': [{'textButton': {'text': button2text,'onClick': {'action': {'actionMethodName': INTERACTIVE_TEXT_BUTTON_ACTION,'parameters': [{'key': INTERACTIVE_BUTTON_PARAMETER_KEY,'value': button2value}]}}}}]},
{'buttons': [{'textButton': {'text': button3text,'onClick': {'action': {'actionMethodName': INTERACTIVE_TEXT_BUTTON_ACTION,'parameters': [{'key': INTERACTIVE_BUTTON_PARAMETER_KEY,'value': button3value}]}}}}]}
]
}
]
}
]
}
def _text_card_with_two_buttons(headertitle, headerimage,text1,text2, button1text, button2text, button1value, button2value):
return {
'cards': [{'header': {'title': headertitle, 'subtitle': 'City of Edmonton chatbot','imageUrl': headerimage,'imageStyle': 'IMAGE'}},
{'sections':[{
'widgets': [
{'textParagraph': {'text': text1}},
{'textParagraph': {'text': text2}},
{'buttons': [{'textButton': {'text': button1text,'onClick': {'action': {'actionMethodName': INTERACTIVE_TEXT_BUTTON_ACTION,'parameters': [{'key': INTERACTIVE_BUTTON_PARAMETER_KEY,'value': button1value}]}}}}]},
{'buttons': [{'textButton': {'text': button2text,'onClick': {'action': {'actionMethodName': INTERACTIVE_TEXT_BUTTON_ACTION,'parameters': [{'key': INTERACTIVE_BUTTON_PARAMETER_KEY,'value': button2value}]}}}}]}
]
}
]
}
]
}
def _text_card(title,text):
return {
"cards": [
{
'header': {'title': title, 'subtitle': 'City of Edmonton chatbot', 'imageUrl': 'http://www.gwcl.ca/wp-content/uploads/2014/01/IMG_4371.png','imageStyle': 'IMAGE'}
},
{
"sections": [
{
"widgets": [
{"textParagraph": {"text": text}}
]
}]
}
]
}
def create_cards(cards_order):
INTERACTIVE_TEXT_BUTTON_ACTION = "doTextButtonAction"
INTERACTIVE_IMAGE_BUTTON_ACTION = "doImageButtonAction"
INTERACTIVE_BUTTON_PARAMETER_KEY = "param_key"
BOT_HEADER = 'Card Bot Python'
response = dict()
cards = list()
widgets = list()
header = None
words = cards_order.lower().split()
for word in words:
if word == 'header':
header = {
'header': {
'title': BOT_HEADER,
'subtitle': 'Card header',
'imageUrl': 'https://goo.gl/5obRKj',
'imageStyle': 'IMAGE'
}
}
elif word == 'textparagraph':
widgets.append({
'textParagraph' : {
'text': '<b>This</b> is a <i>text paragraph</i>.'
}
})
elif word == 'keyvalue':
widgets.append({
'keyValue': {
'topLabel': 'KeyValue Widget',
'content': 'This is a KeyValue widget',
'bottomLabel': 'The bottom label',
'icon': 'STAR'
}
})
elif word == 'interactivetextbutton':
widgets.append({
'buttons': [
{
'textButton': {
'text': 'INTERACTIVE BUTTON',
'onClick': {
'action': {
'actionMethodName': INTERACTIVE_TEXT_BUTTON_ACTION,
'parameters': [{
'key': INTERACTIVE_BUTTON_PARAMETER_KEY,
'value': event_message
}]
}
}
}
}
]
})
elif word == 'interactiveimagebutton':
widgets.append({
'buttons': [
{
'imageButton': {
'icon': 'EVENT_SEAT',
'onClick': {
'action': {
'actionMethodName': INTERACTIVE_IMAGE_BUTTON_ACTION,
'parameters': [{
'key': INTERACTIVE_BUTTON_PARAMETER_KEY,
'value': event_message
}]
}
}
}
}
]
})
elif word == 'textbutton':
widgets.append({
'buttons': [
{
'textButton': {
'text': 'TEXT BUTTON',
'onClick': {
'openLink': {
'url': 'https://developers.google.com',
}
}
}
}
]
})
elif word == 'imagebutton':
widgets.append({
'buttons': [
{
'imageButton': {
'icon': 'EVENT_SEAT',
'onClick': {
'openLink': {
'url': 'https://developers.google.com',
}
}
}
}
]
})
elif word == 'image':
widgets.append({
'image': {
'imageUrl': 'https://goo.gl/Bpa3Y5',
'onClick': {
'openLink': {
'url': 'https://developers.google.com'
}
}
}
})
if header != None:
cards.append(header)
cards.append({ 'sections': [{ 'widgets': widgets }]})
response['cards'] = cards
return respons
| 38.2 | 221 | 0.425393 | 734 | 11,460 | 6.464578 | 0.152589 | 0.032877 | 0.053109 | 0.067229 | 0.782297 | 0.736776 | 0.728978 | 0.696101 | 0.67608 | 0.655005 | 0 | 0.013178 | 0.437173 | 11,460 | 299 | 222 | 38.327759 | 0.722481 | 0 | 0 | 0.432331 | 0 | 0.018797 | 0.240663 | 0.003752 | 0 | 0 | 0 | 0 | 0 | 1 | 0.037594 | false | 0 | 0 | 0.033835 | 0.075188 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a9e7e50c7c0d766b801dd71dbb5e93eba24ab825 | 1,417 | py | Python | students/K33402/ShkikavyyIvan/lab3/arthub/models.py | ShubhamKunal/ITMO_ICT_WebDevelopment_2020-2021 | bb91c91a56d21cec2b12ae4cc722eaa652a88420 | [
"MIT"
] | 4 | 2020-09-03T15:41:42.000Z | 2021-12-24T15:28:20.000Z | students/K33402/ShkikavyyIvan/lab3/arthub/models.py | ShubhamKunal/ITMO_ICT_WebDevelopment_2020-2021 | bb91c91a56d21cec2b12ae4cc722eaa652a88420 | [
"MIT"
] | 48 | 2020-09-13T20:22:42.000Z | 2021-04-30T11:13:30.000Z | students/K33402/ShkikavyyIvan/lab3/arthub/models.py | ShubhamKunal/ITMO_ICT_WebDevelopment_2020-2021 | bb91c91a56d21cec2b12ae4cc722eaa652a88420 | [
"MIT"
] | 69 | 2020-09-06T10:32:37.000Z | 2021-11-28T18:13:17.000Z | from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here.
class User(AbstractUser):
username = models.CharField(max_length=20, blank=True, null=True, unique=True)
email = models.EmailField()
REQUIRED_FIELDS = ['first_name', 'last_name', 'email']
def __str__(self):
return "{} {}".format(self.username, self.email)
class Review(models.Model):
RATING = [(1, '1'), (2, '2'), (3, '3'), (4, '4'), (5, '5')]
author = models.ForeignKey("User", on_delete=models.CASCADE)
creation = models.ForeignKey("Creation", on_delete=models.CASCADE)
text = models.CharField(max_length=300)
rating = models.IntegerField(choices=RATING)
class Creation(models.Model):
TYPE = [('Изобразительное искусство', 'Изобразительное искусство'), ('Кино', 'Кино'), ('Литература', 'Литература'),
('Музыка', 'Музыка')]
name = models.CharField(max_length=100)
description = models.CharField(max_length=1000)
creator = models.ForeignKey("Author", null=True, blank=True, on_delete=models.CASCADE)
type = models.CharField(max_length=25, choices=TYPE)
def __str__(self):
return "{} {}".format(self.name, self.description)
class Author(models.Model):
name = models.CharField(max_length=200)
description = models.CharField(max_length=1000)
def __str__(self):
return "{}".format(self.name)
| 32.953488 | 119 | 0.679605 | 171 | 1,417 | 5.48538 | 0.374269 | 0.11194 | 0.134328 | 0.179104 | 0.234542 | 0.17484 | 0.063966 | 0 | 0 | 0 | 0 | 0.02616 | 0.163726 | 1,417 | 42 | 120 | 33.738095 | 0.765401 | 0.016937 | 0 | 0.178571 | 0 | 0 | 0.107117 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.107143 | false | 0 | 0.071429 | 0.107143 | 0.964286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
a9fd8ee2bfd6add462cdbfb05e6e2aac2b4ecf27 | 63 | py | Python | lol_id_tools/logger.py | RheingoldRiver/lol_id_tools | 49d1730aaebbefbf1cd0205faf0c752e910a06b4 | [
"MIT"
] | null | null | null | lol_id_tools/logger.py | RheingoldRiver/lol_id_tools | 49d1730aaebbefbf1cd0205faf0c752e910a06b4 | [
"MIT"
] | null | null | null | lol_id_tools/logger.py | RheingoldRiver/lol_id_tools | 49d1730aaebbefbf1cd0205faf0c752e910a06b4 | [
"MIT"
] | null | null | null | import logging
lit_logger = logging.getLogger("lol_id_tools")
| 15.75 | 46 | 0.809524 | 9 | 63 | 5.333333 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.095238 | 63 | 3 | 47 | 21 | 0.842105 | 0 | 0 | 0 | 0 | 0 | 0.190476 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a9fe685d96f55750b33322d1d292af285fc688c5 | 4,241 | py | Python | price_fetcher/traderjoes.py | smartin015/expenses | c0bd7122595c0647d2548396c489935a0f789464 | [
"Apache-2.0"
] | null | null | null | price_fetcher/traderjoes.py | smartin015/expenses | c0bd7122595c0647d2548396c489935a0f789464 | [
"Apache-2.0"
] | null | null | null | price_fetcher/traderjoes.py | smartin015/expenses | c0bd7122595c0647d2548396c489935a0f789464 | [
"Apache-2.0"
] | null | null | null | import requests
def tjQuery(sku):
headers = {
'authority': 'www.traderjoes.com',
'pragma': 'no-cache',
'cache-control': 'no-cache',
'sec-ch-ua': '"Chromium";v="94", "Google Chrome";v="94", ";Not A Brand";v="99"',
'accept': '*/*',
'content-type': 'application/json',
'sec-ch-ua-mobile': '?0',
'user-agent': 'Mozilla/5.0 (X11; CrOS x86_64 14150.74.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.114 Safari/537.36',
'sec-ch-ua-platform': '"Chrome OS"',
'origin': 'https://www.traderjoes.com',
'sec-fetch-site': 'same-origin',
'sec-fetch-mode': 'cors',
'sec-fetch-dest': 'empty',
'referer': 'https://www.traderjoes.com/home/products/pdp/092463',
'accept-language': 'en-US,en;q=0.9',
'cookie': 'affinity="ece063aa8b007bdb"',
}
data = '{"operationName":"SearchProduct","variables":{"storeCode":"678","published":"1","sku":"SKUSKUSKU"},"query":"query SearchProduct($sku: String, $storeCode: String = \\"678\\", $published: String = \\"1\\") {\\n products(\\n filter: {sku: {eq: $sku}, store_code: {eq: $storeCode}, published: {eq: $published}}\\n ) {\\n items {\\n category_hierarchy {\\n id\\n url_key\\n description\\n name\\n position\\n level\\n created_at\\n updated_at\\n product_count\\n __typename\\n }\\n item_story_marketing\\n product_label\\n fun_tags\\n primary_image\\n primary_image_meta {\\n url\\n metadata\\n __typename\\n }\\n other_images\\n other_images_meta {\\n url\\n metadata\\n __typename\\n }\\n context_image\\n context_image_meta {\\n url\\n metadata\\n __typename\\n }\\n published\\n sku\\n url_key\\n name\\n item_description\\n item_title\\n item_characteristics\\n item_story_qil\\n use_and_demo\\n sales_size\\n sales_uom_code\\n sales_uom_description\\n country_of_origin\\n availability\\n new_product\\n promotion\\n price_range {\\n minimum_price {\\n final_price {\\n currency\\n value\\n __typename\\n }\\n __typename\\n }\\n __typename\\n }\\n retail_price\\n nutrition {\\n display_sequence\\n panel_id\\n panel_title\\n serving_size\\n calories_per_serving\\n servings_per_container\\n details {\\n display_seq\\n nutritional_item\\n amount\\n percent_dv\\n __typename\\n }\\n __typename\\n }\\n ingredients {\\n display_sequence\\n ingredient\\n __typename\\n }\\n allergens {\\n display_sequence\\n ingredient\\n __typename\\n }\\n created_at\\n first_published_date\\n last_published_date\\n updated_at\\n related_products {\\n sku\\n item_title\\n primary_image\\n primary_image_meta {\\n url\\n metadata\\n __typename\\n }\\n price_range {\\n minimum_price {\\n final_price {\\n currency\\n value\\n __typename\\n }\\n __typename\\n }\\n __typename\\n }\\n retail_price\\n sales_size\\n sales_uom_description\\n category_hierarchy {\\n id\\n name\\n __typename\\n }\\n __typename\\n }\\n __typename\\n }\\n total_count\\n page_info {\\n current_page\\n page_size\\n total_pages\\n __typename\\n }\\n __typename\\n }\\n}\\n"}'.replace("SKUSKUSKU", sku)
response = requests.post('https://www.traderjoes.com/api/graphql', headers=headers, data=data)
return (
response.json()['data']['products']['items'][0]['item_title'],
float(response.json()['data']['products']['items'][0]['retail_price'])
)
def all_queries():
return [tjQuery("092463")]
if __name__ == "__main__":
print(all_queries())
| 114.621622 | 3,057 | 0.542561 | 517 | 4,241 | 4.201161 | 0.350097 | 0.020258 | 0.092081 | 0.101289 | 0.311234 | 0.296501 | 0.231584 | 0.212247 | 0.212247 | 0.164365 | 0 | 0.024791 | 0.296157 | 4,241 | 36 | 3,058 | 117.805556 | 0.702848 | 0 | 0 | 0 | 0 | 0.1 | 0.870785 | 0.077104 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0 | 0.033333 | 0.033333 | 0.166667 | 0.033333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e745288e1d18f5bc987b508571ab368ed98fe10a | 32,648 | py | Python | ot/regpath.py | cshjin/POT | eccb1386eea52b94b82456d126bd20cbe3198e05 | [
"MIT"
] | 624 | 2016-11-04T13:02:35.000Z | 2020-04-16T10:27:14.000Z | ot/regpath.py | cshjin/POT | eccb1386eea52b94b82456d126bd20cbe3198e05 | [
"MIT"
] | 112 | 2016-12-02T09:01:49.000Z | 2020-04-07T09:31:25.000Z | ot/regpath.py | lchapel/POT | 8385b6db7a394ed48a0eff630f852a6d3952db65 | [
"MIT"
] | 163 | 2016-10-28T16:19:57.000Z | 2020-04-15T13:39:23.000Z | # -*- coding: utf-8 -*-
"""
Regularization path OT solvers
"""
# Author: Haoran Wu <haoran.wu@univ-ubs.fr>
# License: MIT License
import numpy as np
import scipy.sparse as sp
def recast_ot_as_lasso(a, b, C):
r"""This function recasts the l2-penalized UOT problem as a Lasso problem.
Recall the l2-penalized UOT problem defined in
:ref:`[41] <references-regpath>`
.. math::
\text{UOT}_{\lambda} = \min_T <C, T> + \lambda \|T 1_m -
\mathbf{a}\|_2^2 +
\lambda \|T^T 1_n - \mathbf{b}\|_2^2
s.t.
T \geq 0
where :
- :math:`C` is the cost matrix
- :math:`\lambda` is the l2-regularization parameter
- :math:`\mathbf{a}` and :math:`\mathbf{b}` are the source and target \
distributions
- :math:`T` is the transport plan to optimize
The problem above can be reformulated as a non-negative penalized
linear regression problem, particularly Lasso
.. math::
\text{UOT2}_{\lambda} = \min_{\mathbf{t}} \gamma \mathbf{c}^T
\mathbf{t} + 0.5 * \|H \mathbf{t} - \mathbf{y}\|_2^2
s.t.
\mathbf{t} \geq 0
where :
- :math:`\mathbf{c}` is the flattened version of the cost matrix :math:`C`
- :math:`\mathbf{y}` is the concatenation of vectors :math:`\mathbf{a}` \
and :math:`\mathbf{b}`
- :math:`H` is a metric matrix, see :ref:`[41] <references-regpath>` for \
the design of :math:`H`. The matrix product :math:`H\mathbf{t}` \
computes both the source marginal and the target marginals.
- :math:`\mathbf{t}` is the flattened version of the transport plan \
:math:`T`
Parameters
----------
a : np.ndarray (dim_a,)
Histogram of dimension dim_a
b : np.ndarray (dim_b,)
Histogram of dimension dim_b
C : np.ndarray, shape (dim_a, dim_b)
Cost matrix
Returns
-------
H : np.ndarray (dim_a+dim_b, dim_a*dim_b)
Design matrix that contains only 0 and 1
y : np.ndarray (ns + nt, )
Concatenation of histograms :math:`\mathbf{a}` and :math:`\mathbf{b}`
c : np.ndarray (ns * nt, )
Flattened array of the cost matrix
Examples
--------
>>> import ot
>>> a = np.array([0.2, 0.3, 0.5])
>>> b = np.array([0.1, 0.9])
>>> C = np.array([[16., 25.], [28., 16.], [40., 36.]])
>>> H, y, c = ot.regpath.recast_ot_as_lasso(a, b, C)
>>> H.toarray()
array([[1., 1., 0., 0., 0., 0.],
[0., 0., 1., 1., 0., 0.],
[0., 0., 0., 0., 1., 1.],
[1., 0., 1., 0., 1., 0.],
[0., 1., 0., 1., 0., 1.]])
>>> y
array([0.2, 0.3, 0.5, 0.1, 0.9])
>>> c
array([16., 25., 28., 16., 40., 36.])
References
----------
.. [41] Chapel, L., Flamary, R., Wu, H., Févotte, C., and Gasso, G. (2021).
Unbalanced optimal transport through non-negative penalized
linear regression. NeurIPS.
"""
dim_a = np.shape(a)[0]
dim_b = np.shape(b)[0]
y = np.concatenate((a, b))
c = C.flatten()
jHa = np.arange(dim_a * dim_b)
iHa = np.repeat(np.arange(dim_a), dim_b)
jHb = np.arange(dim_a * dim_b)
iHb = np.tile(np.arange(dim_b), dim_a) + dim_a
j = np.concatenate((jHa, jHb))
i = np.concatenate((iHa, iHb))
H = sp.csc_matrix((np.ones(dim_a * dim_b * 2), (i, j)),
shape=(dim_a + dim_b, dim_a * dim_b))
return H, y, c
def recast_semi_relaxed_as_lasso(a, b, C):
r"""This function recasts the semi-relaxed l2-UOT problem as Lasso problem.
.. math::
\text{semi-relaxed UOT} = \min_T <C, T>
+ \lambda \|T 1_m - \mathbf{a}\|_2^2
s.t.
T^T 1_n = \mathbf{b}
\mathbf{t} \geq 0
where :
- :math:`C` is the metric cost matrix
- :math:`\lambda` is the l2-regularization parameter
- :math:`\mathbf{a}` and :math:`\mathbf{b}` are the source and target \
distributions
- :math:`T` is the transport plan to optimize
The problem above can be reformulated as follows
.. math::
\text{semi-relaxed UOT2} = \min_t \gamma \mathbf{c}^T t
+ 0.5 * \|H_r \mathbf{t} - \mathbf{a}\|_2^2
s.t.
H_c \mathbf{t} = \mathbf{b}
\mathbf{t} \geq 0
where :
- :math:`\mathbf{c}` is flattened version of the cost matrix :math:`C`
- :math:`\gamma = 1/\lambda` is the l2-regularization parameter
- :math:`H_r` is a metric matrix which computes the sum along the \
rows of the transport plan :math:`T`
- :math:`H_c` is a metric matrix which computes the sum along the \
columns of the transport plan :math:`T`
- :math:`\mathbf{t}` is the flattened version of :math:`T`
Parameters
----------
a : np.ndarray (dim_a,)
Histogram of dimension dim_a
b : np.ndarray (dim_b,)
Histogram of dimension dim_b
C : np.ndarray, shape (dim_a, dim_b)
Cost matrix
Returns
-------
Hr : np.ndarray (dim_a, dim_a * dim_b)
Auxiliary matrix constituted by 0 and 1, which computes
the sum along the rows of transport plan :math:`T`
Hc : np.ndarray (dim_b, dim_a * dim_b)
Auxiliary matrix constituted by 0 and 1, which computes
the sum along the columns of transport plan :math:`T`
c : np.ndarray (ns * nt, )
Flattened array of the cost matrix
Examples
--------
>>> import ot
>>> a = np.array([0.2, 0.3, 0.5])
>>> b = np.array([0.1, 0.9])
>>> C = np.array([[16., 25.], [28., 16.], [40., 36.]])
>>> Hr,Hc,c = ot.regpath.recast_semi_relaxed_as_lasso(a, b, C)
>>> Hr.toarray()
array([[1., 1., 0., 0., 0., 0.],
[0., 0., 1., 1., 0., 0.],
[0., 0., 0., 0., 1., 1.]])
>>> Hc.toarray()
array([[1., 0., 1., 0., 1., 0.],
[0., 1., 0., 1., 0., 1.]])
>>> c
array([16., 25., 28., 16., 40., 36.])
"""
dim_a = np.shape(a)[0]
dim_b = np.shape(b)[0]
c = C.flatten()
jHr = np.arange(dim_a * dim_b)
iHr = np.repeat(np.arange(dim_a), dim_b)
jHc = np.arange(dim_a * dim_b)
iHc = np.tile(np.arange(dim_b), dim_a)
Hr = sp.csc_matrix((np.ones(dim_a * dim_b), (iHr, jHr)),
shape=(dim_a, dim_a * dim_b))
Hc = sp.csc_matrix((np.ones(dim_a * dim_b), (iHc, jHc)),
shape=(dim_b, dim_a * dim_b))
return Hr, Hc, c
def ot_next_gamma(phi, delta, HtH, Hty, c, active_index, current_gamma):
r""" This function computes the next value of gamma if a variable
is added in the next iteration of the regularization path.
We look for the largest value of gamma such that
the gradient of an inactive variable vanishes
.. math::
\max_{i \in \bar{A}} \frac{\mathbf{h}_i^T(H_A \phi - \mathbf{y})}
{\mathbf{h}_i^T H_A \delta - \mathbf{c}_i}
where :
- A is the current active set
- :math:`\mathbf{h}_i` is the :math:`i` th column of the design \
matrix :math:`{H}`
- :math:`{H}_A` is the sub-matrix constructed by the columns of \
:math:`{H}` whose indices belong to the active set A
- :math:`\mathbf{c}_i` is the :math:`i` th element of the cost vector \
:math:`\mathbf{c}`
- :math:`\mathbf{y}` is the concatenation of the source and target \
distributions
- :math:`\phi` is the intercept of the solutions at the current iteration
- :math:`\delta` is the slope of the solutions at the current iteration
Parameters
----------
phi : np.ndarray (size(A), )
Intercept of the solutions at the current iteration
delta : np.ndarray (size(A), )
Slope of the solutions at the current iteration
HtH : np.ndarray (dim_a * dim_b, dim_a * dim_b)
Matrix product of :math:`{H}^T {H}`
Hty : np.ndarray (dim_a + dim_b, )
Matrix product of :math:`{H}^T \mathbf{y}`
c: np.ndarray (dim_a * dim_b, )
Flattened array of the cost matrix :math:`{C}`
active_index : list
Indices of active variables
current_gamma : float
Value of the regularization parameter at the beginning of the current \
iteration
Returns
-------
next_gamma : float
Value of gamma if a variable is added to active set in next iteration
next_active_index : int
Index of variable to be activated
References
----------
.. [41] Chapel, L., Flamary, R., Wu, H., Févotte, C., and Gasso, G. (2021).
Unbalanced optimal transport through non-negative penalized
linear regression. NeurIPS.
"""
M = (HtH[:, active_index].dot(phi) - Hty) / \
(HtH[:, active_index].dot(delta) - c + 1e-16)
M[active_index] = 0
M[M > (current_gamma - 1e-10 * current_gamma)] = 0
return np.max(M), np.argmax(M)
def semi_relaxed_next_gamma(phi, delta, phi_u, delta_u, HrHr, Hc, Hra,
c, active_index, current_gamma):
r""" This function computes the next value of gamma when a variable is
active in the regularization path of semi-relaxed UOT.
By taking the Lagrangian form of the problem, we obtain a similar update
as the two-sided relaxed UOT
.. math::
\max_{i \in \bar{A}} \frac{\mathbf{h}_{ri}^T(H_{rA} \phi - \mathbf{a})
+ \mathbf{h}_{c i}^T\phi_u}{\mathbf{h}_{r i}^T H_{r A} \delta + \
\mathbf{h}_{c i} \delta_u - \mathbf{c}_i}
where :
- A is the current active set
- :math:`\mathbf{h}_{r i}` is the ith column of the matrix :math:`H_r`
- :math:`\mathbf{h}_{c i}` is the ith column of the matrix :math:`H_c`
- :math:`H_{r A}` is the sub-matrix constructed by the columns of \
:math:`H_r` whose indices belong to the active set A
- :math:`\mathbf{c}_i` is the :math:`i` th element of cost vector \
:math:`\mathbf{c}`
- :math:`\phi` is the intercept of the solutions in current iteration
- :math:`\delta` is the slope of the solutions in current iteration
- :math:`\phi_u` is the intercept of Lagrange parameter at the \
current iteration
- :math:`\delta_u` is the slope of Lagrange parameter at the \
current iteration
Parameters
----------
phi : np.ndarray (size(A), )
Intercept of the solutions at the current iteration
delta : np.ndarray (size(A), )
Slope of the solutions at the current iteration
phi_u : np.ndarray (dim_b, )
Intercept of the Lagrange parameter at the current iteration
delta_u : np.ndarray (dim_b, )
Slope of the Lagrange parameter at the current iteration
HrHr : np.ndarray (dim_a * dim_b, dim_a * dim_b)
Matrix product of :math:`H_r^T H_r`
Hc : np.ndarray (dim_b, dim_a * dim_b)
Matrix that computes the sum along the columns of the transport plan \
:math:`T`
Hra : np.ndarray (dim_a * dim_b, )
Matrix product of :math:`H_r^T \mathbf{a}`
c: np.ndarray (dim_a * dim_b, )
Flattened array of cost matrix :math:`C`
active_index : list
Indices of active variables
current_gamma : float
Value of regularization coefficient at the start of current iteration
Returns
-------
next_gamma : float
Value of gamma if a variable is added to active set in next iteration
next_active_index : int
Index of variable to be activated
References
----------
.. [41] Chapel, L., Flamary, R., Wu, H., Févotte, C., and Gasso, G. (2021).
Unbalanced optimal transport through non-negative penalized
linear regression. NeurIPS.
"""
M = (HrHr[:, active_index].dot(phi) - Hra + Hc.T.dot(phi_u)) / \
(HrHr[:, active_index].dot(delta) - c + Hc.T.dot(delta_u) + 1e-16)
M[active_index] = 0
M[M > (current_gamma - 1e-10 * current_gamma)] = 0
return np.max(M), np.argmax(M)
def compute_next_removal(phi, delta, current_gamma):
r""" This function computes the next gamma value if a variable
is removed at the next iteration of the regularization path.
We look for the largest value of the regularization parameter such that
an element of the current solution vanishes
.. math::
\max_{j \in A} \frac{\phi_j}{\delta_j}
where :
- A is the current active set
- :math:`\phi_j` is the :math:`j` th element of the intercept of the \
current solution
- :math:`\delta_j` is the :math:`j` th element of the slope of the \
current solution
Parameters
----------
phi : ndarray, shape (size(A), )
Intercept of the solution at the current iteration
delta : ndarray, shape (size(A), )
Slope of the solution at the current iteration
current_gamma : float
Value of the regularization parameter at the beginning of the \
current iteration
Returns
-------
next_removal_gamma : float
Gamma value if a variable is removed at the next iteration
next_removal_index : int
Index of the variable to be removed at the next iteration
.. _references-regpath:
References
----------
.. [41] Chapel, L., Flamary, R., Wu, H., Févotte, C., and Gasso, G. (2021).
Unbalanced optimal transport through non-negative penalized
linear regression. NeurIPS.
"""
r_candidate = phi / (delta - 1e-16)
r_candidate[r_candidate >= (1 - 1e-8) * current_gamma] = 0
return np.max(r_candidate), np.argmax(r_candidate)
def complement_schur(M_current, b, d, id_pop):
r""" This function computes the inverse of the design matrix in the \
regularization path using the Schur complement. Two cases may arise:
Case 1: one variable is added to the active set
.. math::
M_{k+1}^{-1} =
\begin{bmatrix}
M_{k}^{-1} + s^{-1} M_{k}^{-1} \mathbf{b} \mathbf{b}^T M_{k}^{-1} \
& - M_{k}^{-1} \mathbf{b} s^{-1} \\
- s^{-1} \mathbf{b}^T M_{k}^{-1} & s^{-1}
\end{bmatrix}
where :
- :math:`M_k^{-1}` is the inverse of the design matrix :math:`H_A^tH_A` \
of the previous iteration
- :math:`\mathbf{b}` is the last column of :math:`M_{k}`
- :math:`s` is the Schur complement, given by \
:math:`s = \mathbf{d} - \mathbf{b}^T M_{k}^{-1} \mathbf{b}`
Case 2: one variable is removed from the active set.
.. math::
M_{k+1}^{-1} = M^{-1}_{k \backslash q} -
\frac{r_{-q,q} r^{T}_{-q,q}}{r_{q,q}}
where :
- :math:`q` is the index of column and row to delete
- :math:`M^{-1}_{k \backslash q}` is the previous inverse matrix deprived \
of the :math:`q` th column and :math:`q` th row
- :math:`r_{-q,q}` is the :math:`q` th column of :math:`M^{-1}_{k}` \
without the :math:`q` th element
- :math:`r_{q, q}` is the element of :math:`q` th column and :math:`q` th \
row in :math:`M^{-1}_{k}`
Parameters
----------
M_current : ndarray, shape (size(A)-1, size(A)-1)
Inverse matrix of :math:`H_A^tH_A` at the previous iteration, with \
size(A) the size of the active set
b : ndarray, shape (size(A)-1, )
None for case 2 (removal), last column of :math:`M_{k}` for case 1 \
(addition)
d : float
should be equal to 2 when UOT and 1 for the semi-relaxed OT
id_pop : int
Index of the variable to be removed, equal to -1
if no variable is deleted at the current iteration
Returns
-------
M : ndarray, shape (size(A), size(A))
Inverse matrix of :math:`H_A^tH_A` of the current iteration
References
----------
.. [41] Chapel, L., Flamary, R., Wu, H., Févotte, C., and Gasso, G. (2021).
Unbalanced optimal transport through non-negative penalized
linear regression. NeurIPS.
"""
if b is None:
b = M_current[id_pop, :]
b = np.delete(b, id_pop)
M_del = np.delete(M_current, id_pop, 0)
a = M_del[:, id_pop]
M_del = np.delete(M_del, id_pop, 1)
M = M_del - np.outer(a, b) / M_current[id_pop, id_pop]
else:
n = b.shape[0] + 1
if np.shape(b)[0] == 0:
M = np.array([[0.5]])
else:
X = M_current.dot(b)
s = d - b.T.dot(X)
M = np.zeros((n, n))
M[:-1, :-1] = M_current + X.dot(X.T) / s
X_ravel = X.ravel()
M[-1, :-1] = -X_ravel / s
M[:-1, -1] = -X_ravel / s
M[-1, -1] = 1 / s
return M
def construct_augmented_H(active_index, m, Hc, HrHr):
r""" This function constructs an augmented matrix for the first iteration
of the semi-relaxed regularization path
.. math::
\text{Augmented}_H =
\begin{bmatrix}
0 & H_{c A} \\
H_{c A}^T & H_{r A}^T H_{r A}
\end{bmatrix}
where :
- :math:`H_{r A}` is the sub-matrix constructed by the columns of \
:math:`H_r` whose indices belong to the active set A
- :math:`H_{c A}` is the sub-matrix constructed by the columns of \
:math:`H_c` whose indices belong to the active set A
Parameters
----------
active_index : list
Indices of the active variables
m : int
Length of the target distribution
Hc : np.ndarray (dim_b, dim_a * dim_b)
Matrix that computes the sum along the columns of the transport plan \
:math:`T`
HrHr : np.ndarray (dim_a * dim_b, dim_a * dim_b)
Matrix product of :math:`H_r^T H_r`
Returns
-------
H_augmented : np.ndarray (dim_b + size(A), dim_b + size(A))
Augmented matrix for the first iteration of the semi-relaxed
regularization path
"""
Hc_sub = Hc[:, active_index].toarray()
HrHr_sub = HrHr[:, active_index]
HrHr_sub = HrHr_sub[active_index, :].toarray()
H_augmented = np.block([[np.zeros((m, m)), Hc_sub], [Hc_sub.T, HrHr_sub]])
return H_augmented
def fully_relaxed_path(a: np.array, b: np.array, C: np.array, reg=1e-4,
itmax=50000):
r"""This function gives the regularization path of l2-penalized UOT problem
The problem to optimize is the Lasso reformulation of the l2-penalized UOT:
.. math::
\min_t \gamma \mathbf{c}^T \mathbf{t}
+ 0.5 * \|{H} \mathbf{t} - \mathbf{y}\|_2^2
s.t.
\mathbf{t} \geq 0
where :
- :math:`\mathbf{c}` is the flattened version of the cost matrix \
:math:`{C}`
- :math:`\gamma = 1/\lambda` is the l2-regularization coefficient
- :math:`\mathbf{y}` is the concatenation of vectors :math:`\mathbf{a}` \
and :math:`\mathbf{b}`, defined as \
:math:`\mathbf{y}^T = [\mathbf{a}^T \mathbf{b}^T]`
- :math:`{H}` is a design matrix, see :ref:`[41] <references-regpath>` \
for the design of :math:`{H}`. The matrix product :math:`H\mathbf{t}` \
computes both the source marginal and the target marginals.
- :math:`\mathbf{t}` is the flattened version of the transport matrix
Parameters
----------
a : np.ndarray (dim_a,)
Histogram of dimension dim_a
b : np.ndarray (dim_b,)
Histogram of dimension dim_b
C : np.ndarray, shape (dim_a, dim_b)
Cost matrix
reg: float
l2-regularization coefficient
itmax: int
Maximum number of iteration
Returns
-------
t : np.ndarray (dim_a*dim_b, )
Flattened vector of the optimal transport matrix
t_list : list
List of solutions in the regularization path
gamma_list : list
List of regularization coefficients in the regularization path
Examples
--------
>>> import ot
>>> import numpy as np
>>> n = 3
>>> xs = np.array([1., 2., 3.]).reshape((n, 1))
>>> xt = np.array([5., 6., 7.]).reshape((n, 1))
>>> C = ot.dist(xs, xt)
>>> C /= C.max()
>>> a = np.array([0.2, 0.5, 0.3])
>>> b = np.array([0.2, 0.5, 0.3])
>>> t, _, _ = ot.regpath.fully_relaxed_path(a, b, C, 1e-4)
>>> t
array([1.99958333e-01, 0.00000000e+00, 0.00000000e+00, 3.88888889e-05,
4.99938889e-01, 0.00000000e+00, 0.00000000e+00, 3.88888889e-05,
2.99958333e-01])
References
----------
.. [41] Chapel, L., Flamary, R., Wu, H., Févotte, C., and Gasso, G. (2021).
Unbalanced optimal transport through non-negative penalized
linear regression. NeurIPS.
"""
n = np.shape(a)[0]
m = np.shape(b)[0]
H, y, c = recast_ot_as_lasso(a, b, C)
HtH = H.T.dot(H)
Hty = H.T.dot(y)
n_iter = 1
# initialization
M0 = Hty / c
gamma_list = [np.max(M0)]
active_index = [np.argmax(M0)]
t_list = [np.zeros((n * m,))]
H_inv = np.array([[]])
add_col = np.array([])
id_pop = -1
while n_iter < itmax and gamma_list[-1] > reg:
H_inv = complement_schur(H_inv, add_col, 2., id_pop)
current_gamma = gamma_list[-1]
# compute the intercept and slope of solutions in current iteration
# t = phi - gamma * delta
phi = H_inv.dot(Hty[active_index])
delta = H_inv.dot(c[active_index])
gamma, ik = ot_next_gamma(phi, delta, HtH, Hty, c, active_index,
current_gamma)
# compute the next lambda when removing a point from the active set
alt_gamma, id_pop = compute_next_removal(phi, delta, current_gamma)
# if the positivity constraint is violated, we remove id_pop
# from active set, otherwise we add ik to active set
if alt_gamma > gamma:
gamma = alt_gamma
else:
id_pop = -1
# compute the solution of current segment
tA = phi - gamma * delta
sol = np.zeros((n * m, ))
sol[active_index] = tA
if id_pop != -1:
active_index.pop(id_pop)
add_col = None
else:
active_index.append(ik)
add_col = HtH[active_index[:-1], ik].toarray()
gamma_list.append(gamma)
t_list.append(sol)
n_iter += 1
if itmax <= n_iter:
print('maximum iteration has been reached !')
# correct the last solution and gamma
if len(t_list) > 1:
t_final = (t_list[-2] + (t_list[-1] - t_list[-2]) *
(reg - gamma_list[-2]) / (gamma_list[-1] - gamma_list[-2]))
t_list[-1] = t_final
gamma_list[-1] = reg
else:
gamma_list[-1] = reg
print('Regularization path does not exist !')
return t_list[-1], t_list, gamma_list
def semi_relaxed_path(a: np.array, b: np.array, C: np.array, reg=1e-4,
itmax=50000):
r"""This function gives the regularization path of semi-relaxed
l2-UOT problem.
The problem to optimize is the Lasso reformulation of the l2-penalized UOT:
.. math::
\min_t \gamma \mathbf{c}^T t
+ 0.5 * \|H_r \mathbf{t} - \mathbf{a}\|_2^2
s.t.
H_c \mathbf{t} = \mathbf{b}
\mathbf{t} \geq 0
where :
- :math:`\mathbf{c}` is the flattened version of the cost matrix \
:math:`C`
- :math:`\gamma = 1/\lambda` is the l2-regularization parameter
- :math:`H_r` is a matrix that computes the sum along the rows of \
the transport plan :math:`T`
- :math:`H_c` is a matrix that computes the sum along the columns of \
the transport plan :math:`T`
- :math:`\mathbf{t}` is the flattened version of the transport plan \
:math:`T`
Parameters
----------
a : np.ndarray (dim_a,)
Histogram of dimension dim_a
b : np.ndarray (dim_b,)
Histogram of dimension dim_b
C : np.ndarray, shape (dim_a, dim_b)
Cost matrix
reg: float (optional)
l2-regularization coefficient
itmax: int (optional)
Maximum number of iteration
Returns
-------
t : np.ndarray (dim_a*dim_b, )
Flattened vector of the (unregularized) optimal transport matrix
t_list : list
List of all the optimal transport vectors of the regularization path
gamma_list : list
List of the regularization parameters in the path
Examples
--------
>>> import ot
>>> import numpy as np
>>> n = 3
>>> xs = np.array([1., 2., 3.]).reshape((n, 1))
>>> xt = np.array([5., 6., 7.]).reshape((n, 1))
>>> C = ot.dist(xs, xt)
>>> C /= C.max()
>>> a = np.array([0.2, 0.5, 0.3])
>>> b = np.array([0.2, 0.5, 0.3])
>>> t, _, _ = ot.regpath.semi_relaxed_path(a, b, C, 1e-4)
>>> t
array([1.99980556e-01, 0.00000000e+00, 0.00000000e+00, 1.94444444e-05,
4.99980556e-01, 0.00000000e+00, 0.00000000e+00, 1.94444444e-05,
3.00000000e-01])
References
----------
.. [41] Chapel, L., Flamary, R., Wu, H., Févotte, C., and Gasso, G. (2021).
Unbalanced optimal transport through non-negative penalized
linear regression. NeurIPS.
"""
n = np.shape(a)[0]
m = np.shape(b)[0]
Hr, Hc, c = recast_semi_relaxed_as_lasso(a, b, C)
Hra = Hr.T.dot(a)
HrHr = Hr.T.dot(Hr)
n_iter = 1
active_index = []
# initialization
for j in range(np.shape(C)[1]):
i = np.argmin(C[:, j])
active_index.append(i * m + j)
gamma_list = []
t_list = []
current_gamma = np.Inf
augmented_H0 = construct_augmented_H(active_index, m, Hc, HrHr)
add_col = np.array([])
id_pop = -1
while n_iter < itmax and current_gamma > reg:
if n_iter == 1:
H_inv = np.linalg.inv(augmented_H0)
else:
H_inv = complement_schur(H_inv, add_col, 1., id_pop + m)
# compute the intercept and slope of solutions in current iteration
augmented_phi = H_inv.dot(np.concatenate((b, Hra[active_index])))
augmented_delta = H_inv[:, m:].dot(c[active_index])
phi = augmented_phi[m:]
delta = augmented_delta[m:]
phi_u = augmented_phi[0:m]
delta_u = augmented_delta[0:m]
gamma, ik = semi_relaxed_next_gamma(phi, delta, phi_u, delta_u,
HrHr, Hc, Hra, c, active_index,
current_gamma)
# compute the next lambda when removing a point from the active set
alt_gamma, id_pop = compute_next_removal(phi, delta, current_gamma)
# if the positivity constraint is violated, we remove id_pop
# from active set, otherwise we add ik to active set
if alt_gamma > gamma:
gamma = alt_gamma
else:
id_pop = -1
# compute the solution of current segment
tA = phi - gamma * delta
sol = np.zeros((n * m, ))
sol[active_index] = tA
if id_pop != -1:
active_index.pop(id_pop)
add_col = None
else:
active_index.append(ik)
add_col = np.concatenate((Hc.toarray()[:, ik],
HrHr.toarray()[active_index[:-1], ik]))
add_col = add_col[:, np.newaxis]
gamma_list.append(gamma)
t_list.append(sol)
current_gamma = gamma
n_iter += 1
if itmax <= n_iter:
print('maximum iteration has been reached !')
# correct the last solution and gamma
if len(t_list) > 1:
t_final = (t_list[-2] + (t_list[-1] - t_list[-2]) *
(reg - gamma_list[-2]) / (gamma_list[-1] - gamma_list[-2]))
t_list[-1] = t_final
gamma_list[-1] = reg
else:
gamma_list[-1] = reg
print('Regularization path does not exist !')
return t_list[-1], t_list, gamma_list
def regularization_path(a: np.array, b: np.array, C: np.array, reg=1e-4,
semi_relaxed=False, itmax=50000):
r"""This function provides all the solutions of the regularization path \
of the l2-UOT problem :ref:`[41] <references-regpath>`.
The problem to optimize is the Lasso reformulation of the l2-penalized UOT:
.. math::
\min_t \gamma \mathbf{c}^T \mathbf{t}
+ 0.5 * \|{H} \mathbf{t} - \mathbf{y}\|_2^2
s.t.
\mathbf{t} \geq 0
where :
- :math:`\mathbf{c}` is the flattened version of the cost matrix \
:math:`{C}`
- :math:`\gamma = 1/\lambda` is the l2-regularization coefficient
- :math:`\mathbf{y}` is the concatenation of vectors :math:`\mathbf{a}` \
and :math:`\mathbf{b}`, defined as \
:math:`\mathbf{y}^T = [\mathbf{a}^T \mathbf{b}^T]`
- :math:`{H}` is a design matrix, see :ref:`[41] <references-regpath>` \
for the design of :math:`{H}`. The matrix product :math:`H\mathbf{t}` \
computes both the source marginal and the target marginals.
- :math:`\mathbf{t}` is the flattened version of the transport matrix
For the semi-relaxed problem, it optimizes the Lasso reformulation of the
l2-penalized UOT:
.. math::
\min_t \gamma \mathbf{c}^T \mathbf{t}
+ 0.5 * \|H_r \mathbf{t} - \mathbf{a}\|_2^2
s.t.
H_c \mathbf{t} = \mathbf{b}
\mathbf{t} \geq 0
Parameters
----------
a : np.ndarray (dim_a,)
Histogram of dimension dim_a
b : np.ndarray (dim_b,)
Histogram of dimension dim_b
C : np.ndarray, shape (dim_a, dim_b)
Cost matrix
reg: float (optional)
l2-regularization coefficient
semi_relaxed : bool (optional)
Give the semi-relaxed path if True
itmax: int (optional)
Maximum number of iteration
Returns
-------
t : np.ndarray (dim_a*dim_b, )
Flattened vector of the (unregularized) optimal transport matrix
t_list : list
List of all the optimal transport vectors of the regularization path
gamma_list : list
List of the regularization parameters in the path
References
----------
.. [41] Chapel, L., Flamary, R., Wu, H., Févotte, C., and Gasso, G. (2021).
Unbalanced optimal transport through non-negative penalized
linear regression. NeurIPS.
"""
if semi_relaxed:
t, t_list, gamma_list = semi_relaxed_path(a, b, C, reg=reg,
itmax=itmax)
else:
t, t_list, gamma_list = fully_relaxed_path(a, b, C, reg=reg,
itmax=itmax)
return t, t_list, gamma_list
def compute_transport_plan(gamma, gamma_list, Pi_list):
r""" Given the regularization path, this function computes the transport
plan for any value of gamma thanks to the piecewise linearity of the path.
.. math::
t(\gamma) = \phi(\gamma) - \gamma \delta(\gamma)
where:
- :math:`\gamma` is the regularization parameter
- :math:`\phi(\gamma)` is the corresponding intercept
- :math:`\delta(\gamma)` is the corresponding slope
- :math:`\mathbf{t}` is the flattened version of the transport matrix
Parameters
----------
gamma : float
Regularization coefficient
gamma_list : list
List of regularization parameters of the regularization path
Pi_list : list
List of all the solutions of the regularization path
Returns
-------
t : np.ndarray (dim_a*dim_b, )
Vectorization of the transport plan corresponding to the given value
of gamma
Examples
--------
>>> import ot
>>> import numpy as np
>>> n = 3
>>> xs = np.array([1., 2., 3.]).reshape((n, 1))
>>> xt = np.array([5., 6., 7.]).reshape((n, 1))
>>> C = ot.dist(xs, xt)
>>> C /= C.max()
>>> a = np.array([0.2, 0.5, 0.3])
>>> b = np.array([0.2, 0.5, 0.3])
>>> t, pi_list, g_list = ot.regpath.regularization_path(a, b, C, reg=1e-4)
>>> gamma = 1
>>> t2 = ot.regpath.compute_transport_plan(gamma, g_list, pi_list)
>>> t2
array([0. , 0. , 0. , 0.19722222, 0.05555556,
0. , 0. , 0.24722222, 0. ])
.. _references-regpath:
References
----------
.. [41] Chapel, L., Flamary, R., Wu, H., Févotte, C., and Gasso, G. (2021).
Unbalanced optimal transport through non-negative penalized
linear regression. NeurIPS.
"""
if gamma >= gamma_list[0]:
Pi = Pi_list[0]
elif gamma <= gamma_list[-1]:
Pi = Pi_list[-1]
else:
idx = np.where(gamma <= np.array(gamma_list))[0][-1]
gamma_k0 = gamma_list[idx]
gamma_k1 = gamma_list[idx + 1]
pi_k0 = Pi_list[idx]
pi_k1 = Pi_list[idx + 1]
Pi = pi_k0 + (pi_k1 - pi_k0) * (gamma - gamma_k0) \
/ (gamma_k1 - gamma_k0)
return Pi
| 33.348315 | 79 | 0.570938 | 4,849 | 32,648 | 3.732316 | 0.075892 | 0.021549 | 0.015858 | 0.016797 | 0.764228 | 0.730302 | 0.700077 | 0.677312 | 0.619184 | 0.600674 | 0 | 0.032026 | 0.28844 | 32,648 | 978 | 80 | 33.382413 | 0.747019 | 0.671833 | 0 | 0.393665 | 0 | 0 | 0.017223 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.049774 | false | 0 | 0.00905 | 0 | 0.108597 | 0.0181 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e74901b8df37db04a074d15254873138295ac74a | 142 | py | Python | modules/dnn/feathernet/model_onnx2IR.py | zongwave/libxcam | 2c0cc6839ddd3ef2b6ad22d2580f7878314daf14 | [
"Apache-2.0"
] | 400 | 2018-01-26T05:33:23.000Z | 2022-03-31T06:36:47.000Z | modules/dnn/feathernet/model_onnx2IR.py | zihengchang/libxcam | 53e2b415f9f20ab315de149afdfee97574aeaad0 | [
"Apache-2.0"
] | 77 | 2018-01-25T06:16:15.000Z | 2022-02-23T02:50:49.000Z | modules/dnn/feathernet/model_onnx2IR.py | zihengchang/libxcam | 53e2b415f9f20ab315de149afdfee97574aeaad0 | [
"Apache-2.0"
] | 161 | 2018-03-05T01:03:42.000Z | 2022-03-29T17:14:20.000Z | onnx formate to openVINO IR formate
reference :https://docs.openvinotoolkit.org/latest/_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html | 71 | 106 | 0.887324 | 21 | 142 | 5.619048 | 0.904762 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.049296 | 142 | 2 | 106 | 71 | 0.874074 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e751d185ef0397b03ac3c621c6b9c85d3bad15b1 | 20 | py | Python | challenges/Mixology/support/mixcodegen/__init__.py | pingjuiliao/cb-multios | 64ededd0b87030eda7c40c4388a4ad8283712d8e | [
"MIT"
] | 473 | 2016-08-01T12:48:16.000Z | 2022-03-09T18:13:14.000Z | challenges/Mixology/support/mixcodegen/__init__.py | pingjuiliao/cb-multios | 64ededd0b87030eda7c40c4388a4ad8283712d8e | [
"MIT"
] | 71 | 2016-08-01T03:33:44.000Z | 2022-03-09T18:37:04.000Z | challenges/Mixology/support/mixcodegen/__init__.py | pingjuiliao/cb-multios | 64ededd0b87030eda7c40c4388a4ad8283712d8e | [
"MIT"
] | 121 | 2016-08-01T04:07:53.000Z | 2022-03-07T11:08:09.000Z | __author__ = 'scsi'
| 10 | 19 | 0.7 | 2 | 20 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15 | 20 | 1 | 20 | 20 | 0.588235 | 0 | 0 | 0 | 0 | 0 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e7548a3265933ea077c134cb8088318693ea41ee | 174 | py | Python | modules/aggregation/management/commands/aggregate_items.py | heolin123/funcrowd | 20167783de208394c09ed0429a5f02ec6dd79c42 | [
"MIT"
] | null | null | null | modules/aggregation/management/commands/aggregate_items.py | heolin123/funcrowd | 20167783de208394c09ed0429a5f02ec6dd79c42 | [
"MIT"
] | 11 | 2019-11-12T23:26:45.000Z | 2021-06-10T17:37:23.000Z | modules/aggregation/management/commands/aggregate_items.py | heolin123/funcrowd | 20167783de208394c09ed0429a5f02ec6dd79c42 | [
"MIT"
] | null | null | null | from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Update items aggregation'
def handle(self, *args, **kwargs):
pass
| 17.4 | 51 | 0.695402 | 20 | 174 | 6.05 | 0.95 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.206897 | 174 | 9 | 52 | 19.333333 | 0.876812 | 0 | 0 | 0 | 0 | 0 | 0.138728 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.2 | 0.2 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
e75a3b474a71c08c1c3b61ee5d6fd417cb20c308 | 689 | bzl | Python | third_party/dlpack/workspace.bzl | ashutom/tensorflow-upstream | c16069c19de9e286dd664abb78d0ea421e9f32d4 | [
"Apache-2.0"
] | 190,993 | 2015-11-09T13:17:30.000Z | 2022-03-31T23:05:27.000Z | third_party/dlpack/workspace.bzl | CaptainGizzy21/tensorflow | 3457a2b122e50b4d44ceaaed5a663d635e5c22df | [
"Apache-2.0"
] | 48,461 | 2015-11-09T14:21:11.000Z | 2022-03-31T23:17:33.000Z | third_party/dlpack/workspace.bzl | CaptainGizzy21/tensorflow | 3457a2b122e50b4d44ceaaed5a663d635e5c22df | [
"Apache-2.0"
] | 104,981 | 2015-11-09T13:40:17.000Z | 2022-03-31T19:51:54.000Z | """DLPack is a protocol for sharing arrays between deep learning frameworks."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
tf_http_archive(
name = "dlpack",
strip_prefix = "dlpack-3efc489b55385936531a06ff83425b719387ec63",
sha256 = "b59586ce69bcf3efdbf3cf4803fadfeaae4948044e2b8d89cf912194cf28f233",
urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/dmlc/dlpack/archive/3efc489b55385936531a06ff83425b719387ec63.tar.gz",
"https://github.com/dmlc/dlpack/archive/3efc489b55385936531a06ff83425b719387ec63.tar.gz",
],
build_file = "//third_party/dlpack:BUILD.bazel",
)
| 43.0625 | 146 | 0.712627 | 64 | 689 | 7.546875 | 0.640625 | 0.041408 | 0.05383 | 0.078675 | 0.293996 | 0.293996 | 0.293996 | 0.293996 | 0 | 0 | 0 | 0.223776 | 0.169811 | 689 | 15 | 147 | 45.933333 | 0.620629 | 0.105951 | 0 | 0 | 0 | 0.083333 | 0.660656 | 0.270492 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | true | 0 | 0 | 0 | 0.083333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e763a712fd2ae8a0997a8a6afe336f4e91c3354b | 249,680 | py | Python | gen/apache/aurora/api/ttypes.py | broadinstitute/herc | dd75ed41a1433f8b6c6f0d338194a3488b76fc11 | [
"Apache-2.0",
"BSD-3-Clause"
] | 8 | 2015-03-04T19:10:03.000Z | 2017-05-30T09:42:06.000Z | gen/apache/aurora/api/ttypes.py | broadinstitute/herc | dd75ed41a1433f8b6c6f0d338194a3488b76fc11 | [
"Apache-2.0",
"BSD-3-Clause"
] | 13 | 2015-03-04T21:05:08.000Z | 2015-04-10T22:52:47.000Z | gen/apache/aurora/api/ttypes.py | broadinstitute/herc | dd75ed41a1433f8b6c6f0d338194a3488b76fc11 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | #
# Autogenerated by Thrift Compiler (1.0.0-dev)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
from thrift.protocol import fastbinary
except:
fastbinary = None
class ResponseCode:
INVALID_REQUEST = 0
OK = 1
ERROR = 2
WARNING = 3
AUTH_FAILED = 4
LOCK_ERROR = 5
ERROR_TRANSIENT = 6
_VALUES_TO_NAMES = {
0: "INVALID_REQUEST",
1: "OK",
2: "ERROR",
3: "WARNING",
4: "AUTH_FAILED",
5: "LOCK_ERROR",
6: "ERROR_TRANSIENT",
}
_NAMES_TO_VALUES = {
"INVALID_REQUEST": 0,
"OK": 1,
"ERROR": 2,
"WARNING": 3,
"AUTH_FAILED": 4,
"LOCK_ERROR": 5,
"ERROR_TRANSIENT": 6,
}
class MaintenanceMode:
NONE = 1
SCHEDULED = 2
DRAINING = 3
DRAINED = 4
_VALUES_TO_NAMES = {
1: "NONE",
2: "SCHEDULED",
3: "DRAINING",
4: "DRAINED",
}
_NAMES_TO_VALUES = {
"NONE": 1,
"SCHEDULED": 2,
"DRAINING": 3,
"DRAINED": 4,
}
class LockValidation:
"""
Defines the required lock validation level.
"""
CHECKED = 0
UNCHECKED = 1
_VALUES_TO_NAMES = {
0: "CHECKED",
1: "UNCHECKED",
}
_NAMES_TO_VALUES = {
"CHECKED": 0,
"UNCHECKED": 1,
}
class Mode:
"""
The mode for a volume mount
"""
RW = 1
RO = 2
_VALUES_TO_NAMES = {
1: "RW",
2: "RO",
}
_NAMES_TO_VALUES = {
"RW": 1,
"RO": 2,
}
class CronCollisionPolicy:
"""
Defines the policy for launching a new cron job when one is already running.
"""
KILL_EXISTING = 0
CANCEL_NEW = 1
RUN_OVERLAP = 2
_VALUES_TO_NAMES = {
0: "KILL_EXISTING",
1: "CANCEL_NEW",
2: "RUN_OVERLAP",
}
_NAMES_TO_VALUES = {
"KILL_EXISTING": 0,
"CANCEL_NEW": 1,
"RUN_OVERLAP": 2,
}
class ScheduleStatus:
"""
States that a task may be in.
"""
INIT = 11
THROTTLED = 16
PENDING = 0
ASSIGNED = 9
STARTING = 1
RUNNING = 2
FINISHED = 3
PREEMPTING = 13
RESTARTING = 12
DRAINING = 17
FAILED = 4
KILLED = 5
KILLING = 6
LOST = 7
_VALUES_TO_NAMES = {
11: "INIT",
16: "THROTTLED",
0: "PENDING",
9: "ASSIGNED",
1: "STARTING",
2: "RUNNING",
3: "FINISHED",
13: "PREEMPTING",
12: "RESTARTING",
17: "DRAINING",
4: "FAILED",
5: "KILLED",
6: "KILLING",
7: "LOST",
}
_NAMES_TO_VALUES = {
"INIT": 11,
"THROTTLED": 16,
"PENDING": 0,
"ASSIGNED": 9,
"STARTING": 1,
"RUNNING": 2,
"FINISHED": 3,
"PREEMPTING": 13,
"RESTARTING": 12,
"DRAINING": 17,
"FAILED": 4,
"KILLED": 5,
"KILLING": 6,
"LOST": 7,
}
class JobUpdateStatus:
"""
States that a job update may be in.
"""
ROLLING_FORWARD = 0
ROLLING_BACK = 1
ROLL_FORWARD_PAUSED = 2
ROLL_BACK_PAUSED = 3
ROLLED_FORWARD = 4
ROLLED_BACK = 5
ABORTED = 6
ERROR = 7
FAILED = 8
ROLL_FORWARD_AWAITING_PULSE = 9
ROLL_BACK_AWAITING_PULSE = 10
_VALUES_TO_NAMES = {
0: "ROLLING_FORWARD",
1: "ROLLING_BACK",
2: "ROLL_FORWARD_PAUSED",
3: "ROLL_BACK_PAUSED",
4: "ROLLED_FORWARD",
5: "ROLLED_BACK",
6: "ABORTED",
7: "ERROR",
8: "FAILED",
9: "ROLL_FORWARD_AWAITING_PULSE",
10: "ROLL_BACK_AWAITING_PULSE",
}
_NAMES_TO_VALUES = {
"ROLLING_FORWARD": 0,
"ROLLING_BACK": 1,
"ROLL_FORWARD_PAUSED": 2,
"ROLL_BACK_PAUSED": 3,
"ROLLED_FORWARD": 4,
"ROLLED_BACK": 5,
"ABORTED": 6,
"ERROR": 7,
"FAILED": 8,
"ROLL_FORWARD_AWAITING_PULSE": 9,
"ROLL_BACK_AWAITING_PULSE": 10,
}
class JobUpdateAction:
"""
Job update actions that can be applied to job instances.
"""
INSTANCE_UPDATED = 1
INSTANCE_ROLLED_BACK = 2
INSTANCE_UPDATING = 3
INSTANCE_ROLLING_BACK = 4
INSTANCE_UPDATE_FAILED = 5
INSTANCE_ROLLBACK_FAILED = 6
_VALUES_TO_NAMES = {
1: "INSTANCE_UPDATED",
2: "INSTANCE_ROLLED_BACK",
3: "INSTANCE_UPDATING",
4: "INSTANCE_ROLLING_BACK",
5: "INSTANCE_UPDATE_FAILED",
6: "INSTANCE_ROLLBACK_FAILED",
}
_NAMES_TO_VALUES = {
"INSTANCE_UPDATED": 1,
"INSTANCE_ROLLED_BACK": 2,
"INSTANCE_UPDATING": 3,
"INSTANCE_ROLLING_BACK": 4,
"INSTANCE_UPDATE_FAILED": 5,
"INSTANCE_ROLLBACK_FAILED": 6,
}
class JobUpdatePulseStatus:
"""
Status of the coordinated update. Intended as a response to pulseJobUpdate RPC.
"""
OK = 1
FINISHED = 2
_VALUES_TO_NAMES = {
1: "OK",
2: "FINISHED",
}
_NAMES_TO_VALUES = {
"OK": 1,
"FINISHED": 2,
}
class APIVersion:
"""
Attributes:
- major
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'major', None, None, ), # 1
)
def __init__(self, major=None,):
self.major = major
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.major = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('APIVersion')
if self.major is not None:
oprot.writeFieldBegin('major', TType.I32, 1)
oprot.writeI32(self.major)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.major is None:
raise TProtocol.TProtocolException(message='Required field major is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.major)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Identity:
"""
Attributes:
- role
- user
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'role', None, None, ), # 1
(2, TType.STRING, 'user', None, None, ), # 2
)
def __init__(self, role=None, user=None,):
self.role = role
self.user = user
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.role = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.user = iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Identity')
if self.role is not None:
oprot.writeFieldBegin('role', TType.STRING, 1)
oprot.writeString(self.role)
oprot.writeFieldEnd()
if self.user is not None:
oprot.writeFieldBegin('user', TType.STRING, 2)
oprot.writeString(self.user)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.role)
value = (value * 31) ^ hash(self.user)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class SessionKey:
"""
Attributes:
- mechanism: The name of the authentication mechanism, which instructs the server how to interpret the data
field.
- data: A blob of data that the server may use for authentication.
"""
thrift_spec = (
None, # 0
None, # 1
None, # 2
None, # 3
(4, TType.STRING, 'mechanism', None, None, ), # 4
(5, TType.STRING, 'data', None, None, ), # 5
)
def __init__(self, mechanism=None, data=None,):
self.mechanism = mechanism
self.data = data
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 4:
if ftype == TType.STRING:
self.mechanism = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.STRING:
self.data = iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('SessionKey')
if self.mechanism is not None:
oprot.writeFieldBegin('mechanism', TType.STRING, 4)
oprot.writeString(self.mechanism)
oprot.writeFieldEnd()
if self.data is not None:
oprot.writeFieldBegin('data', TType.STRING, 5)
oprot.writeString(self.data)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.mechanism)
value = (value * 31) ^ hash(self.data)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class ResourceAggregate:
"""
Attributes:
- numCpus: Number of CPU cores allotted.
- ramMb: Megabytes of RAM allotted.
- diskMb: Megabytes of disk space allotted.
"""
thrift_spec = (
None, # 0
(1, TType.DOUBLE, 'numCpus', None, None, ), # 1
(2, TType.I64, 'ramMb', None, None, ), # 2
(3, TType.I64, 'diskMb', None, None, ), # 3
)
def __init__(self, numCpus=None, ramMb=None, diskMb=None,):
self.numCpus = numCpus
self.ramMb = ramMb
self.diskMb = diskMb
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.DOUBLE:
self.numCpus = iprot.readDouble()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I64:
self.ramMb = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I64:
self.diskMb = iprot.readI64()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('ResourceAggregate')
if self.numCpus is not None:
oprot.writeFieldBegin('numCpus', TType.DOUBLE, 1)
oprot.writeDouble(self.numCpus)
oprot.writeFieldEnd()
if self.ramMb is not None:
oprot.writeFieldBegin('ramMb', TType.I64, 2)
oprot.writeI64(self.ramMb)
oprot.writeFieldEnd()
if self.diskMb is not None:
oprot.writeFieldBegin('diskMb', TType.I64, 3)
oprot.writeI64(self.diskMb)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.numCpus)
value = (value * 31) ^ hash(self.ramMb)
value = (value * 31) ^ hash(self.diskMb)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Attribute:
"""
A single host attribute.
Attributes:
- name
- values
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'name', None, None, ), # 1
(2, TType.SET, 'values', (TType.STRING,None), None, ), # 2
)
def __init__(self, name=None, values=None,):
self.name = name
self.values = values
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.name = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.SET:
self.values = set()
(_etype3, _size0) = iprot.readSetBegin()
for _i4 in range(_size0):
_elem5 = iprot.readString()
self.values.add(_elem5)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Attribute')
if self.name is not None:
oprot.writeFieldBegin('name', TType.STRING, 1)
oprot.writeString(self.name)
oprot.writeFieldEnd()
if self.values is not None:
oprot.writeFieldBegin('values', TType.SET, 2)
oprot.writeSetBegin(TType.STRING, len(self.values))
for iter6 in self.values:
oprot.writeString(iter6)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.name)
value = (value * 31) ^ hash(self.values)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class HostAttributes:
"""
The attributes assigned to a host.
Attributes:
- host
- attributes
- mode
- slaveId
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'host', None, None, ), # 1
(2, TType.SET, 'attributes', (TType.STRUCT,(Attribute, Attribute.thrift_spec)), None, ), # 2
(3, TType.I32, 'mode', None, None, ), # 3
(4, TType.STRING, 'slaveId', None, None, ), # 4
)
def __init__(self, host=None, attributes=None, mode=None, slaveId=None,):
self.host = host
self.attributes = attributes
self.mode = mode
self.slaveId = slaveId
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.host = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.SET:
self.attributes = set()
(_etype10, _size7) = iprot.readSetBegin()
for _i11 in range(_size7):
_elem12 = Attribute()
_elem12.read(iprot)
self.attributes.add(_elem12)
iprot.readSetEnd()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.mode = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
self.slaveId = iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('HostAttributes')
if self.host is not None:
oprot.writeFieldBegin('host', TType.STRING, 1)
oprot.writeString(self.host)
oprot.writeFieldEnd()
if self.attributes is not None:
oprot.writeFieldBegin('attributes', TType.SET, 2)
oprot.writeSetBegin(TType.STRUCT, len(self.attributes))
for iter13 in self.attributes:
iter13.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
if self.mode is not None:
oprot.writeFieldBegin('mode', TType.I32, 3)
oprot.writeI32(self.mode)
oprot.writeFieldEnd()
if self.slaveId is not None:
oprot.writeFieldBegin('slaveId', TType.STRING, 4)
oprot.writeString(self.slaveId)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.host)
value = (value * 31) ^ hash(self.attributes)
value = (value * 31) ^ hash(self.mode)
value = (value * 31) ^ hash(self.slaveId)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class ValueConstraint:
"""
A constraint that specifies an explicit set of values, at least one of which must be present
on a host for a task to be scheduled there.
Attributes:
- negated: If true, treat this as a 'not' - to avoid specific values.
- values
"""
thrift_spec = (
None, # 0
(1, TType.BOOL, 'negated', None, None, ), # 1
(2, TType.SET, 'values', (TType.STRING,None), None, ), # 2
)
def __init__(self, negated=None, values=None,):
self.negated = negated
self.values = values
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.BOOL:
self.negated = iprot.readBool()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.SET:
self.values = set()
(_etype17, _size14) = iprot.readSetBegin()
for _i18 in range(_size14):
_elem19 = iprot.readString()
self.values.add(_elem19)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('ValueConstraint')
if self.negated is not None:
oprot.writeFieldBegin('negated', TType.BOOL, 1)
oprot.writeBool(self.negated)
oprot.writeFieldEnd()
if self.values is not None:
oprot.writeFieldBegin('values', TType.SET, 2)
oprot.writeSetBegin(TType.STRING, len(self.values))
for iter20 in self.values:
oprot.writeString(iter20)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.negated)
value = (value * 31) ^ hash(self.values)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class LimitConstraint:
"""
A constraint the specifies the maximum number of active tasks on a host with a matching
attribute that may be scheduled simultaneously.
Attributes:
- limit
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'limit', None, None, ), # 1
)
def __init__(self, limit=None,):
self.limit = limit
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.limit = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('LimitConstraint')
if self.limit is not None:
oprot.writeFieldBegin('limit', TType.I32, 1)
oprot.writeI32(self.limit)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.limit)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class TaskConstraint:
"""
Types of constraints that may be applied to a task.
Attributes:
- value
- limit
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'value', (ValueConstraint, ValueConstraint.thrift_spec), None, ), # 1
(2, TType.STRUCT, 'limit', (LimitConstraint, LimitConstraint.thrift_spec), None, ), # 2
)
def __init__(self, value=None, limit=None,):
self.value = value
self.limit = limit
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.value = ValueConstraint()
self.value.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.limit = LimitConstraint()
self.limit.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('TaskConstraint')
if self.value is not None:
oprot.writeFieldBegin('value', TType.STRUCT, 1)
self.value.write(oprot)
oprot.writeFieldEnd()
if self.limit is not None:
oprot.writeFieldBegin('limit', TType.STRUCT, 2)
self.limit.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.value)
value = (value * 31) ^ hash(self.limit)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Constraint:
"""
A constraint that defines whether a task may be scheduled on a host.
Attributes:
- name: Mesos slave attribute that the constraint is matched against.
- constraint
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'name', None, None, ), # 1
(2, TType.STRUCT, 'constraint', (TaskConstraint, TaskConstraint.thrift_spec), None, ), # 2
)
def __init__(self, name=None, constraint=None,):
self.name = name
self.constraint = constraint
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.name = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.constraint = TaskConstraint()
self.constraint.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Constraint')
if self.name is not None:
oprot.writeFieldBegin('name', TType.STRING, 1)
oprot.writeString(self.name)
oprot.writeFieldEnd()
if self.constraint is not None:
oprot.writeFieldBegin('constraint', TType.STRUCT, 2)
self.constraint.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.name)
value = (value * 31) ^ hash(self.constraint)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Package:
"""
Attributes:
- role
- name
- version
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'role', None, None, ), # 1
(2, TType.STRING, 'name', None, None, ), # 2
(3, TType.I32, 'version', None, None, ), # 3
)
def __init__(self, role=None, name=None, version=None,):
self.role = role
self.name = name
self.version = version
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.role = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.name = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.version = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Package')
if self.role is not None:
oprot.writeFieldBegin('role', TType.STRING, 1)
oprot.writeString(self.role)
oprot.writeFieldEnd()
if self.name is not None:
oprot.writeFieldBegin('name', TType.STRING, 2)
oprot.writeString(self.name)
oprot.writeFieldEnd()
if self.version is not None:
oprot.writeFieldBegin('version', TType.I32, 3)
oprot.writeI32(self.version)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.role)
value = (value * 31) ^ hash(self.name)
value = (value * 31) ^ hash(self.version)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Metadata:
"""
Arbitrary key-value metadata to be included into TaskConfig.
Attributes:
- key
- value
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'key', None, None, ), # 1
(2, TType.STRING, 'value', None, None, ), # 2
)
def __init__(self, key=None, value=None,):
self.key = key
self.value = value
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.key = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.value = iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Metadata')
if self.key is not None:
oprot.writeFieldBegin('key', TType.STRING, 1)
oprot.writeString(self.key)
oprot.writeFieldEnd()
if self.value is not None:
oprot.writeFieldBegin('value', TType.STRING, 2)
oprot.writeString(self.value)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.key)
value = (value * 31) ^ hash(self.value)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobKey:
"""
A unique identifier for a Job.
Attributes:
- role: User role (Unix service account), for example "mesos"
- environment: Environment, for example "devel"
- name: Name, for example "labrat"
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'role', None, None, ), # 1
(2, TType.STRING, 'environment', None, None, ), # 2
(3, TType.STRING, 'name', None, None, ), # 3
)
def __init__(self, role=None, environment=None, name=None,):
self.role = role
self.environment = environment
self.name = name
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.role = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.environment = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.name = iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobKey')
if self.role is not None:
oprot.writeFieldBegin('role', TType.STRING, 1)
oprot.writeString(self.role)
oprot.writeFieldEnd()
if self.environment is not None:
oprot.writeFieldBegin('environment', TType.STRING, 2)
oprot.writeString(self.environment)
oprot.writeFieldEnd()
if self.name is not None:
oprot.writeFieldBegin('name', TType.STRING, 3)
oprot.writeString(self.name)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.role)
value = (value * 31) ^ hash(self.environment)
value = (value * 31) ^ hash(self.name)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class LockKey:
"""
A unique lock key.
Attributes:
- job
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'job', (JobKey, JobKey.thrift_spec), None, ), # 1
)
def __init__(self, job=None,):
self.job = job
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.job = JobKey()
self.job.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('LockKey')
if self.job is not None:
oprot.writeFieldBegin('job', TType.STRUCT, 1)
self.job.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.job)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Lock:
"""
A generic lock struct to facilitate context specific resource/operation serialization.
Attributes:
- key: ID of the lock - unique per storage
- token: UUID - facilitating soft lock authorization
- user: Lock creator
- timestampMs: Lock creation timestamp in milliseconds
- message: Optional message to record with the lock
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'key', (LockKey, LockKey.thrift_spec), None, ), # 1
(2, TType.STRING, 'token', None, None, ), # 2
(3, TType.STRING, 'user', None, None, ), # 3
(4, TType.I64, 'timestampMs', None, None, ), # 4
(5, TType.STRING, 'message', None, None, ), # 5
)
def __init__(self, key=None, token=None, user=None, timestampMs=None, message=None,):
self.key = key
self.token = token
self.user = user
self.timestampMs = timestampMs
self.message = message
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.key = LockKey()
self.key.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.token = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.user = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.I64:
self.timestampMs = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.STRING:
self.message = iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Lock')
if self.key is not None:
oprot.writeFieldBegin('key', TType.STRUCT, 1)
self.key.write(oprot)
oprot.writeFieldEnd()
if self.token is not None:
oprot.writeFieldBegin('token', TType.STRING, 2)
oprot.writeString(self.token)
oprot.writeFieldEnd()
if self.user is not None:
oprot.writeFieldBegin('user', TType.STRING, 3)
oprot.writeString(self.user)
oprot.writeFieldEnd()
if self.timestampMs is not None:
oprot.writeFieldBegin('timestampMs', TType.I64, 4)
oprot.writeI64(self.timestampMs)
oprot.writeFieldEnd()
if self.message is not None:
oprot.writeFieldBegin('message', TType.STRING, 5)
oprot.writeString(self.message)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.key)
value = (value * 31) ^ hash(self.token)
value = (value * 31) ^ hash(self.user)
value = (value * 31) ^ hash(self.timestampMs)
value = (value * 31) ^ hash(self.message)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class InstanceKey:
"""
A unique identifier for the active task within a job.
Attributes:
- jobKey: Key identifying the job.
- instanceId: Unique instance ID for the active task in a job.
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'jobKey', (JobKey, JobKey.thrift_spec), None, ), # 1
(2, TType.I32, 'instanceId', None, None, ), # 2
)
def __init__(self, jobKey=None, instanceId=None,):
self.jobKey = jobKey
self.instanceId = instanceId
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.jobKey = JobKey()
self.jobKey.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.instanceId = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('InstanceKey')
if self.jobKey is not None:
oprot.writeFieldBegin('jobKey', TType.STRUCT, 1)
self.jobKey.write(oprot)
oprot.writeFieldEnd()
if self.instanceId is not None:
oprot.writeFieldBegin('instanceId', TType.I32, 2)
oprot.writeI32(self.instanceId)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.jobKey)
value = (value * 31) ^ hash(self.instanceId)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class ExecutorConfig:
"""
Attributes:
- name: Name identifying the Executor.
- data: Executor configuration data.
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'name', None, None, ), # 1
(2, TType.STRING, 'data', None, None, ), # 2
)
def __init__(self, name=None, data=None,):
self.name = name
self.data = data
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.name = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.data = iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('ExecutorConfig')
if self.name is not None:
oprot.writeFieldBegin('name', TType.STRING, 1)
oprot.writeString(self.name)
oprot.writeFieldEnd()
if self.data is not None:
oprot.writeFieldBegin('data', TType.STRING, 2)
oprot.writeString(self.data)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.name)
value = (value * 31) ^ hash(self.data)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Volume:
"""
A volume mount point within a container
Attributes:
- containerPath: The path inside the container where the mount will be created.
- hostPath: The path on the host that will serve as the source for the mount.
- mode: The access mode
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'containerPath', None, None, ), # 1
(2, TType.STRING, 'hostPath', None, None, ), # 2
(3, TType.I32, 'mode', None, None, ), # 3
)
def __init__(self, containerPath=None, hostPath=None, mode=None,):
self.containerPath = containerPath
self.hostPath = hostPath
self.mode = mode
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.containerPath = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.hostPath = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.mode = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Volume')
if self.containerPath is not None:
oprot.writeFieldBegin('containerPath', TType.STRING, 1)
oprot.writeString(self.containerPath)
oprot.writeFieldEnd()
if self.hostPath is not None:
oprot.writeFieldBegin('hostPath', TType.STRING, 2)
oprot.writeString(self.hostPath)
oprot.writeFieldEnd()
if self.mode is not None:
oprot.writeFieldBegin('mode', TType.I32, 3)
oprot.writeI32(self.mode)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.containerPath)
value = (value * 31) ^ hash(self.hostPath)
value = (value * 31) ^ hash(self.mode)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class MesosContainer:
"""
Describes a mesos container, this is the default
"""
thrift_spec = (
)
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('MesosContainer')
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class DockerContainer:
"""
Describes a docker container
Attributes:
- image: The container image to be run
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'image', None, None, ), # 1
)
def __init__(self, image=None,):
self.image = image
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.image = iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('DockerContainer')
if self.image is not None:
oprot.writeFieldBegin('image', TType.STRING, 1)
oprot.writeString(self.image)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.image)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Container:
"""
Describes a container to be used in a task
Attributes:
- mesos
- docker
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'mesos', (MesosContainer, MesosContainer.thrift_spec), None, ), # 1
(2, TType.STRUCT, 'docker', (DockerContainer, DockerContainer.thrift_spec), None, ), # 2
)
def __init__(self, mesos=None, docker=None,):
self.mesos = mesos
self.docker = docker
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.mesos = MesosContainer()
self.mesos.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.docker = DockerContainer()
self.docker.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Container')
if self.mesos is not None:
oprot.writeFieldBegin('mesos', TType.STRUCT, 1)
self.mesos.write(oprot)
oprot.writeFieldEnd()
if self.docker is not None:
oprot.writeFieldBegin('docker', TType.STRUCT, 2)
self.docker.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.mesos)
value = (value * 31) ^ hash(self.docker)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class TaskConfig:
"""
Description of the tasks contained within a job.
Attributes:
- job: Job task belongs to.
- owner: contains the role component of JobKey
- environment: contains the environment component of JobKey
- jobName: contains the name component of JobKey
- isService
- numCpus
- ramMb
- diskMb
- priority
- maxTaskFailures
- production: Whether this is a production task, which can preempt.
- constraints
- requestedPorts: a list of named ports this task requests
- container: the container the task should use to execute
- taskLinks: Custom links to include when displaying this task on the scheduler dashboard. Keys are anchor
text, values are URLs. Wildcards are supported for dynamic link crafting based on host, ports,
instance, etc.
- contactEmail
- executorConfig: Executor configuration
- metadata: Used to display additional details in the UI.
"""
thrift_spec = (
None, # 0
None, # 1
None, # 2
(3, TType.STRING, 'jobName', None, None, ), # 3
None, # 4
None, # 5
None, # 6
(7, TType.BOOL, 'isService', None, None, ), # 7
(8, TType.DOUBLE, 'numCpus', None, None, ), # 8
(9, TType.I64, 'ramMb', None, None, ), # 9
(10, TType.I64, 'diskMb', None, None, ), # 10
(11, TType.I32, 'priority', None, None, ), # 11
None, # 12
(13, TType.I32, 'maxTaskFailures', None, None, ), # 13
None, # 14
None, # 15
None, # 16
(17, TType.STRUCT, 'owner', (Identity, Identity.thrift_spec), None, ), # 17
(18, TType.BOOL, 'production', None, None, ), # 18
None, # 19
(20, TType.SET, 'constraints', (TType.STRUCT,(Constraint, Constraint.thrift_spec)), None, ), # 20
(21, TType.SET, 'requestedPorts', (TType.STRING,None), None, ), # 21
(22, TType.MAP, 'taskLinks', (TType.STRING,None,TType.STRING,None), None, ), # 22
(23, TType.STRING, 'contactEmail', None, None, ), # 23
None, # 24
(25, TType.STRUCT, 'executorConfig', (ExecutorConfig, ExecutorConfig.thrift_spec), None, ), # 25
(26, TType.STRING, 'environment', None, None, ), # 26
(27, TType.SET, 'metadata', (TType.STRUCT,(Metadata, Metadata.thrift_spec)), None, ), # 27
(28, TType.STRUCT, 'job', (JobKey, JobKey.thrift_spec), None, ), # 28
(29, TType.STRUCT, 'container', (Container, Container.thrift_spec), Container(**{
"mesos" : MesosContainer(**{
}),
}), ), # 29
)
def __init__(self, job=None, owner=None, environment=None, jobName=None, isService=None, numCpus=None, ramMb=None, diskMb=None, priority=None, maxTaskFailures=None, production=None, constraints=None, requestedPorts=None, container=thrift_spec[29][4], taskLinks=None, contactEmail=None, executorConfig=None, metadata=None,):
self.job = job
self.owner = owner
self.environment = environment
self.jobName = jobName
self.isService = isService
self.numCpus = numCpus
self.ramMb = ramMb
self.diskMb = diskMb
self.priority = priority
self.maxTaskFailures = maxTaskFailures
self.production = production
self.constraints = constraints
self.requestedPorts = requestedPorts
if container is self.thrift_spec[29][4]:
container = Container(**{
"mesos" : MesosContainer(**{
}),
})
self.container = container
self.taskLinks = taskLinks
self.contactEmail = contactEmail
self.executorConfig = executorConfig
self.metadata = metadata
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 28:
if ftype == TType.STRUCT:
self.job = JobKey()
self.job.read(iprot)
else:
iprot.skip(ftype)
elif fid == 17:
if ftype == TType.STRUCT:
self.owner = Identity()
self.owner.read(iprot)
else:
iprot.skip(ftype)
elif fid == 26:
if ftype == TType.STRING:
self.environment = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.jobName = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 7:
if ftype == TType.BOOL:
self.isService = iprot.readBool()
else:
iprot.skip(ftype)
elif fid == 8:
if ftype == TType.DOUBLE:
self.numCpus = iprot.readDouble()
else:
iprot.skip(ftype)
elif fid == 9:
if ftype == TType.I64:
self.ramMb = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 10:
if ftype == TType.I64:
self.diskMb = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 11:
if ftype == TType.I32:
self.priority = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 13:
if ftype == TType.I32:
self.maxTaskFailures = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 18:
if ftype == TType.BOOL:
self.production = iprot.readBool()
else:
iprot.skip(ftype)
elif fid == 20:
if ftype == TType.SET:
self.constraints = set()
(_etype24, _size21) = iprot.readSetBegin()
for _i25 in range(_size21):
_elem26 = Constraint()
_elem26.read(iprot)
self.constraints.add(_elem26)
iprot.readSetEnd()
else:
iprot.skip(ftype)
elif fid == 21:
if ftype == TType.SET:
self.requestedPorts = set()
(_etype30, _size27) = iprot.readSetBegin()
for _i31 in range(_size27):
_elem32 = iprot.readString()
self.requestedPorts.add(_elem32)
iprot.readSetEnd()
else:
iprot.skip(ftype)
elif fid == 29:
if ftype == TType.STRUCT:
self.container = Container()
self.container.read(iprot)
else:
iprot.skip(ftype)
elif fid == 22:
if ftype == TType.MAP:
self.taskLinks = {}
(_ktype34, _vtype35, _size33 ) = iprot.readMapBegin()
for _i37 in range(_size33):
_key38 = iprot.readString()
_val39 = iprot.readString()
self.taskLinks[_key38] = _val39
iprot.readMapEnd()
else:
iprot.skip(ftype)
elif fid == 23:
if ftype == TType.STRING:
self.contactEmail = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 25:
if ftype == TType.STRUCT:
self.executorConfig = ExecutorConfig()
self.executorConfig.read(iprot)
else:
iprot.skip(ftype)
elif fid == 27:
if ftype == TType.SET:
self.metadata = set()
(_etype43, _size40) = iprot.readSetBegin()
for _i44 in range(_size40):
_elem45 = Metadata()
_elem45.read(iprot)
self.metadata.add(_elem45)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('TaskConfig')
if self.jobName is not None:
oprot.writeFieldBegin('jobName', TType.STRING, 3)
oprot.writeString(self.jobName)
oprot.writeFieldEnd()
if self.isService is not None:
oprot.writeFieldBegin('isService', TType.BOOL, 7)
oprot.writeBool(self.isService)
oprot.writeFieldEnd()
if self.numCpus is not None:
oprot.writeFieldBegin('numCpus', TType.DOUBLE, 8)
oprot.writeDouble(self.numCpus)
oprot.writeFieldEnd()
if self.ramMb is not None:
oprot.writeFieldBegin('ramMb', TType.I64, 9)
oprot.writeI64(self.ramMb)
oprot.writeFieldEnd()
if self.diskMb is not None:
oprot.writeFieldBegin('diskMb', TType.I64, 10)
oprot.writeI64(self.diskMb)
oprot.writeFieldEnd()
if self.priority is not None:
oprot.writeFieldBegin('priority', TType.I32, 11)
oprot.writeI32(self.priority)
oprot.writeFieldEnd()
if self.maxTaskFailures is not None:
oprot.writeFieldBegin('maxTaskFailures', TType.I32, 13)
oprot.writeI32(self.maxTaskFailures)
oprot.writeFieldEnd()
if self.owner is not None:
oprot.writeFieldBegin('owner', TType.STRUCT, 17)
self.owner.write(oprot)
oprot.writeFieldEnd()
if self.production is not None:
oprot.writeFieldBegin('production', TType.BOOL, 18)
oprot.writeBool(self.production)
oprot.writeFieldEnd()
if self.constraints is not None:
oprot.writeFieldBegin('constraints', TType.SET, 20)
oprot.writeSetBegin(TType.STRUCT, len(self.constraints))
for iter46 in self.constraints:
iter46.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
if self.requestedPorts is not None:
oprot.writeFieldBegin('requestedPorts', TType.SET, 21)
oprot.writeSetBegin(TType.STRING, len(self.requestedPorts))
for iter47 in self.requestedPorts:
oprot.writeString(iter47)
oprot.writeSetEnd()
oprot.writeFieldEnd()
if self.taskLinks is not None:
oprot.writeFieldBegin('taskLinks', TType.MAP, 22)
oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.taskLinks))
for kiter48,viter49 in self.taskLinks.items():
oprot.writeString(kiter48)
oprot.writeString(viter49)
oprot.writeMapEnd()
oprot.writeFieldEnd()
if self.contactEmail is not None:
oprot.writeFieldBegin('contactEmail', TType.STRING, 23)
oprot.writeString(self.contactEmail)
oprot.writeFieldEnd()
if self.executorConfig is not None:
oprot.writeFieldBegin('executorConfig', TType.STRUCT, 25)
self.executorConfig.write(oprot)
oprot.writeFieldEnd()
if self.environment is not None:
oprot.writeFieldBegin('environment', TType.STRING, 26)
oprot.writeString(self.environment)
oprot.writeFieldEnd()
if self.metadata is not None:
oprot.writeFieldBegin('metadata', TType.SET, 27)
oprot.writeSetBegin(TType.STRUCT, len(self.metadata))
for iter50 in self.metadata:
iter50.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
if self.job is not None:
oprot.writeFieldBegin('job', TType.STRUCT, 28)
self.job.write(oprot)
oprot.writeFieldEnd()
if self.container is not None:
oprot.writeFieldBegin('container', TType.STRUCT, 29)
self.container.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.job)
value = (value * 31) ^ hash(self.owner)
value = (value * 31) ^ hash(self.environment)
value = (value * 31) ^ hash(self.jobName)
value = (value * 31) ^ hash(self.isService)
value = (value * 31) ^ hash(self.numCpus)
value = (value * 31) ^ hash(self.ramMb)
value = (value * 31) ^ hash(self.diskMb)
value = (value * 31) ^ hash(self.priority)
value = (value * 31) ^ hash(self.maxTaskFailures)
value = (value * 31) ^ hash(self.production)
value = (value * 31) ^ hash(self.constraints)
value = (value * 31) ^ hash(self.requestedPorts)
value = (value * 31) ^ hash(self.container)
value = (value * 31) ^ hash(self.taskLinks)
value = (value * 31) ^ hash(self.contactEmail)
value = (value * 31) ^ hash(self.executorConfig)
value = (value * 31) ^ hash(self.metadata)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobConfiguration:
"""
Description of an Aurora job. One task will be scheduled for each instance within the job.
Attributes:
- key: Key for this job. If not specified name, owner.role, and a reasonable default environment are
used to construct it server-side.
- owner: Owner of this job.
- cronSchedule: If present, the job will be handled as a cron job with this crontab-syntax schedule.
- cronCollisionPolicy: Collision policy to use when handling overlapping cron runs. Default is KILL_EXISTING.
- taskConfig: Task configuration for this job.
- instanceCount: The number of instances in the job. Generated instance IDs for tasks will be in the range
[0, instances).
"""
thrift_spec = (
None, # 0
None, # 1
None, # 2
None, # 3
(4, TType.STRING, 'cronSchedule', None, None, ), # 4
(5, TType.I32, 'cronCollisionPolicy', None, None, ), # 5
(6, TType.STRUCT, 'taskConfig', (TaskConfig, TaskConfig.thrift_spec), None, ), # 6
(7, TType.STRUCT, 'owner', (Identity, Identity.thrift_spec), None, ), # 7
(8, TType.I32, 'instanceCount', None, None, ), # 8
(9, TType.STRUCT, 'key', (JobKey, JobKey.thrift_spec), None, ), # 9
)
def __init__(self, key=None, owner=None, cronSchedule=None, cronCollisionPolicy=None, taskConfig=None, instanceCount=None,):
self.key = key
self.owner = owner
self.cronSchedule = cronSchedule
self.cronCollisionPolicy = cronCollisionPolicy
self.taskConfig = taskConfig
self.instanceCount = instanceCount
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 9:
if ftype == TType.STRUCT:
self.key = JobKey()
self.key.read(iprot)
else:
iprot.skip(ftype)
elif fid == 7:
if ftype == TType.STRUCT:
self.owner = Identity()
self.owner.read(iprot)
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
self.cronSchedule = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.I32:
self.cronCollisionPolicy = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.STRUCT:
self.taskConfig = TaskConfig()
self.taskConfig.read(iprot)
else:
iprot.skip(ftype)
elif fid == 8:
if ftype == TType.I32:
self.instanceCount = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobConfiguration')
if self.cronSchedule is not None:
oprot.writeFieldBegin('cronSchedule', TType.STRING, 4)
oprot.writeString(self.cronSchedule)
oprot.writeFieldEnd()
if self.cronCollisionPolicy is not None:
oprot.writeFieldBegin('cronCollisionPolicy', TType.I32, 5)
oprot.writeI32(self.cronCollisionPolicy)
oprot.writeFieldEnd()
if self.taskConfig is not None:
oprot.writeFieldBegin('taskConfig', TType.STRUCT, 6)
self.taskConfig.write(oprot)
oprot.writeFieldEnd()
if self.owner is not None:
oprot.writeFieldBegin('owner', TType.STRUCT, 7)
self.owner.write(oprot)
oprot.writeFieldEnd()
if self.instanceCount is not None:
oprot.writeFieldBegin('instanceCount', TType.I32, 8)
oprot.writeI32(self.instanceCount)
oprot.writeFieldEnd()
if self.key is not None:
oprot.writeFieldBegin('key', TType.STRUCT, 9)
self.key.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.key)
value = (value * 31) ^ hash(self.owner)
value = (value * 31) ^ hash(self.cronSchedule)
value = (value * 31) ^ hash(self.cronCollisionPolicy)
value = (value * 31) ^ hash(self.taskConfig)
value = (value * 31) ^ hash(self.instanceCount)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobStats:
"""
Attributes:
- activeTaskCount: Number of tasks in active state for this job.
- finishedTaskCount: Number of tasks in finished state for this job.
- failedTaskCount: Number of failed tasks for this job.
- pendingTaskCount: Number of tasks in pending state for this job.
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'activeTaskCount', None, None, ), # 1
(2, TType.I32, 'finishedTaskCount', None, None, ), # 2
(3, TType.I32, 'failedTaskCount', None, None, ), # 3
(4, TType.I32, 'pendingTaskCount', None, None, ), # 4
)
def __init__(self, activeTaskCount=None, finishedTaskCount=None, failedTaskCount=None, pendingTaskCount=None,):
self.activeTaskCount = activeTaskCount
self.finishedTaskCount = finishedTaskCount
self.failedTaskCount = failedTaskCount
self.pendingTaskCount = pendingTaskCount
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.activeTaskCount = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.finishedTaskCount = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.failedTaskCount = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.I32:
self.pendingTaskCount = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobStats')
if self.activeTaskCount is not None:
oprot.writeFieldBegin('activeTaskCount', TType.I32, 1)
oprot.writeI32(self.activeTaskCount)
oprot.writeFieldEnd()
if self.finishedTaskCount is not None:
oprot.writeFieldBegin('finishedTaskCount', TType.I32, 2)
oprot.writeI32(self.finishedTaskCount)
oprot.writeFieldEnd()
if self.failedTaskCount is not None:
oprot.writeFieldBegin('failedTaskCount', TType.I32, 3)
oprot.writeI32(self.failedTaskCount)
oprot.writeFieldEnd()
if self.pendingTaskCount is not None:
oprot.writeFieldBegin('pendingTaskCount', TType.I32, 4)
oprot.writeI32(self.pendingTaskCount)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.activeTaskCount)
value = (value * 31) ^ hash(self.finishedTaskCount)
value = (value * 31) ^ hash(self.failedTaskCount)
value = (value * 31) ^ hash(self.pendingTaskCount)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobSummary:
"""
Attributes:
- job
- stats
- nextCronRunMs: Timestamp of next cron run in ms since epoch, for a cron job
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'job', (JobConfiguration, JobConfiguration.thrift_spec), None, ), # 1
(2, TType.STRUCT, 'stats', (JobStats, JobStats.thrift_spec), None, ), # 2
(3, TType.I64, 'nextCronRunMs', None, None, ), # 3
)
def __init__(self, job=None, stats=None, nextCronRunMs=None,):
self.job = job
self.stats = stats
self.nextCronRunMs = nextCronRunMs
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.job = JobConfiguration()
self.job.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.stats = JobStats()
self.stats.read(iprot)
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I64:
self.nextCronRunMs = iprot.readI64()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobSummary')
if self.job is not None:
oprot.writeFieldBegin('job', TType.STRUCT, 1)
self.job.write(oprot)
oprot.writeFieldEnd()
if self.stats is not None:
oprot.writeFieldBegin('stats', TType.STRUCT, 2)
self.stats.write(oprot)
oprot.writeFieldEnd()
if self.nextCronRunMs is not None:
oprot.writeFieldBegin('nextCronRunMs', TType.I64, 3)
oprot.writeI64(self.nextCronRunMs)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.job)
value = (value * 31) ^ hash(self.stats)
value = (value * 31) ^ hash(self.nextCronRunMs)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class AddInstancesConfig:
"""
A request to add the following instances to an existing job. Used by addInstances.
Attributes:
- key
- taskConfig
- instanceIds
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'key', (JobKey, JobKey.thrift_spec), None, ), # 1
(2, TType.STRUCT, 'taskConfig', (TaskConfig, TaskConfig.thrift_spec), None, ), # 2
(3, TType.SET, 'instanceIds', (TType.I32,None), None, ), # 3
)
def __init__(self, key=None, taskConfig=None, instanceIds=None,):
self.key = key
self.taskConfig = taskConfig
self.instanceIds = instanceIds
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.key = JobKey()
self.key.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.taskConfig = TaskConfig()
self.taskConfig.read(iprot)
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.SET:
self.instanceIds = set()
(_etype54, _size51) = iprot.readSetBegin()
for _i55 in range(_size51):
_elem56 = iprot.readI32()
self.instanceIds.add(_elem56)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('AddInstancesConfig')
if self.key is not None:
oprot.writeFieldBegin('key', TType.STRUCT, 1)
self.key.write(oprot)
oprot.writeFieldEnd()
if self.taskConfig is not None:
oprot.writeFieldBegin('taskConfig', TType.STRUCT, 2)
self.taskConfig.write(oprot)
oprot.writeFieldEnd()
if self.instanceIds is not None:
oprot.writeFieldBegin('instanceIds', TType.SET, 3)
oprot.writeSetBegin(TType.I32, len(self.instanceIds))
for iter57 in self.instanceIds:
oprot.writeI32(iter57)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.key)
value = (value * 31) ^ hash(self.taskConfig)
value = (value * 31) ^ hash(self.instanceIds)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Range:
"""
Closed range of integers.
Attributes:
- first
- last
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'first', None, None, ), # 1
(2, TType.I32, 'last', None, None, ), # 2
)
def __init__(self, first=None, last=None,):
self.first = first
self.last = last
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.first = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.last = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Range')
if self.first is not None:
oprot.writeFieldBegin('first', TType.I32, 1)
oprot.writeI32(self.first)
oprot.writeFieldEnd()
if self.last is not None:
oprot.writeFieldBegin('last', TType.I32, 2)
oprot.writeI32(self.last)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.first)
value = (value * 31) ^ hash(self.last)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class ConfigGroup:
"""
Attributes:
- config
- instanceIds
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'config', (TaskConfig, TaskConfig.thrift_spec), None, ), # 1
(2, TType.SET, 'instanceIds', (TType.I32,None), None, ), # 2
)
def __init__(self, config=None, instanceIds=None,):
self.config = config
self.instanceIds = instanceIds
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.config = TaskConfig()
self.config.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.SET:
self.instanceIds = set()
(_etype61, _size58) = iprot.readSetBegin()
for _i62 in range(_size58):
_elem63 = iprot.readI32()
self.instanceIds.add(_elem63)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('ConfigGroup')
if self.config is not None:
oprot.writeFieldBegin('config', TType.STRUCT, 1)
self.config.write(oprot)
oprot.writeFieldEnd()
if self.instanceIds is not None:
oprot.writeFieldBegin('instanceIds', TType.SET, 2)
oprot.writeSetBegin(TType.I32, len(self.instanceIds))
for iter64 in self.instanceIds:
oprot.writeI32(iter64)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.config)
value = (value * 31) ^ hash(self.instanceIds)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class ConfigSummary:
"""
Attributes:
- key
- groups
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'key', (JobKey, JobKey.thrift_spec), None, ), # 1
(2, TType.SET, 'groups', (TType.STRUCT,(ConfigGroup, ConfigGroup.thrift_spec)), None, ), # 2
)
def __init__(self, key=None, groups=None,):
self.key = key
self.groups = groups
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.key = JobKey()
self.key.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.SET:
self.groups = set()
(_etype68, _size65) = iprot.readSetBegin()
for _i69 in range(_size65):
_elem70 = ConfigGroup()
_elem70.read(iprot)
self.groups.add(_elem70)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('ConfigSummary')
if self.key is not None:
oprot.writeFieldBegin('key', TType.STRUCT, 1)
self.key.write(oprot)
oprot.writeFieldEnd()
if self.groups is not None:
oprot.writeFieldBegin('groups', TType.SET, 2)
oprot.writeSetBegin(TType.STRUCT, len(self.groups))
for iter71 in self.groups:
iter71.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.key)
value = (value * 31) ^ hash(self.groups)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class PopulateJobResult:
"""
Attributes:
- populatedDEPRECATED
- taskConfig
"""
thrift_spec = (
None, # 0
(1, TType.SET, 'populatedDEPRECATED', (TType.STRUCT,(TaskConfig, TaskConfig.thrift_spec)), None, ), # 1
(2, TType.STRUCT, 'taskConfig', (TaskConfig, TaskConfig.thrift_spec), None, ), # 2
)
def __init__(self, populatedDEPRECATED=None, taskConfig=None,):
self.populatedDEPRECATED = populatedDEPRECATED
self.taskConfig = taskConfig
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.SET:
self.populatedDEPRECATED = set()
(_etype75, _size72) = iprot.readSetBegin()
for _i76 in range(_size72):
_elem77 = TaskConfig()
_elem77.read(iprot)
self.populatedDEPRECATED.add(_elem77)
iprot.readSetEnd()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.taskConfig = TaskConfig()
self.taskConfig.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('PopulateJobResult')
if self.populatedDEPRECATED is not None:
oprot.writeFieldBegin('populatedDEPRECATED', TType.SET, 1)
oprot.writeSetBegin(TType.STRUCT, len(self.populatedDEPRECATED))
for iter78 in self.populatedDEPRECATED:
iter78.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
if self.taskConfig is not None:
oprot.writeFieldBegin('taskConfig', TType.STRUCT, 2)
self.taskConfig.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.populatedDEPRECATED)
value = (value * 31) ^ hash(self.taskConfig)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class GetQuotaResult:
"""
Attributes:
- quota: Total allocated resource quota.
- prodConsumption: Resources consumed by production jobs.
- nonProdConsumption: Resources consumed by non-production jobs.
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'quota', (ResourceAggregate, ResourceAggregate.thrift_spec), None, ), # 1
(2, TType.STRUCT, 'prodConsumption', (ResourceAggregate, ResourceAggregate.thrift_spec), None, ), # 2
(3, TType.STRUCT, 'nonProdConsumption', (ResourceAggregate, ResourceAggregate.thrift_spec), None, ), # 3
)
def __init__(self, quota=None, prodConsumption=None, nonProdConsumption=None,):
self.quota = quota
self.prodConsumption = prodConsumption
self.nonProdConsumption = nonProdConsumption
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.quota = ResourceAggregate()
self.quota.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.prodConsumption = ResourceAggregate()
self.prodConsumption.read(iprot)
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRUCT:
self.nonProdConsumption = ResourceAggregate()
self.nonProdConsumption.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('GetQuotaResult')
if self.quota is not None:
oprot.writeFieldBegin('quota', TType.STRUCT, 1)
self.quota.write(oprot)
oprot.writeFieldEnd()
if self.prodConsumption is not None:
oprot.writeFieldBegin('prodConsumption', TType.STRUCT, 2)
self.prodConsumption.write(oprot)
oprot.writeFieldEnd()
if self.nonProdConsumption is not None:
oprot.writeFieldBegin('nonProdConsumption', TType.STRUCT, 3)
self.nonProdConsumption.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.quota)
value = (value * 31) ^ hash(self.prodConsumption)
value = (value * 31) ^ hash(self.nonProdConsumption)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class AcquireLockResult:
"""
Wraps return results for the acquireLock API.
Attributes:
- lock: Acquired Lock instance.
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'lock', (Lock, Lock.thrift_spec), None, ), # 1
)
def __init__(self, lock=None,):
self.lock = lock
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.lock = Lock()
self.lock.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('AcquireLockResult')
if self.lock is not None:
oprot.writeFieldBegin('lock', TType.STRUCT, 1)
self.lock.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.lock)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class TaskEvent:
"""
Event marking a state transition within a task's lifecycle.
Attributes:
- timestamp: Epoch timestamp in milliseconds.
- status: New status of the task.
- message: Audit message that explains why a transition occurred.
- scheduler: Hostname of the scheduler machine that performed the event.
"""
thrift_spec = (
None, # 0
(1, TType.I64, 'timestamp', None, None, ), # 1
(2, TType.I32, 'status', None, None, ), # 2
(3, TType.STRING, 'message', None, None, ), # 3
(4, TType.STRING, 'scheduler', None, None, ), # 4
)
def __init__(self, timestamp=None, status=None, message=None, scheduler=None,):
self.timestamp = timestamp
self.status = status
self.message = message
self.scheduler = scheduler
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I64:
self.timestamp = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.status = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.message = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
self.scheduler = iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('TaskEvent')
if self.timestamp is not None:
oprot.writeFieldBegin('timestamp', TType.I64, 1)
oprot.writeI64(self.timestamp)
oprot.writeFieldEnd()
if self.status is not None:
oprot.writeFieldBegin('status', TType.I32, 2)
oprot.writeI32(self.status)
oprot.writeFieldEnd()
if self.message is not None:
oprot.writeFieldBegin('message', TType.STRING, 3)
oprot.writeString(self.message)
oprot.writeFieldEnd()
if self.scheduler is not None:
oprot.writeFieldBegin('scheduler', TType.STRING, 4)
oprot.writeString(self.scheduler)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.timestamp)
value = (value * 31) ^ hash(self.status)
value = (value * 31) ^ hash(self.message)
value = (value * 31) ^ hash(self.scheduler)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class AssignedTask:
"""
A task assignment that is provided to an executor.
Attributes:
- taskId: The mesos task ID for this task. Guaranteed to be globally unique
- slaveId: The mesos slave ID that this task has been assigned to.
This will not be populated for a PENDING task.
- slaveHost: The name of the machine that this task has been assigned to.
This will not be populated for a PENDING task.
- task: Information about how to run this task.
- assignedPorts: Ports reserved on the machine while this task is running.
- instanceId: The instance ID assigned to this task. Instance IDs must be unique and contiguous within a
job, and will be in the range [0, N-1] (inclusive) for a job that has N instances.
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'taskId', None, None, ), # 1
(2, TType.STRING, 'slaveId', None, None, ), # 2
(3, TType.STRING, 'slaveHost', None, None, ), # 3
(4, TType.STRUCT, 'task', (TaskConfig, TaskConfig.thrift_spec), None, ), # 4
(5, TType.MAP, 'assignedPorts', (TType.STRING,None,TType.I32,None), None, ), # 5
(6, TType.I32, 'instanceId', None, None, ), # 6
)
def __init__(self, taskId=None, slaveId=None, slaveHost=None, task=None, assignedPorts=None, instanceId=None,):
self.taskId = taskId
self.slaveId = slaveId
self.slaveHost = slaveHost
self.task = task
self.assignedPorts = assignedPorts
self.instanceId = instanceId
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.taskId = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.slaveId = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.slaveHost = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRUCT:
self.task = TaskConfig()
self.task.read(iprot)
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.MAP:
self.assignedPorts = {}
(_ktype80, _vtype81, _size79 ) = iprot.readMapBegin()
for _i83 in range(_size79):
_key84 = iprot.readString()
_val85 = iprot.readI32()
self.assignedPorts[_key84] = _val85
iprot.readMapEnd()
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.I32:
self.instanceId = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('AssignedTask')
if self.taskId is not None:
oprot.writeFieldBegin('taskId', TType.STRING, 1)
oprot.writeString(self.taskId)
oprot.writeFieldEnd()
if self.slaveId is not None:
oprot.writeFieldBegin('slaveId', TType.STRING, 2)
oprot.writeString(self.slaveId)
oprot.writeFieldEnd()
if self.slaveHost is not None:
oprot.writeFieldBegin('slaveHost', TType.STRING, 3)
oprot.writeString(self.slaveHost)
oprot.writeFieldEnd()
if self.task is not None:
oprot.writeFieldBegin('task', TType.STRUCT, 4)
self.task.write(oprot)
oprot.writeFieldEnd()
if self.assignedPorts is not None:
oprot.writeFieldBegin('assignedPorts', TType.MAP, 5)
oprot.writeMapBegin(TType.STRING, TType.I32, len(self.assignedPorts))
for kiter86,viter87 in self.assignedPorts.items():
oprot.writeString(kiter86)
oprot.writeI32(viter87)
oprot.writeMapEnd()
oprot.writeFieldEnd()
if self.instanceId is not None:
oprot.writeFieldBegin('instanceId', TType.I32, 6)
oprot.writeI32(self.instanceId)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.taskId)
value = (value * 31) ^ hash(self.slaveId)
value = (value * 31) ^ hash(self.slaveHost)
value = (value * 31) ^ hash(self.task)
value = (value * 31) ^ hash(self.assignedPorts)
value = (value * 31) ^ hash(self.instanceId)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class ScheduledTask:
"""
A task that has been scheduled.
Attributes:
- assignedTask: The task that was scheduled.
- status: The current status of this task.
- failureCount: The number of failures that this task has accumulated over the multi-generational history of
this task.
- taskEvents: State change history for this task.
- ancestorId: The task ID of the previous generation of this task. When a task is automatically rescheduled,
a copy of the task is created and ancestor ID of the previous task's task ID.
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'assignedTask', (AssignedTask, AssignedTask.thrift_spec), None, ), # 1
(2, TType.I32, 'status', None, None, ), # 2
(3, TType.I32, 'failureCount', None, None, ), # 3
(4, TType.LIST, 'taskEvents', (TType.STRUCT,(TaskEvent, TaskEvent.thrift_spec)), None, ), # 4
(5, TType.STRING, 'ancestorId', None, None, ), # 5
)
def __init__(self, assignedTask=None, status=None, failureCount=None, taskEvents=None, ancestorId=None,):
self.assignedTask = assignedTask
self.status = status
self.failureCount = failureCount
self.taskEvents = taskEvents
self.ancestorId = ancestorId
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.assignedTask = AssignedTask()
self.assignedTask.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.status = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.failureCount = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.LIST:
self.taskEvents = []
(_etype91, _size88) = iprot.readListBegin()
for _i92 in range(_size88):
_elem93 = TaskEvent()
_elem93.read(iprot)
self.taskEvents.append(_elem93)
iprot.readListEnd()
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.STRING:
self.ancestorId = iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('ScheduledTask')
if self.assignedTask is not None:
oprot.writeFieldBegin('assignedTask', TType.STRUCT, 1)
self.assignedTask.write(oprot)
oprot.writeFieldEnd()
if self.status is not None:
oprot.writeFieldBegin('status', TType.I32, 2)
oprot.writeI32(self.status)
oprot.writeFieldEnd()
if self.failureCount is not None:
oprot.writeFieldBegin('failureCount', TType.I32, 3)
oprot.writeI32(self.failureCount)
oprot.writeFieldEnd()
if self.taskEvents is not None:
oprot.writeFieldBegin('taskEvents', TType.LIST, 4)
oprot.writeListBegin(TType.STRUCT, len(self.taskEvents))
for iter94 in self.taskEvents:
iter94.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.ancestorId is not None:
oprot.writeFieldBegin('ancestorId', TType.STRING, 5)
oprot.writeString(self.ancestorId)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.assignedTask)
value = (value * 31) ^ hash(self.status)
value = (value * 31) ^ hash(self.failureCount)
value = (value * 31) ^ hash(self.taskEvents)
value = (value * 31) ^ hash(self.ancestorId)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class ScheduleStatusResult:
"""
Attributes:
- tasks
"""
thrift_spec = (
None, # 0
(1, TType.LIST, 'tasks', (TType.STRUCT,(ScheduledTask, ScheduledTask.thrift_spec)), None, ), # 1
)
def __init__(self, tasks=None,):
self.tasks = tasks
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.LIST:
self.tasks = []
(_etype98, _size95) = iprot.readListBegin()
for _i99 in range(_size95):
_elem100 = ScheduledTask()
_elem100.read(iprot)
self.tasks.append(_elem100)
iprot.readListEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('ScheduleStatusResult')
if self.tasks is not None:
oprot.writeFieldBegin('tasks', TType.LIST, 1)
oprot.writeListBegin(TType.STRUCT, len(self.tasks))
for iter101 in self.tasks:
iter101.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.tasks)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class GetJobsResult:
"""
Attributes:
- configs
"""
thrift_spec = (
None, # 0
(1, TType.SET, 'configs', (TType.STRUCT,(JobConfiguration, JobConfiguration.thrift_spec)), None, ), # 1
)
def __init__(self, configs=None,):
self.configs = configs
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.SET:
self.configs = set()
(_etype105, _size102) = iprot.readSetBegin()
for _i106 in range(_size102):
_elem107 = JobConfiguration()
_elem107.read(iprot)
self.configs.add(_elem107)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('GetJobsResult')
if self.configs is not None:
oprot.writeFieldBegin('configs', TType.SET, 1)
oprot.writeSetBegin(TType.STRUCT, len(self.configs))
for iter108 in self.configs:
iter108.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.configs)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class TaskQuery:
"""
Contains a set of restrictions on matching tasks where all restrictions must be met
(terms are AND'ed together).
Attributes:
- owner
- role
- environment
- jobName
- taskIds
- statuses
- instanceIds
- slaveHosts
- jobKeys
- offset
- limit
"""
thrift_spec = (
None, # 0
None, # 1
(2, TType.STRING, 'jobName', None, None, ), # 2
None, # 3
(4, TType.SET, 'taskIds', (TType.STRING,None), None, ), # 4
(5, TType.SET, 'statuses', (TType.I32,None), None, ), # 5
None, # 6
(7, TType.SET, 'instanceIds', (TType.I32,None), None, ), # 7
(8, TType.STRUCT, 'owner', (Identity, Identity.thrift_spec), None, ), # 8
(9, TType.STRING, 'environment', None, None, ), # 9
(10, TType.SET, 'slaveHosts', (TType.STRING,None), None, ), # 10
(11, TType.SET, 'jobKeys', (TType.STRUCT,(JobKey, JobKey.thrift_spec)), None, ), # 11
(12, TType.I32, 'offset', None, None, ), # 12
(13, TType.I32, 'limit', None, None, ), # 13
(14, TType.STRING, 'role', None, None, ), # 14
)
def __init__(self, owner=None, role=None, environment=None, jobName=None, taskIds=None, statuses=None, instanceIds=None, slaveHosts=None, jobKeys=None, offset=None, limit=None,):
self.owner = owner
self.role = role
self.environment = environment
self.jobName = jobName
self.taskIds = taskIds
self.statuses = statuses
self.instanceIds = instanceIds
self.slaveHosts = slaveHosts
self.jobKeys = jobKeys
self.offset = offset
self.limit = limit
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 8:
if ftype == TType.STRUCT:
self.owner = Identity()
self.owner.read(iprot)
else:
iprot.skip(ftype)
elif fid == 14:
if ftype == TType.STRING:
self.role = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 9:
if ftype == TType.STRING:
self.environment = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.jobName = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.SET:
self.taskIds = set()
(_etype112, _size109) = iprot.readSetBegin()
for _i113 in range(_size109):
_elem114 = iprot.readString()
self.taskIds.add(_elem114)
iprot.readSetEnd()
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.SET:
self.statuses = set()
(_etype118, _size115) = iprot.readSetBegin()
for _i119 in range(_size115):
_elem120 = iprot.readI32()
self.statuses.add(_elem120)
iprot.readSetEnd()
else:
iprot.skip(ftype)
elif fid == 7:
if ftype == TType.SET:
self.instanceIds = set()
(_etype124, _size121) = iprot.readSetBegin()
for _i125 in range(_size121):
_elem126 = iprot.readI32()
self.instanceIds.add(_elem126)
iprot.readSetEnd()
else:
iprot.skip(ftype)
elif fid == 10:
if ftype == TType.SET:
self.slaveHosts = set()
(_etype130, _size127) = iprot.readSetBegin()
for _i131 in range(_size127):
_elem132 = iprot.readString()
self.slaveHosts.add(_elem132)
iprot.readSetEnd()
else:
iprot.skip(ftype)
elif fid == 11:
if ftype == TType.SET:
self.jobKeys = set()
(_etype136, _size133) = iprot.readSetBegin()
for _i137 in range(_size133):
_elem138 = JobKey()
_elem138.read(iprot)
self.jobKeys.add(_elem138)
iprot.readSetEnd()
else:
iprot.skip(ftype)
elif fid == 12:
if ftype == TType.I32:
self.offset = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 13:
if ftype == TType.I32:
self.limit = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('TaskQuery')
if self.jobName is not None:
oprot.writeFieldBegin('jobName', TType.STRING, 2)
oprot.writeString(self.jobName)
oprot.writeFieldEnd()
if self.taskIds is not None:
oprot.writeFieldBegin('taskIds', TType.SET, 4)
oprot.writeSetBegin(TType.STRING, len(self.taskIds))
for iter139 in self.taskIds:
oprot.writeString(iter139)
oprot.writeSetEnd()
oprot.writeFieldEnd()
if self.statuses is not None:
oprot.writeFieldBegin('statuses', TType.SET, 5)
oprot.writeSetBegin(TType.I32, len(self.statuses))
for iter140 in self.statuses:
oprot.writeI32(iter140)
oprot.writeSetEnd()
oprot.writeFieldEnd()
if self.instanceIds is not None:
oprot.writeFieldBegin('instanceIds', TType.SET, 7)
oprot.writeSetBegin(TType.I32, len(self.instanceIds))
for iter141 in self.instanceIds:
oprot.writeI32(iter141)
oprot.writeSetEnd()
oprot.writeFieldEnd()
if self.owner is not None:
oprot.writeFieldBegin('owner', TType.STRUCT, 8)
self.owner.write(oprot)
oprot.writeFieldEnd()
if self.environment is not None:
oprot.writeFieldBegin('environment', TType.STRING, 9)
oprot.writeString(self.environment)
oprot.writeFieldEnd()
if self.slaveHosts is not None:
oprot.writeFieldBegin('slaveHosts', TType.SET, 10)
oprot.writeSetBegin(TType.STRING, len(self.slaveHosts))
for iter142 in self.slaveHosts:
oprot.writeString(iter142)
oprot.writeSetEnd()
oprot.writeFieldEnd()
if self.jobKeys is not None:
oprot.writeFieldBegin('jobKeys', TType.SET, 11)
oprot.writeSetBegin(TType.STRUCT, len(self.jobKeys))
for iter143 in self.jobKeys:
iter143.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
if self.offset is not None:
oprot.writeFieldBegin('offset', TType.I32, 12)
oprot.writeI32(self.offset)
oprot.writeFieldEnd()
if self.limit is not None:
oprot.writeFieldBegin('limit', TType.I32, 13)
oprot.writeI32(self.limit)
oprot.writeFieldEnd()
if self.role is not None:
oprot.writeFieldBegin('role', TType.STRING, 14)
oprot.writeString(self.role)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.owner)
value = (value * 31) ^ hash(self.role)
value = (value * 31) ^ hash(self.environment)
value = (value * 31) ^ hash(self.jobName)
value = (value * 31) ^ hash(self.taskIds)
value = (value * 31) ^ hash(self.statuses)
value = (value * 31) ^ hash(self.instanceIds)
value = (value * 31) ^ hash(self.slaveHosts)
value = (value * 31) ^ hash(self.jobKeys)
value = (value * 31) ^ hash(self.offset)
value = (value * 31) ^ hash(self.limit)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class HostStatus:
"""
Attributes:
- host
- mode
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'host', None, None, ), # 1
(2, TType.I32, 'mode', None, None, ), # 2
)
def __init__(self, host=None, mode=None,):
self.host = host
self.mode = mode
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.host = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.mode = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('HostStatus')
if self.host is not None:
oprot.writeFieldBegin('host', TType.STRING, 1)
oprot.writeString(self.host)
oprot.writeFieldEnd()
if self.mode is not None:
oprot.writeFieldBegin('mode', TType.I32, 2)
oprot.writeI32(self.mode)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.host)
value = (value * 31) ^ hash(self.mode)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class RoleSummary:
"""
Attributes:
- role
- jobCount
- cronJobCount
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'role', None, None, ), # 1
(2, TType.I32, 'jobCount', None, None, ), # 2
(3, TType.I32, 'cronJobCount', None, None, ), # 3
)
def __init__(self, role=None, jobCount=None, cronJobCount=None,):
self.role = role
self.jobCount = jobCount
self.cronJobCount = cronJobCount
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.role = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.jobCount = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.cronJobCount = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('RoleSummary')
if self.role is not None:
oprot.writeFieldBegin('role', TType.STRING, 1)
oprot.writeString(self.role)
oprot.writeFieldEnd()
if self.jobCount is not None:
oprot.writeFieldBegin('jobCount', TType.I32, 2)
oprot.writeI32(self.jobCount)
oprot.writeFieldEnd()
if self.cronJobCount is not None:
oprot.writeFieldBegin('cronJobCount', TType.I32, 3)
oprot.writeI32(self.cronJobCount)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.role)
value = (value * 31) ^ hash(self.jobCount)
value = (value * 31) ^ hash(self.cronJobCount)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Hosts:
"""
Attributes:
- hostNames
"""
thrift_spec = (
None, # 0
(1, TType.SET, 'hostNames', (TType.STRING,None), None, ), # 1
)
def __init__(self, hostNames=None,):
self.hostNames = hostNames
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.SET:
self.hostNames = set()
(_etype147, _size144) = iprot.readSetBegin()
for _i148 in range(_size144):
_elem149 = iprot.readString()
self.hostNames.add(_elem149)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Hosts')
if self.hostNames is not None:
oprot.writeFieldBegin('hostNames', TType.SET, 1)
oprot.writeSetBegin(TType.STRING, len(self.hostNames))
for iter150 in self.hostNames:
oprot.writeString(iter150)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.hostNames)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class PendingReason:
"""
Attributes:
- taskId
- reason
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'taskId', None, None, ), # 1
(2, TType.STRING, 'reason', None, None, ), # 2
)
def __init__(self, taskId=None, reason=None,):
self.taskId = taskId
self.reason = reason
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.taskId = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.reason = iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('PendingReason')
if self.taskId is not None:
oprot.writeFieldBegin('taskId', TType.STRING, 1)
oprot.writeString(self.taskId)
oprot.writeFieldEnd()
if self.reason is not None:
oprot.writeFieldBegin('reason', TType.STRING, 2)
oprot.writeString(self.reason)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.taskId)
value = (value * 31) ^ hash(self.reason)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobUpdateKey:
"""
Job update key.
Attributes:
- job: Job being updated
- id: Update ID.
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'job', (JobKey, JobKey.thrift_spec), None, ), # 1
(2, TType.STRING, 'id', None, None, ), # 2
)
def __init__(self, job=None, id=None,):
self.job = job
self.id = id
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.job = JobKey()
self.job.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.id = iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobUpdateKey')
if self.job is not None:
oprot.writeFieldBegin('job', TType.STRUCT, 1)
self.job.write(oprot)
oprot.writeFieldEnd()
if self.id is not None:
oprot.writeFieldBegin('id', TType.STRING, 2)
oprot.writeString(self.id)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.job)
value = (value * 31) ^ hash(self.id)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobUpdateSettings:
"""
Job update thresholds and limits.
Attributes:
- updateGroupSize: Max number of instances being updated at any given moment.
- maxPerInstanceFailures: Max number of instance failures to tolerate before marking instance as FAILED.
- maxFailedInstances: Max number of FAILED instances to tolerate before terminating the update.
- maxWaitToInstanceRunningMs: Max time to wait until an instance reaches RUNNING state.
- minWaitInInstanceRunningMs: Min time to watch a RUNNING instance.
- rollbackOnFailure: If true, enables failed update rollback.
- updateOnlyTheseInstances: Instance IDs to act on. All instances will be affected if this is not set.
- waitForBatchCompletion: If true, use updateGroupSize as strict batching boundaries, and avoid proceeding to another
batch until the preceding batch finishes updating.
- blockIfNoPulsesAfterMs: If set, requires external calls to pulseJobUpdate RPC within the specified rate for the
update to make progress. If no pulses received within specified interval the update will
block. A blocked update is unable to continue but retains its current status. It may only get
unblocked by a fresh pulseJobUpdate call.
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'updateGroupSize', None, None, ), # 1
(2, TType.I32, 'maxPerInstanceFailures', None, None, ), # 2
(3, TType.I32, 'maxFailedInstances', None, None, ), # 3
(4, TType.I32, 'maxWaitToInstanceRunningMs', None, None, ), # 4
(5, TType.I32, 'minWaitInInstanceRunningMs', None, None, ), # 5
(6, TType.BOOL, 'rollbackOnFailure', None, None, ), # 6
(7, TType.SET, 'updateOnlyTheseInstances', (TType.STRUCT,(Range, Range.thrift_spec)), None, ), # 7
(8, TType.BOOL, 'waitForBatchCompletion', None, None, ), # 8
(9, TType.I32, 'blockIfNoPulsesAfterMs', None, None, ), # 9
)
def __init__(self, updateGroupSize=None, maxPerInstanceFailures=None, maxFailedInstances=None, maxWaitToInstanceRunningMs=None, minWaitInInstanceRunningMs=None, rollbackOnFailure=None, updateOnlyTheseInstances=None, waitForBatchCompletion=None, blockIfNoPulsesAfterMs=None,):
self.updateGroupSize = updateGroupSize
self.maxPerInstanceFailures = maxPerInstanceFailures
self.maxFailedInstances = maxFailedInstances
self.maxWaitToInstanceRunningMs = maxWaitToInstanceRunningMs
self.minWaitInInstanceRunningMs = minWaitInInstanceRunningMs
self.rollbackOnFailure = rollbackOnFailure
self.updateOnlyTheseInstances = updateOnlyTheseInstances
self.waitForBatchCompletion = waitForBatchCompletion
self.blockIfNoPulsesAfterMs = blockIfNoPulsesAfterMs
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.updateGroupSize = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.maxPerInstanceFailures = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.maxFailedInstances = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.I32:
self.maxWaitToInstanceRunningMs = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.I32:
self.minWaitInInstanceRunningMs = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.BOOL:
self.rollbackOnFailure = iprot.readBool()
else:
iprot.skip(ftype)
elif fid == 7:
if ftype == TType.SET:
self.updateOnlyTheseInstances = set()
(_etype154, _size151) = iprot.readSetBegin()
for _i155 in range(_size151):
_elem156 = Range()
_elem156.read(iprot)
self.updateOnlyTheseInstances.add(_elem156)
iprot.readSetEnd()
else:
iprot.skip(ftype)
elif fid == 8:
if ftype == TType.BOOL:
self.waitForBatchCompletion = iprot.readBool()
else:
iprot.skip(ftype)
elif fid == 9:
if ftype == TType.I32:
self.blockIfNoPulsesAfterMs = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobUpdateSettings')
if self.updateGroupSize is not None:
oprot.writeFieldBegin('updateGroupSize', TType.I32, 1)
oprot.writeI32(self.updateGroupSize)
oprot.writeFieldEnd()
if self.maxPerInstanceFailures is not None:
oprot.writeFieldBegin('maxPerInstanceFailures', TType.I32, 2)
oprot.writeI32(self.maxPerInstanceFailures)
oprot.writeFieldEnd()
if self.maxFailedInstances is not None:
oprot.writeFieldBegin('maxFailedInstances', TType.I32, 3)
oprot.writeI32(self.maxFailedInstances)
oprot.writeFieldEnd()
if self.maxWaitToInstanceRunningMs is not None:
oprot.writeFieldBegin('maxWaitToInstanceRunningMs', TType.I32, 4)
oprot.writeI32(self.maxWaitToInstanceRunningMs)
oprot.writeFieldEnd()
if self.minWaitInInstanceRunningMs is not None:
oprot.writeFieldBegin('minWaitInInstanceRunningMs', TType.I32, 5)
oprot.writeI32(self.minWaitInInstanceRunningMs)
oprot.writeFieldEnd()
if self.rollbackOnFailure is not None:
oprot.writeFieldBegin('rollbackOnFailure', TType.BOOL, 6)
oprot.writeBool(self.rollbackOnFailure)
oprot.writeFieldEnd()
if self.updateOnlyTheseInstances is not None:
oprot.writeFieldBegin('updateOnlyTheseInstances', TType.SET, 7)
oprot.writeSetBegin(TType.STRUCT, len(self.updateOnlyTheseInstances))
for iter157 in self.updateOnlyTheseInstances:
iter157.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
if self.waitForBatchCompletion is not None:
oprot.writeFieldBegin('waitForBatchCompletion', TType.BOOL, 8)
oprot.writeBool(self.waitForBatchCompletion)
oprot.writeFieldEnd()
if self.blockIfNoPulsesAfterMs is not None:
oprot.writeFieldBegin('blockIfNoPulsesAfterMs', TType.I32, 9)
oprot.writeI32(self.blockIfNoPulsesAfterMs)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.updateGroupSize)
value = (value * 31) ^ hash(self.maxPerInstanceFailures)
value = (value * 31) ^ hash(self.maxFailedInstances)
value = (value * 31) ^ hash(self.maxWaitToInstanceRunningMs)
value = (value * 31) ^ hash(self.minWaitInInstanceRunningMs)
value = (value * 31) ^ hash(self.rollbackOnFailure)
value = (value * 31) ^ hash(self.updateOnlyTheseInstances)
value = (value * 31) ^ hash(self.waitForBatchCompletion)
value = (value * 31) ^ hash(self.blockIfNoPulsesAfterMs)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobUpdateEvent:
"""
Event marking a state transition in job update lifecycle.
Attributes:
- status: Update status.
- timestampMs: Epoch timestamp in milliseconds.
- user: User who performed this event (if user-initiated).
- message: Message from the user (for user-initiated transitions) or the scheduler about why the state was
changed.
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'status', None, None, ), # 1
(2, TType.I64, 'timestampMs', None, None, ), # 2
(3, TType.STRING, 'user', None, None, ), # 3
(4, TType.STRING, 'message', None, None, ), # 4
)
def __init__(self, status=None, timestampMs=None, user=None, message=None,):
self.status = status
self.timestampMs = timestampMs
self.user = user
self.message = message
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.status = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I64:
self.timestampMs = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.user = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
self.message = iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobUpdateEvent')
if self.status is not None:
oprot.writeFieldBegin('status', TType.I32, 1)
oprot.writeI32(self.status)
oprot.writeFieldEnd()
if self.timestampMs is not None:
oprot.writeFieldBegin('timestampMs', TType.I64, 2)
oprot.writeI64(self.timestampMs)
oprot.writeFieldEnd()
if self.user is not None:
oprot.writeFieldBegin('user', TType.STRING, 3)
oprot.writeString(self.user)
oprot.writeFieldEnd()
if self.message is not None:
oprot.writeFieldBegin('message', TType.STRING, 4)
oprot.writeString(self.message)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.status)
value = (value * 31) ^ hash(self.timestampMs)
value = (value * 31) ^ hash(self.user)
value = (value * 31) ^ hash(self.message)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobInstanceUpdateEvent:
"""
Event marking a state transition in job instance update lifecycle.
Attributes:
- instanceId: Job instance ID.
- timestampMs: Epoch timestamp in milliseconds.
- action: Job update action taken on the instance.
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'instanceId', None, None, ), # 1
(2, TType.I64, 'timestampMs', None, None, ), # 2
(3, TType.I32, 'action', None, None, ), # 3
)
def __init__(self, instanceId=None, timestampMs=None, action=None,):
self.instanceId = instanceId
self.timestampMs = timestampMs
self.action = action
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.instanceId = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I64:
self.timestampMs = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.action = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobInstanceUpdateEvent')
if self.instanceId is not None:
oprot.writeFieldBegin('instanceId', TType.I32, 1)
oprot.writeI32(self.instanceId)
oprot.writeFieldEnd()
if self.timestampMs is not None:
oprot.writeFieldBegin('timestampMs', TType.I64, 2)
oprot.writeI64(self.timestampMs)
oprot.writeFieldEnd()
if self.action is not None:
oprot.writeFieldBegin('action', TType.I32, 3)
oprot.writeI32(self.action)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.instanceId)
value = (value * 31) ^ hash(self.timestampMs)
value = (value * 31) ^ hash(self.action)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class InstanceTaskConfig:
"""
Maps instance IDs to TaskConfigs it.
Attributes:
- task: A TaskConfig associated with instances.
- instances: Instances associated with the TaskConfig.
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'task', (TaskConfig, TaskConfig.thrift_spec), None, ), # 1
(2, TType.SET, 'instances', (TType.STRUCT,(Range, Range.thrift_spec)), None, ), # 2
)
def __init__(self, task=None, instances=None,):
self.task = task
self.instances = instances
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.task = TaskConfig()
self.task.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.SET:
self.instances = set()
(_etype161, _size158) = iprot.readSetBegin()
for _i162 in range(_size158):
_elem163 = Range()
_elem163.read(iprot)
self.instances.add(_elem163)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('InstanceTaskConfig')
if self.task is not None:
oprot.writeFieldBegin('task', TType.STRUCT, 1)
self.task.write(oprot)
oprot.writeFieldEnd()
if self.instances is not None:
oprot.writeFieldBegin('instances', TType.SET, 2)
oprot.writeSetBegin(TType.STRUCT, len(self.instances))
for iter164 in self.instances:
iter164.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.task)
value = (value * 31) ^ hash(self.instances)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobUpdateState:
"""
Current job update state including status and created/modified timestamps.
Attributes:
- status: Current status of the update.
- createdTimestampMs: Created timestamp in milliseconds.
- lastModifiedTimestampMs: Last modified timestamp in milliseconds.
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'status', None, None, ), # 1
(2, TType.I64, 'createdTimestampMs', None, None, ), # 2
(3, TType.I64, 'lastModifiedTimestampMs', None, None, ), # 3
)
def __init__(self, status=None, createdTimestampMs=None, lastModifiedTimestampMs=None,):
self.status = status
self.createdTimestampMs = createdTimestampMs
self.lastModifiedTimestampMs = lastModifiedTimestampMs
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.status = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I64:
self.createdTimestampMs = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I64:
self.lastModifiedTimestampMs = iprot.readI64()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobUpdateState')
if self.status is not None:
oprot.writeFieldBegin('status', TType.I32, 1)
oprot.writeI32(self.status)
oprot.writeFieldEnd()
if self.createdTimestampMs is not None:
oprot.writeFieldBegin('createdTimestampMs', TType.I64, 2)
oprot.writeI64(self.createdTimestampMs)
oprot.writeFieldEnd()
if self.lastModifiedTimestampMs is not None:
oprot.writeFieldBegin('lastModifiedTimestampMs', TType.I64, 3)
oprot.writeI64(self.lastModifiedTimestampMs)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.status)
value = (value * 31) ^ hash(self.createdTimestampMs)
value = (value * 31) ^ hash(self.lastModifiedTimestampMs)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobUpdateSummary:
"""
Summary of the job update including job key, user and current state.
Attributes:
- updateId: Update ID.
- jobKey: Job key.
- key: Unique identifier for the update.
- user: User initiated an update.
- state: Current job update state.
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'updateId', None, None, ), # 1
(2, TType.STRUCT, 'jobKey', (JobKey, JobKey.thrift_spec), None, ), # 2
(3, TType.STRING, 'user', None, None, ), # 3
(4, TType.STRUCT, 'state', (JobUpdateState, JobUpdateState.thrift_spec), None, ), # 4
(5, TType.STRUCT, 'key', (JobUpdateKey, JobUpdateKey.thrift_spec), None, ), # 5
)
def __init__(self, updateId=None, jobKey=None, key=None, user=None, state=None,):
self.updateId = updateId
self.jobKey = jobKey
self.key = key
self.user = user
self.state = state
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.updateId = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.jobKey = JobKey()
self.jobKey.read(iprot)
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.STRUCT:
self.key = JobUpdateKey()
self.key.read(iprot)
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.user = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRUCT:
self.state = JobUpdateState()
self.state.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobUpdateSummary')
if self.updateId is not None:
oprot.writeFieldBegin('updateId', TType.STRING, 1)
oprot.writeString(self.updateId)
oprot.writeFieldEnd()
if self.jobKey is not None:
oprot.writeFieldBegin('jobKey', TType.STRUCT, 2)
self.jobKey.write(oprot)
oprot.writeFieldEnd()
if self.user is not None:
oprot.writeFieldBegin('user', TType.STRING, 3)
oprot.writeString(self.user)
oprot.writeFieldEnd()
if self.state is not None:
oprot.writeFieldBegin('state', TType.STRUCT, 4)
self.state.write(oprot)
oprot.writeFieldEnd()
if self.key is not None:
oprot.writeFieldBegin('key', TType.STRUCT, 5)
self.key.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.updateId)
value = (value * 31) ^ hash(self.jobKey)
value = (value * 31) ^ hash(self.key)
value = (value * 31) ^ hash(self.user)
value = (value * 31) ^ hash(self.state)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobUpdateInstructions:
"""
Update configuration and setting details.
Attributes:
- initialState: Actual InstanceId -> TaskConfig mapping when the update was requested.
- desiredState: Desired configuration when the update completes.
- settings: Update specific settings.
"""
thrift_spec = (
None, # 0
(1, TType.SET, 'initialState', (TType.STRUCT,(InstanceTaskConfig, InstanceTaskConfig.thrift_spec)), None, ), # 1
(2, TType.STRUCT, 'desiredState', (InstanceTaskConfig, InstanceTaskConfig.thrift_spec), None, ), # 2
(3, TType.STRUCT, 'settings', (JobUpdateSettings, JobUpdateSettings.thrift_spec), None, ), # 3
)
def __init__(self, initialState=None, desiredState=None, settings=None,):
self.initialState = initialState
self.desiredState = desiredState
self.settings = settings
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.SET:
self.initialState = set()
(_etype168, _size165) = iprot.readSetBegin()
for _i169 in range(_size165):
_elem170 = InstanceTaskConfig()
_elem170.read(iprot)
self.initialState.add(_elem170)
iprot.readSetEnd()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.desiredState = InstanceTaskConfig()
self.desiredState.read(iprot)
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRUCT:
self.settings = JobUpdateSettings()
self.settings.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobUpdateInstructions')
if self.initialState is not None:
oprot.writeFieldBegin('initialState', TType.SET, 1)
oprot.writeSetBegin(TType.STRUCT, len(self.initialState))
for iter171 in self.initialState:
iter171.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
if self.desiredState is not None:
oprot.writeFieldBegin('desiredState', TType.STRUCT, 2)
self.desiredState.write(oprot)
oprot.writeFieldEnd()
if self.settings is not None:
oprot.writeFieldBegin('settings', TType.STRUCT, 3)
self.settings.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.initialState)
value = (value * 31) ^ hash(self.desiredState)
value = (value * 31) ^ hash(self.settings)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobUpdate:
"""
Full definition of the job update.
Attributes:
- summary: Update summary.
- instructions: Update configuration.
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'summary', (JobUpdateSummary, JobUpdateSummary.thrift_spec), None, ), # 1
(2, TType.STRUCT, 'instructions', (JobUpdateInstructions, JobUpdateInstructions.thrift_spec), None, ), # 2
)
def __init__(self, summary=None, instructions=None,):
self.summary = summary
self.instructions = instructions
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.summary = JobUpdateSummary()
self.summary.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.instructions = JobUpdateInstructions()
self.instructions.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobUpdate')
if self.summary is not None:
oprot.writeFieldBegin('summary', TType.STRUCT, 1)
self.summary.write(oprot)
oprot.writeFieldEnd()
if self.instructions is not None:
oprot.writeFieldBegin('instructions', TType.STRUCT, 2)
self.instructions.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.summary)
value = (value * 31) ^ hash(self.instructions)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobUpdateDetails:
"""
Attributes:
- update: Update definition.
- updateEvents: History for this update.
- instanceEvents: History for the individual instances updated.
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'update', (JobUpdate, JobUpdate.thrift_spec), None, ), # 1
(2, TType.LIST, 'updateEvents', (TType.STRUCT,(JobUpdateEvent, JobUpdateEvent.thrift_spec)), None, ), # 2
(3, TType.LIST, 'instanceEvents', (TType.STRUCT,(JobInstanceUpdateEvent, JobInstanceUpdateEvent.thrift_spec)), None, ), # 3
)
def __init__(self, update=None, updateEvents=None, instanceEvents=None,):
self.update = update
self.updateEvents = updateEvents
self.instanceEvents = instanceEvents
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.update = JobUpdate()
self.update.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.LIST:
self.updateEvents = []
(_etype175, _size172) = iprot.readListBegin()
for _i176 in range(_size172):
_elem177 = JobUpdateEvent()
_elem177.read(iprot)
self.updateEvents.append(_elem177)
iprot.readListEnd()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.LIST:
self.instanceEvents = []
(_etype181, _size178) = iprot.readListBegin()
for _i182 in range(_size178):
_elem183 = JobInstanceUpdateEvent()
_elem183.read(iprot)
self.instanceEvents.append(_elem183)
iprot.readListEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobUpdateDetails')
if self.update is not None:
oprot.writeFieldBegin('update', TType.STRUCT, 1)
self.update.write(oprot)
oprot.writeFieldEnd()
if self.updateEvents is not None:
oprot.writeFieldBegin('updateEvents', TType.LIST, 2)
oprot.writeListBegin(TType.STRUCT, len(self.updateEvents))
for iter184 in self.updateEvents:
iter184.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.instanceEvents is not None:
oprot.writeFieldBegin('instanceEvents', TType.LIST, 3)
oprot.writeListBegin(TType.STRUCT, len(self.instanceEvents))
for iter185 in self.instanceEvents:
iter185.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.update)
value = (value * 31) ^ hash(self.updateEvents)
value = (value * 31) ^ hash(self.instanceEvents)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobUpdateRequest:
"""
A request to update the following instances of an existing job. Used by startUpdate.
Attributes:
- taskConfig: Desired TaskConfig to apply.
- instanceCount: Desired number of instances of the task config.
- settings: Update settings and limits.
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'taskConfig', (TaskConfig, TaskConfig.thrift_spec), None, ), # 1
(2, TType.I32, 'instanceCount', None, None, ), # 2
(3, TType.STRUCT, 'settings', (JobUpdateSettings, JobUpdateSettings.thrift_spec), None, ), # 3
)
def __init__(self, taskConfig=None, instanceCount=None, settings=None,):
self.taskConfig = taskConfig
self.instanceCount = instanceCount
self.settings = settings
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.taskConfig = TaskConfig()
self.taskConfig.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.instanceCount = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRUCT:
self.settings = JobUpdateSettings()
self.settings.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobUpdateRequest')
if self.taskConfig is not None:
oprot.writeFieldBegin('taskConfig', TType.STRUCT, 1)
self.taskConfig.write(oprot)
oprot.writeFieldEnd()
if self.instanceCount is not None:
oprot.writeFieldBegin('instanceCount', TType.I32, 2)
oprot.writeI32(self.instanceCount)
oprot.writeFieldEnd()
if self.settings is not None:
oprot.writeFieldBegin('settings', TType.STRUCT, 3)
self.settings.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.taskConfig)
value = (value * 31) ^ hash(self.instanceCount)
value = (value * 31) ^ hash(self.settings)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobUpdateQuery:
"""
Contains a set of restrictions on matching job updates where all restrictions must be met
(terms are AND'ed together).
Attributes:
- role: Job role.
- key: Unique identifier for a job update.
- jobKey: Job key.
- user: User who created the update.
- updateStatuses: Set of update statuses.
- offset: Offset to serve data from. Used by pagination.
- limit: Number or records to serve. Used by pagination.
"""
thrift_spec = (
None, # 0
None, # 1
(2, TType.STRING, 'role', None, None, ), # 2
(3, TType.STRUCT, 'jobKey', (JobKey, JobKey.thrift_spec), None, ), # 3
(4, TType.STRING, 'user', None, None, ), # 4
(5, TType.SET, 'updateStatuses', (TType.I32,None), None, ), # 5
(6, TType.I32, 'offset', None, None, ), # 6
(7, TType.I32, 'limit', None, None, ), # 7
(8, TType.STRUCT, 'key', (JobUpdateKey, JobUpdateKey.thrift_spec), None, ), # 8
)
def __init__(self, role=None, key=None, jobKey=None, user=None, updateStatuses=None, offset=None, limit=None,):
self.role = role
self.key = key
self.jobKey = jobKey
self.user = user
self.updateStatuses = updateStatuses
self.offset = offset
self.limit = limit
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 2:
if ftype == TType.STRING:
self.role = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 8:
if ftype == TType.STRUCT:
self.key = JobUpdateKey()
self.key.read(iprot)
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRUCT:
self.jobKey = JobKey()
self.jobKey.read(iprot)
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
self.user = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.SET:
self.updateStatuses = set()
(_etype189, _size186) = iprot.readSetBegin()
for _i190 in range(_size186):
_elem191 = iprot.readI32()
self.updateStatuses.add(_elem191)
iprot.readSetEnd()
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.I32:
self.offset = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 7:
if ftype == TType.I32:
self.limit = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobUpdateQuery')
if self.role is not None:
oprot.writeFieldBegin('role', TType.STRING, 2)
oprot.writeString(self.role)
oprot.writeFieldEnd()
if self.jobKey is not None:
oprot.writeFieldBegin('jobKey', TType.STRUCT, 3)
self.jobKey.write(oprot)
oprot.writeFieldEnd()
if self.user is not None:
oprot.writeFieldBegin('user', TType.STRING, 4)
oprot.writeString(self.user)
oprot.writeFieldEnd()
if self.updateStatuses is not None:
oprot.writeFieldBegin('updateStatuses', TType.SET, 5)
oprot.writeSetBegin(TType.I32, len(self.updateStatuses))
for iter192 in self.updateStatuses:
oprot.writeI32(iter192)
oprot.writeSetEnd()
oprot.writeFieldEnd()
if self.offset is not None:
oprot.writeFieldBegin('offset', TType.I32, 6)
oprot.writeI32(self.offset)
oprot.writeFieldEnd()
if self.limit is not None:
oprot.writeFieldBegin('limit', TType.I32, 7)
oprot.writeI32(self.limit)
oprot.writeFieldEnd()
if self.key is not None:
oprot.writeFieldBegin('key', TType.STRUCT, 8)
self.key.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.role)
value = (value * 31) ^ hash(self.key)
value = (value * 31) ^ hash(self.jobKey)
value = (value * 31) ^ hash(self.user)
value = (value * 31) ^ hash(self.updateStatuses)
value = (value * 31) ^ hash(self.offset)
value = (value * 31) ^ hash(self.limit)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class ListBackupsResult:
"""
Attributes:
- backups
"""
thrift_spec = (
None, # 0
(1, TType.SET, 'backups', (TType.STRING,None), None, ), # 1
)
def __init__(self, backups=None,):
self.backups = backups
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.SET:
self.backups = set()
(_etype196, _size193) = iprot.readSetBegin()
for _i197 in range(_size193):
_elem198 = iprot.readString()
self.backups.add(_elem198)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('ListBackupsResult')
if self.backups is not None:
oprot.writeFieldBegin('backups', TType.SET, 1)
oprot.writeSetBegin(TType.STRING, len(self.backups))
for iter199 in self.backups:
oprot.writeString(iter199)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.backups)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class StartMaintenanceResult:
"""
Attributes:
- statuses
"""
thrift_spec = (
None, # 0
(1, TType.SET, 'statuses', (TType.STRUCT,(HostStatus, HostStatus.thrift_spec)), None, ), # 1
)
def __init__(self, statuses=None,):
self.statuses = statuses
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.SET:
self.statuses = set()
(_etype203, _size200) = iprot.readSetBegin()
for _i204 in range(_size200):
_elem205 = HostStatus()
_elem205.read(iprot)
self.statuses.add(_elem205)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('StartMaintenanceResult')
if self.statuses is not None:
oprot.writeFieldBegin('statuses', TType.SET, 1)
oprot.writeSetBegin(TType.STRUCT, len(self.statuses))
for iter206 in self.statuses:
iter206.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.statuses)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class DrainHostsResult:
"""
Attributes:
- statuses
"""
thrift_spec = (
None, # 0
(1, TType.SET, 'statuses', (TType.STRUCT,(HostStatus, HostStatus.thrift_spec)), None, ), # 1
)
def __init__(self, statuses=None,):
self.statuses = statuses
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.SET:
self.statuses = set()
(_etype210, _size207) = iprot.readSetBegin()
for _i211 in range(_size207):
_elem212 = HostStatus()
_elem212.read(iprot)
self.statuses.add(_elem212)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('DrainHostsResult')
if self.statuses is not None:
oprot.writeFieldBegin('statuses', TType.SET, 1)
oprot.writeSetBegin(TType.STRUCT, len(self.statuses))
for iter213 in self.statuses:
iter213.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.statuses)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class QueryRecoveryResult:
"""
Attributes:
- tasks
"""
thrift_spec = (
None, # 0
(1, TType.SET, 'tasks', (TType.STRUCT,(ScheduledTask, ScheduledTask.thrift_spec)), None, ), # 1
)
def __init__(self, tasks=None,):
self.tasks = tasks
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.SET:
self.tasks = set()
(_etype217, _size214) = iprot.readSetBegin()
for _i218 in range(_size214):
_elem219 = ScheduledTask()
_elem219.read(iprot)
self.tasks.add(_elem219)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('QueryRecoveryResult')
if self.tasks is not None:
oprot.writeFieldBegin('tasks', TType.SET, 1)
oprot.writeSetBegin(TType.STRUCT, len(self.tasks))
for iter220 in self.tasks:
iter220.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.tasks)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class MaintenanceStatusResult:
"""
Attributes:
- statuses
"""
thrift_spec = (
None, # 0
(1, TType.SET, 'statuses', (TType.STRUCT,(HostStatus, HostStatus.thrift_spec)), None, ), # 1
)
def __init__(self, statuses=None,):
self.statuses = statuses
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.SET:
self.statuses = set()
(_etype224, _size221) = iprot.readSetBegin()
for _i225 in range(_size221):
_elem226 = HostStatus()
_elem226.read(iprot)
self.statuses.add(_elem226)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('MaintenanceStatusResult')
if self.statuses is not None:
oprot.writeFieldBegin('statuses', TType.SET, 1)
oprot.writeSetBegin(TType.STRUCT, len(self.statuses))
for iter227 in self.statuses:
iter227.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.statuses)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class EndMaintenanceResult:
"""
Attributes:
- statuses
"""
thrift_spec = (
None, # 0
(1, TType.SET, 'statuses', (TType.STRUCT,(HostStatus, HostStatus.thrift_spec)), None, ), # 1
)
def __init__(self, statuses=None,):
self.statuses = statuses
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.SET:
self.statuses = set()
(_etype231, _size228) = iprot.readSetBegin()
for _i232 in range(_size228):
_elem233 = HostStatus()
_elem233.read(iprot)
self.statuses.add(_elem233)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('EndMaintenanceResult')
if self.statuses is not None:
oprot.writeFieldBegin('statuses', TType.SET, 1)
oprot.writeSetBegin(TType.STRUCT, len(self.statuses))
for iter234 in self.statuses:
iter234.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.statuses)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class RoleSummaryResult:
"""
Attributes:
- summaries
"""
thrift_spec = (
None, # 0
(1, TType.SET, 'summaries', (TType.STRUCT,(RoleSummary, RoleSummary.thrift_spec)), None, ), # 1
)
def __init__(self, summaries=None,):
self.summaries = summaries
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.SET:
self.summaries = set()
(_etype238, _size235) = iprot.readSetBegin()
for _i239 in range(_size235):
_elem240 = RoleSummary()
_elem240.read(iprot)
self.summaries.add(_elem240)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('RoleSummaryResult')
if self.summaries is not None:
oprot.writeFieldBegin('summaries', TType.SET, 1)
oprot.writeSetBegin(TType.STRUCT, len(self.summaries))
for iter241 in self.summaries:
iter241.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.summaries)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobSummaryResult:
"""
Attributes:
- summaries
"""
thrift_spec = (
None, # 0
(1, TType.SET, 'summaries', (TType.STRUCT,(JobSummary, JobSummary.thrift_spec)), None, ), # 1
)
def __init__(self, summaries=None,):
self.summaries = summaries
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.SET:
self.summaries = set()
(_etype245, _size242) = iprot.readSetBegin()
for _i246 in range(_size242):
_elem247 = JobSummary()
_elem247.read(iprot)
self.summaries.add(_elem247)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobSummaryResult')
if self.summaries is not None:
oprot.writeFieldBegin('summaries', TType.SET, 1)
oprot.writeSetBegin(TType.STRUCT, len(self.summaries))
for iter248 in self.summaries:
iter248.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.summaries)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class GetLocksResult:
"""
Attributes:
- locks
"""
thrift_spec = (
None, # 0
(1, TType.SET, 'locks', (TType.STRUCT,(Lock, Lock.thrift_spec)), None, ), # 1
)
def __init__(self, locks=None,):
self.locks = locks
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.SET:
self.locks = set()
(_etype252, _size249) = iprot.readSetBegin()
for _i253 in range(_size249):
_elem254 = Lock()
_elem254.read(iprot)
self.locks.add(_elem254)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('GetLocksResult')
if self.locks is not None:
oprot.writeFieldBegin('locks', TType.SET, 1)
oprot.writeSetBegin(TType.STRUCT, len(self.locks))
for iter255 in self.locks:
iter255.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.locks)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class ConfigSummaryResult:
"""
Attributes:
- summary
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'summary', (ConfigSummary, ConfigSummary.thrift_spec), None, ), # 1
)
def __init__(self, summary=None,):
self.summary = summary
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.summary = ConfigSummary()
self.summary.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('ConfigSummaryResult')
if self.summary is not None:
oprot.writeFieldBegin('summary', TType.STRUCT, 1)
self.summary.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.summary)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class GetPendingReasonResult:
"""
Attributes:
- reasons
"""
thrift_spec = (
None, # 0
(1, TType.SET, 'reasons', (TType.STRUCT,(PendingReason, PendingReason.thrift_spec)), None, ), # 1
)
def __init__(self, reasons=None,):
self.reasons = reasons
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.SET:
self.reasons = set()
(_etype259, _size256) = iprot.readSetBegin()
for _i260 in range(_size256):
_elem261 = PendingReason()
_elem261.read(iprot)
self.reasons.add(_elem261)
iprot.readSetEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('GetPendingReasonResult')
if self.reasons is not None:
oprot.writeFieldBegin('reasons', TType.SET, 1)
oprot.writeSetBegin(TType.STRUCT, len(self.reasons))
for iter262 in self.reasons:
iter262.write(oprot)
oprot.writeSetEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.reasons)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class StartJobUpdateResult:
"""
Result of the startUpdate call.
Attributes:
- key: Unique identifier for the job update.
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'key', (JobUpdateKey, JobUpdateKey.thrift_spec), None, ), # 1
)
def __init__(self, key=None,):
self.key = key
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.key = JobUpdateKey()
self.key.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('StartJobUpdateResult')
if self.key is not None:
oprot.writeFieldBegin('key', TType.STRUCT, 1)
self.key.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.key)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class GetJobUpdateSummariesResult:
"""
Result of the getJobUpdateSummaries call.
Attributes:
- updateSummaries
"""
thrift_spec = (
None, # 0
(1, TType.LIST, 'updateSummaries', (TType.STRUCT,(JobUpdateSummary, JobUpdateSummary.thrift_spec)), None, ), # 1
)
def __init__(self, updateSummaries=None,):
self.updateSummaries = updateSummaries
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.LIST:
self.updateSummaries = []
(_etype266, _size263) = iprot.readListBegin()
for _i267 in range(_size263):
_elem268 = JobUpdateSummary()
_elem268.read(iprot)
self.updateSummaries.append(_elem268)
iprot.readListEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('GetJobUpdateSummariesResult')
if self.updateSummaries is not None:
oprot.writeFieldBegin('updateSummaries', TType.LIST, 1)
oprot.writeListBegin(TType.STRUCT, len(self.updateSummaries))
for iter269 in self.updateSummaries:
iter269.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.updateSummaries)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class GetJobUpdateDetailsResult:
"""
Result of the getJobUpdateDetails call.
Attributes:
- details
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'details', (JobUpdateDetails, JobUpdateDetails.thrift_spec), None, ), # 1
)
def __init__(self, details=None,):
self.details = details
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.details = JobUpdateDetails()
self.details.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('GetJobUpdateDetailsResult')
if self.details is not None:
oprot.writeFieldBegin('details', TType.STRUCT, 1)
self.details.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.details)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class PulseJobUpdateResult:
"""
Result of the pulseJobUpdate call.
Attributes:
- status
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'status', None, None, ), # 1
)
def __init__(self, status=None,):
self.status = status
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.status = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('PulseJobUpdateResult')
if self.status is not None:
oprot.writeFieldBegin('status', TType.I32, 1)
oprot.writeI32(self.status)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.status)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class ServerInfo:
"""
Information about the scheduler.
Attributes:
- clusterName
- thriftAPIVersion
- statsUrlPrefix: A url prefix for job container stats.
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'clusterName', None, None, ), # 1
(2, TType.I32, 'thriftAPIVersion', None, None, ), # 2
(3, TType.STRING, 'statsUrlPrefix', None, None, ), # 3
)
def __init__(self, clusterName=None, thriftAPIVersion=None, statsUrlPrefix=None,):
self.clusterName = clusterName
self.thriftAPIVersion = thriftAPIVersion
self.statsUrlPrefix = statsUrlPrefix
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.clusterName = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.thriftAPIVersion = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.statsUrlPrefix = iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('ServerInfo')
if self.clusterName is not None:
oprot.writeFieldBegin('clusterName', TType.STRING, 1)
oprot.writeString(self.clusterName)
oprot.writeFieldEnd()
if self.thriftAPIVersion is not None:
oprot.writeFieldBegin('thriftAPIVersion', TType.I32, 2)
oprot.writeI32(self.thriftAPIVersion)
oprot.writeFieldEnd()
if self.statsUrlPrefix is not None:
oprot.writeFieldBegin('statsUrlPrefix', TType.STRING, 3)
oprot.writeString(self.statsUrlPrefix)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.clusterName)
value = (value * 31) ^ hash(self.thriftAPIVersion)
value = (value * 31) ^ hash(self.statsUrlPrefix)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Result:
"""
Attributes:
- populateJobResult
- scheduleStatusResult
- getJobsResult
- getQuotaResult
- listBackupsResult
- startMaintenanceResult
- drainHostsResult
- queryRecoveryResult
- maintenanceStatusResult
- endMaintenanceResult
- getVersionResult
- acquireLockResult
- roleSummaryResult
- jobSummaryResult
- getLocksResult
- configSummaryResult
- getPendingReasonResult
- startJobUpdateResult
- getJobUpdateSummariesResult
- getJobUpdateDetailsResult
- pulseJobUpdateResult
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'populateJobResult', (PopulateJobResult, PopulateJobResult.thrift_spec), None, ), # 1
None, # 2
(3, TType.STRUCT, 'scheduleStatusResult', (ScheduleStatusResult, ScheduleStatusResult.thrift_spec), None, ), # 3
(4, TType.STRUCT, 'getJobsResult', (GetJobsResult, GetJobsResult.thrift_spec), None, ), # 4
(5, TType.STRUCT, 'getQuotaResult', (GetQuotaResult, GetQuotaResult.thrift_spec), None, ), # 5
(6, TType.STRUCT, 'listBackupsResult', (ListBackupsResult, ListBackupsResult.thrift_spec), None, ), # 6
(7, TType.STRUCT, 'startMaintenanceResult', (StartMaintenanceResult, StartMaintenanceResult.thrift_spec), None, ), # 7
(8, TType.STRUCT, 'drainHostsResult', (DrainHostsResult, DrainHostsResult.thrift_spec), None, ), # 8
(9, TType.STRUCT, 'queryRecoveryResult', (QueryRecoveryResult, QueryRecoveryResult.thrift_spec), None, ), # 9
(10, TType.STRUCT, 'maintenanceStatusResult', (MaintenanceStatusResult, MaintenanceStatusResult.thrift_spec), None, ), # 10
(11, TType.STRUCT, 'endMaintenanceResult', (EndMaintenanceResult, EndMaintenanceResult.thrift_spec), None, ), # 11
None, # 12
None, # 13
None, # 14
(15, TType.STRUCT, 'getVersionResult', (APIVersion, APIVersion.thrift_spec), None, ), # 15
(16, TType.STRUCT, 'acquireLockResult', (AcquireLockResult, AcquireLockResult.thrift_spec), None, ), # 16
(17, TType.STRUCT, 'roleSummaryResult', (RoleSummaryResult, RoleSummaryResult.thrift_spec), None, ), # 17
(18, TType.STRUCT, 'jobSummaryResult', (JobSummaryResult, JobSummaryResult.thrift_spec), None, ), # 18
(19, TType.STRUCT, 'getLocksResult', (GetLocksResult, GetLocksResult.thrift_spec), None, ), # 19
(20, TType.STRUCT, 'configSummaryResult', (ConfigSummaryResult, ConfigSummaryResult.thrift_spec), None, ), # 20
(21, TType.STRUCT, 'getPendingReasonResult', (GetPendingReasonResult, GetPendingReasonResult.thrift_spec), None, ), # 21
(22, TType.STRUCT, 'startJobUpdateResult', (StartJobUpdateResult, StartJobUpdateResult.thrift_spec), None, ), # 22
(23, TType.STRUCT, 'getJobUpdateSummariesResult', (GetJobUpdateSummariesResult, GetJobUpdateSummariesResult.thrift_spec), None, ), # 23
(24, TType.STRUCT, 'getJobUpdateDetailsResult', (GetJobUpdateDetailsResult, GetJobUpdateDetailsResult.thrift_spec), None, ), # 24
(25, TType.STRUCT, 'pulseJobUpdateResult', (PulseJobUpdateResult, PulseJobUpdateResult.thrift_spec), None, ), # 25
)
def __init__(self, populateJobResult=None, scheduleStatusResult=None, getJobsResult=None, getQuotaResult=None, listBackupsResult=None, startMaintenanceResult=None, drainHostsResult=None, queryRecoveryResult=None, maintenanceStatusResult=None, endMaintenanceResult=None, getVersionResult=None, acquireLockResult=None, roleSummaryResult=None, jobSummaryResult=None, getLocksResult=None, configSummaryResult=None, getPendingReasonResult=None, startJobUpdateResult=None, getJobUpdateSummariesResult=None, getJobUpdateDetailsResult=None, pulseJobUpdateResult=None,):
self.populateJobResult = populateJobResult
self.scheduleStatusResult = scheduleStatusResult
self.getJobsResult = getJobsResult
self.getQuotaResult = getQuotaResult
self.listBackupsResult = listBackupsResult
self.startMaintenanceResult = startMaintenanceResult
self.drainHostsResult = drainHostsResult
self.queryRecoveryResult = queryRecoveryResult
self.maintenanceStatusResult = maintenanceStatusResult
self.endMaintenanceResult = endMaintenanceResult
self.getVersionResult = getVersionResult
self.acquireLockResult = acquireLockResult
self.roleSummaryResult = roleSummaryResult
self.jobSummaryResult = jobSummaryResult
self.getLocksResult = getLocksResult
self.configSummaryResult = configSummaryResult
self.getPendingReasonResult = getPendingReasonResult
self.startJobUpdateResult = startJobUpdateResult
self.getJobUpdateSummariesResult = getJobUpdateSummariesResult
self.getJobUpdateDetailsResult = getJobUpdateDetailsResult
self.pulseJobUpdateResult = pulseJobUpdateResult
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.populateJobResult = PopulateJobResult()
self.populateJobResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRUCT:
self.scheduleStatusResult = ScheduleStatusResult()
self.scheduleStatusResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRUCT:
self.getJobsResult = GetJobsResult()
self.getJobsResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.STRUCT:
self.getQuotaResult = GetQuotaResult()
self.getQuotaResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.STRUCT:
self.listBackupsResult = ListBackupsResult()
self.listBackupsResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 7:
if ftype == TType.STRUCT:
self.startMaintenanceResult = StartMaintenanceResult()
self.startMaintenanceResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 8:
if ftype == TType.STRUCT:
self.drainHostsResult = DrainHostsResult()
self.drainHostsResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 9:
if ftype == TType.STRUCT:
self.queryRecoveryResult = QueryRecoveryResult()
self.queryRecoveryResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 10:
if ftype == TType.STRUCT:
self.maintenanceStatusResult = MaintenanceStatusResult()
self.maintenanceStatusResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 11:
if ftype == TType.STRUCT:
self.endMaintenanceResult = EndMaintenanceResult()
self.endMaintenanceResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 15:
if ftype == TType.STRUCT:
self.getVersionResult = APIVersion()
self.getVersionResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 16:
if ftype == TType.STRUCT:
self.acquireLockResult = AcquireLockResult()
self.acquireLockResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 17:
if ftype == TType.STRUCT:
self.roleSummaryResult = RoleSummaryResult()
self.roleSummaryResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 18:
if ftype == TType.STRUCT:
self.jobSummaryResult = JobSummaryResult()
self.jobSummaryResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 19:
if ftype == TType.STRUCT:
self.getLocksResult = GetLocksResult()
self.getLocksResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 20:
if ftype == TType.STRUCT:
self.configSummaryResult = ConfigSummaryResult()
self.configSummaryResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 21:
if ftype == TType.STRUCT:
self.getPendingReasonResult = GetPendingReasonResult()
self.getPendingReasonResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 22:
if ftype == TType.STRUCT:
self.startJobUpdateResult = StartJobUpdateResult()
self.startJobUpdateResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 23:
if ftype == TType.STRUCT:
self.getJobUpdateSummariesResult = GetJobUpdateSummariesResult()
self.getJobUpdateSummariesResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 24:
if ftype == TType.STRUCT:
self.getJobUpdateDetailsResult = GetJobUpdateDetailsResult()
self.getJobUpdateDetailsResult.read(iprot)
else:
iprot.skip(ftype)
elif fid == 25:
if ftype == TType.STRUCT:
self.pulseJobUpdateResult = PulseJobUpdateResult()
self.pulseJobUpdateResult.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Result')
if self.populateJobResult is not None:
oprot.writeFieldBegin('populateJobResult', TType.STRUCT, 1)
self.populateJobResult.write(oprot)
oprot.writeFieldEnd()
if self.scheduleStatusResult is not None:
oprot.writeFieldBegin('scheduleStatusResult', TType.STRUCT, 3)
self.scheduleStatusResult.write(oprot)
oprot.writeFieldEnd()
if self.getJobsResult is not None:
oprot.writeFieldBegin('getJobsResult', TType.STRUCT, 4)
self.getJobsResult.write(oprot)
oprot.writeFieldEnd()
if self.getQuotaResult is not None:
oprot.writeFieldBegin('getQuotaResult', TType.STRUCT, 5)
self.getQuotaResult.write(oprot)
oprot.writeFieldEnd()
if self.listBackupsResult is not None:
oprot.writeFieldBegin('listBackupsResult', TType.STRUCT, 6)
self.listBackupsResult.write(oprot)
oprot.writeFieldEnd()
if self.startMaintenanceResult is not None:
oprot.writeFieldBegin('startMaintenanceResult', TType.STRUCT, 7)
self.startMaintenanceResult.write(oprot)
oprot.writeFieldEnd()
if self.drainHostsResult is not None:
oprot.writeFieldBegin('drainHostsResult', TType.STRUCT, 8)
self.drainHostsResult.write(oprot)
oprot.writeFieldEnd()
if self.queryRecoveryResult is not None:
oprot.writeFieldBegin('queryRecoveryResult', TType.STRUCT, 9)
self.queryRecoveryResult.write(oprot)
oprot.writeFieldEnd()
if self.maintenanceStatusResult is not None:
oprot.writeFieldBegin('maintenanceStatusResult', TType.STRUCT, 10)
self.maintenanceStatusResult.write(oprot)
oprot.writeFieldEnd()
if self.endMaintenanceResult is not None:
oprot.writeFieldBegin('endMaintenanceResult', TType.STRUCT, 11)
self.endMaintenanceResult.write(oprot)
oprot.writeFieldEnd()
if self.getVersionResult is not None:
oprot.writeFieldBegin('getVersionResult', TType.STRUCT, 15)
self.getVersionResult.write(oprot)
oprot.writeFieldEnd()
if self.acquireLockResult is not None:
oprot.writeFieldBegin('acquireLockResult', TType.STRUCT, 16)
self.acquireLockResult.write(oprot)
oprot.writeFieldEnd()
if self.roleSummaryResult is not None:
oprot.writeFieldBegin('roleSummaryResult', TType.STRUCT, 17)
self.roleSummaryResult.write(oprot)
oprot.writeFieldEnd()
if self.jobSummaryResult is not None:
oprot.writeFieldBegin('jobSummaryResult', TType.STRUCT, 18)
self.jobSummaryResult.write(oprot)
oprot.writeFieldEnd()
if self.getLocksResult is not None:
oprot.writeFieldBegin('getLocksResult', TType.STRUCT, 19)
self.getLocksResult.write(oprot)
oprot.writeFieldEnd()
if self.configSummaryResult is not None:
oprot.writeFieldBegin('configSummaryResult', TType.STRUCT, 20)
self.configSummaryResult.write(oprot)
oprot.writeFieldEnd()
if self.getPendingReasonResult is not None:
oprot.writeFieldBegin('getPendingReasonResult', TType.STRUCT, 21)
self.getPendingReasonResult.write(oprot)
oprot.writeFieldEnd()
if self.startJobUpdateResult is not None:
oprot.writeFieldBegin('startJobUpdateResult', TType.STRUCT, 22)
self.startJobUpdateResult.write(oprot)
oprot.writeFieldEnd()
if self.getJobUpdateSummariesResult is not None:
oprot.writeFieldBegin('getJobUpdateSummariesResult', TType.STRUCT, 23)
self.getJobUpdateSummariesResult.write(oprot)
oprot.writeFieldEnd()
if self.getJobUpdateDetailsResult is not None:
oprot.writeFieldBegin('getJobUpdateDetailsResult', TType.STRUCT, 24)
self.getJobUpdateDetailsResult.write(oprot)
oprot.writeFieldEnd()
if self.pulseJobUpdateResult is not None:
oprot.writeFieldBegin('pulseJobUpdateResult', TType.STRUCT, 25)
self.pulseJobUpdateResult.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.populateJobResult)
value = (value * 31) ^ hash(self.scheduleStatusResult)
value = (value * 31) ^ hash(self.getJobsResult)
value = (value * 31) ^ hash(self.getQuotaResult)
value = (value * 31) ^ hash(self.listBackupsResult)
value = (value * 31) ^ hash(self.startMaintenanceResult)
value = (value * 31) ^ hash(self.drainHostsResult)
value = (value * 31) ^ hash(self.queryRecoveryResult)
value = (value * 31) ^ hash(self.maintenanceStatusResult)
value = (value * 31) ^ hash(self.endMaintenanceResult)
value = (value * 31) ^ hash(self.getVersionResult)
value = (value * 31) ^ hash(self.acquireLockResult)
value = (value * 31) ^ hash(self.roleSummaryResult)
value = (value * 31) ^ hash(self.jobSummaryResult)
value = (value * 31) ^ hash(self.getLocksResult)
value = (value * 31) ^ hash(self.configSummaryResult)
value = (value * 31) ^ hash(self.getPendingReasonResult)
value = (value * 31) ^ hash(self.startJobUpdateResult)
value = (value * 31) ^ hash(self.getJobUpdateSummariesResult)
value = (value * 31) ^ hash(self.getJobUpdateDetailsResult)
value = (value * 31) ^ hash(self.pulseJobUpdateResult)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class ResponseDetail:
"""
Attributes:
- message
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'message', None, None, ), # 1
)
def __init__(self, message=None,):
self.message = message
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.message = iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('ResponseDetail')
if self.message is not None:
oprot.writeFieldBegin('message', TType.STRING, 1)
oprot.writeString(self.message)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.message)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Response:
"""
Attributes:
- responseCode
- serverInfo
- result: Payload from the invoked RPC.
- details: Messages from the server relevant to the request, such as warnings or use of deprecated
features.
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'responseCode', None, None, ), # 1
None, # 2
(3, TType.STRUCT, 'result', (Result, Result.thrift_spec), None, ), # 3
None, # 4
(5, TType.STRUCT, 'serverInfo', (ServerInfo, ServerInfo.thrift_spec), None, ), # 5
(6, TType.LIST, 'details', (TType.STRUCT,(ResponseDetail, ResponseDetail.thrift_spec)), None, ), # 6
)
def __init__(self, responseCode=None, serverInfo=None, result=None, details=None,):
self.responseCode = responseCode
self.serverInfo = serverInfo
self.result = result
self.details = details
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.responseCode = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.STRUCT:
self.serverInfo = ServerInfo()
self.serverInfo.read(iprot)
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRUCT:
self.result = Result()
self.result.read(iprot)
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.LIST:
self.details = []
(_etype273, _size270) = iprot.readListBegin()
for _i274 in range(_size270):
_elem275 = ResponseDetail()
_elem275.read(iprot)
self.details.append(_elem275)
iprot.readListEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Response')
if self.responseCode is not None:
oprot.writeFieldBegin('responseCode', TType.I32, 1)
oprot.writeI32(self.responseCode)
oprot.writeFieldEnd()
if self.result is not None:
oprot.writeFieldBegin('result', TType.STRUCT, 3)
self.result.write(oprot)
oprot.writeFieldEnd()
if self.serverInfo is not None:
oprot.writeFieldBegin('serverInfo', TType.STRUCT, 5)
self.serverInfo.write(oprot)
oprot.writeFieldEnd()
if self.details is not None:
oprot.writeFieldBegin('details', TType.LIST, 6)
oprot.writeListBegin(TType.STRUCT, len(self.details))
for iter276 in self.details:
iter276.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.responseCode)
value = (value * 31) ^ hash(self.serverInfo)
value = (value * 31) ^ hash(self.result)
value = (value * 31) ^ hash(self.details)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class InstanceConfigRewrite:
"""
Attributes:
- instanceKey: Key for the task to rewrite.
- oldTask: The original configuration.
- rewrittenTask: The rewritten configuration.
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'instanceKey', (InstanceKey, InstanceKey.thrift_spec), None, ), # 1
(2, TType.STRUCT, 'oldTask', (TaskConfig, TaskConfig.thrift_spec), None, ), # 2
(3, TType.STRUCT, 'rewrittenTask', (TaskConfig, TaskConfig.thrift_spec), None, ), # 3
)
def __init__(self, instanceKey=None, oldTask=None, rewrittenTask=None,):
self.instanceKey = instanceKey
self.oldTask = oldTask
self.rewrittenTask = rewrittenTask
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.instanceKey = InstanceKey()
self.instanceKey.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.oldTask = TaskConfig()
self.oldTask.read(iprot)
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRUCT:
self.rewrittenTask = TaskConfig()
self.rewrittenTask.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('InstanceConfigRewrite')
if self.instanceKey is not None:
oprot.writeFieldBegin('instanceKey', TType.STRUCT, 1)
self.instanceKey.write(oprot)
oprot.writeFieldEnd()
if self.oldTask is not None:
oprot.writeFieldBegin('oldTask', TType.STRUCT, 2)
self.oldTask.write(oprot)
oprot.writeFieldEnd()
if self.rewrittenTask is not None:
oprot.writeFieldBegin('rewrittenTask', TType.STRUCT, 3)
self.rewrittenTask.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.instanceKey)
value = (value * 31) ^ hash(self.oldTask)
value = (value * 31) ^ hash(self.rewrittenTask)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class JobConfigRewrite:
"""
Attributes:
- oldJob: The original job configuration.
- rewrittenJob: The rewritten job configuration.
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'oldJob', (JobConfiguration, JobConfiguration.thrift_spec), None, ), # 1
(2, TType.STRUCT, 'rewrittenJob', (JobConfiguration, JobConfiguration.thrift_spec), None, ), # 2
)
def __init__(self, oldJob=None, rewrittenJob=None,):
self.oldJob = oldJob
self.rewrittenJob = rewrittenJob
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.oldJob = JobConfiguration()
self.oldJob.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.rewrittenJob = JobConfiguration()
self.rewrittenJob.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('JobConfigRewrite')
if self.oldJob is not None:
oprot.writeFieldBegin('oldJob', TType.STRUCT, 1)
self.oldJob.write(oprot)
oprot.writeFieldEnd()
if self.rewrittenJob is not None:
oprot.writeFieldBegin('rewrittenJob', TType.STRUCT, 2)
self.rewrittenJob.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.oldJob)
value = (value * 31) ^ hash(self.rewrittenJob)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class ConfigRewrite:
"""
Attributes:
- jobRewrite
- instanceRewrite
"""
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'jobRewrite', (JobConfigRewrite, JobConfigRewrite.thrift_spec), None, ), # 1
(2, TType.STRUCT, 'instanceRewrite', (InstanceConfigRewrite, InstanceConfigRewrite.thrift_spec), None, ), # 2
)
def __init__(self, jobRewrite=None, instanceRewrite=None,):
self.jobRewrite = jobRewrite
self.instanceRewrite = instanceRewrite
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.jobRewrite = JobConfigRewrite()
self.jobRewrite.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.instanceRewrite = InstanceConfigRewrite()
self.instanceRewrite.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('ConfigRewrite')
if self.jobRewrite is not None:
oprot.writeFieldBegin('jobRewrite', TType.STRUCT, 1)
self.jobRewrite.write(oprot)
oprot.writeFieldEnd()
if self.instanceRewrite is not None:
oprot.writeFieldBegin('instanceRewrite', TType.STRUCT, 2)
self.instanceRewrite.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.jobRewrite)
value = (value * 31) ^ hash(self.instanceRewrite)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class RewriteConfigsRequest:
"""
Attributes:
- rewriteCommands
"""
thrift_spec = (
None, # 0
(1, TType.LIST, 'rewriteCommands', (TType.STRUCT,(ConfigRewrite, ConfigRewrite.thrift_spec)), None, ), # 1
)
def __init__(self, rewriteCommands=None,):
self.rewriteCommands = rewriteCommands
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.LIST:
self.rewriteCommands = []
(_etype280, _size277) = iprot.readListBegin()
for _i281 in range(_size277):
_elem282 = ConfigRewrite()
_elem282.read(iprot)
self.rewriteCommands.append(_elem282)
iprot.readListEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('RewriteConfigsRequest')
if self.rewriteCommands is not None:
oprot.writeFieldBegin('rewriteCommands', TType.LIST, 1)
oprot.writeListBegin(TType.STRUCT, len(self.rewriteCommands))
for iter283 in self.rewriteCommands:
iter283.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.rewriteCommands)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
| 32.208462 | 563 | 0.648082 | 28,514 | 249,680 | 5.475696 | 0.03237 | 0.017101 | 0.030724 | 0.034816 | 0.747063 | 0.698202 | 0.664954 | 0.650198 | 0.628537 | 0.619795 | 0 | 0.017953 | 0.235033 | 249,680 | 7,751 | 564 | 32.212618 | 0.799515 | 0.053777 | 0 | 0.714081 | 1 | 0 | 0.031903 | 0.0043 | 0 | 0 | 0 | 0 | 0 | 1 | 0.097743 | false | 0 | 0.000636 | 0.036554 | 0.220915 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e78c8504cb38666456dba20dc22f671b4910bff6 | 69 | py | Python | test/test.py | landdafku11/cryptocurrencybot | d91976d4fb42c75632e92bf9dd2b183d584b0f89 | [
"MIT"
] | 1 | 2021-09-30T13:41:12.000Z | 2021-09-30T13:41:12.000Z | test/test.py | KangDo96/CryptoCurrencyBot | 3c5d347495b27c752016302fec761efc46daaae5 | [
"MIT"
] | null | null | null | test/test.py | KangDo96/CryptoCurrencyBot | 3c5d347495b27c752016302fec761efc46daaae5 | [
"MIT"
] | null | null | null | import re
result = re.match(r'Analytics', 'AV Analytics ESET AV')
ad | 17.25 | 55 | 0.724638 | 12 | 69 | 4.166667 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144928 | 69 | 4 | 56 | 17.25 | 0.847458 | 0 | 0 | 0 | 0 | 0 | 0.414286 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e796a58eb4300de0314fe4b7bff78266de9e06d2 | 73 | py | Python | transforms/fcc_fourier/__init__.py | mikelytaev/wave-propagation | eff0eb1fc843e4d206b05731e40047e1d810d76f | [
"MIT"
] | 15 | 2019-06-28T17:05:23.000Z | 2022-03-22T02:20:39.000Z | transforms/fcc_fourier/__init__.py | mikelytaev/wave-propagation | eff0eb1fc843e4d206b05731e40047e1d810d76f | [
"MIT"
] | null | null | null | transforms/fcc_fourier/__init__.py | mikelytaev/wave-propagation | eff0eb1fc843e4d206b05731e40047e1d810d76f | [
"MIT"
] | 3 | 2020-10-10T12:41:19.000Z | 2021-12-17T14:08:18.000Z | __author__ = 'Lytaev Mikhail (mikelytaev@gmail.com)'
from .fcc import *
| 18.25 | 52 | 0.739726 | 9 | 73 | 5.555556 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136986 | 73 | 3 | 53 | 24.333333 | 0.793651 | 0 | 0 | 0 | 0 | 0 | 0.506849 | 0.30137 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e7af089e211f63ddb7f8867bd2361bef7c8bcf00 | 294 | py | Python | membership/membership/customize/on_buy_package.py | techyidiots/memb | 8abf4c9fc7811c285de945eb4921ed359456a456 | [
"MIT"
] | null | null | null | membership/membership/customize/on_buy_package.py | techyidiots/memb | 8abf4c9fc7811c285de945eb4921ed359456a456 | [
"MIT"
] | null | null | null | membership/membership/customize/on_buy_package.py | techyidiots/memb | 8abf4c9fc7811c285de945eb4921ed359456a456 | [
"MIT"
] | 1 | 2019-10-20T02:53:14.000Z | 2019-10-20T02:53:14.000Z | from frappe.utils import getdate
import frappe
# def on_submit(doc, method):
# customer = doc.customer
# package = doc.item_code
# frappe.errprint(package)
# pacakage_list = frappe.get_doc("Membership", package_name)
# for p in pacakage_list:
# if(p== package):
# flag = True
| 17.294118 | 61 | 0.697279 | 40 | 294 | 4.975 | 0.65 | 0.120603 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.187075 | 294 | 16 | 62 | 18.375 | 0.832636 | 0.755102 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
e7d087d4bce65b210611d6c4124f36db77c54fef | 171 | py | Python | website/apps.py | grusirna/django-website | 49958fe98ea2b95d121e8bb880e684ee7be4ec15 | [
"MIT"
] | null | null | null | website/apps.py | grusirna/django-website | 49958fe98ea2b95d121e8bb880e684ee7be4ec15 | [
"MIT"
] | null | null | null | website/apps.py | grusirna/django-website | 49958fe98ea2b95d121e8bb880e684ee7be4ec15 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class BaseConfig(AppConfig):
name = 'website'
verbose_name = '管理员'
def ready(self):
# autodiscover()
pass
| 15.545455 | 33 | 0.625731 | 18 | 171 | 5.888889 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.280702 | 171 | 10 | 34 | 17.1 | 0.861789 | 0.081871 | 0 | 0 | 0 | 0 | 0.064516 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.166667 | 0.166667 | 0 | 0.833333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
e7d3fac356c9b0e2d89f734ced66fde365670cd9 | 395 | py | Python | src/xbot/chatbot.py | xinyang178/xbot | dad1fc67062dc6fd21802899fd68f7eb91c96569 | [
"MIT"
] | 77 | 2020-10-27T12:19:01.000Z | 2022-03-16T09:13:17.000Z | src/xbot/chatbot.py | xinyang178/xbot | dad1fc67062dc6fd21802899fd68f7eb91c96569 | [
"MIT"
] | 7 | 2020-12-09T14:05:07.000Z | 2021-04-28T02:37:05.000Z | src/xbot/chatbot.py | xinyang178/xbot | dad1fc67062dc6fd21802899fd68f7eb91c96569 | [
"MIT"
] | 45 | 2020-09-24T07:28:32.000Z | 2022-03-03T17:09:04.000Z | from .exceptions import XBotBaseException
class ChatbotBaseException(XBotBaseException):
pass
class Chatbot(object):
"""对话机器人类"""
def __init__(self, name):
self._name = name if name else "XBot"
self._history = []
def history(self):
pass
def get_latest_response(self):
pass
def response_from(self, sequence, **kwargs):
pass
| 17.173913 | 48 | 0.635443 | 42 | 395 | 5.761905 | 0.547619 | 0.066116 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.268354 | 395 | 22 | 49 | 17.954545 | 0.83737 | 0.01519 | 0 | 0.307692 | 0 | 0 | 0.010444 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0.307692 | 0.076923 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
99b98c85db6971f73c3d7f68fd6951c03998f24e | 3,102 | py | Python | course/migrations/0092_unicode_literals.py | 68ymtlab/relate | 0120ca0188a969b3251722241e8d97fda52226b4 | [
"Unlicense"
] | null | null | null | course/migrations/0092_unicode_literals.py | 68ymtlab/relate | 0120ca0188a969b3251722241e8d97fda52226b4 | [
"Unlicense"
] | 6 | 2015-08-18T00:13:40.000Z | 2018-01-31T05:55:13.000Z | course/migrations/0092_unicode_literals.py | davis68/relate | eb40c8c17d4a724a60de3caa3334521a833bad5c | [
"Unlicense"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-08 22:07
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('course', '0091_changes_found_for_py3'),
]
operations = [
migrations.AlterField(
model_name='examticket',
name='creator',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Creator'),
),
migrations.AlterField(
model_name='flowaccessexception',
name='creator',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Creator'),
),
migrations.AlterField(
model_name='flowpagevisit',
name='impersonated_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='impersonator', to=settings.AUTH_USER_MODEL, verbose_name='Impersonated by'),
),
migrations.AlterField(
model_name='flowpagevisit',
name='user',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='visitor', to=settings.AUTH_USER_MODEL, verbose_name='User'),
),
migrations.AlterField(
model_name='flowpagevisitgrade',
name='grader',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Grader'),
),
migrations.AlterField(
model_name='flowruleexception',
name='creator',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Creator'),
),
migrations.AlterField(
model_name='flowsession',
name='user',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='User'),
),
migrations.AlterField(
model_name='gradechange',
name='creator',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Creator'),
),
migrations.AlterField(
model_name='gradechange',
name='flow_session',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='grade_changes', to='course.FlowSession', verbose_name='Flow session'),
),
migrations.AlterField(
model_name='participationpreapproval',
name='creator',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Creator'),
),
]
| 45.617647 | 195 | 0.661186 | 349 | 3,102 | 5.667622 | 0.186246 | 0.048534 | 0.077856 | 0.122346 | 0.71638 | 0.71638 | 0.673407 | 0.656218 | 0.656218 | 0.656218 | 0 | 0.008667 | 0.218891 | 3,102 | 67 | 196 | 46.298507 | 0.807676 | 0.021277 | 0 | 0.6 | 1 | 0 | 0.125618 | 0.016485 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 0 | 0.116667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 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 | 3 |
99d9e09b8395d37d0ca88c8eb655595c1c62f9f1 | 97 | py | Python | lab-resources/mapPlottingPy/config.py | varunyn/pythonAtp-workshop | 160b0d8ce1dcb12c888fc4e502d0d3de31280d69 | [
"UPL-1.0",
"BSD-3-Clause"
] | null | null | null | lab-resources/mapPlottingPy/config.py | varunyn/pythonAtp-workshop | 160b0d8ce1dcb12c888fc4e502d0d3de31280d69 | [
"UPL-1.0",
"BSD-3-Clause"
] | null | null | null | lab-resources/mapPlottingPy/config.py | varunyn/pythonAtp-workshop | 160b0d8ce1dcb12c888fc4e502d0d3de31280d69 | [
"UPL-1.0",
"BSD-3-Clause"
] | null | null | null | import cx_Oracle
conn_info = {
'user': 'alpha',
'password': '',
'service_name': ''
}
| 13.857143 | 22 | 0.546392 | 10 | 97 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.247423 | 97 | 6 | 23 | 16.166667 | 0.684932 | 0 | 0 | 0 | 0 | 0 | 0.298969 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.166667 | 0.166667 | 0 | 0.166667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
99ddfd28377654b9736b3e494219ac3970a3bf3d | 2,328 | py | Python | aliyun-python-sdk-dg/aliyunsdkdg/request/v20190327/CreateDatabaseAccessPointRequest.py | yndu13/aliyun-openapi-python-sdk | 12ace4fb39fe2fb0e3927a4b1b43ee4872da43f5 | [
"Apache-2.0"
] | 1,001 | 2015-07-24T01:32:41.000Z | 2022-03-25T01:28:18.000Z | aliyun-python-sdk-dg/aliyunsdkdg/request/v20190327/CreateDatabaseAccessPointRequest.py | yndu13/aliyun-openapi-python-sdk | 12ace4fb39fe2fb0e3927a4b1b43ee4872da43f5 | [
"Apache-2.0"
] | 363 | 2015-10-20T03:15:00.000Z | 2022-03-08T12:26:19.000Z | aliyun-python-sdk-dg/aliyunsdkdg/request/v20190327/CreateDatabaseAccessPointRequest.py | yndu13/aliyun-openapi-python-sdk | 12ace4fb39fe2fb0e3927a4b1b43ee4872da43f5 | [
"Apache-2.0"
] | 682 | 2015-09-22T07:19:02.000Z | 2022-03-22T09:51:46.000Z | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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 aliyunsdkcore.request import RpcRequest
from aliyunsdkdg.endpoint import endpoint_data
class CreateDatabaseAccessPointRequest(RpcRequest):
def __init__(self):
RpcRequest.__init__(self, 'dg', '2019-03-27', 'CreateDatabaseAccessPoint','dg')
self.set_protocol_type('https')
self.set_method('POST')
if hasattr(self, "endpoint_map"):
setattr(self, "endpoint_map", endpoint_data.getEndpointMap())
if hasattr(self, "endpoint_regional"):
setattr(self, "endpoint_regional", endpoint_data.getEndpointRegional())
def get_VpcAZone(self):
return self.get_body_params().get('VpcAZone')
def set_VpcAZone(self,VpcAZone):
self.add_body_params('VpcAZone', VpcAZone)
def get_ClientToken(self):
return self.get_body_params().get('ClientToken')
def set_ClientToken(self,ClientToken):
self.add_body_params('ClientToken', ClientToken)
def get_DbInstanceId(self):
return self.get_body_params().get('DbInstanceId')
def set_DbInstanceId(self,DbInstanceId):
self.add_body_params('DbInstanceId', DbInstanceId)
def get_VpcRegionId(self):
return self.get_body_params().get('VpcRegionId')
def set_VpcRegionId(self,VpcRegionId):
self.add_body_params('VpcRegionId', VpcRegionId)
def get_VSwitchId(self):
return self.get_body_params().get('VSwitchId')
def set_VSwitchId(self,VSwitchId):
self.add_body_params('VSwitchId', VSwitchId)
def get_VpcId(self):
return self.get_body_params().get('VpcId')
def set_VpcId(self,VpcId):
self.add_body_params('VpcId', VpcId) | 33.73913 | 82 | 0.75988 | 311 | 2,328 | 5.514469 | 0.366559 | 0.069971 | 0.04898 | 0.059475 | 0.104956 | 0.104956 | 0.104956 | 0 | 0 | 0 | 0 | 0.005982 | 0.138316 | 2,328 | 69 | 83 | 33.73913 | 0.848953 | 0.323883 | 0 | 0 | 0 | 0 | 0.14361 | 0.016469 | 0 | 0 | 0 | 0 | 0 | 1 | 0.371429 | false | 0 | 0.057143 | 0.171429 | 0.628571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
99e34fc3fe4b4df321b1a45797122554815e18a1 | 2,996 | py | Python | mechanics.py | Windfisch/agario-frickel | 04acf7e45d08878733b0d0a0d65f319f6d14d224 | [
"BSD-3-Clause"
] | 2 | 2015-08-11T00:47:49.000Z | 2016-03-05T13:09:12.000Z | mechanics.py | Windfisch/agario-frickel | 04acf7e45d08878733b0d0a0d65f319f6d14d224 | [
"BSD-3-Clause"
] | 23 | 2015-08-10T11:11:05.000Z | 2015-09-22T16:18:04.000Z | mechanics.py | Windfisch/agario-frickel | 04acf7e45d08878733b0d0a0d65f319f6d14d224 | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) 2015, Florian Jung and Timm Weber
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from agarnet2.world import Cell
def speed(size_or_cell):
if isinstance(size_or_cell, Cell):
if size_or_cell.is_virus or size_or_cell.is_ejected_mass or size_or_cell.is_food:
return 0
else:
return speed(size_or_cell.size)
else:
return 86 / (size_or_cell**0.45)
def viewport_diag(sizesum):
return 370 * max(sizesum,70)**0.431776
eject_delta = 22 # how many degrees do ejects deviate from the original direction (maximum)
def get_my_smallest_cell(c):
return sorted(c.player.own_cells, key = lambda x: x.mass)[0]
def get_my_largest_cell(c):
return sorted(c.player.own_cells, key = lambda x: x.mass)[-1]
def is_enemy(cell, c):
return not cell.is_virus and not cell.is_food and not cell.is_ejected_mass and (not cell.same_player(random_own_cell(c))) and cell.mass > 1.25 * get_my_smallest_cell(c).mass
def is_splitkiller(cell, c):
return not cell.is_virus and not cell.is_food and not cell.is_ejected_mass and(not cell.same_player(random_own_cell(c))) and cell.mass > 2.5 * get_my_smallest_cell(c).mass and cell.mass < 10 * get_my_smallest_cell(c).mass
def is_edible(cell, c):
return cell.is_food or cell.is_ejected_mass or ( (not cell.same_player(c.player.own_cells[0])) and not is_enemy(cell,c) and get_my_largest_cell(c).mass > 1.25 * cell.mass )
def is_dangerous_virus(cell, c):
return cell.is_virus and (cell.mass < self.get_my_largest().mass)
| 45.393939 | 226 | 0.759012 | 492 | 2,996 | 4.48374 | 0.376016 | 0.029465 | 0.031732 | 0.030825 | 0.320943 | 0.256573 | 0.227561 | 0.227561 | 0.203083 | 0.203083 | 0 | 0.01642 | 0.166555 | 2,996 | 65 | 227 | 46.092308 | 0.86704 | 0.524032 | 0 | 0.083333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.041667 | 0.291667 | 0.791667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
99f357d29169601abf543944bae99519788c1f90 | 79 | py | Python | mynn/activations/__init__.py | davidmascharka/MyNN | 0da56806ed4b6cec8e8ee40d5aa1149d1733bd3b | [
"MIT"
] | 19 | 2018-08-06T14:56:08.000Z | 2021-04-27T08:03:04.000Z | mynn/activations/__init__.py | davidmascharka/MyNN | 0da56806ed4b6cec8e8ee40d5aa1149d1733bd3b | [
"MIT"
] | 33 | 2018-08-11T16:48:53.000Z | 2021-06-07T19:11:20.000Z | mynn/activations/__init__.py | davidmascharka/MyNN | 0da56806ed4b6cec8e8ee40d5aa1149d1733bd3b | [
"MIT"
] | 2 | 2018-08-13T19:05:09.000Z | 2021-05-07T09:57:53.000Z | from mygrad.nnet.activations import *
log_softmax = logsoftmax
del logsoftmax
| 15.8 | 37 | 0.822785 | 10 | 79 | 6.4 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126582 | 79 | 4 | 38 | 19.75 | 0.927536 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
99f707c1a721156f92bff7539f6ec6cc81f9f3b4 | 193 | py | Python | txtemplates/echo/__init__.py | mdrohmann/txtemplates | b346b15d3eb465ec828a31fea0a00df3ae582942 | [
"BSD-3-Clause"
] | null | null | null | txtemplates/echo/__init__.py | mdrohmann/txtemplates | b346b15d3eb465ec828a31fea0a00df3ae582942 | [
"BSD-3-Clause"
] | null | null | null | txtemplates/echo/__init__.py | mdrohmann/txtemplates | b346b15d3eb465ec828a31fea0a00df3ae582942 | [
"BSD-3-Clause"
] | null | null | null | """
Minimal server module used for debugging.
"""
import backend
import service
import protocol
__all__ = ['backend', 'service', 'protocol']
# vim: set ft=python spell spelllang=en sw=4 et:
| 16.083333 | 48 | 0.720207 | 26 | 193 | 5.192308 | 0.807692 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006135 | 0.15544 | 193 | 11 | 49 | 17.545455 | 0.822086 | 0.46114 | 0 | 0 | 0 | 0 | 0.229167 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.75 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
821543b228d62a687d310733959a84249fcb0f1f | 178 | py | Python | text_analysis/main/urls.py | bungoume/mecab-web-api | d69fb87778c54e73652652b38dd14245bfb8f4a5 | [
"MIT"
] | 36 | 2015-01-14T03:11:28.000Z | 2022-01-10T03:50:21.000Z | text_analysis/main/urls.py | bungoume/mecab-web-api | d69fb87778c54e73652652b38dd14245bfb8f4a5 | [
"MIT"
] | 49 | 2018-10-04T04:03:11.000Z | 2022-03-07T02:00:25.000Z | text_analysis/main/urls.py | bungoume/mecab-web-api | d69fb87778c54e73652652b38dd14245bfb8f4a5 | [
"MIT"
] | 7 | 2015-07-28T05:02:56.000Z | 2021-05-28T17:38:11.000Z | from django.conf.urls import url
from main import views
urlpatterns = [
url(r'^parse$', views.parse, name='parse'),
url(r'^reading$', views.reading, name='reading'),
]
| 19.777778 | 53 | 0.668539 | 25 | 178 | 4.76 | 0.52 | 0.067227 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.157303 | 178 | 8 | 54 | 22.25 | 0.793333 | 0 | 0 | 0 | 0 | 0 | 0.157303 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
82172be7941802c5ee1e9077dcf973559bec6791 | 119 | py | Python | day_1/hackerrank_if_else.py | anishLearnsToCode/python-workshop-9 | 383d417f37c8779f17128c47eb5f4afb4411781b | [
"MIT"
] | 3 | 2021-01-29T16:35:54.000Z | 2021-11-28T15:42:55.000Z | day_1/hackerrank_if_else.py | anishLearnsToCode/python-workshop-9 | 383d417f37c8779f17128c47eb5f4afb4411781b | [
"MIT"
] | null | null | null | day_1/hackerrank_if_else.py | anishLearnsToCode/python-workshop-9 | 383d417f37c8779f17128c47eb5f4afb4411781b | [
"MIT"
] | 1 | 2021-01-13T14:08:31.000Z | 2021-01-13T14:08:31.000Z | n = int(input())
if n % 2 == 1 or 6 <= n <= 20:
print('Weird')
elif 2 <= n <= 5 or n > 20:
print('Not Weird')
| 17 | 30 | 0.462185 | 23 | 119 | 2.391304 | 0.608696 | 0.109091 | 0.290909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.109756 | 0.310924 | 119 | 6 | 31 | 19.833333 | 0.560976 | 0 | 0 | 0 | 0 | 0 | 0.117647 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.4 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
82230b5ac6a6bd60d80028b577c98d831cc34d26 | 329 | py | Python | cap-2/exercicio_1_modulo_1.py | igoradriano/manipulacao-dados-python-bd | e3e47f15529d98e5c5887ebbb93c48924fceb665 | [
"MIT"
] | null | null | null | cap-2/exercicio_1_modulo_1.py | igoradriano/manipulacao-dados-python-bd | e3e47f15529d98e5c5887ebbb93c48924fceb665 | [
"MIT"
] | null | null | null | cap-2/exercicio_1_modulo_1.py | igoradriano/manipulacao-dados-python-bd | e3e47f15529d98e5c5887ebbb93c48924fceb665 | [
"MIT"
] | null | null | null | arquivo = open("exercicio_1.txt", "w")
arquivo.write("\nTeste 3")
arquivo.write("\nTeste 4")
arquivo.close()
arquivo = open("exercicio_1.txt", "a")
arquivo.write("\nTeste 5")
arquivo.write("\nTeste 6")
arquivo.close()
arquivo = open("exercicio_1.txt", "w")
arquivo.write("\nTeste 7")
arquivo.write("\nTeste 8")
arquivo.close()
| 21.933333 | 38 | 0.693009 | 48 | 329 | 4.6875 | 0.333333 | 0.32 | 0.48 | 0.28 | 0.595556 | 0.595556 | 0.595556 | 0.382222 | 0.382222 | 0 | 0 | 0.03 | 0.088146 | 329 | 14 | 39 | 23.5 | 0.72 | 0 | 0 | 0.416667 | 0 | 0 | 0.31003 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8231786275267cf2d054b04cb9b1d06171482cd7 | 243 | py | Python | src/blog/managers.py | amirpsd/drf_blog_api | 58be081a450840114af021e7412e469fad90456d | [
"MIT"
] | 33 | 2022-02-11T12:16:29.000Z | 2022-03-26T15:08:47.000Z | src/blog/managers.py | amirpsd/django_blog_api | 58be081a450840114af021e7412e469fad90456d | [
"MIT"
] | null | null | null | src/blog/managers.py | amirpsd/django_blog_api | 58be081a450840114af021e7412e469fad90456d | [
"MIT"
] | 5 | 2022-02-11T13:03:52.000Z | 2022-03-28T16:04:32.000Z | from django.db.models import Manager
# create manager
class BlogManager(Manager):
def publish(self):
return self.filter(status='p')
class CategoryManager(Manager):
def active(self):
return self.filter(status=True)
| 18.692308 | 39 | 0.699588 | 30 | 243 | 5.666667 | 0.633333 | 0.117647 | 0.164706 | 0.235294 | 0.305882 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.197531 | 243 | 12 | 40 | 20.25 | 0.871795 | 0.057613 | 0 | 0 | 0 | 0 | 0.004425 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.142857 | 0.285714 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
8243ed7850499e35c23e937600f58b196b8b2307 | 2,454 | py | Python | headliner/model/basic_model.py | audriusuzkuraitis/headliner | f915306fd80218949a6447aa915c93ef4b44fdd0 | [
"MIT"
] | 1 | 2021-01-05T16:26:28.000Z | 2021-01-05T16:26:28.000Z | headliner/model/model_basic.py | lucko515/headliner | ac2cef164a7fbad19b93501177cf25993cf6c588 | [
"MIT"
] | null | null | null | headliner/model/model_basic.py | lucko515/headliner | ac2cef164a7fbad19b93501177cf25993cf6c588 | [
"MIT"
] | null | null | null | from typing import Tuple
import tensorflow as tf
class Encoder(tf.keras.Model):
def __init__(self,
embedding_shape: Tuple[int, int],
lstm_size=50,
embedding_weights=None,
embedding_trainable=True) -> None:
super(Encoder, self).__init__()
vocab_size, vec_dim = embedding_shape
weights = None if embedding_weights is None else [embedding_weights]
self.embedding = tf.keras.layers.Embedding(vocab_size,
vec_dim,
weights=weights,
trainable=embedding_trainable)
self.lstm = tf.keras.layers.LSTM(lstm_size, return_sequences=True, return_state=True, go_backwards=True)
self.lstm_size = lstm_size
def call(self,
sequence: tf.Tensor,
states: tf.Tensor) -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor]:
embed = self.embedding(sequence)
output, state_h, state_c = self.lstm(embed, initial_state=states)
return output, state_h, state_c
def init_states(self, batch_size: int) -> Tuple[tf.Tensor, tf.Tensor]:
return tf.zeros([batch_size, self.lstm_size]), tf.zeros([batch_size, self.lstm_size])
class Decoder(tf.keras.Model):
def __init__(self,
embedding_shape: Tuple[int, int],
lstm_size=50,
embedding_weights=None,
embedding_trainable=True) -> None:
super(Decoder, self).__init__()
self.lstm_size = lstm_size
vocab_size, vec_dim = embedding_shape
weights = None if embedding_weights is None else [embedding_weights]
self.embedding = tf.keras.layers.Embedding(vocab_size,
vec_dim,
weights=weights,
trainable=embedding_trainable)
self.lstm = tf.keras.layers.LSTM(lstm_size, return_sequences=True, return_state=True)
self.dense = tf.keras.layers.Dense(vocab_size)
def call(self, sequence: tf.Tensor, state: tf.Tensor) -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor]:
embed = self.embedding(sequence)
lstm_out, state_h, state_c = self.lstm(embed, state)
logits = self.dense(lstm_out)
return logits, state_h, state_c
| 43.052632 | 112 | 0.577017 | 278 | 2,454 | 4.845324 | 0.18705 | 0.071269 | 0.048255 | 0.059391 | 0.799555 | 0.739421 | 0.739421 | 0.614699 | 0.614699 | 0.614699 | 0 | 0.002449 | 0.334556 | 2,454 | 56 | 113 | 43.821429 | 0.822413 | 0 | 0 | 0.565217 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.108696 | false | 0 | 0.043478 | 0.021739 | 0.26087 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
41467b4919fb523e56e60f29cc674158531c7648 | 79 | py | Python | py_portfolio_index/bin/lists/__init__.py | greenmtnboy/py-portfolio-index | 99ea2619ae60bfdee2e9d4bbccfd7e4fac43b52f | [
"MIT"
] | 1 | 2021-08-13T22:55:58.000Z | 2021-08-13T22:55:58.000Z | py_portfolio_index/bin/lists/__init__.py | ajmal017/py-portfolio-index | 4966bb82fd7e99709492c004eccacf6194563f73 | [
"MIT"
] | null | null | null | py_portfolio_index/bin/lists/__init__.py | ajmal017/py-portfolio-index | 4966bb82fd7e99709492c004eccacf6194563f73 | [
"MIT"
] | 1 | 2021-08-13T22:55:49.000Z | 2021-08-13T22:55:49.000Z | from .inventory import StocklistInventory
STOCK_LISTS = StocklistInventory()
| 15.8 | 41 | 0.835443 | 7 | 79 | 9.285714 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113924 | 79 | 4 | 42 | 19.75 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
414ceba1dab80558e8117417627a3a172ef6b451 | 1,171 | py | Python | Projects/TdorListToCsv/Report.py | annajayne/tdor-site | 7fb2d6ce8afa571b34e4b41432b655798c6e252a | [
"MIT"
] | null | null | null | Projects/TdorListToCsv/Report.py | annajayne/tdor-site | 7fb2d6ce8afa571b34e4b41432b655798c6e252a | [
"MIT"
] | 2 | 2020-11-14T12:01:33.000Z | 2020-11-14T12:08:44.000Z | Projects/TdorListToCsv/Report.py | annajayne/tdor-site | 7fb2d6ce8afa571b34e4b41432b655798c6e252a | [
"MIT"
] | null | null | null | class Report:
def __init__(self):
self.set_age('')
self.set_date('')
self.set_cause('')
self.set_location('')
self.set_remarks('')
self.set_source('')
def clear():
self.data = []
def empty(self):
return (len(self.name) == 0)
def get_name(self):
return self.name
def set_name(self, name):
self.name = name
def get_age(self):
return self.age
def set_age(self, age):
self.age = age
def get_date(self):
return self.date
def set_date(self, date):
self.date = date
def get_location(self):
return self.location
def set_location(self, location):
self.location = location
def get_cause(self):
return self.cause
def set_cause(self, cause):
self.cause = cause
def get_remarks(self):
return self.remarks
def set_remarks(self, remarks):
self.remarks = remarks
def get_source(self):
return self.source
def set_source(self, source):
self.source = source
| 18.015385 | 38 | 0.53544 | 140 | 1,171 | 4.307143 | 0.142857 | 0.13267 | 0.162521 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001337 | 0.36123 | 1,171 | 64 | 39 | 18.296875 | 0.804813 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.425 | false | 0 | 0 | 0.2 | 0.65 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
416a6dd3c8f58ac1aed4ab986d35c46ae1cab248 | 865 | py | Python | setup.py | svartalf/python-opus | a3c1d556d2772b5be659ddd08c033ddd4d566b3a | [
"BSD-3-Clause"
] | 22 | 2015-01-12T21:18:41.000Z | 2021-08-10T04:07:15.000Z | setup.py | svartalf/python-opus | a3c1d556d2772b5be659ddd08c033ddd4d566b3a | [
"BSD-3-Clause"
] | 3 | 2015-12-21T08:14:39.000Z | 2020-12-08T15:36:17.000Z | setup.py | svartalf/python-opus | a3c1d556d2772b5be659ddd08c033ddd4d566b3a | [
"BSD-3-Clause"
] | 21 | 2015-01-02T22:18:53.000Z | 2021-02-03T15:44:43.000Z | # -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='opus',
version='0.0.1',
author='SvartalF',
author_email='self@svartalf.info',
url='https://github.com/svartalf/python-opus',
description='Python bindings to the libopus, IETF low-delay audio codec',
packages=('opus', 'opus.api'),
test_suite='tests',
classifiers=(
'Development Status :: 1 - Planning',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Software Development :: Libraries',
'Topic :: Multimedia :: Sound/Audio :: Conversion',
),
)
| 32.037037 | 77 | 0.602312 | 90 | 865 | 5.766667 | 0.711111 | 0.146435 | 0.192678 | 0.150289 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016768 | 0.241619 | 865 | 26 | 78 | 33.269231 | 0.77439 | 0.024277 | 0 | 0 | 0 | 0 | 0.614014 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.043478 | 0 | 0.043478 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
418a275925658046d8c21c6fb10c3bcf3c2de729 | 982 | py | Python | filter_plugins/core.py | DirkTheDaring/proxmox-fcos | b38c05a5d814ea4820e0b17b16dc2b8c212a650b | [
"BSD-3-Clause"
] | null | null | null | filter_plugins/core.py | DirkTheDaring/proxmox-fcos | b38c05a5d814ea4820e0b17b16dc2b8c212a650b | [
"BSD-3-Clause"
] | null | null | null | filter_plugins/core.py | DirkTheDaring/proxmox-fcos | b38c05a5d814ea4820e0b17b16dc2b8c212a650b | [
"BSD-3-Clause"
] | null | null | null | def filter_child_dictionary(dictionary, key, value):
newdict = {}
for child_name in dictionary:
child = dictionary[child_name]
if not key in child:
continue
if str(child[key]) != str(value):
continue
newdict[child_name] = child
return newdict
def filter_child_attr(dictionary, key, available):
newdict = {}
for child_name in dictionary:
child = dictionary[child_name]
keyfound = key in child
if keyfound == available:
newdict[child_name] = child
return newdict
def filter_child_attr_exists(dictionary, key):
return filter_child_attr(dictionary, key, True)
def filter_child_attr_exists_not(dictionary, key):
return filter_child_attr(dictionary, key, False)
class FilterModule(object):
def filters(self):
return {
'filter_child_dictionary': filter_child_dictionary,
'filter_child_attr_exists': filter_child_attr_exists,
'filter_child_attr_exists_not': filter_child_attr_exists_not
}
| 27.277778 | 66 | 0.730143 | 126 | 982 | 5.380952 | 0.206349 | 0.19469 | 0.199115 | 0.185841 | 0.716814 | 0.547198 | 0.547198 | 0.547198 | 0.315634 | 0.315634 | 0 | 0 | 0.189409 | 982 | 35 | 67 | 28.057143 | 0.851759 | 0 | 0 | 0.413793 | 0 | 0 | 0.076375 | 0.076375 | 0 | 0 | 0 | 0 | 0 | 1 | 0.172414 | false | 0 | 0 | 0.103448 | 0.37931 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
418eeba56215ea28ab36563df70a1daa57be3996 | 3,233 | py | Python | tests/fixtures/test_references_json/content_10_expected.py | elifesciences/elife-tools | ee345bf0e6703ef0f7e718355e85730abbdfd117 | [
"MIT"
] | 9 | 2015-04-16T08:13:31.000Z | 2020-05-18T14:03:06.000Z | tests/fixtures/test_references_json/content_10_expected.py | elifesciences/elife-tools | ee345bf0e6703ef0f7e718355e85730abbdfd117 | [
"MIT"
] | 310 | 2015-02-11T00:30:09.000Z | 2021-07-14T23:58:50.000Z | tests/fixtures/test_references_json/content_10_expected.py | elifesciences/elife-tools | ee345bf0e6703ef0f7e718355e85730abbdfd117 | [
"MIT"
] | 9 | 2015-02-04T01:21:28.000Z | 2021-06-15T12:50:47.000Z | from collections import OrderedDict
expected = [
OrderedDict(
[
("type", "unknown"),
("id", u"bib20"),
("date", u"1993"),
(
"authors",
[
OrderedDict(
[
("type", "person"),
(
"name",
OrderedDict(
[
("preferred", u"Elzinga SDJ"),
("index", u"Elzinga, SDJ"),
]
),
),
]
),
OrderedDict(
[
("type", "person"),
(
"name",
OrderedDict(
[
("preferred", u"Bednarz AL"),
("index", u"Bednarz, AL"),
]
),
),
]
),
OrderedDict(
[
("type", "person"),
(
"name",
OrderedDict(
[
("preferred", u"van Oosterum K"),
("index", u"van Oosterum, K"),
]
),
),
]
),
OrderedDict(
[
("type", "person"),
(
"name",
OrderedDict(
[
("preferred", u"Dekker PJT"),
("index", u"Dekker, PJT"),
]
),
),
]
),
OrderedDict(
[
("type", "person"),
(
"name",
OrderedDict(
[
("preferred", u"Grivell L"),
("index", u"Grivell, L"),
]
),
),
]
),
],
),
("title", u"Nucleic Acids Research"),
(
"details",
u"5328\u20135331, Nucleic Acids Research, 21, 10.1093/nar/21.23.5328",
),
]
)
]
| 35.141304 | 86 | 0.163316 | 101 | 3,233 | 5.227723 | 0.39604 | 0.170455 | 0.198864 | 0.236742 | 0.435606 | 0.435606 | 0.435606 | 0 | 0 | 0 | 0 | 0.042553 | 0.752861 | 3,233 | 91 | 87 | 35.527473 | 0.618273 | 0 | 0 | 0.422222 | 0 | 0.011111 | 0.119394 | 0.006805 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.011111 | 0 | 0.011111 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
41959fb1f1e972c7ddefbb767e3778a8565f0cd6 | 1,434 | py | Python | orangecontrib/OasysWiser/widgets/optical_elements/ow_plane_mirror.py | aljosahafner/OasysWiser | 1d4042102a5016d5d46d29af1cd17bf0c83b9b21 | [
"MIT"
] | null | null | null | orangecontrib/OasysWiser/widgets/optical_elements/ow_plane_mirror.py | aljosahafner/OasysWiser | 1d4042102a5016d5d46d29af1cd17bf0c83b9b21 | [
"MIT"
] | 2 | 2019-04-06T16:29:36.000Z | 2019-04-06T16:31:33.000Z | orangecontrib/OasysWiser/widgets/optical_elements/ow_plane_mirror.py | aljosahafner/OasysWiser | 1d4042102a5016d5d46d29af1cd17bf0c83b9b21 | [
"MIT"
] | 1 | 2020-03-31T10:14:47.000Z | 2020-03-31T10:14:47.000Z | import numpy
from syned.widget.widget_decorator import WidgetDecorator
from syned.beamline.shape import Plane
from wiselib2 import Optics
from wofrywise2.beamline.optical_elements.wise_plane_mirror import WisePlaneMirror
from orangecontrib.wise2.widgets.gui.ow_optical_element import OWOpticalElement
class OWPlaneMirror(OWOpticalElement, WidgetDecorator):
name = "PlaneMirror"
id = "PlaneMirror"
description = "Plane Mirror"
icon = "icons/plane_mirror.png"
priority = 1
def after_change_workspace_units(self):
super(OWPlaneMirror, self).after_change_workspace_units()
def build_mirror_specific_gui(self, container_box):
pass
def get_inner_wise_optical_element(self):
return Optics.MirrorPlane(L=self.length*self.workspace_units_to_m,
AngleGrazing = numpy.deg2rad(self.alpha))
def get_optical_element(self, inner_wise_optical_element):
return WisePlaneMirror(name= self.oe_name,
plane_mirror=inner_wise_optical_element,
position_directives=self.get_PositionDirectives())
def receive_specific_syned_data(self, optical_element):
pass
def check_syned_shape(self, optical_element):
if not isinstance(optical_element._surface_shape, Plane):
raise Exception("Syned Data not correct: Mirror Surface Shape is not Elliptical")
| 34.142857 | 93 | 0.725244 | 164 | 1,434 | 6.060976 | 0.457317 | 0.112676 | 0.04829 | 0.069417 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004417 | 0.2106 | 1,434 | 41 | 94 | 34.97561 | 0.873675 | 0 | 0 | 0.071429 | 0 | 0 | 0.082345 | 0.015352 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0.071429 | 0.214286 | 0.071429 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
41a785ef33b44eebce4a41fa62b8c3c1bb9f0755 | 658 | py | Python | exercicios_mundo-I/ex004b.py | Lucas-Lourencao/ExerciciosPython | e43ce23dbddd126abb9ce6c02bd39dac3677856e | [
"MIT"
] | null | null | null | exercicios_mundo-I/ex004b.py | Lucas-Lourencao/ExerciciosPython | e43ce23dbddd126abb9ce6c02bd39dac3677856e | [
"MIT"
] | null | null | null | exercicios_mundo-I/ex004b.py | Lucas-Lourencao/ExerciciosPython | e43ce23dbddd126abb9ce6c02bd39dac3677856e | [
"MIT"
] | null | null | null | # Dissecando uma variável:
# Exercício para testar tipos primitivos e informações sobre o que for digitado.
a = input('Digite algo: ')
print(type(a))
print('O valor digitado só tem espaços?', a.isspace())
print('O valor digitado é número?', a.isnumeric())
print('O valor digitado é alfanumérico?', a.isalnum())
print('O valor digitado está em minúsculo?', a.islower())
print('O valor digitado está em maiúsculo', a.isupper())
print('O valor digitado está capitalizado?', a.istitle())
print('O valor digitado pertence ao código ascii?', a.isascii())
print('O valor digitado é imprimível?', a.isprintable())
print('O valor digitado é um dígito?', a.isdigit())
| 47 | 80 | 0.731003 | 100 | 658 | 4.81 | 0.49 | 0.112266 | 0.205821 | 0.355509 | 0.318087 | 0.10395 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12614 | 658 | 13 | 81 | 50.615385 | 0.836522 | 0.156535 | 0 | 0 | 0 | 0 | 0.557971 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.909091 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
68c6ad0fb0ff1aef97250832446bf2d3a3408d7b | 2,723 | py | Python | Project/FindMaxAverageDelayType.py | QinganZhao/Big-Data-Management-and-Analysis | 08b68a8a77743f5dea779744dd2011543d92f38c | [
"MIT"
] | 1 | 2020-10-13T10:48:45.000Z | 2020-10-13T10:48:45.000Z | Project/FindMaxAverageDelayType.py | QinganZhao/Big-Data-Management-and-Analysis | 08b68a8a77743f5dea779744dd2011543d92f38c | [
"MIT"
] | null | null | null | Project/FindMaxAverageDelayType.py | QinganZhao/Big-Data-Management-and-Analysis | 08b68a8a77743f5dea779744dd2011543d92f38c | [
"MIT"
] | 1 | 2020-10-13T10:48:46.000Z | 2020-10-13T10:48:46.000Z | #!/usr/bin/python
import sys
def FindMaxAverageDelayType(carrier, weather, nas, security, late_aircraft):
key = ['CARRIER_DELAY', 'WEATHER_DELAY', 'NAS_DELAY',
'SECURITY_DELAY', 'LATE_AIRCRAFT_DELAY']
value = [carrier, weather, nas, security, late_aircraft]
max_val = max(value)
max_key = key[value.index(max_val)]
return (max_key, str(max_val))
for line in sys.stdin:
line = line.strip()
carrier, weather, nas, security, late_aircraft = line.split('\t')
max_key = FindMaxAverageDelayType(float(carrier), float(weather), float(nas),
float(security), float(late_aircraft))[0]
max_val = FindMaxAverageDelayType(float(carrier), float(weather), float(nas),
float(security), float(late_aircraft))[1]
print('The delay category with the longest average delay is ' + max_key +
'; the average delay time is ' + max_val + ' minutes.')
| 143.315789 | 187 | 0.228057 | 116 | 2,723 | 5.181034 | 0.344828 | 0.1198 | 0.084859 | 0.124792 | 0.467554 | 0.467554 | 0.282862 | 0.282862 | 0.282862 | 0.282862 | 0 | 0.002703 | 0.728241 | 2,723 | 18 | 188 | 151.277778 | 0.809459 | 0.005876 | 0 | 0 | 0 | 0 | 0.059524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.058824 | null | null | 0.058824 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
68d2957f7301c3ffbedcb28519ed65a70b320032 | 483 | py | Python | source/supervised/gaussian_process.py | ValentinCalomme/skratch | f234a9b95adfdb20d231d7f8c761ab1098733cb8 | [
"MIT"
] | 4 | 2017-10-27T07:23:34.000Z | 2020-02-11T18:02:39.000Z | source/supervised/gaussian_process.py | ValentinCalomme/skratch | f234a9b95adfdb20d231d7f8c761ab1098733cb8 | [
"MIT"
] | null | null | null | source/supervised/gaussian_process.py | ValentinCalomme/skratch | f234a9b95adfdb20d231d7f8c761ab1098733cb8 | [
"MIT"
] | null | null | null | """Implementation coming soon"""
import numpy as np
from utils.kernels import RBF, LinearKernel, PolynomialKernel
from utils.optimization import GradientDescentOptimizer
class GaussianProcessRegressor:
def __init__(self, kernel=RBF(1.0), seed=0):
self.kernel = kernel
self.rnd = np.random.RandomState(seed)
def fit(self, X, y):
return self
def predict(self, X):
return None
def predict_proba(self, X):
return None
| 17.25 | 61 | 0.677019 | 59 | 483 | 5.457627 | 0.576271 | 0.046584 | 0.068323 | 0.093168 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00813 | 0.236025 | 483 | 27 | 62 | 17.888889 | 0.864499 | 0.05383 | 0 | 0.153846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0 | 0.230769 | 0.230769 | 0.846154 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
68e135f8c698f904728788b7fdcbca1ace9c4596 | 555 | py | Python | history.py | belajarqywok/BL-userExample | 569722b3bae177dac735f7b8cf18860871ce5235 | [
"MIT"
] | 1 | 2021-09-24T11:59:29.000Z | 2021-09-24T11:59:29.000Z | history.py | belajarqywok/BL-userExample | 569722b3bae177dac735f7b8cf18860871ce5235 | [
"MIT"
] | null | null | null | history.py | belajarqywok/BL-userExample | 569722b3bae177dac735f7b8cf18860871ce5235 | [
"MIT"
] | null | null | null | #!/bin/env python3
import datetime
class createUserHistory:
def __init__(self,fileName,history):
self.f=open(fileName,"a")
self.History=history
def create(self):
self.f.writelines("date : "+datetime.datetime.now().strftime("%H")+"-"+datetime.datetime.now().strftime("%d")+"-"+datetime.datetime.now().strftime("%m")+"-"+datetime.datetime.now().strftime("%Y")+"\n"
+"link : "+self.History+"\n"
+"===========================================\n"
)
self.f.close | 46.25 | 208 | 0.517117 | 56 | 555 | 5.053571 | 0.482143 | 0.226148 | 0.268551 | 0.381625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002299 | 0.216216 | 555 | 12 | 209 | 46.25 | 0.648276 | 0.030631 | 0 | 0 | 0 | 0 | 0.139405 | 0.083643 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.090909 | 0 | 0.363636 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ec019ee0985ddac3614f1fdf276152cbd847efce | 3,726 | py | Python | tests/_strategies.py | orsinium-forks/json-syntax | a1a9eeb113f13ac62bdea6db9847d7d19658fc50 | [
"MIT"
] | 9 | 2019-02-08T05:59:11.000Z | 2021-04-10T18:04:15.000Z | tests/_strategies.py | orsinium-forks/json-syntax | a1a9eeb113f13ac62bdea6db9847d7d19658fc50 | [
"MIT"
] | 7 | 2019-02-11T15:49:57.000Z | 2020-12-09T08:37:07.000Z | tests/_strategies.py | orsinium-forks/json-syntax | a1a9eeb113f13ac62bdea6db9847d7d19658fc50 | [
"MIT"
] | 4 | 2019-02-05T18:24:40.000Z | 2021-09-30T03:22:07.000Z | """
Some miscellany to keep the type_strategies module a bit more readable.
"""
from hypothesis import strategies as st
import attr
try:
import dataclasses as dc
except ImportError:
dc = None
from datetime import date
from enum import IntEnum
from keyword import iskeyword
import os
import typing
MAX_FIELDS = 8
_max_cp = None if os.environ.get("UNICODE_NAMES") else 0x7F
_any_char = st.characters(min_codepoint=1, max_codepoint=_max_cp)
_ident_start = st.characters(
whitelist_categories=["Lu", "Ll", "Lt", "Lm", "Lo", "Nl"], max_codepoint=_max_cp
)
_ident_tail = st.characters(
whitelist_categories=["Lu", "Ll", "Lt", "Lm", "Lo", "Nl", "Mn", "Mc", "Nd", "Pc"],
whitelist_characters="_",
max_codepoint=_max_cp,
)
@st.composite
def _idents(draw, lengths=st.integers(min_value=0, max_value=80)):
chars = [draw(_ident_start)]
chars.extend(draw(_ident_tail) for _ in range(draw(lengths)))
chars = "".join(chars)
if iskeyword(chars):
chars += draw(_ident_tail)
return chars
def _make_enum(name, elems):
# print(f'IntEnum(enum_{name}, {elems!r})')
return IntEnum("enum_" + name, elems)
idents = _idents()
enums = st.builds(
_make_enum, idents, st.lists(idents, min_size=1, max_size=MAX_FIELDS, unique=True)
)
def fields_idents(types):
return st.dictionaries(
idents, types, dict_class=list, min_size=0, max_size=MAX_FIELDS
)
class _Faux(attr.validators._InstanceOfValidator):
def __call__(self, inst, attr, value):
pass
def attrs(types, frozen):
def _make(name, fields, **kw):
def _attrib(typ):
# Add a bogus validator because from_type reads that, not `type`
# Can't use the real one because of generic types!
return attr.ib(type=typ, validator=_Faux(typ))
# print(f'attrs({name}, {fields}, **{kw})')
return attr.make_class(
"attrs_" + name,
{field: _attrib(typ) for field, typ in fields},
frozen=frozen,
**kw
)
return st.builds(_make, idents, fields_idents(types), slots=st.booleans())
if dc is not None:
def dataclasses(types, frozen):
def _make(name, fields, order):
# print(f'dataclass({name}, {fields}, frozen={frozen}, order={order}')
return dc.make_dataclass(
"dc_" + name, fields, frozen=frozen, eq=True, order=order
)
return st.builds(_make, idents, fields_idents(types), order=st.booleans())
else:
def dataclasses(types, frozen):
return None
try:
_NamedTuple = typing.NamedTuple
except AttributeError:
def namedtuples(types):
return None
else:
def namedtuples(types):
def _make(name, fields):
# print(f'namedtuple({name}, {fields})')
return _NamedTuple("nt_" + name, fields)
return st.builds(_make, idents, fields_idents(types))
def lists(types):
return st.builds(lambda a: typing.List[a], types)
def hmg_tuples(types):
return st.builds(lambda a: typing.Tuple[a, ...], types)
def sets(types):
return st.builds(lambda a: typing.Set[a], types)
def frozensets(types):
return st.builds(lambda a: typing.FrozenSet[a], types)
_dict_keys = atoms = st.one_of([st.sampled_from([int, str, date]), enums])
def dicts(val_types):
return st.builds(lambda k, v: typing.Dict[k, v], _dict_keys, val_types)
def prod_tuples(types):
return st.builds(
lambda a: typing.Tuple[tuple(a)],
st.lists(types, min_size=1, max_size=MAX_FIELDS),
)
def unions(types, max_size=None):
return st.builds(
lambda a: typing.Union[tuple(a)], st.lists(types, min_size=1, max_size=max_size)
)
| 24.513158 | 88 | 0.648953 | 510 | 3,726 | 4.558824 | 0.303922 | 0.037849 | 0.060215 | 0.060215 | 0.277419 | 0.247742 | 0.212043 | 0.157849 | 0.104946 | 0.067957 | 0 | 0.003777 | 0.218465 | 3,726 | 151 | 89 | 24.675497 | 0.794643 | 0.100913 | 0 | 0.12766 | 0 | 0 | 0.018879 | 0 | 0 | 0 | 0.001199 | 0 | 0 | 1 | 0.212766 | false | 0.010638 | 0.095745 | 0.148936 | 0.521277 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ec1d2d3db8b2ef70546ed8bc91f890f3b5fd3c92 | 1,686 | py | Python | Ejercicio 4/CuentaBancaria.py | alexbalduz/EjerciciosPOO | 550b69bc42d21e092482e0efc31a67e7212b9839 | [
"Apache-2.0"
] | null | null | null | Ejercicio 4/CuentaBancaria.py | alexbalduz/EjerciciosPOO | 550b69bc42d21e092482e0efc31a67e7212b9839 | [
"Apache-2.0"
] | 1 | 2021-11-14T23:17:50.000Z | 2021-11-14T23:17:50.000Z | Ejercicio 4/CuentaBancaria.py | alexbalduz/EjerciciosPOO | 550b69bc42d21e092482e0efc31a67e7212b9839 | [
"Apache-2.0"
] | null | null | null | class CuentaBancaria():
def __init__(self, ID, titular, fecha_apertura, numero_cuenta, saldo):
self.ID = ID
self.titular = titular
self.fecha_apertura = fecha_apertura
self.numero_cuenta = numero_cuenta
self.saldo = saldo
#Método set
def setID(self, ID):
self.ID = ID
def settitular(self, titular):
self.titular = titular
def setfecha_apertura(self, fecha_apertura):
self.fecha_apertura = fecha_apertura
def setnumero_cuenta(self, numero_cuenta):
self.numero_cuenta = numero_cuenta
def setsaldo(self, saldo):
self.saldo = saldo
#Método get
def getID(self):
return self.ID
def gettitular(self):
return self.titular
def getfecha_apertura(self):
return self.fecha_apertura
def getnumero_cuenta(self):
return self.numero_cuenta
def getsaldo(self):
return self.saldo
#Método para retirar dinero
def retirar_dinero(self, dinero):
if float(dinero) > self.getsaldo():
print('No hay suficiente dinero para retirar')
else:
dinero_final = (self.getsaldo()) - float(dinero)
self.setsaldo(dinero_final)
#Método para ingresar dinero
def ingresar_dinero(self, dinero):
dinero_final = (self.getsaldo()) + float(dinero)
self.setsaldo(dinero_final)
#Método para transferir dinero
def transferir_dinero(self, dinero, cuenta):
if float(dinero) > self.getsaldo():
print('No hay suficiente saldo para transferir')
else:
self.retirar_dinero(dinero)
cuenta.ingresar_dinero(dinero)
| 27.639344 | 74 | 0.639383 | 194 | 1,686 | 5.396907 | 0.201031 | 0.086915 | 0.066858 | 0.042025 | 0.324737 | 0.213945 | 0.213945 | 0.213945 | 0.213945 | 0.127985 | 0 | 0 | 0.275801 | 1,686 | 60 | 75 | 28.1 | 0.857494 | 0.060498 | 0 | 0.380952 | 0 | 0 | 0.048132 | 0 | 0 | 0 | 0 | 0.016667 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.119048 | 0.47619 | 0.047619 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
ec2465c7064ddf1bc175ced63322860beb4d371e | 36 | py | Python | ciphey/iface/_fwd.py | emadfuel/Ciphey | 323fe3aa5eac07a8c25354bdb19fe8a860c11958 | [
"MIT"
] | 9,908 | 2020-06-06T01:06:50.000Z | 2022-03-31T21:22:57.000Z | ciphey/iface/_fwd.py | emadfuel/Ciphey | 323fe3aa5eac07a8c25354bdb19fe8a860c11958 | [
"MIT"
] | 423 | 2020-05-30T11:44:37.000Z | 2022-03-18T03:15:30.000Z | ciphey/iface/_fwd.py | emadfuel/Ciphey | 323fe3aa5eac07a8c25354bdb19fe8a860c11958 | [
"MIT"
] | 714 | 2020-06-09T20:24:41.000Z | 2022-03-29T15:28:53.000Z | registry = None
config = type(None)
| 12 | 19 | 0.722222 | 5 | 36 | 5.2 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 36 | 2 | 20 | 18 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ec251ef94ee94ee4fea6354fcaac3fc04e7bc32a | 1,556 | py | Python | Python/Programming-in-Python/3. Building web-services in Python/Week1/Lecture/regular.py | EldanGS/Engineering | beff426dfeaf71a5cb32b74be81df9540ebece4a | [
"MIT"
] | null | null | null | Python/Programming-in-Python/3. Building web-services in Python/Week1/Lecture/regular.py | EldanGS/Engineering | beff426dfeaf71a5cb32b74be81df9540ebece4a | [
"MIT"
] | 1 | 2019-11-03T10:28:33.000Z | 2019-12-29T17:34:46.000Z | Python/Programming-in-Python/3. Building web-services in Python/Week1/Lecture/regular.py | EldanGS/Engineering | beff426dfeaf71a5cb32b74be81df9540ebece4a | [
"MIT"
] | null | null | null | import re
# Найти все действительные числа, например: -100; 21.4; +5.3; -1.5; 0
# res = re.findall(r"[-+]?\d+(?:\.\d+)?", test_str)
# Проверить, что строка это серийный номер вида 00XXX-XXXXX-XXXXX-XXXXX, где X - шестнадцатиричная цифра
# if re.match(r"^00[\da-f]{3}(?:-[\da-f]{5}){3}$", serial_str, re.IGNORECASE):
# Проверить, что строка является корректным IPv4 адресом
# if re.match(r"^((25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(\.|$)){4}(?<!\.)$", ip_str):
# Проверить, что логин содержит от 8 до 16 латинских букв, цифр и _
# if re.match(r"^\w{8,16}$", login):
# Проверить, что пароль состоит не менее чем из 8 символов без пробелов. Пароль должен содержать хотя бы одну: строчную букву, заглавную, цифру
# if re.match(r"^(?=\S*?[A-Z])(?=\S*?[a-z])(?=\S*?[0-9])\S{8,}$", password):
# Переформатировать код, убрав лишние пробелы между def, именем функции и (
# Например: def myFunc (x, y): => def myFunc(x, y):
# re.sub(r'def\s+(\w+)\s*\(', r'def \1(', code)
# Заменить все "camel_case" на "сamelCase"
# Например: my_function_name, peer__2__peer => myFunctionName, peer2Peer
# re.sub('_+([a-zA-Z\d])', lambda x: x.group(1).upper(), code.lower())
"""
Полезные ссылки:
Документация Python: Модуль re
https://docs.python.org/3/library/re.html
Хабрахабр: Регулярные выражения в Python от простого к сложному
https://habr.com/en/post/349860/
regex101.com: Проверка регулярных выражений online
https://regex101.com
Hackerrank: Практика по regexp
https://www.hackerrank.com/domains/regex
Книга: Фридл Дж. Регулярные выражения 3-е издание
""" | 36.186047 | 143 | 0.673522 | 255 | 1,556 | 4.062745 | 0.588235 | 0.046332 | 0.034749 | 0.03861 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.042741 | 0.127892 | 1,556 | 43 | 144 | 36.186047 | 0.720707 | 0.713368 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
ec2799085ac18c8cf9d0b18092f5f0ab41246c34 | 4,167 | py | Python | omegasensor/bus_i2c.py | bdinhomega/omega-smartsensor-python | 24f88b6246ce69962a2622fd70704f22f2ff76bd | [
"MIT"
] | null | null | null | omegasensor/bus_i2c.py | bdinhomega/omega-smartsensor-python | 24f88b6246ce69962a2622fd70704f22f2ff76bd | [
"MIT"
] | 3 | 2020-07-02T21:47:15.000Z | 2020-12-20T13:09:52.000Z | omegasensor/bus_i2c.py | bdinhomega/omega-smartsensor-python | 24f88b6246ce69962a2622fd70704f22f2ff76bd | [
"MIT"
] | 1 | 2019-07-01T22:46:03.000Z | 2019-07-01T22:46:03.000Z | import smbus
import struct
from .bus import Bus, bus_logger
SMARTSENSOR_I2C_ADDR = 0x68
class BusI2C(Bus):
def __init__(self, bus_id, dev_addr):
"""
Initialize Bus I2C with bus id for device address on the bus
:param bus_id: bus id (eg:1, 2, ...)
:param dev_addr: device address
"""
super().__init__(Bus.Type.I2C, dev_addr)
self.bus = smbus.SMBus(bus_id)
def read_register(self, reg_addr, bytes_cnt):
"""
Read from i2c register address with bytes count
:param reg_addr: i2c register address
:param bytes_cnt: bytes count
:return: bytes
"""
data = self.read_bytes(reg_addr, bytes_cnt)
bus_logger.debug("Read 0x%04x <= %s" % (reg_addr, data))
return data
def write_register(self, reg_addr, data):
"""
Write to i2c register address with provided data
:param reg_addr: i2c register address
:param data: data bytes in list
"""
assert(type(data) is list)
bus_logger.debug("Write 0x%04x => %s" % (reg_addr, data))
self.write_bytes(reg_addr, data)
def read_byte(self, reg_addr):
"""
Read a byte from i2c register address
:param reg_addr: i2c register address
:return: byte data
"""
data = self.bus.read_byte(reg_addr)
return data
def read_float(self, reg_addr):
"""
Read a float from i2c register address
:param reg_addr: i2c register address
:return: float data
"""
data = self.bus.read_i2c_block_data(self.dev_addr, reg_addr, 4)
value, = struct.unpack('>f', bytearray(data))
return value
def read_uint32(self, reg_addr):
"""
Read uint32 from i2c register address
:param reg_addr: i2c register address
:return: int data
"""
data = self.bus.read_i2c_block_data(self.dev_addr, reg_addr, 4)
value, = struct.unpack('>I', bytearray(data))
return value
def read_uint16(self, reg_addr):
"""
Read uint16 from i2c register address
:param reg_addr: i2c register address
:return: int data
"""
data = self.bus.read_i2c_block_data(self.dev_addr, reg_addr, 2)
value, = struct.unpack('>H', bytearray(data))
return value
def read_bytes(self, reg_addr, cnt):
"""
Read bytes with count from i2c register address
:param reg_addr: i2c register address
:param cnt: bytes count
:return: bytes
"""
data = self.bus.read_i2c_block_data(self.dev_addr, reg_addr, cnt)
return data
def write_byte(self, reg_addr, data):
"""
Write bytes to i2c register address
:param reg_addr: i2c register address
:param data: bytes
"""
self.bus.write_byte(reg_addr, data)
def write_float(self, reg_addr, value: float):
"""
Write float value to i2c register address
:param reg_addr: i2c register address
:param value: float value
"""
data = struct.pack('>f', value)
self.bus.write_block_data(self.dev_addr, reg_addr, data)
def write_uint32(self, reg_addr, value: int):
"""
Write uint32 value to i2c register address
:param reg_addr: i2c register address
:param value: int value
"""
data = struct.pack(">I", value)
self.bus.write_block_data(self.dev_addr, reg_addr, data)
def write_uint16(self, reg_addr, value: int):
"""
Write uint16 value to i2c register address
:param reg_addr: i2c register address
:param value: int value
"""
data = struct.pack(">H", value)
self.bus.write_block_data(self.dev_addr, reg_addr, data)
def write_bytes(self, reg_addr, data: bytearray):
"""
Write bytes to i2c register address
:param reg_addr: i2c register address
:param data: bytes
"""
self.bus.write_i2c_block_data(self.dev_addr, reg_addr, data)
| 31.80916 | 73 | 0.595152 | 546 | 4,167 | 4.349817 | 0.117216 | 0.112 | 0.181895 | 0.174316 | 0.650947 | 0.606737 | 0.533053 | 0.494737 | 0.464 | 0.464 | 0 | 0.021936 | 0.310775 | 4,167 | 130 | 74 | 32.053846 | 0.805014 | 0.344132 | 0 | 0.234043 | 0 | 0 | 0.021315 | 0 | 0 | 0 | 0.001814 | 0 | 0.021277 | 1 | 0.276596 | false | 0 | 0.06383 | 0 | 0.489362 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ec38005d270c596c400c802b6093e6743e25eb9c | 152 | py | Python | python/ch_07_filter.py | simonmonk/raspberrypi_cookbook_ed4 | dc320dfae4252f70c812af1dd7739d13d09615c1 | [
"MIT"
] | 7 | 2022-03-19T18:53:39.000Z | 2022-03-22T13:41:30.000Z | python/ch_07_filter.py | simonmonk/raspberrypi_cookbook_ed4 | dc320dfae4252f70c812af1dd7739d13d09615c1 | [
"MIT"
] | null | null | null | python/ch_07_filter.py | simonmonk/raspberrypi_cookbook_ed4 | dc320dfae4252f70c812af1dd7739d13d09615c1 | [
"MIT"
] | null | null | null | new_list = []
people = ['agnes', 'andrew','jane','peter']
for person in people:
if person[0] == 'a':
new_list.append(person)
print(new_list) | 25.333333 | 43 | 0.618421 | 22 | 152 | 4.136364 | 0.681818 | 0.230769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008065 | 0.184211 | 152 | 6 | 44 | 25.333333 | 0.725806 | 0 | 0 | 0 | 0 | 0 | 0.137255 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ec38265953ceab4d1b85721c4f30a8f312831d23 | 690 | py | Python | examples/session4/snow.py | futurice/PythonInBrowser | 066ab28ffad265efc7968b87f33dab2c68216d9d | [
"MIT"
] | 4 | 2015-12-08T19:34:49.000Z | 2019-09-08T22:11:05.000Z | examples/session4/snow.py | futurice/PythonInBrowser | 066ab28ffad265efc7968b87f33dab2c68216d9d | [
"MIT"
] | 18 | 2016-10-14T13:48:39.000Z | 2019-10-11T12:14:21.000Z | examples/session4/snow.py | futurice/PythonInBrowser | 066ab28ffad265efc7968b87f33dab2c68216d9d | [
"MIT"
] | 4 | 2015-11-18T15:18:43.000Z | 2018-03-02T09:36:23.000Z | # Let's draw snowflakes
##### INFO #####
# Click run to see what happens when function letThereBeSnow is called
import winter
winter.letThereBeSnow(20)
##### Exercise #####
# In the beginning we import winter. To see what is in winter go to Modules and open Winter.
# You can find Modules under Exercises. Read the code there.
# 1. Write a function that draws snowflake of your design
# 2. Write a function that draws snowflakes x times, where x is a given parameter
# 3. Can you make the location random to your snowflake?
# 4. Can you make the lenght of the side random to your snowflake?
# 5. Design your winter view and make other figures and use them the same way as snowflakes
| 32.857143 | 92 | 0.743478 | 115 | 690 | 4.46087 | 0.582609 | 0.019493 | 0.035088 | 0.070175 | 0.089669 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012545 | 0.191304 | 690 | 20 | 93 | 34.5 | 0.90681 | 0.872464 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
ec5813245cf0a9c08a1911e4c7e2f24ff5efcb2d | 2,586 | py | Python | PythonTricks/ch03_03.py | eroicaleo/LearningPython | 297d46eddce6e43ce0c160d2660dff5f5d616800 | [
"MIT"
] | 1 | 2020-10-12T13:33:29.000Z | 2020-10-12T13:33:29.000Z | PythonTricks/ch03_03.py | eroicaleo/LearningPython | 297d46eddce6e43ce0c160d2660dff5f5d616800 | [
"MIT"
] | null | null | null | PythonTricks/ch03_03.py | eroicaleo/LearningPython | 297d46eddce6e43ce0c160d2660dff5f5d616800 | [
"MIT"
] | 1 | 2016-11-09T07:28:45.000Z | 2016-11-09T07:28:45.000Z | #!/usr/bin/env python
def null_decorator(func):
return func
null_decorator(print)('Hello decorator!')
def greet():
return 'Hello!'
print(null_decorator(greet)())
print('greet:', greet)
print('null_decorator(greet):', null_decorator(greet))
def uppercase(func):
def wrapper():
original_result = func()
modified_result = original_result.upper()
return modified_result
return wrapper
@uppercase
def greet2():
return 'Hello!'
print(greet2())
print('greet2:', greet2)
print('uppercase(greet2): ', uppercase(greet2))
print('################################################################################')
print('## Applying Multiple Decorators to a Function')
print('################################################################################')
def strong(func):
def wrapper():
return '<strong>' + func() + '</strong>'
return wrapper
def emphasize(func):
def wrapper():
return '<em>' + func() + '</em>'
return wrapper
@strong
@emphasize
def greet3():
return 'Hello!'
print(greet3())
print('################################################################################')
print('## Decorating Functions That Accept Arguments')
print('################################################################################')
def trace(func):
def wrapper(*args, **kwargs):
print(f'TRACE: calling {func.__name__}() '
f'with {args}, {kwargs}')
original_result = func(*args, **kwargs)
print(f'TRACE: {func.__name__}() '
f'returned {original_result!r}')
return original_result
return wrapper
@trace
def say(name, line):
return f'{name}: {line}'
print(say('Jane', 'Hello, World!'))
print('################################################################################')
print('## How to Write “Debuggable” Decorators')
print('################################################################################')
import functools
def uppercase(func):
@functools.wraps(func)
def wrapper():
return func().upper()
return wrapper
@uppercase
def greet():
"""Return a frendly greeting."""
return 'Hello!'
print('With functools.wraps')
print('greet.__name__:', greet.__name__)
print('greet.__doc__:', greet.__doc__)
def uppercase(func):
def wrapper():
return func().upper()
return wrapper
@uppercase
def greet():
"""Return a frendly greeting."""
return 'Hello!'
print('Without functools.wraps')
print('greet.__name__:', greet.__name__)
print('greet.__doc__:', greet.__doc__)
| 23.724771 | 89 | 0.520882 | 243 | 2,586 | 5.329218 | 0.234568 | 0.032432 | 0.064865 | 0.061776 | 0.301158 | 0.239382 | 0.239382 | 0.239382 | 0.239382 | 0.239382 | 0 | 0.003683 | 0.160093 | 2,586 | 108 | 90 | 23.944444 | 0.592541 | 0.028616 | 0 | 0.480519 | 0 | 0 | 0.389444 | 0.20072 | 0 | 0 | 0 | 0 | 0 | 1 | 0.246753 | false | 0 | 0.012987 | 0.116883 | 0.506494 | 0.337662 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
6b67b773888b707398601510246c08ee287f8088 | 127 | py | Python | test/files/template-engine/custom-delimiter.py | AlexCortinas/spl-js-engine | c7931a5024b9f096ed283daa40e09d6239c9ae21 | [
"MIT"
] | 1 | 2021-12-17T14:43:36.000Z | 2021-12-17T14:43:36.000Z | test/files/template-engine/custom-delimiter.py | AlexCortinas/spl-js-engine | c7931a5024b9f096ed283daa40e09d6239c9ae21 | [
"MIT"
] | 1 | 2020-11-20T09:24:30.000Z | 2020-11-20T09:24:30.000Z | test/files/template-engine/custom-delimiter.py | AlexCortinas/spl-js-engine | c7931a5024b9f096ed283daa40e09d6239c9ae21 | [
"MIT"
] | null | null | null | #% if (feature.ask) { %#
name = raw_input('What is your name?\n')
#% } else { %#
name = 'alex'
#% } %#
print 'Hi, %s.' % name
| 15.875 | 40 | 0.503937 | 18 | 127 | 3.5 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.220472 | 127 | 7 | 41 | 18.142857 | 0.636364 | 0.307087 | 0 | 0 | 0 | 0 | 0.378049 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6b6b3ef1779ee01919d94b36dadaa2a17af628cb | 750 | py | Python | pac/date_time_op.py | prabhatkumarsagar/Ok-Computer | 76d8a60d31a30d35e6e8b78901b817913045fbf3 | [
"MIT"
] | 2 | 2020-10-18T06:45:54.000Z | 2020-11-07T07:35:52.000Z | pac/date_time_op.py | prabhatkumarsagar/Python-Desktop-Assistant | 76d8a60d31a30d35e6e8b78901b817913045fbf3 | [
"MIT"
] | 9 | 2021-09-03T12:11:19.000Z | 2021-09-24T23:10:19.000Z | pac/date_time_op.py | prabhatkumarsagar/Python-Desktop-Assistant | 76d8a60d31a30d35e6e8b78901b817913045fbf3 | [
"MIT"
] | null | null | null | import datetime
import time as samay
try:
from pac import voice_io
except ModuleNotFoundError:
import voice_io
def date():
x = datetime.datetime.now().strftime("%d/%m/%Y")
voice_io.show(f"Today's date is {x} (DD/MM/YYYY)")
def time():
#x=datetime.datetime.now().strftime("%H:%M:%S")
localtime = samay.localtime()
x = samay.strftime("%I:%M:%S %p", localtime)
voice_io.show(f"The current time is {x}")
def year():
x=datetime.datetime.now().strftime("%Y")
voice_io.show(f"The current year is {x}")
def month():
x=datetime.datetime.now().strftime("%B")
voice_io.show(f"The current month is {x}")
def day():
x=datetime.datetime.now().strftime("%A")
voice_io.show(f"Today it is a {x}")
| 25 | 55 | 0.636 | 120 | 750 | 3.916667 | 0.333333 | 0.104255 | 0.180851 | 0.212766 | 0.514894 | 0.140426 | 0 | 0 | 0 | 0 | 0 | 0 | 0.18 | 750 | 29 | 56 | 25.862069 | 0.764228 | 0.061333 | 0 | 0 | 0 | 0 | 0.206009 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.227273 | false | 0 | 0.181818 | 0 | 0.409091 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6b7064d8c56be0af679f7806003a58d6d6808dfb | 199 | py | Python | try_except.py | purva-saxena/Python-programming | 9458ddca9fc890eeb1fb3a16ceed74cedfcb116d | [
"MIT"
] | 14 | 2020-09-29T07:29:33.000Z | 2020-11-03T04:26:39.000Z | try_except.py | purva-saxena/Python-programming | 9458ddca9fc890eeb1fb3a16ceed74cedfcb116d | [
"MIT"
] | 4 | 2020-10-23T18:10:50.000Z | 2020-10-29T18:39:20.000Z | try_except.py | purva-saxena/Python-programming | 9458ddca9fc890eeb1fb3a16ceed74cedfcb116d | [
"MIT"
] | 5 | 2020-10-15T23:49:29.000Z | 2020-10-28T20:16:42.000Z | try:
num1 = int(input("TELL ME YOUR AGE\n"))
num2 = int(input("TELL ME YOUR name\n"))
print(num1 + num2)
# print(num2)
except Exception as dfdfe:
print(dfdfe)
print("HELLO\n")
| 16.583333 | 44 | 0.60804 | 31 | 199 | 3.903226 | 0.548387 | 0.132231 | 0.198347 | 0.231405 | 0.297521 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032895 | 0.236181 | 199 | 11 | 45 | 18.090909 | 0.763158 | 0.055276 | 0 | 0 | 0 | 0 | 0.237838 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.428571 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
6b7c3eb5e8f22d85220817d66b3c94157606b9f8 | 157 | py | Python | reference/hello.py | philanaaurelia/ucsb-gradescope-diff-based-testing | b05f81eb772f187e3ac83f1c3cc98dcb367fed30 | [
"MIT"
] | 2 | 2018-03-29T22:36:37.000Z | 2018-03-30T04:08:40.000Z | reference/hello.py | project-anacapa/gradescope-diff-engine | b6b1c36d5508dc675657c5219128ebd65042ce82 | [
"MIT"
] | null | null | null | reference/hello.py | project-anacapa/gradescope-diff-engine | b6b1c36d5508dc675657c5219128ebd65042ce82 | [
"MIT"
] | 6 | 2018-08-16T20:35:38.000Z | 2021-09-29T06:23:09.000Z | import sys
print("Hello World on Stdout")
print('spam on stderr', file=sys.stderr)
with open('myfile.out', 'w') as out:
out.write("Hello myfile.out")
| 17.444444 | 40 | 0.681529 | 26 | 157 | 4.115385 | 0.653846 | 0.168224 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152866 | 157 | 8 | 41 | 19.625 | 0.804511 | 0 | 0 | 0 | 0 | 0 | 0.397436 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0.4 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6b990ee78718d71db1770ff81ce43c843008e8ed | 1,473 | py | Python | tests/__init__.py | AndreGosselink/binderfinder | 3704b62c2d6ad8825a20ddf86dbd80c3c82b4a12 | [
"BSD-4-Clause"
] | null | null | null | tests/__init__.py | AndreGosselink/binderfinder | 3704b62c2d6ad8825a20ddf86dbd80c3c82b4a12 | [
"BSD-4-Clause"
] | null | null | null | tests/__init__.py | AndreGosselink/binderfinder | 3704b62c2d6ad8825a20ddf86dbd80c3c82b4a12 | [
"BSD-4-Clause"
] | null | null | null | import numpy as np
import os
def get_params(kw):
param_dict = dict(pca_min=dict(filename=os.path.join('data', 'mock_data_pca_testcases.csv'),
annotate=False,
normalize=True,
covplot=False,
portions=False,
),)
return param_dict[kw]
def get_testdata():
ret = np.array([[7.7, 5.0, 9.1, -7.7,2.2,-0.8,-0.67],
[8.1,-1.9, 7.4, -8.1,2.3, 2.4, 1.76],
[8.0,-2.2, 9.1, -7.8,2.5, 0.3, 1.77],
[8.3, 2.8, 9.0, -9.9,2.4,-0.0, 1.52],
[8.3,-4.7, 9.1, -8.7,2.0, 0.4, 0.01],
[9.1, 0.4, 9.6, -9.5,2.2, 1.9, 0.24],
[9.3,-4.4,10.2, -9.7,2.3, 5.3, 3.73],
[9.1, 3.9,10.3, -8.5,2.8, 2.5, 3.14],
[9.2, 1.0, 9.9, -9.5,2.2, 1.9, 2.06],
[9.3, 2.1,10.8, -8.6,2.3,-2.8,-0.02],
[9.2, 1.8, 9.2, -8.9,3.5, 1.2, 3.09],
[9.6,-3.1,10.3,-10.6,2.6, 0.6, 0.77],
[9.3,-1.2, 8.9, -9.0,3.9, 4.0, 2.07],
[9.9,-4.6,10.8,-11.7,2.5, 5.1, 3.82],
[9.5, 2.7, 9.2,-10.0,2.3, 0.8, 1.85],
[9.3,-3.5, 9.7, -9.0,2.6, 3.9, 2.88],
[9.8, 2.6, 9.7,-10.4,2.5, 5.6, 4.00],])
return ret.T
| 44.636364 | 97 | 0.325187 | 285 | 1,473 | 1.652632 | 0.207018 | 0.029724 | 0.019108 | 0.016985 | 0.025478 | 0.025478 | 0 | 0 | 0 | 0 | 0 | 0.320778 | 0.441276 | 1,473 | 32 | 98 | 46.03125 | 0.251519 | 0 | 0 | 0 | 0 | 0 | 0.021513 | 0.018737 | 0 | 0 | 0 | 0 | 0 | 1 | 0.068966 | false | 0 | 0.068966 | 0 | 0.206897 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6bcbb3e5ea67ecd5b0a61799f0e99ccabcf98ba1 | 4,176 | py | Python | plot/spatial_distribution.py | stanford-policylab/surveilling-surveillance | bbb9a147927a6342eecfe07ffa756b3acdb63f35 | [
"MIT"
] | 8 | 2021-05-21T03:38:52.000Z | 2021-11-21T08:32:41.000Z | plot/spatial_distribution.py | stanford-policylab/surveilling-surveillance | bbb9a147927a6342eecfe07ffa756b3acdb63f35 | [
"MIT"
] | null | null | null | plot/spatial_distribution.py | stanford-policylab/surveilling-surveillance | bbb9a147927a6342eecfe07ffa756b3acdb63f35 | [
"MIT"
] | 1 | 2021-06-13T21:49:14.000Z | 2021-06-13T21:49:14.000Z | from util import constants as C
import osmnx as ox
import pandas as pd
import pickle as pkl
from tqdm import tqdm
from matplotlib import pyplot as plt
import seaborn as sb
sb.set()
def plot_samples(
meta_file_path="/home/haosheng/dataset/camera/deployment/verified_0425.csv"):
data = pd.read_csv(meta_file_path)
for city, place in list(C.CITIES.items()):
with open(f"/home/haosheng/dataset/camera/shape/graph/{city}.pkl", "rb") as f:
G = pkl.load(f)
ox.plot.plot_graph(G,
figsize=(12, 12),
bgcolor='white',
node_color='#696969',
edge_color="#A9A9A9",
edge_linewidth=0.8,
node_size=0,
edge_alpha=0.5,
save=False,
show=False)
sample = data.query(f'city == "{city}"')
plt.scatter(
sample.lon_anchor,
sample.lat_anchor,
s=0.2,
c='blue',
alpha=1)
plt.tight_layout()
plt.savefig(f"figures/samples_{city}.png")
print(f"Save figure to [figures/samples_{city}.png]")
def plot_prepost(
meta_file_path="/home/haosheng/dataset/camera/deployment/verified_prepost_0425.csv"):
data = pd.read_csv(meta_file_path)
for city, place in list(C.CITIES.items())[:10]:
with open(f"/home/haosheng/dataset/camera/shape/graph/{city}.pkl", "rb") as f:
G = pkl.load(f)
ox.plot.plot_graph(G,
figsize=(12, 12),
bgcolor='white',
node_color='#696969',
edge_color="#A9A9A9",
edge_linewidth=0.8,
node_size=0,
edge_alpha=0.5,
save=False,
show=False)
print("Generating the plot .. ")
pre = data.query(
f'camera_count > 0 and split == "pre" and city == "{city}"')
post = data.query(
f'camera_count > 0 and split == "post" and city == "{city}"')
plt.scatter(
pre.lon_anchor,
pre.lat_anchor,
s=150,
facecolors='none',
edgecolors='red',
linewidth=2.0,
marker='o')
plt.scatter(
post.lon_anchor,
post.lat_anchor,
s=120,
c='black',
marker='x')
plt.tight_layout()
plt.savefig(f"figures/prepost_spatial_distribution_{city}.png")
print(
f"Save figure to [figures/prepost_spatial_distribution_{city}.png]")
def plot_post(
meta_file_path="/home/haosheng/dataset/camera/deployment/verified_0425.csv"):
data = pd.read_csv(meta_file_path)
for city, place in C.CITIES.items():
with open(f"/home/haosheng/dataset/camera/shape/graph/{city}.pkl", "rb") as f:
G = pkl.load(f)
ox.plot.plot_graph(G,
figsize=(12, 12),
bgcolor='white',
node_color='#696969',
edge_color="#A9A9A9",
edge_linewidth=0.8,
node_size=0,
edge_alpha=0.5,
save=False,
show=False)
print("Generating the plot .. ")
pre = data.query(f'camera_count > 0 and city == "{city}"')
post = data.query(f'camera_count > 0 and city == "{city}"')
plt.scatter(
pre.lon_anchor,
pre.lat_anchor,
color='red',
#color='#BE0000',
s=30,
linewidth=2.0,
marker='o',
alpha=1)
plt.tight_layout()
plt.savefig(f"figures/post_spatial_distribution_{city}.png")
print(f"Save figure to [figures/post_spatial_distribution_{city}.png]")
def plot_spatial_distribution():
plot_samples()
plot_prepost()
plot_post()
| 33.142857 | 93 | 0.494013 | 473 | 4,176 | 4.205074 | 0.230444 | 0.024133 | 0.036199 | 0.075415 | 0.778281 | 0.760181 | 0.715938 | 0.699849 | 0.678733 | 0.612871 | 0 | 0.036036 | 0.388649 | 4,176 | 125 | 94 | 33.408 | 0.743047 | 0.003592 | 0 | 0.542056 | 0 | 0 | 0.230103 | 0.138976 | 0 | 0 | 0 | 0 | 0 | 1 | 0.037383 | false | 0 | 0.065421 | 0 | 0.102804 | 0.046729 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6bd10a1009a7a9276dfac9b6f1302d44fec959de | 1,051 | py | Python | core/migrations/0057_auto_20210624_1451.py | CrownKira/digitalace-backend | 9489b3dc4b856688360b60a7dca040c945faab74 | [
"MIT"
] | 1 | 2021-05-28T05:22:54.000Z | 2021-05-28T05:22:54.000Z | core/migrations/0057_auto_20210624_1451.py | CrownKira/digitalace-backend | 9489b3dc4b856688360b60a7dca040c945faab74 | [
"MIT"
] | 3 | 2021-05-31T15:44:14.000Z | 2021-06-29T07:48:13.000Z | core/migrations/0057_auto_20210624_1451.py | CrownKira/digitalace-backend | 9489b3dc4b856688360b60a7dca040c945faab74 | [
"MIT"
] | 1 | 2021-05-30T07:42:54.000Z | 2021-05-30T07:42:54.000Z | # Generated by Django 3.2.3 on 2021-06-24 14:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0056_auto_20210624_1401'),
]
operations = [
migrations.AddField(
model_name='invoice',
name='reference',
field=models.CharField(default=0, max_length=255),
preserve_default=False,
),
migrations.AddField(
model_name='purchaseorder',
name='reference',
field=models.CharField(default=0, max_length=255),
preserve_default=False,
),
migrations.AddField(
model_name='receive',
name='reference',
field=models.CharField(default=0, max_length=255),
preserve_default=False,
),
migrations.AddField(
model_name='salesorder',
name='reference',
field=models.CharField(default=0, max_length=255),
preserve_default=False,
),
]
| 27.657895 | 62 | 0.569933 | 101 | 1,051 | 5.782178 | 0.415842 | 0.123288 | 0.157534 | 0.184932 | 0.638699 | 0.638699 | 0.638699 | 0.638699 | 0.638699 | 0.638699 | 0 | 0.065919 | 0.321598 | 1,051 | 37 | 63 | 28.405405 | 0.753156 | 0.042816 | 0 | 0.645161 | 1 | 0 | 0.099602 | 0.022908 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.032258 | 0 | 0.129032 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 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 | 3 |
6be5641617f2cf5dcb13098a8d30b84114fa57cb | 155 | py | Python | portfolio/urls.py | samshultz/techbitsdata | 753309cbfee7bfa9a08804786f29b37f2b058436 | [
"BSD-3-Clause"
] | null | null | null | portfolio/urls.py | samshultz/techbitsdata | 753309cbfee7bfa9a08804786f29b37f2b058436 | [
"BSD-3-Clause"
] | null | null | null | portfolio/urls.py | samshultz/techbitsdata | 753309cbfee7bfa9a08804786f29b37f2b058436 | [
"BSD-3-Clause"
] | null | null | null | from django.urls import path
from . import views
app_name = 'portfolio'
urlpatterns = [
path("", views.ProjectListView.as_view(), name="projects")
] | 17.222222 | 62 | 0.709677 | 19 | 155 | 5.684211 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.154839 | 155 | 9 | 63 | 17.222222 | 0.824427 | 0 | 0 | 0 | 0 | 0 | 0.108974 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
6bf12f27a490cd0034942b4de0cc648c84a98a6b | 201 | py | Python | hello.py | jinguangzhu/the_first_python | d9d035b44652a4cd6ecd1834dd9930d1c78bf360 | [
"Apache-2.0"
] | null | null | null | hello.py | jinguangzhu/the_first_python | d9d035b44652a4cd6ecd1834dd9930d1c78bf360 | [
"Apache-2.0"
] | null | null | null | hello.py | jinguangzhu/the_first_python | d9d035b44652a4cd6ecd1834dd9930d1c78bf360 | [
"Apache-2.0"
] | 3 | 2018-06-09T01:07:45.000Z | 2018-08-06T12:41:06.000Z | print("first")
print("JinGuangzhu is a fool")
print("To see a world in a grain of sand. And a heaven in a wild flower
Hold infinity in the palm of your hand. And eternity in an hour")
print('test')
| 33.5 | 72 | 0.721393 | 39 | 201 | 3.717949 | 0.692308 | 0.041379 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.189055 | 201 | 5 | 73 | 40.2 | 0.889571 | 0 | 0 | 0 | 0 | 0 | 0.149254 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.8 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
d41926e6c8adf329f8c0dcf3515fc9f0685e0bc6 | 386 | py | Python | erpnext_support/patches/delete_property_setter_doc.py | manuthu/test-package | 906a2a3ce7878d81a01149a60fb06e07400e6f47 | [
"MIT"
] | null | null | null | erpnext_support/patches/delete_property_setter_doc.py | manuthu/test-package | 906a2a3ce7878d81a01149a60fb06e07400e6f47 | [
"MIT"
] | null | null | null | erpnext_support/patches/delete_property_setter_doc.py | manuthu/test-package | 906a2a3ce7878d81a01149a60fb06e07400e6f47 | [
"MIT"
] | null | null | null | import frappe
def execute():
# Delete Property Setter for issue_type as it used to be synced and updated.
if frappe.db.exists("Property Setter", {"doc_type": "ERPNext Support Issue", "field_name": "issue_type"}):
frappe.db.sql("""delete from `tabProperty Setter`
where `tabProperty Setter`.doc_type='ERPNext Support Issue'
and `tabProperty Setter`.field_name='issue_type'""") | 48.25 | 107 | 0.743523 | 55 | 386 | 5.090909 | 0.545455 | 0.096429 | 0.092857 | 0.142857 | 0.228571 | 0.228571 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126943 | 386 | 8 | 108 | 48.25 | 0.830861 | 0.19171 | 0 | 0 | 0 | 0 | 0.678457 | 0.180064 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | true | 0 | 0.166667 | 0 | 0.333333 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d44f823d72b45a0253c1616439d00a1746c1023f | 1,183 | py | Python | chia/pools/custom_pool_api.py | littlechare/keepool-chia-blockchain | 87542572b232ccada9e5446a764979b9df8e5233 | [
"Apache-2.0"
] | 1 | 2021-06-30T13:09:31.000Z | 2021-06-30T13:09:31.000Z | chia/pools/custom_pool_api.py | littlechare/keepool-chia-blockchain | 87542572b232ccada9e5446a764979b9df8e5233 | [
"Apache-2.0"
] | 26 | 2021-07-20T12:04:35.000Z | 2022-03-29T12:10:06.000Z | chia/pools/custom_pool_api.py | littlechare/keepool-chia-blockchain | 87542572b232ccada9e5446a764979b9df8e5233 | [
"Apache-2.0"
] | null | null | null | from chia.pools.pool_config import load_pool_config, PoolWalletConfig
from chia.util.byte_types import hexstr_to_bytes
from blspy import G1Element
from pathlib import Path
from typing import List
def custom_load_pool_config(root_path: Path) -> List[PoolWalletConfig]:
ret_list = []
config = PoolWalletConfig(hexstr_to_bytes('ae4ef3b9bfe68949691281a015a9c16630fc8f66d48c19ca548fb80768791afa'),
'https://www.keepool.net/app/pool',
'c2b08e41d766da4116e388357ed957d04ad754623a915f3fd65188a8746cf3e8',
hexstr_to_bytes('344587cf06a39db471d2cc027504e8688a0a67cce961253500c956c73603fd58'),
hexstr_to_bytes('2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824'),
G1Element.from_bytes(hexstr_to_bytes('84c3fcf9d5581c1ddc702cb0f3b4a06043303b334dd993ab42b2c320ebfa98e5ce558448615b3f69638ba92cf7f43da5')),
G1Element.from_bytes(hexstr_to_bytes('970e181ae45435ae696508a78012dc80548c334cf29676ea6ade7049eb9d2b9579cc30cb44c3fd68d35a250cfbc69e29')))
ret_list.append(config)
return ret_list
| 62.263158 | 168 | 0.743026 | 85 | 1,183 | 10.047059 | 0.435294 | 0.056206 | 0.091335 | 0.056206 | 0.0726 | 0.0726 | 0 | 0 | 0 | 0 | 0 | 0.313559 | 0.202029 | 1,183 | 18 | 169 | 65.722222 | 0.591102 | 0 | 0 | 0 | 0 | 0 | 0.406091 | 0.379019 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | false | 0 | 0.3125 | 0 | 0.4375 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
d4710895ea31d27e437d24cfe00330df1cb51844 | 1,089 | py | Python | src/14 - tuples.py | filchyboy/cs-intro-1 | cf6b752d3ae60b29af389cda279d39720ae5441b | [
"MIT"
] | null | null | null | src/14 - tuples.py | filchyboy/cs-intro-1 | cf6b752d3ae60b29af389cda279d39720ae5441b | [
"MIT"
] | null | null | null | src/14 - tuples.py | filchyboy/cs-intro-1 | cf6b752d3ae60b29af389cda279d39720ae5441b | [
"MIT"
] | null | null | null | """
Tuples
"""
# A tuple is a collection which is ordered and unchangeable
# 1. In Python, tuples are written with round brackets
thistuple = ("apple", "banana", "cherry")
print(thistuple)
# 2. accessing
thistuple = ("apple", "banana", "cherry")
print(thistuple[1])
# 3. reverse indexing
thistuple = ("apple", "banana", "cherry")
print(thistuple[-1])
# 4. slicing
thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")
print(thistuple[2:5])
# 5. negative slicing
thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")
print(thistuple[-4:-1])
# 6. iterating
thistuple = ("apple", "banana", "cherry")
for x in thistuple:
print(x)
# 7. contains?
thistuple = ("apple", "banana", "cherry")
if "apple" in thistuple:
print("Yes, 'apple' is in the fruits tuple")
# 8. creating a tuple with one item
thistuple = ("apple",)
print(type(thistuple))
#NOT a tuple
thistuple = ("apple")
print(type(thistuple))
# 9. concatenating tuples with addition operator
tuple1 = ("a", "b" , "c")
tuple2 = (1, 2, 3)
tuple3 = tuple1 + tuple2
print(tuple3) | 21.78 | 77 | 0.660239 | 143 | 1,089 | 5.027972 | 0.41958 | 0.175243 | 0.194715 | 0.253129 | 0.445063 | 0.35605 | 0.300417 | 0.18637 | 0.18637 | 0.18637 | 0 | 0.026002 | 0.152433 | 1,089 | 50 | 78 | 21.78 | 0.752979 | 0.275482 | 0 | 0.375 | 0 | 0 | 0.274611 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.416667 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
d478b059e9eebc2ce71d7278f72b1c0bf9ca5cad | 4,751 | py | Python | tf2onnx/tflite/DimensionMetadata.py | LoicDagnas/tensorflow-onnx | 6691850e79047d05d85017573170fd8240393b57 | [
"Apache-2.0"
] | 1,473 | 2018-03-16T02:47:33.000Z | 2022-03-31T03:43:52.000Z | tf2onnx/tflite/DimensionMetadata.py | LoicDagnas/tensorflow-onnx | 6691850e79047d05d85017573170fd8240393b57 | [
"Apache-2.0"
] | 1,208 | 2018-03-14T09:58:49.000Z | 2022-03-31T17:56:20.000Z | tf2onnx/tflite/DimensionMetadata.py | LoicDagnas/tensorflow-onnx | 6691850e79047d05d85017573170fd8240393b57 | [
"Apache-2.0"
] | 350 | 2018-04-03T03:48:40.000Z | 2022-03-30T11:23:55.000Z | # SPDX-License-Identifier: Apache-2.0
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class DimensionMetadata(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = DimensionMetadata()
x.Init(buf, n + offset)
return x
@classmethod
def GetRootAsDimensionMetadata(cls, buf, offset=0):
"""This method is deprecated. Please switch to GetRootAs."""
return cls.GetRootAs(buf, offset)
@classmethod
def DimensionMetadataBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed)
# DimensionMetadata
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# DimensionMetadata
def Format(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
# DimensionMetadata
def DenseSize(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0
# DimensionMetadata
def ArraySegmentsType(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
return 0
# DimensionMetadata
def ArraySegments(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
if o != 0:
from flatbuffers.table import Table
obj = Table(bytearray(), 0)
self._tab.Union(obj, o)
return obj
return None
# DimensionMetadata
def ArrayIndicesType(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
return 0
# DimensionMetadata
def ArrayIndices(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
if o != 0:
from flatbuffers.table import Table
obj = Table(bytearray(), 0)
self._tab.Union(obj, o)
return obj
return None
def Start(builder): builder.StartObject(6)
def DimensionMetadataStart(builder):
"""This method is deprecated. Please switch to Start."""
return Start(builder)
def AddFormat(builder, format): builder.PrependInt8Slot(0, format, 0)
def DimensionMetadataAddFormat(builder, format):
"""This method is deprecated. Please switch to AddFormat."""
return AddFormat(builder, format)
def AddDenseSize(builder, denseSize): builder.PrependInt32Slot(1, denseSize, 0)
def DimensionMetadataAddDenseSize(builder, denseSize):
"""This method is deprecated. Please switch to AddDenseSize."""
return AddDenseSize(builder, denseSize)
def AddArraySegmentsType(builder, arraySegmentsType): builder.PrependUint8Slot(2, arraySegmentsType, 0)
def DimensionMetadataAddArraySegmentsType(builder, arraySegmentsType):
"""This method is deprecated. Please switch to AddArraySegmentsType."""
return AddArraySegmentsType(builder, arraySegmentsType)
def AddArraySegments(builder, arraySegments): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(arraySegments), 0)
def DimensionMetadataAddArraySegments(builder, arraySegments):
"""This method is deprecated. Please switch to AddArraySegments."""
return AddArraySegments(builder, arraySegments)
def AddArrayIndicesType(builder, arrayIndicesType): builder.PrependUint8Slot(4, arrayIndicesType, 0)
def DimensionMetadataAddArrayIndicesType(builder, arrayIndicesType):
"""This method is deprecated. Please switch to AddArrayIndicesType."""
return AddArrayIndicesType(builder, arrayIndicesType)
def AddArrayIndices(builder, arrayIndices): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(arrayIndices), 0)
def DimensionMetadataAddArrayIndices(builder, arrayIndices):
"""This method is deprecated. Please switch to AddArrayIndices."""
return AddArrayIndices(builder, arrayIndices)
def End(builder): return builder.EndObject()
def DimensionMetadataEnd(builder):
"""This method is deprecated. Please switch to End."""
return End(builder) | 42.419643 | 150 | 0.720059 | 517 | 4,751 | 6.526112 | 0.222437 | 0.03527 | 0.078245 | 0.058684 | 0.382336 | 0.382336 | 0.358032 | 0.283343 | 0.235329 | 0.235329 | 0 | 0.014179 | 0.18354 | 4,751 | 112 | 151 | 42.419643 | 0.855633 | 0.161861 | 0 | 0.316456 | 1 | 0 | 0.005092 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.329114 | false | 0 | 0.063291 | 0.025316 | 0.708861 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d480390a6cf73efb9fee975a48c7bfdc40f36225 | 979 | py | Python | services/traction/acapy_wrapper/models/menu_option.py | Open-Earth-Foundation/traction | 908b555a7f408a88541b7692d3730e37a297c919 | [
"Apache-2.0"
] | 12 | 2022-01-29T20:30:03.000Z | 2022-03-29T11:46:14.000Z | services/traction/acapy_wrapper/models/menu_option.py | Open-Earth-Foundation/traction | 908b555a7f408a88541b7692d3730e37a297c919 | [
"Apache-2.0"
] | 38 | 2021-11-22T17:52:50.000Z | 2022-03-31T17:52:00.000Z | services/traction/acapy_wrapper/models/menu_option.py | Open-Earth-Foundation/traction | 908b555a7f408a88541b7692d3730e37a297c919 | [
"Apache-2.0"
] | 9 | 2021-11-22T18:05:48.000Z | 2022-03-29T11:25:08.000Z | # coding: utf-8
from __future__ import annotations
from datetime import date, datetime # noqa: F401
import re # noqa: F401
from typing import Any, Dict, List, Optional # noqa: F401
from pydantic import AnyUrl, BaseModel, EmailStr, validator # noqa: F401
from acapy_wrapper.models.menu_form import MenuForm
class MenuOption(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Do not edit the class manually.
MenuOption - a model defined in OpenAPI
description: The description of this MenuOption [Optional].
disabled: The disabled of this MenuOption [Optional].
form: The form of this MenuOption [Optional].
name: The name of this MenuOption.
title: The title of this MenuOption.
"""
description: Optional[str] = None
disabled: Optional[bool] = None
form: Optional[MenuForm] = None
name: str
title: str
MenuOption.update_forward_refs()
| 27.971429 | 96 | 0.709908 | 125 | 979 | 5.496 | 0.48 | 0.043668 | 0.116448 | 0.104803 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016927 | 0.215526 | 979 | 34 | 97 | 28.794118 | 0.877604 | 0.485189 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.461538 | 0 | 0.923077 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
00f7d144350d2335042028fb40b27995f5f47cd8 | 106 | py | Python | runserver.py | codito/flow | 7eaf581e2e96f3d5f4168583fda18a57e3bb4543 | [
"MIT"
] | 1 | 2015-05-22T01:23:13.000Z | 2015-05-22T01:23:13.000Z | runserver.py | codito/flow | 7eaf581e2e96f3d5f4168583fda18a57e3bb4543 | [
"MIT"
] | 1 | 2018-09-21T12:04:12.000Z | 2018-09-21T12:04:12.000Z | runserver.py | codito/flow | 7eaf581e2e96f3d5f4168583fda18a57e3bb4543 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import flow
if __name__ == '__main__':
flow.initialize()
flow.app.run()
| 13.25 | 26 | 0.584906 | 13 | 106 | 4.153846 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012048 | 0.216981 | 106 | 7 | 27 | 15.142857 | 0.638554 | 0.198113 | 0 | 0 | 0 | 0 | 0.096386 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
00f8eb74f352bcd725f6d2c86c3345443d159593 | 50 | py | Python | quicklooper/__init__.py | deuxglaces/quicklooper | 8cb7c12f16ece1c2dd6cb796ec4b8b0c831a502e | [
"MIT"
] | null | null | null | quicklooper/__init__.py | deuxglaces/quicklooper | 8cb7c12f16ece1c2dd6cb796ec4b8b0c831a502e | [
"MIT"
] | null | null | null | quicklooper/__init__.py | deuxglaces/quicklooper | 8cb7c12f16ece1c2dd6cb796ec4b8b0c831a502e | [
"MIT"
] | null | null | null | __version__ = '1.0.0'
from .looper import Looper
| 12.5 | 26 | 0.72 | 8 | 50 | 4 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.071429 | 0.16 | 50 | 3 | 27 | 16.666667 | 0.690476 | 0 | 0 | 0 | 0 | 0 | 0.1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
00fcbbe3c8de5881e1c7f0f6c212d1a5e13e2682 | 536 | py | Python | manager/migrations/0007_auto_20201110_1622.py | UN-ICC/icc-digital-id-manager | aca0109b3202b292145326ec5523ee8f24691a83 | [
"Apache-2.0"
] | 3 | 2021-02-03T16:37:19.000Z | 2022-02-07T09:59:03.000Z | manager/migrations/0007_auto_20201110_1622.py | UN-ICC/icc-digital-id-manager | aca0109b3202b292145326ec5523ee8f24691a83 | [
"Apache-2.0"
] | null | null | null | manager/migrations/0007_auto_20201110_1622.py | UN-ICC/icc-digital-id-manager | aca0109b3202b292145326ec5523ee8f24691a83 | [
"Apache-2.0"
] | 2 | 2021-02-10T16:03:31.000Z | 2022-02-07T08:50:16.000Z | # Generated by Django 3.1 on 2020-11-10 15:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("manager", "0006_auto_20201105_1007"),
]
operations = [
migrations.RemoveField(
model_name="credentialdefinition",
name="credential_json",
),
migrations.AddField(
model_name="credentialdefinition",
name="support_revocation",
field=models.BooleanField(default=True),
),
]
| 23.304348 | 52 | 0.608209 | 49 | 536 | 6.510204 | 0.77551 | 0.056426 | 0.181818 | 0.206897 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.07874 | 0.289179 | 536 | 22 | 53 | 24.363636 | 0.75853 | 0.080224 | 0 | 0.25 | 1 | 0 | 0.209776 | 0.046843 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.0625 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2e1811ed43f409ce5c09c98945c66fb9e103112b | 165 | py | Python | katas/beta/how_much_coffee_do_you_need.py | the-zebulan/CodeWars | 1eafd1247d60955a5dfb63e4882e8ce86019f43a | [
"MIT"
] | 40 | 2016-03-09T12:26:20.000Z | 2022-03-23T08:44:51.000Z | katas/beta/how_much_coffee_do_you_need.py | akalynych/CodeWars | 1eafd1247d60955a5dfb63e4882e8ce86019f43a | [
"MIT"
] | null | null | null | katas/beta/how_much_coffee_do_you_need.py | akalynych/CodeWars | 1eafd1247d60955a5dfb63e4882e8ce86019f43a | [
"MIT"
] | 36 | 2016-11-07T19:59:58.000Z | 2022-03-31T11:18:27.000Z | def how_much_coffee(lst):
result = sum(a.isalpha() if a.islower() else 2 * a.isalpha() for a in lst)
return 'You need extra sleep' if result > 3 else result
| 41.25 | 78 | 0.678788 | 30 | 165 | 3.666667 | 0.7 | 0.145455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015267 | 0.206061 | 165 | 3 | 79 | 55 | 0.824427 | 0 | 0 | 0 | 0 | 0 | 0.121212 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
2e343cd481ef2ee88b3c908edb93b07f8e965d94 | 769 | py | Python | grortir/main/pso/calls_optimization_strategy.py | wojtekPi/grortir | 0ef8b495527a4f3861e5df5db756d0ee3ed4aa6f | [
"MIT"
] | null | null | null | grortir/main/pso/calls_optimization_strategy.py | wojtekPi/grortir | 0ef8b495527a4f3861e5df5db756d0ee3ed4aa6f | [
"MIT"
] | null | null | null | grortir/main/pso/calls_optimization_strategy.py | wojtekPi/grortir | 0ef8b495527a4f3861e5df5db756d0ee3ed4aa6f | [
"MIT"
] | null | null | null | """Represents optimization strategy for PSO."""
from grortir.main.pso.calls_group_optimization_strategy import \
CallsGroupOptimizationStrategy
from grortir.main.pso.optimization_strategy import OptimizationStrategy
class CallsOptimizationStrategy(OptimizationStrategy):
"""Represents optimization strategy Calls stages for PSO."""
def get_group_optimization_strategy(self, stages_in_group, process):
"""
Return group optimization strategy.
Args:
process (AbstractProcess): optimized process
stages_in_group (list): list of stages
Returns:
CallsGroupOptimizationStrategy: strategy for group optimization.
"""
return CallsGroupOptimizationStrategy(stages_in_group)
| 34.954545 | 76 | 0.73472 | 70 | 769 | 7.885714 | 0.4 | 0.217391 | 0.13587 | 0.065217 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.202861 | 769 | 21 | 77 | 36.619048 | 0.900489 | 0.408323 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
5cfec1686dbd0fbc9a82dff9721f0d84ecab71c2 | 198 | py | Python | pybk8500/__meta__.py | justengel/pybk8500 | 6a9748033c783a0081ec391359067dfb9dc83760 | [
"MIT"
] | null | null | null | pybk8500/__meta__.py | justengel/pybk8500 | 6a9748033c783a0081ec391359067dfb9dc83760 | [
"MIT"
] | null | null | null | pybk8500/__meta__.py | justengel/pybk8500 | 6a9748033c783a0081ec391359067dfb9dc83760 | [
"MIT"
] | null | null | null | name = 'pybk8500'
version = '1.2.0'
description = 'BK-8500-Electronic-Load python library'
url = 'https://github.com/justengel/pybk8500'
author = 'Justin Engel'
author_email = 'jtengel08@gmail.com'
| 28.285714 | 54 | 0.737374 | 27 | 198 | 5.37037 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096045 | 0.106061 | 198 | 6 | 55 | 33 | 0.723164 | 0 | 0 | 0 | 0 | 0 | 0.60101 | 0.116162 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
cf08138655c22bfed6396bc5a650857f9c5adc3d | 3,175 | py | Python | jaxns/gaussian_process/kernels.py | fehiepsi/jaxns | 9cf9366f11ace564e21f938edf4d090fb5de137d | [
"Apache-2.0"
] | null | null | null | jaxns/gaussian_process/kernels.py | fehiepsi/jaxns | 9cf9366f11ace564e21f938edf4d090fb5de137d | [
"Apache-2.0"
] | null | null | null | jaxns/gaussian_process/kernels.py | fehiepsi/jaxns | 9cf9366f11ace564e21f938edf4d090fb5de137d | [
"Apache-2.0"
] | null | null | null | from jaxns.gaussian_process.utils import squared_norm, product_log
import jax.numpy as jnp
class Kernel(object):
def __call__(self, x1, x2, *args):
raise NotImplemented()
class Diagonal(Kernel):
def __call__(self, x1, x2, sigma):
return jnp.full((x1.shape[0], x1.shape[0]), sigma ** 2)
class StationaryKernel(Kernel):
def inverse_x(self, p, l, sigma, *params):
"""
Find x where K(x,0) == p
Args:
p:
l:
sigma:
Returns:
"""
return l * jnp.sqrt(2. * jnp.log(sigma ** 2 / p))
def inverse_l(self, p, x, sigma):
return x / jnp.sqrt(2. * jnp.log(sigma ** 2 / p))
def act(self, r2, *args):
"""
Given the squared Euclidean norm of the outer difference between two coordinate sets,
return the log of the kernel. Only valid for strictly positive kernels.
Args:
r2: [N, M]
*args: other kernel arguments, e.g. sigma, alpha, ...
Returns: log(K(r2)) [N, M]
"""
raise NotImplemented()
def __call__(self, x1, x2, l, *args):
r2 = squared_norm(x1, x2)
r2 = jnp.maximum(r2 / l, 1e-36)
return jnp.exp(self.act(r2, *args))
class RBF(StationaryKernel):
def inverse_x(self, p, l, sigma):
return l * jnp.sqrt(2. * jnp.log(sigma ** 2 / p))
def inverse_l(self, p, x, sigma):
return x / jnp.sqrt(2. * jnp.log(sigma ** 2 / p))
def act(self, r2, sigma):
return 2. * jnp.log(sigma) - 0.5 * r2
class RationalQuadratic(StationaryKernel):
def inverse_x(self, p, l, sigma, alpha):
return l * jnp.sqrt(2. * alpha * ((p / sigma ** 2) ** (-1. / alpha) - 1.))
def inverse_l(self, p, x, sigma, alpha):
return x / jnp.sqrt(2. * alpha * ((p / sigma ** 2) ** (-1. / alpha) - 1.))
def act(self, r2, sigma, alpha):
log_res = 2. * jnp.log(sigma) - alpha * jnp.log(1. + jnp.sqrt(r2) / (2. * alpha))
return log_res
class M12(StationaryKernel):
def inverse_x(self, p, l, sigma):
return l * jnp.log(sigma ** 2 / p)
def inverse_l(self, p, x, sigma):
return x / jnp.log(sigma ** 2 / p)
def act(self, r2, sigma):
return 2. * jnp.log(sigma) - jnp.sqrt(r2)
class M32(StationaryKernel):
def inverse_x(self, p, l, sigma):
return l * (product_log(-p / jnp.exp(1.) / sigma ** 2) + 1.) / (-jnp.sqrt(3.))
def inverse_l(self, p, x, sigma):
return x * (-jnp.sqrt(3.)) / (product_log(-p / jnp.exp(1.) / sigma ** 2) + 1.)
def act(self, r2, sigma):
r = jnp.sqrt(r2)
r *= jnp.sqrt(3.)
log_res = 2. * jnp.log(sigma) + jnp.log(1. + r) - r
return log_res
class M52(StationaryKernel):
def inverse_x(self, p, l, sigma):
return l * (product_log(-p / jnp.exp(1.) / sigma ** 2) + 1.) / (-jnp.sqrt(3.))
def inverse_l(self, p, x, sigma):
return x * (-jnp.sqrt(3.)) / (product_log(-p / jnp.exp(1.) / sigma ** 2) + 1.)
def act(self, r2, sigma):
r = jnp.sqrt(r2)
r *= jnp.sqrt(3.)
log_res = 2. * jnp.log(sigma) + jnp.log(1. + r) - r
return log_res
| 28.097345 | 93 | 0.539213 | 477 | 3,175 | 3.509434 | 0.171908 | 0.066906 | 0.072282 | 0.064516 | 0.620669 | 0.583632 | 0.564516 | 0.540024 | 0.517324 | 0.517324 | 0 | 0.038787 | 0.293543 | 3,175 | 112 | 94 | 28.348214 | 0.707535 | 0.104252 | 0 | 0.52459 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.344262 | false | 0 | 0.032787 | 0.229508 | 0.819672 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
cf17001941721945c77b518cbc00112421985125 | 66 | py | Python | src/lib/sre.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 10 | 2015-11-13T17:02:40.000Z | 2021-02-09T23:21:05.000Z | src/lib/sre.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 43 | 2015-06-03T17:59:23.000Z | 2021-09-17T10:45:21.000Z | src/lib/sre.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 13 | 2017-07-02T03:16:46.000Z | 2021-07-05T14:53:56.000Z | raise NotImplementedError("sre is not yet implemented in Skulpt")
| 33 | 65 | 0.818182 | 9 | 66 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121212 | 66 | 1 | 66 | 66 | 0.931034 | 0 | 0 | 0 | 0 | 0 | 0.545455 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
cf3ad6cdc33ac7de5f1a17a517d09fc497aa362e | 189 | py | Python | UE4Parse/Assets/Objects/ETextFlag.py | zbx911/pyUE4Parse | eb30d27a4341ad68a7104458a0fdfae6a360d153 | [
"MIT"
] | 13 | 2021-06-09T09:21:00.000Z | 2022-03-30T22:13:24.000Z | UE4Parse/Assets/Objects/ETextFlag.py | zbx911/pyUE4Parse | eb30d27a4341ad68a7104458a0fdfae6a360d153 | [
"MIT"
] | 3 | 2021-09-04T22:23:02.000Z | 2022-03-04T09:45:45.000Z | UE4Parse/Assets/Objects/ETextFlag.py | zbx911/pyUE4Parse | eb30d27a4341ad68a7104458a0fdfae6a360d153 | [
"MIT"
] | 6 | 2021-09-02T10:28:21.000Z | 2022-03-30T22:13:37.000Z | from enum import Enum
class ETextFlag(Enum):
Transient = 1 << 0
CultureInvariant = 1 << 1
ConvertedProperty = 1 << 2
Immutable = 1 << 3
InitializedFromString = 1 << 4
| 18.9 | 34 | 0.624339 | 22 | 189 | 5.363636 | 0.681818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.073529 | 0.280423 | 189 | 9 | 35 | 21 | 0.794118 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
cf5e4550b7583a2f6490cf9ba995745a0d048cd3 | 872 | py | Python | housemonitor/inputs/abc_input.py | gary-pickens/HouseMonitor | 4b169bdbeed9013e1824d4bb929970ae0c27a6c9 | [
"MIT"
] | 1 | 2021-06-28T06:52:03.000Z | 2021-06-28T06:52:03.000Z | housemonitor/inputs/abc_input.py | gary-pickens/HouseMonitor | 4b169bdbeed9013e1824d4bb929970ae0c27a6c9 | [
"MIT"
] | null | null | null | housemonitor/inputs/abc_input.py | gary-pickens/HouseMonitor | 4b169bdbeed9013e1824d4bb929970ae0c27a6c9 | [
"MIT"
] | null | null | null | '''
Created on Aug 2, 2012
@author: Gary
'''
import abc
from pubsub import pub
from housemonitor.lib.base import Base
from housemonitor.lib.constants import Constants
class abcInput(Base, object):
'''
This abstract class will input all the data and send it on
it's way.
'''
__metaclass__ = abc.ABCMeta
def __init__(self):
'''
Constructor
'''
super(abcInput, self).__init__()
self.logger.debug("in iInput")
@abc.abstractproperty
def topic_name(self):
return 'Should never see this' # pragma: no cover
@abc.abstractmethod
def input(self):
pass # pragma: no cover
@abc.abstractproperty
def logger_name(self):
""" Set the logger level. This needs to be added to house_monitoring_logging.conf"""
return Constants.LogKeys.inputs # pragma: no cover
| 22.947368 | 92 | 0.649083 | 110 | 872 | 5 | 0.6 | 0.043636 | 0.070909 | 0.058182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007728 | 0.258028 | 872 | 37 | 93 | 23.567568 | 0.842349 | 0.284404 | 0 | 0.111111 | 0 | 0 | 0.053004 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0.055556 | 0.222222 | 0.055556 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
cf64eca24a14445f809b639bf8c45cafe66b4a53 | 8,387 | py | Python | src/api/handlers/event.py | jpeirce21/api | 11035360d6829a398b747aa86771b7d30fe46cb8 | [
"MIT"
] | null | null | null | src/api/handlers/event.py | jpeirce21/api | 11035360d6829a398b747aa86771b7d30fe46cb8 | [
"MIT"
] | null | null | null | src/api/handlers/event.py | jpeirce21/api | 11035360d6829a398b747aa86771b7d30fe46cb8 | [
"MIT"
] | null | null | null | """Handler file for all routes pertaining to events"""
from _main_.utils.route_handler import RouteHandler
from _main_.utils.common import get_request_contents, parse_list, parse_bool, check_length, parse_date, parse_int, parse_location
from api.services.event import EventService
from _main_.utils.massenergize_response import MassenergizeResponse
from types import FunctionType as function
from _main_.utils.context import Context
from _main_.utils.validator import Validator
from api.decorators import admins_only, super_admins_only, login_required
class EventHandler(RouteHandler):
def __init__(self):
super().__init__()
self.service = EventService()
self.registerRoutes()
def registerRoutes(self) -> None:
self.add("/events.info", self.info)
self.add("/events.create", self.create)
self.add("/events.add", self.create)
self.add("/events.copy", self.copy)
self.add("/events.list", self.list)
self.add("/events.update", self.update)
self.add("/events.delete", self.delete)
self.add("/events.remove", self.delete)
self.add("/events.rank", self.rank)
self.add("/events.rsvp", self.rsvp)
self.add("/events.rsvp.update", self.rsvp_update)
self.add("/events.rsvp.remove", self.rsvp_remove)
self.add("/events.todo", self.save_for_later)
#admin routes
self.add("/events.listForCommunityAdmin", self.community_admin_list)
self.add("/events.listForSuperAdmin", self.super_admin_list)
def info(self, request):
context: Context = request.context
args: dict = context.args
self.validator.expect("event_id", is_required=True)
args, err = self.validator.verify(args, strict=True)
if err:
return err
event_info, err = self.service.get_event_info(context, args)
if err:
return MassenergizeResponse(error=str(err), status=err.status)
return MassenergizeResponse(data=event_info)
@admins_only
def copy(self, request):
context: Context = request.context
args: dict = context.args
self.validator.expect("event_id", is_required=True)
args, err = self.validator.verify(args, strict=True)
if err:
return err
event_info, err = self.service.copy_event(context, args)
if err:
return MassenergizeResponse(error=str(err), status=err.status)
return MassenergizeResponse(data=event_info)
@login_required
def rsvp(self, request):
context: Context = request.context
args: dict = context.args
self.validator.expect("event_id", is_required=True)
args, err = self.validator.verify(args, strict=True)
if err:
return err
event_info, err = self.service.rsvp(context, args)
if err:
return MassenergizeResponse(error=str(err), status=err.status)
return MassenergizeResponse(data=event_info)
@login_required
def rsvp_update(self, request) -> function:
context: Context = request.context
args: dict = context.args
self.validator.expect("event_id", is_required=True)
self.validator.expect("status", is_required=False)
args, err = self.validator.verify(args, strict=True)
if err:
return err
event_info, err = self.service.rsvp_update(context, args)
if err:
return MassenergizeResponse(error=str(err), status=err.status)
return MassenergizeResponse(data=event_info)
@login_required
def rsvp_remove(self, request):
context: Context = request.context
args: dict = context.args
self.validator.expect("rsvp_id", is_required=True)
args, err = self.validator.verify(args, strict=True)
if err:
return err
event_info, err = self.service.rsvp_remove(context, args)
if err:
return MassenergizeResponse(error=str(err), status=err.status)
return MassenergizeResponse(data=event_info)
@login_required
def save_for_later(self, request):
context: Context = request.context
args: dict = context.args
self.validator.expect("event_id", is_required=True)
args, err = self.validator.verify(args, strict=True)
if err:
return err
event_info, err = self.service.get_event_info(context, args)
if err:
return MassenergizeResponse(error=str(err), status=err.status)
return MassenergizeResponse(data=event_info)
# TODO implement validator
@admins_only
def create(self, request):
context: Context = request.context
args: dict = context.args
ok, err = check_length(args, 'name', min_length=5, max_length=100)
if not ok:
return MassenergizeResponse(error=str(err), status=err.status)
args['tags'] = parse_list(args.get('tags', []))
args['is_global'] = parse_bool(args.pop('is_global', None))
args['archive'] = parse_bool(args.pop('archive', None))
args['is_published'] = parse_bool(args.pop('is_published', None))
args['have_address'] = parse_bool(args.pop('have_address', False))
args = parse_location(args)
event_info, err = self.service.create_event(context, args)
if err:
return MassenergizeResponse(error=str(err), status=err.status)
return MassenergizeResponse(data=event_info)
def list(self, request):
context: Context = request.context
args: dict = context.args
community_id = args.pop('community_id', None)
subdomain = args.pop('subdomain', None)
user_id = args.pop('user_id', None)
self.validator.expect("community_id", is_required=False)
self.validator.expect("subdomain", is_required=False)
self.validator.expect("user_id", is_required=False)
args, err = self.validator.verify(args, strict=True)
if err:
return err
event_info, err = self.service.list_events(context, args)
if err:
return MassenergizeResponse(error=str(err), status=err.status)
return MassenergizeResponse(data=event_info)
# TODO implement validator
@admins_only
def update(self, request):
context: Context = request.context
args: dict = context.args
event_id = args.pop('event_id', None)
ok, err = check_length(args, 'name', min_length=5, max_length=100)
if not ok:
return MassenergizeResponse(error=str(err), status=err.status)
args['tags'] = parse_list(args.get('tags', []))
args['is_global'] = parse_bool(args.pop('is_global', None))
args['archive'] = parse_bool(args.pop('archive', None))
args['is_published'] = parse_bool(args.pop('is_published', None))
args['have_address'] = parse_bool(args.pop('have_address', False))
args = parse_location(args)
event_info, err = self.service.update_event(context, event_id, args)
if err:
return MassenergizeResponse(error=str(err), status=err.status)
return MassenergizeResponse(data=event_info)
@admins_only
def rank(self, request):
context: Context = request.context
args: dict = context.args
self.validator.expect('id', int, is_required=True)
self.validator.expect('rank', int, is_required=True)
self.validator.rename('event_id', 'id')
args, err = self.validator.verify(args)
if err:
return MassenergizeResponse(error=str(err), status=err.status)
event_info, err = self.service.rank_event(args)
if err:
return MassenergizeResponse(error=str(err), status=err.status)
return MassenergizeResponse(data=event_info)
@admins_only
def delete(self, request):
context: Context = request.context
args: dict = context.args
event_id = args.get("event_id", None)
event_info, err = self.service.delete_event(context, event_id)
if err:
return MassenergizeResponse(error=str(err), status=err.status)
return MassenergizeResponse(data=event_info)
@admins_only
def community_admin_list(self, request):
context: Context = request.context
args: dict = context.args
self.validator.expect("community_id", is_required=True)
args, err = self.validator.verify(args)
if err:
return err
events, err = self.service.list_events_for_community_admin(context, args)
if err:
return MassenergizeResponse(error=str(err), status=err.status)
return MassenergizeResponse(data=events)
@super_admins_only
def super_admin_list(self, request):
context: Context = request.context
events, err = self.service.list_events_for_super_admin(context)
if err:
return MassenergizeResponse(error=str(err), status=err.status)
return MassenergizeResponse(data=events)
| 32.507752 | 129 | 0.710862 | 1,097 | 8,387 | 5.284412 | 0.093892 | 0.062619 | 0.041746 | 0.093842 | 0.767466 | 0.741935 | 0.717268 | 0.69743 | 0.688287 | 0.681904 | 0 | 0.001151 | 0.170979 | 8,387 | 257 | 130 | 32.634241 | 0.83259 | 0.013235 | 0 | 0.649485 | 0 | 0 | 0.068699 | 0.006531 | 0 | 0 | 0 | 0.003891 | 0 | 1 | 0.07732 | false | 0 | 0.041237 | 0 | 0.314433 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
cf722d094e4a86e3cdd63fb5b6362826c04ffe69 | 140 | py | Python | rpycore/__init__.py | roguextech/ICL-Rocketry-RocketPy | 789cad455ab64fd5a01fb8bf27852950408b3691 | [
"MIT"
] | null | null | null | rpycore/__init__.py | roguextech/ICL-Rocketry-RocketPy | 789cad455ab64fd5a01fb8bf27852950408b3691 | [
"MIT"
] | null | null | null | rpycore/__init__.py | roguextech/ICL-Rocketry-RocketPy | 789cad455ab64fd5a01fb8bf27852950408b3691 | [
"MIT"
] | null | null | null | """Top-level package for RocketPy."""
__author__ = """Mohammed Raihaan Usman"""
__email__ = 'raihaan.usman@gmail.com'
__version__ = '0.1.1' | 28 | 41 | 0.707143 | 18 | 140 | 4.833333 | 0.833333 | 0.275862 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024 | 0.107143 | 140 | 5 | 42 | 28 | 0.672 | 0.221429 | 0 | 0 | 0 | 0 | 0.480769 | 0.221154 | 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 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
cf817518c039ae1ddb27709043dfbfdde04e64c5 | 192 | py | Python | test.py | cbn35/CS-470-Halma | 78fa2aaa4bc4a2e7bb6d60d4bf33a80a32f8dbd7 | [
"MIT"
] | 1 | 2019-10-23T01:21:10.000Z | 2019-10-23T01:21:10.000Z | test.py | cbn35/CS-470-Halma | 78fa2aaa4bc4a2e7bb6d60d4bf33a80a32f8dbd7 | [
"MIT"
] | null | null | null | test.py | cbn35/CS-470-Halma | 78fa2aaa4bc4a2e7bb6d60d4bf33a80a32f8dbd7 | [
"MIT"
] | null | null | null | from Halma import Halma
from Player import Node, MiniMax
import time
test = Halma(8, 0, 2)
timeStamp = time.time()
m = MiniMax(test, 9999999999)
print("Done! Took ", time.time() - timeStamp)
| 21.333333 | 45 | 0.71875 | 29 | 192 | 4.758621 | 0.586207 | 0.115942 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.080247 | 0.15625 | 192 | 8 | 46 | 24 | 0.771605 | 0 | 0 | 0 | 0 | 0 | 0.057292 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 0.428571 | 0.142857 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
d843a9bfff16e3879512c66396513cbd209aeaee | 1,488 | py | Python | main.py | gaato/nkodice-discord | d693b0db37f1ca3480fd4de964434d9800b06a12 | [
"Apache-2.0"
] | null | null | null | main.py | gaato/nkodice-discord | d693b0db37f1ca3480fd4de964434d9800b06a12 | [
"Apache-2.0"
] | null | null | null | main.py | gaato/nkodice-discord | d693b0db37f1ca3480fd4de964434d9800b06a12 | [
"Apache-2.0"
] | null | null | null | import random
import discord
import asyncio
from config import DISCORD_TOKEN
client = discord.Client()
@client.event
async def on_ready():
print('It\'s activated')
async def nkodice(message: discord.Message):
rolls = random.choices(('う', 'ま', 'ち', 'ん', 'こ', 'お'), k=5)
roles = []
if rolls.count('う') >= 1 and rolls.count('ん') >= 1 and rolls.count('ち'):
roles.append('UNCHI')
if rolls.count('う') >= 1 and rolls.count('ん') >= 1 and rolls.count('こ'):
roles.append('UNKO')
if rolls.count('お') >= 1 and rolls.count('ま') >= 1 and rolls.count('ん') >= 1 and rolls.count('こ'):
roles.append('OMANKO')
elif rolls.count('ま') >= 1 and rolls.count('ん') >= 1 and rolls.count('こ'):
roles.append('MANKO')
if rolls.count('ち') >= 1 and rolls.count('ん') and rolls.count('こ'):
roles.append('CHINKO')
if rolls.count('お') >= 1 and rolls.count('ち') >= 2 and rolls.count('ん') >= 2:
roles.append('OCHINCHIN')
elif rolls.count('ち') >= 2 and rolls.count('ん') >= 2:
roles.append('CHINCHIN')
for r in rolls:
await message.channel.send(r)
await asyncio.sleep(1.0)
for r in roles:
await message.channel.send('***' + r + '***')
await asyncio.sleep(1.0)
@client.event
async def on_message(message: discord.Message):
if message.author.bot:
return
if message.content == '!nkodice':
await nkodice(message)
client.run(DISCORD_TOKEN)
| 24.8 | 102 | 0.584005 | 215 | 1,488 | 4.023256 | 0.265116 | 0.242775 | 0.210405 | 0.178035 | 0.553757 | 0.486705 | 0.457803 | 0.457803 | 0.418497 | 0.418497 | 0 | 0.017452 | 0.229839 | 1,488 | 59 | 103 | 25.220339 | 0.737347 | 0 | 0 | 0.105263 | 0 | 0 | 0.058468 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.105263 | 0 | 0.131579 | 0.026316 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d8459fe1fe1f0a5dba6ca051cbf8b6edbdd45630 | 193 | py | Python | World/Object/Unit/Constants/MovementType.py | sundayz/idewave-core | 5bdb88892173c9c3e8c85f431cf9b5dbd9f23941 | [
"Apache-2.0"
] | 10 | 2019-06-29T19:24:52.000Z | 2021-02-21T22:45:57.000Z | World/Object/Unit/Constants/MovementType.py | sundayz/idewave-core | 5bdb88892173c9c3e8c85f431cf9b5dbd9f23941 | [
"Apache-2.0"
] | 4 | 2019-08-15T07:03:36.000Z | 2021-06-02T13:01:25.000Z | World/Object/Unit/Constants/MovementType.py | sundayz/idewave-core | 5bdb88892173c9c3e8c85f431cf9b5dbd9f23941 | [
"Apache-2.0"
] | 8 | 2019-06-30T22:47:48.000Z | 2021-02-20T19:21:30.000Z | from enum import Enum
class MovementType(Enum):
IDLE_ON_SPANW_POINT = 0
RANDOM_MOVEMENT = 1 # should set spawndistance radius
WAYPOINT_MOVEMENT = 2 | 24.125 | 70 | 0.626943 | 22 | 193 | 5.272727 | 0.863636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023438 | 0.336788 | 193 | 8 | 71 | 24.125 | 0.882813 | 0.160622 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d8512530ecfba8cba30fe6e8826eb9c3a0427acb | 259 | py | Python | flask_extras/forms/validators/serialization.py | up2cat/flask_extras | 7888da0ca2793e49a803a256b405fa43e6e64ae2 | [
"MIT"
] | 19 | 2016-08-03T07:10:23.000Z | 2022-03-03T16:37:11.000Z | flask_extras/forms/validators/serialization.py | christabor/jinja2_template_pack | f57300bc2922aa4105d1aa393351b63c86c26048 | [
"MIT"
] | 7 | 2016-11-11T21:54:53.000Z | 2018-11-21T04:33:46.000Z | flask_extras/forms/validators/serialization.py | christabor/jinja2_template_pack | f57300bc2922aa4105d1aa393351b63c86c26048 | [
"MIT"
] | 3 | 2016-12-30T10:34:02.000Z | 2021-04-08T05:40:09.000Z | """Validators for various serialization formats."""
import json
def valid_json(formcls, field):
"""Validate field data as a json.
:param formcls (object): The form class.
:param field (str): The list of ips.
"""
json.loads(field.data)
| 19.923077 | 51 | 0.664093 | 35 | 259 | 4.885714 | 0.714286 | 0.105263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.212355 | 259 | 12 | 52 | 21.583333 | 0.838235 | 0.598456 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
d859382937ea95d2946ec59432d960f84381c2f3 | 204 | py | Python | zhsz_api/controllers/__init__.py | azhen318x/FormatFa6 | 9a103e91fa6b1ba99ff30cdf96770f304c968288 | [
"MIT"
] | 12 | 2019-12-05T02:12:01.000Z | 2021-12-13T14:56:44.000Z | zhsz_api/controllers/__init__.py | azhen318x/FormatFa6 | 9a103e91fa6b1ba99ff30cdf96770f304c968288 | [
"MIT"
] | null | null | null | zhsz_api/controllers/__init__.py | azhen318x/FormatFa6 | 9a103e91fa6b1ba99ff30cdf96770f304c968288 | [
"MIT"
] | 4 | 2019-12-05T03:18:42.000Z | 2021-04-06T06:13:55.000Z | from flask import Blueprint
from settings import Config
db=Config.db
api_blue = Blueprint('api', __name__, url_prefix='/api')
from . import auth
from . import data
from . import logonav
from .import sql | 20.4 | 56 | 0.769608 | 31 | 204 | 4.870968 | 0.516129 | 0.264901 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147059 | 204 | 10 | 57 | 20.4 | 0.867816 | 0 | 0 | 0 | 0 | 0 | 0.034146 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.75 | 0 | 0.75 | 0.25 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
d85a4f16928c4465d47ab2678139e64d3adaaf20 | 440 | py | Python | lib/stop_words.py | awesome-archive/novelRS | ae9d0cbd765dfb5730321fa320a8a559730b5d8d | [
"MIT"
] | null | null | null | lib/stop_words.py | awesome-archive/novelRS | ae9d0cbd765dfb5730321fa320a8a559730b5d8d | [
"MIT"
] | null | null | null | lib/stop_words.py | awesome-archive/novelRS | ae9d0cbd765dfb5730321fa320a8a559730b5d8d | [
"MIT"
] | null | null | null | # coding=utf-8
""" 停用词,去除标点符号 """
stop_words = [
',',
'。',
'“',
'”',
'‘',
'’',
'!',
'?',
'(',
'《',
'》',
')',
'-',
'=',
'+',
'-',
':',
';',
'…',
'、',
'?',
'.',
',',
'/',
';',
':',
'.',
'!',
'(',
')',
'&',
'^',
'%',
'$',
'#',
'@',
'`',
'~',
'\\',
'|',
'_',
'<',
'>',
]
| 8.979592 | 18 | 0.068182 | 8 | 440 | 3.875 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004651 | 0.511364 | 440 | 48 | 19 | 9.166667 | 0.125581 | 0.056818 | 0 | 0.088889 | 0 | 0 | 0.107843 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d85a689310652712876d7ea54ebb0d08eb176cd6 | 732 | py | Python | pysurf/random/shrandom.py | MFSJMenger/pysurf | 99c6a94d4cb5046f16a0961b907061d989ffb6dc | [
"Apache-2.0"
] | 7 | 2020-10-28T13:46:08.000Z | 2021-05-27T06:41:56.000Z | pysurf/random/shrandom.py | MFSJMenger/pysurf | 99c6a94d4cb5046f16a0961b907061d989ffb6dc | [
"Apache-2.0"
] | 2 | 2020-10-27T19:15:12.000Z | 2020-10-27T19:15:25.000Z | pysurf/random/shrandom.py | MFSJMenger/pysurf | 99c6a94d4cb5046f16a0961b907061d989ffb6dc | [
"Apache-2.0"
] | 2 | 2021-04-15T05:54:30.000Z | 2022-02-08T00:10:10.000Z | from abc import ABC, abstractmethod
import numpy as np
# This should be a Singleton class!
# there can only exist ONE way to
# generate random numbers!
class RandomNumberGeneratorBase(ABC):
""""Python Class to generate random numbers"""
def __init__(self, seed=None):
self.seed = seed
self._set_seed(seed)
@abstractmethod
def _set_seed(self, seed):
"""Sets seed for random number generator"""
pass
@abstractmethod
def get(self):
pass
class RandomNumberGeneratorNP(RandomNumberGeneratorBase):
def _set_seed(self, seed):
"""Sets seed for random number generator"""
np.random.seed(seed)
def get(self):
return np.random.random()
| 21.529412 | 57 | 0.663934 | 89 | 732 | 5.348315 | 0.438202 | 0.067227 | 0.067227 | 0.096639 | 0.210084 | 0.210084 | 0.210084 | 0.210084 | 0.210084 | 0.210084 | 0 | 0 | 0.247268 | 732 | 33 | 58 | 22.181818 | 0.863884 | 0.285519 | 0 | 0.470588 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.294118 | false | 0.117647 | 0.117647 | 0.058824 | 0.588235 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
d8612305fbc8350fa73e22884a6d2886b9660f39 | 888 | py | Python | base/views.py | EOSIO-HACKATHON2020/eosform | 49d283634567858aff24dac139aefab2d9ab3395 | [
"Apache-2.0"
] | null | null | null | base/views.py | EOSIO-HACKATHON2020/eosform | 49d283634567858aff24dac139aefab2d9ab3395 | [
"Apache-2.0"
] | null | null | null | base/views.py | EOSIO-HACKATHON2020/eosform | 49d283634567858aff24dac139aefab2d9ab3395 | [
"Apache-2.0"
] | null | null | null | from django.shortcuts import render
from django.views.generic import TemplateView
from eos import EOS
from surveys.models import Survey
from surveys.models import SurveyStatus
class LandingView(TemplateView):
template_name = 'landing.html'
def get_surveys(self):
return Survey.objects.filter(status=SurveyStatus.PUBLISHED.value)\
.order_by('-modified', '-created')[:20]
def get_context_data(self, **kwargs):
kwargs.update({
'eos': EOS(),
'surveys': self.get_surveys()
})
return super().get_context_data(**kwargs)
def page_400(request):
return render('400.html', {}, status=400)
def page_403(request):
return render('403.html', {}, status=403)
def page_404(request):
return render('404.html', {}, status=404)
def page_500(request):
return render('500.html', {}, status=500)
| 24 | 74 | 0.663288 | 109 | 888 | 5.293578 | 0.40367 | 0.048527 | 0.131716 | 0.079723 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.053748 | 0.203829 | 888 | 36 | 75 | 24.666667 | 0.762376 | 0 | 0 | 0 | 0 | 0 | 0.079955 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.208333 | 0.208333 | 0.791667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.