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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
db1d23294faa4085c4b298242beee689b84ba787 | 984 | py | Python | tincan/extensions.py | openedx/TinCanPython | f257d3f2e210e4b8181c6c94c2245b7b398c21d4 | [
"Apache-2.0"
] | 2 | 2018-08-01T18:50:36.000Z | 2019-04-17T15:24:16.000Z | tincan/extensions.py | openedx/TinCanPython | f257d3f2e210e4b8181c6c94c2245b7b398c21d4 | [
"Apache-2.0"
] | 5 | 2019-03-22T23:14:19.000Z | 2020-07-02T14:43:49.000Z | tincan/extensions.py | openedx/TinCanPython | f257d3f2e210e4b8181c6c94c2245b7b398c21d4 | [
"Apache-2.0"
] | 2 | 2018-07-19T09:54:24.000Z | 2020-02-12T12:03:31.000Z | # Copyright 2014 Rustici Software
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from tincan.serializable_base import SerializableBase
class Extensions(dict, SerializableBase):
"""
Contains domain-specific custom data.
Can be created from a dict, another :class:`tincan.Extensions`,
or from args and kwargs.
Use this like a regular Python dict.
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
| 32.8 | 77 | 0.716463 | 136 | 984 | 5.117647 | 0.647059 | 0.086207 | 0.037356 | 0.045977 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010243 | 0.206301 | 984 | 29 | 78 | 33.931034 | 0.880922 | 0.755081 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 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 | 0 | 1 | 0 | 0 | 2 |
db22db43be67ee7f4c1658d06b304bb89ce863a5 | 303 | py | Python | ch3/lab3_14.py | chunhua2017/pythonprogrammingdemo | 64e4ac2b33c54cde4671291a6203e94cd96de4ba | [
"MIT"
] | 4 | 2020-05-18T05:25:44.000Z | 2021-07-30T01:02:39.000Z | ch3/lab3_14.py | chunhua2017/pythonprogrammingdemo | 64e4ac2b33c54cde4671291a6203e94cd96de4ba | [
"MIT"
] | null | null | null | ch3/lab3_14.py | chunhua2017/pythonprogrammingdemo | 64e4ac2b33c54cde4671291a6203e94cd96de4ba | [
"MIT"
] | 2 | 2021-09-15T05:41:05.000Z | 2022-01-25T05:44:43.000Z | dividend = eval(input('Please Enter a dividend:')) #从键盘输入被除数
divisor = eval(input('Please Enter a divisor:')) #从键盘输入除数
try:
result = dividend/divisor
except ZeroDivisionError: #捕捉除数为零异常
# 当除数为零异常发生,输出提示信息
print('Input Error: divisor can NOT be Zero!')
| 37.875 | 63 | 0.630363 | 33 | 303 | 5.787879 | 0.666667 | 0.094241 | 0.157068 | 0.209424 | 0.219895 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.267327 | 303 | 7 | 64 | 43.285714 | 0.86036 | 0.151815 | 0 | 0 | 0 | 0 | 0.334661 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.166667 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e1d442b50227aa12f3eaa4f59e33e6f3e04d6c8e | 2,596 | py | Python | canp_view_enaml.py | Kochise/canette | 000d53fddc26abdcedc610bdaa6e93c8a63288ab | [
"MIT"
] | null | null | null | canp_view_enaml.py | Kochise/canette | 000d53fddc26abdcedc610bdaa6e93c8a63288ab | [
"MIT"
] | null | null | null | canp_view_enaml.py | Kochise/canette | 000d53fddc26abdcedc610bdaa6e93c8a63288ab | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# author: d.koch
# coding: utf-8
# naming: pep-0008
# typing: pep-0484
# docstring: pep-0257
# indentation: tabulation
""" canp_view_enaml.py
Enaml view
"""
# --- IMPORT ---
# Standard libraries (installed with python)
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import Union
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# External libraries (installed with pip, conda, setup.py, ...)
# python3 -m pip install --upgrade pyqtgraph
# python3 -m pip install --upgrade QScintilla
# python3 -m pip install --upgrade enamlx
#import enamlx
#enamlx.install()
# python3 -m pip install --upgrade rtree
# python3 -m pip install --upgrade intervaltree
# python3 -m pip install --upgrade enaml
import enaml
from enaml.qt.qt_application import QtApplication
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# Included libraries (this module, local files)
from canp_enum import CANP_ENUM__HEAD_MAIN
from canp_enum import CANP_ENUM__IDX_X_CAN
from canp_enum import CANP_ENUM__IDX_X_REF
from canp_enum import CANP_ENUM__IDX_Y_CAN
from canp_enum import CANP_ENUM__IDX_Y_REF
from canp_enum import CANP_ENUM__IDX_Z_CAN
from canp_enum import CANP_ENUM__IDX_Z_REF
from canp_args import canp_args
from canp_logs import canp_logs
# --- GLOBAL ---
# Local settings (might be present in other files yet with different values)
# --- CLASS ---
class canp_view_enaml:
""" CAN view
CANNOT be used alone, but be fed some data
"""
@staticmethod
def display(
i_list_narr, # All the lists in one package
i_int_tmp, # Time index in each list (usually 0)
i_int_pos, # Pos index in each list (usually 1)
i_obj_can, # Can card object (chan, node, conf, ...)
) -> None:
# Display data in Enaml windows
with enaml.imports():
from canp_view_enaml_main import Main
app = QtApplication()
view = Main(
i_list_narr = i_list_narr,
i_int_tmp = i_int_tmp,
i_int_pos = i_int_pos,
i_obj_can = i_obj_can,
)
view.show()
app.start()
# --- MAIN ---
def __main__(i_list_args: List = []):
""" Basic self test (debugging)
"""
if True:
with enaml.imports():
from canp_view_enaml_main import Main
app = QtApplication()
view = Main()
view.show()
app.start()
else:
pass
if __name__ == CANP_ENUM__HEAD_MAIN:
""" Routine selector
"""
canp_args.dispatch(i_list_globals = globals())
| 22.188034 | 79 | 0.683359 | 374 | 2,596 | 4.473262 | 0.363636 | 0.071727 | 0.050209 | 0.075314 | 0.343694 | 0.216975 | 0.201435 | 0.201435 | 0.084877 | 0.084877 | 0 | 0.010091 | 0.198382 | 2,596 | 116 | 80 | 22.37931 | 0.793849 | 0.438752 | 0 | 0.196078 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.039216 | false | 0.019608 | 0.45098 | 0 | 0.509804 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
e1e9036c7d8f053a327d3b4d01c652a800c4413b | 345 | py | Python | utils.py | applejenny66/snoopy | 916700661976aef121c16c3cf1418f395eff54a6 | [
"MIT"
] | null | null | null | utils.py | applejenny66/snoopy | 916700661976aef121c16c3cf1418f395eff54a6 | [
"MIT"
] | null | null | null | utils.py | applejenny66/snoopy | 916700661976aef121c16c3cf1418f395eff54a6 | [
"MIT"
] | null | null | null | # utils.py
import numpy as np
import cv2
import os
def clearall():
import shutil
shutil.rmtree('./test')
os.mkdir('./test')
def blankarray(shape):
array = np.zeros(shape)
for x in range(0, shape[0]):
for y in range(0, shape[1]):
array[x, y, 0] = array[x, y, 1] = array[x, y, 2] = 255
return (array) | 20.294118 | 66 | 0.573913 | 56 | 345 | 3.535714 | 0.5 | 0.090909 | 0.106061 | 0.131313 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.043478 | 0.266667 | 345 | 17 | 67 | 20.294118 | 0.73913 | 0.023188 | 0 | 0 | 0 | 0 | 0.035714 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.307692 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
e1ecfe1022eb436ff719435d4d1f2bde99930652 | 1,011 | py | Python | movie_explorer/movie_rating/urls.py | ahtml/movie_project | 75e5cc3517520392b2a916b363785315511b02b6 | [
"MIT"
] | null | null | null | movie_explorer/movie_rating/urls.py | ahtml/movie_project | 75e5cc3517520392b2a916b363785315511b02b6 | [
"MIT"
] | null | null | null | movie_explorer/movie_rating/urls.py | ahtml/movie_project | 75e5cc3517520392b2a916b363785315511b02b6 | [
"MIT"
] | null | null | null | from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.views.generic.base import TemplateView
from movie_rating.views import MovieDescriptionView
from movie_rating.views import MyRatingsView
from . import views
urlpatterns = [
url(r'^$', views.sort, name='home'),
url(r'^register/', views.register, name='register'),
url(r'^login/', auth_views.login, name='login'),
url(r'^logout/', auth_views.logout, {'next_page': 'home'}, name='logout'),
url(r'^search/', views.search, name='search'),
url(r'^home/', views.sort, name='home'),
# url(r'^description/', views.description, name='description'),
url(r'^description/(?P<tmdb_movie_id>\d+)/', MovieDescriptionView.as_view(), name='description'),
# url(r'^rated/', views.rate, name='rated'),
url(r'^myratings/', MyRatingsView.as_view(), name='myratings'),
url(r'^changepassword/', views.changePass, name='changePassword'),
url(r'^profile/', views.profile, name='profile'),
]
| 43.956522 | 101 | 0.692384 | 133 | 1,011 | 5.18797 | 0.300752 | 0.069565 | 0.043478 | 0.057971 | 0.136232 | 0.06087 | 0 | 0 | 0 | 0 | 0 | 0 | 0.118694 | 1,011 | 22 | 102 | 45.954545 | 0.774411 | 0.102868 | 0 | 0 | 0 | 0 | 0.221239 | 0.039823 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.055556 | 0.333333 | 0 | 0.333333 | 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 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 2 |
e1eff052e64ac861f786a34ba2a3604632e572ba | 1,722 | py | Python | results/classical_ablation/classical_epochsize_data.py | bjader/QSSL | f3eeba7cd3d7c03f6990e89158323261947ab14e | [
"MIT"
] | 3 | 2021-06-12T21:11:42.000Z | 2022-02-11T12:10:28.000Z | results/classical_ablation/classical_epochsize_data.py | bjader/QSSL | f3eeba7cd3d7c03f6990e89158323261947ab14e | [
"MIT"
] | null | null | null | results/classical_ablation/classical_epochsize_data.py | bjader/QSSL | f3eeba7cd3d7c03f6990e89158323261947ab14e | [
"MIT"
] | 2 | 2021-06-12T16:28:06.000Z | 2021-06-12T21:11:49.000Z | import numpy as np
# ResNet-18, 5 classes, 100 linear probing epochs, classical, 8 width, variable epoch size
def results():
accs = np.array([
[(37.94, 9), (40.4, 19), (45.72, 49), (48.2, 99), (53.68, 199), (56.1, 299)],
[(43.32, 9), (47.64, 19), (48.98, 49), (51.96, 99), (53.82, 199), (54.48, 299)],
[(43.04, 9), (48.34, 19), (51.9, 49), (56.1, 99), (60.3, 199), (62.62, 299)],
[(44.86, 9), (47.86, 19), (53.4, 49), (56.58, 99), (57.3, 199), (59.7, 299)],
[(52.56, 9), (55.16, 19), (60.88, 49), (62.08, 99), (63.56, 199), (64.02, 299)]])
epoch_size = np.array([2500, 5000, 17500, 10000, 25000])
order = epoch_size.argsort()
epoch_size.sort()
sorted_accs = accs[order]
return epoch_size, sorted_accs
def results_low_tepochs():
accs = np.array([
[(39.74, 2), (45.32, 5), (44.8, 8), (44.18, 11), (45.76, 14), (45.98, 17), (48.24, 20), (47.16, 23), (48.9, 26),
(50.68, 29)],
[(35.26, 2), (36.7, 5), (36.92, 8), (38.68, 11), (38.32, 14), (39.0, 17), (38.54, 20), (38.62, 23), (39.24, 26),
(40.9, 29)],
[(36.34, 2), (38.56, 5), (42.76, 8), (45.9, 11), (45.84, 14), (46.7, 17), (46.68, 20), (46.34, 23), (45.92, 26),
(45.58, 29)],
[(41.82, 2), (44.2, 5), (45.08, 8), (47.5, 11), (47.52, 14), (48.3, 17), (48.8, 20), (47.76, 23), (48.8, 26),
(48.84, 29)],
[(48.94, 2), (51.56, 5), (52.02, 8), (51.78, 11), (53.5, 14), (53.0, 17), (53.94, 20), (55.38, 23), (55.88, 26),
(57.44, 29)]])
epoch_size = np.array([10000, 2500, 5000, 17500, 25000])
order = epoch_size.argsort()
epoch_size.sort()
sorted_accs = accs[order]
return epoch_size, sorted_accs
| 41 | 120 | 0.483159 | 320 | 1,722 | 2.55625 | 0.315625 | 0.099022 | 0.026895 | 0.03912 | 0.202934 | 0.202934 | 0.202934 | 0.202934 | 0.202934 | 0.202934 | 0 | 0.379651 | 0.235192 | 1,722 | 41 | 121 | 42 | 0.241458 | 0.051103 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0 | 0.033333 | 0 | 0.166667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e1f1cd747fa65d2410e55c0154e8833ae87468fb | 36,477 | py | Python | dbas/strings/keywords.py | tbsschroeder/dbas | 9c86eccde65cd64bc5719573b3b8449d8f333e08 | [
"MIT"
] | null | null | null | dbas/strings/keywords.py | tbsschroeder/dbas | 9c86eccde65cd64bc5719573b3b8449d8f333e08 | [
"MIT"
] | null | null | null | dbas/strings/keywords.py | tbsschroeder/dbas | 9c86eccde65cd64bc5719573b3b8449d8f333e08 | [
"MIT"
] | null | null | null | from enum import Enum
class Keywords(Enum):
arguments = 'arguments'
error = 'error'
iActuallyHave = 'iActuallyHave'
insertOneArgument = 'insertOneArgument'
insertDontCare = 'insertDontCare'
forgotInputRadio = 'forgotInputRadio'
needHelpToUnderstandStatement = 'needHelpToUnderstandStatement'
setPremisegroupsIntro1 = 'setPremisegroupsIntro1'
setPremisegroupsIntro2 = 'setPremisegroupsIntro2'
attack = 'attack'
support = 'support'
premise = 'premise'
because = 'because'
moreAbout = 'moreAbout'
undermine = 'undermine'
support1 = 'support1'
undercut1 = 'undercut1'
undercut2 = 'undercut2'
rebut1 = 'rebut1'
rebut2 = 'rebut2'
oldPwdEmpty = 'oldPwdEmpty'
newPwdEmtpy = 'newPwdEmtpy'
confPwdEmpty = 'confPwdEmpty'
newPwdNotEqual = 'newPwdNotEqual'
pwdsSame = 'pwdsSame'
oldPwdWrong = 'oldPwdWrong'
pwdChanged = 'pwdChanged'
emptyName = 'emptyName'
emptyEmail = 'emptyEmail'
emtpyContent = 'emtpyContent'
maliciousAntiSpam = 'maliciousAntiSpam'
maliciousSlug = 'maliciousSlug'
nonValidCSRF = 'nonValidCSRF'
name = 'name'
mail = 'mail'
phone = 'phone'
message = 'message'
messageDeleted = 'messageDeleted'
notification = 'notification'
notificationDeleted = 'notificationDeleted'
pwdNotEqual = 'pwdNotEqual'
pwdShort = 'pwdShort'
nickIsTaken = 'nickIsTaken'
mailIsTaken = 'mailIsTaken'
mailNotValid = 'mailNotValid'
mailSettingsTitle = 'mailSettingsTitle'
notificationSettingsTitle = 'notificationSettingsTitle'
errorTryLateOrContant = 'errorTryLateOrContant'
accountWasAdded = 'accountWasAdded'
accountRegistration = 'accountRegistration'
accountWasRegistered = 'accountWasRegistered'
accoutErrorTryLateOrContant = 'accoutErrorTryLateOrContant'
nicknameIs = 'nicknameIs'
newPwdIs = 'newPwdIs'
newPwdInfo = 'newPwdInfo'
dbasPwdRequest = 'dbasPwdRequest'
antispamquestion = 'antispamquestion'
defaultView = 'defaultView'
positions = 'positions'
labels = 'labels'
showMyPath = 'showMyPath'
hideMyPath = 'hideMyPath'
myStatements = 'myStatements'
supportsOnMyStatements = 'supportsOnMyStatements'
attacksOnMyStatements = 'attacksOnMyStatements'
addATopic = 'addATopic'
editIssueViewChangelog = 'editIssueViewChangelog'
editTitleHere = 'editTitleHere'
editInfoHere = 'editInfoHere'
viewChangelog = 'viewChangelog'
editStatementHere = 'editStatementHere'
save = 'save'
cancel = 'cancel'
submit = 'submit'
close = 'close'
urlSharing = 'urlSharing'
urlSharingDescription = 'urlSharingDescription'
warning = 'warning'
resumeHere = 'resumeHere'
aand = 'aand'
andor = 'andor'
addedEverything = 'addedEverything'
addStatementRow = 'addStatementRow'
addTopic = 'addTopic'
alreadyInserted = 'alreadyInserted'
addIssueInfo = 'addIssueInfo'
addPremisesRadioButtonText = 'addPremisesRadioButtonText'
addArgumentsRadioButtonText = 'addArgumentsRadioButtonText'
argumentContainerTextIfPremises = 'argumentContainerTextIfPremises'
argumentContainerTextIfArguments = 'argumentContainerTextIfArguments'
addPremiseRadioButtonText = 'addPremiseRadioButtonText'
addArgumentRadioButtonText = 'addArgumentRadioButtonText'
argumentContainerTextIfPremise = 'argumentContainerTextIfPremise'
argumentContainerTextIfArgument = 'argumentContainerTextIfArgument'
argumentContainerTextIfConclusion = 'argumentContainerTextIfConclusion'
argueAgainstPositionToggleButton = 'argueAgainstPositionToggleButton'
argueForPositionToggleButton = 'argueForPositionToggleButton'
andIDoNotBelieveCounter = 'andIDoNotBelieveCounter'
andIDoNotBelieveArgument = 'andIDoNotBelieveArgument'
andTheyDoNotBelieveCounter = 'andTheyDoNotBelieveCounter'
andTheyDoNotBelieveArgument = 'andTheyDoNotBelieveArgument'
argumentFlaggedBecauseOfftopic = 'argumentFlaggedBecauseOfftopic'
argumentFlaggedBecauseSpam = 'argumentFlaggedBecauseSpam'
argumentFlaggedBecauseHarmful = 'argumentFlaggedBecauseHarmful'
argumentFlaggedBecauseOptimization = 'argumentFlaggedBecauseOptimization'
argumentFlaggedBecauseEdit = 'argumentFlaggedBecauseEdit'
argumentFlaggedBecauseDuplicate = 'argumentFlaggedBecauseDuplicate'
argumentFlaggedBecauseSplit = 'argumentFlaggedBecauseSplit'
argumentFlaggedBecauseMerge = 'argumentFlaggedBecauseMerge'
argument_optimization_description = 'argument_optimization_description'
argument_offtopic_or_irrelevant_description = 'argument_offtopic_or_irrelevant_description'
argument_statement_harmful_description = 'argument_statement_harmful_description'
alternatively = 'alternatively'
addArguments = 'addArguments'
addStatements = 'addStatements'
addArgumentsTitle = 'addArgumentsTitle'
acceptItTitle = 'acceptItTitle'
acceptIt = 'acceptIt'
asReasonFor = 'asReasonFor'
askAFriend = 'askAFriend'
argument = 'argument'
attackPosition = 'attackPosition'
attackStatement = 'attackStatement'
at = 'at'
assertion = 'assertion'
accept = 'accept'
assistance = 'assistance'
agreeToThis0 = 'agreeToThis0'
agreeToThis1 = 'agreeToThis1'
agreeToThis2 = 'agreeToThis2'
attackedBy = 'attackedBy'
attackedWith = 'attackedWith'
agreeBecause = 'agreeBecause'
andIDoBelieveCounterFor = 'andIDoBelieveCounterFor'
andIDoBelieveArgument = 'andIDoBelieveArgument'
attitudeFor = 'attitudeFor'
alreadyFlaggedByOthers = 'alreadyFlaggedByOthers'
alreadyFlaggedByYou = 'alreadyFlaggedByYou'
alreadyEditProposals = 'alreadyEditProposals'
alreadyExecuted = 'alreadyExecuted'
breadcrumbsStart = 'breadcrumbsStart'
breadcrumbsChoose = 'breadcrumbsChoose'
breadcrumbsJustifyStatement = 'breadcrumbsJustifyStatement'
breadcrumbsGetPremisesForStatement = 'breadcrumbsGetPremisesForStatement'
breadcrumbsMoreAboutArgument = 'breadcrumbsMoreAboutArgument'
breadcrumbsReplyForPremisegroup = 'breadcrumbsReplyForPremisegroup'
breadcrumbsReplyForResponseOfConfrontation = 'breadcrumbsReplyForResponseOfConfrontation'
breadcrumbsReplyForArgument = 'breadcrumbsReplyForArgument'
bugSubmit = 'bugSubmit'
butIDoNotBelieveCounterFor = 'butIDoNotBelieveCounterFor'
butIDoNotBelieveArgumentFor = 'butIDoNotBelieveArgumentFor'
butIDoNotBelieveReasonForReject = 'butIDoNotBelieveReasonForReject'
butTheyDoNotBelieveCounter = 'butTheyDoNotBelieveCounter'
butSheDoesNotBelieveCounter = 'butSheDoesNotBelieveCounter'
butHeDoesNotBelieveCounter = 'butHeDoesNotBelieveCounter'
butTheyDoNotBelieveArgument = 'butTheyDoNotBelieveArgument'
butSheDoesNotBelieveArgument = 'butSheDoesNotBelieveArgument'
butHeDoesNotBelieveArgument = 'butHeDoesNotBelieveArgument'
butOtherParticipantsDontHaveOpinionRegardingYourOpinion = 'butOtherParticipantsDontHaveOpinionRegardingYourOpinion'
butOtherParticipantsDontHaveArgument = 'butOtherParticipantsDontHaveArgument'
butOtherParticipantsDontHaveCounterArgument = 'butOtherParticipantsDontHaveCounterArgument'
butWhich = 'butWhich'
butThisDoesNotRejectArgument = 'butThisDoesNotRejectArgument'
butThisDoesNotRejectStatement = 'butThisDoesNotRejectStatement'
but = 'but'
butYouCounteredWithInterest = 'butYouCounteredWithInterest'
butYouCounteredWithArgument = 'butYouCounteredWithArgument'
butYouAgreedWith = 'butYouAgreedWith'
canYouGiveAReason = 'canYouGiveAReason'
canYouGiveAReasonFor = 'canYouGiveAReasonFor'
canYouGiveACounter = 'canYouGiveACounter'
canYouGiveACounterArgumentWhy1 = 'canYouGiveACounterArgumentWhy1'
canYouGiveACounterArgumentWhy2 = 'canYouGiveACounterArgumentWhy2'
canYouGiveAReasonForThat = 'canYouGiveAReasonForThat'
canYouBeMorePrecise = 'canYouBeMorePrecise'
clickHereForRegistration = 'clickHereForRegistration'
clickForMore = 'clickForMore'
countOfArguments = 'countOfArguments'
countOfPosts = 'countOfPosts'
confirmation = 'confirmation'
contact = 'contact'
contactSubmit = 'contactSubmit'
confirmTranslation = 'confirmTranslation'
correctionsSet = 'correctionsSet'
checkFirstname = 'checkFirstname'
checkLastname = 'checkLastname'
checkNickname = 'checkNickname'
checkLanguage = 'checkLanguage'
checkEmail = 'checkEmail'
checkPassword = 'checkPassword'
checkConfirmation = 'checkConfirmation'
completeView = 'completeView'
completeViewTitle = 'completeViewTitle'
conclusionIsMissing = 'conclusionIsMissing'
checkPasswordConfirm = 'checkPasswordConfirm'
clickToChoose = 'clickToChoose'
clearStatistics = 'clearStatistics'
congratulation = 'congratulation'
currentDiscussion = 'currentDiscussion'
description_undermine = 'description_undermine'
description_support = 'description_support'
description_undercut = 'description_undercut'
description_rebut = 'description_rebut'
description_no_opinion = 'description_no_opinion'
decisionIndex7 = 'decisionIndex7'
decisionIndex30 = 'decisionIndex30'
decisionIndex7Info = 'decisionIndex7Info'
decisionIndex30Info = 'decisionIndex30Info'
dateString = 'dateString'
deleteTrack = 'deleteTrack'
deleteStatement = 'deleteStatement'
disassociateStatement = 'disassociateStatement'
deleteHistory = 'deleteHistory'
delete = 'delete'
disagreeBecause = 'disagreeBecause'
dataRemoved = 'dataRemoved'
didYouMean = 'didYouMean'
dialogView = 'dialogView'
dialogViewTitle = 'dialogViewTitle'
displayControlDialogGuidedTitle = 'displayControlDialogGuidedTitle'
displayControlDialogGuidedBody = 'displayControlDialogGuidedBody'
displayControlDialogIslandTitle = 'displayControlDialogIslandTitle'
displayControlDialogIslandBody = 'displayControlDialogIslandBody'
displayControlDialogExpertTitle = 'displayControlDialogExpertTitle'
displayControlDialogExpertBody = 'displayControlDialogExpertBody'
displayControlDialogGraphTitle = 'displayControlDialogGraphTitle'
displayControlDialogGraphBody = 'displayControlDialogGraphBody'
discussionEnd = 'discussionEnd'
discussionStart = 'discussionStart'
discussionEndAndReadOnly = 'discussionEndAndReadOnly'
discussionCongratulationEnd = 'discussionCongratulationEnd'
discussionEndLinkTextRestartDiscussion = 'discussionEndLinkTextRestartDiscussion'
discussionEndLinkTextWithQueueLoggedIn = 'discussionEndLinkTextWithQueueLoggedIn'
discussionEndLinkTextWithQueueNotLoggedIn = 'discussionEndLinkTextWithQueueNotLoggedIn'
discussionInfoTooltipSg = 'discussionInfoTooltipSg'
discussionInfoTooltipPl = 'discussionInfoTooltipPl'
discussionIsReadOnly = 'discussionIsReadOnly'
disagreeToThis0 = 'disagreeToThis0'
disagreeToThis1 = 'disagreeToThis1'
disagreeToThis2 = 'disagreeToThis2'
duplicate = 'duplicate'
duplicateDialog = 'duplicateDialog'
doesNotHold = 'doesNotHold'
isNotRight = 'isNotRight'
isNoGoodJustification = 'isNoGoodJustification'
doNotHesitateToContact = 'doNotHesitateToContact'
docs = 'docs'
doesJustify = 'doesJustify'
doesNotJustify = 'doesNotJustify'
doYouWantToEnterYourStatements = 'doYouWantToEnterYourStatements'
dataNowLocked = 'dataNowLocked'
dataUnlocked = 'dataUnlocked'
dataAlreadyLockedByYou = 'dataAlreadyLockedByYou'
dataAlreadyLockedByOthers = 'dataAlreadyLockedByOthers'
earlierYouArguedThat = 'earlierYouArguedThat'
eachStatement = 'eachStatement'
editIndex = 'editIndex'
editIndexInfo = 'editIndexInfo'
editTextMessage = 'editTextMessage'
editTextMessageForHtml = 'editTextMessageForHtml'
euCookiePopupTitle = 'euCookiePopupTitle'
euCookiePopupText = 'euCookiePopupText'
euCookiePopoupButton1 = 'euCookiePopoupButton1'
euCookiePopoupButton2 = 'euCookiePopoupButton2'
empty_news_input = 'empty_news_input'
empty_notification_input = 'empty_notification_input'
email = 'email'
emailWasSent = 'emailWasSent'
emailWasNotSent = 'emailWasNotSent'
emailUnknown = 'emailUnknown'
emailSentGeneric = 'emailSentGeneric'
emailBodyText = 'emailBodyText'
emailArgumentAddTitle = 'emailArgumentAddTitle'
emailArgumentAddBody = 'emailArgumentAddBody'
exampleName = 'exampleName'
exampleMail = 'exampleMail'
examplePhone = 'examplePhone'
exampleMessage = 'exampleMessage'
exampleMessageBug = 'exampleMessageBug'
exampleNickname = 'exampleNickname'
examplePassword = 'examplePassword'
exampleNicknameLdap = 'exampleNicknameLdap'
exampleFirstname = 'exampleFirstname'
exampleLastname = 'exampleLastname'
exampleStatement = 'exampleStatement'
exampleSource = 'exampleSource'
exampleSearchDuplicate = 'exampleSearchDuplicate'
examplePosition = 'examplePosition'
exampleReason = 'exampleReason'
exampleAddTopicTitle = 'exampleAddTopicTitle'
exampleAddTopicQuestion = 'exampleAddTopicQuestion'
exampleAddTopicDescription = 'exampleAddTopicDescription'
everythingSaved = 'everythingSaved'
opinionSaved = 'opinionSaved'
error_code = 'error_code'
edit = 'edit'
editTitle = 'editTitle'
editAlreadyTitle = 'editAlreadyTitle'
feelFreeToLogin = 'feelFreeToLogin'
forText = 'forText'
forThat = 'forThat'
firstConclusionRadioButtonText = 'firstConclusionRadioButtonText'
firstArgumentRadioButtonText = 'firstArgumentRadioButtonText'
feelFreeToShareUrl = 'feelFreeToShareUrl'
fetchLongUrl = 'fetchLongUrl'
fetchShortUrl = 'fetchShortUrl'
forgotPassword = 'forgotPassword'
firstOneInformationText = 'firstOneInformationText'
firstOneInformationTextM = 'firstOneInformationTextM'
firstOneInformationTextF = 'firstOneInformationTextF'
firstOneReason = 'firstOneReason'
firstOneReasonM = 'firstOneReasonM'
firstOneReasonF = 'firstOneReasonF'
firstPositionText = 'firstPositionText'
firstPositionTextM = 'firstPositionTextM'
firstPositionTextF = 'firstPositionTextF'
firstPremiseText1 = 'firstPremiseText1'
firstPremiseText1M = 'firstPremiseText1M'
firstPremiseText1F = 'firstPremiseText1F'
firstPremiseText2 = 'firstPremiseText2'
firstname = 'firstname'
fillLine = 'fillLine'
finish = 'exit'
finishTitle = 'finishTitle'
fieldtest = 'fieldtest'
fromm = 'fromm'
gender = 'gender'
goBack = 'goBack'
goHome = 'goHome'
goStepBack = 'goStepBack'
generateSecurePassword = 'generateSecurePassword'
goodPointTakeMeBackButtonText = 'goodPointTakeMeBackButtonText'
group_uid = 'group_uid'
goBackToTheDiscussion = 'goBackToTheDiscussion'
goForward = 'goForward'
goodPointAndUserIsInterestedTooM = 'goodPointAndUserIsInterestedTooM'
goodPointAndUserIsInterestedTooF = 'goodPointAndUserIsInterestedTooF'
goodPointAndOtherParticipantsIsInterestedToo = 'goodPointAndOtherParticipantsIsInterestedToo'
haveALookAt = 'haveALookAt'
hidePasswordRequest = 'hidePasswordRequest'
hideGenerator = 'hideGenerator'
hold = 'hold'
howeverIHaveMuchStrongerArgumentRejectingThat = 'howeverIHaveMuchStrongerArgumentRejectingThat'
howeverIHaveMuchStrongerArgumentAcceptingThat = 'howeverIHaveMuchStrongerArgumentAcceptingThat'
howeverIHaveMuchStrongerArgument = 'howeverIHaveMuchStrongerArgument'
howeverIHaveMuchStrongerArgumentTo = 'howeverIHaveMuchStrongerArgumentTo'
howeverIHaveEvenStrongerArgumentRejecting = 'howeverIHaveEvenStrongerArgumentRejecting'
howeverIHaveEvenStrongerArgumentAccepting = 'howeverIHaveEvenStrongerArgumentAccepting'
imprint = 'imprint'
iAgreeWithInColor = 'iAgreeWithInColor'
iAgreeWith = 'iAgreeWith'
iDisagreeWithInColor = 'iDisagreeWithInColor'
iDisagreeWith = 'iDisagreeWith'
iDoNotKnow = 'iDoNotKnow'
iDoNotKnowInColor = 'iDoNotKnowInColor'
iHaveNoOpinionYet = 'iHaveNoOpinionYet'
iHaveNoOpinion = 'iHaveNoOpinion'
iHaveNoOpinionYetInColor = 'iHaveNoOpinionYetInColor'
informationForExperts = 'informationForExperts'
internalFailureWhileDeletingTrack = 'internalFailureWhileDeletingTrack'
internalFailureWhileDeletingHistory = 'internalFailureWhileDeletingHistory'
internalError = 'internalError'
internalErrorHTTPS = 'internalErrorHTTPS'
internalKeyError = 'internalKeyError'
invalidTableName = 'invalidTableName'
issueList = 'issueList'
issueNotFound = 'issueNotFound'
irrelevant = 'irrelevant'
itIsTrueThat = 'itIsTrueThat'
maybeItIsTrueThat = 'maybeItIsTrueThat'
itIsTrueThatAnonymous = 'itIsTrueThatAnonymous'
itIsTrue1 = 'itIsTrue1'
itIsTrue2 = 'itIsTrue2'
itIsFalseThat = 'itIsFalseThat'
itIsFalseThatAnonymous = 'itIsFalseThatAnonymous'
itIsFalse1 = 'itIsFalse1'
itIsFalse2 = 'itIsFalse2'
itTrueIsThat = 'itTrueIsThat'
itFalseIsThat = 'itFalseIsThat'
isFalse = 'isFalse'
isNotAGoodIdea = 'isNotAGoodIdea'
isNotAGoodReasonFor = 'isNotAGoodReasonFor'
isNotAGoodReasonAgainstArgument = 'isNotAGoodReasonAgainstArgument'
issueEnableDescription = 'issueEnableDescription'
issuePublicDescription = 'issuePublicDescription'
issueWritableDescription = 'issueWritableDescription'
itIsNotRight = 'itIsNotRight'
isNotAGoodIdeaInColor = 'isNotAGoodIdeaInColor'
isTrue = 'isTrue'
areTrue = 'areTrue'
initialPositionInterest = 'initialPositionInterest'
invalidEmail = 'invalidEmail'
iAcceptCounter = 'iAcceptCounter'
iAcceptArgument = 'iAcceptArgument'
iAcceptCounterThat = 'iAcceptCounterThat'
iAcceptArgumentThat = 'iAcceptArgumentThat'
iHaveMuchStrongerArgumentRejecting = 'iHaveMuchStrongerArgumentRejecting'
iHaveEvenStrongerArgumentRejecting = 'iHaveEvenStrongerArgumentRejecting'
iHaveMuchStrongerArgumentAccepting = 'iHaveMuchStrongerArgumentAccepting'
iHaveEvenStrongerArgumentAccepting = 'iHaveEvenStrongerArgumentAccepting'
iNoOpinion = 'iNoOpinion'
interestingOnDBAS = 'interestingOnDBAS'
inputEmpty = 'inputEmpty'
informationForStatements = 'informationForStatements'
relativePopularityOfStatements = 'relativePopularityOfStatements'
jumpAnswer0 = 'jumpAnswer0'
jumpAnswer1 = 'jumpAnswer1'
jumpAnswer2 = 'jumpAnswer2'
jumpAnswer3 = 'jumpAnswer3'
jumpAnswer4 = 'jumpAnswer4'
newIssueErrorMsg = 'newIssueErrorMsg'
newIssueTitle = 'newIssueHasNoTitle'
newIssueInfo = 'newIssueHasNoInfo'
newIssueLongInfo = 'newIssueHasNoLongInfo'
supportAnswer0 = 'supportAnswer0'
supportAnswer1 = 'supportAnswer1'
supportAnswer2 = 'supportAnswer2'
supportAnswer3 = 'supportAnswer3'
justLookDontTouch = 'justLookDontTouch'
keyword = 'keyword'
keywordStart = 'keywordStart'
keywordChooseActionForStatement = 'keywordChooseActionForStatement'
keywordGetPremisesForStatement = 'keywordGetPremisesForStatement'
keywordMoreAboutArgument = 'keywordMoreAboutArgument'
keywordReplyForPremisegroup = 'keywordReplyForPremisegroup'
keywordReplyForResponseOfConfrontation = 'keywordReplyForResponseOfConfrontation'
keywordReplyForArgument = 'keywordReplyForArgument'
keepSetting = 'keepSetting'
holds = 'holds'
holdsInColor = 'holdsInColor'
hideAllUsers = 'hideAllUsers'
hideAllAttacks = 'hideAllAttacks'
letMeExplain = 'letMeExplain'
levenshteinDistance = 'levenshteinDistance'
languageCouldNotBeSwitched = 'languageCouldNotBeSwitched'
last_action = 'last_action'
last_login = 'last_login'
login = 'login'
logfile = 'logfile'
letsGo = 'letsGo'
letsGoBack = 'letsGoBack'
letsGoHome = 'letsGoHome'
langNotFound = 'langNotFound'
latestNewsFromDiscussion = 'latestNewsFromDiscussion'
latestNewsFromDBAS = 'latestNewsFromDBAS'
ldapInfo = 'ldapInfo'
more = 'more'
medium = 'medium'
minLength = 'minLength'
myArgument = 'myArgument'
mark_as_opinion = 'mark_as_opinion'
unmark_as_opinion = 'unmark_as_opinion'
user_is_admin = 'user_is_admin'
user_is_special = 'user_is_special'
user_is_author = 'user_is_author'
next = 'next'
now = 'now'
nowYouSayThat = 'nowYouSayThat'
newNotification = 'newNotification'
newMention = 'newMention'
newPremiseRadioButtonText = 'newPremiseRadioButtonText'
newPremiseRadioButtonTextAsFirstOne = 'newPremiseRadioButtonTextAsFirstOne'
newConclusionRadioButtonText = 'newConclusionRadioButtonText'
newConclusionRadioButtonTextNewIdea = 'newConclusionRadioButtonTextNewIdea'
newsAboutDbas = 'newsAboutDbas'
nickname = 'nickname'
noOtherAttack = 'noOtherAttack'
noCorrections = 'noCorrections'
noCorrectionsSet = 'noCorrectionsSet'
noDecisionDone = 'noDecisionDone'
noDataSelected = 'noDataSelected'
notInsertedErrorBecauseEmpty = 'notInsertedErrorBecauseEmpty'
notInsertedErrorBecauseDuplicate = 'notInsertedErrorBecauseDuplicate'
notInsertedErrorBecauseUnknown = 'notInsertedErrorBecauseUnknown'
notInsertedErrorBecauseInternal = 'notInsertedErrorBecauseInternal'
noEntries = 'noEntries'
noTrackedData = 'noTrackedData'
number = 'number'
note = 'note'
no_entry = 'no_entry'
no_arguments = 'no_arguments'
noRights = 'noRights'
notLoggedIn = 'notLoggedIn'
on = 'on'
of = 'of'
off = 'off'
opinion_his = 'opinion_his'
opinion_her = 'opinion_her'
opinion = 'opinion'
onlyOneItem = 'onlyOneItem'
onlyOneItemWithLink = 'onlyOneItemWithLink'
unfortunatelyOnlyOneItem = 'unfortunatelyOnlyOneItem'
otherParticipantsConvincedYouThat = 'otherParticipantsConvincedYouThat'
otherParticipantsThinkThat = 'otherParticipantsThinkThat'
otherParticipantsAgreeThat = 'otherParticipantsAgreeThat'
otherParticipants = 'otherParticipants'
thinkThat = 'thinkThat'
agreeThat = 'agreeThat'
thinksThat = 'thinksThat'
agreesThat = 'agreesThat'
that = 'that'
earlierYouHadNoOpinitionForThisStatement = 'earlierYouHadNoOpinitionForThisStatement'
whichConfirmedYourView = 'whichConfirmedYourView'
otherUserDoesntHaveOpinionForThisStatement = 'otherUserDoesntHaveOpinionForThisStatement'
otherParticipantsDontHaveOpinionForThisStatement = 'otherParticipantsDontHaveOpinionForThisStatement'
otherParticipantsDontHaveOpinion = 'otherParticipantsDontHaveOpinion'
otherParticipantsDontHaveOpinionRegaringYourSelection = 'otherParticipantsDontHaveOpinionRegaringYourSelection'
otherParticipantsDontHaveCounterForThat = 'otherParticipantsDontHaveCounterForThat'
otherParticipantsDontHaveNewCounterForThat = 'otherParticipantsDontHaveNewCounterForThat'
otherParticipantsDontHaveCounter = 'otherParticipantsDontHaveCounter'
otherParticipantsDontHaveArgument = 'otherParticipantsDontHaveArgument'
otherParticipantsAcceptBut = 'otherParticipantsAcceptBut'
otherParticipantDisagreeThat = 'otherParticipantDisagreeThat'
otherUsersClaimStrongerArgumentS = 'otherUsersClaimStrongerArgumentS'
otherUsersClaimStrongerArgumentP = 'otherUsersClaimStrongerArgumentP'
claimsStrongerArgumentRejecting = 'claimsStrongerArgumentRejecting'
claimsStrongerArgumentAccepting = 'claimsStrongerArgumentAccepting'
otherUsersHaveCounterArgument = 'otherUsersHaveCounterArgument'
otherUsersSaidThat = 'otherUsersSaidThat'
thenOtherUsersSaidThat = 'thenOtherUsersSaidThat'
opinionBarometer = 'opinionBarometer'
pleaseAddYourSuggestion = 'pleaseAddYourSuggestion'
pleaseTryAgainLaterOrContactUs = 'pleaseTryAgainLaterOrContactUs'
premiseGroup = 'premiseGroup'
premisegroupPopupWarning = 'premisegroupPopupWarning'
previous = 'previous'
publicNickTitle = 'publicNickTitle'
passwordSubmit = 'passwordSubmit'
passwordRequestLDAP = 'PasswordRequestLdap'
preferredLangTitle = 'preferredLangTitle'
priv_access_x_queue = 'priv_access_{}_queue'
priv_access_edit_queue = 'priv_access_edit_queue'
priv_access_delete_queue = 'priv_access_delete_queue'
priv_access_duplicate_queue = 'priv_access_duplicate_queue'
priv_access_optimization_queue = 'priv_access_optimization_queue'
priv_access_merge_queue = 'priv_access_merge_queue'
priv_access_split_queue = 'priv_access_split_queue'
priv_access_history_queue = 'priv_history_queue'
priv_access_ongoing_queue = 'priv_ongoing_queue'
privacy_policy = 'privacy_policy'
publications = 'publications'
premiseAndConclusionAreEqual = 'premiseAndConclusionAreEqual'
queue = 'queue'
queueDelete = 'queueDelete'
queueOptimization = 'queueOptimization'
queueEdit = 'queueEdit'
queueDuplicate = 'queueDuplicate'
queueSplit = 'queueSplit'
queueMerge = 'queueMerge'
queueHistory = 'queueHistory'
queueOngoing = 'queueOngoing'
requestPassword = 'requestPassword'
myPosition = 'myPosition'
myPositionGenitiv = 'myPositionGenitiv'
the_der = 'the_der'
the_die = 'the_die'
the_das = 'the_das'
reference = 'reference'
registered = 'registered'
restartDiscussion = 'restartDiscussion'
restartDiscussionTitle = 'restartDiscussionTitle'
restartOnError = 'restartOnError'
recipient = 'recipient'
recipientNotFound = 'recipientNotFound'
report = 'report'
reportStatement = 'reportStatement'
reportArgument = 'reportArgument'
reportIssue = 'reportIssue'
review = 'review'
review_history = 'review_history'
review_ongoing = 'review_ongoing'
reputation = 'reputation'
right = 'right'
reason = 'reason'
requestTrack = 'requestTrack'
refreshTrack = 'refreshTrack'
requestHistory = 'requestHistory'
refreshHistory = 'refreshHistory'
requestFailed = 'requestFailed'
reject = 'reject'
rejection = 'rejection'
remStatementRow = 'remStatementRow'
reaction = 'reaction'
attitudesOfOpinions = 'attitudesOfOpinions'
reactionFor = 'reactionFor'
agreeVsDisagree = 'agreeVsDisagree'
rep_reason_first_argument_click = 'rep_reason_first_argument_click'
rep_reason_first_confrontation = 'rep_reason_first_confrontation'
rep_reason_first_position = 'rep_reason_first_position'
rep_reason_first_justification = 'rep_reason_first_justification'
rep_reason_first_new_argument = 'rep_reason_first_new_argument'
rep_reason_new_statement = 'rep_reason_new_statement'
rep_reason_success_flag = 'rep_reason_success_flag'
rep_reason_success_edit = 'rep_reason_success_edit'
rep_reason_success_duplicate = 'rep_reason_success_duplicate'
rep_reason_bad_flag = 'rep_reason_bad_flag'
rep_reason_bad_edit = 'rep_reason_bad_edit'
rep_reason_bad_duplicate = 'rep_reason_bad_duplicate'
reaction_text_undermine = 'reaction_text_undermine'
reaction_text_support = 'reaction_text_support'
reaction_text_undercut = 'reaction_text_undercut'
reaction_text_undercut_for_dont_know = 'reaction_text_undercut_for_dont_know'
reaction_text_rebut = 'reaction_text_rebut'
reaction_text_rebut_for_dont_know = 'reaction_text_rebut_for_dont_know'
questionTitle = 'questionTitle'
saveMyStatement = 'saveMyStatement'
selectStatement = 'selectStatement'
selectMultipleStatementsWhichFlag = 'selectMultipleStatementsWhichFlag'
mergeStatement = 'mergeStatement'
mergeMultipleStatements = 'mergeMultipleStatements'
mergeMultiplePGroup = 'mergeMultiplePGroup'
splitStatement = 'splitStatement'
splitMultipleStatements = 'splitMultipleStatements'
splitMultiplePGroup = 'splitMultiplePGroup'
showAllUsers = 'showAllUsers'
showAllArguments = 'showAllArguments'
showAllArgumentsTitle = 'showAllArgumentsTitle'
showAllUsersTitle = 'showAllUsersTitle'
supportPosition = 'supportPosition'
supportsNot = 'supportsNot'
isupport = 'isupport'
strength = 'strength'
strong = 'strong'
strongerStatementF = 'strongerStatementF'
strongerStatementM = 'strongerStatementM'
strongerStatementP = 'strongerStatementP'
strongerStatementY = 'strongerStatementY'
accepting = 'accepting'
rejecting = 'rejecting'
strongerStatementEnd = 'strongerStatementEnd'
search = 'search'
searchForStatements = 'searchForStatements'
serviceNotAvailable = 'serviceNotAvailable'
someoneArgued = 'someoneArgued'
soYouEnteredMultipleReasons = 'soYouEnteredMultipleReasons'
soYourOpinionIsThat = 'soYourOpinionIsThat'
soYouWantToArgueAgainst = 'soYouWantToArgueAgainst'
shortenedBy = 'shortenedBy'
shareUrl = 'shareUrl'
showMeAnotherArgument = 'showMeAnotherArgument'
switchDiscussion = 'switchDiscussion'
switchDiscussionTitle = 'switchDiscussionTitle'
switchDiscussionText1 = 'switchDiscussionText1'
switchDiscussionText2 = 'switchDiscussionText2'
switchLanguage = 'switchLanguage'
statement = 'statement'
statementAdded = 'statementAdded'
statementIsAbout = 'statementIsAbout'
statementAbout = 'statementAbout'
statementIsDuplicate = 'statementIsDuplicate'
statement_offtopic_or_irrelevant_description = 'statement_offtopic_or_irrelevant_description'
statement_duplicate_description = 'statement_duplicate_description'
statement_merge_description = 'statement_merge_description'
statement_split_description = 'statement_split_description'
statement_optimization_description = 'statement_optimization_description'
settings = 'settings'
senderReceiverSame = 'senderReceiverSame'
seperated = 'seperated'
argumentAdded = 'argumentAdded'
positionAdded = 'positionAdded'
statementAddedMessageContent = 'statementAddedMessageContent'
argumentAddedMessageContent = 'argumentAddedMessageContent'
statementIndex = 'statementIndex'
statementIndexInfo = 'statementIndexInfo'
statementsShowAll = 'statementsShowAll'
statementsHideAll = 'statementsHideAll'
sureThat = 'sureThat'
surname = 'surname'
myStatement = 'myStatement'
myDiscussions = 'myDiscussions'
showMeAnArgumentFor = 'showMeAnArgumentFor'
textAreaReasonHintText = 'textAreaReasonHintText'
theCounterArgument = 'theCounterArgument'
therefore = 'therefore'
thinkWeShould = 'thinkWeShould'
track = 'track'
this = 'this'
textversionChangedTopic = 'textversionChangedTopic'
textversionChangedContent = 'textversionChangedContent'
to = 'to'
history = 'history'
topicString = 'topicString'
text = 'text'
theySay = 'theySay'
heSays = 'heSays'
sheSays = 'sheSays'
theyThink = 'theyThink'
theyThinkThat = 'theyThinkThat'
participantsThink = 'participantsThink'
heThinks = 'heThinks'
sheThinks = 'sheThinks'
thisIsACopyOfMail = 'thisIsACopyOfMail'
thisConfrontationIs = 'thisConfrontationIs'
thisArgument = 'thisArgument'
theirArgument = 'theirArgument'
hisArgument = 'hisArgument'
herArgument = 'herArgument'
theirStatement = 'theirStatement'
hisStatement = 'hisStatement'
herStatement = 'herStatement'
theirAssertion = 'theirAssertion'
herAssertion = 'herAssertion'
hisAssertion = 'hisAssertion'
theirPosition = 'theirPosition'
hisPosition = 'hisPosition'
herPosition = 'herPosition'
theirReason = 'theirReason'
herReason = 'herReason'
hisReason = 'hisReason'
textChange = 'textChange'
thxForFlagText = 'thxForFlagText'
veryweak = 'veryweak'
wantToStateNewPosition = 'wantToStateNewPosition'
weak = 'weak'
wrong = 'wrong'
where = 'where'
wouldYourShareArgument = 'wouldYourShareArgument'
whatDoYouThinkAbout = 'whatDoYouThinkAbout'
whatDoYouThinkArgument = 'whatDoYouThinkArgument'
whatDoYouThinkOf = 'whatDoYouThinkOf'
whatDoYouThinkAboutThat = 'whatDoYouThinkAboutThat'
whatIsYourIdea = 'whatIsYourIdea'
whatIsYourMostImportantReasonForArgument = 'whatIsYourMostImportantReasonForArgument'
whatIsYourMostImportantReasonForStatement = 'whatIsYourMostImportantReasonForStatement'
whatIsYourMostImportantReasonAgainstArgument = 'whatIsYourMostImportantReasonAgainstArgument'
whatIsYourMostImportantReasonAgainstStatement = 'whatIsYourMostImportantReasonAgainstStatement'
whatIsYourMostImportantReasonWhyFor = 'whatIsYourMostImportantReasonWhyFor'
whatIsYourMostImportantReasonWhyAgainst = 'whatIsYourMostImportantReasonWhyAgainst'
whatIsYourMostImportantReasonWhyForInColor = 'whatIsYourMostImportantReasonWhyForInColor'
whatIsYourMostImportantReasonWhyAgainstInColor = 'whatIsYourMostImportantReasonWhyAgainstInColor'
whyDoYouThinkThat = 'whyDoYouThinkThat'
wrongArgument = 'wrongArgument'
wrongStatement = 'wrongStatement'
wrongConclusion = 'wrongConclusion'
wrongURL = 'wrongURL'
whyAreYouDisagreeingWith = 'whyAreYouDisagreeingWith'
whyAreYouAgreeingWith = 'whyAreYouAgreeingWith'
whyAreYouDisagreeingWithInColor = 'whyAreYouDisagreeingWithInColor'
whyAreYouAgreeingWithInColor = 'whyAreYouAgreeingWithInColor'
whyAreYouDisagreeingWithThat = 'whyAreYouDisagreeingWithThat'
itsYou = 'itsYou'
youMadeA = 'youMadeA'
youMadeAn = 'youMadeAn'
youHaveSelectedStatement = 'youHaveSelectedStatement'
relation_undermine = 'relation_undermine'
relation_support = 'relation_support'
relation_undercut = 'relation_undercut'
relation_rebut = 'relation_rebut'
uid = 'uid'
unfortunatelyNoMoreArgument = 'unfortunatelyNoMoreArgument'
userPasswordNotMatch = 'userPasswordNotMatch'
userOptions = 'userOptions'
userNotFound = 'userNotFound'
userIsOAuth = 'userIsOAuth'
userIsNotAuthorOfStatement = 'userIsNotAuthorOfStatement'
userIsNotAuthorOfArgument = 'userIsNotAuthorOfArgument'
untilNowThereAreNoMoreInformation = 'untilNowThereAreNoMoreInformation'
voteCountTextFirst = 'voteCountTextFirst'
voteCountTextFirstM = 'voteCountTextFirstM'
voteCountTextFirstF = 'voteCountTextFirstF'
voteCountTextMayBeFirst = 'voteCountTextMayBeFirst'
voteCountTextMayBeFirstM = 'voteCountTextMayBeFirstM'
voteCountTextMayBeFirstF = 'voteCountTextMayBeFirstF'
voteCountTextOneOther = 'voteCountTextOneOther'
voteCountTextOneOtherM = 'voteCountTextOneOtherM'
voteCountTextOneOtherF = 'voteCountTextOneOtherF'
voteCountTextMore = 'voteCountTextMore'
voteCountTextOneMore = 'voteCountTextOneMore'
voteCountTextOneMoreM = 'voteCountTextOneMoreM'
voteCountTextOneMoreF = 'voteCountTextOneMoreF'
visitDeleteQueue = 'visitDeleteQueue'
visitDeleteQueueLimitation = 'visitDeleteQueueLimitation'
visitEditQueue = 'visitEditQueue'
visitEditQueueLimitation = 'visitEditQueueLimitation'
visitDuplicateQueue = 'visitDuplicateQueue'
visitDuplicateQueueLimitation = 'visitDuplicateQueueLimitation'
visitOptimizationQueue = 'visitOptimizationQueue'
visitOptimizationQueueLimitation = 'visitOptimizationQueueLimitation'
visitSplitQueue = 'visitSplitQueue'
visitSplitQueueLimitation = 'visitSplitQueueLimitation'
visitMergeQueue = 'visitMergeQueue'
visitMergeQueueLimitation = 'visitMergeQueueLimitation'
visitHistoryQueue = 'visitHistoryQueue'
visitHistoryQueueLimitation = 'visitHistoryQueueLimitation'
visitOngoingQueue = 'visitOngoingQueue'
welcome = 'welcome'
welcomeMessage = 'welcomeMessage'
youAreInterestedIn = 'youAreInterestedIn'
youHaveTheOpinionThat = 'youHaveTheOpinionThat'
youAgreeWith = 'youAgreeWith'
youAgreeWithThatNow = 'youAgreeWithThatNow'
youDisagreeWith = 'youDisagreeWith'
youSaidThat = 'youSaidThat'
youUsedThisEarlier = 'youUsedThisEarlier'
youRejectedThisEarlier = 'youRejectedThisEarlier'
youHaveMuchStrongerArgumentForAccepting = 'youHaveMuchStrongerArgumentForAccepting'
youHaveMuchStrongerArgumentForRejecting = 'youHaveMuchStrongerArgumentForRejecting'
youAreAbleToReviewNow = 'youAreAbleToReviewNow'
youArgue = 'youArgue'
youAgreeWithThecounterargument = 'youAgreeWithThecounterargument'
@staticmethod
def get_key_by_string(string):
"""
Returns a key by his name
:raises KeyError if the key is not in the enumeration
:param string: The name of the key
:return: The key
"""
for key in Keywords:
if key.name == string:
return key
raise KeyError('Invalid key: {}'.format(string))
| 44.429963 | 119 | 0.77542 | 1,937 | 36,477 | 14.455343 | 0.420754 | 0.007714 | 0.008036 | 0.004429 | 0.055429 | 0.041393 | 0.031607 | 0.005071 | 0 | 0 | 0 | 0.002734 | 0.157825 | 36,477 | 820 | 120 | 44.484146 | 0.908724 | 0.003646 | 0 | 0 | 0 | 0 | 0.386654 | 0.202915 | 0 | 0 | 0 | 0 | 0.004951 | 1 | 0.001238 | false | 0.012376 | 0.011139 | 0 | 1.004951 | 0.001238 | 0 | 0 | 1 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
e1f8112319b28b532cfa6cb895e3fdd5c5549e21 | 2,112 | py | Python | config.py | guomaoqiu/Celery_Flask_Demo | 7051361ca34c7e0d62678d8bd0e3c89403195d0f | [
"MIT"
] | 4 | 2018-04-10T10:06:03.000Z | 2021-02-06T04:48:50.000Z | config.py | guomaoqiu/Celery_Flask_Demo | 7051361ca34c7e0d62678d8bd0e3c89403195d0f | [
"MIT"
] | null | null | null | config.py | guomaoqiu/Celery_Flask_Demo | 7051361ca34c7e0d62678d8bd0e3c89403195d0f | [
"MIT"
] | 2 | 2018-06-05T08:34:19.000Z | 2018-08-13T10:41:29.000Z | #-*- coding:utf-8 -*-
import os
basedir = os.path.abspath(os.path.dirname(__file__))
from datetime import timedelta
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
# send mail
MAIL_SERVER = 'smtp.qq.com'
MAIL_PORT = 465
MAIL_USE_SSL = True
MAIL_USERNAME = '2399447849@qq.com' #os.environ.get('MAIL_USERNAME')
MAIL_PASSWORD = '' #os.environ.get('MAIL_PASSWORD')
FLASKY_MAIL_SUBJECT_PREFIX = u''
FLASKY_MAIL_SENDER = '2399447849@qq.com'
FLASKY_ADMIN = '2399447849@qq.com' # os.environ.get('FANXIANG_ADMIN')
CELERY_BROKER_URL = 'redis://localhost:6379',
CELERY_RESULT_BACKEND = 'redis://localhost:6379'
CELERY_TIMEZONE = 'Asia/Shanghai'
CELERYBEAT_SCHEDULE = {
# 定义任务名称:task1、task2
# 执行规则:通过timedelta定义
'task1': {
'task': 'task1',
'schedule': timedelta(seconds=5)
},
'task2': {
'task': 'task2',
'schedule': timedelta(seconds=10)
}
}
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(Config):
'''
# 创建数据库时需要指定编码为UTF8;
# CREATE DATABASE `celery` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
# grant all on celery.* to celery@'127.0.0.1' identified by 'celery';
# flush privileges;
#
#python manage.py shell #创建用户角色对应表
from manager import Role
Role.insert_roles()
Role.query.all()
[<Role u'Moderator'>, <Role u'Administrator'>, <Role u'User'>]
'''
DEBUG = True
db_host = '127.0.0.1'
db_user = 'celery'
db_pass = 'celery'
db_name = 'celery'
SQLALCHEMY_DATABASE_URI = 'mysql://' + db_user + ':' + db_pass + '@' + db_host + '/' + db_name
#SQLALCHEMY_ECHO=False #用于显式地禁用或启用查询记录
class TestingConfig(Config):
TESTING = True
class ProductionConfig(Config):
DEBUG = True
config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}
| 26.734177 | 98 | 0.641572 | 241 | 2,112 | 5.427386 | 0.518672 | 0.027523 | 0.036697 | 0.025994 | 0.041284 | 0.041284 | 0 | 0 | 0 | 0 | 0 | 0.04064 | 0.231061 | 2,112 | 78 | 99 | 27.076923 | 0.764778 | 0.076231 | 0 | 0.04 | 0 | 0 | 0.172615 | 0.028553 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.08 | 0.04 | null | null | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e1fc3278855be7c26c8c42a590aa200b45506947 | 917 | py | Python | test/custom/seed_column_types/test_seed_column_types.py | mv1742/dbt-spark | a8a85c54d10920af1c5efcbb4d2a51eb7cfcad11 | [
"Apache-2.0"
] | null | null | null | test/custom/seed_column_types/test_seed_column_types.py | mv1742/dbt-spark | a8a85c54d10920af1c5efcbb4d2a51eb7cfcad11 | [
"Apache-2.0"
] | null | null | null | test/custom/seed_column_types/test_seed_column_types.py | mv1742/dbt-spark | a8a85c54d10920af1c5efcbb4d2a51eb7cfcad11 | [
"Apache-2.0"
] | null | null | null | from cProfile import run
from test.custom.base import DBTSparkIntegrationTest, use_profile
import dbt.exceptions
class TestSeedColumnTypeCast(DBTSparkIntegrationTest):
@property
def schema(self):
return "seed_column_types"
@property
def models(self):
return "models"
@property
def project_config(self):
return {
'seeds': {
'quote_columns': False,
},
}
# runs on Spark v2.0
@use_profile("apache_spark")
def test_seed_column_types_apache_spark(self):
self.run_dbt(["seed"])
# runs on Spark v3.0
@use_profile("databricks_cluster")
def test_seed_column_types_databricks_cluster(self):
self.run_dbt(["seed"])
# runs on Spark v3.0
@use_profile("databricks_sql_endpoint")
def test_seed_column_types_databricks_sql_endpoint(self):
self.run_dbt(["seed"])
| 24.783784 | 65 | 0.653217 | 107 | 917 | 5.308411 | 0.373832 | 0.070423 | 0.105634 | 0.089789 | 0.366197 | 0.295775 | 0.183099 | 0.183099 | 0.183099 | 0.183099 | 0 | 0.008759 | 0.252999 | 917 | 36 | 66 | 25.472222 | 0.820438 | 0.061069 | 0 | 0.230769 | 0 | 0 | 0.123687 | 0.026838 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.115385 | 0.115385 | 0.5 | 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 | 0 | 0 | 0 | 2 |
c0029380dc7dcc7db892d91add5ca6da6236f89e | 1,023 | py | Python | ion/agents/port/exceptions.py | ooici/coi-services | 43246f46a82e597345507afd7dfc7373cb346afa | [
"BSD-2-Clause"
] | 3 | 2016-09-20T09:50:06.000Z | 2018-08-10T01:41:38.000Z | ion/agents/port/exceptions.py | ooici/coi-services | 43246f46a82e597345507afd7dfc7373cb346afa | [
"BSD-2-Clause"
] | null | null | null | ion/agents/port/exceptions.py | ooici/coi-services | 43246f46a82e597345507afd7dfc7373cb346afa | [
"BSD-2-Clause"
] | 2 | 2016-03-16T22:25:49.000Z | 2016-11-26T14:54:21.000Z | #!/usr/bin/env python
"""
@package ion.agents.port.exceptions Exception classes for the port agent
@file ion/agents/port/exceptions.py
@author Bill French
@brief Common exceptions used in port agent. Specific ones can be subclassed
in the driver code.
"""
__author__ = 'Bill French'
from ion.agents.instrument.common import InstErrorCode
import traceback
class PortAgentException(Exception):
"""Base class for an exception related to the port agent
"""
def __init__ (self, msg):
super(PortAgentException,self).__init__(msg)
class PortAgentLaunchException(PortAgentException):
"""
A port agnet process failed to launch
"""
pass
class PortAgentMissingConfig(PortAgentException):
"""
A port agnet process failed to launch
"""
pass
class PortAgentTimeout(PortAgentException):
"""
A port agnet process failed to launch
"""
pass
class NotImplementedException(PortAgentException):
"""
A port agnet function is not implemented.
"""
pass
| 21.765957 | 76 | 0.717498 | 118 | 1,023 | 6.118644 | 0.508475 | 0.105263 | 0.127424 | 0.155125 | 0.240997 | 0.240997 | 0.240997 | 0.240997 | 0.240997 | 0.240997 | 0 | 0 | 0.198436 | 1,023 | 46 | 77 | 22.23913 | 0.880488 | 0.450635 | 0 | 0.285714 | 0 | 0 | 0.022541 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0.285714 | 0.142857 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
c018464dca11e6dae1683eb2b19d72c9c2ed549d | 670 | py | Python | Tests/test_filtre_villes.py | aminelarhchim/FindMeCulture-App | 8a3401ad7cca6111be96da414b8fb1719f22ed74 | [
"MIT"
] | null | null | null | Tests/test_filtre_villes.py | aminelarhchim/FindMeCulture-App | 8a3401ad7cca6111be96da414b8fb1719f22ed74 | [
"MIT"
] | null | null | null | Tests/test_filtre_villes.py | aminelarhchim/FindMeCulture-App | 8a3401ad7cca6111be96da414b8fb1719f22ed74 | [
"MIT"
] | null | null | null | #Autre test pour le filtre des musées sur les villes, qui vérifie la correspondance de manière plus précise.
import sys
import os
from pathlib import Path
scriptpath = Path(os.path.dirname(os.path.abspath(__file__))).parent
sys.path.insert(0,str(scriptpath))
import pandas as pd
from data_extraction.filtre_base_de_donnees import filtre_par_villes
from pandas import isnull
def test_filtre_par_villes():
df = pd.read_excel(r"tests\tests.xlsx")
assert df[df.VILLE=="ALISE-SAINTE-REINE"].applymap(lambda x: {} if isnull(x) else x).eq(filtre_par_villes(df,"ALISE-SAINTE-REINE").applymap(lambda x: {} if isnull(x) else x)).all().all()
test_filtre_par_villes() | 37.222222 | 190 | 0.771642 | 111 | 670 | 4.486486 | 0.540541 | 0.072289 | 0.120482 | 0.076305 | 0.180723 | 0.180723 | 0.180723 | 0.180723 | 0.180723 | 0.180723 | 0 | 0.001684 | 0.113433 | 670 | 18 | 191 | 37.222222 | 0.8367 | 0.159701 | 0 | 0 | 0 | 0 | 0.092362 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 1 | 0.083333 | false | 0 | 0.5 | 0 | 0.583333 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
c021ee5fba9ba81ebc8699d195f7515e77e82d01 | 329 | py | Python | python/bigadd.py | seckcoder/lang-learn | 1e0d6f412bbd7f89b1af00293fd907ddb3c1b571 | [
"Unlicense"
] | 1 | 2017-10-14T04:23:45.000Z | 2017-10-14T04:23:45.000Z | python/bigadd.py | seckcoder/lang-learn | 1e0d6f412bbd7f89b1af00293fd907ddb3c1b571 | [
"Unlicense"
] | null | null | null | python/bigadd.py | seckcoder/lang-learn | 1e0d6f412bbd7f89b1af00293fd907ddb3c1b571 | [
"Unlicense"
] | null | null | null | import itertools
def bigadd(a, b):
z = [x+y for x,y in itertools.izip_longest(reversed(a),reversed(b),fillvalue=0)]
res = [x+y for x,y in itertools.izip_longest([i%10 for i in z],[0] + [i/10 for i in z],fillvalue=0)]
[x for x in itertools.dropwhile(lambda x: x == 0, reversed(res))]
print bigadd([1,2,3], [4,5,6,8])
| 41.125 | 104 | 0.644377 | 68 | 329 | 3.088235 | 0.426471 | 0.038095 | 0.047619 | 0.057143 | 0.371429 | 0.371429 | 0.27619 | 0.27619 | 0.27619 | 0 | 0 | 0.054745 | 0.167173 | 329 | 7 | 105 | 47 | 0.711679 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.166667 | null | null | 0.166667 | 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 | 0 | 0 | 2 |
c0257f44699ae3206015a7b0ca29affe695eb06d | 475 | py | Python | example/forms.py | arturoless/django_rest | 281915d21d758a14162053c2242c4aae078c3d7f | [
"MIT"
] | null | null | null | example/forms.py | arturoless/django_rest | 281915d21d758a14162053c2242c4aae078c3d7f | [
"MIT"
] | 8 | 2019-11-23T20:23:53.000Z | 2021-09-08T01:00:04.000Z | example/forms.py | arturoless/django_rest | 281915d21d758a14162053c2242c4aae078c3d7f | [
"MIT"
] | 1 | 2019-05-28T01:57:07.000Z | 2019-05-28T01:57:07.000Z | from django import forms
from example.models import Person, Imagen,Career
class ImageUploadForm(forms.ModelForm):
class Meta:
model = Imagen
fields = ('model_pic1', 'model_pic2', 'model_pic3',)
class PersonUploadForm(forms.ModelForm):
class Meta:
model = Person
fields = ('name', 'lastname', 'age','address','career')
class CareerUploadForm(forms.ModelForm):
class Meta:
model = Career
fields = ('name', 'slug') | 31.666667 | 63 | 0.652632 | 51 | 475 | 6.019608 | 0.490196 | 0.136808 | 0.185668 | 0.224756 | 0.273616 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008152 | 0.225263 | 475 | 15 | 64 | 31.666667 | 0.826087 | 0 | 0 | 0.214286 | 0 | 0 | 0.138655 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c03e26d0371c91fb25d46e75b1bb7e2ef1c41394 | 297 | py | Python | date_assistant/__init__.py | jalvaradosegura/date_assistant | 79fa15a4172f2e58e3e3d429826f8c9d72bb010a | [
"MIT"
] | 1 | 2021-08-23T13:15:07.000Z | 2021-08-23T13:15:07.000Z | date_assistant/__init__.py | jalvaradosegura/date_assistant | 79fa15a4172f2e58e3e3d429826f8c9d72bb010a | [
"MIT"
] | null | null | null | date_assistant/__init__.py | jalvaradosegura/date_assistant | 79fa15a4172f2e58e3e3d429826f8c9d72bb010a | [
"MIT"
] | null | null | null | __version__ = "0.11.2"
from .classes import DateAssistant # noqa
from .utils import ( # noqa
cast_datetime_to_str,
cast_str_to_datetime,
get_days_diff_between,
get_months_diff_between,
get_months_started_between,
get_years_diff_between,
get_years_started_between,
)
| 22.846154 | 42 | 0.757576 | 41 | 297 | 4.878049 | 0.512195 | 0.2 | 0.21 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016461 | 0.181818 | 297 | 12 | 43 | 24.75 | 0.806584 | 0.030303 | 0 | 0 | 0 | 0 | 0.021053 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.181818 | 0 | 0.181818 | 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 | 0 | 0 | 0 | 0 | 2 |
c049b6259677e3bcb7d19ba4be943f6463e00134 | 928 | py | Python | app_idea_feed/models.py | achin1992/Achin92 | 4011ab6bf19b4855bf61e547fe895ac666fb328a | [
"MIT"
] | null | null | null | app_idea_feed/models.py | achin1992/Achin92 | 4011ab6bf19b4855bf61e547fe895ac666fb328a | [
"MIT"
] | 5 | 2021-03-19T11:35:57.000Z | 2022-02-10T10:46:08.000Z | app_idea_feed/models.py | achin1992/Achin92 | 4011ab6bf19b4855bf61e547fe895ac666fb328a | [
"MIT"
] | null | null | null | from django.db import models
from django.conf import settings
class IdeaFeedItem(models.Model):
"""To store idea submitted by application users"""
user_profile = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE
)
name = models.CharField(max_length=50, unique=True)
description = models.CharField(max_length=400)
theme = models.CharField(max_length=25, default="Data Science")
department = models.CharField(max_length=25, default="Finance")
rag_status = models.CharField(max_length=15, default="Green")
tags = models.CharField(max_length=150, default="#Innovation")
stage = models.CharField(max_length=20, default="Idea Initiation")
contributor = models.CharField(max_length=100, default="MentorA")
created_on = models.DateTimeField(auto_now_add=True)
def __str__(self):
"""Returns the model as string"""
return self.name | 40.347826 | 70 | 0.724138 | 117 | 928 | 5.57265 | 0.564103 | 0.184049 | 0.220859 | 0.294479 | 0.101227 | 0.101227 | 0 | 0 | 0 | 0 | 0 | 0.024548 | 0.165948 | 928 | 23 | 71 | 40.347826 | 0.817829 | 0.077586 | 0 | 0 | 0 | 0 | 0.067376 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0 | 0.111111 | 0 | 0.833333 | 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 | 0 | 0 | 0 | 0 | 2 |
c068e627ce9e264059711571c28cb9b39961483d | 314 | py | Python | custom/icds_reports/migrations/0083_ccs_record_monthly_pregnant_all.py | kkrampa/commcare-hq | d64d7cad98b240325ad669ccc7effb07721b4d44 | [
"BSD-3-Clause"
] | 1 | 2020-05-05T13:10:01.000Z | 2020-05-05T13:10:01.000Z | custom/icds_reports/migrations/0083_ccs_record_monthly_pregnant_all.py | kkrampa/commcare-hq | d64d7cad98b240325ad669ccc7effb07721b4d44 | [
"BSD-3-Clause"
] | 1 | 2019-12-09T14:00:14.000Z | 2019-12-09T14:00:14.000Z | custom/icds_reports/migrations/0083_ccs_record_monthly_pregnant_all.py | MaciejChoromanski/commcare-hq | fd7f65362d56d73b75a2c20d2afeabbc70876867 | [
"BSD-3-Clause"
] | 5 | 2015-11-30T13:12:45.000Z | 2019-07-01T19:27:07.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-12-20 15:40
from __future__ import absolute_import, unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('icds_reports', '0082_ccs_record_monthly_closed'),
]
operations = []
| 20.933333 | 59 | 0.703822 | 40 | 314 | 5.25 | 0.85 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.082031 | 0.184713 | 314 | 14 | 60 | 22.428571 | 0.738281 | 0.216561 | 0 | 0 | 1 | 0 | 0.17284 | 0.123457 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
fbe5ff533ff3f6273b34b535d274964445adb761 | 981 | py | Python | finalists/yc14600/PyTorch-Encoding/encoding/datasets/imagenet.py | lrzpellegrini/cvpr_clvision_challenge | cc783a9a4f80ab72062ef40368e4eed6b10c7bc9 | [
"CC-BY-4.0"
] | 2,190 | 2018-09-11T11:44:50.000Z | 2022-03-30T15:20:11.000Z | finalists/yc14600/PyTorch-Encoding/encoding/datasets/imagenet.py | lrzpellegrini/cvpr_clvision_challenge | cc783a9a4f80ab72062ef40368e4eed6b10c7bc9 | [
"CC-BY-4.0"
] | 374 | 2017-10-05T09:25:08.000Z | 2022-03-11T06:03:53.000Z | finalists/yc14600/PyTorch-Encoding/encoding/datasets/imagenet.py | lrzpellegrini/cvpr_clvision_challenge | cc783a9a4f80ab72062ef40368e4eed6b10c7bc9 | [
"CC-BY-4.0"
] | 531 | 2018-09-12T06:46:10.000Z | 2022-03-30T13:14:28.000Z | ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Created by: Hang Zhang
## Email: zhanghang0704@gmail.com
## Copyright (c) 2018
##
## This source code is licensed under the MIT-style license found in the
## LICENSE file in the root directory of this source tree
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import os
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import warnings
warnings.filterwarnings("ignore", "(Possibly )?corrupt EXIF data", UserWarning)
class ImageNetDataset(datasets.ImageFolder):
BASE_DIR = "ILSVRC2012"
def __init__(self, root=os.path.expanduser('~/.encoding/data'), transform=None,
target_transform=None, train=True, **kwargs):
split='train' if train == True else 'val'
root = os.path.join(root, self.BASE_DIR, split)
super(ImageNetDataset, self).__init__(
root, transform, target_transform)
| 39.24 | 83 | 0.605505 | 104 | 981 | 5.596154 | 0.634615 | 0.034364 | 0.034364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01444 | 0.152905 | 981 | 24 | 84 | 40.875 | 0.685921 | 0.350663 | 0 | 0 | 0 | 0 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.307692 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
fbefef6f34b757d6a86e4527f38a65dc57a3a618 | 2,297 | py | Python | games/Bowling Score Keeper.py | EnderBro1000/Scripts | 197871022d9285907180d99369c2fe35fa1ff726 | [
"MIT"
] | 2 | 2020-09-30T23:02:02.000Z | 2020-09-30T23:02:25.000Z | games/Bowling Score Keeper.py | EnderBro1000/PythonScripts | 197871022d9285907180d99369c2fe35fa1ff726 | [
"MIT"
] | 4 | 2020-09-30T22:23:42.000Z | 2020-10-01T16:45:11.000Z | games/Bowling Score Keeper.py | EnderBro1000/Scripts | 197871022d9285907180d99369c2fe35fa1ff726 | [
"MIT"
] | 1 | 2020-09-30T22:18:34.000Z | 2020-09-30T22:18:34.000Z | game = [[0, 0, 0, ' '], [0, 0, 0, ' '], [0, 0, 0, ' '], [0, 0, 0, ' '], [0, 0, 0, ' ']]
frame_counter = 0
# Ask score for frames
for frame in game:
if frame_counter < 4:
shot_number = 0
for shot in range(2):
game[frame_counter][shot_number] = int(input(f'Score for frame {frame_counter + 1}, shot {shot_number + 1}: '))
shot_number += 1
frame_counter += 1
if 0 > game[frame_counter][0] + game[frame_counter][0] > 10:
raise ValueError('values are too large or too small')
else:
for shot in range(game[frame_counter].count(0) - 1):
game[4][shot] = int(input(f'Score for frame 10, shot {shot + 1}: '))
if 0 > game[4][shot] > 10:
raise ValueError('Value is too large or too small')
if game[4][0] == 10 and game[4][1] == 10:
game[4] = ([10, 10, 20, 'X', 'X'], [0, 0, ' '])
game[4][1][0] = int(input('Score for frame 10, shot 3: '))
game[4][1][1] = game[4][1][0]
elif game[4][0] == 10:
game[4] = ([10, 10, 'X'], [game[4][1], 0, 0, ' '])
game[4][1][1] = int(input('Score for frame 10, shot 3: '))
elif game[4][0] + game[4][1] == 10:
game[4] = ([game[4][0], game[4][1], 10, '/'], [0, 0, ' '])
game[4][1][0] = int(input('Score for frame 10, shot 3: '))
game[4][1][1] = game[4][1][0]
frame_counter = 1
print(game)
game.reverse()
# Count and organize scores
for frame in game[1:]:
if frame[0] == 10 and frame[1] == 0:
game[frame_counter][2] = 10 + game[frame_counter - 1][0]
if game[frame_counter - 1][0] == 10 and frame_counter != 1:
game[frame_counter][2] += game[frame_counter - 2][0]
else:
game[frame_counter][2] += game[frame_counter - 1][1]
game[frame_counter][3] = 'X'
elif frame[0] + frame[1] == 10:
game[frame_counter][2] = 10 + game[frame_counter - 1][0]
game[frame_counter][3] = '/'
elif 0 < frame[0] + frame[1] < 10:
game[frame_counter][2] = frame[0] + frame[1]
game[frame_counter][3] = f'{frame[0] + frame[1]}'
elif frame[0] + frame[1] == 0:
game[frame_counter][2] = 0
game[frame_counter][3] = '0'
print(f'frame {4 - frame_counter} finished')
print(game)
frame_counter += 1
game.reverse()
print(game)
| 37.655738 | 123 | 0.533304 | 372 | 2,297 | 3.209677 | 0.112903 | 0.271357 | 0.268007 | 0.040201 | 0.549414 | 0.377722 | 0.325796 | 0.221106 | 0.197655 | 0.159967 | 0 | 0.098583 | 0.262516 | 2,297 | 60 | 124 | 38.283333 | 0.606257 | 0.020026 | 0 | 0.288462 | 0 | 0 | 0.140569 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.076923 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
fbf49cbe2c611c5942170c91561540bba3f96c12 | 973 | py | Python | mallerenga/twitter/status.py | pybcn/mallerenga | f3cab856b529a2b32d850800a03054e11e4615e6 | [
"MIT"
] | null | null | null | mallerenga/twitter/status.py | pybcn/mallerenga | f3cab856b529a2b32d850800a03054e11e4615e6 | [
"MIT"
] | 2 | 2018-10-17T09:05:55.000Z | 2019-03-14T16:40:39.000Z | mallerenga/twitter/status.py | pybcn/mallerenga | f3cab856b529a2b32d850800a03054e11e4615e6 | [
"MIT"
] | null | null | null | class Status(object):
"""This encapsulates the Twitter reply to a tweet."""
def __init__(self, status):
"""This initializes the object storing metadata."""
self._status = status
@property
def id(self):
return self._status.id
@property
def username(self):
"""This formats the username."""
return '@{}'.format(self._status.user.screen_name)
@property
def link(self):
"""This formats the URL to the link for the tweet."""
return 'https://twitter.com/{0.user.screen_name}/status/{0.id}'.format(
self._status,
)
@property
def text(self):
return self._status.text
@property
def time(self):
"""This provides access to creation time."""
return self._status.created_at
def __repr__(self):
"""This returns a representation of the status object."""
return '{0.time} {0.id} {0.username} {0.text}'.format(self)
| 27.027778 | 79 | 0.601233 | 120 | 973 | 4.733333 | 0.358333 | 0.123239 | 0.084507 | 0.070423 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008403 | 0.266187 | 973 | 35 | 80 | 27.8 | 0.787115 | 0.266187 | 0 | 0.227273 | 0 | 0 | 0.137628 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.318182 | false | 0 | 0 | 0.090909 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
220747c9459ced51b64d6f0da7778c611410c685 | 168 | py | Python | isPalindromeLinkedList.py | hazardinho/LeetcodeSolutions | 3f7fee882c1cdc83ecf7c9fd05d2a7f1afb130e6 | [
"MIT"
] | 1 | 2020-05-21T09:29:48.000Z | 2020-05-21T09:29:48.000Z | isPalindromeLinkedList.py | Ich1goSan/LeetcodeSolutions | 3f7fee882c1cdc83ecf7c9fd05d2a7f1afb130e6 | [
"MIT"
] | null | null | null | isPalindromeLinkedList.py | Ich1goSan/LeetcodeSolutions | 3f7fee882c1cdc83ecf7c9fd05d2a7f1afb130e6 | [
"MIT"
] | null | null | null | def isPalindromeLinkedList(self, head: ListNode) -> bool:
arr = []
while head:
arr.append(head.val)
head = head.next
return arr == arr[::-1] | 28 | 57 | 0.583333 | 20 | 168 | 4.9 | 0.65 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008197 | 0.27381 | 168 | 6 | 58 | 28 | 0.795082 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
220f0c5ffb55aa38874ce2abe20df38dc95f9ab5 | 424 | py | Python | polling_stations/apps/data_collection/management/commands/import_bassetlaw.py | chris48s/UK-Polling-Stations | 4742b527dae94f0276d35c80460837be743b7d17 | [
"BSD-3-Clause"
] | null | null | null | polling_stations/apps/data_collection/management/commands/import_bassetlaw.py | chris48s/UK-Polling-Stations | 4742b527dae94f0276d35c80460837be743b7d17 | [
"BSD-3-Clause"
] | null | null | null | polling_stations/apps/data_collection/management/commands/import_bassetlaw.py | chris48s/UK-Polling-Stations | 4742b527dae94f0276d35c80460837be743b7d17 | [
"BSD-3-Clause"
] | null | null | null | from data_collection.management.commands import BaseXpressDCCsvInconsistentPostcodesImporter
class Command(BaseXpressDCCsvInconsistentPostcodesImporter):
council_id = 'E07000171'
addresses_name = 'parl.2017-06-08/Version 1/Bassetlaw Democracy_Club__08June2017.tsv'
stations_name = 'parl.2017-06-08/Version 1/Bassetlaw Democracy_Club__08June2017.tsv'
elections = ['parl.2017-06-08']
csv_delimiter = '\t'
| 47.111111 | 92 | 0.801887 | 47 | 424 | 7 | 0.638298 | 0.072948 | 0.091185 | 0.109422 | 0.358663 | 0.358663 | 0.358663 | 0.358663 | 0.358663 | 0.358663 | 0 | 0.121693 | 0.108491 | 424 | 8 | 93 | 53 | 0.748677 | 0 | 0 | 0 | 0 | 0 | 0.372642 | 0.25 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 1.142857 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
2210b6bae6ef723cb20048d5c5563f2b2928305c | 693 | py | Python | test_xor.py | tuladhay/ERL-Project | 4be15db07c8c21ab59b849f63738326d7e60e407 | [
"MIT"
] | 1 | 2019-08-22T08:44:16.000Z | 2019-08-22T08:44:16.000Z | test_xor.py | tuladhay/ERL-Project | 4be15db07c8c21ab59b849f63738326d7e60e407 | [
"MIT"
] | null | null | null | test_xor.py | tuladhay/ERL-Project | 4be15db07c8c21ab59b849f63738326d7e60e407 | [
"MIT"
] | null | null | null | import random
class XOR:
def __init__(self):
self.states = [[1,1], [1,0], [0,1], [0,0]]
self.current_state = []
def step(self, action):
if (self.current_state == [1,1] or self.current_state == [0,0]) and action == 0:
reward = 1
elif (self.current_state == [1,0] or self.current_state == [0,1]) and action == 1:
reward = 1
else:
reward = 0
self.current_state = self._get_obs()
done = True
return self.current_state, reward, done
def _get_obs(self):
obs = random.choice(self.states)
return obs
def reset(self):
self.current_state = self._get_obs()
| 24.75 | 90 | 0.545455 | 95 | 693 | 3.789474 | 0.284211 | 0.244444 | 0.355556 | 0.094444 | 0.25 | 0.144444 | 0 | 0 | 0 | 0 | 0 | 0.044492 | 0.318903 | 693 | 27 | 91 | 25.666667 | 0.71822 | 0 | 0 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.05 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
222c6ffc5da97a6e6b99e6f97aeec53b30400631 | 570 | py | Python | netbox/netbox/admin.py | BrnoPCmaniak/netbox | 7b517abdb68a6324950dfd0375861163c7bfff00 | [
"Apache-2.0"
] | 1 | 2021-09-23T00:06:51.000Z | 2021-09-23T00:06:51.000Z | netbox/netbox/admin.py | BrnoPCmaniak/netbox | 7b517abdb68a6324950dfd0375861163c7bfff00 | [
"Apache-2.0"
] | 2 | 2021-06-08T21:05:10.000Z | 2021-09-08T01:46:58.000Z | netbox/netbox/admin.py | BrnoPCmaniak/netbox | 7b517abdb68a6324950dfd0375861163c7bfff00 | [
"Apache-2.0"
] | null | null | null | from django.conf import settings
from django.contrib.admin import AdminSite
from django.contrib.auth.admin import GroupAdmin, UserAdmin
from django.contrib.auth.models import Group, User
class NetBoxAdminSite(AdminSite):
"""
Custom admin site
"""
site_header = 'NetBox Administration'
site_title = 'NetBox'
site_url = '/{}'.format(settings.BASE_PATH)
index_template = 'django_rq/index.html'
admin_site = NetBoxAdminSite(name='admin')
# Register external models
admin_site.register(Group, GroupAdmin)
admin_site.register(User, UserAdmin)
| 25.909091 | 59 | 0.757895 | 70 | 570 | 6.042857 | 0.471429 | 0.094563 | 0.120567 | 0.099291 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.14386 | 570 | 21 | 60 | 27.142857 | 0.866803 | 0.075439 | 0 | 0 | 0 | 0 | 0.107632 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.75 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
22312be672a5db7e16e275ecaf72c418c6d29942 | 12,962 | py | Python | otter/util/retry.py | codebyravi/otter | d58077ba4af24a586ae0a0becaf6da96b716a597 | [
"Apache-2.0"
] | 20 | 2015-02-11T16:32:07.000Z | 2019-11-12T03:27:54.000Z | otter/util/retry.py | codebyravi/otter | d58077ba4af24a586ae0a0becaf6da96b716a597 | [
"Apache-2.0"
] | 1,145 | 2015-01-01T00:00:47.000Z | 2022-02-11T03:40:39.000Z | otter/util/retry.py | codebyravi/otter | d58077ba4af24a586ae0a0becaf6da96b716a597 | [
"Apache-2.0"
] | 29 | 2015-01-08T15:00:11.000Z | 2021-02-16T16:33:53.000Z | """
Module that provides retrying-at-a-particular-interval functionality.
"""
import random
from characteristic import Attribute, attributes
from effect import Delay, Effect, Func, sync_performer
from effect.retry import retry as effect_retry
from twisted.internet import defer
from twisted.python.failure import Failure
class _Retrier(object):
"""
Helper class used to implement and to store the state of retrying an
operation. To be called by :py:func:``retry``
:ivar callable do_work: function to be retried - should take no arguments
and can be either synchronous or return a deferred
:ivar callable can_retry: function that takes a failure and returns a
boolean representing whether or not the next attempt should be made, or
if all retries should be aborted. Should be synchronous.
:ivar callable next_interval: function that takes a failure and returns
the number of seconds until the next attempt as a float. Should be
synchronous.
:ivar Clock clock: clock to be used to retry - used for testing purposes
:ivar Deferred deferred: the :class:`Deferred` that will callback with
either the eventualy success of the possibly-retried ``do_work``
function or its failure, for whatever reason.
:ivar Deferred current_work: the :class:Deferred` corresponding to the
current work being done by ``do_work``. Needs to be cancelled if
``self.deferred`` is fired due to external reasons (e.g. it is
cancelled).
:ivar Deferred delayed_call: the :class:`IDelayedCall` corresponding to the
next scheduled call of ``do_work``. Needs to be cancelled if
``self.deferred`` is fired due to external reasons (e.g. it is
cancelled).
:ivar bool terminated: a boolean representing whether ``self.deferred`` has
been terminated early (likely due to cancellation of ``self.deferred``)
"""
def __init__(self, do_work, can_retry, next_interval, clock):
self.do_work = do_work
self.can_retry = can_retry
self.next_interval = next_interval
self.clock = clock
self.deferred = defer.Deferred(self.handle_cancellation)
self.current_work = None
self.delayed_call = None
self.cancelled = False
def clear_current_work(self, anything):
"""
To be used as a passthrough that also clears out the current work.
"""
self.current_work = None
return anything
def handle_failure(self, f):
"""
On a failure, either propagate the failure if it is terminal (and
canceling ``self.deferred`` is terminal, no matter what
``self.can_retry`` has to say about it), or schedule the next retry
of ``self.do_work``
"""
if self.cancelled:
return
if not self.can_retry(f):
return f
self.delayed_call = self.clock.callLater(self.next_interval(f),
self.do_real_work)
def handle_cancellation(self, _deferred):
"""
If ``self.deferred`` is cancelled, then the work already in progress
and scheduled needs to be cancelled.
"""
self.cancelled = True
if self.delayed_call is not None:
self.delayed_call.cancel()
if self.current_work is not None:
self.current_work.cancel()
def do_real_work(self):
"""
Actually do the work, then add the appropriate callbacks, store info,
etc. Note: this particular ordering of operations is important.
"""
self.delayed_call = None # because work will be called
# self.current_work might be set to None on the next line since the
# deferred returned by do_work may have already fired. So must be able
# to refer to it by some other name.
self.current_work = work_d = defer.maybeDeferred(self.do_work)
# work is done - no need to cancel operations
work_d.addBoth(self.clear_current_work)
# propagate the success
work_d.addCallback(self.deferred.callback)
# After this - only error cases. Figure out if it is terminal first.
# If so, propagate to self.deferred
work_d.addErrback(self.handle_failure)
work_d.addErrback(self.deferred.errback)
def start(self):
"""
Kick the whole thing off by calling ``do_real_work``, and return
``self.deferred``
"""
self.do_real_work()
return self.deferred
def transient_errors_except(*args):
"""
Returns a ``can_retry`` function for :py:func:retry` that ignores all
errors as transient except the ``Exception`` types specified.
:return: a function that accepts a :class:`Failure` and returns ``True``
only if the :class:`Failure` does not wrap an Exception passed in the
args. If no args are passed, all :class:`Exception`s are treated as
transient.
"""
def can_retry(f):
return not f.check(*args)
return can_retry
def terminal_errors_except(*args):
"""
Returns a ``can_retry`` function for :py:func:retry` that only retries if
errors the ``Exception`` types specified.
:return: a function that accepts a :class:`Failure` and returns ``True``
only if the :class:`Failure` wraps an Exception passed in the args.
If no args are passed, no :class:`Exception` is treated as transient.
"""
def can_retry(f):
return f.check(*args)
return can_retry
def retry_times(max_tries):
"""
Returns a ``can_retry`` function for :py:func:retry` that ignores all
errors and returns True until it has been called `max_tries` number of times
:return: a function that accepts a :class:`Failure` and returns ``True``
until it has been called ``max_tries`` times. Otherwise, returns ``False``
"""
return RetryTimes(max_retries=max_tries)
def compose_retries(*can_retry_funcs):
"""
Compose other can_retry functions into a single function that calls each
of the passed can_retry function in the sequence and returns True only if all
of them return True
:return: a function that accepts a :class:`Failure` and returns ``True``
only if all `can_retry_funcs` return True on that failure.
Otherwise, returns ``False``
"""
def can_retry(f):
for func in can_retry_funcs:
if not func(f):
return False
return True
return can_retry
def repeating_interval(interval):
"""
Returns a ``can_retry`` function for :py:func:retry` that returns the
specified interval all the time.
:return: a function that accepts a :class:`Failure` and returns ``interval``
"""
return lambda f: interval
def random_interval(minimum, maximum):
"""
Returns a ``can_retry`` function for :py:func:retry` that returns different
random interval between `minimum` and `maximum` each time it is called
:return: a function that accepts a :class:`Failure` and returns ``interval``
"""
return lambda f: random.uniform(minimum, maximum)
def exponential_backoff_interval(start=2):
"""
Returns a ``next_interval`` function for `:py:func:retry` that returns previous
interval * 2 as new interval each time it is called
:param start: number of seconds > 0 to start with
:return: a function that accepts a :class:`Failure` and returns ``interval``
"""
return ExponentialBackoffInterval(start=start)
def retry(do_work, can_retry=None, next_interval=None, clock=None):
"""
Retries the `do_work` function if it does not succeed and the ``can_retry``
callable returns ``True``. The next time the `do_work` function is retried
is dependent upon the return value of the function ``next_interval``, which
should return the number of seconds before the next attempt.
The ``can_retry`` function will only be called upon ``do_work`` error, and
should accept a failure and return a boolean.
:param callable do_work: function to be retried - should take no arguments
and can be either synchronous or return a deferred
:param callable can_retry: function that takes a failure and returns a
boolean representing whether or not the next attempt should be made, or
if all retries should be aborted. Should be synchronous. If None,
defaults to something that treats all errors as transient. Some
default functions that can be used are, for instance,
:func:`transient_errors_except`.
:param callable next_interval: function that takes a failure and returns
the number of seconds until the next attempt as a float. Should be
synchronous. If None, defaults to something that always returns a 5
second interval. Some default functions that can be used are, for
instance, :func:`repeating_interval`.
:return: a Deferred which fires with the result of the ``do_work``,
if successful, or the failure of the ``do_work``, if cannot be retried
"""
if can_retry is None:
can_retry = transient_errors_except()
if next_interval is None:
next_interval = repeating_interval(5)
if clock is None: # pragma: no cover
from twisted.internet import reactor
clock = reactor
retrier = _Retrier(do_work, can_retry, next_interval, clock)
return retrier.start()
class TransientRetryError(Exception):
"""
Exception that can be used to represent retry-able status in a
retry-function.
"""
# TODO: The following code should be moved to effect.retry if it proves out.
@attributes(['start', Attribute('last_interval', default_value=0)])
class ExponentialBackoffInterval(object):
"""
A callable that returns the previous interval * 2 (starting at
``start``) every time it's called.
:param start: number of seconds > 0 to start with
:return: a function that accepts a :class:`Failure` and returns ``interval``
"""
def __call__(self, failure):
"""Return an increasingly larger number."""
if self.last_interval != 0:
self.last_interval *= 2
else:
self.last_interval = self.start
return self.last_interval
@attributes(['max_retries', Attribute('tries', default_value=0)])
class RetryTimes(object):
"""
A callable that returns True until it's been called ``max_retries``.
:param max_retries: Number of times to return True.
"""
def __call__(self, failure):
"""Return True if this has been called <= ``max_retries``."""
self.tries += 1
return self.tries <= self.max_retries
@attributes(['can_retry', 'next_interval'])
class ShouldDelayAndRetry(object):
"""
A callable which can be passed as the should_retry argument to
:func:`effect.retry.retry`. Determines whether to retry and also causes
a delay before retrying.
:param can_retry: A callable of Failure -> Bool, indicating whether retry
should occur
:param next_interval: A callable of Failure -> interval to wait
"""
def __call__(self, exc_info):
"""
Determine whether retry should occur, based on the exception info.
"""
exc_type, exc_value, exc_traceback = exc_info
failure = Failure(exc_value, exc_type, exc_traceback)
def doit():
if self.can_retry(failure):
interval = self.next_interval(failure)
return Effect(Delay(interval)).on(lambda r: True)
else:
return False
return Effect(Func(doit))
@attributes(['effect', 'should_retry'])
class Retry(object):
"""
An effect intent that, when performed, executes another effect and
potentially retries it.
The main reason this class exists is to transparently represent the
retryable effect and its retry policy as public attributes, making it
easy to test that some effect should be retried, without actually running
a bunch of imperative code to test it's retried correctly.
:param effect: The effect to perform.
:param should_retry: The function to call to determine whether retry
should occur (usually an instance of :obj:`ShouldDelayAndRetry`).
"""
@sync_performer
def perform_retry(dispatcher, intent):
"""
Invoke :func:`effect.retry.retry` with the effect and the
should_retry function.
"""
return effect_retry(intent.effect, intent.should_retry)
def retry_effect(effect, can_retry, next_interval):
"""
Convenience function for wrapping an effect in a :obj:`Retry`.
:return: :obj:`Effect` of :obj:`Retry`.
"""
return Effect(Retry(
effect=effect,
should_retry=ShouldDelayAndRetry(can_retry=can_retry,
next_interval=next_interval)))
| 35.60989 | 83 | 0.67127 | 1,753 | 12,962 | 4.86081 | 0.180262 | 0.03286 | 0.023941 | 0.017838 | 0.311818 | 0.284122 | 0.28107 | 0.263584 | 0.255134 | 0.248328 | 0 | 0.001233 | 0.249344 | 12,962 | 363 | 84 | 35.707989 | 0.874512 | 0.590187 | 0 | 0.144144 | 0 | 0 | 0.016404 | 0 | 0 | 0 | 0 | 0.002755 | 0 | 1 | 0.207207 | false | 0 | 0.063063 | 0.018018 | 0.531532 | 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 | 0 | 1 | 0 | 0 | 2 |
2232ea6886c27de7bab89c6de8f0b2e730f6cf1e | 1,358 | py | Python | src/convert_transforms.py | Shuhei-YOSHIDA/tagslam | 1fa3bef064696b289fece0c98b92001b3fb84fae | [
"Apache-2.0"
] | 210 | 2018-04-04T12:34:02.000Z | 2022-03-24T03:49:46.000Z | src/convert_transforms.py | Shuhei-YOSHIDA/tagslam | 1fa3bef064696b289fece0c98b92001b3fb84fae | [
"Apache-2.0"
] | 27 | 2018-11-05T22:05:29.000Z | 2021-12-01T02:30:57.000Z | src/convert_transforms.py | Shuhei-YOSHIDA/tagslam | 1fa3bef064696b289fece0c98b92001b3fb84fae | [
"Apache-2.0"
] | 58 | 2018-04-30T02:43:33.000Z | 2022-01-28T16:48:55.000Z | import tf
import numpy as np
""" convert multicam_calib transforms to tagslam format:
example session:
ipython
import numpy as np
from convert_transforms import multicam_to_tagslam
%load_ext autoreload
%autoreload 2
# copy T_cn_cnm1 from multicam_calibration file:
T=np.array([[0.99995273841, 0.00284628684, 0.00929621430, -0.20032164920], [-0.00285007802, 0.99999586067, 0.00039459796, -0.00109630102], [-0.00929505268, -0.00042107425, 0.99995671141, 0.00092501568], [ 0.00000000000, 0.00000000000, 0.00000000000, 1.00000000000]])
rvec,tvec = multicam_to_tagslam(T)
"""
def mat_to_rvec_tvec(T):
angle, direc, point = tf.transformations.rotation_from_matrix(T)
return angle*direc, T[0:3,3]
def multicam_to_tagslam(tf_matrix_4x4_cn_cnm1):
T_w_c = np.linalg.inv(tf_matrix_4x4_cn_cnm1)
return mat_to_rvec_tvec(T_w_c)
def rvec_tvec_to_mat(rvec, tvec):
l = np.linalg.norm(rvec)
n = rvec/l if l > 1e-8 else np.array([1.0, 0.0, 0.0])
T = tf.transformations.rotation_matrix(l, n)
T[0:3, 3] = tvec
return T
def as_yaml(rvec, tvec):
print " position:"
print " x: %12.8f" % tvec[0]
print " y: %12.8f" % tvec[1]
print " z: %12.8f" % tvec[2]
print " rotation:"
print " x: %11.8f" % rvec[0]
print " y: %11.8f" % rvec[1]
print " z: %11.8f" % rvec[2]
| 32.333333 | 275 | 0.667894 | 218 | 1,358 | 3.990826 | 0.344037 | 0.055172 | 0.058621 | 0.034483 | 0.071264 | 0 | 0 | 0 | 0 | 0 | 0 | 0.218148 | 0.196613 | 1,358 | 41 | 276 | 33.121951 | 0.579285 | 0 | 0 | 0 | 0 | 0 | 0.147826 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.086957 | null | null | 0.347826 | 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 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
223762d10cd5cf7bc322d9bd249a91c93ae89ada | 1,806 | py | Python | chapter2/intogen-arrays/src/extdb/ensembl_gene.py | chris-zen/phd-thesis | 1eefdff8e7ca1910304e27ae42551dc64496b101 | [
"Unlicense"
] | 1 | 2015-12-22T00:53:18.000Z | 2015-12-22T00:53:18.000Z | chapter2/intogen-arrays/src/extdb/ensembl_gene.py | chris-zen/phd-thesis | 1eefdff8e7ca1910304e27ae42551dc64496b101 | [
"Unlicense"
] | null | null | null | chapter2/intogen-arrays/src/extdb/ensembl_gene.py | chris-zen/phd-thesis | 1eefdff8e7ca1910304e27ae42551dc64496b101 | [
"Unlicense"
] | null | null | null | #!/usr/bin/env python
"""
Get gene data from ensembl
* Configuration parameters:
- The ones required by intogen.data.entity.EntityManagerFactory
"""
from wok.task import Task
from biomart import BiomartService
# Initialization
task = Task()
@task.main()
def main():
conf = task.conf
log = task.logger()
query = """
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Query>
<Query virtualSchemaName = "default" formatter = "TSV" header = "0" uniqueRows = "1" count = "" datasetConfigVersion = "0.6" >
<Dataset name = "hsapiens_gene_ensembl" interface = "default" >
<Attribute name = "ensembl_gene_id" />
<Attribute name = "external_gene_id" />
<Attribute name = "description" />
<Attribute name = "chromosome_name" />
<Attribute name = "band" />
<Attribute name = "strand" />
<Attribute name = "start_position" />
<Attribute name = "end_position" />
<Attribute name = "gene_biotype" />
<Attribute name = "status" />
<Attribute name = "source" />
<Attribute name = "transcript_count" />
<Attribute name = "percentage_gc_content" />
</Dataset>
</Query>"""
bs = BiomartService(
conf["biomart.host"],
conf.get("biomart.port"),
conf.get("biomart.path"))
log.info("Connecting to biomart ...")
bs.connect()
#TODO path, local_path
log.info("Creating file {0} ...".format(path))
f = FileWriter(local_path)
f.write("\t".join(["gene_name", "gene_sym", "gene_desc", "gene_chr", "gene_band", "gene_strand",
"gene_pos_start", "gene_pos_end", "gene_biotype", "gene_status", "gene_source",
"gene_transcript_count", "gene_gc_content"]))
f.write("\n")
count = 0
for line in bs.query(query):
f.write(line)
if count % 10000:
log.debug("{0} rows".format(count))
count += 1
f.close()
bs.close()
task.start()
| 22.860759 | 129 | 0.65227 | 223 | 1,806 | 5.139013 | 0.443946 | 0.147469 | 0.026178 | 0.033159 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010774 | 0.177741 | 1,806 | 78 | 130 | 23.153846 | 0.760943 | 0.098007 | 0 | 0 | 0 | 0.020833 | 0.645241 | 0.041409 | 0 | 0 | 0 | 0.012821 | 0 | 1 | 0.020833 | false | 0 | 0.041667 | 0 | 0.0625 | 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 | 1 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
223b17b19adf21ac21fbf2d3f4731085b0d356ea | 401 | py | Python | src/dials/algorithms/profile_model/ellipsoid/__init__.py | dials-src/dials | 25055c1f6164dc33e672e7c5c6a9c5a35e870660 | [
"BSD-3-Clause"
] | 1 | 2021-12-10T17:28:16.000Z | 2021-12-10T17:28:16.000Z | src/dials/algorithms/profile_model/ellipsoid/__init__.py | dials-src/dials | 25055c1f6164dc33e672e7c5c6a9c5a35e870660 | [
"BSD-3-Clause"
] | null | null | null | src/dials/algorithms/profile_model/ellipsoid/__init__.py | dials-src/dials | 25055c1f6164dc33e672e7c5c6a9c5a35e870660 | [
"BSD-3-Clause"
] | 1 | 2021-12-07T12:39:04.000Z | 2021-12-07T12:39:04.000Z | from __future__ import annotations
from math import pi, sqrt
from dials.array_family import flex # noqa: F401;
from dials_algorithms_profile_model_ellipsoid_ext import * # noqa: F401, F403;
def mosaicity_from_eigen_decomposition(eigen_values):
return (
sqrt(eigen_values[0]) * 180.0 / pi,
sqrt(eigen_values[1]) * 180.0 / pi,
sqrt(eigen_values[2]) * 180.0 / pi,
)
| 26.733333 | 79 | 0.698254 | 57 | 401 | 4.614035 | 0.508772 | 0.1673 | 0.171103 | 0.076046 | 0.159696 | 0.159696 | 0 | 0 | 0 | 0 | 0 | 0.075235 | 0.204489 | 401 | 14 | 80 | 28.642857 | 0.749216 | 0.072319 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.4 | 0.1 | 0.6 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
223c332aba25c4ccff1108bd644d2fc2013c03b9 | 221 | py | Python | bpe_cn_en/add_special_token.py | Hzfinfdu/BBT_CPM | ee095727c714902fa6f8f5deebf1c30dc1956520 | [
"MIT"
] | 34 | 2021-06-23T14:34:04.000Z | 2022-03-13T08:32:44.000Z | bpe_cn_en/add_special_token.py | Hzfinfdu/BBT_CPM | ee095727c714902fa6f8f5deebf1c30dc1956520 | [
"MIT"
] | 35 | 2021-06-23T08:55:44.000Z | 2022-03-30T13:47:46.000Z | bpe_cn_en/add_special_token.py | Hzfinfdu/BBT_CPM | ee095727c714902fa6f8f5deebf1c30dc1956520 | [
"MIT"
] | 10 | 2021-06-22T07:47:51.000Z | 2022-03-18T03:56:58.000Z | with open("vocab_origin.txt", "r") as f:
lines = f.readlines()
for i in range(185):
lines.append("<s_{}>".format(i))
with open("vocab.txt", "w") as f:
for line in lines:
f.write(line.strip() + "\n")
| 22.1 | 40 | 0.570136 | 37 | 221 | 3.351351 | 0.621622 | 0.129032 | 0.209677 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017241 | 0.21267 | 221 | 9 | 41 | 24.555556 | 0.695402 | 0 | 0 | 0 | 0 | 0 | 0.158371 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
2240c0a2ae9581efe6a30c6c882e04255348ba1a | 1,368 | py | Python | project_1_1/train.py | tillaczel/Deep-Learning-in-Computer-Vision | 792e90a3ad5bafdb30e0267226c2c75b8afd01e3 | [
"MIT"
] | null | null | null | project_1_1/train.py | tillaczel/Deep-Learning-in-Computer-Vision | 792e90a3ad5bafdb30e0267226c2c75b8afd01e3 | [
"MIT"
] | null | null | null | project_1_1/train.py | tillaczel/Deep-Learning-in-Computer-Vision | 792e90a3ad5bafdb30e0267226c2c75b8afd01e3 | [
"MIT"
] | 1 | 2021-06-08T09:28:01.000Z | 2021-06-08T09:28:01.000Z | import sys
import os
sys.path.append('git_repo')
sys.path.append(os.path.split(os.getcwd())[0])
import hydra
import wandb
from omegaconf import DictConfig, OmegaConf
from project_1_1.src.data import get_data, download_data
from project_1_1.src.engine import EngineModule
from project_1_1.src.trainer import get_trainer
from project_1_1.src.utils import print_class_dist
wandb.init(project='p1', entity='dlcv')
@hydra.main(config_path='config', config_name="default")
def run_training(cfg: DictConfig):
print(OmegaConf.to_yaml(cfg))
cfg_file = os.path.join(wandb.run.dir, 'train_config.yaml')
with open(cfg_file, 'w') as fh:
fh.write(OmegaConf.to_yaml(cfg))
wandb.save(cfg_file) # this will force sync it
download_data(cfg.data.path)
train_dataloader, test_dataloader = get_data(cfg.data.size, cfg.data.train_augmentation, cfg.training.batch_size,
base_path=cfg.data.path)
print_class_dist(train_dataloader, title='Train set'), print_class_dist(test_dataloader, title='Test set')
engine = EngineModule(cfg)
wandb.save('*.ckpt') # should keep it up to date
trainer = get_trainer(cfg, engine)
trainer.fit(engine, train_dataloader=train_dataloader, val_dataloaders=test_dataloader)
# TODO: visualizations
if __name__ == '__main__':
run_training()
| 30.4 | 117 | 0.72807 | 200 | 1,368 | 4.73 | 0.385 | 0.046512 | 0.05074 | 0.054968 | 0.067653 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008726 | 0.162281 | 1,368 | 44 | 118 | 31.090909 | 0.816754 | 0.05117 | 0 | 0 | 0 | 0 | 0.058824 | 0 | 0 | 0 | 0 | 0.022727 | 0 | 1 | 0.034483 | false | 0 | 0.310345 | 0 | 0.344828 | 0.103448 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
22538f26c66894437b479b39d588b512ae9cb82e | 1,713 | py | Python | test_cashdesk.py | sslavov93/CashDesk-Problem | 6ee3c450c0d23ba9cc255ae3781c0a29d42fc32b | [
"Apache-2.0"
] | null | null | null | test_cashdesk.py | sslavov93/CashDesk-Problem | 6ee3c450c0d23ba9cc255ae3781c0a29d42fc32b | [
"Apache-2.0"
] | null | null | null | test_cashdesk.py | sslavov93/CashDesk-Problem | 6ee3c450c0d23ba9cc255ae3781c0a29d42fc32b | [
"Apache-2.0"
] | null | null | null | import unittest
from cash_desk import CashDesk
class TestCashDesk(unittest.TestCase):
def setUp(self):
self.kasa = CashDesk()
self.kasa.scan('Sandwich')
def test_init(self):
self.assertEqual(
self.kasa.discounts,
{'Sandwich': [3, 2], 'Cucumber': [2, 1], 'Apple': [4, 3]})
self.assertEqual(
self.kasa.meal_deals,
[(['Sandwich', 'Coke', 'Apple'], 3.0, [1, 1, 1]),
(['Soup', 'Noodles', 'Custard'], 6.50, [1, 2, 1])])
def test_scan_with_present_item(self):
self.kasa.scan('Sandwich')
self.assertEqual(self.kasa.scanned_items, {'Sandwich': 2})
def test_scan_with_new_valid_item(self):
self.kasa.scan('Apple')
self.assertEqual(self.kasa.scanned_items,
{'Sandwich': 1, 'Apple': 1})
def test_scan_with_new_invalid_item(self):
self.kasa.scan('asd')
self.assertEqual(self.kasa.scanned_items, {'Sandwich': 1})
def test_total_method(self):
result = self.kasa.total()
self.assertEqual(result, 0)
def test_calculate_meal_with_missing_item(self):
self.kasa.scanned_items = {'Apple': 2}
self.kasa.calculate_meal_deals()
self.assertEqual(self.kasa.total_price, 0)
def test_calculate_discounts(self):
self.kasa.scanned_items = {'Soup': 2}
self.kasa.calculate_discounts()
self.assertEqual(self.kasa.total_price, 0)
def test_calculate_all(self):
result = self.kasa.calculate_all()
self.assertEqual(result, 2.50)
def test_cashout(self):
self.assertEqual(self.kasa.total_price, 0)
if __name__ == "__main__":
unittest.main()
| 30.589286 | 70 | 0.615879 | 214 | 1,713 | 4.700935 | 0.252336 | 0.151093 | 0.151093 | 0.182903 | 0.454274 | 0.263419 | 0.263419 | 0.186879 | 0.099404 | 0.099404 | 0 | 0.023112 | 0.242265 | 1,713 | 55 | 71 | 31.145455 | 0.751926 | 0 | 0 | 0.166667 | 0 | 0 | 0.073555 | 0 | 0 | 0 | 0 | 0 | 0.238095 | 1 | 0.238095 | false | 0 | 0.047619 | 0 | 0.309524 | 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 | 0 | 0 | 0 | 0 | 2 |
225ab2df1e0628560959d1bcb76e1b4446fcadcc | 409 | py | Python | snippets/popular_libraries/click-lib/cliparameters/counting.py | melvio/python3-examples | 5340fe17e0a5001a81cf195e63f825b77dc16fca | [
"Apache-2.0"
] | null | null | null | snippets/popular_libraries/click-lib/cliparameters/counting.py | melvio/python3-examples | 5340fe17e0a5001a81cf195e63f825b77dc16fca | [
"Apache-2.0"
] | null | null | null | snippets/popular_libraries/click-lib/cliparameters/counting.py | melvio/python3-examples | 5340fe17e0a5001a81cf195e63f825b77dc16fca | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
import click
@click.command()
@click.option("--count", default=1)
@click.option("--name")
def hello_cli(count, name):
for _ in range(count):
click.echo(f"Hello {name}!")
if __name__ == "__main__":
hello_cli()
# $ ./counting.py
# Hello None!
# $ ./counting.py --name="melvin"
# Hello melvin!
#$ ./counting.py --count=2 --name="melvin"
# Hello melvin!
# Hello melvin!
| 18.590909 | 42 | 0.633252 | 55 | 409 | 4.509091 | 0.490909 | 0.120968 | 0.205645 | 0.169355 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008721 | 0.158924 | 409 | 21 | 43 | 19.47619 | 0.712209 | 0.400978 | 0 | 0 | 0 | 0 | 0.14346 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.111111 | 0 | 0.222222 | 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 | 0 | 0 | 0 | 0 | 2 |
22691ec61ce87887672fd39de1c86b10f169cf48 | 711 | py | Python | camkes/visualCAmkES/View/__init__.py | aisamanra/camkes-tool | 4bcf3f22ef7e73f8755ca1b5e7165dd6a23e89f3 | [
"BSD-2-Clause"
] | null | null | null | camkes/visualCAmkES/View/__init__.py | aisamanra/camkes-tool | 4bcf3f22ef7e73f8755ca1b5e7165dd6a23e89f3 | [
"BSD-2-Clause"
] | null | null | null | camkes/visualCAmkES/View/__init__.py | aisamanra/camkes-tool | 4bcf3f22ef7e73f8755ca1b5e7165dd6a23e89f3 | [
"BSD-2-Clause"
] | null | null | null | #
# Copyright 2017, Data61
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# This software may be distributed and modified according to the terms of
# the BSD 2-Clause license. Note that NO WARRANTY is provided.
# See "LICENSE_BSD2.txt" for details.
#
# @TAG(DATA61_BSD)
# The View python module
# This is where most of the gui work is done.
# GraphWidget deals with the placement of all nodes and edge, and deals with overarching mouse events.
# Instance_Widget deals with drawing and managing of each node (which represents an instance in camkes).
# Connection_Widget deals with the drawing and managing of each edge (which represents a connection in camkes).
| 39.5 | 111 | 0.777778 | 110 | 711 | 4.990909 | 0.663636 | 0.065574 | 0.043716 | 0.07286 | 0.087432 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035533 | 0.168776 | 711 | 17 | 112 | 41.823529 | 0.893401 | 0.953587 | 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 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
226950eb05d782901ec424349ec63921ab902b76 | 508 | py | Python | parsifal/utils/test.py | ShivamPytho/parsifal | 9386a0fb328d4880d052c94e9224ce50a9b2f6a6 | [
"MIT"
] | 342 | 2015-01-14T17:25:35.000Z | 2022-02-26T11:59:09.000Z | parsifal/utils/test.py | ShivamPytho/parsifal | 9386a0fb328d4880d052c94e9224ce50a9b2f6a6 | [
"MIT"
] | 56 | 2015-01-23T12:57:59.000Z | 2022-03-12T01:01:38.000Z | parsifal/utils/test.py | ShivamPytho/parsifal | 9386a0fb328d4880d052c94e9224ce50a9b2f6a6 | [
"MIT"
] | 200 | 2015-01-22T21:50:41.000Z | 2021-12-28T13:42:57.000Z | from django.conf import settings
from django.shortcuts import resolve_url
from django.utils.http import urlencode
def login_redirect_url(url):
"""
Utility function to be used as the "expected_url" param of the
test case assertRedirects.
:param url: Model instance, url pattern, url
:return: String in the format "/login/?next=%2Fabout%2F"
"""
login_url = resolve_url(settings.LOGIN_URL)
next_url = urlencode({"next": resolve_url(url)})
return f"{login_url}?{next_url}"
| 29.882353 | 66 | 0.720472 | 73 | 508 | 4.863014 | 0.520548 | 0.084507 | 0.067606 | 0.084507 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004796 | 0.179134 | 508 | 16 | 67 | 31.75 | 0.846523 | 0.377953 | 0 | 0 | 0 | 0 | 0.090278 | 0.076389 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.428571 | 0 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
2278f4664f293e2092ce87d2c47b7250a8441b82 | 1,535 | py | Python | scripts/cmap.py | max-simon/master-thesis | b0db01008d52317bc036f8a0f20671ce49108a12 | [
"CC-BY-4.0"
] | 4 | 2021-01-03T06:57:47.000Z | 2022-02-05T15:31:44.000Z | scripts/cmap.py | max-simon/master-thesis | b0db01008d52317bc036f8a0f20671ce49108a12 | [
"CC-BY-4.0"
] | null | null | null | scripts/cmap.py | max-simon/master-thesis | b0db01008d52317bc036f8a0f20671ce49108a12 | [
"CC-BY-4.0"
] | 2 | 2021-03-20T18:39:39.000Z | 2022-01-17T12:55:28.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Max Simon
# Year: 2020
from matplotlib import colors
from matplotlib.cm import get_cmap
import numpy as np
# colormap like (Gruber, 2011)
COLORS_DIFF = [
'#F8E14C',
'#FFA63D',
'#FF6637',
'#FF7D83',
'#FFFFFF',
'#4262B3',
'#2F62B4',
'#3F96D2',
'#5BD2E2'
]
# colormap like (Gruber, 2011)
COLORS_W2G = [
'#FFFFFF',
'#7D90CA',
'#274BA7',
'#512795',
'#FF351A',
'#FF712A',
'#F8E754',
'#79C651',
'#2EAC61'
]
# colormap like (Gruber, 2011)
COLORS_G2R = [
'#1F4F25',
'#359842',
'#5DBF49',
'#B6D550',
'#FF8027',
'#E5401C',
'#5E1010'
]
# create colormaps for matplotlib
DIFF = colors.LinearSegmentedColormap.from_list('diff', COLORS_DIFF)
DIFF_r = colors.LinearSegmentedColormap.from_list('diff', COLORS_DIFF[::-1])
DIFF.set_bad('gray')
DIFF_r.set_bad('gray')
W2G = colors.LinearSegmentedColormap.from_list('w2g', COLORS_W2G)
W2G_r = colors.LinearSegmentedColormap.from_list('w2g_r', COLORS_W2G[::-1])
W2G.set_bad('gray')
W2G_r.set_bad('gray')
G2R = colors.LinearSegmentedColormap.from_list('g2r', COLORS_G2R)
G2R_r = colors.LinearSegmentedColormap.from_list('g2r_r', COLORS_G2R[::-1])
G2R.set_bad('gray')
G2R_r.set_bad('gray')
def get_step_cmap(cmap, num_values):
# create a colormap with steps instead of continous colors
mycmap = get_cmap(cmap, num_values)
new_colors = mycmap(np.linspace(0, 1, num_values))
return colors.ListedColormap(new_colors, 'stepwise')
| 21.928571 | 76 | 0.662541 | 193 | 1,535 | 5.072539 | 0.414508 | 0.177732 | 0.202247 | 0.226762 | 0.356486 | 0.104188 | 0.104188 | 0 | 0 | 0 | 0 | 0.102282 | 0.171987 | 1,535 | 69 | 77 | 22.246377 | 0.667978 | 0.161564 | 0 | 0.04 | 0 | 0 | 0.180751 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.02 | false | 0 | 0.06 | 0 | 0.1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
97e97ffce1928472533b712640788c9dfe850241 | 1,257 | py | Python | migrations/versions/b1abd6e837d2_meeting_support_invite_add_agendaitem.py | louking/members | ee204211812e00945f9e2b09cfa130cc9d3e6558 | [
"Apache-2.0"
] | 1 | 2020-12-07T02:52:01.000Z | 2020-12-07T02:52:01.000Z | migrations/versions/b1abd6e837d2_meeting_support_invite_add_agendaitem.py | louking/members | ee204211812e00945f9e2b09cfa130cc9d3e6558 | [
"Apache-2.0"
] | 496 | 2020-02-12T15:48:26.000Z | 2022-03-23T11:17:27.000Z | migrations/versions/b1abd6e837d2_meeting_support_invite_add_agendaitem.py | louking/members | ee204211812e00945f9e2b09cfa130cc9d3e6558 | [
"Apache-2.0"
] | null | null | null | """meeting support - invite: add agendaitem
Revision ID: b1abd6e837d2
Revises: 4e95ae391320
Create Date: 2020-06-17 06:20:33.637533
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b1abd6e837d2'
down_revision = '4e95ae391320'
branch_labels = None
depends_on = None
def upgrade(engine_name):
globals()["upgrade_%s" % engine_name]()
def downgrade(engine_name):
globals()["downgrade_%s" % engine_name]()
def upgrade_():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('invite', sa.Column('agendaitem_id', sa.Integer(), nullable=True))
op.create_foreign_key(None, 'invite', 'agendaitem', ['agendaitem_id'], ['id'])
# ### end Alembic commands ###
def downgrade_():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'invite', type_='foreignkey')
op.drop_column('invite', 'agendaitem_id')
# ### end Alembic commands ###
def upgrade_users():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade_users():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
| 22.854545 | 84 | 0.673031 | 148 | 1,257 | 5.567568 | 0.398649 | 0.054612 | 0.101942 | 0.11165 | 0.355583 | 0.274272 | 0.274272 | 0.274272 | 0.167476 | 0.167476 | 0 | 0.048591 | 0.181384 | 1,257 | 54 | 85 | 23.277778 | 0.752187 | 0.378679 | 0 | 0.1 | 0 | 0 | 0.183217 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0.1 | 0.1 | 0 | 0.4 | 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 | 0 | 0 | 0 | 2 |
97eb068e3b56a2721bae8b3d960ae96d868aea8a | 924 | py | Python | cs/lambda_cs/05_hash_tables_and_blockchain/Hash-Tables/notes/longest_linked_list_chain.py | tobias-fyi/vela | b0b3d3c6dc3fa397c8c7a492098a02cf75e0ff82 | [
"MIT"
] | null | null | null | cs/lambda_cs/05_hash_tables_and_blockchain/Hash-Tables/notes/longest_linked_list_chain.py | tobias-fyi/vela | b0b3d3c6dc3fa397c8c7a492098a02cf75e0ff82 | [
"MIT"
] | 8 | 2020-03-24T17:47:23.000Z | 2022-03-12T00:33:21.000Z | cs/lambda_cs/05_hash_tables_and_blockchain/Hash-Tables/notes/longest_linked_list_chain.py | tobias-fyi/vela | b0b3d3c6dc3fa397c8c7a492098a02cf75e0ff82 | [
"MIT"
] | null | null | null | def longest_linked_list_chain(keys, buckets, loops=10):
"""
Rolls `keys` number of random keys into `buckets` buckets
and counts the collisions.
Run `loops` number of times.
"""
for i in range(loops):
key_counts = {}
for i in range(buckets):
key_counts[i] = 0
for i in range(keys):
random_key = str(random.random())
hash_index = hash(random_key) % buckets
key_counts[hash_index] += 1
largest_n = 0
for key in key_counts:
if key_counts[key] > largest_n:
largest_n = key_counts[key]
print(
f"Longest Linked List Chain for {keys} keys in {buckets} buckets (Load Factor: {keys/buckets:.2f}): {largest_n}"
)
longest_linked_list_chain(4, 16, 5)
longest_linked_list_chain(16, 16, 5)
longest_linked_list_chain(32, 16, 5)
longest_linked_list_chain(1024, 128, 5)
| 31.862069 | 124 | 0.611472 | 130 | 924 | 4.123077 | 0.338462 | 0.145522 | 0.190299 | 0.246269 | 0.139925 | 0.139925 | 0 | 0 | 0 | 0 | 0 | 0.042553 | 0.287879 | 924 | 28 | 125 | 33 | 0.772036 | 0.123377 | 0 | 0 | 0 | 0.05 | 0.138677 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.05 | false | 0 | 0 | 0 | 0.05 | 0.05 | 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 | 0 | 0 | 2 |
3f050542323346257ee09070e7737a2e1e33e8fd | 748 | py | Python | OOP_Inclass/OO_fraction.py | HelloYeew/helloyeew-computer-programming-i | cf8315bdc4b8e20ba410e0745778595805f51afb | [
"MIT"
] | null | null | null | OOP_Inclass/OO_fraction.py | HelloYeew/helloyeew-computer-programming-i | cf8315bdc4b8e20ba410e0745778595805f51afb | [
"MIT"
] | null | null | null | OOP_Inclass/OO_fraction.py | HelloYeew/helloyeew-computer-programming-i | cf8315bdc4b8e20ba410e0745778595805f51afb | [
"MIT"
] | 1 | 2020-12-07T10:05:44.000Z | 2020-12-07T10:05:44.000Z | import math
class Fraction:
def __init__(self, num, den):
self.num = num
self.den = den
def reduce(self):
"""Returns a reduced form of this fraction
"""
เ
gcd = math.gcd(self.num, self.den)
def add(self, m):
"""Returns a new fraction in reduced form that results from adding this fraction with the m fraction
"""
pass
def subtract(self, m):
"""Returns a new fraction in reduced form that results from subtracting this fraction with the m fraction
"""
pass
def multiply(self, n):
"""Returns a new fraction in reduced form that results from multiplying this fraction with the n fraction
"""
pass
| 25.793103 | 113 | 0.592246 | 99 | 748 | 4.434343 | 0.343434 | 0.072893 | 0.075171 | 0.129841 | 0.503417 | 0.503417 | 0.503417 | 0.503417 | 0.343964 | 0.343964 | 0 | 0 | 0.332888 | 748 | 28 | 114 | 26.714286 | 0.87976 | 0 | 0 | 0.214286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.214286 | 0.071429 | null | null | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
3f18c316e6a1caca6917799421b1a3f1a0536718 | 3,202 | py | Python | emqxlwm2m/oma/location_6.py | Penlect/emqxlwm2m | 9fcd13c1b794eb64b1e8244841a20827432665bf | [
"MIT"
] | 2 | 2020-10-22T17:37:42.000Z | 2021-08-04T08:34:36.000Z | emqxlwm2m/oma/location_6.py | Penlect/emqxlwm2m | 9fcd13c1b794eb64b1e8244841a20827432665bf | [
"MIT"
] | null | null | null | emqxlwm2m/oma/location_6.py | Penlect/emqxlwm2m | 9fcd13c1b794eb64b1e8244841a20827432665bf | [
"MIT"
] | null | null | null | """Generated by emqxlwm2m.codegen at 2020-11-22 12:13:49
LwM2M Object: Location
ID: 6, URN: urn:oma:lwm2m:oma:6, Optional, Single
"""
from emqxlwm2m.lwm2m import *
class Latitude(Resource):
"""Latitude 0 - Float, Single, Mandatory
The decimal notation of latitude, e.g., -43.5723 [World Geodetic
System 1984].
"""
rid = 0
operations = R
type = "float"
range = "N/A"
unit = "Deg"
mandatory = True
multiple = False
class Longitude(Resource):
"""Longitude 1 - Float, Single, Mandatory
The decimal notation of longitude, e.g., 153.21760 [World Geodetic
System 1984].
"""
rid = 1
operations = R
type = "float"
range = "N/A"
unit = "Deg"
mandatory = True
multiple = False
class Altitude(Resource):
"""Altitude 2 - Float, Single, Optional
The decimal notation of altitude in meters above sea level.
"""
rid = 2
operations = R
type = "float"
range = "N/A"
unit = "m"
mandatory = False
multiple = False
class Radius(Resource):
"""Radius 3 - Float, Single, Optional
The value in the Radius Resource indicates the size in meters of a
circular area around a point of geometry.
"""
rid = 3
operations = R
type = "float"
range = "N/A"
unit = "m"
mandatory = False
multiple = False
class Velocity(Resource):
"""Velocity 4 - Opaque, Single, Optional
The velocity in the LwM2M Client is defined in [3GPP-TS_23.032].
"""
rid = 4
operations = R
type = "opaque"
range = "N/A"
unit = "N/A"
mandatory = False
multiple = False
class Timestamp(Resource):
"""Timestamp 5 - Time, Single, Mandatory
The timestamp of when the location measurement was performed.
"""
rid = 5
operations = R
type = "time"
range = "N/A"
unit = "N/A"
mandatory = True
multiple = False
class Speed(Resource):
"""Speed 6 - Float, Single, Optional
Speed is the time rate of change in position of a LwM2M Client
without regard for direction: the scalar component of velocity.
"""
rid = 6
operations = R
type = "float"
range = "N/A"
unit = "Meters per second"
mandatory = False
multiple = False
class Location(ObjectDef):
"""Location Object 6 - Optional, Single
This LwM2M Objects provide a range of device related information
which can be queried by the LwM2M Server, and a device reboot and
factory reset function.
"""
oid = 6
mandatory = False
multiple = False
# ID=0, Float, R, Single, Mandatory, range: N/A, unit: Deg
latitude = Latitude()
# ID=1, Float, R, Single, Mandatory, range: N/A, unit: Deg
longitude = Longitude()
# ID=2, Float, R, Single, Optional, range: N/A, unit: m
altitude = Altitude()
# ID=3, Float, R, Single, Optional, range: N/A, unit: m
radius = Radius()
# ID=4, Opaque, R, Single, Optional, range: N/A, unit: N/A
velocity = Velocity()
# ID=5, Time, R, Single, Mandatory, range: N/A, unit: N/A
timestamp = Timestamp()
# ID=6, Float, R, Single, Optional, range: N/A, unit: Meters per second
speed = Speed()
| 21.205298 | 75 | 0.613679 | 428 | 3,202 | 4.588785 | 0.28271 | 0.01833 | 0.049898 | 0.078411 | 0.404277 | 0.338595 | 0.336558 | 0.231161 | 0.199593 | 0.131365 | 0 | 0.032829 | 0.277014 | 3,202 | 150 | 76 | 21.346667 | 0.815551 | 0.49188 | 0 | 0.602941 | 1 | 0 | 0.058863 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.014706 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
3f20cb5748f4b7a8ee396e202a20638b83f6aaa1 | 533 | py | Python | NFproject/articles/migrations/0016_auto_20180228_1615.py | JoinCODED/NationalFundCommunity | 6dfd8a700950b0174284127d993acff99e37acde | [
"MIT"
] | null | null | null | NFproject/articles/migrations/0016_auto_20180228_1615.py | JoinCODED/NationalFundCommunity | 6dfd8a700950b0174284127d993acff99e37acde | [
"MIT"
] | 92 | 2018-02-19T09:57:53.000Z | 2022-03-11T23:19:45.000Z | NFproject/articles/migrations/0016_auto_20180228_1615.py | JoinCODED/NationalFundCommunity | 6dfd8a700950b0174284127d993acff99e37acde | [
"MIT"
] | 2 | 2019-09-08T09:04:10.000Z | 2019-12-18T11:17:14.000Z | # Generated by Django 2.0.2 on 2018-02-28 13:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0015_auto_20180228_1400'),
]
operations = [
migrations.AlterField(
model_name='article',
name='slug',
field=models.SlugField(blank=True),
),
migrations.AlterField(
model_name='category',
name='slug',
field=models.SlugField(blank=True),
),
]
| 22.208333 | 48 | 0.56848 | 53 | 533 | 5.622642 | 0.660377 | 0.134228 | 0.167785 | 0.194631 | 0.248322 | 0.248322 | 0.248322 | 0 | 0 | 0 | 0 | 0.084932 | 0.315197 | 533 | 23 | 49 | 23.173913 | 0.731507 | 0.084428 | 0 | 0.470588 | 1 | 0 | 0.111111 | 0.047325 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.235294 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3f21b92e67f4c3fbff4dce551dc7ef3f67833e9b | 311 | py | Python | server/src/tests/samples/typeAlias3.py | jhutchings1/pyright | 2b8593a58a2aecc95dac49cce92fc16678cd4e14 | [
"MIT"
] | 1 | 2020-12-28T16:58:24.000Z | 2020-12-28T16:58:24.000Z | server/src/tests/samples/typeAlias3.py | jhutchings1/pyright | 2b8593a58a2aecc95dac49cce92fc16678cd4e14 | [
"MIT"
] | 3 | 2022-03-03T03:03:24.000Z | 2022-03-25T14:43:54.000Z | server/src/tests/samples/typeAlias3.py | jhutchings1/pyright | 2b8593a58a2aecc95dac49cce92fc16678cd4e14 | [
"MIT"
] | null | null | null | # This sample tests that type aliases can consist of
# partially-specialized classes that can be further
# specialized.
# pyright: strict
from typing import Tuple, Optional, TypeVar
T = TypeVar('T')
ValidationResult = Tuple[bool, Optional[T]]
def foo() -> ValidationResult[str]:
return False, 'valid'
| 19.4375 | 52 | 0.736334 | 40 | 311 | 5.725 | 0.775 | 0.069869 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.167203 | 311 | 15 | 53 | 20.733333 | 0.88417 | 0.414791 | 0 | 0 | 0 | 0 | 0.034091 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0.2 | 0.6 | 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 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
3f229ee25655282cf1bedbb29c93c0e8a72be7c8 | 1,904 | py | Python | reproman/formats/trig.py | kyleam/niceman | f4f026d2827e03dce272c7c2d1c6fc11a6abc3b5 | [
"MIT"
] | 13 | 2017-03-02T16:33:08.000Z | 2019-01-12T19:19:08.000Z | reproman/formats/trig.py | kyleam/niceman | f4f026d2827e03dce272c7c2d1c6fc11a6abc3b5 | [
"MIT"
] | 313 | 2017-01-13T03:36:30.000Z | 2019-01-24T19:16:08.000Z | reproman/formats/trig.py | kyleam/niceman | f4f026d2827e03dce272c7c2d1c6fc11a6abc3b5 | [
"MIT"
] | 6 | 2017-01-12T19:44:01.000Z | 2019-01-12T19:19:18.000Z | # ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the reproman package for the
# copyright and license terms.
#
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
"""
Plugin support for TriG formatted RDF provenance files.
See: https://en.wikipedia.org/wiki/TriG_(syntax)
"""
from reproman.formats.base import Provenance
from rdflib import ConjunctiveGraph
class TrigProvenance(Provenance):
@classmethod
def _load(cls, source):
graph = ConjunctiveGraph()
graph.parse(source, format='trig')
return graph
# def get_os(self):
# return 'Ubuntu'
#
# def get_os_version(self):
# return '12.04'
#
# def get_create_date(self):
# return '20091004T111800Z'
#
# def get_environment_vars(self):
#
# results = self.graph.query(
# """SELECT DISTINCT ?variable ?value
# WHERE {
# ?x nipype:environmentVariable ?variable .
# ?x prov:value ?value .
# }""")
#
# return results
def get_packages(self):
results = self._src.query(
"""SELECT DISTINCT ?command ?version
WHERE {
?x nipype:command ?full_command .
bind( strbefore( $full_command, " " ) as ?command ) .
?x nipype:version ?version .
}""")
return results
def get_distributions(self):
# needs to use get_packages and see what is in there --
# we might need to come up with a "source_distribution" which
# would just define packages based on their names without clear
# definition on how they were obtained
raise NotImplementedError()
def get_files(self, limit='all'):
raise NotImplementedError('TODO') | 28.848485 | 79 | 0.551996 | 195 | 1,904 | 5.302564 | 0.594872 | 0.040619 | 0.015474 | 0.03675 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015695 | 0.297269 | 1,904 | 66 | 80 | 28.848485 | 0.7571 | 0.456408 | 0 | 0 | 0 | 0 | 0.016743 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0 | 0.5625 | 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 | 0 | 1 | 0 | 0 | 2 |
3f2c0a148af31ad4fd132eb0419fa6c28e6e26b2 | 178 | py | Python | two2ten.py | zlyfer/RandomPythonScripts | 203c965ddbf27e1772b0a8886fd4d986e186ca4b | [
"MIT"
] | null | null | null | two2ten.py | zlyfer/RandomPythonScripts | 203c965ddbf27e1772b0a8886fd4d986e186ca4b | [
"MIT"
] | null | null | null | two2ten.py | zlyfer/RandomPythonScripts | 203c965ddbf27e1772b0a8886fd4d986e186ca4b | [
"MIT"
] | null | null | null | decimal = int(input("Decimal: "))
binary = ""
while decimal != 0:
rest = decimal % 2
binary = str(rest) + binary
decimal = decimal // 2
print ("Binary: %s" % binary) | 25.428571 | 33 | 0.589888 | 22 | 178 | 4.772727 | 0.5 | 0.152381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022222 | 0.241573 | 178 | 7 | 34 | 25.428571 | 0.755556 | 0 | 0 | 0 | 0 | 0 | 0.111732 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 0 | 0 | 0 | 0 | 0 | 2 |
3f2ed9d830bd28aa79d88a76b996194149802157 | 3,145 | py | Python | exceptionsLibrary.py | ChamiLamelas1/Music_Tab_Project | af36c8a2e721336b5f95afcfc79297321fb70714 | [
"MIT"
] | null | null | null | exceptionsLibrary.py | ChamiLamelas1/Music_Tab_Project | af36c8a2e721336b5f95afcfc79297321fb70714 | [
"MIT"
] | null | null | null | exceptionsLibrary.py | ChamiLamelas1/Music_Tab_Project | af36c8a2e721336b5f95afcfc79297321fb70714 | [
"MIT"
] | null | null | null | """
This file provides a library of music exception types that are used throughout the project to better report errors to the user.
Exception Types:
TabException - general exception type for the project used to report general errors in the tab that cannot be reported more specifically
MeasureException - caused by the construction of a Measure whose length is not <= 1
TabFileException - error caused by incorrect input tab file
TabIOException - error caused by file reading/writing in tab program.
TabConfigurationException - exception caused by incorrect program configuration file
StaffException - caused by illegal StaffString object construction
StaffOutOfBoundsException - caused by accessing a StaffString index that is out of bounds
LoggingException - caused by failure of logging operations.
Some of these exceptions are used in try-except clauses that handle a more generic Python exception (e.g. ValueError, IOError) and then raise one of these exception types
to better inform the user.
author: Chami Lamelas
date: Summer 2019
"""
UNIDENTIFIED_LINE_IN_FILE = -1 # for exceptions that report a file line no. as part of the error, use this to report that line couldn't be found
class TabException(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return str(self.msg)
class MeasureException(TabException):
def __init__(self, op, reason):
super().__init__("Operation on Measure failed: {0}. Reason: {1}.".format(op, reason))
class TabFileException(TabException):
def __init__(self, issue = "unknown", reason="unknown", line=UNIDENTIFIED_LINE_IN_FILE):
self.issue = issue
self.reason = reason
self.line = line
errorMsg = "Issue with the tab file: \"{0}\". Reason: {1}.".format(issue, reason)
if line != UNIDENTIFIED_LINE_IN_FILE:
errorMsg += " Approximate line number: {0}.".format(line)
super().__init__(errorMsg)
class TabIOException(TabException):
def __init__(self, issue, reason):
super().__init__("I/O Error with \"{0}\". Reason: {1}.".format(issue, reason))
class TabConfigurationException(TabException):
def __init__(self, reason="not specified", line=UNIDENTIFIED_LINE_IN_FILE):
errorMsg = "Program configuration failed. Reason: {0}.".format(reason)
if line != UNIDENTIFIED_LINE_IN_FILE:
errorMsg += " Approximate line number: {0}.".format(line)
errorMsg += " To reset the config. file, you can redownload it from the repository."
super().__init__(errorMsg)
class StaffException(TabException):
def __init__(self, op, reason, str):
super().__init__("Staff operation cannot be performed: \"{0}\", Reason: {1}. str={2}".format(op, reason, str))
class StaffOutOfBoundsException(TabException):
def __init__(self, reason, viol):
super().__init__("Bounds Violation, reason: {0} ({1})".format(reason, viol))
class LoggingException(Exception):
def __init__(self, op, reason):
self.msg = "Log operation \"{0}\" failed. Reason: {1}".format(op, reason)
def __str__(self):
return str(self.msg)
| 45.57971 | 170 | 0.716375 | 407 | 3,145 | 5.341523 | 0.334152 | 0.025759 | 0.040478 | 0.063477 | 0.24885 | 0.156394 | 0.091996 | 0.068077 | 0.068077 | 0.068077 | 0 | 0.008574 | 0.184102 | 3,145 | 68 | 171 | 46.25 | 0.838659 | 0.366296 | 0 | 0.307692 | 0 | 0 | 0.224181 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25641 | false | 0 | 0 | 0.051282 | 0.512821 | 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 | 0 | 1 | 0 | 0 | 2 |
3f31504732632daf3238c766c9130f18804a6806 | 1,490 | py | Python | automatminer/utils/tests/test_ml.py | kmu/automatminer | f39894a157dcc35a6fe94b1f747c1f06ffea9824 | [
"BSD-3-Clause-LBNL"
] | 1 | 2019-05-16T20:34:54.000Z | 2019-05-16T20:34:54.000Z | automatminer/utils/tests/test_ml.py | kmu/automatminer | f39894a157dcc35a6fe94b1f747c1f06ffea9824 | [
"BSD-3-Clause-LBNL"
] | null | null | null | automatminer/utils/tests/test_ml.py | kmu/automatminer | f39894a157dcc35a6fe94b1f747c1f06ffea9824 | [
"BSD-3-Clause-LBNL"
] | null | null | null | """
Tests for machine learning related utils.
"""
import unittest
import pandas as pd
from automatminer.utils.ml import is_greater_better, \
regression_or_classification, AMM_CLF_NAME, AMM_REG_NAME
class TestMLTools(unittest.TestCase):
def test_is_greater_better(self):
self.assertTrue(is_greater_better('accuracy'))
self.assertTrue(is_greater_better('r2_score'))
self.assertTrue(is_greater_better('neg_mean_squared_error'))
self.assertFalse(is_greater_better('mean_squared_error'))
def test_regression_or_classification(self):
s = pd.Series(data=["4", "5", "6"])
self.assertTrue(regression_or_classification(s) == AMM_REG_NAME)
s = pd.Series(data=[1, 2, 3])
self.assertTrue(regression_or_classification(s) == AMM_REG_NAME)
s = pd.Series(data=["a", "b", "c"])
self.assertTrue(regression_or_classification(s) == AMM_CLF_NAME)
s = pd.Series(data=["a1", "b", "c"])
self.assertTrue(regression_or_classification(s) == AMM_CLF_NAME)
# binary classification
s = pd.Series(data=[0, 1, 0, 0, 1])
self.assertTrue(regression_or_classification(s) == AMM_CLF_NAME)
s = pd.Series(data=[0.0, 1.0, 0.0, 0.0, 1.0])
self.assertTrue(regression_or_classification(s) == AMM_CLF_NAME)
s = pd.Series(data=[0, 1, 0, 0, 2])
self.assertTrue(regression_or_classification(s) == AMM_REG_NAME)
if __name__ == "__main__":
unittest.main()
| 31.702128 | 72 | 0.673826 | 205 | 1,490 | 4.585366 | 0.273171 | 0.148936 | 0.248936 | 0.096809 | 0.569149 | 0.476596 | 0.476596 | 0.476596 | 0.455319 | 0.401064 | 0 | 0.023237 | 0.191275 | 1,490 | 46 | 73 | 32.391304 | 0.756846 | 0.042953 | 0 | 0.259259 | 0 | 0 | 0.052186 | 0.015515 | 0 | 0 | 0 | 0 | 0.407407 | 1 | 0.074074 | false | 0 | 0.111111 | 0 | 0.222222 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3f42084abcfb0dceea841793ca65646d0c64f9a5 | 381 | py | Python | wal_e/worker/gs/__init__.py | paalkr/wal-e | ff6102a1d19cf0f683c7232f618dbe8d14e6e017 | [
"BSD-3-Clause"
] | 2,739 | 2015-01-05T03:57:02.000Z | 2022-03-22T10:51:38.000Z | wal_e/worker/gs/__init__.py | 0xgpapad/wal-e | f5b3e790fe10daa098b8cbf01d836c4885dc13c7 | [
"BSD-3-Clause"
] | 264 | 2015-01-13T01:07:19.000Z | 2022-02-08T00:56:14.000Z | wal_e/worker/gs/__init__.py | 0xgpapad/wal-e | f5b3e790fe10daa098b8cbf01d836c4885dc13c7 | [
"BSD-3-Clause"
] | 245 | 2015-01-11T15:13:42.000Z | 2022-02-10T10:58:09.000Z | from wal_e.worker.gs.gs_deleter import Deleter
from wal_e.worker.gs.gs_worker import BackupFetcher
from wal_e.worker.gs.gs_worker import BackupList
from wal_e.worker.gs.gs_worker import DeleteFromContext
from wal_e.worker.gs.gs_worker import TarPartitionLister
__all__ = [
'Deleter',
'TarPartitionLister',
'BackupFetcher',
'BackupList',
'DeleteFromContext',
]
| 27.214286 | 56 | 0.782152 | 51 | 381 | 5.568627 | 0.235294 | 0.123239 | 0.140845 | 0.246479 | 0.485915 | 0.485915 | 0.422535 | 0.422535 | 0 | 0 | 0 | 0 | 0.131234 | 381 | 13 | 57 | 29.307692 | 0.858006 | 0 | 0 | 0 | 0 | 0 | 0.170604 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.416667 | 0 | 0.416667 | 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 | 1 | 0 | 0 | 0 | 0 | 2 |
3f6214019a5922236fa43b4d44f666ceb7626208 | 936 | py | Python | Project Pattern/pattern_23.py | AMARTYA2020/nppy | 7f750534bb5faa4e661447ca132077de0ce0a0ed | [
"MIT"
] | 4 | 2020-12-07T10:15:08.000Z | 2021-11-17T11:21:07.000Z | Project Pattern/pattern_23.py | AMARTYA2020/nppy | 7f750534bb5faa4e661447ca132077de0ce0a0ed | [
"MIT"
] | null | null | null | Project Pattern/pattern_23.py | AMARTYA2020/nppy | 7f750534bb5faa4e661447ca132077de0ce0a0ed | [
"MIT"
] | 1 | 2021-02-17T07:53:13.000Z | 2021-02-17T07:53:13.000Z | class Pattern_Twenty_Three:
'''Pattern twenty_three
ooooooooooooooooo
ooooooooooooooooo
ooooooooooooooooo
oooo
oooo
oooo
ooooooooooooooooo
ooooooooooooooooo
ooooooooooooooooo
oooo
oooo
oooo
ooooooooooooooooo
ooooooooooooooooo
ooooooooooooooooo
'''
def __init__(self, strings='o'):
if not isinstance(strings, str):
strings = str(strings)
for i in range(15):
if i == 0:
print(f' {strings * 17}')
elif i in [3, 4, 5]:
print(f'{strings * 4}')
elif i in [9, 10, 11]:
print(f'{(strings * 4).rjust(17)}')
elif i in [1, 2, 6, 7, 8, 12, 13, 14]:
print(f'{strings * 17}')
if __name__ == '__main__':
Pattern_Twenty_Three()
| 22.829268 | 51 | 0.476496 | 90 | 936 | 4.766667 | 0.466667 | 0.475524 | 0.121212 | 0.25641 | 0.412587 | 0.412587 | 0.412587 | 0.412587 | 0.412587 | 0 | 0 | 0.056285 | 0.430556 | 936 | 40 | 52 | 23.4 | 0.748593 | 0.270299 | 0 | 0.133333 | 0 | 0 | 0.137681 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0 | 0 | 0 | 0.133333 | 0.266667 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
58ae62eb7e508b677c4cbec3efd67a2a1fd77082 | 336 | py | Python | src/test_lambdata_witt.py | RowenWitt/lambdata_1 | 9acd03887786ecafa8e2129f8ca3a936fd442e3b | [
"MIT"
] | null | null | null | src/test_lambdata_witt.py | RowenWitt/lambdata_1 | 9acd03887786ecafa8e2129f8ca3a936fd442e3b | [
"MIT"
] | null | null | null | src/test_lambdata_witt.py | RowenWitt/lambdata_1 | 9acd03887786ecafa8e2129f8ca3a936fd442e3b | [
"MIT"
] | null | null | null | from random import randint
import pytest
from lambdata_witt import helper_functions as hf
import pandas as pd
import numpy as np
def test_NullCounter():
"""Testing null counter function"""
test_df_nulls = pd.DataFrame(np.nan, index=[0,1,2,3,4,5], columns=['One','Two'])
assert hf.NullCount.NullCounter(test_df_nulls) == 12 | 33.6 | 84 | 0.744048 | 54 | 336 | 4.5 | 0.722222 | 0.049383 | 0.090535 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027778 | 0.142857 | 336 | 10 | 85 | 33.6 | 0.815972 | 0.08631 | 0 | 0 | 0 | 0 | 0.019868 | 0 | 0 | 0 | 0 | 0 | 0.125 | 1 | 0.125 | false | 0 | 0.625 | 0 | 0.75 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
58b14401df8b21f4464ee41aa4c106f047cd3052 | 281 | py | Python | harvester/ext/importer/base.py | opendatatrentino/opendata-harvester | 7cdff57e02cad22e35c4b19d15df7bbec730cc47 | [
"BSD-2-Clause"
] | 1 | 2021-04-05T16:39:29.000Z | 2021-04-05T16:39:29.000Z | harvester/ext/importer/base.py | opendatatrentino/opendata-harvester | 7cdff57e02cad22e35c4b19d15df7bbec730cc47 | [
"BSD-2-Clause"
] | null | null | null | harvester/ext/importer/base.py | opendatatrentino/opendata-harvester | 7cdff57e02cad22e35c4b19d15df7bbec730cc47 | [
"BSD-2-Clause"
] | 1 | 2015-01-14T16:58:46.000Z | 2015-01-14T16:58:46.000Z | import abc
from ..base import PluginBase
class ImporterPluginBase(PluginBase):
__metaclass__ = abc.ABCMeta
def __init__(self, url, conf=None):
self.url = url
self.conf = conf or {}
@abc.abstractmethod
def sync_data(self, storage):
pass
| 17.5625 | 39 | 0.651246 | 33 | 281 | 5.272727 | 0.636364 | 0.08046 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.259786 | 281 | 15 | 40 | 18.733333 | 0.836538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.1 | 0.3 | 0 | 0.7 | 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 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
58bb65dbf1392f552f538ec951f1f1d2a7798179 | 320 | py | Python | aria2.py | GerGitHub/ncmd | 921337c954e68eba3fee38a344b87d4a83068c9d | [
"MIT"
] | 1 | 2020-11-09T09:21:40.000Z | 2020-11-09T09:21:40.000Z | aria2.py | GerGitHub/ncmd | 921337c954e68eba3fee38a344b87d4a83068c9d | [
"MIT"
] | null | null | null | aria2.py | GerGitHub/ncmd | 921337c954e68eba3fee38a344b87d4a83068c9d | [
"MIT"
] | null | null | null | import xmlrpc.client as rpc
import time
import json
s = rpc.ServerProxy('http://localhost:6888/rpc')
gid = s.aria2.addUri([r'https://dl.softmgr.qq.com/original/im/QQ9.3.8.27381.exe'])
for i in range(100):
time.sleep(1)
print(s.aria2.tellStatus(gid, ['completedLength','totalLength','downloadSpeed']))
# json. | 35.555556 | 85 | 0.709375 | 50 | 320 | 4.54 | 0.8 | 0.052863 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.062937 | 0.10625 | 320 | 9 | 86 | 35.555556 | 0.730769 | 0.015625 | 0 | 0 | 0 | 0.125 | 0.378981 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.375 | 0.125 | 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 | 0 | 0 | 0 | 2 |
58dd4ee0253105c341d69098902aabc9acd8c128 | 899 | py | Python | stanovanja/home/migrations/0036_auto_20210817_1350.py | danesjenovdan/najemniski-sos | aa68fc31d748b9e032bf52d8d9e7fda865aa9506 | [
"Unlicense"
] | null | null | null | stanovanja/home/migrations/0036_auto_20210817_1350.py | danesjenovdan/najemniski-sos | aa68fc31d748b9e032bf52d8d9e7fda865aa9506 | [
"Unlicense"
] | null | null | null | stanovanja/home/migrations/0036_auto_20210817_1350.py | danesjenovdan/najemniski-sos | aa68fc31d748b9e032bf52d8d9e7fda865aa9506 | [
"Unlicense"
] | null | null | null | # Generated by Django 3.2.6 on 2021-08-17 11:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0035_auto_20210817_0846'),
]
operations = [
migrations.AlterField(
model_name='rentalstory',
name='icon',
field=models.CharField(blank=True, max_length=9, null=True, verbose_name='Ikona'),
),
migrations.AlterField(
model_name='rentalstory',
name='lat',
field=models.DecimalField(blank=True, decimal_places=7, max_digits=10, null=True, verbose_name='Zemljepisna širina'),
),
migrations.AlterField(
model_name='rentalstory',
name='lng',
field=models.DecimalField(blank=True, decimal_places=7, max_digits=10, null=True, verbose_name='Zemljepisna dolžina'),
),
]
| 31 | 130 | 0.615128 | 97 | 899 | 5.556701 | 0.536082 | 0.111317 | 0.139147 | 0.16141 | 0.567718 | 0.567718 | 0.32282 | 0.32282 | 0.32282 | 0.32282 | 0 | 0.057489 | 0.264739 | 899 | 28 | 131 | 32.107143 | 0.757943 | 0.050056 | 0 | 0.409091 | 1 | 0 | 0.131455 | 0.026995 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
58deb14ac5a0401010eb3443f9c5e4580b39bf28 | 285 | py | Python | tests/gamestonk_terminal/cryptocurrency/defi/test_defipulse_model.py | minhhoang1023/GamestonkTerminal | 195dc19b491052df080178c0cc6a9d535a91a704 | [
"MIT"
] | 1 | 2022-03-15T13:05:40.000Z | 2022-03-15T13:05:40.000Z | tests/gamestonk_terminal/cryptocurrency/defi/test_defipulse_model.py | minhhoang1023/GamestonkTerminal | 195dc19b491052df080178c0cc6a9d535a91a704 | [
"MIT"
] | null | null | null | tests/gamestonk_terminal/cryptocurrency/defi/test_defipulse_model.py | minhhoang1023/GamestonkTerminal | 195dc19b491052df080178c0cc6a9d535a91a704 | [
"MIT"
] | null | null | null | # IMPORTATION STANDARD
# IMPORTATION THIRDPARTY
import pytest
# IMPORTATION INTERNAL
from gamestonk_terminal.cryptocurrency.defi import defipulse_model
@pytest.mark.vcr
def test_get_defipulse_index(recorder):
df = defipulse_model.get_defipulse_index()
recorder.capture(df)
| 20.357143 | 66 | 0.817544 | 34 | 285 | 6.617647 | 0.647059 | 0.124444 | 0.151111 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.119298 | 285 | 13 | 67 | 21.923077 | 0.896414 | 0.224561 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 2 |
58ebad875e58d288e5481e418ea382446daa3eda | 395 | py | Python | models.py | roti17/atleast | 006eef0f92f09ec05c4e4cc00de662d8ee8edaf5 | [
"MIT"
] | null | null | null | models.py | roti17/atleast | 006eef0f92f09ec05c4e4cc00de662d8ee8edaf5 | [
"MIT"
] | null | null | null | models.py | roti17/atleast | 006eef0f92f09ec05c4e4cc00de662d8ee8edaf5 | [
"MIT"
] | null | null | null | from sqlalchemy import Column, Integer, String, Boolean, Float
from sqlalchemy.orm import declarative_base
Base = declarative_base()
class Movie(Base):
__tablename__ = 'movies'
id = Column(Integer, primary_key = True)
pic_link = Column(String)
director = Column(String)
movie_name = Column(String)
release_year = Column(String)
price = Column(Float)
description=Column(String)
| 26.333333 | 62 | 0.75443 | 49 | 395 | 5.877551 | 0.55102 | 0.208333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.151899 | 395 | 14 | 63 | 28.214286 | 0.859701 | 0 | 0 | 0 | 0 | 0 | 0.01519 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.916667 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
58f8cf0c74c7176ca5148b906e7d0bfd8da2ff08 | 3,559 | py | Python | apps/site/api/views/__init__.py | LocalGround/localground | aa5a956afe7a84a7763a3b23d62a9fd925831cd7 | [
"Apache-2.0"
] | 9 | 2015-05-29T22:22:20.000Z | 2022-02-01T20:39:00.000Z | apps/site/api/views/__init__.py | LocalGround/localground | aa5a956afe7a84a7763a3b23d62a9fd925831cd7 | [
"Apache-2.0"
] | 143 | 2015-01-22T15:03:40.000Z | 2020-06-27T01:55:29.000Z | apps/site/api/views/__init__.py | LocalGround/localground | aa5a956afe7a84a7763a3b23d62a9fd925831cd7 | [
"Apache-2.0"
] | 5 | 2015-03-16T20:51:49.000Z | 2017-02-07T20:48:49.000Z | from localground.apps.site.api.views.audio_views import \
AudioList, AudioInstance
from localground.apps.site.api.views.icon_views import IconList, IconInstance
from localground.apps.site.api.views.video_views import \
VideoList, VideoInstance
from localground.apps.site.api.views.mapimage_views import \
MapImageList, MapImageInstance
from localground.apps.site.api.views.mapimage_overlay_views import \
MapImageOverlayList, MapImageOverlayInstance
from localground.apps.site.api.views.photo_views import (
PhotoList, PhotoInstance, rotate_left, rotate_right
)
from localground.apps.site.api.views.print_views import \
PrintList, PrintInstance, LayoutViewSet
from localground.apps.site.api.views.project_views import \
ProjectList, ProjectInstance
from localground.apps.site.api.views.sharing_views import \
SharingList, SharingInstance
from localground.apps.site.api.views.layer_views import \
LayerList, LayerInstance
from localground.apps.site.api.views.map_views import \
MapList, MapInstance, MapInstanceSlug
from localground.apps.site.api.views.record_views \
import RecordList, RecordInstance
from localground.apps.site.api.views.association_views import (
RelatedMediaList, RelatedMediaInstance
)
from localground.apps.site.api.views.ebays_views import TrackList
from localground.apps.site.api.views.field_views import \
FieldList, FieldInstance
from localground.apps.site.api.views.dataset_views import \
DatasetList, DatasetInstance
from localground.apps.site.api.views.tile_views import \
TileSetList, TileSetInstance
from localground.apps.site.api.views.admin_views import (
OverlaySourceViewSet, UserViewSet, GroupViewSet, DataTypeViewSet,
ListUsernames
)
from localground.apps.site.api.views.tags_views import TagList
from localground.apps.site.api.views.user_profile_views import \
UserProfileList, UserProfileInstance
from rest_framework.decorators import api_view
from collections import OrderedDict
from rest_framework.response import Response
from rest_framework.reverse import reverse
@api_view(('GET',))
def api_root(request, format=None, **kwargs):
d = {}
d['audio'] = reverse('audio-list', request=request, format=format)
d['datasets'] = reverse('dataset-list', request=request, format=format)
d['groups'] = reverse('group-list', request=request, format=format)
d['icons'] = reverse('icon-list', request=request, format=format)
d['layouts'] = reverse('layout-list', request=request, format=format)
d['data-types'] = reverse('datatype-list', request=request, format=format)
d['map-images'] = reverse('mapimage-list', request=request, format=format)
d['overlay-sources'] = reverse('overlaysource-list',
request=request,
format=format)
d['photos'] = reverse('photo-list', request=request, format=format)
d['videos'] = reverse('video-list', request=request, format=format)
d['prints'] = reverse('print-list', request=request, format=format)
d['projects'] = reverse('project-list', request=request, format=format)
d['maps'] = reverse('map-list', request=request, format=format)
d['tags'] = reverse('tag-list', request=request, format=format)
d['tiles'] = reverse('tileset-list', request=request, format=format)
d['users'] = reverse('user-list', request=request, format=format)
d['userprofiles'] = reverse(
'userprofile-list', request=request, format=format)
return Response(OrderedDict(sorted(d.items())))
| 45.628205 | 78 | 0.750492 | 425 | 3,559 | 6.214118 | 0.275294 | 0.113593 | 0.143885 | 0.174176 | 0.439985 | 0.428626 | 0.029534 | 0 | 0 | 0 | 0 | 0 | 0.132341 | 3,559 | 77 | 79 | 46.220779 | 0.855246 | 0 | 0 | 0 | 0 | 0 | 0.088789 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.014493 | false | 0 | 0.347826 | 0 | 0.376812 | 0.028986 | 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 | 1 | 0 | 0 | 0 | 0 | 2 |
58faf8fbbf00b71958c459254b5a87fc88eed3f4 | 2,706 | py | Python | pythonradex/helpers.py | gica3618/pythonradex | 4821537b85f41451cd0c2f26017df78658d2b728 | [
"MIT"
] | 5 | 2020-01-15T02:36:32.000Z | 2021-11-16T17:25:57.000Z | pythonradex/helpers.py | gica3618/pythonradex | 4821537b85f41451cd0c2f26017df78658d2b728 | [
"MIT"
] | null | null | null | pythonradex/helpers.py | gica3618/pythonradex | 4821537b85f41451cd0c2f26017df78658d2b728 | [
"MIT"
] | 1 | 2021-06-18T11:53:34.000Z | 2021-06-18T11:53:34.000Z | # -*- coding: utf-8 -*-
import numpy as np
from scipy import constants
def B21(A21,nu):
'''Returns the Einstein B21 coefficient for stimulated emission, computed
from the Einstein A21 coefficient and the frequency nu.'''
return constants.c**2/(2*constants.h*nu**3)*A21
def B12(A21,nu,g1,g2):
'''Einstein B12 coefficient for absorption, computed from the Einstein A21
coefficient, the frequency nu, statistical weights g2 and g1 of upper and
lower level respectively.'''
return g2/g1*B21(A21=A21,nu=nu)
def B_nu(nu,T):
"""Planck function
Return the value of the Planck function (black body) in [W/m2/Hz/sr].
Parameters
----------
nu : float or numpy.ndarray
frequency in Hz
T : float or numpy.ndarray
temperature in K
Returns
-------
numpy.ndarray
Value of Planck function in [W/m2/Hz/sr]
"""
T = np.array(T)
return (2*constants.h*nu**3/constants.c**2
*(np.exp(constants.h*nu/(constants.k*T))-1)**-1)
def generate_CMB_background(z=0):
'''generates a function that gives the CMB background at redshift z
Parameters
-----------
z: float
redshift
Returns
--------
function
function giving CMB background in [W/m2/Hz/sr] for an input frequency in [Hz]
'''
T_CMB = 2.73*(1+z)
def CMB_background(nu):
return B_nu(nu=nu,T=T_CMB)
return CMB_background
def zero_background(nu):
'''Zero intensity radiation field
Returns zero intensity for any frequency
Parameters
------------
nu: array_like
frequency in Hz
Returns
---------------
numpy.ndarray
Zero at all requested frequencies'''
return np.zeros_like(nu)
def FWHM2sigma(FWHM):
"""Convert FWHM of a Gaussian to standard deviation.
Parameters
-----------
FWHM: float or numpy.ndarray
FWHM of the Gaussian
Returns
------------
float or numpy.ndarray
the standard deviation of the Gaussian"""
return FWHM/(2*np.sqrt(2*np.log(2)))
def relative_difference(a,b):
"""Computes the elementwise relative difference between a and b.
In general, return |a-b|/a.
Special cases:
a=0 and b=0: return 0
a=0 and b!=0: return 1"""
abs_diff = np.abs(a-b)
with np.errstate(invalid='ignore',divide='ignore'):
rel_diff = np.where((a==0) & (b==0),0,np.where(a==0,1,abs_diff/a))
assert not np.any(np.isnan(rel_diff))
return np.abs(rel_diff)
def Delta_nu(Delta_v,nu0):
'''Computes the frequency interval from a given velocity interval
Delta_v at frequency nu0'''
return nu0 * Delta_v / constants.c | 26.529412 | 85 | 0.619364 | 394 | 2,706 | 4.200508 | 0.307107 | 0.043505 | 0.029003 | 0.045921 | 0.093656 | 0.060423 | 0 | 0 | 0 | 0 | 0 | 0.031957 | 0.248337 | 2,706 | 102 | 86 | 26.529412 | 0.781711 | 0.552106 | 0 | 0 | 0 | 0 | 0.012565 | 0 | 0 | 0 | 0 | 0 | 0.037037 | 1 | 0.333333 | false | 0 | 0.074074 | 0.037037 | 0.740741 | 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 | 0 | 1 | 0 | 0 | 2 |
58fd13bd244dea00c5c832059c6451df4538f4c4 | 1,723 | py | Python | register/forms.py | anoop80/admission_portal | d17a92d3282f6c212fa146692f87f7ea06a782a6 | [
"MIT"
] | null | null | null | register/forms.py | anoop80/admission_portal | d17a92d3282f6c212fa146692f87f7ea06a782a6 | [
"MIT"
] | 1 | 2016-03-03T10:48:25.000Z | 2016-03-03T10:48:25.000Z | register/forms.py | anoop80/admission_portal | d17a92d3282f6c212fa146692f87f7ea06a782a6 | [
"MIT"
] | null | null | null | __author__ = 'zeroonehacker'
from django import forms
from django.contrib.auth.models import User
from .models import UserDetails1,UserDetails2
class UserForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput(attrs={'size':'50','pattern':'.{8,}','title':'8 characters minimum','placeholder':'8 characters minimum'}),label="Password :",help_text="Enter your Password:",required=True)
username = forms.CharField(widget=forms.HiddenInput(),label="Name",help_text="Enter Username",initial="lol")
email = forms.EmailField(widget=forms.EmailInput(attrs={'size':'50'}),label="Email ID:",help_text="Enter your Email:")
class Meta:
model = User
fields = ('username','email','password')
class UserProfileForm(forms.ModelForm):
dob = forms.DateField(widget=forms.DateInput(attrs={'type':'date'}))
full_name = forms.CharField(widget=forms.TextInput(attrs={}))
class Meta:
model = UserDetails1
fields = ('full_name','father_name','mother_name','dob','gender','nation','category','phys','mobile','perma_addr','corres_addr')
class Meta:
model = UserDetails2
fields = ('full_name','father_name','mother_name','dob','gender','nation','category','phys','mobile','perma_addr','corres_addr')
class ImageForm(forms.ModelForm):
image = forms.ImageField(widget=forms.FileInput(attrs={'id':'image'}))
signature = forms.ImageField(widget=forms.FileInput(attrs={'id':'signature'}))
score_card = forms.ImageField(widget=forms.FileInput())
class Meta:
model = UserDetails1
fields = ('image','signature','score_card')
class Meta:
model = UserDetails2
fields = ('image','signature','score_card')
| 45.342105 | 231 | 0.694138 | 199 | 1,723 | 5.904523 | 0.361809 | 0.074894 | 0.059574 | 0.06383 | 0.389787 | 0.226383 | 0.226383 | 0.154894 | 0.154894 | 0.154894 | 0 | 0.008713 | 0.134068 | 1,723 | 37 | 232 | 46.567568 | 0.77882 | 0 | 0 | 0.433333 | 0 | 0 | 0.252467 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.066667 | 0.1 | 0 | 0.7 | 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 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
4507c4eaba0efd11d7217cf73c0db85c18d0249d | 10,807 | py | Python | test/dataset_test.py | joaquincabezas/pytorch_geometric_temporal | 8ea8ff320f4542b43fdb1f0fbdb30555ae909e90 | [
"MIT"
] | null | null | null | test/dataset_test.py | joaquincabezas/pytorch_geometric_temporal | 8ea8ff320f4542b43fdb1f0fbdb30555ae909e90 | [
"MIT"
] | null | null | null | test/dataset_test.py | joaquincabezas/pytorch_geometric_temporal | 8ea8ff320f4542b43fdb1f0fbdb30555ae909e90 | [
"MIT"
] | null | null | null | import numpy as np
import networkx as nx
from torch_geometric_temporal.signal import temporal_signal_split
from torch_geometric_temporal.signal import StaticGraphTemporalSignal
from torch_geometric_temporal.signal import DynamicGraphTemporalSignal
from torch_geometric_temporal.signal import DynamicGraphStaticSignal
from torch_geometric_temporal.dataset import METRLADatasetLoader, PemsBayDatasetLoader, WindmillOutputDatasetLoader
from torch_geometric_temporal.dataset import ChickenpoxDatasetLoader, PedalMeDatasetLoader, WikiMathsDatasetLoader, EnglandCovidDatasetLoader
def get_edge_array(n_count):
return np.array([edge for edge in nx.gnp_random_graph(n_count, 0.1).edges()]).T
def generate_signal(snapshot_count, n_count, feature_count):
edge_indices = [get_edge_array(n_count) for _ in range(snapshot_count)]
edge_weights = [np.ones(edge_indices[t].shape[1]) for t in range(snapshot_count)]
features = [np.random.uniform(0,1,(n_count, feature_count)) for _ in range(snapshot_count)]
return edge_indices, edge_weights, features
def test_dynamic_graph_temporal_signal_real():
snapshot_count = 250
n_count = 100
feature_count = 32
edge_indices, edge_weights, features = generate_signal(250, 100, 32)
targets = [np.random.uniform(0,10,(n_count,)) for _ in range(snapshot_count)]
dataset = DynamicGraphTemporalSignal(edge_indices, edge_weights, features, targets)
for epoch in range(2):
for snapshot in dataset:
assert snapshot.edge_index.shape[0] == 2
assert snapshot.edge_index.shape[1] == snapshot.edge_attr.shape[0]
assert snapshot.x.shape == (100, 32)
assert snapshot.y.shape == (100, )
targets = [np.floor(np.random.uniform(0,10,(n_count,))).astype(int) for _ in range(snapshot_count)]
dataset = DynamicGraphTemporalSignal(edge_indices, edge_weights, features, targets)
for epoch in range(2):
for snapshot in dataset:
assert snapshot.edge_index.shape[0] == 2
assert snapshot.edge_index.shape[1] == snapshot.edge_attr.shape[0]
assert snapshot.x.shape == (100, 32)
assert snapshot.y.shape == (100, )
def test_static_graph_temporal_signal():
dataset = StaticGraphTemporalSignal(None, None, [None, None],[None, None])
for snapshot in dataset:
assert snapshot.edge_index is None
assert snapshot.edge_attr is None
assert snapshot.x is None
assert snapshot.y is None
def test_dynamic_graph_temporal_signal():
dataset = DynamicGraphTemporalSignal([None, None], [None, None], [None, None],[None, None])
for snapshot in dataset:
assert snapshot.edge_index is None
assert snapshot.edge_attr is None
assert snapshot.x is None
assert snapshot.y is None
def test_static_graph_temporal_signal_typing():
dataset = StaticGraphTemporalSignal(None, None, [np.array([1])],[np.array([2])])
for snapshot in dataset:
assert snapshot.edge_index is None
assert snapshot.edge_attr is None
assert snapshot.x.shape == (1,)
assert snapshot.y.shape == (1,)
def test_dynamic_graph_static_signal_typing():
dataset = DynamicGraphStaticSignal([None], [None], None, [None])
for snapshot in dataset:
assert snapshot.edge_index is None
assert snapshot.edge_attr is None
assert snapshot.x is None
assert snapshot.y is None
def test_chickenpox():
loader = ChickenpoxDatasetLoader()
dataset = loader.get_dataset()
for epoch in range(3):
for snapshot in dataset:
assert snapshot.edge_index.shape == (2, 102)
assert snapshot.edge_attr.shape == (102, )
assert snapshot.x.shape == (20, 4)
assert snapshot.y.shape == (20, )
def test_pedalme():
loader = PedalMeDatasetLoader()
dataset = loader.get_dataset()
for epoch in range(3):
for snapshot in dataset:
assert snapshot.edge_index.shape == (2, 225)
assert snapshot.edge_attr.shape == (225, )
assert snapshot.x.shape == (15, 4)
assert snapshot.y.shape == (15, )
def test_wiki():
loader = WikiMathsDatasetLoader()
dataset = loader.get_dataset()
for epoch in range(1):
for snapshot in dataset:
snapshot.edge_index.shape == (2, 27079)
snapshot.edge_attr.shape == (27079, )
snapshot.x.shape == (1068, 8)
snapshot.y.shape == (1068, )
def test_windmill():
loader = WindmillOutputDatasetLoader()
dataset = loader.get_dataset()
for epoch in range(2):
for snapshot in dataset:
snapshot.edge_index.shape == (2, 97032)
snapshot.edge_attr.shape == (97032, )
snapshot.x.shape == (312, 8)
snapshot.y.shape == (312, )
def test_covid():
loader = EnglandCovidDatasetLoader()
dataset = loader.get_dataset()
for epoch in range(2):
for snapshot in dataset:
snapshot.edge_index.shape[0] == 2
snapshot.edge_attr.shape[0] == snapshot.edge_index.shape[1]
snapshot.x.shape == (129, 8)
snapshot.y.shape == (129, )
def test_metrla():
loader = METRLADatasetLoader(raw_data_dir="/tmp/")
dataset = loader.get_dataset()
for epoch in range(2):
for snapshot in dataset:
assert snapshot.edge_index.shape == (2, 1722)
assert snapshot.edge_attr.shape == (1722, )
assert snapshot.x.shape == (207, 2, 12)
assert snapshot.y.shape == (207, 12)
def test_metrla_task_generator():
loader = METRLADatasetLoader(raw_data_dir="/tmp/")
dataset = loader.get_dataset(num_timesteps_in=6, num_timesteps_out=5)
for epoch in range(2):
for snapshot in dataset:
assert snapshot.edge_index.shape == (2, 1722)
assert snapshot.edge_attr.shape == (1722, )
assert snapshot.x.shape == (207, 2, 6)
assert snapshot.y.shape == (207, 5)
def test_pemsbay():
loader = PemsBayDatasetLoader(raw_data_dir="/tmp/")
dataset = loader.get_dataset()
for epoch in range(2):
for snapshot in dataset:
assert snapshot.edge_index.shape == (2, 2694)
assert snapshot.edge_attr.shape == (2694, )
assert snapshot.x.shape == (325, 2, 12)
assert snapshot.y.shape == (325, 2, 12)
def test_pemsbay_task_generator():
loader = PemsBayDatasetLoader(raw_data_dir="/tmp/")
dataset = loader.get_dataset(num_timesteps_in=6, num_timesteps_out=5)
for epoch in range(2):
for snapshot in dataset:
assert snapshot.edge_index.shape == (2, 2694)
assert snapshot.edge_attr.shape == (2694, )
assert snapshot.x.shape == (325, 2, 6)
assert snapshot.y.shape == (325, 2, 5)
def test_discrete_train_test_split_static():
loader = ChickenpoxDatasetLoader()
dataset = loader.get_dataset()
train_dataset, test_dataset = temporal_signal_split(dataset, 0.8)
for epoch in range(2):
for snapshot in train_dataset:
assert snapshot.edge_index.shape == (2, 102)
assert snapshot.edge_attr.shape == (102, )
assert snapshot.x.shape == (20, 4)
assert snapshot.y.shape == (20, )
for epoch in range(2):
for snapshot in test_dataset:
assert snapshot.edge_index.shape == (2, 102)
assert snapshot.edge_attr.shape == (102, )
assert snapshot.x.shape == (20, 4)
assert snapshot.y.shape == (20, )
def test_discrete_train_test_split_dynamic():
snapshot_count = 250
n_count = 100
feature_count = 32
edge_indices, edge_weights, features = generate_signal(250, 100, 32)
targets = [np.random.uniform(0,10,(n_count,)) for _ in range(snapshot_count)]
dataset = DynamicGraphTemporalSignal(edge_indices, edge_weights, features, targets)
train_dataset, test_dataset = temporal_signal_split(dataset, 0.8)
for epoch in range(2):
for snapshot in test_dataset:
assert snapshot.edge_index.shape[0] == 2
assert snapshot.edge_index.shape[1] == snapshot.edge_attr.shape[0]
assert snapshot.x.shape == (100, 32)
assert snapshot.y.shape == (100, )
for epoch in range(2):
for snapshot in train_dataset:
assert snapshot.edge_index.shape[0] == 2
assert snapshot.edge_index.shape[1] == snapshot.edge_attr.shape[0]
assert snapshot.x.shape == (100, 32)
assert snapshot.y.shape == (100, )
def test_train_test_split_dynamic_graph_static_signal():
snapshot_count = 250
n_count = 100
feature_count = 32
edge_indices, edge_weights, features = generate_signal(250, 100, 32)
targets = [np.random.uniform(0, 10, (n_count,)) for _ in range(snapshot_count)]
dataset = StaticGraphTemporalSignal(edge_indices[0], edge_weights[0], features, targets)
train_dataset, test_dataset = temporal_signal_split(dataset, 0.8)
for epoch in range(2):
for snapshot in test_dataset:
assert snapshot.edge_index.shape[0] == 2
assert snapshot.edge_index.shape[1] == snapshot.edge_attr.shape[0]
assert snapshot.x.shape == (100, 32)
assert snapshot.y.shape == (100, )
for epoch in range(2):
for snapshot in train_dataset:
assert snapshot.edge_index.shape[0] == 2
assert snapshot.edge_index.shape[1] == snapshot.edge_attr.shape[0]
assert snapshot.x.shape == (100, 32)
assert snapshot.y.shape == (100, )
def test_discrete_train_test_split_dynamic():
snapshot_count = 250
n_count = 100
feature_count = 32
edge_indices, edge_weights, features = generate_signal(250, 100, 32)
feature = features[0]
targets = [np.random.uniform(0,10,(n_count,)) for _ in range(snapshot_count)]
dataset = DynamicGraphStaticSignal(edge_indices, edge_weights, feature, targets)
train_dataset, test_dataset = temporal_signal_split(dataset, 0.8)
for epoch in range(2):
for snapshot in test_dataset:
assert snapshot.edge_index.shape[0] == 2
assert snapshot.edge_index.shape[1] == snapshot.edge_attr.shape[0]
assert snapshot.x.shape == (100, 32)
assert snapshot.y.shape == (100, )
for epoch in range(2):
for snapshot in train_dataset:
assert snapshot.edge_index.shape[0] == 2
assert snapshot.edge_index.shape[1] == snapshot.edge_attr.shape[0]
assert snapshot.x.shape == (100, 32)
assert snapshot.y.shape == (100, )
| 37.786713 | 141 | 0.651615 | 1,369 | 10,807 | 4.960555 | 0.07962 | 0.164924 | 0.106023 | 0.094831 | 0.798999 | 0.778972 | 0.690031 | 0.681048 | 0.675453 | 0.668826 | 0 | 0.048138 | 0.244564 | 10,807 | 285 | 142 | 37.919298 | 0.783684 | 0 | 0 | 0.684685 | 0 | 0 | 0.001851 | 0 | 0 | 0 | 0 | 0 | 0.36036 | 1 | 0.09009 | false | 0 | 0.036036 | 0.004505 | 0.135135 | 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 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4514b7eb79005677b05dc56d670ae77c9f8e55d6 | 332 | py | Python | src/compas_fab/ghpython/artists.py | yck011522/compas_fab | db7c8e54184dbbad9be5a818cf7ff814c95cf162 | [
"MIT"
] | 64 | 2019-08-07T07:19:06.000Z | 2022-03-22T16:48:23.000Z | src/compas_fab/ghpython/artists.py | yck011522/compas_fab | db7c8e54184dbbad9be5a818cf7ff814c95cf162 | [
"MIT"
] | 228 | 2019-07-08T07:55:30.000Z | 2022-03-25T16:39:17.000Z | src/compas_fab/ghpython/artists.py | yck011522/compas_fab | db7c8e54184dbbad9be5a818cf7ff814c95cf162 | [
"MIT"
] | 18 | 2019-08-04T16:42:37.000Z | 2022-01-12T18:36:06.000Z | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import compas
if compas.RHINO:
from compas_ghpython.artists import RobotModelArtist
__all__ = [
'RobotArtist',
'RobotModelArtist',
]
# deprecated alias
RobotArtist = RobotModelArtist
| 19.529412 | 56 | 0.740964 | 32 | 332 | 7.09375 | 0.53125 | 0.132159 | 0.211454 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.216867 | 332 | 16 | 57 | 20.75 | 0.873077 | 0.048193 | 0 | 0 | 0 | 0 | 0.085987 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.454545 | 0 | 0.454545 | 0.090909 | 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 | 0 | 0 | 0 | 2 |
451fb89114c8803a80f9a72afa7c8408c30a6901 | 583 | py | Python | Programming building blocks/W2activity.py | marcosamos/Python-tasks-and-proyects | 00426323647639016a407c40af1fd00f35ea2229 | [
"MIT"
] | null | null | null | Programming building blocks/W2activity.py | marcosamos/Python-tasks-and-proyects | 00426323647639016a407c40af1fd00f35ea2229 | [
"MIT"
] | null | null | null | Programming building blocks/W2activity.py | marcosamos/Python-tasks-and-proyects | 00426323647639016a407c40af1fd00f35ea2229 | [
"MIT"
] | null | null | null | print("Please inser the following")
print()
adjective = input("adjetive: ")
animal = input("animal: ")
verb1 = input("verb: ")
exclamation = input("exclamation: ")
verb2 = input ("verb: ")
verb3 = input("verb: ")
print()
print()
print("Your story is: ")
print()
print(f"The other day, I was really in trouble. It all started when I saw a very\n{adjective} {animal} {verb1} down the hallway. '{exclamation}!' I yelled. but all\nI could think to do was to {verb2} over and over. Miraculously, \nthat caused it to stop, but not before it tried to {verb3}\nright in front of my family.") | 44.846154 | 321 | 0.701544 | 91 | 583 | 4.494505 | 0.615385 | 0.066015 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01217 | 0.154374 | 583 | 13 | 321 | 44.846154 | 0.817444 | 0 | 0 | 0.307692 | 0 | 0.076923 | 0.686644 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.538462 | 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 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
45290e76cd3300990f83508efef9da1b946ffbbd | 7,136 | py | Python | pysnmp/DMTF-MONITOR-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/DMTF-MONITOR-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/DMTF-MONITOR-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module DMTF-MONITOR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DMTF-MONITOR-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:36:16 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "ValueSizeConstraint")
DmiString, dmiCompId, dmiEventSubSystem, dmiEventStateKey, dmiEventDateTime, dmiEventSeverity, dmiEventAssociatedGroup, dmiEventSystem = mibBuilder.importSymbols("DMTF-DMI-MIB", "DmiString", "dmiCompId", "dmiEventSubSystem", "dmiEventStateKey", "dmiEventDateTime", "dmiEventSeverity", "dmiEventAssociatedGroup", "dmiEventSystem")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, Unsigned32, TimeTicks, Gauge32, MibIdentifier, ModuleIdentity, iso, enterprises, NotificationType, Bits, IpAddress, Counter64, Integer32, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "Unsigned32", "TimeTicks", "Gauge32", "MibIdentifier", "ModuleIdentity", "iso", "enterprises", "NotificationType", "Bits", "IpAddress", "Counter64", "Integer32", "Counter32")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
class DmiCounter(Counter32):
pass
class DmiCounter64(Counter64):
pass
class DmiGauge(Gauge32):
pass
class DmiInteger(Integer32):
pass
class DmiOctetstring(OctetString):
pass
class DmiCompId(Integer32):
pass
class DmiGroupId(Integer32):
pass
dmtf = MibIdentifier((1, 3, 6, 1, 4, 1, 412))
dmtfStdMifs = MibIdentifier((1, 3, 6, 1, 4, 1, 412, 2))
dmtfDynOids = MibIdentifier((1, 3, 6, 1, 4, 1, 412, 3))
dmtfMonitorMIF = ModuleIdentity((1, 3, 6, 1, 4, 1, 412, 2, 6))
if mibBuilder.loadTexts: dmtfMonitorMIF.setLastUpdated('9710221800Z')
if mibBuilder.loadTexts: dmtfMonitorMIF.setOrganization('Desktop Management Task Force')
dmtfMonitorAdditionalInformationsTable = MibTable((1, 3, 6, 1, 4, 1, 412, 2, 6, 1), )
if mibBuilder.loadTexts: dmtfMonitorAdditionalInformationsTable.setStatus('current')
dmtfMonitorAdditionalInformationsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 412, 2, 6, 1, 1), ).setIndexNames((0, "DMTF-MONITOR-MIB", "DmiCompId"), (0, "DMTF-MONITOR-MIB", "DmiGroupId"))
if mibBuilder.loadTexts: dmtfMonitorAdditionalInformationsEntry.setStatus('current')
assetTag = MibTableColumn((1, 3, 6, 1, 4, 1, 412, 2, 6, 1, 1, 1), DmiString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: assetTag.setStatus('current')
monitorLocation = MibTableColumn((1, 3, 6, 1, 4, 1, 412, 2, 6, 1, 1, 2), DmiString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: monitorLocation.setStatus('current')
monitorPrimaryUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 412, 2, 6, 1, 1, 3), DmiString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: monitorPrimaryUserName.setStatus('current')
monitorPrimaryUserPhone = MibTableColumn((1, 3, 6, 1, 4, 1, 412, 2, 6, 1, 1, 4), DmiString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: monitorPrimaryUserPhone.setStatus('current')
dmtfMonitorResolutionsTable = MibTable((1, 3, 6, 1, 4, 1, 412, 2, 6, 2), )
if mibBuilder.loadTexts: dmtfMonitorResolutionsTable.setStatus('current')
dmtfMonitorResolutionsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 412, 2, 6, 2, 1), ).setIndexNames((0, "DMTF-MONITOR-MIB", "DmiCompId"), (0, "DMTF-MONITOR-MIB", "DmiGroupId"), (0, "DMTF-MONITOR-MIB", "monitorResolutionIndex"))
if mibBuilder.loadTexts: dmtfMonitorResolutionsEntry.setStatus('current')
dmtfMonitorResolutionsState = MibTableColumn((1, 3, 6, 1, 4, 1, 412, 2, 6, 2, 1, 0), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("active", 1), ("notInService", 2), ("notReady", 3), ("createAndGo", 4), ("createAndWait", 5), ("destroy", 6)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dmtfMonitorResolutionsState.setStatus('current')
monitorResolutionIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 412, 2, 6, 2, 1, 1), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: monitorResolutionIndex.setStatus('current')
horizontalResolution = MibTableColumn((1, 3, 6, 1, 4, 1, 412, 2, 6, 2, 1, 2), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: horizontalResolution.setStatus('current')
verticalResolution = MibTableColumn((1, 3, 6, 1, 4, 1, 412, 2, 6, 2, 1, 3), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: verticalResolution.setStatus('current')
refreshRate = MibTableColumn((1, 3, 6, 1, 4, 1, 412, 2, 6, 2, 1, 4), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: refreshRate.setStatus('current')
verticalScanMode = MibTableColumn((1, 3, 6, 1, 4, 1, 412, 2, 6, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("other", 1), ("unknown", 2), ("unsupported", 3), ("notInterlaced", 4), ("interlaced", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: verticalScanMode.setStatus('current')
minimumMonitorRefreshRate = MibTableColumn((1, 3, 6, 1, 4, 1, 412, 2, 6, 2, 1, 6), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: minimumMonitorRefreshRate.setStatus('current')
maximumMonitorRefreshRate = MibTableColumn((1, 3, 6, 1, 4, 1, 412, 2, 6, 2, 1, 7), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: maximumMonitorRefreshRate.setStatus('current')
mibBuilder.exportSymbols("DMTF-MONITOR-MIB", dmtfMonitorMIF=dmtfMonitorMIF, DmiInteger=DmiInteger, dmtfMonitorResolutionsState=dmtfMonitorResolutionsState, horizontalResolution=horizontalResolution, refreshRate=refreshRate, monitorPrimaryUserPhone=monitorPrimaryUserPhone, dmtfDynOids=dmtfDynOids, PYSNMP_MODULE_ID=dmtfMonitorMIF, dmtfMonitorResolutionsTable=dmtfMonitorResolutionsTable, dmtf=dmtf, monitorPrimaryUserName=monitorPrimaryUserName, dmtfMonitorResolutionsEntry=dmtfMonitorResolutionsEntry, dmtfStdMifs=dmtfStdMifs, maximumMonitorRefreshRate=maximumMonitorRefreshRate, DmiCompId=DmiCompId, dmtfMonitorAdditionalInformationsTable=dmtfMonitorAdditionalInformationsTable, verticalResolution=verticalResolution, minimumMonitorRefreshRate=minimumMonitorRefreshRate, monitorResolutionIndex=monitorResolutionIndex, dmtfMonitorAdditionalInformationsEntry=dmtfMonitorAdditionalInformationsEntry, DmiGroupId=DmiGroupId, monitorLocation=monitorLocation, verticalScanMode=verticalScanMode, assetTag=assetTag, DmiCounter=DmiCounter, DmiOctetstring=DmiOctetstring, DmiCounter64=DmiCounter64, DmiGauge=DmiGauge)
| 95.146667 | 1,108 | 0.774664 | 741 | 7,136 | 7.45749 | 0.213225 | 0.00941 | 0.010858 | 0.014477 | 0.387441 | 0.336591 | 0.2443 | 0.2443 | 0.188744 | 0.186754 | 0 | 0.059003 | 0.08324 | 7,136 | 74 | 1,109 | 96.432432 | 0.785692 | 0.045684 | 0 | 0.116667 | 0 | 0 | 0.161006 | 0.013086 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.116667 | 0.116667 | 0 | 0.233333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
452bd36437e5bd5b6a913b832edec45538e17f17 | 312 | py | Python | contracts/urls.py | Zayanto/Protocol-CRM | c81489d69de581d8216e20f7dd80089116f85c7b | [
"MIT"
] | null | null | null | contracts/urls.py | Zayanto/Protocol-CRM | c81489d69de581d8216e20f7dd80089116f85c7b | [
"MIT"
] | null | null | null | contracts/urls.py | Zayanto/Protocol-CRM | c81489d69de581d8216e20f7dd80089116f85c7b | [
"MIT"
] | null | null | null | from django.urls import path
from .views import ContractListView, ContractDetailView
from django.conf import settings
app_name = 'contract'
urlpatterns = [
path('', ContractListView.as_view(), name='contract_list'),
path('<uuid:pk>', ContractDetailView.as_view(),
name='contract_detail'),
]
| 22.285714 | 63 | 0.724359 | 35 | 312 | 6.314286 | 0.571429 | 0.162896 | 0.090498 | 0.162896 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.150641 | 312 | 13 | 64 | 24 | 0.833962 | 0 | 0 | 0 | 0 | 0 | 0.144231 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 2 |
188a9eeec94c841761aacc8ece5045409380ae31 | 1,977 | py | Python | core/web/collection.py | Chras-fu/LiuMa-engine | 4d52160d8a5c81d31311ab75d6cf274bfa74269e | [
"MIT"
] | 1 | 2022-03-31T12:29:14.000Z | 2022-03-31T12:29:14.000Z | core/web/collection.py | Chras-fu/LiuMa-engine | 4d52160d8a5c81d31311ab75d6cf274bfa74269e | [
"MIT"
] | null | null | null | core/web/collection.py | Chras-fu/LiuMa-engine | 4d52160d8a5c81d31311ab75d6cf274bfa74269e | [
"MIT"
] | null | null | null | class WebOperationCollection:
def __init__(self):
self.id = None
self.opt_type = None
self.opt_name = None
self.opt_trans = None
self.opt_element = None
self.opt_data = None
self.opt_code = None
@staticmethod
def __parse(ui_data: dict, name):
if name not in ui_data:
return None
return ui_data.get(name)
def collect_id(self, ui_data):
self.id = WebOperationCollection.__parse(ui_data, "operationId")
def collect_opt_type(self, ui_data):
self.opt_type = WebOperationCollection.__parse(ui_data, "operationType")
def collect_opt_name(self, ui_data):
self.opt_name = WebOperationCollection.__parse(ui_data, "operationName")
def collect_opt_trans(self, ui_data):
self.opt_trans = WebOperationCollection.__parse(ui_data, "operationTrans")
def collect_opt_code(self, ui_data):
self.opt_code = WebOperationCollection.__parse(ui_data, "operationCode")
def collect_opt_element(self, ui_data):
opt_element = WebOperationCollection.__parse(ui_data, "operationElement")
if opt_element is None or len(opt_element) == 0:
self.opt_element = None
else:
for name, element in opt_element.items():
opt_element[name] = (element["by"].lower(), element["expression"])
self.opt_element = opt_element
def collect_opt_data(self, ui_data):
opt_data = WebOperationCollection.__parse(ui_data, "operationData")
if opt_data is None or len(opt_data) == 0:
self.opt_data = None
else:
self.opt_data = opt_data
def collect(self, ui_data):
self.collect_id(ui_data)
self.collect_opt_type(ui_data)
self.collect_opt_name(ui_data)
self.collect_opt_trans(ui_data)
self.collect_opt_element(ui_data)
self.collect_opt_data(ui_data)
self.collect_opt_code(ui_data)
| 34.684211 | 82 | 0.660091 | 254 | 1,977 | 4.76378 | 0.161417 | 0.123967 | 0.099174 | 0.190909 | 0.178512 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00135 | 0.250379 | 1,977 | 56 | 83 | 35.303571 | 0.815115 | 0 | 0 | 0.130435 | 0 | 0 | 0.053111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.217391 | false | 0 | 0 | 0 | 0.282609 | 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 | 0 | 0 | 0 | 0 | 2 |
18ad484f0fbe410a579ef242843638bd852a796a | 197 | py | Python | pi_string.py | AmitSuresh/learning-python | f1ea5b9f3659f21504b1b0e452c03239b03cde85 | [
"MIT"
] | null | null | null | pi_string.py | AmitSuresh/learning-python | f1ea5b9f3659f21504b1b0e452c03239b03cde85 | [
"MIT"
] | null | null | null | pi_string.py | AmitSuresh/learning-python | f1ea5b9f3659f21504b1b0e452c03239b03cde85 | [
"MIT"
] | null | null | null | filename='pi_digits.txt'
with open(filename) as file_object:
lines=file_object.readlines()
pi_string=''
for line in lines:
pi_string +=line.strip()
print(pi_string)
print(len(pi_string)) | 21.888889 | 36 | 0.741117 | 31 | 197 | 4.483871 | 0.580645 | 0.230216 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126904 | 197 | 9 | 37 | 21.888889 | 0.80814 | 0 | 0 | 0 | 0 | 0 | 0.068421 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
18c19b4681c73cbc5b6be18e7f9ae4d1b9a48001 | 1,201 | py | Python | posthog/models/action_step.py | Kacppian/posthog | faa0696e3219f9162a3fd59501e126a7cd79ec8c | [
"MIT"
] | null | null | null | posthog/models/action_step.py | Kacppian/posthog | faa0696e3219f9162a3fd59501e126a7cd79ec8c | [
"MIT"
] | null | null | null | posthog/models/action_step.py | Kacppian/posthog | faa0696e3219f9162a3fd59501e126a7cd79ec8c | [
"MIT"
] | null | null | null | from django.db import models, connection, transaction
from django.contrib.postgres.fields import JSONField
class ActionStep(models.Model):
EXACT = "exact"
CONTAINS = "contains"
URL_MATCHING = [
(EXACT, EXACT),
(CONTAINS, CONTAINS),
]
action: models.ForeignKey = models.ForeignKey("Action", related_name="steps", on_delete=models.CASCADE)
tag_name: models.CharField = models.CharField(max_length=400, null=True, blank=True)
text: models.CharField = models.CharField(max_length=400, null=True, blank=True)
href: models.CharField = models.CharField(max_length=400, null=True, blank=True)
selector: models.CharField = models.CharField(max_length=400, null=True, blank=True)
url: models.CharField = models.CharField(max_length=400, null=True, blank=True)
url_matching: models.CharField = models.CharField(
max_length=400, choices=URL_MATCHING, default=CONTAINS, null=True, blank=True
)
name: models.CharField = models.CharField(max_length=400, null=True, blank=True)
event: models.CharField = models.CharField(max_length=400, null=True, blank=True)
properties: JSONField = JSONField(default=list, null=True, blank=True)
| 50.041667 | 107 | 0.734388 | 153 | 1,201 | 5.673203 | 0.27451 | 0.276498 | 0.134793 | 0.176267 | 0.540323 | 0.540323 | 0.540323 | 0.491935 | 0.491935 | 0.491935 | 0 | 0.023415 | 0.146545 | 1,201 | 23 | 108 | 52.217391 | 0.823415 | 0 | 0 | 0 | 0 | 0 | 0.019983 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.095238 | 0 | 0.761905 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
18d84bf1a54c8f0bf7f69a7dbdc285108d4510d6 | 1,034 | py | Python | pychron/pyscripts/tests/co2_v2.py | ael-noblegas/pychron | 6ebbbb1f66a614972b62b7a9be4c784ae61b5d62 | [
"Apache-2.0"
] | 1 | 2019-02-27T21:57:44.000Z | 2019-02-27T21:57:44.000Z | pychron/pyscripts/tests/co2_v2.py | ael-noblegas/pychron | 6ebbbb1f66a614972b62b7a9be4c784ae61b5d62 | [
"Apache-2.0"
] | 80 | 2018-07-17T20:10:20.000Z | 2021-08-17T15:38:24.000Z | pychron/pyscripts/tests/co2_v2.py | AGESLDEO/pychron | 1a81e05d9fba43b797f335ceff6837c016633bcf | [
"Apache-2.0"
] | null | null | null | def main():
info('Jan unknown laser analysis')
#gosub('jan:PrepareForCO2Analysis')
if exp.analysis_type == 'blank':
info('is blank. not heating')
else:
info('move to position {}'.format(exp.position))
move_to_position(exp.position)
if exp.ramp_rate > 0:
'''
style 1.
'''
# begin_interval(duration)
# info('ramping to {} at {} {}/s'.format(extract_value, ramp_rate, extract_units)
# ramp(setpoint=extract_value, rate=ramp_rate)
# complete_interval()
'''
style 2.
'''
#elapsed=ramp(setpoint=extract_value, rate=ramp_rate)
#sleep(min(0, duration-elapsed))
pass
else:
info('set heat to {}'.format(exp.extract_value))
extract(exp.extract_value)
sleep(exp.duration)
if not exp.analysis_type == 'blank':
disable()
sleep(exp.cleanup) | 30.411765 | 103 | 0.515474 | 106 | 1,034 | 4.877358 | 0.433962 | 0.116054 | 0.058027 | 0.077369 | 0.139265 | 0.139265 | 0.139265 | 0 | 0 | 0 | 0 | 0.007599 | 0.363636 | 1,034 | 34 | 104 | 30.411765 | 0.778116 | 0.316248 | 0 | 0.125 | 0 | 0 | 0.144928 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | true | 0.0625 | 0 | 0 | 0.0625 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
18e040fafc3ce6cb1fc7490ee0a8d48e676e1240 | 186 | py | Python | mailersend/__init__.py | flanciskinho/mailersend-python | f9aaa533c4bab82669ad736a37a5ef068529546e | [
"MIT"
] | null | null | null | mailersend/__init__.py | flanciskinho/mailersend-python | f9aaa533c4bab82669ad736a37a5ef068529546e | [
"MIT"
] | null | null | null | mailersend/__init__.py | flanciskinho/mailersend-python | f9aaa533c4bab82669ad736a37a5ef068529546e | [
"MIT"
] | null | null | null | """
MailerSend Official Python DSK
@maintainer: Alexandros Orfanos (alexandros at remotecompany dot com)
"""
__version_info__ = ("0", "1", "3")
__version__ = ".".join(__version_info__)
| 23.25 | 69 | 0.725806 | 21 | 186 | 5.761905 | 0.809524 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018405 | 0.123656 | 186 | 7 | 70 | 26.571429 | 0.723926 | 0.537634 | 0 | 0 | 0 | 0 | 0.051282 | 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 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
18e37a3a428e4d2f36de6a5ffbf0292dbfcf7f46 | 2,161 | py | Python | bin/pxcars.py | ddierschow/bamca | 11b42a1348f22816ca8cc714e7619127af2bcf21 | [
"MIT"
] | 1 | 2019-06-05T21:13:20.000Z | 2019-06-05T21:13:20.000Z | bin/pxcars.py | ddierschow/bamca | 11b42a1348f22816ca8cc714e7619127af2bcf21 | [
"MIT"
] | 3 | 2017-04-26T21:15:01.000Z | 2017-04-29T08:19:33.000Z | bin/pxcars.py | ddierschow/bamca | 11b42a1348f22816ca8cc714e7619127af2bcf21 | [
"MIT"
] | null | null | null | #!/usr/local/bin/python
from sprint import sprint as print
import copy
import basics
import bfiles
import config
import useful
# ------- ----------------------------------------------------------
class CarsFile(bfiles.ArgFile):
def __init__(self, fname=useful.relpath(config.SRC_DIR, "cars.dat")):
self.sec = []
self.ent = []
self.secname = ''
bfiles.ArgFile.__init__(self, fname)
def parse_c(self, llist):
self.parse_end()
self.ent = []
self.secname = llist[1]
def parse_m(self, llist):
self.ent.append(llist.llist[1:3])
def parse_end(self):
if self.ent:
self.sec.append([self.secname, copy.deepcopy(self.ent)])
def render_cars(pif, cf):
imax = 0
print(pif.render.format_table_start())
sec = 0
print(pif.render.format_row_start())
for c in cf.sec:
imax = max(imax, len(c[1]))
print(pif.render.format_cell(sec, c[0], hdr=True, also={'colspan': len(c[1][0])}))
sec = sec + len(c[1][0])
print(pif.render.format_row_end())
for i in range(0, imax):
print(pif.render.format_row_start())
sec = 0
for c in cf.sec:
if i >= len(c[1]):
for f in c[1][0]:
print(pif.render.format_cell(sec, ' '))
sec = sec + 1
else:
for f in c[1][i]:
if f == 'x':
print(pif.render.format_cell(sec, pif.render.format_image_art('box-sm-x.gif')))
elif f:
print(pif.render.format_cell(sec, " " + f + " "))
else:
print(pif.render.format_cell(sec, pif.render.format_image_art('box-sm.gif')))
sec = sec + 1
print(pif.render.format_row_end())
print(pif.render.format_table_end())
@basics.web_page
def cars_main(pif):
pif.render.print_html()
db = CarsFile(useful.relpath(config.SRC_DIR, pif.form.get_str('page', 'cars') + '.dat'))
print(pif.render.format_head())
render_cars(pif, db)
print(pif.render.format_tail())
| 28.064935 | 103 | 0.534938 | 292 | 2,161 | 3.811644 | 0.270548 | 0.12938 | 0.202156 | 0.233603 | 0.39982 | 0.274933 | 0.140162 | 0.098832 | 0.098832 | 0.098832 | 0 | 0.012435 | 0.29292 | 2,161 | 76 | 104 | 28.434211 | 0.715969 | 0.041185 | 0 | 0.245614 | 0 | 0 | 0.030435 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.105263 | false | 0 | 0.105263 | 0 | 0.22807 | 0.263158 | 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 | 0 | 0 | 2 |
18f74e878010d6f1ff7eb2013d59e4699357874d | 354 | py | Python | gigpower/src/gigpower/bus_group.py | elaguerta/gigpower | 22e0a6152fa8d7a04f6067f3d500bfee042a98f9 | [
"Unlicense"
] | null | null | null | gigpower/src/gigpower/bus_group.py | elaguerta/gigpower | 22e0a6152fa8d7a04f6067f3d500bfee042a98f9 | [
"Unlicense"
] | 4 | 2021-06-15T16:50:13.000Z | 2021-06-15T16:53:23.000Z | gigpower/src/gigpower/bus_group.py | msankur/gigpower | 22e0a6152fa8d7a04f6067f3d500bfee042a98f9 | [
"Unlicense"
] | null | null | null | from . circuit_element_group import CircuitElementGroup
from . bus import Bus
class BusGroup(CircuitElementGroup):
dss_module_name = 'Bus'
ele_class = Bus
def _collect_names(self, dss):
""" Override super() to use dss.Circuit.AllBusNames()"""
self._names = dss.Circuit.AllBusNames()
self._populate_name_idx_dicts()
| 27.230769 | 64 | 0.706215 | 42 | 354 | 5.666667 | 0.595238 | 0.084034 | 0.176471 | 0.210084 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.19774 | 354 | 12 | 65 | 29.5 | 0.838028 | 0.138418 | 0 | 0 | 0 | 0 | 0.010067 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.25 | 0 | 0.75 | 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 | 0 | 1 | 0 | 0 | 2 |
7a0228d61e5be1cfbf5e95f9d8f09350d2e8aeaa | 1,091 | py | Python | src/netify/tests/base.py | fretboardfreak/netify | c3a78cc8061cb5c69ceabd033b7da2b82e397f6b | [
"Apache-2.0"
] | 2 | 2019-02-17T11:31:56.000Z | 2019-03-27T00:25:20.000Z | src/netify/tests/base.py | fretboardfreak/netify | c3a78cc8061cb5c69ceabd033b7da2b82e397f6b | [
"Apache-2.0"
] | null | null | null | src/netify/tests/base.py | fretboardfreak/netify | c3a78cc8061cb5c69ceabd033b7da2b82e397f6b | [
"Apache-2.0"
] | 1 | 2019-01-22T06:07:58.000Z | 2019-01-22T06:07:58.000Z | """Basic common tools for testing netify."""
# Copyright 2016 Curtis Sand
#
# 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 unittest
import flask_testing
import netify.app as app
class BasicTest(unittest.TestCase):
"""A base class for netify tests that do not require the netify app."""
pass
class NetifyTest(flask_testing.TestCase):
"""A base class for netify tests that require the netify/flask app."""
def create_app(self):
"""Create an instance of the flask_app for the Flask Testing API."""
napp = app.NetifyApp()
return napp.flask_app
| 32.088235 | 76 | 0.734189 | 164 | 1,091 | 4.853659 | 0.54878 | 0.075377 | 0.032663 | 0.040201 | 0.090452 | 0.090452 | 0.090452 | 0.090452 | 0 | 0 | 0 | 0.00905 | 0.189734 | 1,091 | 33 | 77 | 33.060606 | 0.891403 | 0.716774 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0.111111 | 0.333333 | 0 | 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 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 2 |
7a05cfe00e713c60cb94c49600c13c749d1b2d01 | 1,329 | py | Python | leanai/data/transformer.py | penguinmenac3/leanai | 6d26575b248ff03c4a24009cd82f26ea99d96d15 | [
"MIT"
] | 1 | 2021-03-28T21:32:59.000Z | 2021-03-28T21:32:59.000Z | leanai/data/transformer.py | penguinmenac3/leanai | 6d26575b248ff03c4a24009cd82f26ea99d96d15 | [
"MIT"
] | null | null | null | leanai/data/transformer.py | penguinmenac3/leanai | 6d26575b248ff03c4a24009cd82f26ea99d96d15 | [
"MIT"
] | null | null | null | """doc
# leanai.data.transformer
> A transformer converts the data from a general format into what the neural network needs.
"""
class Transformer():
def __init__(self):
"""
A transformer must implement `__call__`.
A transformer is a callable that gets the data (usually a tuple of feature, label), transforms it and returns the data again (usually as a tuple of feature, label).
The last transformer must output a tuple of feature of type NetworkInput (namedtuple) and label of type NetworkOutput (namedtuple) to be able to pass it to the neural network.
Example:
```python
def __call__(self, sample: Tuple[DatasetInput, DatasetOutput]) -> Tuple[NetworkInput, NetworkTargets]:
```
"""
pass
def __call__(self, *args):
"""
This function gets the data from the previous transformer or dataset as input and should output the data again.
:param args: The input data.
:return: The output data.
"""
raise NotImplementedError
@property
def version(self):
"""
Defines the version of the transformer. The name can be also something descriptive of the method.
:return: The version number of the transformer.
"""
raise NotImplementedError
| 33.225 | 183 | 0.654628 | 163 | 1,329 | 5.239264 | 0.460123 | 0.040984 | 0.028103 | 0.052693 | 0.046838 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.276147 | 1,329 | 39 | 184 | 34.076923 | 0.887734 | 0.712566 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0.125 | 0 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
7a09852dd07bfb8b43e15f2cddd825750c874dc3 | 1,802 | py | Python | python_modules/dagster/dagster/core/definitions/input.py | bambielli-flex/dagster | 30b75ba7c62fc536bc827f177c1dc6ba20f5ae20 | [
"Apache-2.0"
] | null | null | null | python_modules/dagster/dagster/core/definitions/input.py | bambielli-flex/dagster | 30b75ba7c62fc536bc827f177c1dc6ba20f5ae20 | [
"Apache-2.0"
] | null | null | null | python_modules/dagster/dagster/core/definitions/input.py | bambielli-flex/dagster | 30b75ba7c62fc536bc827f177c1dc6ba20f5ae20 | [
"Apache-2.0"
] | null | null | null | from collections import namedtuple
from dagster import check
from dagster.core.types.runtime import RuntimeType, resolve_to_runtime_type
from .expectation import ExpectationDefinition
from .utils import check_valid_name
class InputDefinition(object):
'''An InputDefinition instance represents an argument to a compute defined within a solid.
Inputs are values within the dagster type system that are created from previous solids.
Attributes:
name (str): Name of the input.
runtime_type (DagsterType): Type of the input. Defaults to types.Any
expectations (List[ExpectationDefinition]):
List of expectations that applies to the value passed to the solid.
description (str): Description of the input. Optional.
'''
def __init__(self, name, dagster_type=None, expectations=None, description=None):
''
self.name = check_valid_name(name)
self.runtime_type = check.inst(resolve_to_runtime_type(dagster_type), RuntimeType)
self.expectations = check.opt_list_param(
expectations, 'expectations', of_type=ExpectationDefinition
)
self.description = check.opt_str_param(description, 'description')
@property
def descriptive_key(self):
return 'output'
def mapping_to(self, solid_name, input_name):
return InputMapping(self, solid_name, input_name)
class InputMapping(namedtuple('_InputMapping', 'definition solid_name input_name')):
def __new__(cls, definition, solid_name, input_name):
return super(InputMapping, cls).__new__(
cls,
check.inst_param(definition, 'definition', InputDefinition),
check.str_param(solid_name, 'solid_name'),
check.str_param(input_name, 'input_name'),
)
| 36.77551 | 94 | 0.711432 | 212 | 1,802 | 5.816038 | 0.334906 | 0.043796 | 0.052717 | 0.058394 | 0.090835 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.210877 | 1,802 | 48 | 95 | 37.541667 | 0.867089 | 0.265816 | 0 | 0 | 0 | 0 | 0.080997 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.148148 | false | 0 | 0.185185 | 0.111111 | 0.518519 | 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 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
7a0e4791f389fd9f881d1d2df7f6704f0f72a779 | 5,546 | py | Python | openbmc_modules/ipmi-fru-parser/scripts/gen_pimrules.py | Eyerunmyden/HWMgmt-MegaRAC-OpenEdition | 72b03e9fc6e2a13184f1c57b8045b616db9b0a6d | [
"Apache-2.0",
"MIT"
] | 14 | 2021-11-04T07:47:37.000Z | 2022-03-21T10:10:30.000Z | openbmc_modules/ipmi-fru-parser/scripts/gen_pimrules.py | Eyerunmyden/HWMgmt-MegaRAC-OpenEdition | 72b03e9fc6e2a13184f1c57b8045b616db9b0a6d | [
"Apache-2.0",
"MIT"
] | null | null | null | openbmc_modules/ipmi-fru-parser/scripts/gen_pimrules.py | Eyerunmyden/HWMgmt-MegaRAC-OpenEdition | 72b03e9fc6e2a13184f1c57b8045b616db9b0a6d | [
"Apache-2.0",
"MIT"
] | 6 | 2021-11-02T10:56:19.000Z | 2022-03-06T11:58:20.000Z | #!/usr/bin/env python3
'''Generate PIM rules for ipmi-fru-parser.
'''
import argparse
import os
import sys
import yaml
from mako.template import Template
tmpl = '''
description: >
PIM rules for ipmi-fru-parser inventory objects.
events:
- name: Host off at startup
description: >
Mark ipmi-fru-parser inventory items as cached when
the host is off at startup.
type: startup
actions:
- name: setProperty
interface: ${cacheable_iface}
property: ${cacheable_property}
paths:
%for i in cacheable:
- ${i}
%endfor
value:
type: ${cacheable_type}
value: ${cacheable_cached}
- name: Host off event
description: >
Mark ipmi-fru-parser inventory items as cached when
the host goes away.
type: match
signatures:
- type: signal
interface: org.freedesktop.DBus.Properties
path: ${off_path}
member: PropertiesChanged
filters:
- name: propertyChangedTo
interface: ${off_iface}
property: ${off_property}
value:
value: ${off_value}
type: ${off_type}
actions:
- name: setProperty
interface: ${cacheable_iface}
property: ${cacheable_property}
paths:
%for i in cacheable:
- ${i}
%endfor
value:
type: ${cacheable_type}
value: ${cacheable_cached}
- name: Host on at startup
description: >
Remove ipmi-fru-parser inventory items when the host is finished
sending inventory items and the item is still marked as cached.
type: startup
filters:
- name: propertyIs
path: ${on_path}
interface: ${on_iface}
property: ${on_property}
value:
value: ${on_value}
type: ${on_type}
actions:
- name: destroyObjects
paths:
%for i in cacheable:
- ${i}
%endfor
conditions:
- name: propertyIs
interface: ${cacheable_iface}
property: ${cacheable_property}
value:
type: ${cacheable_type}
value: ${cacheable_cached}
- name: Host on event
description: >
Remove ipmi-fru-parser inventory items when the host is finished
sending inventory items and the item is still marked as cached.
type: match
signatures:
- type: signal
interface: org.freedesktop.DBus.Properties
path: ${on_path}
member: PropertiesChanged
filters:
- name: propertyChangedTo
interface: ${on_iface}
property: ${on_property}
value:
value: ${on_value}
type: ${on_type}
actions:
- name: destroyObjects
paths:
%for i in cacheable:
- ${i}
%endfor
conditions:
- name: propertyIs
interface: ${cacheable_iface}
property: ${cacheable_property}
value:
type: ${cacheable_type}
value: ${cacheable_cached}
'''
def get_cacheable_objs(yaml):
cacheable = []
for objdata in data.values():
if not isinstance(objdata, dict):
continue
for path, ifaces in objdata.items():
if not isinstance(ifaces, dict):
continue
if cacheable_iface_name in ifaces.keys():
cacheable.append(path)
return cacheable
if __name__ == '__main__':
script_dir = os.path.dirname(os.path.realpath(__file__))
parser = argparse.ArgumentParser(
description='ipmi-fru-parser PIM rule generator.')
parser.add_argument(
'-o', '--output-dir', dest='outputdir',
default='.', help='Output directory.')
parser.add_argument(
'inventory', metavar='INVENTORY', type=str,
help='Path to inventory YAML.')
args = parser.parse_args()
with open(args.inventory, 'r') as fd:
data = yaml.safe_load(fd.read())
cacheable_iface_name = 'xyz.openbmc_project.Inventory.Decorator.Cacheable'
target_file = os.path.join(args.outputdir, 'ipmi-fru-rules.yaml')
cacheable = []
if isinstance(data, dict):
cacheable = get_cacheable_objs(data)
if cacheable:
with open(target_file, 'w') as out:
out.write(
Template(tmpl).render(
cacheable_iface=cacheable_iface_name,
cacheable_property='Cached',
cacheable_cached='true',
cacheable_type='boolean',
on_path='/xyz/openbmc_project/state/host0',
on_iface='xyz.openbmc_project.State.Boot.Progress',
on_property='BootProgress',
on_value='xyz.openbmc_project.State.Boot.Progress.ProgressStages.OSStart',
on_type='string',
off_path='/xyz/openbmc_project/state/host0',
off_iface='xyz.openbmc_project.State.Host',
off_property='CurrentHostState',
off_value='xyz.openbmc_project.State.Host.Off',
off_type='string',
cacheable=cacheable))
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
| 30.141304 | 94 | 0.550126 | 544 | 5,546 | 5.459559 | 0.270221 | 0.018855 | 0.03064 | 0.044444 | 0.550505 | 0.543771 | 0.46431 | 0.424242 | 0.424242 | 0.424242 | 0 | 0.001685 | 0.358096 | 5,546 | 183 | 95 | 30.306011 | 0.832584 | 0.020375 | 0 | 0.607595 | 1 | 0 | 0.675207 | 0.078157 | 0 | 0 | 0 | 0 | 0 | 1 | 0.006329 | false | 0 | 0.031646 | 0 | 0.044304 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
7a0f781b0ebadfde6778c3be146da0e99ac5b215 | 2,953 | py | Python | tests/test_ec2.py | compose-x/troposphere | 9a94a8fafd8b4da1cd1f4239be0e7aa0681fd8d4 | [
"BSD-2-Clause"
] | 4,573 | 2015-01-02T20:31:04.000Z | 2022-03-31T17:15:32.000Z | tests/test_ec2.py | compose-x/troposphere | 9a94a8fafd8b4da1cd1f4239be0e7aa0681fd8d4 | [
"BSD-2-Clause"
] | 1,730 | 2015-01-02T19:24:47.000Z | 2022-03-31T23:22:52.000Z | tests/test_ec2.py | compose-x/troposphere | 9a94a8fafd8b4da1cd1f4239be0e7aa0681fd8d4 | [
"BSD-2-Clause"
] | 1,753 | 2015-01-01T01:24:12.000Z | 2022-03-27T05:36:17.000Z | import unittest
import troposphere.ec2 as ec2
class TestEC2(unittest.TestCase):
def test_securitygroupegress(self):
egress = ec2.SecurityGroupEgress(
"egress",
ToPort="80",
FromPort="80",
IpProtocol="tcp",
GroupId="id",
CidrIp="0.0.0.0/0",
)
egress.to_dict()
egress = ec2.SecurityGroupEgress(
"egress",
ToPort="80",
FromPort="80",
IpProtocol="tcp",
GroupId="id",
DestinationPrefixListId="id",
)
egress.to_dict()
egress = ec2.SecurityGroupEgress(
"egress",
ToPort="80",
FromPort="80",
IpProtocol="tcp",
GroupId="id",
DestinationSecurityGroupId="id",
)
egress.to_dict()
egress = ec2.SecurityGroupEgress(
"egress",
IpProtocol="-1",
GroupId="id",
DestinationSecurityGroupId="id",
)
egress.to_dict()
egress = ec2.SecurityGroupEgress(
"egress",
IpProtocol="58",
GroupId="id",
DestinationSecurityGroupId="id",
)
egress.to_dict()
egress = ec2.SecurityGroupEgress(
"egress",
ToPort="80",
FromPort="80",
IpProtocol="tcp",
GroupId="id",
CidrIp="0.0.0.0/0",
DestinationPrefixListId="id",
)
with self.assertRaises(ValueError):
egress.to_dict()
# Test mutually exclusive fields
egress = ec2.SecurityGroupEgress(
"egress",
ToPort="80",
FromPort="80",
IpProtocol="tcp",
GroupId="id",
CidrIp="0.0.0.0/0",
DestinationPrefixListId="id",
DestinationSecurityGroupId="id",
)
with self.assertRaises(ValueError):
egress.to_dict()
# Test no ToPort
egress = ec2.SecurityGroupEgress(
"egress",
FromPort="80",
IpProtocol="tcp",
GroupId="id",
CidrIp="0.0.0.0/0",
)
with self.assertRaises(ValueError):
egress.to_dict()
# Test no ToPort or FromPort
egress = ec2.SecurityGroupEgress(
"egress",
IpProtocol="tcp",
GroupId="id",
CidrIp="0.0.0.0/0",
)
with self.assertRaises(ValueError):
egress.to_dict()
def test_vpn_conn_cannot_have_customer_gateway_and_transit_gateway(self):
vpn = ec2.VPNConnection(
"VPNConnection",
CustomerGatewayId="cgw-0e11f167",
VpnGatewayId="vgw-9a4cacf3",
TransitGatewayId="tgw-b2b84747",
Type="ipsec.1",
)
with self.assertRaises(ValueError):
vpn.to_dict()
| 26.603604 | 77 | 0.497122 | 243 | 2,953 | 5.958848 | 0.230453 | 0.027624 | 0.031077 | 0.027624 | 0.699586 | 0.676105 | 0.676105 | 0.676105 | 0.676105 | 0.642956 | 0 | 0.043719 | 0.38808 | 2,953 | 110 | 78 | 26.845455 | 0.757609 | 0.024382 | 0 | 0.747368 | 0 | 0 | 0.081335 | 0 | 0 | 0 | 0 | 0 | 0.052632 | 1 | 0.021053 | false | 0 | 0.021053 | 0 | 0.052632 | 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 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
7a1776a8a8e975c0689d00f7467c2f390ca49a5b | 785 | py | Python | catkin_ws/src:/opt/ros/kinetic/lib/python2.7/dist-packages:/home/bala/duckietown/catkin_ws/src:/home/bala/duckietown/catkin_ws/src/lib/python2.7/site-packages/contracts/enabling.py | johnson880319/Software | 045894227f359e0a3a3ec5b7a53f8d1ebc06acdd | [
"CC-BY-2.0"
] | 13 | 2018-03-28T23:07:01.000Z | 2022-03-12T06:01:21.000Z | catkin_ws/src:/opt/ros/kinetic/lib/python2.7/dist-packages:/home/bala/duckietown/catkin_ws/src:/home/bala/duckietown/catkin_ws/src/lib/python2.7/site-packages/contracts/enabling.py | johnson880319/Software | 045894227f359e0a3a3ec5b7a53f8d1ebc06acdd | [
"CC-BY-2.0"
] | 11 | 2018-06-18T15:49:07.000Z | 2021-11-25T01:45:33.000Z | catkin_ws/src:/opt/ros/kinetic/lib/python2.7/dist-packages:/home/bala/duckietown/catkin_ws/src:/home/bala/duckietown/catkin_ws/src/lib/python2.7/site-packages/contracts/enabling.py | johnson880319/Software | 045894227f359e0a3a3ec5b7a53f8d1ebc06acdd | [
"CC-BY-2.0"
] | 5 | 2018-03-28T23:07:05.000Z | 2021-12-09T19:02:00.000Z | from . import logger
import os
class Switches:
# default to ENV variable
disable_all = os.environ.get('DISABLE_CONTRACTS', False)
def disable_all():
""" Disables all contracts checks. """
# print('disable_all()')
Switches.disable_all = True
logger.info('All contracts checking disabled.')
def enable_all():
"""
Enables all contracts checks.
Can be overridden by an environment variable.
"""
# print('enable_all()')
if not os.environ.get('DISABLE_CONTRACTS', False):
Switches.disable_all = False
logger.info('All contracts checking enabled.')
def all_disabled():
# print('all_Disabled? %s' % Switches.disable_all)
""" Returns true if all contracts checks are disabled. """
return Switches.disable_all
| 23.787879 | 62 | 0.673885 | 96 | 785 | 5.375 | 0.40625 | 0.135659 | 0.139535 | 0.073643 | 0.244186 | 0.127907 | 0 | 0 | 0 | 0 | 0 | 0 | 0.211465 | 785 | 32 | 63 | 24.53125 | 0.833603 | 0.369427 | 0 | 0 | 0 | 0 | 0.211329 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.153846 | 0 | 0.615385 | 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 | 0 | 1 | 0 | 0 | 2 |
7a184387e23f0daff020de3da1e9069aa5951150 | 810 | py | Python | gadget/route/api/run/__init__.py | wvankuipers/gadget-backend | ac23c9b991c44ed343784a197ed0805b23b88f02 | [
"MIT"
] | null | null | null | gadget/route/api/run/__init__.py | wvankuipers/gadget-backend | ac23c9b991c44ed343784a197ed0805b23b88f02 | [
"MIT"
] | 9 | 2020-09-26T11:25:11.000Z | 2020-09-30T18:18:26.000Z | gadget/route/api/run/__init__.py | wvankuipers/gadget-backend | ac23c9b991c44ed343784a197ed0805b23b88f02 | [
"MIT"
] | null | null | null | from flask import Blueprint, jsonify, request
from flask_restful import Resource
from gadget import utils
from .model import Run
bp = Blueprint('run', __name__)
@bp.route('/', methods=['GET'])
def list():
runs = utils.serialize_list(Run.query.all())
return jsonify(runs)
@bp.route('/<id>', methods=['GET'])
def get(id):
return jsonify(Run.query.get(id).serialize())
@bp.route('/<id>', methods=['POST'])
def save(id):
run = Run.query.get(id)
run.update(nr=request.json['nr'], suite_id=request.json['suite'])
return ''
# @bp.route('/', methods=['POST'])
# def create():
# run = Run(nr=request.json['nr'])
# run.create()
# return ''
@bp.route('/<id>', methods=['DELETE'])
def delete(id):
run = Run.query.get(id)
# @todo tests
run.delete()
return ''
| 19.756098 | 69 | 0.619753 | 112 | 810 | 4.419643 | 0.3125 | 0.070707 | 0.054545 | 0.09697 | 0.072727 | 0.072727 | 0 | 0 | 0 | 0 | 0 | 0 | 0.17284 | 810 | 40 | 70 | 20.25 | 0.738806 | 0.155556 | 0 | 0.181818 | 0 | 0 | 0.062038 | 0 | 0 | 0 | 0 | 0.025 | 0 | 1 | 0.181818 | false | 0 | 0.181818 | 0.045455 | 0.545455 | 0.090909 | 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 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
7a1912cc0afb4bf8842acf1bceae2a7390e2ca87 | 316 | py | Python | blink/biencoder/special_partition/setup.py | parin1995/claim2fact | 9f928a5789b3dc85cfa69395e0ba02b0b84276a8 | [
"MIT"
] | 8 | 2021-09-08T04:39:31.000Z | 2022-02-10T06:28:36.000Z | blink/biencoder/special_partition/setup.py | parin1995/claim2fact | 9f928a5789b3dc85cfa69395e0ba02b0b84276a8 | [
"MIT"
] | null | null | null | blink/biencoder/special_partition/setup.py | parin1995/claim2fact | 9f928a5789b3dc85cfa69395e0ba02b0b84276a8 | [
"MIT"
] | 2 | 2021-02-23T23:18:13.000Z | 2021-03-31T17:42:28.000Z | from distutils.core import setup, Extension
import Cython
from Cython.Build import cythonize
import numpy
setup(
ext_modules=cythonize("special_partition.pyx"),
include_dirs=[numpy.get_include()]
)
"""
Build instructions:
------------------
> cd special_partition
> python setup.py build_ext --inplace
""" | 19.75 | 51 | 0.721519 | 38 | 316 | 5.842105 | 0.605263 | 0.144144 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126582 | 316 | 16 | 52 | 19.75 | 0.804348 | 0 | 0 | 0 | 0 | 0 | 0.100478 | 0.100478 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
7a1ddea9ea76f2697f8745be73fb2767eef84c9a | 152 | py | Python | LOSTMAX.py | abphilip-codes/Codechef_Practice | 21fd52e03df8a0f72a08b0e2a0b48dbd508aac95 | [
"MIT"
] | 2 | 2021-07-26T03:32:24.000Z | 2021-07-31T02:32:14.000Z | LOSTMAX.py | abphilip-codes/Codechef_Practice | 21fd52e03df8a0f72a08b0e2a0b48dbd508aac95 | [
"MIT"
] | null | null | null | LOSTMAX.py | abphilip-codes/Codechef_Practice | 21fd52e03df8a0f72a08b0e2a0b48dbd508aac95 | [
"MIT"
] | 1 | 2021-07-14T17:45:33.000Z | 2021-07-14T17:45:33.000Z | # https://www.codechef.com/problems/LOSTMAX
for T in range(int(input())):
l=list(map(int,input().split()))
l.remove(len(l)-1)
print(max(l)) | 25.333333 | 43 | 0.625 | 26 | 152 | 3.653846 | 0.807692 | 0.168421 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007634 | 0.138158 | 152 | 6 | 44 | 25.333333 | 0.717557 | 0.269737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 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 | 0 | 0 | 2 |
7a1fc78bd7293ddb6d8365562c43ce5826372f1c | 186 | py | Python | app/handlers/run.py | esert/rabbitlol | e232179f93cb7b3a55395a9789ca41bdfc90ca37 | [
"MIT"
] | 2 | 2016-09-27T23:36:12.000Z | 2019-11-15T23:19:40.000Z | app/handlers/run.py | esert/rabbitlol | e232179f93cb7b3a55395a9789ca41bdfc90ca37 | [
"MIT"
] | null | null | null | app/handlers/run.py | esert/rabbitlol | e232179f93cb7b3a55395a9789ca41bdfc90ca37 | [
"MIT"
] | 5 | 2016-09-30T14:53:45.000Z | 2022-02-19T21:26:24.000Z | from app.routes import RUN
from app.utils import (
Blueprint,
render,
)
blueprint = Blueprint('run', __name__)
@blueprint.route(RUN)
def run():
return render('run.html')
| 13.285714 | 38 | 0.677419 | 24 | 186 | 5.083333 | 0.541667 | 0.114754 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.193548 | 186 | 13 | 39 | 14.307692 | 0.813333 | 0 | 0 | 0 | 0 | 0 | 0.05914 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.222222 | 0.111111 | 0.444444 | 0.333333 | 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 | 0 | 1 | 0 | 0 | 0 | 2 |
e12ffb04db9a29cd3c4b24832490debc7d63bee5 | 1,325 | py | Python | src/spring-cloud/azext_spring_cloud/__init__.py | Mannan2812/azure-cli-extensions | e2b34efe23795f6db9c59100534a40f0813c3d95 | [
"MIT"
] | 207 | 2017-11-29T06:59:41.000Z | 2022-03-31T10:00:53.000Z | src/spring-cloud/azext_spring_cloud/__init__.py | Mannan2812/azure-cli-extensions | e2b34efe23795f6db9c59100534a40f0813c3d95 | [
"MIT"
] | 4,061 | 2017-10-27T23:19:56.000Z | 2022-03-31T23:18:30.000Z | src/spring-cloud/azext_spring_cloud/__init__.py | Mannan2812/azure-cli-extensions | e2b34efe23795f6db9c59100534a40f0813c3d95 | [
"MIT"
] | 802 | 2017-10-11T17:36:26.000Z | 2022-03-31T22:24:32.000Z | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from azure.cli.core import AzCommandsLoader
from azure.cli.core.commands import CliCommandType
from azext_spring_cloud._help import helps # pylint: disable=unused-import
from azext_spring_cloud._client_factory import cf_spring_cloud
from azext_spring_cloud.commands import load_command_table
from azext_spring_cloud._params import load_arguments
class spring_cloudCommandsLoader(AzCommandsLoader):
def __init__(self, cli_ctx=None):
spring_cloud_custom = CliCommandType(
operations_tmpl='azext_spring_cloud.custom#{}',
client_factory=cf_spring_cloud)
super(spring_cloudCommandsLoader, self).__init__(cli_ctx=cli_ctx, custom_command_type=spring_cloud_custom)
def load_command_table(self, args):
load_command_table(self, args)
return self.command_table
def load_arguments(self, command):
load_arguments(self, command)
COMMAND_LOADER_CLS = spring_cloudCommandsLoader
| 41.40625 | 115 | 0.658868 | 142 | 1,325 | 5.78169 | 0.415493 | 0.120585 | 0.097442 | 0.097442 | 0.058465 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.150189 | 1,325 | 31 | 116 | 42.741935 | 0.72913 | 0.276226 | 0 | 0 | 0 | 0 | 0.030369 | 0.030369 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.611111 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
e13e69be94acab77c1c8073f3a1305f3a4afe31b | 427 | py | Python | scripts/python-phoniebox/helpers_unused_atm/helpers.py | Microgenic/RPi-Jukebox-RFID | 187c74ee442b4e068428742b28c81011a32899df | [
"MIT"
] | 3 | 2020-11-22T21:19:30.000Z | 2022-02-12T19:02:50.000Z | scripts/python-phoniebox/helpers_unused_atm/helpers.py | Microgenic/RPi-Jukebox-RFID | 187c74ee442b4e068428742b28c81011a32899df | [
"MIT"
] | null | null | null | scripts/python-phoniebox/helpers_unused_atm/helpers.py | Microgenic/RPi-Jukebox-RFID | 187c74ee442b4e068428742b28c81011a32899df | [
"MIT"
] | 1 | 2019-10-11T08:16:52.000Z | 2019-10-11T08:16:52.000Z | __name__ = "helpers"
def is_int(s):
""" return True if string is an int """
try:
int(s)
return True
except ValueError:
return False
def str2bool(s):
""" convert string to a python boolean """
return s.lower() in ("yes", "true", "t", "1")
def str2num(s):
""" convert string to an int or a float """
try:
return int(s)
except ValueError:
return float(s)
| 20.333333 | 49 | 0.557377 | 59 | 427 | 3.949153 | 0.491525 | 0.051502 | 0.085837 | 0.120172 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010204 | 0.311475 | 427 | 20 | 50 | 21.35 | 0.782313 | 0.24356 | 0 | 0.285714 | 0 | 0 | 0.052805 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
e142732ab572019b67e55cc2c3ad6a3063e591e4 | 1,752 | py | Python | baelfire/core.py | socek/baelfire | 028701bf9da3ac6cbd54342e21681c242d5931e1 | [
"Apache-2.0"
] | null | null | null | baelfire/core.py | socek/baelfire | 028701bf9da3ac6cbd54342e21681c242d5931e1 | [
"Apache-2.0"
] | 1 | 2016-09-15T09:11:57.000Z | 2016-09-15T09:11:57.000Z | baelfire/core.py | socek/baelfire | 028701bf9da3ac6cbd54342e21681c242d5931e1 | [
"Apache-2.0"
] | null | null | null | from morfdict import Paths
from morfdict import StringDict
class TaskInheritance(object):
def __init__(self, base_cls, child_cls, migration=None):
self.base_cls = base_cls
self.child_cls = child_cls
self.migration = migration or self._default_migration
def is_ready_to_migrate(self, task):
return self.base_cls == task.__class__
def migrate(self, task):
return self.migration(task, self.child_cls)
def _default_migration(self, task, child_cls):
return child_cls()
def is_doubled(self, base_cls):
return self.base_cls == base_cls
class Core(object):
def __init__(self):
self.inheritance = []
self.make_task_inheritance()
def init(self):
self.settings = StringDict()
self.paths = Paths()
self.report = {'last_index': 0}
def phase_settings(self):
self.paths.set('jinja_templates', '', is_root=True)
def prepere_task(self, task):
for inheritance in self.inheritance:
if inheritance.is_ready_to_migrate(task):
old_parent = task.parent
task = inheritance.migrate(task)
task.set_parent(old_parent)
return task
return task
def make_task_inheritance(self):
pass
def add_task_inheritance(self, base_cls, child_cls, migration=None):
self._remove_old_inheritance(base_cls)
self.inheritance.append(
TaskInheritance(base_cls, child_cls, migration))
def _remove_old_inheritance(self, base_cls):
for inheritance in list(self.inheritance):
if inheritance.is_doubled(base_cls):
self.inheritance.remove(inheritance)
return
| 28.721311 | 72 | 0.64726 | 211 | 1,752 | 5.07109 | 0.236967 | 0.078505 | 0.071963 | 0.042056 | 0.22243 | 0.06729 | 0.06729 | 0.06729 | 0 | 0 | 0 | 0.000779 | 0.267694 | 1,752 | 60 | 73 | 29.2 | 0.833203 | 0 | 0 | 0.045455 | 0 | 0 | 0.014269 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0.022727 | 0.045455 | 0.090909 | 0.522727 | 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 | 0 | 1 | 0 | 0 | 2 |
e1461fc5a7e9d6ab737649d3e5c81bab16043eac | 9,798 | py | Python | sdk/python/pulumi_scaleway/__init__.py | stack72/pulumi-scaleway | 0242d1f058046f86fe4ea6f106872ecd08d10c3b | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_scaleway/__init__.py | stack72/pulumi-scaleway | 0242d1f058046f86fe4ea6f106872ecd08d10c3b | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_scaleway/__init__.py | stack72/pulumi-scaleway | 0242d1f058046f86fe4ea6f106872ecd08d10c3b | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from . import _utilities
import typing
# Export this package's modules as members:
from .account_ssh_key import *
from .apple_slicon_valley_server import *
from .baremetal_server import *
from .database import *
from .database_acl import *
from .database_instance import *
from .database_privilege import *
from .database_user import *
from .domain_record import *
from .get_account_ssh_key import *
from .get_baremetal_offer import *
from .get_database import *
from .get_database_acl import *
from .get_database_instance import *
from .get_database_privilege import *
from .get_domain_record import *
from .get_instance_image import *
from .get_instance_ip import *
from .get_instance_security_group import *
from .get_instance_server import *
from .get_instance_volume import *
from .get_kubernetes_cluster import *
from .get_kubernetes_node_pool import *
from .get_loadbalancer import *
from .get_loadbalancer_ip import *
from .get_marketplace_image import *
from .get_registry_image import *
from .get_registry_namespace import *
from .get_vpc_private_network import *
from .get_vpc_public_gateway import *
from .get_vpc_public_gateway_dhcp import *
from .get_vpc_public_gateway_ip import *
from .instance_ip import *
from .instance_ip_reverse_dns import *
from .instance_placement_group import *
from .instance_private_nic import *
from .instance_security_group import *
from .instance_security_group_rules import *
from .instance_server import *
from .instance_snapshot import *
from .instance_volume import *
from .iot_device import *
from .iot_hub import *
from .iot_network import *
from .iot_route import *
from .kubernetes_cluster import *
from .kubernetes_node_pool import *
from .loadbalancer import *
from .loadbalancer_backend import *
from .loadbalancer_certificate import *
from .loadbalancer_frontend import *
from .loadbalancer_ip import *
from .loadbalancer_route import *
from .object_bucket import *
from .provider import *
from .registry_namespace import *
from .vpc_gateway_network import *
from .vpc_private_network import *
from .vpc_public_gateway import *
from .vpc_public_gateway_dhcp import *
from .vpc_public_gateway_ip import *
from .vpc_public_gateway_pat_rule import *
from ._inputs import *
from . import outputs
# Make subpackages available:
if typing.TYPE_CHECKING:
import pulumi_scaleway.config as __config
config = __config
else:
config = _utilities.lazy_import('pulumi_scaleway.config')
_utilities.register(
resource_modules="""
[
{
"pkg": "scaleway",
"mod": "index/accountSshKey",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/accountSshKey:AccountSshKey": "AccountSshKey"
}
},
{
"pkg": "scaleway",
"mod": "index/appleSliconValleyServer",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/appleSliconValleyServer:AppleSliconValleyServer": "AppleSliconValleyServer"
}
},
{
"pkg": "scaleway",
"mod": "index/baremetalServer",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/baremetalServer:BaremetalServer": "BaremetalServer"
}
},
{
"pkg": "scaleway",
"mod": "index/database",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/database:Database": "Database"
}
},
{
"pkg": "scaleway",
"mod": "index/databaseAcl",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/databaseAcl:DatabaseAcl": "DatabaseAcl"
}
},
{
"pkg": "scaleway",
"mod": "index/databaseInstance",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/databaseInstance:DatabaseInstance": "DatabaseInstance"
}
},
{
"pkg": "scaleway",
"mod": "index/databasePrivilege",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/databasePrivilege:DatabasePrivilege": "DatabasePrivilege"
}
},
{
"pkg": "scaleway",
"mod": "index/databaseUser",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/databaseUser:DatabaseUser": "DatabaseUser"
}
},
{
"pkg": "scaleway",
"mod": "index/domainRecord",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/domainRecord:DomainRecord": "DomainRecord"
}
},
{
"pkg": "scaleway",
"mod": "index/instanceIp",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/instanceIp:InstanceIp": "InstanceIp"
}
},
{
"pkg": "scaleway",
"mod": "index/instanceIpReverseDns",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/instanceIpReverseDns:InstanceIpReverseDns": "InstanceIpReverseDns"
}
},
{
"pkg": "scaleway",
"mod": "index/instancePlacementGroup",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/instancePlacementGroup:InstancePlacementGroup": "InstancePlacementGroup"
}
},
{
"pkg": "scaleway",
"mod": "index/instancePrivateNic",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/instancePrivateNic:InstancePrivateNic": "InstancePrivateNic"
}
},
{
"pkg": "scaleway",
"mod": "index/instanceSecurityGroup",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/instanceSecurityGroup:InstanceSecurityGroup": "InstanceSecurityGroup"
}
},
{
"pkg": "scaleway",
"mod": "index/instanceSecurityGroupRules",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/instanceSecurityGroupRules:InstanceSecurityGroupRules": "InstanceSecurityGroupRules"
}
},
{
"pkg": "scaleway",
"mod": "index/instanceServer",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/instanceServer:InstanceServer": "InstanceServer"
}
},
{
"pkg": "scaleway",
"mod": "index/instanceSnapshot",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/instanceSnapshot:InstanceSnapshot": "InstanceSnapshot"
}
},
{
"pkg": "scaleway",
"mod": "index/instanceVolume",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/instanceVolume:InstanceVolume": "InstanceVolume"
}
},
{
"pkg": "scaleway",
"mod": "index/iotDevice",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/iotDevice:IotDevice": "IotDevice"
}
},
{
"pkg": "scaleway",
"mod": "index/iotHub",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/iotHub:IotHub": "IotHub"
}
},
{
"pkg": "scaleway",
"mod": "index/iotNetwork",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/iotNetwork:IotNetwork": "IotNetwork"
}
},
{
"pkg": "scaleway",
"mod": "index/iotRoute",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/iotRoute:IotRoute": "IotRoute"
}
},
{
"pkg": "scaleway",
"mod": "index/kubernetesCluster",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/kubernetesCluster:KubernetesCluster": "KubernetesCluster"
}
},
{
"pkg": "scaleway",
"mod": "index/kubernetesNodePool",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/kubernetesNodePool:KubernetesNodePool": "KubernetesNodePool"
}
},
{
"pkg": "scaleway",
"mod": "index/loadbalancer",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/loadbalancer:Loadbalancer": "Loadbalancer"
}
},
{
"pkg": "scaleway",
"mod": "index/loadbalancerBackend",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/loadbalancerBackend:LoadbalancerBackend": "LoadbalancerBackend"
}
},
{
"pkg": "scaleway",
"mod": "index/loadbalancerCertificate",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/loadbalancerCertificate:LoadbalancerCertificate": "LoadbalancerCertificate"
}
},
{
"pkg": "scaleway",
"mod": "index/loadbalancerFrontend",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/loadbalancerFrontend:LoadbalancerFrontend": "LoadbalancerFrontend"
}
},
{
"pkg": "scaleway",
"mod": "index/loadbalancerIp",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/loadbalancerIp:LoadbalancerIp": "LoadbalancerIp"
}
},
{
"pkg": "scaleway",
"mod": "index/loadbalancerRoute",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/loadbalancerRoute:LoadbalancerRoute": "LoadbalancerRoute"
}
},
{
"pkg": "scaleway",
"mod": "index/objectBucket",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/objectBucket:ObjectBucket": "ObjectBucket"
}
},
{
"pkg": "scaleway",
"mod": "index/registryNamespace",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/registryNamespace:RegistryNamespace": "RegistryNamespace"
}
},
{
"pkg": "scaleway",
"mod": "index/vpcGatewayNetwork",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/vpcGatewayNetwork:VpcGatewayNetwork": "VpcGatewayNetwork"
}
},
{
"pkg": "scaleway",
"mod": "index/vpcPrivateNetwork",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/vpcPrivateNetwork:VpcPrivateNetwork": "VpcPrivateNetwork"
}
},
{
"pkg": "scaleway",
"mod": "index/vpcPublicGateway",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/vpcPublicGateway:VpcPublicGateway": "VpcPublicGateway"
}
},
{
"pkg": "scaleway",
"mod": "index/vpcPublicGatewayDhcp",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/vpcPublicGatewayDhcp:VpcPublicGatewayDhcp": "VpcPublicGatewayDhcp"
}
},
{
"pkg": "scaleway",
"mod": "index/vpcPublicGatewayIp",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/vpcPublicGatewayIp:VpcPublicGatewayIp": "VpcPublicGatewayIp"
}
},
{
"pkg": "scaleway",
"mod": "index/vpcPublicGatewayPatRule",
"fqn": "pulumi_scaleway",
"classes": {
"scaleway:index/vpcPublicGatewayPatRule:VpcPublicGatewayPatRule": "VpcPublicGatewayPatRule"
}
}
]
""",
resource_packages="""
[
{
"pkg": "scaleway",
"token": "pulumi:providers:scaleway",
"fqn": "pulumi_scaleway",
"class": "Provider"
}
]
"""
)
| 24.495 | 103 | 0.69555 | 916 | 9,798 | 7.262009 | 0.163755 | 0.094708 | 0.099669 | 0.108539 | 0.297655 | 0.235568 | 0 | 0 | 0 | 0 | 0 | 0.00012 | 0.146663 | 9,798 | 399 | 104 | 24.556391 | 0.795479 | 0.025209 | 0 | 0.296675 | 1 | 0 | 0.745102 | 0.317339 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.173913 | 0 | 0.173913 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e14c3c2dce9a7346ab7612701cdab5b131f10905 | 218 | py | Python | misc/talk.py | semillero-obsolescencia/criticon | 4d59864de0af7e47f3d84a4a2c8b7d58635a3862 | [
"MIT"
] | null | null | null | misc/talk.py | semillero-obsolescencia/criticon | 4d59864de0af7e47f3d84a4a2c8b7d58635a3862 | [
"MIT"
] | null | null | null | misc/talk.py | semillero-obsolescencia/criticon | 4d59864de0af7e47f3d84a4a2c8b7d58635a3862 | [
"MIT"
] | null | null | null | #coding:utf-8
import sys
import festival
print("talking")
festival.execCommand("(voice_el_diphone)")
string = unicode("Hola mundo, esta es una prueba del criticon, con una canción", "ascii")
festival.sayText(string)
| 21.8 | 89 | 0.766055 | 31 | 218 | 5.322581 | 0.83871 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005155 | 0.110092 | 218 | 9 | 90 | 24.222222 | 0.845361 | 0.055046 | 0 | 0 | 0 | 0 | 0.439024 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.166667 | 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 | 0 | 0 | 0 | 2 |
e16692683aa1860ed2002bfb06f2c29ba35794e2 | 7,752 | py | Python | tamil/txt2unicode/unicode2encode.py | nv-d/open-tamil | 0fcb1cece5ffd6263210db987bede09566353e80 | [
"MIT"
] | 2 | 2021-07-17T02:52:38.000Z | 2021-07-17T02:52:52.000Z | tamil/txt2unicode/unicode2encode.py | nv-d/open-tamil | 0fcb1cece5ffd6263210db987bede09566353e80 | [
"MIT"
] | null | null | null | tamil/txt2unicode/unicode2encode.py | nv-d/open-tamil | 0fcb1cece5ffd6263210db987bede09566353e80 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
##############################################################################
# #
# (C) 2014 Arulalan.T <arulalant@gmail.com> #
# #
# Author : Arulalan.T <arulalant@gmail.com> #
# Date : 04.08.2014 #
# #
# This file is part of open-tamil/txt2uni #
# #
# txt2unicode is free software: you can redistribute it and/or #
# modify it under the terms of the GNU General Public License as published by#
# the Free Software Foundation, either version 3 of the License, or (at your #
# option) any later version. This program is distributed in the hope that it #
# will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty#
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General#
# Public License for more details. You should have received a copy of the GNU#
# General Public License along with this program. If not, see #
# <http://www.gnu.org/licenses/>. #
# #
##############################################################################
from .encode2utf8 import (
anjal2utf8,
bamini2utf8,
boomi2utf8,
dinakaran2utf8,
dinamani2utf8,
dinathanthy2utf8,
kavipriya2utf8,
murasoli2utf8,
mylai2utf8,
nakkeeran2utf8,
roman2utf8,
tab2utf8,
tam2utf8,
tscii2utf8,
pallavar2utf8,
indoweb2utf8,
koeln2utf8,
libi2utf8,
oldvikatan2utf8,
webulagam2utf8,
diacritic2utf8,
shreelipi2utf8,
softview2utf8,
tace2utf8,
vanavil2utf8,
indica2utf8,
anu2utf8,
shreelipiavid2utf8,
)
from .encode2unicode import _all_encodes_, _get_unique_ch, _get_unique_common_encodes
__all__ = [
"unicode2anjal",
"unicode2bamini",
"unicode2boomi",
"unicode2dinakaran",
"unicode2dinathanthy",
"unicode2kavipriya",
"unicode2murasoli",
"unicode2mylai",
"unicode2nakkeeran",
"unicode2roman",
"unicode2tab",
"unicode2tam",
"unicode2tscii",
"unicode2indoweb",
"unicode2koeln",
"unicode2libi",
"unicode2oldvikatan",
"unicode2webulagam",
"unicode2auto",
"unicode2dinamani",
"unicode2pallavar",
"unicode2diacritic",
"unicode2shreelipi",
"unicode2softview",
"unicode2tace",
"unicode2vanavil",
"unicode2indica",
"unicode2anu",
"unicode2shreelipiavid",
]
def unicode2encode(text, charmap):
"""
charmap : dictionary which has both encode as key, unicode as value
"""
if isinstance(text, (list, tuple)):
unitxt = ""
for line in text:
for val, key in charmap.items():
if key in line:
line = line.replace(key, val)
# end of if val in text:
unitxt += line
# end of for line in text:
return unitxt
elif isinstance(text, str):
for val, key in charmap.items():
if key in text:
text = text.replace(key, val)
return text
def unicode2anjal(text):
return unicode2encode(text, anjal2utf8)
def unicode2bamini(text):
return unicode2encode(text, bamini2utf8)
def unicode2boomi(text):
return unicode2encode(text, boomi2utf8)
def unicode2dinakaran(text):
return unicode2encode(text, dinakaran2utf8)
def unicode2dinamani(text):
return unicode2encode(text, dinamani2utf8)
def unicode2dinathanthy(text):
return unicode2encode(text, dinathanthy2utf8)
def unicode2kavipriya(text):
return unicode2encode(text, kavipriya2utf8)
def unicode2murasoli(text):
return unicode2encode(text, murasoli2utf8)
def unicode2mylai(text):
return unicode2encode(text, mylai2utf8)
def unicode2nakkeeran(text):
return unicode2encode(text, nakkeeran2utf8)
def unicode2roman(text):
return unicode2encode(text, roman2utf8)
def unicode2tab(text):
return unicode2encode(text, tab2utf8)
def unicode2tam(text):
return unicode2encode(text, tam2utf8)
def unicode2tscii(text):
return unicode2encode(text, tscii2utf8)
def unicode2pallavar(text):
return unicode2encode(text, pallavar2utf8)
def unicode2indoweb(text):
return unicode2encode(text, indoweb2utf8)
def unicode2koeln(text):
return unicode2encode(text, koeln2utf8)
def unicode2libi(text):
return unicode2encode(text, libi2utf8)
def unicode2oldvikatan(text):
return unicode2encode(text, oldvikatan2utf8)
def unicode2webulagam(text):
return unicode2encode(text, webulagam2utf8)
def unicode2diacritic(text):
return unicode2encode(text, diacritic2utf8)
def unicode2shreelipi(text):
return unicode2encode(text, shreelipi2utf8)
def unicode2softview(text):
return unicode2encode(text, softview2utf8)
def unicode2tace(text):
return unicode2encode(text, tace2utf8)
def unicode2vanavil(text):
return unicode2encode(text, vanavil2utf8)
def unicode2indica(text):
return unicode2encode(text, indica2utf8)
def unicode2anu(text):
return unicode2encode(text, anu2utf8)
def unicode2shreelipiavid(text):
return unicode2encode(text, shreelipiavid2utf8)
def unicode2auto(unicode_text, encode_text):
"""
This function will convert unicode (first argument) text into other
encodes by auto find the encode (from available encodes) by using sample
encode text in second argument of this function.
unicode_text : Pass unicode string which has to convert into other encode.
encode_text : Pass sample encode string to identify suitable encode for it.
This function tries to identify encode in available encodings.
If it finds, then it will convert unicode_text into encode string.
Author : Arulalan.T
08.08.2014
"""
_all_unique_encodes_, _all_common_encodes_ = _get_unique_common_encodes()
# get unique word which falls under any one of available encodes from
# user passed text lines
unique_chars = _get_unique_ch(encode_text, _all_common_encodes_)
# count common encode chars
clen = len(_all_common_encodes_)
msg = "Sorry, couldn't find encode :-(\n"
msg += "Need more words to find unique encode out side of %d " % clen
msg += "common compound characters"
if not unique_chars:
print(msg)
return ""
# end of if not unique_chars:
for encode_name, encode_keys in _all_unique_encodes_:
if not len(encode_keys):
continue
for ch in encode_keys:
# check either encode char is presnent in word
if ch in unique_chars:
# found encode
print(("Found encode : ", encode_name))
encode = _all_encodes_[encode_name]
return unicode2encode(unicode_text, encode)
# end of if ch in unique_chars:
# end of ifor ch in encode_keys:
else:
print(msg)
return ""
# end of for encode in _all_unique_encodes_:
# end of def auto2unicode(text):
| 28.291971 | 86 | 0.599974 | 731 | 7,752 | 6.270862 | 0.318741 | 0.113874 | 0.146597 | 0.17103 | 0.058028 | 0.025305 | 0.013089 | 0.013089 | 0.013089 | 0 | 0 | 0.042625 | 0.309985 | 7,752 | 273 | 87 | 28.395604 | 0.814358 | 0.305728 | 0 | 0.039216 | 0 | 0 | 0.114876 | 0.004339 | 0 | 0 | 0 | 0 | 0 | 1 | 0.196078 | false | 0 | 0.013072 | 0.183007 | 0.424837 | 0.019608 | 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 | 0 | 0 | 0 | 2 |
e167d796b1b20c72d85596f36596ee61e3e6effd | 454 | py | Python | core/views.py | it-teaching-abo-akademi/webshop-project-arnelimperial | 98fc7bd8ce031a50c0bd83a6c5c48ed93030e528 | [
"Unlicense"
] | null | null | null | core/views.py | it-teaching-abo-akademi/webshop-project-arnelimperial | 98fc7bd8ce031a50c0bd83a6c5c48ed93030e528 | [
"Unlicense"
] | null | null | null | core/views.py | it-teaching-abo-akademi/webshop-project-arnelimperial | 98fc7bd8ce031a50c0bd83a6c5c48ed93030e528 | [
"Unlicense"
] | null | null | null | from django.shortcuts import render
from django.views.generic.base import TemplateView
#from django.shortcuts import HttpResponseRedirect, redirect
#from django.views.decorators.cache import never_cache
#from django.urls import reverse
from django.conf import settings
class IndexTemplateView(TemplateView):
def get_template_names(self):
template_name = "index.html"
return template_name
client_view = IndexTemplateView.as_view()
| 28.375 | 60 | 0.803965 | 56 | 454 | 6.392857 | 0.571429 | 0.167598 | 0.106145 | 0.139665 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134361 | 454 | 15 | 61 | 30.266667 | 0.910941 | 0.314978 | 0 | 0 | 0 | 0 | 0.032573 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.375 | 0 | 0.75 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
e168d14c0882d540eba4dc5084d819196d44857e | 646 | py | Python | issmap.py | alberand/issmap | 13a848df10497db764807305e87816f15b9bca50 | [
"MIT"
] | null | null | null | issmap.py | alberand/issmap | 13a848df10497db764807305e87816f15b9bca50 | [
"MIT"
] | 6 | 2018-08-16T06:14:39.000Z | 2020-08-02T16:56:10.000Z | issmap.py | alberand/issmap | 13a848df10497db764807305e87816f15b9bca50 | [
"MIT"
] | null | null | null | import json
import os
from uwsgidecorators import *
from flask import Flask, render_template
from api import Source
app = Flask(__name__)
src = Source()
@timer(3)
def update_coordinates(num):
src.update_coordinates()
@timer(10800)
def update_people(num):
src.update_people()
@app.route("/")
def main():
return render_template('index.html', data=src.get_iss_info())
@app.route("/issfullinfo")
def get_iss_full_info():
return json.dumps(src.get_iss_info())
@app.route("/people")
def get_people_in_space():
return json.dumps(src.get_people())
if __name__ == "__main__":
app.run(host=os.environ['ISSMAP_DEMO_HOST'])
| 18.457143 | 65 | 0.724458 | 94 | 646 | 4.648936 | 0.43617 | 0.05492 | 0.05492 | 0.059497 | 0.17849 | 0.09611 | 0 | 0 | 0 | 0 | 0 | 0.010714 | 0.133127 | 646 | 34 | 66 | 19 | 0.769643 | 0 | 0 | 0 | 0 | 0 | 0.083591 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.208333 | false | 0 | 0.208333 | 0.125 | 0.541667 | 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 | 0 | 0 | 0 | 2 |
e1772b4c772ae120dd02f4d8f22e4ba464639ab6 | 881 | py | Python | tests/providers.py | GarrettHeel/foauth.org | f550f11c61ab0d9ec75d9a512fa9665db7a20087 | [
"BSD-3-Clause"
] | null | null | null | tests/providers.py | GarrettHeel/foauth.org | f550f11c61ab0d9ec75d9a512fa9665db7a20087 | [
"BSD-3-Clause"
] | null | null | null | tests/providers.py | GarrettHeel/foauth.org | f550f11c61ab0d9ec75d9a512fa9665db7a20087 | [
"BSD-3-Clause"
] | null | null | null | import unittest
import foauth.providers
import urllib
class ProviderTests(unittest.TestCase):
def setUp(self):
class Example(foauth.providers.OAuth):
provider_url = 'http://example.com'
api_domain = 'api.example.com'
self.provider = Example
def test_auto_name(self):
self.assertEqual(self.provider.name, 'Example')
def test_auto_alias(self):
self.assertEqual(self.provider.alias, 'example')
def test_auto_favicon_url(self):
primary = 'https://getfavicon.appspot.com/http://example.com'
backup = 'https://www.google.com/s2/favicons?domain=example.com'
url = '%s?defaulticon=%s' % (primary, urllib.quote(backup))
self.assertEqual(self.provider.favicon_url, url)
def test_auto_api_domains(self):
self.assertEqual(self.provider.api_domains, ['api.example.com'])
| 31.464286 | 72 | 0.676504 | 108 | 881 | 5.388889 | 0.351852 | 0.085911 | 0.075601 | 0.185567 | 0.159794 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00141 | 0.195233 | 881 | 27 | 73 | 32.62963 | 0.819464 | 0 | 0 | 0 | 0 | 0 | 0.205448 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.25 | false | 0 | 0.15 | 0 | 0.5 | 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 | 0 | 0 | 0 | 0 | 2 |
e194fd2cc542d6bf91c910a109ea5b6e0ea5e70a | 359 | py | Python | sbpy/spectroscopy/tests/test_spec.py | dirac-institute/sbpy | 9eb0523610f497ba2d068a071aae05ebfd67ed9d | [
"BSD-3-Clause"
] | 47 | 2018-07-26T04:21:51.000Z | 2022-03-07T16:23:02.000Z | sbpy/spectroscopy/tests/test_spec.py | dirac-institute/sbpy | 9eb0523610f497ba2d068a071aae05ebfd67ed9d | [
"BSD-3-Clause"
] | 253 | 2018-07-24T12:12:57.000Z | 2022-03-13T21:59:52.000Z | sbpy/spectroscopy/tests/test_spec.py | dirac-institute/sbpy | 9eb0523610f497ba2d068a071aae05ebfd67ed9d | [
"BSD-3-Clause"
] | 27 | 2018-07-20T05:25:44.000Z | 2022-03-01T03:29:30.000Z | import os
def data_path(filename):
data_dir = os.path.join(os.path.dirname(__file__), 'data')
return os.path.join(data_dir, filename)
class MockResponseSpec(object):
def __init__(self, filename):
self.filename = data_path(filename)
@property
def text(self):
with open(self.filename) as f:
return f.read()
| 19.944444 | 62 | 0.654596 | 48 | 359 | 4.645833 | 0.479167 | 0.080717 | 0.143498 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.228412 | 359 | 17 | 63 | 21.117647 | 0.805054 | 0 | 0 | 0 | 0 | 0 | 0.011142 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.090909 | 0 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
e1a2239837d3963bd1cc2f70baf44a02ec86f6ce | 1,347 | py | Python | kik_unofficial/datatypes/exceptions.py | aspwil/kik-bot-api-unofficial | bc6fc93492690044c705d51e59eaa3401d260a6a | [
"MIT"
] | 120 | 2017-07-07T14:07:14.000Z | 2022-02-22T03:14:23.000Z | kik_unofficial/datatypes/exceptions.py | TheGreatCodeholio/kik-bot-api-unofficial | c1f02b735dcb3e1d1b5e29a1ca04dd2f66557248 | [
"MIT"
] | 173 | 2017-07-07T04:31:19.000Z | 2021-11-20T02:59:20.000Z | kik_unofficial/datatypes/exceptions.py | TheGreatCodeholio/kik-bot-api-unofficial | c1f02b735dcb3e1d1b5e29a1ca04dd2f66557248 | [
"MIT"
] | 101 | 2017-07-11T19:43:17.000Z | 2022-03-03T02:04:05.000Z | class KikErrorException(Exception):
def __init__(self, xml_error, message=None):
self.message = message
self.xml_error = xml_error
def __str__(self):
return self.__repr__()
def __repr__(self):
if self.message is not None:
return self.message
else:
if "prettify" in dict(self.xml_error):
error_string = self.xml_error.prettify()
else:
error_string = self.xml_error
return "Kik error: \r\n" + error_string
class KikCaptchaException(KikErrorException):
def __init__(self, xml_error, message, captcha_url):
super().__init__(xml_error, message)
self.captcha_url = captcha_url
class KikLoginException(KikErrorException):
pass
class KikInvalidAckException(KikErrorException):
pass
class KikEmptyResponseException(KikErrorException):
pass
class KikApiException(Exception):
pass
class KikParsingException(Exception):
pass
class KikUploadError(Exception):
def __init__(self, status_code, reason=None):
self.status_code = reason
self.reason = reason
def __str__(self):
return self.__repr__()
def __repr__(self):
if self.reason is None:
return self.status_code
return f"[{self.status_code}] {self.reason}"
| 23.631579 | 56 | 0.656273 | 146 | 1,347 | 5.657534 | 0.267123 | 0.077482 | 0.087167 | 0.048426 | 0.217918 | 0.162228 | 0.099274 | 0.099274 | 0.099274 | 0.099274 | 0 | 0 | 0.259837 | 1,347 | 56 | 57 | 24.053571 | 0.828485 | 0 | 0 | 0.333333 | 0 | 0 | 0.042316 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.179487 | false | 0.128205 | 0 | 0.051282 | 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 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
e1a8dba175d09ff4e05a0acf4c2b16ef6bb3ee1b | 1,168 | py | Python | office365/planner/planner_user.py | theodoriss/Office365-REST-Python-Client | 3bd7a62dadcd3f0a0aceeaff7584fff3fd44886e | [
"MIT"
] | 544 | 2016-08-04T17:10:16.000Z | 2022-03-31T07:17:20.000Z | office365/planner/planner_user.py | theodoriss/Office365-REST-Python-Client | 3bd7a62dadcd3f0a0aceeaff7584fff3fd44886e | [
"MIT"
] | 438 | 2016-10-11T12:24:22.000Z | 2022-03-31T19:30:35.000Z | office365/planner/planner_user.py | theodoriss/Office365-REST-Python-Client | 3bd7a62dadcd3f0a0aceeaff7584fff3fd44886e | [
"MIT"
] | 202 | 2016-08-22T19:29:40.000Z | 2022-03-30T20:26:15.000Z | from office365.entity import Entity
from office365.entity_collection import EntityCollection
from office365.planner.plans.plan import PlannerPlan
from office365.planner.tasks.task import PlannerTask
from office365.runtime.paths.resource_path import ResourcePath
class PlannerUser(Entity):
"""The plannerUser resource provide access to Planner resources for a user.
It doesn't contain any usable properties."""
@property
def plans(self):
"""Read-only. Nullable. Returns the plannerTasks assigned to the user.
:rtype: EntityCollection
"""
return self.get_property('plans',
EntityCollection(self.context, PlannerPlan,
ResourcePath("plans", self.resource_path)))
@property
def tasks(self):
"""Read-only. Nullable. Returns the plannerTasks assigned to the user.
:rtype: EntityCollection
"""
return self.get_property('tasks',
EntityCollection(self.context, PlannerTask,
ResourcePath("tasks", self.resource_path)))
| 37.677419 | 93 | 0.631849 | 114 | 1,168 | 6.421053 | 0.421053 | 0.088798 | 0.051913 | 0.054645 | 0.275956 | 0.275956 | 0.275956 | 0.275956 | 0.275956 | 0.275956 | 0 | 0.018138 | 0.291952 | 1,168 | 30 | 94 | 38.933333 | 0.866989 | 0.258562 | 0 | 0.125 | 0 | 0 | 0.024631 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.3125 | 0 | 0.625 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
e1ae44b7386fbf129afb5a18d8da877a01a191e9 | 2,770 | py | Python | tests/test_encode.py | dveselov/beretta | b33ae0f22b916039ac5a8282c8db11811a885b8e | [
"MIT"
] | 2 | 2015-10-26T15:20:44.000Z | 2016-01-27T17:49:18.000Z | tests/test_encode.py | tyrannosaurus/beretta | b33ae0f22b916039ac5a8282c8db11811a885b8e | [
"MIT"
] | null | null | null | tests/test_encode.py | tyrannosaurus/beretta | b33ae0f22b916039ac5a8282c8db11811a885b8e | [
"MIT"
] | null | null | null | import re
import beretta
import unittest
import datetime
class EncodeTestCase(unittest.TestCase):
def test_encode_compressed(self):
bytes = beretta.encode((':call', 'Module', 'function', []) * 4, compressed=6)
self.assertTrue(bytes.startswith(b'\x83P'))
def test_encode_tuple(self):
bytes = beretta.encode((':call', 'Module', 'function', [True]))
self.assertEqual(bytes, b'\x83h\x04d\x00\x04callm\x00\x00\x00'
b'\x06Modulem\x00\x00\x00\x08functionl'
b'\x00\x00\x00\x01h\x02d\x00\x04bertd'
b'\x00\x04truej')
def test_encode_list(self):
bytes = beretta.encode([1, 2, False])
self.assertEqual(bytes, b'\x83l\x00\x00\x00\x03a\x01a\x02h\x02d'
b'\x00\x04bertd\x00\x05falsej')
def test_encode_empty_list(self):
bytes = beretta.encode([])
self.assertEqual(bytes, b'\x83h\x02d\x00\x04bertd\x00\x03nil')
def test_encode_true(self):
bytes = beretta.encode(True)
self.assertEqual(bytes, b'\x83h\x02d\x00\x04bertd\x00\x04true')
def test_encode_false(self):
bytes = beretta.encode(False)
self.assertEqual(bytes, b'\x83h\x02d\x00\x04bertd\x00\x05false')
def test_encode_none(self):
bytes = beretta.encode(None)
self.assertEqual(bytes, b'\x83h\x02d\x00\x04bertd\x00\tundefined')
def test_encode_dict(self):
bytes = beretta.encode({'key': 'value'})
self.assertEqual(bytes, b'\x83h\x03d\x00\x04bertd\x00\x04dictl'
b'\x00\x00\x00\x01h\x02m\x00\x00\x00\x03'
b'keym\x00\x00\x00\x05valuej')
def test_encode_empty_dict(self):
bytes = beretta.encode({})
self.assertEqual(bytes, b'\x83h\x03d\x00\x04bertd\x00\x04dictj')
def test_encode_datetime(self):
bytes = beretta.encode(datetime.datetime(2014, 2, 10, 6, 2, 51, 36215))
self.assertEqual(bytes, b'\x83h\x05d\x00\x04bertd\x00\x04timeb'
b'\x00\x00\x05pb\x00\x00/\x8bb\x00\x00\x8dw')
def test_encode_0(self):
bytes = beretta.encode(0)
self.assertEqual(bytes, b'\x83a\x00')
def test_encode_1(self):
bytes = beretta.encode(1)
self.assertEqual(bytes, b'\x83a\x01')
def test_encode_0_float(self):
bytes = beretta.encode(0.0)
self.assertEqual(bytes, b'\x83c0.00000000000000000000e+00\x00\x00\x00\x00\x00')
def test_encode_regex(self):
regex = re.compile('^(kitty)$', re.I|re.X)
self.assertEqual(regex.pattern, '^(kitty)$')
self.assertIn(regex.flags, (66, 98)) # python 2.x / 66, python 3.x / 98
bytes = beretta.encode(regex)
self.assertEqual(bytes, b'\x83h\x04d\x00\x04bertd\x00\x05regexm\x00\x00\x00\t'
b'^(kitty)$h\x02d\x00\x08extendedd\x00\x08caseless')
| 36.447368 | 83 | 0.648736 | 379 | 2,770 | 4.659631 | 0.248021 | 0.078143 | 0.103058 | 0.161948 | 0.419026 | 0.257078 | 0.252548 | 0.171008 | 0.171008 | 0 | 0 | 0.134771 | 0.19639 | 2,770 | 75 | 84 | 36.933333 | 0.65858 | 0.011552 | 0 | 0 | 0 | 0 | 0.283729 | 0.247166 | 0 | 0 | 0 | 0 | 0.275862 | 1 | 0.241379 | false | 0 | 0.068966 | 0 | 0.327586 | 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 | 0 | 0 | 0 | 0 | 2 |
e1ba72ffff7adb23b1316c1d7aa32d49d4a37871 | 432 | py | Python | database/database.py | generationydev/ATMsimulator | 196a36e201d516060d7efdf3bfcc0fefcd6114db | [
"Apache-2.0"
] | null | null | null | database/database.py | generationydev/ATMsimulator | 196a36e201d516060d7efdf3bfcc0fefcd6114db | [
"Apache-2.0"
] | null | null | null | database/database.py | generationydev/ATMsimulator | 196a36e201d516060d7efdf3bfcc0fefcd6114db | [
"Apache-2.0"
] | null | null | null | import json
class Database:
def __init__(self, data):
self.data = data
def saveData(self):
user_data = {
"name": self.data["name"],
"password": self.data["password"],
"isAuth": self.data["isAuth"],
}
json_objects = json.dumps(user_data, indent= 4)
with open(f"user.{self.data['name']}.json", "w") as file:
file.write(json_objects)
| 22.736842 | 65 | 0.537037 | 51 | 432 | 4.392157 | 0.470588 | 0.214286 | 0.107143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003356 | 0.310185 | 432 | 18 | 66 | 24 | 0.748322 | 0 | 0 | 0 | 0 | 0 | 0.152778 | 0.06713 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0.076923 | 0.076923 | 0 | 0.307692 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e1c87cb768e161b63b5e03ab8c4c1d7b1c9b2d00 | 2,186 | py | Python | saleor/webhook/migrations/0001_initial.py | fairhopeweb/saleor | 9ac6c22652d46ba65a5b894da5f1ba5bec48c019 | [
"CC-BY-4.0"
] | 15,337 | 2015-01-12T02:11:52.000Z | 2021-10-05T19:19:29.000Z | saleor/webhook/migrations/0001_initial.py | fairhopeweb/saleor | 9ac6c22652d46ba65a5b894da5f1ba5bec48c019 | [
"CC-BY-4.0"
] | 7,486 | 2015-02-11T10:52:13.000Z | 2021-10-06T09:37:15.000Z | saleor/webhook/migrations/0001_initial.py | aminziadna/saleor | 2e78fb5bcf8b83a6278af02551a104cfa555a1fb | [
"CC-BY-4.0"
] | 5,864 | 2015-01-16T14:52:54.000Z | 2021-10-05T23:01:15.000Z | # Generated by Django 2.2.4 on 2019-09-26 05:47
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [("account", "0033_serviceaccount")]
operations = [
migrations.CreateModel(
name="Webhook",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("target_url", models.URLField(max_length=255)),
("is_active", models.BooleanField(default=True)),
("secret_key", models.CharField(blank=True, max_length=255, null=True)),
(
"service_account",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="webhooks",
to="account.ServiceAccount",
),
),
],
options={"permissions": (("manage_webhooks", "Manage webhooks"),)},
),
migrations.CreateModel(
name="WebhookEvent",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"event_type",
models.CharField(
db_index=True, max_length=128, verbose_name="Event type"
),
),
(
"webhook",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="events",
to="webhook.Webhook",
),
),
],
),
]
| 31.681159 | 88 | 0.400732 | 149 | 2,186 | 5.731544 | 0.463087 | 0.037471 | 0.04918 | 0.077283 | 0.334895 | 0.334895 | 0.334895 | 0.334895 | 0.334895 | 0.334895 | 0 | 0.025759 | 0.502745 | 2,186 | 68 | 89 | 32.147059 | 0.75989 | 0.020586 | 0 | 0.557377 | 1 | 0 | 0.100982 | 0.010285 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.032787 | 0 | 0.098361 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 2 |
e1c8b125a6d575a360d4b4ee3783fa9d9ec7ca5e | 160 | py | Python | stubs/3.2/fcntl.py | TimSimpsonR/mypy | 5e6fd6335e0662b0477e1d678269f33e6f4194ba | [
"PSF-2.0"
] | 1 | 2019-06-27T11:34:27.000Z | 2019-06-27T11:34:27.000Z | stubs/3.2/fcntl.py | silky/mypy | de6a8d3710df9f49109cb682f2092e4967bfb92c | [
"PSF-2.0"
] | null | null | null | stubs/3.2/fcntl.py | silky/mypy | de6a8d3710df9f49109cb682f2092e4967bfb92c | [
"PSF-2.0"
] | null | null | null | # Stubs for fcntl
# NOTE: These are incomplete!
import typing
FD_CLOEXEC = 0
F_GETFD = 0
F_SETFD = 0
def fcntl(fd: int, op: int, arg: int = 0) -> int: pass
| 13.333333 | 54 | 0.6625 | 29 | 160 | 3.551724 | 0.689655 | 0.038835 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032258 | 0.225 | 160 | 11 | 55 | 14.545455 | 0.798387 | 0.26875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.2 | 0.2 | 0 | 0.4 | 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 | 0 | 0 | 0 | 2 |
e1d07795486d4d61a357b57a980a2225f54362f6 | 8,654 | py | Python | google-ortools-tsp.py | kaushikbar/or | a35ec177b8b5c072c497df6cdb513f451d9d0c0d | [
"CC-BY-3.0"
] | null | null | null | google-ortools-tsp.py | kaushikbar/or | a35ec177b8b5c072c497df6cdb513f451d9d0c0d | [
"CC-BY-3.0"
] | null | null | null | google-ortools-tsp.py | kaushikbar/or | a35ec177b8b5c072c497df6cdb513f451d9d0c0d | [
"CC-BY-3.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 16 14:50:14 2018
@author: Kaushik
"""
'''
# Known symmatric distances
locations = ["New York", "Los Angeles", "Chicago", "Minneapolis", "Denver", "Dallas", "Seattle",
"Boston", "San Francisco", "St. Louis", "Houston", "Phoenix", "Salt Lake City"]
dist_matrix = [
[ 0, 2451, 713, 1018, 1631, 1374, 2408, 213, 2571, 875, 1420, 2145, 1972], # New York
[2451, 0, 1745, 1524, 831, 1240, 959, 2596, 403, 1589, 1374, 357, 579], # Los Angeles
[ 713, 1745, 0, 355, 920, 803, 1737, 851, 1858, 262, 940, 1453, 1260], # Chicago
[1018, 1524, 355, 0, 700, 862, 1395, 1123, 1584, 466, 1056, 1280, 987], # Minneapolis
[1631, 831, 920, 700, 0, 663, 1021, 1769, 949, 796, 879, 586, 371], # Denver
[1374, 1240, 803, 862, 663, 0, 1681, 1551, 1765, 547, 225, 887, 999], # Dallas
[2408, 959, 1737, 1395, 1021, 1681, 0, 2493, 678, 1724, 1891, 1114, 701], # Seattle
[ 213, 2596, 851, 1123, 1769, 1551, 2493, 0, 2699, 1038, 1605, 2300, 2099], # Boston
[2571, 403, 1858, 1584, 949, 1765, 678, 2699, 0, 1744, 1645, 653, 600], # San Francisco
[ 875, 1589, 262, 466, 796, 547, 1724, 1038, 1744, 0, 679, 1272, 1162], # St. Louis
[1420, 1374, 940, 1056, 879, 225, 1891, 1605, 1645, 679, 0, 1017, 1200], # Houston
[2145, 357, 1453, 1280, 586, 887, 1114, 2300, 653, 1272, 1017, 0, 504], # Phoenix
[1972, 579, 1260, 987, 371, 999, 701, 2099, 600, 1162, 1200, 504, 0]] # Salt Lake City
'''
# Locations
def create_data_array():
locations = [[288, 149], [288, 129], [270, 133], [256, 141], [256, 157], [246, 157], [236, 169],
[228, 169], [228, 161], [220, 169], [212, 169], [204, 169], [196, 169], [188, 169], [196, 161],
[188, 145], [172, 145], [164, 145], [156, 145], [148, 145], [140, 145], [148, 169], [164, 169],
[172, 169], [156, 169], [140, 169], [132, 169], [124, 169], [116, 161], [104, 153], [104, 161],
[104, 169], [90, 165], [80, 157], [64, 157], [64, 165], [56, 169], [56, 161], [56, 153], [56, 145],
[56, 137], [56, 129], [56, 121], [40, 121], [40, 129], [40, 137], [40, 145], [40, 153], [40, 161],
[40, 169], [32, 169], [32, 161], [32, 153], [32, 145], [32, 137], [32, 129], [32, 121], [32, 113],
[40, 113], [56, 113], [56, 105], [48, 99], [40, 99], [32, 97], [32, 89], [24, 89], [16, 97],
[16, 109], [8, 109], [8, 97], [8, 89], [8, 81], [8, 73], [8, 65], [8, 57], [16, 57], [8, 49],
[8, 41], [24, 45], [32, 41], [32, 49], [32, 57], [32, 65], [32, 73], [32, 81], [40, 83], [40, 73],
[40, 63], [40, 51], [44, 43], [44, 35], [44, 27], [32, 25], [24, 25], [16, 25], [16, 17], [24, 17],
[32, 17], [44, 11], [56, 9], [56, 17], [56, 25], [56, 33], [56, 41], [64, 41], [72, 41], [72, 49],
[56, 49], [48, 51], [56, 57], [56, 65], [48, 63], [48, 73], [56, 73], [56, 81], [48, 83], [56, 89],
[56, 97], [104, 97], [104, 105], [104, 113], [104, 121], [104, 129], [104, 137], [104, 145],
[116, 145], [124, 145], [132, 145], [132, 137], [140, 137], [148, 137], [156, 137], [164, 137],
[172, 125], [172, 117], [172, 109], [172, 101], [172, 93], [172, 85], [180, 85], [180, 77],
[180, 69], [180, 61], [180, 53], [172, 53], [172, 61], [172, 69], [172, 77], [164, 81], [148, 85],
[124, 85], [124, 93], [124, 109], [124, 125], [124, 117], [124, 101], [104, 89], [104, 81],
[104, 73], [104, 65], [104, 49], [104, 41], [104, 33], [104, 25], [104, 17], [92, 9], [80, 9],
[72, 9], [64, 21], [72, 25], [80, 25], [80, 25], [80, 41], [88, 49], [104, 57], [124, 69],
[124, 77], [132, 81], [140, 65], [132, 61], [124, 61], [124, 53], [124, 45], [124, 37], [124, 29],
[132, 21], [124, 21], [120, 9], [128, 9], [136, 9], [148, 9], [162, 9], [156, 25], [172, 21],
[180, 21], [180, 29], [172, 29], [172, 37], [172, 45], [180, 45], [180, 37], [188, 41], [196, 49],
[204, 57], [212, 65], [220, 73], [228, 69], [228, 77], [236, 77], [236, 69], [236, 61], [228, 61],
[228, 53], [236, 53], [236, 45], [228, 45], [228, 37], [236, 37], [236, 29], [228, 29], [228, 21],
[236, 21], [252, 21], [260, 29], [260, 37], [260, 45], [260, 53], [260, 61], [260, 69], [260, 77],
[276, 77], [276, 69], [276, 61], [276, 53], [284, 53], [284, 61], [284, 69], [284, 77], [284, 85],
[284, 93], [284, 101], [288, 109], [280, 109], [276, 101], [276, 93], [276, 85], [268, 97],
[260, 109], [252, 101], [260, 93], [260, 85], [236, 85], [228, 85], [228, 93], [236, 93],
[236, 101], [228, 101], [228, 109], [228, 117], [228, 125], [220, 125], [212, 117], [204, 109],
[196, 101], [188, 93], [180, 93], [180, 101], [180, 109], [180, 117], [180, 125], [196, 145],
[204, 145], [212, 145], [220, 145], [228, 145], [236, 145], [246, 141], [252, 125], [260, 129],
[280, 133]]
return locations
# Imports
import numpy as np
# from ortools.linear_solver import pywraplp
from ortools.constraint_solver import pywrapcp, routing_enums_pb2
# Euclidean distance between points.
def euclid_distance(x1, y1, x2, y2):
dist = np.sqrt((x1 - x2)**2 + (y1 - y2)**2)
return dist
# Manhattan distance between points.
def manhattan_distance(x1, y1, x2, y2):
dist = abs(x1 - x2) + abs(y1 - y2)
return dist
# Create the distance matrix (symmetric).
def create_distance_matrix(locations, distance_func):
size = len(locations)
dist_matrix = {}
for from_node in range(size):
dist_matrix[from_node] = {}
for to_node in range(size):
x1 = locations[from_node][0]
y1 = locations[from_node][1]
x2 = locations[to_node][0]
y2 = locations[to_node][1]
dist_matrix[from_node][to_node] = distance_func(x1, y1, x2, y2)
return dist_matrix
# Create a callback to calculate distances between cities.
def create_distance_callback(dist_matrix):
# For each pair of nodes
def distance_callback(from_node, to_node):
return int(dist_matrix[from_node][to_node])
return distance_callback
# Set search parameters
def set_search_parameters(guided_local_search=False, timeout=30000):
search_parameters = pywrapcp.RoutingModel.DefaultSearchParameters() # Default
if guided_local_search:
search_parameters.local_search_metaheuristic = (routing_enums_pb2.LocalSearchMetaheuristic.GUIDED_LOCAL_SEARCH) # Guided local search to avoid a local minimum
search_parameters.time_limit_ms = timeout # Need to set a time limit for guided local search
return search_parameters
# Display the solution
def display_solution(assignment, routing):
# Solution cost.
print("\nMinimum total distance found: " + str(assignment.ObjectiveValue()) + " miles\n")
# Display the routes
for vehicle_number in range(routing.vehicles()):
print("\nBest route found for vehicle ", vehicle_number, ":\n")
node = routing.Start(vehicle_number) # Index of the variable for the starting node.
route = ''
while not routing.IsEnd(node):
# Convert variable indices to node indices in the displayed route.
route += str(locations[routing.IndexToNode(node)]) + ' -> '
node = assignment.Value(routing.NextVar(node))
route += str(locations[routing.IndexToNode(node)])
print(route)
# Wrapper over Google OR Tools
def google_or_wrapper(tsp_size, num_vehicles, depot, locations, dist_matrix):
if tsp_size > 0:
# Create the routing model
routing = pywrapcp.RoutingModel(tsp_size, num_vehicles, depot)
# Set the search parameters
search_parameters = set_search_parameters(True)
# Create the distance callback.
dist_callback = create_distance_callback(dist_matrix)
routing.SetArcCostEvaluatorOfAllVehicles(dist_callback)
# Solve
assignment = routing.SolveWithParameters(search_parameters)
if assignment:
# Display the solution
display_solution(assignment, routing)
else:
print('No solution found.')
else:
print("Specify an instance greater than 0.")
# Main
if __name__ == "__main__":
# Create the data.
locations = create_data_array()
dist_matrix = create_distance_matrix(locations, euclid_distance)
# Initialize parameters
tsp_size = len(locations) # Number of cities.
num_vehicles = 1 # Number of routes (i.e. number of vehicles), which is 1 for a TSP
depot = 0 # Start and end node of the route
# Solve using Google OR Tools
google_or_wrapper(tsp_size, num_vehicles, depot, locations, dist_matrix)
| 50.608187 | 166 | 0.570257 | 1,268 | 8,654 | 3.815457 | 0.268927 | 0.022737 | 0.017569 | 0.004961 | 0.081232 | 0.057875 | 0.023563 | 0.023563 | 0.023563 | 0.023563 | 0 | 0.304282 | 0.230991 | 8,654 | 170 | 167 | 50.905882 | 0.42269 | 0.10862 | 0 | 0.041667 | 0 | 0 | 0.022477 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.09375 | false | 0 | 0.020833 | 0.010417 | 0.1875 | 0.052083 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e1d09b78917d7efa52605a2ccde5ec6b34740ab1 | 911 | py | Python | src/main/python/inline.py | SummitStreet/makestuff | 9d9d1a05b30d5ac0063a657b651c7ad83d4cf1bc | [
"MIT"
] | null | null | null | src/main/python/inline.py | SummitStreet/makestuff | 9d9d1a05b30d5ac0063a657b651c7ad83d4cf1bc | [
"MIT"
] | null | null | null | src/main/python/inline.py | SummitStreet/makestuff | 9d9d1a05b30d5ac0063a657b651c7ad83d4cf1bc | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Converts a Python script into a single line string suitable for use with
python as a program passed in via the -c option.
"""
#** makestuff/src/main/python/inline.py
#pylint: disable=
import codecs
import re
import sys
sys.stdin = codecs.getreader("utf-8")(sys.stdin)
sys.stdout = codecs.getwriter("utf-8")(sys.stdout)
sys.stderr = codecs.getwriter("utf-8")(sys.stderr)
SRC = re.sub(re.compile("#.*?\n|\r|\r\n"), "", sys.stdin.read())
SRC = re.sub(re.compile("\"{3}.*?\"{3}", re.DOTALL), "", SRC)
LINES = [i for i in SRC.splitlines(False) if i]
IMPORTS = [i.split()[1] for i in LINES if i.startswith("import")]
IMPORTS = "" if not IMPORTS else "import " + ", ".join(IMPORTS) + " ; "
LINES = [i for i in LINES if not i.startswith("import")]
CODE = "".join([("" if not i or j[:1].isspace() else " ; ") + j for i, j in enumerate(LINES)])
print IMPORTS + CODE
| 32.535714 | 94 | 0.646542 | 151 | 911 | 3.900662 | 0.443709 | 0.027165 | 0.035654 | 0.064516 | 0.207131 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010296 | 0.147091 | 911 | 27 | 95 | 33.740741 | 0.747748 | 0.105379 | 0 | 0 | 0 | 0 | 0.087977 | 0 | 0.071429 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.5 | null | null | 0.071429 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
becf00906ed33703ebbcc1ccc382252249e9c40b | 1,415 | py | Python | doc/source/conf.py | dongikpark/contrail | 484fb0fdcda1fb84902590f7951720891d21584f | [
"Apache-2.0"
] | null | null | null | doc/source/conf.py | dongikpark/contrail | 484fb0fdcda1fb84902590f7951720891d21584f | [
"Apache-2.0"
] | null | null | null | doc/source/conf.py | dongikpark/contrail | 484fb0fdcda1fb84902590f7951720891d21584f | [
"Apache-2.0"
] | null | null | null | from distutils.version import LooseVersion
from sphinx import __version__ as sphinx_version
mypreamble=ur'''
\renewcommand{\Verbatim}[1][1]{%
% list starts new par, but we don't want it to be set apart vertically
\bgroup\parskip=0pt%
\smallskip%
% The list environement is needed to control perfectly the vertical
% space.
\list{}{%
\setlength\parskip{0pt}%
\setlength\itemsep{0ex}%
\setlength\topsep{0ex}%
\setlength\partopsep{0pt}%
\setlength\leftmargin{10pt}%
}%
\item\MakeFramed {\FrameRestore}%
\small % <---------------- To be changed!
\OriginalVerbatim[#1]%
}
'''
source_suffix = '.rst'
master_doc = 'index'
project = u'Contrail plugin for Fuel'
copyright = u'2015, Mirantis Inc.'
version = '4.0-4.0.0-1'
release = '4.0-4.0.0-1'
pygments_style = 'sphinx'
latex_documents = [
('index','fuel-plugin-contrail-doc.tex',
u'Contrail plugin for Fuel Documentation',
u'Mirantis Inc.', 'manual')
]
# Configuration for the latex/pdf docs.
latex_elements = {
'papersize': 'a4paper',
'pointsize': '11pt',
# remove blank pages
'classoptions': ',openany,oneside',
'babel': '\\usepackage[english]{babel}',
'preamble':mypreamble,
'fontpkg': '\usepackage[T1]{fontenc}'
}
if LooseVersion(sphinx_version) >= LooseVersion('1.3.1'):
html_theme = "sphinx_rtd_theme"
html_add_permalinks = ""
html_show_copyright = False
highlight_language = 'none'
| 23.196721 | 72 | 0.682686 | 176 | 1,415 | 5.380682 | 0.630682 | 0.008448 | 0.031679 | 0.038015 | 0.059134 | 0.012672 | 0 | 0 | 0 | 0 | 0 | 0.027685 | 0.157597 | 1,415 | 60 | 73 | 23.583333 | 0.766779 | 0.039576 | 0 | 0 | 0 | 0 | 0.600295 | 0.191003 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.043478 | null | null | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
bee38f24abc47249d24025e7ba4f6e14fc71c83d | 3,600 | py | Python | google/cloud/lifesciences/v2beta/lifesciences-v2beta-py/google/cloud/lifesciences/__init__.py | googleapis/googleapis-gen | d84824c78563d59b0e58d5664bfaa430e9ad7e7a | [
"Apache-2.0"
] | 7 | 2021-02-21T10:39:41.000Z | 2021-12-07T07:31:28.000Z | google/cloud/lifesciences/v2beta/lifesciences-v2beta-py/google/cloud/lifesciences/__init__.py | googleapis/googleapis-gen | d84824c78563d59b0e58d5664bfaa430e9ad7e7a | [
"Apache-2.0"
] | 6 | 2021-02-02T23:46:11.000Z | 2021-11-15T01:46:02.000Z | google/cloud/lifesciences/v2beta/lifesciences-v2beta-py/google/cloud/lifesciences/__init__.py | googleapis/googleapis-gen | d84824c78563d59b0e58d5664bfaa430e9ad7e7a | [
"Apache-2.0"
] | 4 | 2021-01-28T23:25:45.000Z | 2021-08-30T01:55:16.000Z | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from google.cloud.lifesciences_v2beta.services.workflows_service_v2_beta.client import WorkflowsServiceV2BetaClient
from google.cloud.lifesciences_v2beta.services.workflows_service_v2_beta.async_client import WorkflowsServiceV2BetaAsyncClient
from google.cloud.lifesciences_v2beta.types.workflows import Accelerator
from google.cloud.lifesciences_v2beta.types.workflows import Action
from google.cloud.lifesciences_v2beta.types.workflows import ContainerKilledEvent
from google.cloud.lifesciences_v2beta.types.workflows import ContainerStartedEvent
from google.cloud.lifesciences_v2beta.types.workflows import ContainerStoppedEvent
from google.cloud.lifesciences_v2beta.types.workflows import DelayedEvent
from google.cloud.lifesciences_v2beta.types.workflows import Disk
from google.cloud.lifesciences_v2beta.types.workflows import Event
from google.cloud.lifesciences_v2beta.types.workflows import ExistingDisk
from google.cloud.lifesciences_v2beta.types.workflows import FailedEvent
from google.cloud.lifesciences_v2beta.types.workflows import Metadata
from google.cloud.lifesciences_v2beta.types.workflows import Mount
from google.cloud.lifesciences_v2beta.types.workflows import Network
from google.cloud.lifesciences_v2beta.types.workflows import NFSMount
from google.cloud.lifesciences_v2beta.types.workflows import PersistentDisk
from google.cloud.lifesciences_v2beta.types.workflows import Pipeline
from google.cloud.lifesciences_v2beta.types.workflows import PullStartedEvent
from google.cloud.lifesciences_v2beta.types.workflows import PullStoppedEvent
from google.cloud.lifesciences_v2beta.types.workflows import Resources
from google.cloud.lifesciences_v2beta.types.workflows import RunPipelineRequest
from google.cloud.lifesciences_v2beta.types.workflows import RunPipelineResponse
from google.cloud.lifesciences_v2beta.types.workflows import Secret
from google.cloud.lifesciences_v2beta.types.workflows import ServiceAccount
from google.cloud.lifesciences_v2beta.types.workflows import UnexpectedExitStatusEvent
from google.cloud.lifesciences_v2beta.types.workflows import VirtualMachine
from google.cloud.lifesciences_v2beta.types.workflows import Volume
from google.cloud.lifesciences_v2beta.types.workflows import WorkerAssignedEvent
from google.cloud.lifesciences_v2beta.types.workflows import WorkerReleasedEvent
__all__ = ('WorkflowsServiceV2BetaClient',
'WorkflowsServiceV2BetaAsyncClient',
'Accelerator',
'Action',
'ContainerKilledEvent',
'ContainerStartedEvent',
'ContainerStoppedEvent',
'DelayedEvent',
'Disk',
'Event',
'ExistingDisk',
'FailedEvent',
'Metadata',
'Mount',
'Network',
'NFSMount',
'PersistentDisk',
'Pipeline',
'PullStartedEvent',
'PullStoppedEvent',
'Resources',
'RunPipelineRequest',
'RunPipelineResponse',
'Secret',
'ServiceAccount',
'UnexpectedExitStatusEvent',
'VirtualMachine',
'Volume',
'WorkerAssignedEvent',
'WorkerReleasedEvent',
)
| 45 | 126 | 0.8225 | 403 | 3,600 | 7.245658 | 0.272953 | 0.10274 | 0.15411 | 0.277397 | 0.55137 | 0.55137 | 0.55137 | 0.55137 | 0.043151 | 0.043151 | 0 | 0.013962 | 0.104722 | 3,600 | 79 | 127 | 45.56962 | 0.892026 | 0.158056 | 0 | 0 | 0 | 0 | 0.137645 | 0.042454 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.491803 | 0 | 0.491803 | 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 | 1 | 0 | 0 | 0 | 0 | 2 |
beed0ace32ca9377f5a75b46ff58122957227e0a | 1,558 | py | Python | algoneer/dataset/attribute.py | algoneer/algoneer-py | 5f300543116278c91a9cf8c9ef5a1375e3f1e75d | [
"MIT"
] | 10 | 2019-08-05T16:06:12.000Z | 2020-12-19T16:40:48.000Z | algoneer/dataset/attribute.py | algoneer/algoneer-py | 5f300543116278c91a9cf8c9ef5a1375e3f1e75d | [
"MIT"
] | null | null | null | algoneer/dataset/attribute.py | algoneer/algoneer-py | 5f300543116278c91a9cf8c9ef5a1375e3f1e75d | [
"MIT"
] | 1 | 2020-04-27T08:50:14.000Z | 2020-04-27T08:50:14.000Z | import algoneer.dataset
from typing import Optional, Iterable, Any
from ..dataschema import AttributeSchema
import abc
class Attribute(abc.ABC):
def __init__(
self, dataset: "algoneer.dataset.Dataset", column: str, schema: AttributeSchema
) -> None:
self._schema = schema
self._column = column
self._dataset = dataset
def __getattr__(self, attr):
if attr.startswith("is_"):
_type = attr[3:]
if self.schema is not None and self.schema.type.name.lower() == _type:
return True
return False
raise AttributeError("not found")
@property
def column(self) -> str:
return self._column
@column.setter
def column(self, column: str) -> None:
self._column = column
@property
def roles(self) -> Iterable[str]:
return self._schema.roles
@property
def schema(self) -> AttributeSchema:
return self._schema
@schema.setter
def schema(self, schema: AttributeSchema) -> None:
self._schema = schema
@property
def dataset(self):
return self._dataset
@abc.abstractmethod
def __len__(self) -> int:
pass
@abc.abstractmethod
def sum(self) -> float:
pass
@abc.abstractmethod
def mean(self) -> float:
pass
@abc.abstractmethod
def min(self) -> float:
pass
@abc.abstractmethod
def max(self) -> float:
pass
@abc.abstractmethod
def __getitem__(self, item) -> Any:
pass
| 21.342466 | 87 | 0.603338 | 170 | 1,558 | 5.364706 | 0.3 | 0.076754 | 0.131579 | 0.131579 | 0.234649 | 0.234649 | 0 | 0 | 0 | 0 | 0 | 0.000916 | 0.299101 | 1,558 | 72 | 88 | 21.638889 | 0.834249 | 0 | 0 | 0.37037 | 0 | 0 | 0.023107 | 0.015404 | 0 | 0 | 0 | 0 | 0 | 1 | 0.259259 | false | 0.111111 | 0.074074 | 0.074074 | 0.462963 | 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 | 0 | 0 | 0 | 2 |
beefd848351f770d1db5a7a23d9621aa37aafeb7 | 374 | py | Python | output/models/nist_data/atomic/nmtoken/schema_instance/nistschema_sv_iv_atomic_nmtoken_enumeration_4_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/nist_data/atomic/nmtoken/schema_instance/nistschema_sv_iv_atomic_nmtoken_enumeration_4_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/nist_data/atomic/nmtoken/schema_instance/nistschema_sv_iv_atomic_nmtoken_enumeration_4_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.nist_data.atomic.nmtoken.schema_instance.nistschema_sv_iv_atomic_nmtoken_enumeration_4_xsd.nistschema_sv_iv_atomic_nmtoken_enumeration_4 import (
NistschemaSvIvAtomicNmtokenEnumeration4,
NistschemaSvIvAtomicNmtokenEnumeration4Type,
)
__all__ = [
"NistschemaSvIvAtomicNmtokenEnumeration4",
"NistschemaSvIvAtomicNmtokenEnumeration4Type",
]
| 37.4 | 164 | 0.86631 | 30 | 374 | 10.166667 | 0.633333 | 0.127869 | 0.091803 | 0.131148 | 0.255738 | 0.255738 | 0.255738 | 0 | 0 | 0 | 0 | 0.017442 | 0.080214 | 374 | 9 | 165 | 41.555556 | 0.869186 | 0 | 0 | 0 | 0 | 0 | 0.219251 | 0.219251 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.125 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
befb7e671e746fbee623340f63f4b0b2139936e7 | 11,573 | py | Python | kivy/tests/test_module_inspector.py | adn05/kivy | 5fc538588092133f1a63edd6b0d79f00d3c86db4 | [
"MIT"
] | 2 | 2020-12-30T18:27:17.000Z | 2020-12-30T18:27:18.000Z | kivy/tests/test_module_inspector.py | adn05/kivy | 5fc538588092133f1a63edd6b0d79f00d3c86db4 | [
"MIT"
] | null | null | null | kivy/tests/test_module_inspector.py | adn05/kivy | 5fc538588092133f1a63edd6b0d79f00d3c86db4 | [
"MIT"
] | null | null | null | from kivy.tests.common import GraphicUnitTest, UnitTestTouch
from kivy.base import EventLoop
from kivy.modules import inspector
from kivy.factory import Factory
KV = '''
#:import Factory kivy.factory.Factory
<InspectorTestModal@ModalView>:
size_hint: 0.5, 0.5
<FirstModal@InspectorTestModal>:
Button:
id: firstmodal
text: 'first modal'
on_release: Factory.SecondModal().open()
<SecondModal@InspectorTestModal>:
Button:
id: secondmodal
text: 'second modal'
on_release: Factory.ThirdModal().open()
<ThirdModal@InspectorTestModal>:
Button:
id: thirdmodal
text: 'third modal'
BoxLayout:
Button:
id: highlight
text: 'highlight'
Button:
id: popup
text: 'popup'
on_release: Factory.FirstModal().open()
Button:
id: tri_popup
text: '3 popups'
on_release: Factory.FirstModal().open()
Button:
id: dummy
text: 'dummy'
'''
class InspectorTestCase(GraphicUnitTest):
framecount = 0
def setUp(self):
# kill KV lang logging (too long test)
import kivy.lang.builder as builder
if not hasattr(self, '_trace'):
self._trace = builder.trace
self.builder = builder
builder.trace = lambda *_, **__: None
super(InspectorTestCase, self).setUp()
def tearDown(self):
# add the logging back
import kivy.lang.builder as builder
builder.Builder.unload_file("InspectorTestCase.KV")
builder.trace = self._trace
super(InspectorTestCase, self).tearDown()
def clean_garbage(self, *args):
for child in self._win.children[:]:
self._win.remove_widget(child)
self.advance_frames(5)
def test_activate_deactivate_bottom(self, *args):
EventLoop.ensure_window()
self._win = EventLoop.window
self.clean_garbage()
# build the widget tree & add Window as the main EL
self.root = self.builder.Builder.load_string(
KV, filename="InspectorTestCase.KV")
self.render(self.root)
self.assertLess(len(self._win.children), 2)
# activate inspector with root as ctx
inspector.start(self._win, self.root)
self.advance_frames(2)
# pull the Inspector drawer from bottom
ins = self.root.inspector
ins.activated = True
ins.inspect_enabled = True
self.assertTrue(ins.at_bottom)
# by default is Inspector appended as the first child
# to the window and positioned at the bottom
self.assertEqual(self._win.children[0], ins)
self.advance_frames(1)
self.assertLess(ins.layout.pos[1], self._win.height / 2.0)
# close Inspector
ins.inspect_enabled = False
ins.activated = False
self.render(self.root)
self.advance_frames(1)
# stop Inspector completely
inspector.stop(self._win, self.root)
self.assertLess(len(self._win.children), 2)
self.render(self.root)
def test_activate_deactivate_top(self, *args):
EventLoop.ensure_window()
self._win = EventLoop.window
self.clean_garbage()
# build the widget tree & add Window as the main EL
self.root = self.builder.Builder.load_string(
KV, filename="InspectorTestCase.KV")
self.render(self.root)
self.assertLess(len(self._win.children), 2)
# activate inspector with root as ctx
inspector.start(self._win, self.root)
self.advance_frames(2)
# pull the Inspector drawer from top
ins = self.root.inspector
ins.at_bottom = False
ins.activated = True
ins.inspect_enabled = True
self.assertFalse(ins.at_bottom)
# by default is Inspector appended as the first child
# to the window & we move it to the top
self.assertEqual(self._win.children[0], ins)
ins.toggle_position(self.root.ids.dummy)
self.advance_frames(20) # drawer is moving, like with activate
self.assertGreater(ins.layout.pos[1], self._win.height / 2.0)
# close Inspector
ins.inspect_enabled = False
ins.activated = False
self.render(self.root)
self.advance_frames(1)
# stop Inspector completely
inspector.stop(self._win, self.root)
self.assertLess(len(self._win.children), 2)
self.render(self.root)
def test_widget_button(self, *args):
EventLoop.ensure_window()
self._win = EventLoop.window
self.clean_garbage()
# build the widget tree & add Window as the main EL
self.root = self.builder.Builder.load_string(
KV, filename="InspectorTestCase.KV")
self.render(self.root)
self.assertLess(len(self._win.children), 2)
# checked widget
highlight = self.root.ids.highlight
highlight_exp = self.root.ids.highlight.text
# activate inspector with root as ctx
inspector.start(self._win, self.root)
self.advance_frames(2)
# pull the Inspector drawer from bottom
ins = self.root.inspector
ins.activated = True
ins.inspect_enabled = True
self.assertTrue(ins.at_bottom)
# touch button center
touch = UnitTestTouch(*highlight.center)
touch.touch_down()
touch.touch_up()
# open Inspector properties
ins.show_widget_info()
self.advance_frames(2)
# check if the button is selected
# stored instance
self.assertEqual(ins.widget.text, highlight_exp)
# data in properties
for node in ins.treeview.iterate_all_nodes():
lkey = getattr(node.ids, 'lkey', None)
if not lkey:
continue
if lkey.text == 'text':
ltext = node.ids.ltext
# slice because the string is displayed with quotes
self.assertEqual(ltext.text[1:-1], highlight_exp)
break
# close Inspector
ins.inspect_enabled = False
ins.activated = False
self.render(self.root)
self.advance_frames(1)
# stop Inspector completely
inspector.stop(self._win, self.root)
self.assertLess(len(self._win.children), 2)
self.render(self.root)
def test_widget_popup(self, *args):
EventLoop.ensure_window()
self._win = EventLoop.window
self.clean_garbage()
# build the widget tree & add Window as the main EL
self.root = self.builder.Builder.load_string(
KV, filename="InspectorTestCase.KV")
self.render(self.root)
self.assertLess(len(self._win.children), 2)
# checked widget
popup = self.root.ids.popup
popup_exp = self.root.ids.popup.text
# activate inspector with root as ctx
inspector.start(self._win, self.root)
self.advance_frames(1)
# pull the Inspector drawer from bottom,
# but don't inspect yet!
ins = self.root.inspector
ins.inspect_enabled = False
ins.activated = True
self.assertTrue(ins.at_bottom)
# touch button center to open the popup
touch = UnitTestTouch(*popup.center)
touch.touch_down()
touch.touch_up()
self.advance_frames(1)
# start inspecting
ins.inspect_enabled = True
self.advance_frames(1)
# inspect FirstModal's button
touch.touch_down()
touch.touch_up()
self.advance_frames(1)
# open Inspector properties
ins.show_widget_info()
self.advance_frames(2)
# check if the popup is selected
# stored instance
self.assertIsInstance(ins.widget, Factory.Button)
self.assertIsInstance(ins.widget.parent, Factory.FirstModal)
# check with new Popup instance if the properties match
temp_popup = Factory.FirstModal()
temp_popup_exp = temp_popup.ids.firstmodal.text
self.assertEqual(ins.widget.text, temp_popup_exp)
# data in properties
for node in ins.treeview.iterate_all_nodes():
lkey = getattr(node.ids, 'lkey', None)
if not lkey:
continue
if lkey.text == 'text':
ltext = node.ids.ltext
# slice because the string is displayed with quotes
self.assertEqual(ltext.text[1:-1], temp_popup_exp)
break
del temp_popup
# close popup
ins.inspect_enabled = False
touch = UnitTestTouch(0, 0)
touch.touch_down()
touch.touch_up()
self.advance_frames(10)
# close Inspector
ins.activated = False
self.render(self.root)
self.advance_frames(5)
# stop Inspector completely
inspector.stop(self._win, self.root)
self.assertLess(len(self._win.children), 2)
self.render(self.root)
def test_widget_multipopup(self, *args):
EventLoop.ensure_window()
self._win = EventLoop.window
self.clean_garbage()
# build the widget tree & add Window as the main EL
self.root = self.builder.Builder.load_string(
KV, filename="InspectorTestCase.KV")
self.render(self.root)
self.assertLess(len(self._win.children), 2)
# checked widget
popup = self.root.ids.popup
popup_exp = self.root.ids.popup.text
# activate inspector with root as ctx
inspector.start(self._win, self.root)
self.advance_frames(1)
# pull the Inspector drawer from bottom,
# but don't inspect yet!
ins = self.root.inspector
ins.inspect_enabled = False
ins.activated = True
self.assertTrue(ins.at_bottom)
# touch button center to open the popup
touch = UnitTestTouch(*popup.center)
touch.touch_down()
touch.touch_up()
self.advance_frames(1)
# touch Window center to open
# the second and the third popup
touch = UnitTestTouch(
self._win.width / 2.0,
self._win.height / 2.0
)
for i in range(2):
touch.touch_down()
touch.touch_up()
self.advance_frames(1)
# fixed order, first opened - last closed
modals = (
Factory.ThirdModal,
Factory.SecondModal,
Factory.FirstModal
)
for mod in modals:
# start inspecting
ins.inspect_enabled = True
self.advance_frames(1)
# inspect button
touch.touch_down()
touch.touch_up()
self.advance_frames(1)
# check if the popup is selected
# stored instance
self.assertIsInstance(ins.widget, Factory.Button)
self.assertIsInstance(ins.widget.parent, mod)
# close popup
ins.inspect_enabled = False
orig = UnitTestTouch(0, 0)
orig.touch_down()
orig.touch_up()
self.advance_frames(10)
# close Inspector
ins.activated = False
self.render(self.root)
self.advance_frames(5)
# stop Inspector completely
inspector.stop(self._win, self.root)
self.assertLess(len(self._win.children), 2)
self.render(self.root)
if __name__ == '__main__':
import unittest
unittest.main()
| 30.138021 | 71 | 0.608399 | 1,354 | 11,573 | 5.079025 | 0.140325 | 0.048859 | 0.043624 | 0.039261 | 0.734623 | 0.717464 | 0.699433 | 0.67384 | 0.667878 | 0.662644 | 0 | 0.007936 | 0.303119 | 11,573 | 383 | 72 | 30.21671 | 0.844761 | 0.162533 | 0 | 0.66 | 0 | 0 | 0.10053 | 0.024613 | 0 | 0 | 0 | 0 | 0.108 | 1 | 0.032 | false | 0 | 0.032 | 0 | 0.072 | 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 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.