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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8f5616db84332972623dd36f13ee7e7433b20859 | 606 | py | Python | bertex.py | a13x/python-bertrpc | a872585a9686724d21fb1423abd12c870279ba6f | [
"MIT"
] | null | null | null | bertex.py | a13x/python-bertrpc | a872585a9686724d21fb1423abd12c870279ba6f | [
"MIT"
] | null | null | null | bertex.py | a13x/python-bertrpc | a872585a9686724d21fb1423abd12c870279ba6f | [
"MIT"
] | null | null | null | import bertrpc
import time
service = bertrpc.Service('localhost', 10001, 600)
service.connect()
print service.call().example.adder(102,201)
#time.sleep(4)
print service.call().example.adder(202,404)
#time.sleep(4)
print service.call().example.adder(202,404)
print service.call().dictoid.to_dict("something", "something", "dark side")
options = dict(cache=["validation", "BlaBla"])
#time.sleep(4)
#print service.call(options).dictoid.see(100,200)
service.close()
with bertrpc.Service('localhost', 10001, 600) as svc:
print svc.call().example.adder(303,606)
print svc.call().example.adder(202,101)
| 30.3 | 75 | 0.735974 | 89 | 606 | 5 | 0.426966 | 0.134831 | 0.179775 | 0.155056 | 0.566292 | 0.25618 | 0.197753 | 0.197753 | 0.197753 | 0.197753 | 0 | 0.099099 | 0.084158 | 606 | 19 | 76 | 31.894737 | 0.702703 | 0.143564 | 0 | 0.153846 | 0 | 0 | 0.118677 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.153846 | null | null | 0.461538 | 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 | 0 | 0 | 0 | 1 | 0 | 2 |
8f6783f0d4a161225ffce098782bb30c5b3fb6a6 | 1,257 | py | Python | ui_auto/PageObjects/login_page.py | dong-pro/fullStackPython | 5ad8662f7b57f14c8529e7eaf64290eeda773557 | [
"Apache-2.0"
] | 1 | 2020-04-03T01:32:05.000Z | 2020-04-03T01:32:05.000Z | ui_auto/PageObjects/login_page.py | dong-pro/fullStackPython | 5ad8662f7b57f14c8529e7eaf64290eeda773557 | [
"Apache-2.0"
] | null | null | null | ui_auto/PageObjects/login_page.py | dong-pro/fullStackPython | 5ad8662f7b57f14c8529e7eaf64290eeda773557 | [
"Apache-2.0"
] | null | null | null | # -*- coding: UTF-8 -*-
# @Time: 2020-05-03 14:04
# @Author: wyd
# @File: login_page.py
from ui_auto.PageLocators.loginpage_locators import LoginPageLocator as loc
from ui_auto.Common.basepage import BasePage
class LoginPage(BasePage):
# 登录
def login(self, username, password, remeber_user=True):
doc = '登录页面_登录功能'
self.wait_eleVisible(loc.name_text, doc=doc)
self.input_text(loc.name_text, username, doc=doc)
self.input_text(loc.pwd_text, password, doc=doc)
# 判断一下remember_user的值,来决定是否勾选.这里还没写
if remeber_user:
pass
# 判断处理是在用例里面写的,这里面只是写登录操作。容易混淆
self.click_element(loc.login_but, doc=doc)
# 注册.这里还没写
def register(self):
pass
# 忘记密码.这里还没写
def forget_pwd(self):
pass
# 获取错误提示信息 - 登录区域
def get_errorMsg_from_loginArea(self):
doc = '登录页面_获取登录区域的错误提示'
self.wait_eleVisible(loc.errorMsg_from_loginArea, doc=doc)
return self.get_text(loc.errorMsg_from_loginArea, doc=doc)
# 获取错误提示信息 - 中心区域
def get_errorMsg_from_conterArea(self):
doc = '登录页面_获取登录区域的错误提示'
self.wait_eleVisible(loc.errorMsg_from_conterArea, doc=doc)
return self.get_text(loc.errorMsg_from_conterArea, doc=doc)
| 29.928571 | 75 | 0.680191 | 165 | 1,257 | 4.957576 | 0.424242 | 0.05868 | 0.07335 | 0.077017 | 0.342298 | 0.342298 | 0.227384 | 0.227384 | 0.227384 | 0.134474 | 0 | 0.013292 | 0.221957 | 1,257 | 41 | 76 | 30.658537 | 0.823108 | 0.156722 | 0 | 0.217391 | 0 | 0 | 0.039122 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.217391 | false | 0.217391 | 0.086957 | 0 | 0.434783 | 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 |
8f699eae6f8b296adb383eb3d97e17ae4f19a620 | 1,144 | py | Python | relevanceai/utils/decorators/version.py | RelevanceAI/RelevanceAI | a0542f35153d9c842f3d2cd0955d6b07f6dfc07b | [
"Apache-2.0"
] | 21 | 2021-11-23T13:01:36.000Z | 2022-03-23T03:45:30.000Z | relevanceai/utils/decorators/version.py | RelevanceAI/RelevanceAI | a0542f35153d9c842f3d2cd0955d6b07f6dfc07b | [
"Apache-2.0"
] | 217 | 2021-11-23T00:11:01.000Z | 2022-03-30T08:11:49.000Z | relevanceai/utils/decorators/version.py | RelevanceAI/RelevanceAI | a0542f35153d9c842f3d2cd0955d6b07f6dfc07b | [
"Apache-2.0"
] | 4 | 2022-01-04T01:48:30.000Z | 2022-02-11T03:19:32.000Z | import warnings
from functools import wraps
from relevanceai.constants.messages import Messages
def beta(f):
f.__doc__ = Messages.BETA_DOCSTRING.format(f.__doc__)
@wraps(f)
def wrapper(*args, **kwds):
return f(*args, **kwds)
return wrapper
def added(version):
def _version(f):
f.__doc__ = Messages.ADDED_DOCSTRING.format(version)
@wraps(f)
def wrapper(*args, **kwds):
return f(*args, **kwds)
return wrapper
return _version
def deprecated(version: str, message: str = ""):
def _version(f):
f.__doc__ = Messages.DEPRECEATED_DOCSTRING.format(version)
@wraps(f)
def wrapper(*args, **kwds):
warnings.warn(
Messages.DEPRECEATED.format(version, message), DeprecationWarning
)
return f(*args, **kwds)
return wrapper
return _version
def deprecated_error(message: str = ""):
def raise_warning(f):
@wraps(f)
def wrapper(*args, **kwds):
raise DeprecationWarning(f"Deprecated. {message}")
return wrapper
return raise_warning
| 20.428571 | 81 | 0.61014 | 125 | 1,144 | 5.376 | 0.232 | 0.083333 | 0.104167 | 0.095238 | 0.479167 | 0.479167 | 0.375 | 0.375 | 0.375 | 0.27381 | 0 | 0 | 0.27972 | 1,144 | 55 | 82 | 20.8 | 0.815534 | 0 | 0 | 0.542857 | 0 | 0 | 0.018357 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.314286 | false | 0 | 0.085714 | 0.057143 | 0.685714 | 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 |
8f6ef07536dc2a27ffde63683f68d531efebb468 | 784 | py | Python | logging.py | codedragon/color_world | 577996467e3f5492c7eb7a87f7bdb10624d44328 | [
"BSD-3-Clause"
] | null | null | null | logging.py | codedragon/color_world | 577996467e3f5492c7eb7a87f7bdb10624d44328 | [
"BSD-3-Clause"
] | null | null | null | logging.py | codedragon/color_world | 577996467e3f5492c7eb7a87f7bdb10624d44328 | [
"BSD-3-Clause"
] | null | null | null | from datetime import datetime
from time import mktime
def micro_time():
"""
Returns the current time since epoch, accurate to the
value returned by gettimeofday(), usually ~1microsecond.
Datetime is more accurate than time.clock
"""
now = datetime.now()
return long(mktime(now.timetuple()) * 1000000 + now.microsecond)
class Logging(object):
def __init__(self):
self.filename = 'color_' + datetime.now().strftime("%Y_%m_%d_%H_%M")
self.log_file = self.start_logging()
def start_logging(self):
log_file = open(self.filename, 'a')
return log_file
def write_line(self, *args):
self.log_file.write(str(micro_time()) + ' {} yup\n'.format(args))
def stop_logging(self):
self.log_file.close() | 28 | 76 | 0.656888 | 104 | 784 | 4.759615 | 0.538462 | 0.070707 | 0.088889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013051 | 0.218112 | 784 | 28 | 77 | 28 | 0.794454 | 0.193878 | 0 | 0 | 0 | 0 | 0.049261 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3125 | false | 0 | 0.125 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
8f770f710d358984cafae97b37aa09ae63dbcbaf | 457 | py | Python | main/views.py | DaniGlass/cafesite | fc77d499497d6b5f65b71ceb18d18884061469bc | [
"MIT"
] | null | null | null | main/views.py | DaniGlass/cafesite | fc77d499497d6b5f65b71ceb18d18884061469bc | [
"MIT"
] | null | null | null | main/views.py | DaniGlass/cafesite | fc77d499497d6b5f65b71ceb18d18884061469bc | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django.views.generic import TemplateView
# Create your views here.
class HomePageView(TemplateView):
def get(self, request, **kwargs):
return render(request, 'index.html', context=None)
class AboutPageView(TemplateView):
template_name = "about.html"
class MenuPageView(TemplateView):
template_name = "menu.html"
class ReservationPageView(TemplateView):
template_name = "reservation.html"
| 26.882353 | 58 | 0.7593 | 51 | 457 | 6.745098 | 0.607843 | 0.174419 | 0.209302 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.14442 | 457 | 16 | 59 | 28.5625 | 0.879795 | 0.050328 | 0 | 0 | 0 | 0 | 0.104167 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.181818 | 0.090909 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
56af26984ab2735c23c04cfb8b08a1c314cdc9d1 | 421 | py | Python | Project _ 2 -- BlogSite/users/signals.py | AyemunHossain/Django | 0b1ed21fd6bd2906a4a1a220c029a2193658320f | [
"MIT"
] | 2 | 2020-02-14T19:23:50.000Z | 2020-04-19T08:26:38.000Z | Project _ 2 -- BlogSite/users/signals.py | AyemunHossain/Django | 0b1ed21fd6bd2906a4a1a220c029a2193658320f | [
"MIT"
] | 42 | 2021-02-02T23:08:30.000Z | 2022-03-12T00:54:55.000Z | Project _ 2 -- BlogSite/users/signals.py | AyemunHossain/Django | 0b1ed21fd6bd2906a4a1a220c029a2193658320f | [
"MIT"
] | 1 | 2022-03-07T08:09:41.000Z | 2022-03-07T08:09:41.000Z | from django.db.models.signals import post_save
from django.contrib.auth.models import User
from django.dispatch import receiver
from .models import Profile
@receiver(post_save,sender=User)
def create_profile(sender, instance, created, *args,**kwargs):
if created:
Profile.objects.create(user=instance)
@receiver(post_save,sender=User)
def save_profile(sender, instance, *args, **kwargs):
instance.profile.save()
| 28.066667 | 62 | 0.790974 | 59 | 421 | 5.559322 | 0.389831 | 0.091463 | 0.097561 | 0.134146 | 0.176829 | 0.176829 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097387 | 421 | 14 | 63 | 30.071429 | 0.863158 | 0 | 0 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.363636 | 0 | 0.545455 | 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 |
56b4274c50baf90dfa0a68f211da4be828a029ba | 152 | py | Python | legacy/AGC_029/A1.py | mo-mo-666/AtCoder | 99556f5ed98510850aaa8ab2b845da6a9359f5a5 | [
"MIT"
] | null | null | null | legacy/AGC_029/A1.py | mo-mo-666/AtCoder | 99556f5ed98510850aaa8ab2b845da6a9359f5a5 | [
"MIT"
] | null | null | null | legacy/AGC_029/A1.py | mo-mo-666/AtCoder | 99556f5ed98510850aaa8ab2b845da6a9359f5a5 | [
"MIT"
] | null | null | null | s = input()
s = s[::-1]
ans = 0
b = 0
for i in range(len(s)):
if s[i] == "B":
ans += i
ans -= b
b += 1
print(ans)
| 13.818182 | 24 | 0.348684 | 27 | 152 | 1.962963 | 0.481481 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047619 | 0.447368 | 152 | 10 | 25 | 15.2 | 0.583333 | 0 | 0 | 0 | 0 | 0 | 0.007042 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.1 | 1 | 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 | 0 | 0 | 0 | 2 |
56bd4abb493eb88a43b24228616e36a3ea2c75b1 | 908 | py | Python | common/errors.py | iFunFactory/pong-webscoket | ce0dceb4f60a30e61deb7f20c13f01ee2eeb6b85 | [
"MIT"
] | 2 | 2018-03-28T09:06:07.000Z | 2018-12-26T01:30:06.000Z | common/errors.py | iFunFactory/pong-webscoket | ce0dceb4f60a30e61deb7f20c13f01ee2eeb6b85 | [
"MIT"
] | null | null | null | common/errors.py | iFunFactory/pong-webscoket | ce0dceb4f60a30e61deb7f20c13f01ee2eeb6b85 | [
"MIT"
] | 1 | 2020-09-08T06:26:10.000Z | 2020-09-08T06:26:10.000Z | class PongError(Exception):
pass
class RoomError(PongError):
def __init__(self, room, msg, **kwargs):
err_msg = '{} room info : {}'.format(msg, room)
super().__init__(err_msg, **kwargs)
class PlayerError(PongError):
def __init__(self, player, msg, **kwargs):
err_msg = '{} player info : {}'.format(msg, player)
super().__init__(err_msg, **kwargs)
class LobbyError(PongError):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
class ProtocolError(PongError):
def __init__(self, payload, msg, **kwargs):
err_msg = '{} message: {}'.format(msg, payload)
super().__init__(err_msg, **kwargs)
class UnexpectedProtocolError(ProtocolError):
def __init__(self, payload, expected, **kwargs):
err_msg = 'Unexpected payload type {}'.format(expected)
super().__init__(payload, err_msg, **kwargs) | 29.290323 | 63 | 0.64207 | 100 | 908 | 5.35 | 0.26 | 0.08972 | 0.102804 | 0.149533 | 0.145794 | 0.145794 | 0 | 0 | 0 | 0 | 0 | 0 | 0.199339 | 908 | 31 | 64 | 29.290323 | 0.735901 | 0 | 0 | 0.142857 | 0 | 0 | 0.083608 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.238095 | false | 0.047619 | 0 | 0 | 0.52381 | 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 |
56ce69bc82d80001d09def45437dcb97de9943cc | 1,536 | py | Python | 01_strings_interpolacao/02_interpolacao.py | smartao/estudos_python | 252a2e592ff929dfc6c06fc09b42cb7063ad0b5a | [
"MIT"
] | null | null | null | 01_strings_interpolacao/02_interpolacao.py | smartao/estudos_python | 252a2e592ff929dfc6c06fc09b42cb7063ad0b5a | [
"MIT"
] | 9 | 2019-11-15T14:21:43.000Z | 2020-03-15T14:37:13.000Z | 01_strings_interpolacao/02_interpolacao.py | smartao/estudos_python | 252a2e592ff929dfc6c06fc09b42cb7063ad0b5a | [
"MIT"
] | null | null | null | #!/usr/bin/python3
'''
Interpolarção
É substituir valores dentro da string
'''
# Criando duas variaveis
from string import Template
nome, idade = 'Ana Paula', 30.98761
# Método mais antigo, menos recomendado!
#
# %s = sequencia de caracteres que sera interpretado pelo python
# para substuir elementos do tipo string
# %d = usado para substituir valores inteiros
# %f = usando para substiuir valores float
print('\nSubstituindo valores variaveis, método antigo:')
print('Nome: %s, Idade: %d' % (nome, idade))
print('\nSubstitindo valores float e limitando as casas deciamais:')
print('Nome: %s, Idade: %.2f' % (nome, idade))
# Método utilizado no Python 3.6 ou inferior
print('\nMetodo de interpolacao python 3.6 ou inferior:')
print('Nome: {0} Idade: {1}'.format(nome, idade))
# Método mais novo de todos, suporta apenas Python 3.6 ou superior
# Chamando f-string
print('\nMetodo de interpolacao python 3.6 ou superior:')
print(f'Nome: {nome} Idade: {idade}')
# Adicioando valores e formatando mostrando apenas duas casas deciamias
print(f'Idade de {nome} daqui 10 anos = {idade+10:.2f}')
# Método usando template, necessário configurar o import
print('\nMetodo usando template:')
s = Template('Nome: $n Idade: $ida')
print(s.substitute(n=nome, ida=idade))
#
# Fontes:
# Curso Python 3 - Curso Completo do Básico ao Avançado Udemy Aula 54
# https://github.com/cod3rcursos/curso-python/tree/master/fundamentos
# https://realpython.com/python-f-strings/
# https://www.geeksforgeeks.org/formatted-string-literals-f-strings-python/
| 34.133333 | 75 | 0.740885 | 221 | 1,536 | 5.149321 | 0.497738 | 0.039543 | 0.02812 | 0.035149 | 0.113357 | 0.09051 | 0.063269 | 0.063269 | 0 | 0 | 0 | 0.021037 | 0.133464 | 1,536 | 44 | 76 | 34.909091 | 0.833959 | 0.539063 | 0 | 0 | 0 | 0 | 0.571848 | 0 | 0 | 0 | 0 | 0.022727 | 0 | 1 | 0 | false | 0 | 0.071429 | 0 | 0.071429 | 0.785714 | 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 | 0 | 1 | 0 | 2 |
56d50d2be351a8283cf2f4c3e789c6d968c6ad25 | 315 | py | Python | src/tfmars/applications/marnasnet/__init__.py | Shakshi3104/tfmars | f34d3fff49d9eabf130cd7c5fb8f7c6d0f12b5e8 | [
"MIT"
] | 1 | 2022-03-19T11:14:04.000Z | 2022-03-19T11:14:04.000Z | src/tfmars/applications/marnasnet/__init__.py | Shakshi3104/tfmars | f34d3fff49d9eabf130cd7c5fb8f7c6d0f12b5e8 | [
"MIT"
] | null | null | null | src/tfmars/applications/marnasnet/__init__.py | Shakshi3104/tfmars | f34d3fff49d9eabf130cd7c5fb8f7c6d0f12b5e8 | [
"MIT"
] | null | null | null | from .marnasnet_c import MarNASNetC, MarNASNetCa
from .marnasnet_a import MarNASNetA
from .marnasnet_b import MarNASNetB
from .marnasnet_e import MarNASNetE
from .marnasnet_d import MarNASNetD
__all__ = [
"MarNASNetC",
"MarNASNetA",
"MarNASNetB",
"MarNASNetE",
"MarNASNetD",
"MarNASNetCa"
] | 22.5 | 48 | 0.742857 | 33 | 315 | 6.818182 | 0.454545 | 0.288889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.174603 | 315 | 14 | 49 | 22.5 | 0.865385 | 0 | 0 | 0 | 0 | 0 | 0.193038 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.384615 | 0 | 0.384615 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
56e4e5edf7a8f3823d750a106f39623593cfe9b0 | 1,796 | py | Python | qiskit_nature/problems/second_quantization/lattice/__init__.py | kevinsung/qiskit-nature | 407533e05ca33fa53eb4e9cd7b089a0a99f9540e | [
"Apache-2.0"
] | null | null | null | qiskit_nature/problems/second_quantization/lattice/__init__.py | kevinsung/qiskit-nature | 407533e05ca33fa53eb4e9cd7b089a0a99f9540e | [
"Apache-2.0"
] | null | null | null | qiskit_nature/problems/second_quantization/lattice/__init__.py | kevinsung/qiskit-nature | 407533e05ca33fa53eb4e9cd7b089a0a99f9540e | [
"Apache-2.0"
] | null | null | null | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
"""
Lattice Problems (:mod:`qiskit_nature.problems.second_quantization.lattice`)
=============================================================================
The `Lattice` class is used to generate a general lattice,
which is a graph with complex-valued weights on its edges.
The `HyperCubicLattice` class and others provide standard lattices with certain
translational symmetries.
`Models` include classes that define Hamiltonians on a lattice.
It takes a lattice object and model parameters as input and
generates a Hamiltonian defined on the lattice.
.. currentmodule:: qiskit_nature.problems.second_quantization.lattice
Lattice
==============
.. autosummary::
:toctree: ../stubs/
Lattice
HyperCubicLattice
LineLattice
SquareLattice
TriangularLattice
Models
=======
.. autosummary::
:toctree: ../stubs/
FermiHubbardModel
IsingModel
Lattice Model Problems (:mod:`qiskit_nature.problems.second_quantization.lattice`)
==================================================================================
"""
from .lattices import (
BoundaryCondition,
HyperCubicLattice,
Lattice,
LatticeDrawStyle,
LineLattice,
SquareLattice,
TriangularLattice,
)
from .models import FermiHubbardModel, IsingModel
from .lattice_model_problem import LatticeModelProblem
| 29.442623 | 82 | 0.693764 | 205 | 1,796 | 6.039024 | 0.556098 | 0.019386 | 0.048465 | 0.063005 | 0.126817 | 0.126817 | 0.090469 | 0.090469 | 0 | 0 | 0 | 0.007823 | 0.14588 | 1,796 | 60 | 83 | 29.933333 | 0.799218 | 0.830735 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.272727 | 0 | 0.272727 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
56ed69fd1bc9f2bec3bea836f5992301a3d65323 | 260 | py | Python | 05_if_statements/5_11_ordinal_numbers.py | simonhoch/python_basics | 4ecf12c074e641e3cdeb0a6690846eb9133f96af | [
"MIT"
] | null | null | null | 05_if_statements/5_11_ordinal_numbers.py | simonhoch/python_basics | 4ecf12c074e641e3cdeb0a6690846eb9133f96af | [
"MIT"
] | null | null | null | 05_if_statements/5_11_ordinal_numbers.py | simonhoch/python_basics | 4ecf12c074e641e3cdeb0a6690846eb9133f96af | [
"MIT"
] | null | null | null | numbers = range(1, 10)
for number in numbers:
if number == 1:
print (str(number) + 'st')
elif number == 2:
print (str(number) + 'nd')
elif number == 3:
print (str(number) + 'rd')
else:
print (str(number) + 'th')
| 23.636364 | 34 | 0.507692 | 34 | 260 | 3.882353 | 0.529412 | 0.242424 | 0.424242 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034286 | 0.326923 | 260 | 10 | 35 | 26 | 0.72 | 0 | 0 | 0 | 0 | 0 | 0.030769 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.4 | 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 |
56ffafaa197f579c6b97c86ab04331cd1a636441 | 548 | py | Python | nnn/nodes/_env_interface_wrappers/act_wrapper_node.py | JacobFV/pgi | b4c9af3c4ae94fcb335f20c2a1e7a4ff46ca54e6 | [
"MIT"
] | null | null | null | nnn/nodes/_env_interface_wrappers/act_wrapper_node.py | JacobFV/pgi | b4c9af3c4ae94fcb335f20c2a1e7a4ff46ca54e6 | [
"MIT"
] | null | null | null | nnn/nodes/_env_interface_wrappers/act_wrapper_node.py | JacobFV/pgi | b4c9af3c4ae94fcb335f20c2a1e7a4ff46ca54e6 | [
"MIT"
] | null | null | null | from typing import Text
from .. import TargetResponsiveNode
from ...utils import types as ts
class ActWrapperNode(TargetResponsiveNode):
"""wrapper for actions.
on `top_down`, an `ActWrapperNode` samples a larget from
`states[self.name][keys.TARGET_LATENTS]` and assigns it
to `states[act_key]`.
InfoNodePolicy reads `states[self.name][keys.STATES.LATENT]` for the action.
"""
def __init__(self, key: Text, act_spec: ts.NestedTensorSpec):
super(ActWrapperNode, self).__init__(latent_spec=act_spec, name=key) | 32.235294 | 80 | 0.728102 | 71 | 548 | 5.422535 | 0.605634 | 0.051948 | 0.072727 | 0.093506 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.162409 | 548 | 17 | 81 | 32.235294 | 0.83878 | 0.425182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.5 | 0 | 0.833333 | 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 |
710a7adf748c9456f728f4020caf398b83e5f032 | 191 | py | Python | farcaster/types.py | goksu/farcaster-python | 5500a1ee9223ecfa191de048045c541a8b6f0341 | [
"MIT"
] | 5 | 2022-03-12T21:06:15.000Z | 2022-03-16T22:46:26.000Z | farcaster/types.py | goksu/farcaster-python | 5500a1ee9223ecfa191de048045c541a8b6f0341 | [
"MIT"
] | null | null | null | farcaster/types.py | goksu/farcaster-python | 5500a1ee9223ecfa191de048045c541a8b6f0341 | [
"MIT"
] | null | null | null | from typing import NamedTuple
Cast = NamedTuple(
"Cast",
hash=str,
content=str,
)
Caster = NamedTuple(
"Caster",
hash=str,
display_name=str,
activity_url=str,
)
| 12.733333 | 29 | 0.628272 | 22 | 191 | 5.363636 | 0.590909 | 0.237288 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.256545 | 191 | 14 | 30 | 13.642857 | 0.830986 | 0 | 0 | 0.166667 | 0 | 0 | 0.052356 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.083333 | 0 | 0.083333 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
711f3f7c96885b0026514fd6b2c1003382c1dffb | 4,615 | py | Python | tests/troposphere_tests/test_aws_budget_alerting.py | UKHomeOffice/aws-budget-alerting | b55d59f730c1df0f266f6cac64a0b02546867673 | [
"MIT"
] | 2 | 2019-06-21T13:05:56.000Z | 2019-06-24T09:21:21.000Z | tests/troposphere_tests/test_aws_budget_alerting.py | UKHomeOffice/aws-budget-alerting | b55d59f730c1df0f266f6cac64a0b02546867673 | [
"MIT"
] | 6 | 2019-05-20T16:56:53.000Z | 2019-06-06T09:26:39.000Z | tests/troposphere_tests/test_aws_budget_alerting.py | UKHomeOffice/aws-budget-alerting | b55d59f730c1df0f266f6cac64a0b02546867673 | [
"MIT"
] | 1 | 2021-04-11T09:20:31.000Z | 2021-04-11T09:20:31.000Z | """Test the CloudFormation template generated to manage the AWS Budgets resources
"""
from aws_budget_alerting import get_alerting_cf_template
EXPECTED_ALERTING_TEMPLATE = '''AWSTemplateFormatVersion: '2010-09-09'
Description: Stack alerting forecasted and actual AWS budget overspend to Slack
Parameters:
ActualCostWebHookUrl:
Description: webhook for posting messages to the actual AWS cost Slack channel
Type: String
ActualThreshold:
Description: Threshold (percentage) compared to the actual cost that should trigger
an alert
Type: Number
ForecastedCostWebHookUrl:
Description: webhook for posting messages to the forecasted AWS cost Slack channel
Type: String
ForecastedThreshold:
Description: Threshold (percentage) compared to the forecasted cost that should
trigger an alert
Type: Number
MessagePrefix:
Default: ''
Description: A string that will be pre-pend to alert messages, e.g. to specify
a friendly AWS account name
Type: String
MonthlyBudget:
Description: Monthly budget for the account (in USD)
Type: Number
Resources:
ActualBudgetAlertTopic:
Properties:
TopicName: ActualBudgetAlert
Type: AWS::SNS::Topic
ActualBudgetAlertTopicPolicy:
Properties:
PolicyDocument:
Id: BudgetTopicPolicy
Statement:
- Action: SNS:Publish
Effect: Allow
Principal:
Service: budgets.amazonaws.com
Resource: !Ref 'ActualBudgetAlertTopic'
Sid: AWSBudgets-sns-notification
Version: '2012-10-17'
Topics:
- !Ref 'ActualBudgetAlertTopic'
Type: AWS::SNS::TopicPolicy
ActualCostSlackNotificationLambda:
Properties:
CodeUri: lambda-src/
Description: Posts a message to the actual budget alert Slack channel
Environment:
Variables:
MESSAGE_PREFIX: !Ref 'MessagePrefix'
WEBHOOK_URL: !Ref 'ActualCostWebHookUrl'
Events:
SNS:
Properties:
Topic: !Ref 'ActualBudgetAlertTopic'
Type: SNS
FunctionName: ActualCostSlackNotification
Handler: index.handler
MemorySize: 128
Runtime: nodejs8.10
Timeout: 10
Type: AWS::Serverless::Function
Budget:
Properties:
Budget:
BudgetLimit:
Amount: !Ref 'MonthlyBudget'
Unit: USD
BudgetName: Monthly Budget
BudgetType: COST
TimeUnit: MONTHLY
NotificationsWithSubscribers:
- Notification:
ComparisonOperator: GREATER_THAN
NotificationType: ACTUAL
Threshold: !Ref 'ActualThreshold'
ThresholdType: PERCENTAGE
Subscribers:
- Address: !Ref 'ActualBudgetAlertTopic'
SubscriptionType: SNS
- Notification:
ComparisonOperator: GREATER_THAN
NotificationType: FORECASTED
Threshold: !Ref 'ForecastedThreshold'
ThresholdType: PERCENTAGE
Subscribers:
- Address: !Ref 'ForecastedBudgetAlertTopic'
SubscriptionType: SNS
Type: AWS::Budgets::Budget
ForecastedBudgetAlertTopic:
Properties:
TopicName: ForecastedBudgetAlert
Type: AWS::SNS::Topic
ForecastedBudgetAlertTopicPolicy:
Properties:
PolicyDocument:
Id: BudgetTopicPolicy
Statement:
- Action: SNS:Publish
Effect: Allow
Principal:
Service: budgets.amazonaws.com
Resource: !Ref 'ForecastedBudgetAlertTopic'
Sid: AWSBudgets-sns-notification
Version: '2012-10-17'
Topics:
- !Ref 'ForecastedBudgetAlertTopic'
Type: AWS::SNS::TopicPolicy
ForecastedCostSlackNotificationLambda:
Properties:
CodeUri: lambda-src/
Description: Posts a message to the forecasted budget alert Slack channel
Environment:
Variables:
MESSAGE_PREFIX: !Ref 'MessagePrefix'
WEBHOOK_URL: !Ref 'ForecastedCostWebHookUrl'
Events:
SNS:
Properties:
Topic: !Ref 'ForecastedBudgetAlertTopic'
Type: SNS
FunctionName: ForecastedCostSlackNotification
Handler: index.handler
MemorySize: 128
Runtime: nodejs8.10
Timeout: 10
Type: AWS::Serverless::Function
Transform: AWS::Serverless-2016-10-31
'''
def test_alerting_cf_template():
"""Test the CloudFormation template generated by Troposphere for managing the AWS resources
:return: None
"""
assert EXPECTED_ALERTING_TEMPLATE == get_alerting_cf_template()
| 32.048611 | 95 | 0.664355 | 409 | 4,615 | 7.444988 | 0.361858 | 0.016092 | 0.013136 | 0.019048 | 0.470279 | 0.361248 | 0.313957 | 0.287028 | 0.262069 | 0.262069 | 0 | 0.014341 | 0.274756 | 4,615 | 143 | 96 | 32.272727 | 0.895429 | 0.039437 | 0 | 0.559701 | 1 | 0 | 0.953989 | 0.193563 | 0 | 0 | 0 | 0 | 0.007463 | 1 | 0.007463 | false | 0 | 0.007463 | 0 | 0.014925 | 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 |
7126b82fa8e4f92f61ee69113cba43b96597c4c3 | 502 | py | Python | tests/test_tools.py | ericfrederich/graphviz | 6c53fe9b85b5217888ae44591f72fc919b4c0ecd | [
"MIT"
] | null | null | null | tests/test_tools.py | ericfrederich/graphviz | 6c53fe9b85b5217888ae44591f72fc919b4c0ecd | [
"MIT"
] | null | null | null | tests/test_tools.py | ericfrederich/graphviz | 6c53fe9b85b5217888ae44591f72fc919b4c0ecd | [
"MIT"
] | null | null | null | # test_tools.py
import unittest2 as unittest
import os
from graphviz.tools import mkdirs
class TestMkdirs(unittest.TestCase):
@staticmethod
def _dirnames(path=os.curdir):
return [name for name in os.listdir(path) if os.path.isdir(name)]
def test_cwd(self):
dirnames = self._dirnames()
mkdirs('setup.py')
self.assertEqual(self._dirnames(), dirnames)
def test_file(self):
with self.assertRaises(OSError):
mkdirs('setup.py/spam')
| 21.826087 | 73 | 0.667331 | 64 | 502 | 5.140625 | 0.546875 | 0.109422 | 0.079027 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002571 | 0.2251 | 502 | 22 | 74 | 22.818182 | 0.843188 | 0.025896 | 0 | 0 | 0 | 0 | 0.043121 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.214286 | false | 0 | 0.214286 | 0.071429 | 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 |
7126c00f97c323c339209f80afa2cb6dd00752f4 | 21,601 | py | Python | fhirclient/models/appointment.py | mdx-dev/client-py | f6c16c9bd386c5b05d69753b89c6519d568814ac | [
"Apache-2.0"
] | null | null | null | fhirclient/models/appointment.py | mdx-dev/client-py | f6c16c9bd386c5b05d69753b89c6519d568814ac | [
"Apache-2.0"
] | null | null | null | fhirclient/models/appointment.py | mdx-dev/client-py | f6c16c9bd386c5b05d69753b89c6519d568814ac | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Appointment) on 2019-01-22.
# 2019, SMART Health IT.
from . import domainresource
class Appointment(domainresource.DomainResource):
"""
A
b
o
o
k
i
n
g
o
f
a
h
e
a
l
t
h
c
a
r
e
e
v
e
n
t
a
m
o
n
g
p
a
t
i
e
n
t
(
s
)
,
p
r
a
c
t
i
t
i
o
n
e
r
(
s
)
,
r
e
l
a
t
e
d
p
e
r
s
o
n
(
s
)
a
n
d
/
o
r
d
e
v
i
c
e
(
s
)
f
o
r
a
s
p
e
c
i
f
i
c
d
a
t
e
/
t
i
m
e
.
T
h
i
s
m
a
y
r
e
s
u
l
t
i
n
o
n
e
o
r
m
o
r
e
E
n
c
o
u
n
t
e
r
(
s
)
.
"""
resource_type = "Appointment"
def __init__(self, jsondict=None, strict=True):
""" Initialize all valid properties.
:raises: FHIRValidationError on validation errors, unless strict is False
:param dict jsondict: A JSON dictionary to use for initialization
:param bool strict: If True (the default), invalid variables will raise a TypeError
"""
self.appointmentType = None
"""
T
h
e
s
t
y
l
e
o
f
a
p
p
o
i
n
t
m
e
n
t
o
r
p
a
t
i
e
n
t
t
h
a
t
h
a
s
b
e
e
n
b
o
o
k
e
d
i
n
t
h
e
s
l
o
t
(
n
o
t
s
e
r
v
i
c
e
t
y
p
e
)
.
Type `CodeableConcept` (represented as `dict` in JSON). """
self.basedOn = None
"""
T
h
e
s
e
r
v
i
c
e
r
e
q
u
e
s
t
t
h
i
s
a
p
p
o
i
n
t
m
e
n
t
i
s
a
l
l
o
c
a
t
e
d
t
o
a
s
s
e
s
s
.
List of `FHIRReference` items (represented as `dict` in JSON). """
self.cancelationReason = None
"""
T
h
e
c
o
d
e
d
r
e
a
s
o
n
f
o
r
t
h
e
a
p
p
o
i
n
t
m
e
n
t
b
e
i
n
g
c
a
n
c
e
l
l
e
d
.
Type `CodeableConcept` (represented as `dict` in JSON). """
self.comment = None
"""
A
d
d
i
t
i
o
n
a
l
c
o
m
m
e
n
t
s
.
Type `str`. """
self.created = None
"""
T
h
e
d
a
t
e
t
h
a
t
t
h
i
s
a
p
p
o
i
n
t
m
e
n
t
w
a
s
i
n
i
t
i
a
l
l
y
c
r
e
a
t
e
d
.
Type `FHIRDate` (represented as `str` in JSON). """
self.description = None
"""
S
h
o
w
n
o
n
a
s
u
b
j
e
c
t
l
i
n
e
i
n
a
m
e
e
t
i
n
g
r
e
q
u
e
s
t
,
o
r
a
p
p
o
i
n
t
m
e
n
t
l
i
s
t
.
Type `str`. """
self.end = None
"""
W
h
e
n
a
p
p
o
i
n
t
m
e
n
t
i
s
t
o
c
o
n
c
l
u
d
e
.
Type `FHIRDate` (represented as `str` in JSON). """
self.identifier = None
"""
E
x
t
e
r
n
a
l
I
d
s
f
o
r
t
h
i
s
i
t
e
m
.
List of `Identifier` items (represented as `dict` in JSON). """
self.minutesDuration = None
"""
C
a
n
b
e
l
e
s
s
t
h
a
n
s
t
a
r
t
/
e
n
d
(
e
.
g
.
e
s
t
i
m
a
t
e
)
.
Type `int`. """
self.participant = None
"""
P
a
r
t
i
c
i
p
a
n
t
s
i
n
v
o
l
v
e
d
i
n
a
p
p
o
i
n
t
m
e
n
t
.
List of `AppointmentParticipant` items (represented as `dict` in JSON). """
self.patientInstruction = None
"""
D
e
t
a
i
l
e
d
i
n
f
o
r
m
a
t
i
o
n
a
n
d
i
n
s
t
r
u
c
t
i
o
n
s
f
o
r
t
h
e
p
a
t
i
e
n
t
.
Type `str`. """
self.priority = None
"""
U
s
e
d
t
o
m
a
k
e
i
n
f
o
r
m
e
d
d
e
c
i
s
i
o
n
s
i
f
n
e
e
d
i
n
g
t
o
r
e
-
p
r
i
o
r
i
t
i
z
e
.
Type `int`. """
self.reasonCode = None
"""
C
o
d
e
d
r
e
a
s
o
n
t
h
i
s
a
p
p
o
i
n
t
m
e
n
t
i
s
s
c
h
e
d
u
l
e
d
.
List of `CodeableConcept` items (represented as `dict` in JSON). """
self.reasonReference = None
"""
R
e
a
s
o
n
t
h
e
a
p
p
o
i
n
t
m
e
n
t
i
s
t
o
t
a
k
e
p
l
a
c
e
(
r
e
s
o
u
r
c
e
)
.
List of `FHIRReference` items (represented as `dict` in JSON). """
self.requestedPeriod = None
"""
P
o
t
e
n
t
i
a
l
d
a
t
e
/
t
i
m
e
i
n
t
e
r
v
a
l
(
s
)
r
e
q
u
e
s
t
e
d
t
o
a
l
l
o
c
a
t
e
t
h
e
a
p
p
o
i
n
t
m
e
n
t
w
i
t
h
i
n
.
List of `Period` items (represented as `dict` in JSON). """
self.serviceCategory = None
"""
A
b
r
o
a
d
c
a
t
e
g
o
r
i
z
a
t
i
o
n
o
f
t
h
e
s
e
r
v
i
c
e
t
h
a
t
i
s
t
o
b
e
p
e
r
f
o
r
m
e
d
d
u
r
i
n
g
t
h
i
s
a
p
p
o
i
n
t
m
e
n
t
.
List of `CodeableConcept` items (represented as `dict` in JSON). """
self.serviceType = None
"""
T
h
e
s
p
e
c
i
f
i
c
s
e
r
v
i
c
e
t
h
a
t
i
s
t
o
b
e
p
e
r
f
o
r
m
e
d
d
u
r
i
n
g
t
h
i
s
a
p
p
o
i
n
t
m
e
n
t
.
List of `CodeableConcept` items (represented as `dict` in JSON). """
self.slot = None
"""
T
h
e
s
l
o
t
s
t
h
a
t
t
h
i
s
a
p
p
o
i
n
t
m
e
n
t
i
s
f
i
l
l
i
n
g
.
List of `FHIRReference` items (represented as `dict` in JSON). """
self.specialty = None
"""
T
h
e
s
p
e
c
i
a
l
t
y
o
f
a
p
r
a
c
t
i
t
i
o
n
e
r
t
h
a
t
w
o
u
l
d
b
e
r
e
q
u
i
r
e
d
t
o
p
e
r
f
o
r
m
t
h
e
s
e
r
v
i
c
e
r
e
q
u
e
s
t
e
d
i
n
t
h
i
s
a
p
p
o
i
n
t
m
e
n
t
.
List of `CodeableConcept` items (represented as `dict` in JSON). """
self.start = None
"""
W
h
e
n
a
p
p
o
i
n
t
m
e
n
t
i
s
t
o
t
a
k
e
p
l
a
c
e
.
Type `FHIRDate` (represented as `str` in JSON). """
self.status = None
"""
p
r
o
p
o
s
e
d
|
p
e
n
d
i
n
g
|
b
o
o
k
e
d
|
a
r
r
i
v
e
d
|
f
u
l
f
i
l
l
e
d
|
c
a
n
c
e
l
l
e
d
|
n
o
s
h
o
w
|
e
n
t
e
r
e
d
-
i
n
-
e
r
r
o
r
|
c
h
e
c
k
e
d
-
i
n
|
w
a
i
t
l
i
s
t
.
Type `str`. """
self.supportingInformation = None
"""
A
d
d
i
t
i
o
n
a
l
i
n
f
o
r
m
a
t
i
o
n
t
o
s
u
p
p
o
r
t
t
h
e
a
p
p
o
i
n
t
m
e
n
t
.
List of `FHIRReference` items (represented as `dict` in JSON). """
super(Appointment, self).__init__(jsondict=jsondict, strict=strict)
def elementProperties(self):
js = super(Appointment, self).elementProperties()
js.extend([
("appointmentType", "appointmentType", codeableconcept.CodeableConcept, False, None, False),
("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False),
("cancelationReason", "cancelationReason", codeableconcept.CodeableConcept, False, None, False),
("comment", "comment", str, False, None, False),
("created", "created", fhirdate.FHIRDate, False, None, False),
("description", "description", str, False, None, False),
("end", "end", fhirdate.FHIRDate, False, None, False),
("identifier", "identifier", identifier.Identifier, True, None, False),
("minutesDuration", "minutesDuration", int, False, None, False),
("participant", "participant", AppointmentParticipant, True, None, True),
("patientInstruction", "patientInstruction", str, False, None, False),
("priority", "priority", int, False, None, False),
("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False),
("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False),
("requestedPeriod", "requestedPeriod", period.Period, True, None, False),
("serviceCategory", "serviceCategory", codeableconcept.CodeableConcept, True, None, False),
("serviceType", "serviceType", codeableconcept.CodeableConcept, True, None, False),
("slot", "slot", fhirreference.FHIRReference, True, None, False),
("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False),
("start", "start", fhirdate.FHIRDate, False, None, False),
("status", "status", str, False, None, True),
("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False),
])
return js
from . import backboneelement
class AppointmentParticipant(backboneelement.BackboneElement):
"""
P
a
r
t
i
c
i
p
a
n
t
s
i
n
v
o
l
v
e
d
i
n
a
p
p
o
i
n
t
m
e
n
t
.
L
i
s
t
o
f
p
a
r
t
i
c
i
p
a
n
t
s
i
n
v
o
l
v
e
d
i
n
t
h
e
a
p
p
o
i
n
t
m
e
n
t
.
"""
resource_type = "AppointmentParticipant"
def __init__(self, jsondict=None, strict=True):
""" Initialize all valid properties.
:raises: FHIRValidationError on validation errors, unless strict is False
:param dict jsondict: A JSON dictionary to use for initialization
:param bool strict: If True (the default), invalid variables will raise a TypeError
"""
self.actor = None
"""
P
e
r
s
o
n
,
L
o
c
a
t
i
o
n
/
H
e
a
l
t
h
c
a
r
e
S
e
r
v
i
c
e
o
r
D
e
v
i
c
e
.
Type `FHIRReference` (represented as `dict` in JSON). """
self.period = None
"""
P
a
r
t
i
c
i
p
a
t
i
o
n
p
e
r
i
o
d
o
f
t
h
e
a
c
t
o
r
.
Type `Period` (represented as `dict` in JSON). """
self.required = None
"""
r
e
q
u
i
r
e
d
|
o
p
t
i
o
n
a
l
|
i
n
f
o
r
m
a
t
i
o
n
-
o
n
l
y
.
Type `str`. """
self.status = None
"""
a
c
c
e
p
t
e
d
|
d
e
c
l
i
n
e
d
|
t
e
n
t
a
t
i
v
e
|
n
e
e
d
s
-
a
c
t
i
o
n
.
Type `str`. """
self.type = None
"""
R
o
l
e
o
f
p
a
r
t
i
c
i
p
a
n
t
i
n
t
h
e
a
p
p
o
i
n
t
m
e
n
t
.
List of `CodeableConcept` items (represented as `dict` in JSON). """
super(AppointmentParticipant, self).__init__(jsondict=jsondict, strict=strict)
def elementProperties(self):
js = super(AppointmentParticipant, self).elementProperties()
js.extend([
("actor", "actor", fhirreference.FHIRReference, False, None, False),
("period", "period", period.Period, False, None, False),
("required", "required", str, False, None, False),
("status", "status", str, False, None, True),
("type", "type", codeableconcept.CodeableConcept, True, None, False),
])
return js
import sys
try:
from . import codeableconcept
except ImportError:
codeableconcept = sys.modules[__package__ + '.codeableconcept']
try:
from . import fhirdate
except ImportError:
fhirdate = sys.modules[__package__ + '.fhirdate']
try:
from . import fhirreference
except ImportError:
fhirreference = sys.modules[__package__ + '.fhirreference']
try:
from . import identifier
except ImportError:
identifier = sys.modules[__package__ + '.identifier']
try:
from . import period
except ImportError:
period = sys.modules[__package__ + '.period']
| 12.566027 | 111 | 0.264571 | 2,087 | 21,601 | 2.720173 | 0.067082 | 0.020786 | 0.014268 | 0.014092 | 0.547648 | 0.439669 | 0.420645 | 0.391404 | 0.347014 | 0.302096 | 0 | 0.003124 | 0.688764 | 21,601 | 1,718 | 112 | 12.573341 | 0.841291 | 0.052822 | 0 | 0.252632 | 1 | 0 | 0.1255 | 0.01279 | 0 | 0 | 0 | 0 | 0 | 1 | 0.042105 | false | 0 | 0.136842 | 0 | 0.242105 | 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 |
7128997b1ef930b80c2c6f5e764041f10525b62e | 565 | py | Python | 030.py | zlsun/ProjectEuler | 813ec545484924a052f1bd7fd90a4c676eea3bba | [
"MIT"
] | null | null | null | 030.py | zlsun/ProjectEuler | 813ec545484924a052f1bd7fd90a4c676eea3bba | [
"MIT"
] | null | null | null | 030.py | zlsun/ProjectEuler | 813ec545484924a052f1bd7fd90a4c676eea3bba | [
"MIT"
] | null | null | null | #-*- encoding: utf-8 -*-
"""
Digit fifth powers
Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:
1634 = 1^4 + 6^4 + 3^4 + 4^4
8208 = 8^4 + 2^4 + 0^4 + 8^4
9474 = 9^4 + 4^4 + 7^4 + 4^4
As 1 = 1^4 is not a sum it is not included.
The sum of these numbers is 1634 + 8208 + 9474 = 19316.
Find the sum of all the numbers that can be written as the sum of fifth powers of their digits.
"""
from utils import *
N = 5
print sum(i for i in xrange(2, 9 ** N * 6) if sum(int(j) ** N for j in str(i)) == i)
# 443839
| 29.736842 | 106 | 0.642478 | 122 | 565 | 2.97541 | 0.47541 | 0.033058 | 0.088154 | 0.088154 | 0.181818 | 0.181818 | 0.181818 | 0.181818 | 0.181818 | 0 | 0 | 0.155093 | 0.235398 | 565 | 18 | 107 | 31.388889 | 0.685185 | 0.053097 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.333333 | null | null | 0.333333 | 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 |
7139ef17c5d8a69c94591c894b0b4ef06cc3d0f6 | 2,787 | py | Python | files/CLI/argparse_iaxo_example.py | mipt-npm-study/sciprog-python | 09a0d99254fcd559ec8d13bedd5521e98e86b3ce | [
"MIT"
] | 3 | 2021-09-12T20:54:08.000Z | 2021-09-21T14:49:15.000Z | files/CLI/argparse_iaxo_example.py | mipt-npm-study/sciprog-python | 09a0d99254fcd559ec8d13bedd5521e98e86b3ce | [
"MIT"
] | null | null | null | files/CLI/argparse_iaxo_example.py | mipt-npm-study/sciprog-python | 09a0d99254fcd559ec8d13bedd5521e98e86b3ce | [
"MIT"
] | 2 | 2021-09-14T13:15:41.000Z | 2021-09-14T15:18:01.000Z | import os,sys, time
import stat
delay = 30
repeat = 10
narg = len(sys.argv)
cfgFile = ""
sectionName = ""
jobName = ""
email = ""
logPath = ""
idOffset = 0
duration = "7-00:00:00"
if narg < 2:
print ""
print "----------------------------------------------------------------"
print ""
print " This program launches restG4 jobs to slurm "
print ""
print " The usual restG4 command is : restG4 RML_FILE [SECTION_NAME]"
print ""
print " Values in brackets [] are optional"
print ""
print " Usage : restG4ToSlurm.py -c RML_FILE "
print ""
print " - Options : "
print " ----------- "
print ""
print " -n or --sectionName SECTION_NAME :"
print " Defines the name of the section to be used from RML_FILE"
print ""
print " -e or --email MAIL :"
print " It allows to specify the e-mail for batch system job notifications"
print ""
print " -i or --initialRun VALUE :"
print " An integer number to introduce the first run number."
print ""
print " -r or --repeat REPEAT_VALUE :"
print " This option defines the number of simulations we will launch (default is 10)"
print ""
print " -d or --delay DELAY_TIME :"
print " Time delay between launching 2 reapeated jobs (default is 30 seconds)"
print " Random seed is connected to the time stamp."
print ""
print " -j or --jobName JOB_NAME :"
print " JOB_NAME defines the name of scripts and output files stored under slurmJobs/"
print ""
print " -o or --onlyScripts :"
print " It will just generate the slurm scripts without launching to the queue"
print ""
print "----------------------------------------------------------------"
print ""
sys.exit(1)
onlyScripts=0
for x in range(narg-1):
if ( sys.argv[x+1] == "--repeat" or sys.argv[x+1] == "-r" ):
repeat = int(sys.argv[x+2])
if ( sys.argv[x+1] == "--cfgFile" or sys.argv[x+1] == "-c" ):
cfgFile = sys.argv[x+2]
if ( sys.argv[x+1] == "--logPath" or sys.argv[x+1] == "-l" ):
logPath = sys.argv[x+2]
if ( sys.argv[x+1] == "--idOffset" or sys.argv[x+1] == "-i" ):
idOffset = int(sys.argv[x+2])
if ( sys.argv[x+1] == "--delay" or sys.argv[x+1] == "-d" ):
delay = int( sys.argv[x+2] )
if ( sys.argv[x+1] == "--sectionName" or sys.argv[x+1] == "-n" ):
sectionName = sys.argv[x+2]
if ( sys.argv[x+1] == "--jobName" or sys.argv[x+1] == "-j" ):
jobName = sys.argv[x+2]
if ( sys.argv[x+1] == "--email" or sys.argv[x+1] == "-e" ):
email = sys.argv[x+2]
if ( sys.argv[x+1] == "--onlyScripts" or sys.argv[x+1] == "-o" ):
onlyScripts = 1
if cfgFile == "":
print ( "RML file was not provided. Use -c file.rml" )
sys.exit(1)
| 30.626374 | 90 | 0.546107 | 396 | 2,787 | 3.820707 | 0.292929 | 0.124917 | 0.137475 | 0.107072 | 0.184402 | 0.111699 | 0.111699 | 0.111699 | 0.111699 | 0.045605 | 0 | 0.025444 | 0.252601 | 2,787 | 90 | 91 | 30.966667 | 0.700912 | 0 | 0 | 0.253333 | 0 | 0 | 0.429494 | 0.045928 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.026667 | null | null | 0.52 | 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 | 0 | 0 | 0 | 1 | 0 | 2 |
853fa59f45009f61f705af7c958d2c312d6e248e | 1,043 | py | Python | lib/fbuild/builders/c/intel.py | felix-lang/fbuild | 9595fbfd6d3ceece31fda2f96c35d4a241f0129b | [
"PSF-2.0",
"BSD-2-Clause"
] | 40 | 2015-02-07T00:44:12.000Z | 2021-04-02T13:41:08.000Z | lib/fbuild/builders/c/intel.py | felix-lang/fbuild | 9595fbfd6d3ceece31fda2f96c35d4a241f0129b | [
"PSF-2.0",
"BSD-2-Clause"
] | 30 | 2015-02-06T17:45:15.000Z | 2019-01-10T16:34:29.000Z | lib/fbuild/builders/c/intel.py | felix-lang/fbuild | 9595fbfd6d3ceece31fda2f96c35d4a241f0129b | [
"PSF-2.0",
"BSD-2-Clause"
] | 3 | 2015-09-03T06:38:02.000Z | 2019-10-24T14:26:57.000Z | import re
import fbuild.builders.c.gcc
# ------------------------------------------------------------------------------
class Intel(fbuild.builders.c.gcc.Gcc):
def version(self, *args, **kwargs):
"""Return the version of the Intel compiler executable."""
stdout, stderr = self.ctx.execute((self.exe, '--version'), quieter=1)
m = re.match(r'ic(?:c|pc) \(ICC\) ([\d.]+)', stdout.decode())
return m.group(1) if m else None
# ------------------------------------------------------------------------------
def make_cc(ctx, exe=None, default_exes=['icc'], **kwargs):
return Intel(ctx,
fbuild.builders.find_program(ctx, [exe] if exe else default_exes),
**kwargs)
# ------------------------------------------------------------------------------
def static(*args, make_cc=make_cc, **kwargs):
return fbuild.builders.c.gcc.static(*args, make_cc=make_cc, **kwargs)
def shared(*args, make_cc=make_cc, **kwargs):
return fbuild.builders.c.gcc.shared(*args, make_cc=make_cc, **kwargs)
| 34.766667 | 80 | 0.499521 | 121 | 1,043 | 4.206612 | 0.371901 | 0.10609 | 0.117878 | 0.141454 | 0.314342 | 0.314342 | 0.314342 | 0.180747 | 0.180747 | 0.180747 | 0 | 0.00223 | 0.139981 | 1,043 | 29 | 81 | 35.965517 | 0.565217 | 0.278044 | 0 | 0 | 0 | 0 | 0.052349 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0.133333 | 0.2 | 0.733333 | 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 |
8562f1b5e258989c61241ffd1b2f7bb988e4a9f0 | 4,470 | py | Python | chb/app/BDictionary.py | psifertex/CodeHawk-Binary | 1711d7b16d32a2e9ffa9d22af483182b3f9ded77 | [
"MIT"
] | null | null | null | chb/app/BDictionary.py | psifertex/CodeHawk-Binary | 1711d7b16d32a2e9ffa9d22af483182b3f9ded77 | [
"MIT"
] | null | null | null | chb/app/BDictionary.py | psifertex/CodeHawk-Binary | 1711d7b16d32a2e9ffa9d22af483182b3f9ded77 | [
"MIT"
] | null | null | null | # ------------------------------------------------------------------------------
# Access to the CodeHawk Binary Analyzer Analysis Results
# Author: Henny Sipma
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2016-2020 Kestrel Technology LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# ------------------------------------------------------------------------------
"""Dictionary for indexing basic data structures."""
import chb.util.fileutil as UF
import chb.util.IndexedTable as IT
import chb.util.StringIndexedTable as SI
import chb.asm.AsmRegister as AR
import chb.mips.MIPSRegister as MR
class AsmAddress(object):
def __init__(self,index,tags,args):
self.index = index
self.tags = tags
self.args = args
def get_key(self):
return (','.join(self.tags), ','.join([str(x) for x in self.args]))
def get_hex(self): return(self.tags[0])
def get_int(self): return int(self.tags[0],16)
def __str__(self): return self.tags[0]
register_constructors = {
's': lambda x:AR.SegmentRegister(*x),
'c': lambda x:AR.CPURegister(*x),
'd': lambda x:AR.DoubleRegister(*x),
'f': lambda x:AR.FloatingPointRegister(*x),
'ctr': lambda x:AR.ControlRegister(*x),
'dbg': lambda x:AR.DebugRegister(*x),
'm': lambda x:AR.MmxRegister(*x),
'x': lambda x:AR.XmmRegister(*x),
'p': lambda x:MR.MIPSRegister(*x),
'ps': lambda x:MR.MIPSSpecialRegister(*x),
'pfp': lambda x:MR.MIPSFloatingPointRegister(*x)
}
class BDictionary(object):
def __init__(self,app,xnode):
self.app = app
self.string_table = SI.StringIndexedTable('string-table')
self.address_table = IT.IndexedTable('address-table')
self.register_table = IT.IndexedTable('register-table')
self.tables = [
(self.address_table, self._read_xml_address_table),
(self.register_table, self._read_xml_register_table)
]
self.string_tables = [
(self.string_table, self._read_xml_string_table)
]
self.initialize(xnode)
# -------------- Retrieve items from dictionary tables ---------------------
def get_string(self,ix): return self.string_table.retrieve(ix)
def get_address(self,ix): return self.address_table.retrieve(ix)
def get_register(self,ix): return self.register_table.retrieve(ix)
# ----------------------- xml accessors ------------------------------------
def read_xml_string(self,n):
return self.get_string(int(n.get('istr')))
# ---------------- Initialize dictionary from file -------------------------
def initialize(self,xnode):
if xnode is None: return
for (t,f) in self.tables + self.string_tables:
t.reset()
f(xnode.find(t.name))
def _read_xml_string_table(self,txnode): self.string_table.read_xml(txnode)
def _read_xml_address_table(self,txnode):
def get_value(node):
rep = IT.get_rep(node)
args = rep
return AsmAddress(*args)
self.address_table.read_xml(txnode,'n',get_value)
def _read_xml_register_table(self,txnode):
def get_value(node):
rep = IT.get_rep(node)
tag = rep[1][0]
args = (self,) + rep
return register_constructors[tag](args)
self.register_table.read_xml(txnode,'n',get_value)
| 37.25 | 80 | 0.624832 | 575 | 4,470 | 4.735652 | 0.344348 | 0.039662 | 0.026441 | 0.017628 | 0.141755 | 0.052883 | 0.052883 | 0.033052 | 0.033052 | 0.033052 | 0 | 0.004174 | 0.195973 | 4,470 | 119 | 81 | 37.563025 | 0.753478 | 0.374944 | 0 | 0.060606 | 0 | 0 | 0.023559 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.242424 | false | 0 | 0.075758 | 0.121212 | 0.409091 | 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 |
856bd7469e822a46ad231c78ef89255d56a5e21f | 329 | py | Python | src/reader/test_cases/test_sitemap.py | LukeMurphey/textcritical_net | 887b11ac66d1970576ea83b307cefc4fdc4319b5 | [
"CC-BY-3.0"
] | 6 | 2019-05-18T04:31:39.000Z | 2020-12-10T15:22:59.000Z | src/reader/test_cases/test_sitemap.py | LukeMurphey/textcritical_net | 887b11ac66d1970576ea83b307cefc4fdc4319b5 | [
"CC-BY-3.0"
] | 1 | 2020-05-19T06:04:11.000Z | 2020-06-04T06:16:02.000Z | src/reader/test_cases/test_sitemap.py | LukeMurphey/textcritical_net | 887b11ac66d1970576ea83b307cefc4fdc4319b5 | [
"CC-BY-3.0"
] | null | null | null | from django.test import TestCase
from reader.sitemaps import StaticSitemap, WorksSitemap
class TestStaticSitemap(TestCase):
def test_load(self):
sitemap = StaticSitemap()
sitemap.items()
class TestWorksSitemap(TestCase):
def test_load(self):
sitemap = WorksSitemap()
sitemap.items()
| 19.352941 | 55 | 0.702128 | 33 | 329 | 6.939394 | 0.515152 | 0.09607 | 0.131004 | 0.165939 | 0.262009 | 0.262009 | 0 | 0 | 0 | 0 | 0 | 0 | 0.215805 | 329 | 16 | 56 | 20.5625 | 0.887597 | 0 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 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 |
857b40c8f13ae0999d15724ef85bd05ea6b364b4 | 526 | py | Python | examples/puma560_animation.py | rodosha98/FRPGitHomework | 0905c79ccc28d33f9385c09c03e8e18d8c720787 | [
"MIT"
] | 214 | 2017-10-30T04:36:09.000Z | 2022-03-27T06:05:53.000Z | examples/puma560_animation.py | rodosha98/FRPGitHomework | 0905c79ccc28d33f9385c09c03e8e18d8c720787 | [
"MIT"
] | 16 | 2017-11-28T08:07:04.000Z | 2020-05-12T22:15:10.000Z | examples/puma560_animation.py | rodosha98/FRPGitHomework | 0905c79ccc28d33f9385c09c03e8e18d8c720787 | [
"MIT"
] | 57 | 2017-11-28T02:17:53.000Z | 2021-02-18T14:32:51.000Z | import robopy.base.model as model
import numpy as np
def main():
robot = model.Puma560()
a = np.transpose(np.asmatrix(np.linspace(1, -180, 500)))
b = np.transpose(np.asmatrix(np.linspace(1, 180, 500)))
c = np.transpose(np.asmatrix(np.linspace(1, 90, 500)))
d = np.transpose(np.asmatrix(np.linspace(1, 450, 500)))
e = np.asmatrix(np.zeros((500, 1)))
f = np.concatenate((d, b, a, e, c, d), axis=1)
robot.animate(stances=f, frame_rate=30, unit='deg')
if __name__ == '__main__':
main()
| 23.909091 | 60 | 0.627376 | 86 | 526 | 3.732558 | 0.430233 | 0.155763 | 0.186916 | 0.261682 | 0.436137 | 0.436137 | 0.436137 | 0.23676 | 0.23676 | 0 | 0 | 0.086449 | 0.186312 | 526 | 21 | 61 | 25.047619 | 0.663551 | 0 | 0 | 0 | 0 | 0 | 0.020992 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.153846 | 0 | 0.230769 | 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 |
858011189ad236ce64357e56d129931d89797cce | 233 | gyp | Python | test/gyppies/make_global_settings/test.gyp | indutny/gyp.js | eb8aa23d7b1599db892d54d8c815ce75fa7ae74f | [
"Unlicense",
"MIT"
] | 188 | 2016-06-09T17:49:46.000Z | 2022-02-05T16:46:00.000Z | test/gyppies/make_global_settings/test.gyp | indutny/gyp.js | eb8aa23d7b1599db892d54d8c815ce75fa7ae74f | [
"Unlicense",
"MIT"
] | 38 | 2016-06-12T20:13:29.000Z | 2019-05-12T17:21:05.000Z | test/gyppies/make_global_settings/test.gyp | indutny/gyp.js | eb8aa23d7b1599db892d54d8c815ce75fa7ae74f | [
"Unlicense",
"MIT"
] | 22 | 2016-06-12T23:06:17.000Z | 2019-05-12T11:25:51.000Z | {
"target_defaults": {
"make_global_settings": [
[ "CC", "echo" ],
[ "LD", "echo" ],
],
},
"targets": [{
"target_name": "test",
"type": "executable",
"sources": [
"main.c",
],
}],
}
| 13.705882 | 29 | 0.407725 | 18 | 233 | 5.055556 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.334764 | 233 | 16 | 30 | 14.5625 | 0.587097 | 0 | 0 | 0.133333 | 0 | 0 | 0.412017 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8585bb7bdabb79b49bb3ddc35ad3fa3457ea59c4 | 2,910 | py | Python | pysnmp/SNMP-USM-HMAC-SHA2-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/SNMP-USM-HMAC-SHA2-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/SNMP-USM-HMAC-SHA2-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 SNMP-USM-HMAC-SHA2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNMP-USM-HMAC-SHA2-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:00:31 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)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection", "ValueRangeConstraint")
snmpAuthProtocols, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "snmpAuthProtocols")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
ModuleIdentity, Bits, mib_2, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, ObjectIdentity, NotificationType, IpAddress, Counter32, Integer32, MibIdentifier, Counter64, Unsigned32, iso = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "Bits", "mib-2", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "ObjectIdentity", "NotificationType", "IpAddress", "Counter32", "Integer32", "MibIdentifier", "Counter64", "Unsigned32", "iso")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
snmpUsmHmacSha2MIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 235))
snmpUsmHmacSha2MIB.setRevisions(('2016-04-18 00:00', '2015-10-14 00:00',))
if mibBuilder.loadTexts: snmpUsmHmacSha2MIB.setLastUpdated('201604180000Z')
if mibBuilder.loadTexts: snmpUsmHmacSha2MIB.setOrganization('SNMPv3 Working Group')
usmHMAC128SHA224AuthProtocol = ObjectIdentity((1, 3, 6, 1, 6, 3, 10, 1, 1, 4))
if mibBuilder.loadTexts: usmHMAC128SHA224AuthProtocol.setStatus('current')
usmHMAC192SHA256AuthProtocol = ObjectIdentity((1, 3, 6, 1, 6, 3, 10, 1, 1, 5))
if mibBuilder.loadTexts: usmHMAC192SHA256AuthProtocol.setStatus('current')
usmHMAC256SHA384AuthProtocol = ObjectIdentity((1, 3, 6, 1, 6, 3, 10, 1, 1, 6))
if mibBuilder.loadTexts: usmHMAC256SHA384AuthProtocol.setStatus('current')
usmHMAC384SHA512AuthProtocol = ObjectIdentity((1, 3, 6, 1, 6, 3, 10, 1, 1, 7))
if mibBuilder.loadTexts: usmHMAC384SHA512AuthProtocol.setStatus('current')
mibBuilder.exportSymbols("SNMP-USM-HMAC-SHA2-MIB", usmHMAC384SHA512AuthProtocol=usmHMAC384SHA512AuthProtocol, usmHMAC256SHA384AuthProtocol=usmHMAC256SHA384AuthProtocol, usmHMAC192SHA256AuthProtocol=usmHMAC192SHA256AuthProtocol, PYSNMP_MODULE_ID=snmpUsmHmacSha2MIB, usmHMAC128SHA224AuthProtocol=usmHMAC128SHA224AuthProtocol, snmpUsmHmacSha2MIB=snmpUsmHmacSha2MIB)
| 103.928571 | 493 | 0.800344 | 291 | 2,910 | 7.993127 | 0.405498 | 0.069218 | 0.05417 | 0.008598 | 0.297506 | 0.189166 | 0.189166 | 0.189166 | 0.189166 | 0.189166 | 0 | 0.098889 | 0.072165 | 2,910 | 27 | 494 | 107.777778 | 0.762593 | 0.116151 | 0 | 0 | 0 | 0 | 0.23215 | 0.025751 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.35 | 0 | 0.35 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
858c1aef14290a74bf6a4f31f9628e3829210627 | 1,811 | py | Python | codango/userprofile/api.py | NdagiStanley/silver-happiness | 67fb6dd4047c603a84276f88a021d4489cf3b41e | [
"MIT"
] | 2 | 2019-10-17T01:03:12.000Z | 2021-11-24T07:43:14.000Z | codango/userprofile/api.py | NdagiStanley/silver-happiness | 67fb6dd4047c603a84276f88a021d4489cf3b41e | [
"MIT"
] | 49 | 2019-09-05T02:48:04.000Z | 2021-06-28T02:29:42.000Z | codango/userprofile/api.py | NdagiStanley/silver-happiness | 67fb6dd4047c603a84276f88a021d4489cf3b41e | [
"MIT"
] | 1 | 2021-11-25T10:19:27.000Z | 2021-11-25T10:19:27.000Z | from rest_framework import generics
from serializers import UserProfileSerializer, FollowSerializer, NotificationSerializer, LanguageSerializer
from models import UserProfile, Follow, Notification, Language
class UserProfileListAPIView(generics.ListCreateAPIView):
"""For /api/v1/userprofiles/ url path"""
queryset = UserProfile.objects.all()
serializer_class = UserProfileSerializer
class UserProfileDetailAPIView(generics.RetrieveUpdateDestroyAPIView):
"""For /api/v1/userprofile/<> url path"""
queryset = UserProfile.objects.all()
serializer_class = UserProfileSerializer
class FollowListAPIView(generics.ListCreateAPIView):
"""For /api/v1/userprofile/follows/ url path"""
queryset = Follow.objects.all()
serializer_class = FollowSerializer
class FollowDetailAPIView(generics.RetrieveUpdateDestroyAPIView):
"""For /api/v1/userprofile/follows/<> url path"""
queryset = Follow.objects.all()
serializer_class = FollowSerializer
class LanguageListAPIView(generics.ListCreateAPIView):
"""For /api/v1/userprofile/langauges/ url path"""
queryset = Language.objects.all()
serializer_class = LanguageSerializer
class LanguageDetailAPIView(generics.RetrieveUpdateDestroyAPIView):
"""For /api/v1/userprofile/langauges/<> url path"""
queryset = Language.objects.all()
serializer_class = LanguageSerializer
class NotificationListAPIView(generics.ListCreateAPIView):
"""For /api/v1/userprofile/notifications/ url path"""
queryset = Notification.objects.all()
serializer_class = NotificationSerializer
class NotificationDetailAPIView(generics.RetrieveUpdateDestroyAPIView):
"""For /api/v1/userprofile/notifications/<> url path"""
queryset = Notification.objects.all()
serializer_class = NotificationSerializer
| 34.169811 | 107 | 0.775262 | 161 | 1,811 | 8.664596 | 0.242236 | 0.034409 | 0.045878 | 0.143369 | 0.7319 | 0.708244 | 0.537634 | 0.537634 | 0.537634 | 0.537634 | 0 | 0.005051 | 0.125345 | 1,811 | 52 | 108 | 34.826923 | 0.875631 | 0.18995 | 0 | 0.592593 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.111111 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 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 |
858e7f42cd3f3db7dab180d57d7fe67175d969d6 | 888 | py | Python | wagtail/documents/apps.py | stevedya/wagtail | 52e5abfe62547cdfd90ea7dfeb8bf5a52f16324c | [
"BSD-3-Clause"
] | 1 | 2022-02-09T05:25:30.000Z | 2022-02-09T05:25:30.000Z | wagtail/documents/apps.py | stevedya/wagtail | 52e5abfe62547cdfd90ea7dfeb8bf5a52f16324c | [
"BSD-3-Clause"
] | null | null | null | wagtail/documents/apps.py | stevedya/wagtail | 52e5abfe62547cdfd90ea7dfeb8bf5a52f16324c | [
"BSD-3-Clause"
] | null | null | null | from django.apps import AppConfig
from django.db.models import ForeignKey
from django.utils.translation import gettext_lazy as _
from . import get_document_model
class WagtailDocsAppConfig(AppConfig):
name = "wagtail.documents"
label = "wagtaildocs"
verbose_name = _("Wagtail documents")
default_auto_field = "django.db.models.AutoField"
def ready(self):
from wagtail.documents.signal_handlers import register_signal_handlers
register_signal_handlers()
# Set up model forms to use AdminDocumentChooser for any ForeignKey to the document model
from wagtail.admin.forms.models import register_form_field_override
from .widgets import AdminDocumentChooser
Document = get_document_model()
register_form_field_override(
ForeignKey, to=Document, override={"widget": AdminDocumentChooser}
)
| 31.714286 | 97 | 0.742117 | 100 | 888 | 6.38 | 0.48 | 0.047022 | 0.043887 | 0.07837 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.198198 | 888 | 27 | 98 | 32.888889 | 0.896067 | 0.097973 | 0 | 0 | 0 | 0 | 0.09637 | 0.032541 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0 | 0.388889 | 0 | 0.722222 | 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 |
85b15f4b3c0e60a8d815eb0733a020d22bbe2203 | 368 | py | Python | tasks/experts/notes.py | mwschouten/procapp | 79e4824088270ae0b65243190659eb37df334421 | [
"MIT"
] | null | null | null | tasks/experts/notes.py | mwschouten/procapp | 79e4824088270ae0b65243190659eb37df334421 | [
"MIT"
] | null | null | null | tasks/experts/notes.py | mwschouten/procapp | 79e4824088270ae0b65243190659eb37df334421 | [
"MIT"
] | null | null | null |
# sett things to work well in ipython
export DJANGO_SETTINGS_MODULE="proc.settings"
# load an example groupresult
from tasks.experts.tools.hbobject import HbObject
obj = HbObject({'hash': 'd0f7b7149bc25933ef5e09ff5978a541', 'type': 'data'})
gr = obj.content
# load an example groupresult
obj2 = HbObject(hash="b2d3f217fae95843303fd6092a93b784")
ar = obj2.content
| 24.533333 | 76 | 0.782609 | 44 | 368 | 6.5 | 0.727273 | 0.041958 | 0.090909 | 0.167832 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138889 | 0.119565 | 368 | 14 | 77 | 26.285714 | 0.743827 | 0.247283 | 0 | 0 | 0 | 0 | 0.32963 | 0.237037 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.166667 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
85bb3ac2125b4654371fa450f6def7a8cd3ba26d | 915 | py | Python | messageticker.py | cidoni/newsticker | afa7502ffa0bafc6a1fd7a281a4c9de972c0582a | [
"MIT"
] | null | null | null | messageticker.py | cidoni/newsticker | afa7502ffa0bafc6a1fd7a281a4c9de972c0582a | [
"MIT"
] | null | null | null | messageticker.py | cidoni/newsticker | afa7502ffa0bafc6a1fd7a281a4c9de972c0582a | [
"MIT"
] | null | null | null | # THIS SCRIPT USES THE LIBRARY AT:
# https://github.com/hzeller/rpi-rgb-led-matrix
import os, time, threading, random
from random import shuffle
import argparse
def colorRandom():
return str(random.randint(0,255)) + "," + str(random.randint(0,255)) + "," + str(random.randint(0,255))
def getIoTMessage():
parser = argparse.ArgumentParser()
parser.add_argument("-m", "--message", action="store", required=True, dest="iotmessage", help="Your incoming AWS IoT message")
args = parser.parse_args()
return args.iotmessage
def showOnLEDDisplay(dispmsg):
os.system("sudo /home/pi/risrim/display16x32/rpi-rgb-led-matrix/examples-api-use/scrolling-text-example --led-rows=16 --led-cols=32 -f /home/pi/risrim/display16x32/rpi-rgb-led-matrix/fonts/7x14.bdf -s 10 -C "+ colorRandom() +" -b 50 -l 10 "+dispmsg)
def run():
showOnLEDDisplay(getIoTMessage())
if __name__ == '__main__':
run()
| 36.6 | 253 | 0.707104 | 127 | 915 | 5.015748 | 0.637795 | 0.028257 | 0.042386 | 0.070644 | 0.216641 | 0.216641 | 0.216641 | 0.216641 | 0.094192 | 0.094192 | 0 | 0.041405 | 0.128962 | 915 | 24 | 254 | 38.125 | 0.757842 | 0.085246 | 0 | 0 | 0 | 0.0625 | 0.328537 | 0.178657 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.1875 | 0.0625 | 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 |
a420ebcb185838cc8461e561ac3b30c9e3715090 | 265 | py | Python | config.py | Saravanakrish97/Request-traker | 56d01da04226ce823e1c1f3c2edad3ae07dfd44c | [
"Apache-2.0"
] | 29 | 2021-11-21T18:15:56.000Z | 2022-03-09T04:02:42.000Z | config.py | Saravanakrish97/Request-traker | 56d01da04226ce823e1c1f3c2edad3ae07dfd44c | [
"Apache-2.0"
] | 2 | 2021-11-22T03:37:42.000Z | 2021-12-30T11:07:24.000Z | config.py | Saravanakrish97/Request-traker | 56d01da04226ce823e1c1f3c2edad3ae07dfd44c | [
"Apache-2.0"
] | 49 | 2021-11-21T18:17:02.000Z | 2022-03-24T21:35:54.000Z | #!/usr/bin/env python3
"""Importing"""
from os import environ
class Config(object):
API_ID = int(environ.get("API_ID", 0))
API_HASH = environ.get("API_HASH", "")
BOT_TOKEN = environ.get("BOT_TOKEN", "")
MONGO_STR = environ.get("MONGO_STR", "")
| 18.928571 | 44 | 0.637736 | 38 | 265 | 4.236842 | 0.578947 | 0.248447 | 0.161491 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009132 | 0.173585 | 265 | 13 | 45 | 20.384615 | 0.726027 | 0.116981 | 0 | 0 | 0 | 0 | 0.140969 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
a427c249084e373b517e6936a44e72541e4c9fbb | 546 | py | Python | chatterbot/logic/__init__.py | ingeniousambivert/chatbot | fb1d9659df6c1b6eddd8ee9349f5a65a0530db2a | [
"BSD-3-Clause"
] | null | null | null | chatterbot/logic/__init__.py | ingeniousambivert/chatbot | fb1d9659df6c1b6eddd8ee9349f5a65a0530db2a | [
"BSD-3-Clause"
] | null | null | null | chatterbot/logic/__init__.py | ingeniousambivert/chatbot | fb1d9659df6c1b6eddd8ee9349f5a65a0530db2a | [
"BSD-3-Clause"
] | null | null | null | from chatterbot.logic.logic_adapter import LogicAdapter
from chatterbot.logic.best_match import BestMatch
from chatterbot.logic.mathematical_evaluation import MathematicalEvaluation
from chatterbot.logic.specific_response import SpecificResponseAdapter
from chatterbot.logic.time_adapter import TimeLogicAdapter
from chatterbot.logic.unit_conversion import UnitConversion
__all__ = (
'LogicAdapter',
'BestMatch',
'MathematicalEvaluation',
'SpecificResponseAdapter',
'TimeLogicAdapter',
'UnitConversion',
)
| 34.125 | 76 | 0.804029 | 49 | 546 | 8.755102 | 0.428571 | 0.195804 | 0.265734 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135531 | 546 | 15 | 77 | 36.4 | 0.908898 | 0 | 0 | 0 | 0 | 0 | 0.180791 | 0.084746 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
a42b860e8e97ea7f760300d716c572b8f007273a | 1,796 | py | Python | Chapter 11/accounts.py | nescience8/starting-out-with-python-global-4th-edition | c16f93b7cbb4c7ae7b57653a7190bf192fe6b472 | [
"MIT"
] | 35 | 2019-05-03T00:30:31.000Z | 2022-01-20T06:57:25.000Z | Chapter 11/accounts.py | nescience8/starting-out-with-python-global-4th-edition | c16f93b7cbb4c7ae7b57653a7190bf192fe6b472 | [
"MIT"
] | 1 | 2020-09-04T02:04:33.000Z | 2020-09-04T02:04:33.000Z | Chapter 11/accounts.py | nescience8/starting-out-with-python-global-4th-edition | c16f93b7cbb4c7ae7b57653a7190bf192fe6b472 | [
"MIT"
] | 22 | 2020-05-13T21:20:02.000Z | 2021-12-21T08:35:59.000Z | # The SavingsAccount class represents a
# savings account.
class SavingsAccount:
# The __init__ method accepts arguments for the
# account number, interest rate, and balance.
def __init__(self, account_num, int_rate, bal):
self.__account_num = account_num
self.__interest_rate = int_rate
self.__balance = bal
# The following methods are mutators for the
# data attributes.
def set_account_num(self, account_num):
self.__account_num = account_num
def set_interest_rate(self, int_rate):
self.__interest_rate = int_rate
def set_balance(self, bal):
self.__balance = bal
# The following methods are accessors for the
# data attributes.
def get_account_num(self):
return self.__account_num
def get_interest_rate(self):
return self.__interest_rate
def get_balance(self):
return self.__balance
# The CD account represents a certificate of
# deposit (CD) account. It is a subclass of
# the SavingsAccount class.
class CD(SavingsAccount):
# The init method accepts arguments for the
# account number, interest rate, balance, and
# maturity date.
def __init__(self, account_num, int_rate, bal, mat_date):
# Call the superclass __init__ method.
SavingsAccount.__init__(self, account_num, int_rate, bal)
# Initialize the __maturity_date attribute.
self.__maturity_date = mat_date
# The set_maturity_date is a mutator for the
# __maturity_date attribute.
def set_maturity_date(self, mat_date):
self.__maturity_date = mat_date
# The get_maturity_date method is an accessor
# for the __maturity_date attribute.
def get_maturity_date(self):
return self.__maturity_date
| 27.212121 | 65 | 0.697661 | 233 | 1,796 | 4.965665 | 0.2103 | 0.095073 | 0.084702 | 0.046672 | 0.506482 | 0.364736 | 0.267934 | 0.181504 | 0.127917 | 0.127917 | 0 | 0 | 0.241648 | 1,796 | 65 | 66 | 27.630769 | 0.849486 | 0.392539 | 0 | 0.32 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0.16 | 0.64 | 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 |
a434ee9a321a4d8ec93ccddbabddedaac2b3d08f | 662 | py | Python | ProjectEuler/Task029_DistinctPowers.py | greendwin/puzzles | 5df1175f178d0c3e1ffa765160057d90e9da37cd | [
"MIT"
] | null | null | null | ProjectEuler/Task029_DistinctPowers.py | greendwin/puzzles | 5df1175f178d0c3e1ffa765160057d90e9da37cd | [
"MIT"
] | null | null | null | ProjectEuler/Task029_DistinctPowers.py | greendwin/puzzles | 5df1175f178d0c3e1ffa765160057d90e9da37cd | [
"MIT"
] | null | null | null | # coding=utf-8
"""
Problem 29.
Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
22=4, 23=8, 24=16, 25=32
32=9, 33=27, 34=81, 35=243
42=16, 43=64, 44=256, 45=1024
52=25, 53=125, 54=625, 55=3125
If they are then placed in numerical order, with any repeats removed,
we get the following sequence of 15 distinct terms:
4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125
How many distinct terms are in the sequence generated by ab for 2 ≤ a ≤ 100 and 2 ≤ b ≤ 100?
"""
def run():
lst = {
A**B
for A in xrange(2, 101)
for B in xrange(2, 101)}
print len(lst)
if __name__ == '__main__':
run() | 24.518519 | 92 | 0.614804 | 138 | 662 | 2.949275 | 0.57971 | 0.019656 | 0.029484 | 0.034398 | 0.078624 | 0.044226 | 0 | 0 | 0 | 0 | 0 | 0.260606 | 0.252266 | 662 | 27 | 93 | 24.518519 | 0.545455 | 0.018127 | 0 | 0 | 0 | 0 | 0.049383 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.125 | 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 |
a447ab1b16cbad19db3fbc616cfe9ca697467afc | 4,065 | py | Python | email_control.py | meigrafd/Sample-Code | 7065950dfd0728cfad66db08327f0efa4c26999c | [
"MIT"
] | 10 | 2017-02-08T18:36:09.000Z | 2021-03-31T04:22:25.000Z | email_control.py | meigrafd/Sample-Code | 7065950dfd0728cfad66db08327f0efa4c26999c | [
"MIT"
] | 2 | 2017-01-30T22:15:43.000Z | 2017-09-01T21:49:29.000Z | email_control.py | meigrafd/Sample-Code | 7065950dfd0728cfad66db08327f0efa4c26999c | [
"MIT"
] | 8 | 2017-02-09T12:33:47.000Z | 2021-04-03T13:34:33.000Z | #!/usr/bin/python
#
# Control Pi over Email - v0.2 - optimized by meigrafd
#
# http://www.forum-raspberrypi.de/Thread-python-scroll-menue?pid=130508#pid130508
#
# first line in email-message must match user defined Password.
# supports multiple commands in each line
#
import picamera, smtplib, sys, time
import email, getpass, imaplib
from time import gmtime, strftime
from email.header import Header
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
#---------------------------------------------------------------------
#check eMails every ... sec
interval = 10
#react only on eMails with exact this subject
subject = 'Pi'
#first line in email-message must match this password to verify authenticity
validpass = 'abc123'
MailReceiveUSER = 'USER'
MailReceivePWD = 'PASSWORD'
MailReceiveSRV = 'imap.gmail.com'
MailSendUSER = MailReceiveUSER
MailSendPWD = MailReceivePWD
MailSendSRV = 'smtp.gmail.com'
MailSendFROM = MailReceiveUSER
MailSendTO = 'xxx'
#---------------------------------------------------------------------
# check Mails
def checkMails():
try:
print "Starting checkMails"
m = imaplib.IMAP4_SSL(MailReceiveSRV)
m.login(MailReceiveUSER, MailReceivePWD)
while running:
m.select("Inbox")
status, unreadcount = m.status('INBOX', "(UNSEEN)")
unreadcount = int(unreadcount[0].split()[2].strip(').,]'))
if unreadcount > 0:
items = m.search(None, "UNSEEN")
items = str(items[1]).strip('[\']').split(' ')
for index, emailid in enumerate(items):
#print "emailid: " + emailid
resp, data = m.fetch(emailid, "(RFC822)")
email_body = data[0][1]
mail = email.message_from_string(email_body)
if mail['Subject'] == subject:
timeNow = strftime("%d.%m.%Y %H:%M:%S", gmtime())
print "[{}] New EMail with Subject '{}' received, checking.. ".format(timeNow, mail['Subject']),
for part in mail.walk():
if part.get_content_type() == 'text/plain':
body = part.get_payload()
# For each line in message execute instructions
valid = False
for line in body.split('\r\n'):
if line == "":
#skip empty lines
continue
if not valid and line == validpass:
print "pass is valid!"
valid = True
elif not valid and not line == validpass:
print "\nALERT: first line doesnt match verification password '%s': %s" % (validpass, line)
break
#---------------------------------------------------------------------
elif line == "Bild":
print "Trying to send RaspiCam Pic"
sendMail( raspicam=True )
elif line == "Heizung an":
print line
#...
#---------------------------------------------------------------------
else:
message = "Unknown Command: %s" % line
print message
sendMail( msg=message )
time.sleep(interval)
except Exception, e1:
print "Error in checkMails: " + str(e1)
checkMails()
# Send EMail
def sendMail( subj='Antwort vom Pi', msg='Deine Anfrage', raspicam=False ):
try:
if raspicam:
# Foto erstellen
fn = 'foto.jpg'
camera = picamera.PiCamera()
camera.capture(fn, resize=(640,480))
camera.close()
# E-Mail zusammensetzen
mime = MIMEMultipart()
mime['From'] = MailSendFROM
mime['To'] = MailSendTO
mime['Subject'] = Header(subj, 'utf-8')
mime.attach(MIMEText(msg, 'plain', 'utf-8'))
# Bild hinzufuegen
if raspicam:
f = open(fn, 'rb')
img = MIMEImage( f.read() )
f.close()
mime.attach(img)
# Mail versenden
smtp = smtplib.SMTP(MailSendSRV)
smtp.starttls()
smtp.login(MailSendUSER, MailSendPWD)
smtp.sendmail(MailSendFROM, [MailSendTO], mime.as_string())
smtp.quit()
except Exception, e1:
print "Error in sendMail: " + str(e1)
if __name__ == '__main__':
try:
running = True
checkMails()
except Exception, e1:
print "Error...: " + str(e1)
except (KeyboardInterrupt, SystemExit):
running = False
print "Schliesse Programm.." | 31.269231 | 103 | 0.609102 | 464 | 4,065 | 5.299569 | 0.456897 | 0.00976 | 0.01586 | 0.02684 | 0.060594 | 0.049614 | 0.026027 | 0 | 0 | 0 | 0 | 0.013255 | 0.201968 | 4,065 | 130 | 104 | 31.269231 | 0.74476 | 0.210578 | 0 | 0.104167 | 0 | 0 | 0.155828 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.072917 | 0.072917 | null | null | 0.114583 | 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 |
a44ef0f28152fe52c963ede2601a0051ad1c9ce0 | 427 | py | Python | example/call_track/call_track_test_load.py | errord/sputnik | b83c635a9a160dcd5809265c0d9d231ade33e5ea | [
"BSD-3-Clause"
] | null | null | null | example/call_track/call_track_test_load.py | errord/sputnik | b83c635a9a160dcd5809265c0d9d231ade33e5ea | [
"BSD-3-Clause"
] | null | null | null | example/call_track/call_track_test_load.py | errord/sputnik | b83c635a9a160dcd5809265c0d9d231ade33e5ea | [
"BSD-3-Clause"
] | 1 | 2018-03-04T04:48:44.000Z | 2018-03-04T04:48:44.000Z | #-*- coding: utf-8 -*
#
# Copyright 2011 shuotao.me
# Copyright 2012 2013 2014 msx.com
# by error.d@gmail.com
# 2014-08-20
#
import sys
sys.path.insert(0, '../')
from sputnik.SpuCallTracker import CallTrackerEngine
import call_track_test
import call_track_test2
cte = CallTrackerEngine(import_module=call_track_test)
cte.calltrack_module(call_track_test)
cte.calltrack_module(call_track_test2)
call_track_test.test_main(6)
| 20.333333 | 54 | 0.793911 | 65 | 427 | 4.969231 | 0.553846 | 0.167183 | 0.160991 | 0.117647 | 0.23839 | 0.23839 | 0.23839 | 0.23839 | 0.23839 | 0 | 0 | 0.075521 | 0.100703 | 427 | 20 | 55 | 21.35 | 0.765625 | 0.259953 | 0 | 0 | 0 | 0 | 0.00974 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.555556 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
a453c4a4d118bb13963b82e45d4db3c55cdfd706 | 480 | py | Python | Mundo2/Desafio029.py | Marcoakira/Desafios_Python_do_Curso_Guanabara | c49b774148a2232f8f3c21b83e3dc97610480757 | [
"MIT"
] | null | null | null | Mundo2/Desafio029.py | Marcoakira/Desafios_Python_do_Curso_Guanabara | c49b774148a2232f8f3c21b83e3dc97610480757 | [
"MIT"
] | null | null | null | Mundo2/Desafio029.py | Marcoakira/Desafios_Python_do_Curso_Guanabara | c49b774148a2232f8f3c21b83e3dc97610480757 | [
"MIT"
] | null | null | null | #Desafio029: A aplicação recebe a velocidade fo carro, se a mesma for superior a 80KM/h,
# retorna uma mensagem dizendo que foi multado , com o valor total de cada km acima dos 80.
#entrada da velocidade.
vel = int(input('qual era a velocidade do seu carro? Km/h '))-80
multa = (vel*7)
if vel >= 0:
print(f'Você nao viu o radar de 80Km/h?\nAcabou de ser Multado em R${multa} Reais. tem o prazo de 15 dias para recorrer.' )
else:print('parabens!!!\nContinue dirigindo assim.') | 53.333333 | 127 | 0.722917 | 87 | 480 | 3.988506 | 0.747126 | 0.063401 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037879 | 0.175 | 480 | 9 | 128 | 53.333333 | 0.838384 | 0.414583 | 0 | 0 | 0 | 0.2 | 0.684588 | 0.075269 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.4 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
a45801747b4cbcab01d9f877d7101e6979f037f9 | 359 | py | Python | level1_hitmaps/setup.py | SharperJBCA/COMAProutines | c24522813c4e6ef496d4d1d660a92effa81db6c1 | [
"MIT"
] | null | null | null | level1_hitmaps/setup.py | SharperJBCA/COMAProutines | c24522813c4e6ef496d4d1d660a92effa81db6c1 | [
"MIT"
] | null | null | null | level1_hitmaps/setup.py | SharperJBCA/COMAProutines | c24522813c4e6ef496d4d1d660a92effa81db6c1 | [
"MIT"
] | null | null | null | from numpy.distutils.core import setup
from numpy.distutils.core import Extension
from numpy import get_include
from Cython.Build import cythonize
import os
binFuncs = Extension(name='binFuncs',
include_dirs=[get_include()],
sources=['binFuncs.pyx'])
extensions = [binFuncs]
setup(ext_modules=cythonize(extensions))
| 29.916667 | 50 | 0.715877 | 42 | 359 | 6.02381 | 0.5 | 0.106719 | 0.142292 | 0.173913 | 0.221344 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.194986 | 359 | 11 | 51 | 32.636364 | 0.875433 | 0 | 0 | 0 | 0 | 0 | 0.05571 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 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 |
a45d139597f387b01cd700ebe2e4281b2deceac4 | 1,554 | py | Python | bench_cli/task_factory.py | systay/arewefastyet | f21f3c0c63b5e3729d946bd2283004641b427aad | [
"Apache-2.0"
] | null | null | null | bench_cli/task_factory.py | systay/arewefastyet | f21f3c0c63b5e3729d946bd2283004641b427aad | [
"Apache-2.0"
] | 1 | 2021-03-04T11:06:58.000Z | 2021-03-04T11:06:58.000Z | bench_cli/task_factory.py | systay/arewefastyet | f21f3c0c63b5e3729d946bd2283004641b427aad | [
"Apache-2.0"
] | 1 | 2021-09-03T16:06:08.000Z | 2021-09-03T16:06:08.000Z | # Copyright 2021 The Vitess Authors.
# 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 bench_cli.task as task
import bench_cli.task_oltp as oltp
import bench_cli.task_tpcc as tpcc
class TaskFactory:
def __init__(self):
pass
def create_task(self, task_name, report_dir, ansible_dir, inventory_file, source, pprof) -> task.Task:
"""
Create a task children based on the given task_name.
The task created can either be "oltp" (OLTP) or "tpcc" (TPCC).
@param: task_name
@param: report_dir: Path to task's report directory
@param: ansible_dir: Path to the Ansible directory to use
@param: inventory_file: Filename of the inventory to use
@param: source: The task's source
@param: pprof: The pprof configuration of the task
"""
if task_name == "oltp":
return oltp.OLTP(report_dir, ansible_dir, inventory_file, source, pprof)
elif task_name == "tpcc":
return tpcc.TPCC(report_dir, ansible_dir, inventory_file, source, pprof)
| 42 | 106 | 0.705277 | 229 | 1,554 | 4.668122 | 0.427948 | 0.056127 | 0.039289 | 0.050515 | 0.120674 | 0.120674 | 0.120674 | 0.120674 | 0 | 0 | 0 | 0.006617 | 0.222008 | 1,554 | 36 | 107 | 43.166667 | 0.877585 | 0.606821 | 0 | 0 | 0 | 0 | 0.015326 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0.090909 | 0.272727 | 0 | 0.727273 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
a46539a0bde2b1904bd36c1f0b85fae7e030833b | 118 | py | Python | SillyServer/__init__.py | helloqiu/SillyServer | 1e70f11efd2af679c45de819c226314c28cf7b8b | [
"MIT"
] | null | null | null | SillyServer/__init__.py | helloqiu/SillyServer | 1e70f11efd2af679c45de819c226314c28cf7b8b | [
"MIT"
] | null | null | null | SillyServer/__init__.py | helloqiu/SillyServer | 1e70f11efd2af679c45de819c226314c28cf7b8b | [
"MIT"
] | null | null | null | __VERSION__ = "0.0.1"
__AUTHOR__ = "helloqiu"
__LICENSE__ = "MIT"
__URL__ = "https://github.com/helloqiu/SillyServer"
| 23.6 | 51 | 0.728814 | 14 | 118 | 5 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.028302 | 0.101695 | 118 | 4 | 52 | 29.5 | 0.632075 | 0 | 0 | 0 | 0 | 0 | 0.466102 | 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 |
a469b257122bf9924276fe42362c88b325e93f9d | 20,601 | py | Python | tests/TestConfiguration.py | rakhimov/rtk | adc35e218ccfdcf3a6e3082f6a1a1d308ed4ff63 | [
"BSD-3-Clause"
] | null | null | null | tests/TestConfiguration.py | rakhimov/rtk | adc35e218ccfdcf3a6e3082f6a1a1d308ed4ff63 | [
"BSD-3-Clause"
] | null | null | null | tests/TestConfiguration.py | rakhimov/rtk | adc35e218ccfdcf3a6e3082f6a1a1d308ed4ff63 | [
"BSD-3-Clause"
] | 2 | 2020-04-03T04:14:42.000Z | 2021-02-22T05:30:35.000Z | #!/usr/bin/env python -O
# -*- coding: utf-8 -*-
#
# rtk.tests.unit.TestConfiguration.py is part of The RTK Project
#
# All rights reserved.
# Copyright 2007 - 2017 Andrew Rowland andrew.rowland <AT> reliaqual <DOT> com
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
This is the test class for testing the Configuration module algorithms and
models.
"""
import shutil
import sys
from os import environ, makedirs, name
from os.path import dirname, isfile
sys.path.insert(0, dirname(dirname(__file__)) + "/rtk", )
import unittest
from nose.plugins.attrib import attr
from Configuration import Configuration
__author__ = 'Andrew Rowland'
__email__ = 'andrew.rowland@reliaqual.com'
__organization__ = 'ReliaQual Associates, LLC'
__copyright__ = 'Copyright 2016 Andrew "Weibullguy" Rowland'
class TestConfiguration(unittest.TestCase):
"""
Class for testing the RTK Configuration.
"""
def setUp(self):
"""
(TestConfiguration) Method to setup the test fixture for the Configuration module.
"""
if name == 'posix':
self.HOMEDIR = environ['HOME']
elif name == 'nt':
self.HOMEDIR = environ['USERPROFILE']
self.DUT = Configuration()
try:
makedirs('/tmp/RTK/data')
except OSError:
pass
try:
makedirs('/tmp/RTK/icons')
except OSError:
pass
try:
makedirs('/tmp/RTK/logs')
except OSError:
pass
@attr(all=True, unit=True)
def test00_initialize_configuration(self):
"""
(TestConfiguration) __init__ should create an instance of the Configuration object when initializing
"""
self.assertTrue(isinstance(self.DUT, Configuration))
self.assertEqual(self.DUT.RTK_MODE, '')
self.assertEqual(self.DUT.RTK_SITE_CONF, '')
self.assertEqual(self.DUT.RTK_PROG_CONF, '')
self.assertEqual(self.DUT.RTK_DEBUG_LOG, '')
self.assertEqual(self.DUT.RTK_IMPORT_LOG, '')
self.assertEqual(self.DUT.RTK_USER_LOG, '')
self.assertEqual(self.DUT.RTK_FORMAT_FILE, {})
self.assertEqual(self.DUT.RTK_COLORS, {})
self.assertEqual(self.DUT.RTK_PREFIX, {})
self.assertEqual(self.DUT.RTK_ACTION_CATEGORY, {})
self.assertEqual(self.DUT.RTK_INCIDENT_CATEGORY, {})
self.assertEqual(self.DUT.RTK_SEVERITY, {})
self.assertEqual(self.DUT.RTK_ACTIVE_ENVIRONMENTS, {})
self.assertEqual(self.DUT.RTK_DORMANT_ENVIRONMENTS, {})
self.assertEqual(self.DUT.RTK_SW_DEV_ENVIRONMENTS, {})
self.assertEqual(self.DUT.RTK_AFFINITY_GROUPS, {})
self.assertEqual(self.DUT.RTK_WORKGROUPS, {})
self.assertEqual(self.DUT.RTK_FAILURE_PROBABILITY, {})
self.assertEqual(self.DUT.RTK_SW_LEVELS, {})
self.assertEqual(self.DUT.RTK_DETECTION_METHODS, {})
self.assertEqual(self.DUT.RTK_SW_TEST_METHODS, {})
self.assertEqual(self.DUT.RTK_ALLOCATION_MODELS, {})
self.assertEqual(self.DUT.RTK_DAMAGE_MODELS, {})
self.assertEqual(self.DUT.RTK_HR_MODEL, {})
self.assertEqual(self.DUT.RTK_LIFECYCLE, {})
self.assertEqual(self.DUT.RTK_SW_DEV_PHASES, {})
self.assertEqual(self.DUT.RTK_RPN_DETECTION, {})
self.assertEqual(self.DUT.RTK_RPN_SEVERITY, {})
self.assertEqual(self.DUT.RTK_RPN_OCCURRENCE, {})
self.assertEqual(self.DUT.RTK_ACTION_STATUS, {})
self.assertEqual(self.DUT.RTK_INCIDENT_STATUS, {})
self.assertEqual(self.DUT.RTK_CONTROL_TYPES, [])
self.assertEqual(self.DUT.RTK_COST_TYPE, {})
self.assertEqual(self.DUT.RTK_HR_TYPE, {})
self.assertEqual(self.DUT.RTK_INCIDENT_TYPE, {})
self.assertEqual(self.DUT.RTK_MTTR_TYPE, {})
self.assertEqual(self.DUT.RTK_REQUIREMENT_TYPE, {})
self.assertEqual(self.DUT.RTK_VALIDATION_TYPE, {})
self.assertEqual(self.DUT.RTK_SW_APPLICATION, {})
self.assertEqual(self.DUT.RTK_CATEGORIES, {})
self.assertEqual(self.DUT.RTK_CRITICALITY, {})
self.assertEqual(self.DUT.RTK_FAILURE_MODES, {})
self.assertEqual(self.DUT.RTK_HAZARDS, {})
self.assertEqual(self.DUT.RTK_MANUFACTURERS, {})
self.assertEqual(self.DUT.RTK_MEASUREMENT_UNITS, {})
self.assertEqual(self.DUT.RTK_OPERATING_PARAMETERS, {})
self.assertEqual(self.DUT.RTK_S_DIST, {})
self.assertEqual(self.DUT.RTK_STAKEHOLDERS, {})
self.assertEqual(self.DUT.RTK_SUBCATEGORIES, {})
self.assertEqual(self.DUT.RTK_USERS, {})
self.assertEqual(self.DUT.RTK_RISK_POINTS, [4, 10])
self.assertEqual(self.DUT.RTK_MODE_SOURCE, 1)
self.assertEqual(self.DUT.RTK_FMECA_METHOD, 1)
self.assertEqual(self.DUT.RTK_RPN_FORMAT, 0)
self.assertEqual(self.DUT.RTK_COM_BACKEND, '')
self.assertEqual(self.DUT.RTK_BACKEND, '')
self.assertEqual(self.DUT.RTK_COM_INFO, {})
self.assertEqual(self.DUT.RTK_PROG_INFO, {})
self.assertEqual(self.DUT.RTK_MODULES, {})
self.assertEqual(self.DUT.RTK_PAGE_NUMBER, {})
self.assertEqual(self.DUT.RTK_HR_MULTIPLIER, 1000000.0)
self.assertEqual(self.DUT.RTK_DEC_PLACES, 6)
self.assertEqual(self.DUT.RTK_MTIME, 10.0)
self.assertEqual(self.DUT.RTK_TABPOS,
{'listbook': 'top', 'modulebook': 'bottom',
'workbook': 'bottom'})
self.assertEqual(self.DUT.RTK_GUI_LAYOUT, 'advanced')
self.assertEqual(self.DUT.RTK_METHOD, 'STANDARD')
if name == 'posix':
self.assertEqual(self.DUT.RTK_OS, 'Linux')
self.assertEqual(self.DUT.RTK_LOCALE, 'en_US')
self.assertEqual(self.DUT.RTK_SITE_DIR, '/etc/RTK')
self.assertEqual(self.DUT.RTK_HOME_DIR, environ['HOME'])
self.assertEqual(self.DUT.RTK_DATA_DIR, '/usr/share/RTK')
self.assertEqual(self.DUT.RTK_ICON_DIR, '/usr/share/pixmaps/RTK')
self.assertEqual(self.DUT.RTK_LOG_DIR, '/var/log/RTK')
self.assertEqual(self.DUT.RTK_PROG_DIR,
self.DUT.RTK_HOME_DIR + '/analyses/rtk')
self.assertEqual(self.DUT.RTK_CONF_DIR, '')
@attr(all=True, unit=True)
def test01a_set_site_variables(self):
"""
(TestConfiguration) set_site_variables should return False on success
"""
self.assertFalse(self.DUT.set_site_variables())
if name == 'posix':
self.assertEqual(self.DUT.RTK_SITE_DIR,
'/etc/RTK')
self.assertEqual(self.DUT.RTK_HOME_DIR, environ['HOME'])
self.assertEqual(self.DUT.RTK_CONF_DIR,
self.DUT.RTK_HOME_DIR + '/.config/RTK')
self.assertEqual(self.DUT.RTK_DATA_DIR,
self.DUT.RTK_HOME_DIR + '/.config/RTK/data')
self.assertEqual(self.DUT.RTK_ICON_DIR,
self.DUT.RTK_HOME_DIR + '/.config/RTK/icons')
self.assertEqual(self.DUT.RTK_LOG_DIR,
self.DUT.RTK_HOME_DIR + '/.config/RTK/logs')
self.assertEqual(self.DUT.RTK_PROG_DIR,
self.DUT.RTK_HOME_DIR + '/analyses/rtk')
self.assertEqual(self.DUT.RTK_SITE_CONF,
self.DUT.RTK_CONF_DIR + '/site.conf')
@attr(all=True, unit=True)
def test02a_set_user_variables(self):
"""
(TestConfiguration) set_user_variables should return False on success
"""
self.assertFalse(self.DUT.set_user_variables())
self.assertEqual(self.DUT.RTK_PROG_CONF,
self.DUT.RTK_CONF_DIR + '/RTK.conf')
@attr(all=True, unit=True)
def test03a_create_site_configuration(self):
"""
(TestConfiguration) _create_site_configuration should return False on success
"""
self.DUT.RTK_SITE_DIR = '/tmp/RTK'
self.DUT.RTK_HOME_DIR = '/tmp/RTK'
self.DUT.RTK_SITE_CONF = self.DUT.RTK_SITE_DIR + '/site.conf'
self.assertFalse(self.DUT._create_site_configuration())
self.assertTrue(isfile('/tmp/RTK/site.conf'))
@attr(all=True, unit=True)
def test04a_create_user_configuration(self):
"""
(TestConfiguration) create_user_configuration should return False on success
"""
self.DUT.RTK_SITE_DIR = dirname(dirname(__file__)) + '/config'
self.DUT.RTK_HOME_DIR = '/tmp/RTK'
self.DUT.set_site_variables()
self.DUT.set_user_variables()
self.assertFalse(self.DUT.create_user_configuration())
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/RTK.conf'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/alt_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/dataset_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/ffmeca_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/fmeca_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/fraca_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/function_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/hardware_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/incident_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR +
'/mechanisms_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/modes_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/part_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR +
'/requirement_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/revision_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR +
'/rgincident_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/risk_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/sfmeca_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/sia_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/software_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR +
'/stakeholder_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR + '/testing_format.xml'))
self.assertTrue(isfile(self.DUT.RTK_CONF_DIR +
'/validation_format.xml'))
@attr(all=True, unit=True)
def test05a_read_site_configuration(self):
"""
(TestConfiguration) _read_site_configuration should return False on success
"""
self.DUT.RTK_SITE_DIR = dirname(dirname(__file__)) + '/config'
self.DUT.RTK_HOME_DIR = '/tmp/RTK'
self.DUT.set_site_variables()
self.DUT.set_user_variables()
self.DUT.create_user_configuration()
self.assertFalse(self.DUT._read_site_configuration())
self.assertEqual(self.DUT.RTK_COM_BACKEND, 'sqlite')
self.assertEqual(self.DUT.RTK_COM_INFO['host'], 'localhost')
self.assertEqual(self.DUT.RTK_COM_INFO['socket'], '3306')
self.assertEqual(self.DUT.RTK_COM_INFO['database'], '')
self.assertEqual(self.DUT.RTK_COM_INFO['user'], 'user')
self.assertEqual(self.DUT.RTK_COM_INFO['password'], 'password')
@attr(all=True, unit=True)
def test05b_read_configuration(self):
"""
(TestConfiguration) read_configuration should return False on success
"""
self.DUT.RTK_SITE_DIR = dirname(dirname(__file__)) + '/config'
self.DUT.RTK_HOME_DIR = '/tmp/RTK'
self.DUT.set_site_variables()
self.DUT.set_user_variables()
self.DUT.create_user_configuration()
self.assertFalse(self.DUT.read_configuration())
self.assertEqual(self.DUT.RTK_COLORS['revisionfg'], '#000000')
self.assertEqual(self.DUT.RTK_COLORS['functionfg'], '#0000FF')
self.assertEqual(self.DUT.RTK_COLORS['requirementfg'], '#000000')
self.assertEqual(self.DUT.RTK_COLORS['assemblyfg'], '#000000')
self.assertEqual(self.DUT.RTK_COLORS['partfg'], '#000000')
self.assertEqual(self.DUT.RTK_COLORS['overstressfg'], '#FFFFFF')
self.assertEqual(self.DUT.RTK_COLORS['taggedfg'], '#FFFFFF')
self.assertEqual(self.DUT.RTK_COLORS['nofrmodelfg'], '#A52A2A')
self.assertEqual(self.DUT.RTK_COLORS['softwarefg'], '#000000')
self.assertEqual(self.DUT.RTK_COLORS['incidentfg'], '#000000')
self.assertEqual(self.DUT.RTK_COLORS['validationfg'], '#00FF00')
self.assertEqual(self.DUT.RTK_COLORS['testfg'], '#000000')
self.assertEqual(self.DUT.RTK_COLORS['survivalfg'], '#000000')
self.assertEqual(self.DUT.RTK_COLORS['revisionbg'], '#FFFFFF')
self.assertEqual(self.DUT.RTK_COLORS['functionbg'], '#FFFFFF')
self.assertEqual(self.DUT.RTK_COLORS['requirementbg'], '#FFFFFF')
self.assertEqual(self.DUT.RTK_COLORS['assemblybg'], '#FFFFFF')
self.assertEqual(self.DUT.RTK_COLORS['partbg'], '#FFFFFF')
self.assertEqual(self.DUT.RTK_COLORS['overstressbg'], '#FF0000')
self.assertEqual(self.DUT.RTK_COLORS['taggedbg'], '#00FF00')
self.assertEqual(self.DUT.RTK_COLORS['softwarebg'], '#FFFFFF')
self.assertEqual(self.DUT.RTK_COLORS['incidentbg'], '#FFFFFF')
self.assertEqual(self.DUT.RTK_COLORS['validationbg'], '#FFFFFF')
self.assertEqual(self.DUT.RTK_COLORS['testbg'], '#FFFFFF')
self.assertEqual(self.DUT.RTK_COLORS['survivalbg'], '#FFFFFF')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['revision'],
'revision_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['function'],
'function_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['requirement'],
'requirement_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['hardware'],
'hardware_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['software'],
'software_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['incident'],
'incident_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['validation'],
'validation_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['testing'],
'testing_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['part'], 'part_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['sia'], 'sia_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['fmeca'], 'fmeca_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['rgincident'],
'rgincident_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['stakeholder'],
'stakeholder_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['dataset'],
'dataset_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['risk'], 'risk_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['ffmeca'],
'ffmeca_format.xml')
self.assertEqual(self.DUT.RTK_FORMAT_FILE['sfmeca'],
'sfmeca_format.xml')
self.assertEqual(self.DUT.RTK_DATA_DIR, '/tmp/RTK/.config/RTK/data')
self.assertEqual(self.DUT.RTK_ICON_DIR, '/tmp/RTK/.config/RTK/icons')
self.assertEqual(self.DUT.RTK_LOG_DIR, '/tmp/RTK/.config/RTK/logs')
self.assertEqual(self.DUT.RTK_PROG_DIR, '/home/arowland/analyses/rtk')
self.assertEqual(self.DUT.RTK_PROG_INFO['host'], 'localhost')
self.assertEqual(self.DUT.RTK_PROG_INFO['socket'], '3306')
self.assertEqual(self.DUT.RTK_PROG_INFO['database'], '')
self.assertEqual(self.DUT.RTK_PROG_INFO['user'], '')
self.assertEqual(self.DUT.RTK_PROG_INFO['password'], '')
self.assertEqual(self.DUT.RTK_BACKEND, 'sqlite')
self.assertEqual(float(self.DUT.RTK_HR_MULTIPLIER), 1000000.0)
self.assertEqual(int(self.DUT.RTK_DEC_PLACES), 6)
self.assertEqual(float(self.DUT.RTK_MTIME), 100.0)
self.assertEqual(int(self.DUT.RTK_MODE_SOURCE), 1)
self.assertEqual(self.DUT.RTK_TABPOS['listbook'], 'bottom')
self.assertEqual(self.DUT.RTK_TABPOS['modulebook'], 'top')
self.assertEqual(self.DUT.RTK_TABPOS['workbook'], 'bottom')
@attr(all=True, unit=True)
def test06a_write_configuration(self):
"""
(TestConfiguration) write_configuration should return False on success
"""
self.DUT.RTK_SITE_DIR = dirname(dirname(__file__)) + '/config'
self.DUT.RTK_HOME_DIR = '/tmp/RTK'
self.DUT.set_site_variables()
self.DUT.set_user_variables()
self.DUT.create_user_configuration()
# First, make sure everything is set to it's default value.
self.assertEqual(self.DUT.RTK_PROG_INFO['host'], 'localhost')
self.assertEqual(self.DUT.RTK_PROG_INFO['socket'], '3306')
self.assertEqual(self.DUT.RTK_PROG_INFO['database'], '')
self.assertEqual(self.DUT.RTK_PROG_INFO['user'], '')
self.assertEqual(self.DUT.RTK_PROG_INFO['password'], '')
self.assertEqual(self.DUT.RTK_BACKEND, '')
self.assertEqual(float(self.DUT.RTK_HR_MULTIPLIER), 1000000.0)
self.assertEqual(int(self.DUT.RTK_DEC_PLACES), 6)
self.assertEqual(float(self.DUT.RTK_MTIME), 10.0)
self.assertEqual(int(self.DUT.RTK_MODE_SOURCE), 1)
self.assertEqual(self.DUT.RTK_TABPOS['listbook'], 'bottom')
self.assertEqual(self.DUT.RTK_TABPOS['modulebook'], 'top')
self.assertEqual(self.DUT.RTK_TABPOS['workbook'], 'bottom')
# Next, programatically set these program constants.
self.DUT.RTK_HR_MULTIPLIER = 1000.0
self.DUT.RTK_MODE_SOURCE = 2
self.DUT.RTK_TABPOS['listbook'] = 'top'
self.DUT.RTK_TABPOS['modulebook'] = 'top'
self.DUT.RTK_TABPOS['workbook'] = 'top'
self.DUT.RTK_BACKEND = 'mysql'
self.DUT.RTK_PROG_INFO['database'] = '/tmp/TestDB.rtk'
self.DUT.RTK_PROG_INFO['user'] = 'arowland'
# Write them to the RTK_PROG_CONF file and then re-read the file.
self.assertFalse(self.DUT.write_configuration())
self.assertFalse(self.DUT.read_configuration())
# Verify that the constants were written/read properly.
self.assertEqual(self.DUT.RTK_PROG_INFO['database'], '/tmp/TestDB.rtk')
self.assertEqual(self.DUT.RTK_PROG_INFO['user'], 'arowland')
self.assertEqual(self.DUT.RTK_BACKEND, 'mysql')
self.assertEqual(float(self.DUT.RTK_HR_MULTIPLIER), 1000.0)
self.assertEqual(int(self.DUT.RTK_MODE_SOURCE), 2)
self.assertEqual(self.DUT.RTK_TABPOS['listbook'], 'top')
self.assertEqual(self.DUT.RTK_TABPOS['modulebook'], 'top')
self.assertEqual(self.DUT.RTK_TABPOS['workbook'], 'top') | 48.245902 | 108 | 0.65623 | 2,533 | 20,601 | 5.126727 | 0.156336 | 0.129909 | 0.169413 | 0.271061 | 0.708609 | 0.662406 | 0.547128 | 0.424457 | 0.362467 | 0.299476 | 0 | 0.010426 | 0.213194 | 20,601 | 427 | 109 | 48.245902 | 0.790734 | 0.132566 | 0 | 0.251613 | 0 | 0 | 0.129963 | 0.019938 | 0 | 0 | 0 | 0 | 0.651613 | 1 | 0.029032 | false | 0.019355 | 0.025806 | 0 | 0.058065 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
a477240aee545fd386849e3edd15ce3bc1988f8c | 3,523 | py | Python | zt12306Spider.py | zhmhhu/12306Spider | 1f3134e7c72d5c6ab7374a1d7dd2bb1ef6ad3718 | [
"Artistic-2.0"
] | 4 | 2020-11-26T09:46:14.000Z | 2021-04-30T06:43:15.000Z | zt12306Spider.py | zhmhhu/12306Spider | 1f3134e7c72d5c6ab7374a1d7dd2bb1ef6ad3718 | [
"Artistic-2.0"
] | 1 | 2020-11-26T02:25:55.000Z | 2020-11-26T02:25:55.000Z | zt12306Spider.py | zhmhhu/12306Spider | 1f3134e7c72d5c6ab7374a1d7dd2bb1ef6ad3718 | [
"Artistic-2.0"
] | 2 | 2021-06-26T01:31:17.000Z | 2021-10-21T16:53:25.000Z | from asyncio import get_event_loop
from pyppeteer import launch
from random import randint
from main import main
from verification_code import slide_list
class Zt12306Spider:
def __init__(self,username,password):
self.width, self.height = 1366, 768
self.username = username
self.password = password
get_event_loop().run_until_complete(self.init())
get_event_loop().run_until_complete(self.login())
async def init(self):
self.browser = await launch(headless=False,
args=['--disable-infobars', f'--window-size={self.width},{self.height}', '--no-sandbox'])
self.page = await self.browser.newPage()
await self.page.setViewport({'width': self.width, 'height': self.height})
await self.page.goto('https://kyfw.12306.cn/otn/resources/login.html')
await self.page.evaluate('()=>{Object.defineProperties(navigator,{webdriver:{get:()=>false}})}')
async def login(self):
await self.page.click('.login-hd-account')
await self.page.type('#J-userName', self.username, {'delay': randint(60, 120)}) # 账号
await self.page.type('#J-password', self.password, {'delay': randint(100, 151)}) # 密码
# 验证码
code = await self.page.waitForSelector('#J-loginImg') # 通过css selector定位验证码元素
# 验证码截图
await code.screenshot({'path': 'captcha.jpg'})
# 获取验证码坐标
box = await code.boundingBox()
# 获取验证码
result = ''
text, check = main('captcha.jpg')
for t in text:
for pos, l in check:
if t == l:
result += str(pos) + ','
resultNums = result[:-1]
print(resultNums) # 字符串
if len(resultNums) > 0:
resList = resultNums.split(',')
await self.page.waitFor(1 * 1000)
for res in resList:
if int(res) < 5:
await self.page.mouse.click(box['x'] + 37 * (2 * int(res) - 1), box['y'] + 70)
await self.page.waitFor(randint(567, 3456))
else:
await self.page.mouse.click(box['x'] + 37 * (2 * int(res) - 9), box['y'] + 150)
await self.page.waitFor(randint(567, 3456))
await self.page.waitFor(1 * 1000)
await self.page.click('#J-login')
slider = await self.page.Jeval('#login_slide_box', 'node => node.style') # 是否有滑块
if slider:
print('出现滑块')
await self.page.waitFor('.btn_slide')
await self.slide_move('.btn_slide')
# await self.page.waitFor(150 * 1000)
await self.page.waitForNavigation()
await self.page.waitFor(3 * 1000)
await self.page.click('.modal-ft >a')
await self.page.goto('https://kyfw.12306.cn/otn/view/information.html') #跳转到个人信息页面
await self.page.waitFor(5 * 1000)
else:
print('验证码自动识别失败,请重试')
async def slide_move(self, slide_id):
await self.page.hover(slide_id)
# await self.page.evaluate('document.querySelector("'+slide_id+'").hover()')
await self.page.mouse.down()
slides = slide_list(300)
x = self.page.mouse._x
for distance in slides:
x += distance
await self.page.mouse.move(x, 0, )
await self.page.mouse.up()
if __name__ == '__main__':
username = 'username'
password = 'password'ß
Zt12306Spider(username, password)
| 39.144444 | 124 | 0.57224 | 423 | 3,523 | 4.683215 | 0.349882 | 0.117113 | 0.177183 | 0.080767 | 0.22312 | 0.164563 | 0.139324 | 0.072691 | 0.072691 | 0.036345 | 0 | 0.039505 | 0.288674 | 3,523 | 89 | 125 | 39.58427 | 0.750998 | 0.051377 | 0 | 0.084507 | 0 | 0 | 0.134875 | 0.032442 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.070423 | 0.070423 | null | null | 0.042254 | 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 |
a49eae0d79a461a958484baa170b4bf86a05af4a | 2,084 | py | Python | server/p_lib/database.py | hazra1991/Message_server_ | f56a239418c0f93969b33ef35e36c3a15139ca5e | [
"MIT"
] | null | null | null | server/p_lib/database.py | hazra1991/Message_server_ | f56a239418c0f93969b33ef35e36c3a15139ca5e | [
"MIT"
] | null | null | null | server/p_lib/database.py | hazra1991/Message_server_ | f56a239418c0f93969b33ef35e36c3a15139ca5e | [
"MIT"
] | null | null | null | import sqlite3
class NoUserFound(Exception):
pass
class PasswordMissMatch(Exception):
pass
class Database:
def __init__(self):
self.connection = sqlite3.connect('userdb.db')
self.cur = self.connection.cursor()
self.cur.execute("CREATE TABLE IF NOT EXISTS userinfo (username PRIMARY KEY,password)") #db queries are not case sensitive,capitalized just to distinguise
self.cur.execute("CREATE TABLE IF NOT EXISTS user_record (username PRIMARY KEY,object)")
self.connection.commit()
def login(self,username,password):
self.cur.execute("select password from userinfo where username=(?)",(username,))
passwd= self.cur.fetchone()
print(passwd)
if passwd is None:
raise NoUserFound
if passwd[0] == password:
return True
else:
return False
def create_user(self,username,password,user_object):
try:
self.cur.execute('INSERT INTO userinfo values(?,?)',(username,password))
self.cur.execute("INSERT INTO user_record values(?,?)",(username,user_object))
self.connection.commit()
return True
except sqlite3.IntegrityError:
return False
def update_user(self,username,user_object):
self.cur.execute("UPDATE user_record SET object=(?) WHERE username=(?)",(user_object,username))
self.connection.commit()
# Todo need to checck the password mechanism
def change_password(self,username,old_pass,new_pass):
self.cur.execute("select password from userinfo where username=(?)",(username,))
password = self.cur.fetchone()[0]
print(password)
if password == old_pass:
self.cur.execute("UPDATE userinfo SET password=(?) WHERE username=(?)",(new_pass,username))
else:
raise PasswordMissMatch
def retrive_userobj(self,username):
self.cur.execute("SELECT object from user_record where username=(?)",(username,))
return self.cur.fetchone()[0]
| 35.322034 | 165 | 0.644434 | 237 | 2,084 | 5.582278 | 0.308017 | 0.068783 | 0.095238 | 0.052154 | 0.207105 | 0.146636 | 0.146636 | 0.146636 | 0.092215 | 0.092215 | 0 | 0.003822 | 0.246641 | 2,084 | 58 | 166 | 35.931034 | 0.838854 | 0.051823 | 0 | 0.295455 | 0 | 0 | 0.232523 | 0 | 0 | 0 | 0 | 0.017241 | 0 | 1 | 0.136364 | false | 0.431818 | 0.022727 | 0 | 0.340909 | 0.045455 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
a4a2d971142af48144ed9c1548dbfe6032e6d46c | 216 | py | Python | __main__.py | AlbMej/Code-Breakers | cb9241798935dd34b3c4524e9b5feca9f43a8095 | [
"MIT"
] | null | null | null | __main__.py | AlbMej/Code-Breakers | cb9241798935dd34b3c4524e9b5feca9f43a8095 | [
"MIT"
] | null | null | null | __main__.py | AlbMej/Code-Breakers | cb9241798935dd34b3c4524e9b5feca9f43a8095 | [
"MIT"
] | null | null | null | import subprocess
def main():
start_process = subprocess.Popen(['python3', 'interface.py'], cwd="The Assignment/")
sStdout, sStdErr = start_process.communicate()
return
if __name__ == '__main__':
main() | 24 | 86 | 0.699074 | 24 | 216 | 5.875 | 0.791667 | 0.170213 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005464 | 0.152778 | 216 | 9 | 87 | 24 | 0.765027 | 0 | 0 | 0 | 0 | 0 | 0.200957 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.428571 | 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 |
f10278c2fd5beb2bbfe6e071d0667675a8946a23 | 415 | py | Python | lib/handler.py | redcode-labs/poXSSon | 7046fac15e54e05a73d7d46a00916161d9f36cca | [
"ISC"
] | 18 | 2022-02-20T13:27:36.000Z | 2022-03-23T21:35:13.000Z | lib/handler.py | redcode-labs/poXSSon | 7046fac15e54e05a73d7d46a00916161d9f36cca | [
"ISC"
] | 1 | 2022-02-20T13:37:20.000Z | 2022-02-21T14:38:26.000Z | lib/handler.py | redcode-labs/poXSSon | 7046fac15e54e05a73d7d46a00916161d9f36cca | [
"ISC"
] | 2 | 2022-02-20T13:35:56.000Z | 2022-02-21T11:59:15.000Z | #!/usr/bin/python3.7
from http.server import HTTPServer, BaseHTTPRequestHandler
class DefaultHandler(BaseHTTPRequestHandler):
def do_GET(self):
print(self.path)
#self.send_response(200)
#self.end_headers()
#self.wfile.write(b'Hello, world!')
def start_handler(port, log, outfile):
httpd = HTTPServer(('localhost', 8000), SimpleHTTPRequestHandler)
httpd.serve_forever()
| 29.642857 | 69 | 0.706024 | 47 | 415 | 6.12766 | 0.829787 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026163 | 0.171084 | 415 | 13 | 70 | 31.923077 | 0.811047 | 0.226506 | 0 | 0 | 0 | 0 | 0.028391 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.142857 | 0 | 0.571429 | 0.142857 | 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 |
f1035668e3f6088d1a5d3928be82f7c2d4b715b2 | 1,087 | py | Python | accounting_tech/migrations/0007_auto_20190318_1406.py | Tim-Ilin/asup_corp_site | 02a9573f2490ef8f31b3ba95bc351c2458d049e5 | [
"MIT"
] | null | null | null | accounting_tech/migrations/0007_auto_20190318_1406.py | Tim-Ilin/asup_corp_site | 02a9573f2490ef8f31b3ba95bc351c2458d049e5 | [
"MIT"
] | 8 | 2021-03-19T11:12:07.000Z | 2022-03-12T00:32:27.000Z | accounting_tech/migrations/0007_auto_20190318_1406.py | Tim-Ilin/asup_corp_site | 02a9573f2490ef8f31b3ba95bc351c2458d049e5 | [
"MIT"
] | null | null | null | # Generated by Django 2.1.7 on 2019-03-18 11:06
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accounting_tech', '0006_auto_20190317_1551'),
]
operations = [
migrations.AlterField(
model_name='equipment',
name='date_bought',
field=models.DateField(verbose_name='Дата постановки'),
),
migrations.AlterField(
model_name='equipment',
name='description',
field=models.CharField(blank=True, max_length=100, verbose_name='Описание'),
),
migrations.AlterField(
model_name='equipment',
name='name',
field=models.CharField(max_length=50, verbose_name='Название'),
),
migrations.AlterField(
model_name='equipment',
name='worker',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='accounting_tech.Employees', verbose_name='Должность'),
),
]
| 31.057143 | 151 | 0.614535 | 111 | 1,087 | 5.855856 | 0.513514 | 0.123077 | 0.153846 | 0.178462 | 0.258462 | 0.258462 | 0 | 0 | 0 | 0 | 0 | 0.045226 | 0.267709 | 1,087 | 34 | 152 | 31.970588 | 0.771357 | 0.041398 | 0 | 0.428571 | 1 | 0 | 0.164423 | 0.046154 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.071429 | 0 | 0.178571 | 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 |
f11794dfd0580ccc5d03d94043b5fd87b57c96f4 | 217 | py | Python | misc-code/deprecated/sample_json_handler.py | anudeep22003/simple-langauge-pipeline | e48a4e89b6a01e2b24b949efdf2ca2e316ed9c02 | [
"MIT"
] | 1 | 2022-02-01T14:07:11.000Z | 2022-02-01T14:07:11.000Z | misc-code/deprecated/sample_json_handler.py | anudeep22003/simple-langauge-pipeline | e48a4e89b6a01e2b24b949efdf2ca2e316ed9c02 | [
"MIT"
] | null | null | null | misc-code/deprecated/sample_json_handler.py | anudeep22003/simple-langauge-pipeline | e48a4e89b6a01e2b24b949efdf2ca2e316ed9c02 | [
"MIT"
] | null | null | null | import json
with open(file='src/knowledge_graph/sample.json') as f:
converted = json.load(fp = f)
for item in converted:
print(type(item))
print(item.keys())
print(item['id'])
pass | 24.111111 | 55 | 0.608295 | 31 | 217 | 4.225806 | 0.709677 | 0.137405 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.253456 | 217 | 9 | 56 | 24.111111 | 0.808642 | 0 | 0 | 0 | 0 | 0 | 0.151376 | 0.142202 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.125 | 0.125 | 0 | 0.125 | 0.375 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
f118f9565524a4a92512982282bc6371f38518df | 454 | py | Python | main.py | georgesfarah4/Ogero-Parser | 054cce66799459058fd424017e8a6153adb5beef | [
"MIT"
] | null | null | null | main.py | georgesfarah4/Ogero-Parser | 054cce66799459058fd424017e8a6153adb5beef | [
"MIT"
] | null | null | null | main.py | georgesfarah4/Ogero-Parser | 054cce66799459058fd424017e8a6153adb5beef | [
"MIT"
] | null | null | null | import requests
import re
username='username'
password='password'
payload = {'username': username, 'password': password}
url='https://ogero.gov.lb/myogero/login.p.php'
with requests.Session() as sess:
sess.post(url, data=payload)
index=sess.get('https://ogero.gov.lb/myogero/index.php')
txt=index.text
gb=re.findall('[0-9]+\.[0-9]+ GB.*GB',txt)
if(len(gb)==1):
print(gb[0])
else:
print('error')
input()
| 18.916667 | 60 | 0.627753 | 66 | 454 | 4.318182 | 0.545455 | 0.112281 | 0.168421 | 0.224561 | 0.154386 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016 | 0.174009 | 454 | 23 | 61 | 19.73913 | 0.744 | 0 | 0 | 0 | 0 | 0 | 0.299559 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.125 | 0.125 | 0 | 0.125 | 0.125 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
f120dffdf1d1b8483d54b5ea4750b284d4002fbe | 112 | py | Python | confply/cpp_compiler/options/tool.py | graehu/confply | 4471b520b3685d587a89d31dee7eec9ca7bf85de | [
"MIT"
] | null | null | null | confply/cpp_compiler/options/tool.py | graehu/confply | 4471b520b3685d587a89d31dee7eec9ca7bf85de | [
"MIT"
] | null | null | null | confply/cpp_compiler/options/tool.py | graehu/confply | 4471b520b3685d587a89d31dee7eec9ca7bf85de | [
"MIT"
] | null | null | null | echo = "echo"
gcc = "gcc"
gpp = "g++"
emcc = "emcc"
empp = "em++"
cl = "cl"
clang = "clang"
clangpp = "clang++"
| 12.444444 | 19 | 0.517857 | 16 | 112 | 3.625 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.214286 | 112 | 8 | 20 | 14 | 0.659091 | 0 | 0 | 0 | 0 | 0 | 0.285714 | 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 |
f12439a7c4e14397f7d0e82da1bf23eb6fba6e17 | 458 | py | Python | Percentage_Calculator.py | akshaymulik/Python-Examples | 51f3f647cf4dc234829656e2a7565e8a3419e53c | [
"Apache-2.0"
] | null | null | null | Percentage_Calculator.py | akshaymulik/Python-Examples | 51f3f647cf4dc234829656e2a7565e8a3419e53c | [
"Apache-2.0"
] | null | null | null | Percentage_Calculator.py | akshaymulik/Python-Examples | 51f3f647cf4dc234829656e2a7565e8a3419e53c | [
"Apache-2.0"
] | null | null | null | # Accept the marks of 5 subjects
m1 = input(" Enter the Marks of first subject: ")
m2 = input(" Enter the Marks of second subject: ")
m3 = input(" Enter the Marks of third subject: ")
m4 = input(" Enter the Marks of forth subject: ")
m5 = input(" Enter the Marks of fifth subject: ")
# Total Marks
Total = int(m1)+int(m2)+int(m3)+int(m4)+int(m5)
#Percentage:
Percentage = (Total/500)*100
#Print the Answer
print(' Percentage is {0} %'.format(Percentage))
| 28.625 | 50 | 0.687773 | 73 | 458 | 4.315068 | 0.39726 | 0.152381 | 0.190476 | 0.285714 | 0.31746 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047368 | 0.170306 | 458 | 15 | 51 | 30.533333 | 0.781579 | 0.150655 | 0 | 0 | 0 | 0 | 0.510417 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.125 | 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 |
f12e21b98a41e0fb054cf46d4e18954bcc8fd7d9 | 2,801 | py | Python | ipstools/vsim_defines.py | wanjun199510/IPApproX | 7c60243f90c9f85c54a8500a29d95eec5ab8cf2f | [
"BSD-3-Clause"
] | 11 | 2020-12-04T11:25:40.000Z | 2022-03-09T08:53:36.000Z | ipstools/vsim_defines.py | wanjun199510/IPApproX | 7c60243f90c9f85c54a8500a29d95eec5ab8cf2f | [
"BSD-3-Clause"
] | 7 | 2018-10-02T19:04:33.000Z | 2021-04-27T11:03:44.000Z | ipstools/vsim_defines.py | wanjun199510/IPApproX | 7c60243f90c9f85c54a8500a29d95eec5ab8cf2f | [
"BSD-3-Clause"
] | 30 | 2016-09-17T01:43:21.000Z | 2021-07-28T00:55:49.000Z | #!/usr/bin/env python3
#
# vsim_defines.py
# Francesco Conti <f.conti@unibo.it>
#
# Copyright (C) 2015-2017 ETH Zurich, University of Bologna
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the BSD license. See the LICENSE file for details.
#
# templates for vcompile.csh scripts
VSIM_PREAMBLE = """#!/bin/tcsh
source ${PULP_PATH}/%s/vcompile/setup.csh
##############################################################################
# Settings
##############################################################################
set IP=%s
##############################################################################
# Check settings
##############################################################################
# check if environment variables are defined
if (! $?MSIM_LIBS_PATH ) then
echo "${Red} MSIM_LIBS_PATH is not defined ${NC}"
exit 1
endif
if (! $?IPS_PATH ) then
echo "${Red} IPS_PATH is not defined ${NC}"
exit 1
endif
set LIB_NAME="${IP}_lib"
set LIB_PATH="${MSIM_LIBS_PATH}/${LIB_NAME}"
set IP_PATH="${IPS_PATH}/%s"
set RTL_PATH="${RTL_PATH}"
##############################################################################
# Preparing library
##############################################################################
echo "${Green}--> Compiling ${IP}... ${NC}"
rm -rf $LIB_PATH
vlib $LIB_PATH
vmap $LIB_NAME $LIB_PATH
##############################################################################
# Compiling RTL
##############################################################################
"""
VSIM_POSTAMBLE ="""
echo "${Cyan}--> ${IP} compilation complete! ${NC}"
exit 0
##############################################################################
# Error handler
##############################################################################
error:
echo "${NC}"
exit 1
"""
VSIM_PREAMBLE_SUBIP = """
echo "${Green}Compiling component: ${Brown} %s ${NC}"
echo "${Red}"
"""
VSIM_VLOG_INCDIR_CMD = "+incdir+"
## Add -suppress 2583 to remove warning about always_comb|ff wrapped with
# generate struct that can be only checked after elaboration at vopt stage
VSIM_VLOG_CMD = "vlog -quiet -sv -suppress 2583 -work ${LIB_PATH} %s %s %s || goto error\n"
VSIM_VCOM_CMD = "vcom -quiet -suppress 2583 -work ${LIB_PATH} %s %s || goto error\n"
# templates for vsim.tcl
VSIM_TCL_PREAMBLE = """set VSIM_%s_LIBS " \\\
"""
VSIM_TCL_CMD = " -L %s_lib \\\n"
VSIM_TCL_POSTAMBLE = """"
"""
# templates for vcompile_libs.tc
VCOMPILE_LIBS_PREAMBLE = """#!/usr/bin/tcsh
echo \"\"
echo \"${Green}--> Compiling PULP IPs libraries... ${NC}\"
"""
VCOMPILE_LIBS_CMD = "tcsh ${PULP_PATH}/%s/vcompile/ips/vcompile_%s.csh || exit 1\n"
VCOMPILE_LIBS_XILINX_CMD = "tcsh ${PULP_PATH}/fpga/sim/vcompile/ips/vcompile_%s.csh || exit 1\n"
| 27.194175 | 96 | 0.494466 | 312 | 2,801 | 4.25641 | 0.423077 | 0.031627 | 0.027108 | 0.025602 | 0.139307 | 0.123494 | 0.123494 | 0.085843 | 0 | 0 | 0 | 0.010848 | 0.111389 | 2,801 | 102 | 97 | 27.460784 | 0.5227 | 0.178865 | 0 | 0.344262 | 0 | 0.032787 | 0.858519 | 0.435392 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f12fe2a4def609de352628b4885bd48dd6426c39 | 1,685 | py | Python | functional_tests/register_attendance_student_page.py | wilmoz/attendance-django | c08405079406d8b2a7307643c48d173e5d8d57b8 | [
"MIT"
] | 4 | 2016-11-02T20:38:22.000Z | 2022-02-11T11:39:01.000Z | functional_tests/register_attendance_student_page.py | wilmoz/attendance-django | c08405079406d8b2a7307643c48d173e5d8d57b8 | [
"MIT"
] | null | null | null | functional_tests/register_attendance_student_page.py | wilmoz/attendance-django | c08405079406d8b2a7307643c48d173e5d8d57b8 | [
"MIT"
] | 1 | 2018-05-22T01:44:52.000Z | 2018-05-22T01:44:52.000Z | from page_objects import MultiPageElement, PageElement, PageObject
class RegisterStudentPage(PageObject):
checkboxes = MultiPageElement(xpath="//input[@type='checkbox']")
checked_checkboxes = MultiPageElement(css="input:checked[type='checkbox']")
submit_button = PageElement(css="input[type='submit']")
success_message_element = PageElement(css=".info")
finished_course_message_element = PageElement(css=".finished-course-message")
not_started_course_message_element = PageElement(css=".not-started-course-message")
@property
def not_started_course_message(self):
return self.not_started_course_message_element.text
@property
def finished_course_message(self):
return self.finished_course_message_element.text
@property
def success_message(self):
return self.success_message_element.text
@property
def checked_students(self):
checked_students = [checked_checkbox.find_element_by_xpath("..").text for checked_checkbox in self.checked_checkboxes]
return checked_students
def toggle_check(self, student):
# this is tied to structure of checkboxes generated by django
# <label for="id_students_0">
# <input id="id_students_0" name="students" value="1" type="checkbox"> john
# </label>
student_chekboxes = [checkbox for checkbox in self.checkboxes if checkbox.find_element_by_xpath("..").text == student]
assert len(student_chekboxes) > 0, "student not found in checkboxes"
assert len(student_chekboxes) == 1, "many students found in checkboxes"
student_chekbox = student_chekboxes[0]
student_chekbox.click()
| 43.205128 | 126 | 0.72819 | 197 | 1,685 | 5.974619 | 0.314721 | 0.08836 | 0.071368 | 0.078165 | 0.255735 | 0.11045 | 0 | 0 | 0 | 0 | 0 | 0.00431 | 0.173887 | 1,685 | 38 | 127 | 44.342105 | 0.841236 | 0.102077 | 0 | 0.148148 | 0 | 0 | 0.131963 | 0.070292 | 0 | 0 | 0 | 0 | 0.074074 | 1 | 0.185185 | false | 0 | 0.037037 | 0.111111 | 0.62963 | 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 |
f15159e4ee4f616724cfabf5189129547942a09f | 818 | py | Python | backend/employees/migrations/0005_auto_20200621_2206.py | RodrigoBLima/parking-project | 4444033980aec03f0cd7ba1947b24d487bff9131 | [
"MIT"
] | null | null | null | backend/employees/migrations/0005_auto_20200621_2206.py | RodrigoBLima/parking-project | 4444033980aec03f0cd7ba1947b24d487bff9131 | [
"MIT"
] | 3 | 2021-09-12T01:03:31.000Z | 2022-02-27T06:47:30.000Z | backend/employees/migrations/0005_auto_20200621_2206.py | RodrigoBLima/parking-project | 4444033980aec03f0cd7ba1947b24d487bff9131 | [
"MIT"
] | null | null | null | # Generated by Django 2.0.2 on 2020-06-21 22:06
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('employees', '0004_empregados_idestacionamento'),
]
operations = [
migrations.AlterField(
model_name='empregados',
name='dt_end',
field=models.DateTimeField(verbose_name='Data Saida'),
),
migrations.AlterField(
model_name='empregados',
name='dt_ini',
field=models.DateTimeField(default=datetime.datetime.now, verbose_name='Data entrada'),
),
migrations.AlterField(
model_name='empregados',
name='dt_nasc',
field=models.DateTimeField(verbose_name='Data Nascimento'),
),
]
| 27.266667 | 99 | 0.607579 | 79 | 818 | 6.151899 | 0.506329 | 0.123457 | 0.154321 | 0.179012 | 0.438272 | 0.438272 | 0.277778 | 0 | 0 | 0 | 0 | 0.032368 | 0.282396 | 818 | 29 | 100 | 28.206897 | 0.795571 | 0.055012 | 0 | 0.391304 | 1 | 0 | 0.164721 | 0.041505 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.086957 | 0 | 0.217391 | 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 |
f15200fbf4238e3c2694be0afd209f1db72689ec | 741 | py | Python | korona/templates/html/tags/anchor.py | bharadwajyarlagadda/korona | ee4662b6a29907495e31ed2581dc5484bb03eadc | [
"MIT"
] | 2 | 2016-10-11T03:57:30.000Z | 2018-01-19T20:13:47.000Z | korona/templates/html/tags/anchor.py | iskodirajga/korona | ee4662b6a29907495e31ed2581dc5484bb03eadc | [
"MIT"
] | 16 | 2016-08-19T04:08:45.000Z | 2016-09-27T03:26:39.000Z | korona/templates/html/tags/anchor.py | iskodirajga/korona | ee4662b6a29907495e31ed2581dc5484bb03eadc | [
"MIT"
] | 1 | 2016-10-11T03:57:33.000Z | 2016-10-11T03:57:33.000Z | # -*- coding: utf-8 -*-
"""<a> template"""
from ..environment import env
anchor = env.from_string("""\
<a {% if name -%} name="{{ name }}" {% endif -%}
{% if rel -%} rel="{{ rel }}" {% endif -%}
{% if rev -%} rev="{{ rev }}" {% endif -%}
{% if charset -%} charset="{{ charset }}" {% endif -%}
{% if href -%} href="{{ href }}" {% endif -%}
{% if type -%} type="{{ type }}" {% endif -%}
{% if hreflang -%} hreflang="{{ hreflang }}" {% endif -%}
{% if target -%} target="{{ target }}" {% endif -%}
{% if shape -%} shape="{{ shape }}" {% endif -%}
{% if coords -%} coords="{{ coords }}" {% endif -%}
{% if download -%} download="{{ download }}" {% endif -%}>
{%- if text -%} {{ text }} {%- endif -%}
</a>
""")
| 35.285714 | 61 | 0.446694 | 74 | 741 | 4.459459 | 0.337838 | 0.233333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001757 | 0.232119 | 741 | 20 | 62 | 37.05 | 0.578207 | 0.047233 | 0 | 0 | 0 | 0 | 0.904286 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.0625 | 0 | 0.0625 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f15a6a2bce9a636e62bf2fed79789cce0d6dda8f | 1,599 | py | Python | app/scienceapi/projects/migrations/0006_auto_20160425_1615.py | Mozilla-GitHub-Standards/b55f95984015e193bf0af8041de6a30a1841dd9461fffd41c5216d98d645963d | e30512ba2915abb09e35ea26200cd9cf54d3e965 | [
"MIT"
] | 9 | 2016-03-31T21:53:47.000Z | 2018-12-19T23:42:23.000Z | app/scienceapi/projects/migrations/0006_auto_20160425_1615.py | Mozilla-GitHub-Standards/b55f95984015e193bf0af8041de6a30a1841dd9461fffd41c5216d98d645963d | e30512ba2915abb09e35ea26200cd9cf54d3e965 | [
"MIT"
] | 71 | 2016-03-31T21:09:15.000Z | 2019-03-29T21:55:22.000Z | app/scienceapi/projects/migrations/0006_auto_20160425_1615.py | Mozilla-GitHub-Standards/b55f95984015e193bf0af8041de6a30a1841dd9461fffd41c5216d98d645963d | e30512ba2915abb09e35ea26200cd9cf54d3e965 | [
"MIT"
] | 18 | 2016-03-31T20:48:28.000Z | 2019-03-29T21:55:23.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-25 16:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0005_auto_20160422_1927'),
]
operations = [
migrations.AlterField(
model_name='project',
name='description',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='project',
name='image_url',
field=models.URLField(blank=True, help_text="URL to project's image.", max_length=500, null=True),
),
migrations.AlterField(
model_name='project',
name='license',
field=models.CharField(blank=True, max_length=50, null=True),
),
migrations.AlterField(
model_name='project',
name='project_url',
field=models.URLField(blank=True, help_text="URL to the project's landing page on the web", max_length=500, null=True),
),
migrations.AlterField(
model_name='project',
name='short_description',
field=models.TextField(blank=True, max_length=300, null=True),
),
migrations.AlterField(
model_name='project',
name='slug',
field=models.SlugField(blank=True, help_text="Slug appended to the Mozilla Science project's url that represents this project", max_length=150, null=True, verbose_name='Mozilla Science URL Slug'),
),
]
| 34.76087 | 208 | 0.606004 | 179 | 1,599 | 5.268156 | 0.396648 | 0.081654 | 0.159067 | 0.184518 | 0.50053 | 0.50053 | 0.373277 | 0.373277 | 0.220573 | 0.220573 | 0 | 0.039861 | 0.278299 | 1,599 | 45 | 209 | 35.533333 | 0.777296 | 0.041901 | 0 | 0.473684 | 1 | 0 | 0.197515 | 0.015043 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.052632 | 0 | 0.131579 | 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 |
f16848f38b2c4a1a70dde9745f209461a2bd7ffb | 7,698 | py | Python | Evaluation/mlabels_eval_measures.py | bagheria/cardio-icd-assignment | 99e3162f84aba3301cb69e515b1799cc930471ed | [
"MIT"
] | 5 | 2020-08-05T09:40:59.000Z | 2021-07-08T15:13:41.000Z | Evaluation/mlabels_eval_measures.py | bagheria/cardio-icd-assignment | 99e3162f84aba3301cb69e515b1799cc930471ed | [
"MIT"
] | null | null | null | Evaluation/mlabels_eval_measures.py | bagheria/cardio-icd-assignment | 99e3162f84aba3301cb69e515b1799cc930471ed | [
"MIT"
] | 5 | 2021-01-16T14:04:25.000Z | 2021-05-26T08:12:00.000Z | import numpy as np
import pandas as pd
data = pd.read_csv("Data/icd_selected_data_multilabel.csv", encoding="ISO-8859-1")
df_multi_label = pd.DataFrame(data)
def eval_measures_multi_label(prob_predicted, labels, patient_id_test, threshold=0.08, level='icdcode'):
# labels = list(set(labels))
dict_labels = {i: labels[i] for i in range(0, len(labels))}
# index_dict = [i for i in range(len(dict_labels)) if dict_labels[i]=='I10']
index_E11 = 0
index_E78 = 1
index_I10 = 2
index_I21 = 3
index_I25 = 4
index_I42 = 5
index_I48 = 6
index_I50 = 7
index_N18 = 8
index_Z95 = 9
# Apply apriori rules
for i in range(prob_predicted.shape[0]):
# find max and second max icd probs
temp_array = prob_predicted[i]
temp_array.sort()
max_1 = temp_array[-1]
max_2 = temp_array[-2]
ind_max_1 = np.argwhere(prob_predicted[i] == max_1)
ind_max_2 = np.argwhere(prob_predicted[i] == max_2)
max_1 = np.vectorize(dict_labels.get)(ind_max_1)[0]
max_2 = np.vectorize(dict_labels.get)(ind_max_2)[0]
# two itemset rules
# if (max_1 == 'E78' and max_2 == 'I48') or (max_2 == 'E78' and max_1 == 'I48'):
# prob_predicted[i][index_I10] = prob_predicted[i][index_I10]*1.67
#
# if (max_1 == 'E78' and max_2 == 'Z95') or (max_2 == 'E78' and max_1 == 'Z95'):
# prob_predicted[i][index_I10] = prob_predicted[i][index_I10]*1.56
# prob_predicted[i][index_I25] = prob_predicted[i][index_I25]*1.69
#
# if (max_1 == 'E78' and max_2 == 'I25') or (max_2 == 'E78' and max_1 == 'I25'):
# prob_predicted[i][index_I10] = prob_predicted[i][index_I10]*1.54
# prob_predicted[i][index_Z95] = prob_predicted[i][index_Z95]*1.44
#
# if (max_1 == 'E78' and max_2 == 'I10') or (max_2 == 'E78' and max_1 == 'I10'):
# prob_predicted[i][index_I25] = prob_predicted[i][index_I25]*1.31
#
# if (max_1 == 'I25' and max_2 == 'I48') or (max_2 == 'I25' and max_1 == 'I48'):
# prob_predicted[i][index_Z95] = prob_predicted[i][index_Z95]*1.7
#
# if (max_1 == 'I25' and max_2 == 'I10') or (max_2 == 'I25' and max_1 == 'I10'):
# prob_predicted[i][index_E78] = prob_predicted[i][index_E78]*1.97
# prob_predicted[i][index_Z95] = prob_predicted[i][index_Z95]*1.36
#
# if (max_1 == 'I50' and max_2 == 'I25') or (max_2 == 'I50' and max_1 == 'I25'):
# prob_predicted[i][index_Z95] = prob_predicted[i][index_Z95]*1.68
#
# if (max_1 == 'I50' and max_2 == 'Z95') or (max_2 == 'I50' and max_1 == 'Z95'):
# prob_predicted[i][index_I25] = prob_predicted[i][index_I25]*1.43
#
# if (max_1 == 'I50' and max_2 == 'I48') or (max_2 == 'I50' and max_1 == 'I48'):
# prob_predicted[i][index_Z95] = prob_predicted[i][index_Z95]*1.49
#
# if (max_1 == 'I50' and max_2 == 'I10') or (max_2 == 'I50' and max_1 == 'I10'):
# prob_predicted[i][index_I25] = prob_predicted[i][index_I25]*1.32
#
# if (max_1 == 'Z95' and max_2 == 'I10') or (max_2 == 'Z95' and max_1 == 'I10'):
# prob_predicted[i][index_E78] = prob_predicted[i][index_E78]*1.9
# prob_predicted[i][index_I25] = prob_predicted[i][index_I25]*1.52
#
# if (max_1 == 'Z95' and max_2 == 'I48') or (max_2 == 'Z95' and max_1 == 'I48'):
# prob_predicted[i][index_I50] = prob_predicted[i][index_I50]*1.52
#
# if (max_1 == 'Z95' and max_2 == 'I25') or (max_2 == 'Z95' and max_1 == 'I25'):
# prob_predicted[i][index_I50] = prob_predicted[i][index_I50]*1.5
#
# # one itemset rules
# if max_1 == 'E78':
# prob_predicted[i][index_I25] = prob_predicted[i][index_I25] * 1.33
# prob_predicted[i][index_I10] = prob_predicted[i][index_I10] * 1.56
#
# if max_1 == 'E11':
# prob_predicted[i][index_I25] = prob_predicted[i][index_I25] * 1.36
# prob_predicted[i][index_I10] = prob_predicted[i][index_I10] * 1.4
#
# if max_1 == 'I42':
# prob_predicted[i][index_I50] = prob_predicted[i][index_I50] * 1.91
#
# if max_1 == 'I21':
# prob_predicted[i][index_I25] = prob_predicted[i][index_I25] * 1.39
#
# if max_1 == 'I50':
# prob_predicted[i][index_Z95] = prob_predicted[i][index_Z95] * 1.36
#
# if max_1 == 'Z95':
# prob_predicted[i][index_I25] = prob_predicted[i][index_I25] * 1.3
#
# if max_1 == 'I10':
# prob_predicted[i][index_E78] = prob_predicted[i][index_E78] * 1.56
# Assign the threshold in such a way that the label cardinality for the test set is
# in the same order as the label cardinality in the training set
predicted_labels = []
for i in range(prob_predicted.shape[0]):
lst = [np.argwhere(prob_predicted[i] > threshold)]
lst_val = np.vectorize(dict_labels.get)(lst)[0]
# temp_array = prob_predicted[i]
# temp_array.sort()
# max_1 = temp_array[-1]
# max_2 = temp_array[-2]
# max_3 = temp_array[-3]
# ind_max_1 = np.argwhere(prob_predicted[i] == max_1)
# ind_max_2 = np.argwhere(prob_predicted[i] == max_2)
# ind_max_3 = np.argwhere(prob_predicted[i] == max_3)
# max_1 = np.vectorize(dict_labels.get)(ind_max_1)[0]
# max_2 = np.vectorize(dict_labels.get)(ind_max_2)[0]
# max_3 = np.vectorize(dict_labels.get)(ind_max_3)[0]
# lst_val = []
# lst_val.extend((max_1, max_2, max_3))
predicted_labels.append(lst_val)
# A dataset containing patient id + corresponding predicted chapter labels
# predicted_set = list(zip(patient_id_test, predicted_labels))
# new X_test for multi_label removing duplicates
multi_label_patient_id = df_multi_label['ID']
true_labels = []
for j in range(df_multi_label.shape[0]):
lst = df_multi_label[level][j].split(",")
true_labels.append(lst)
# A dataset containing patient id + corresponding true chapter labels
predicted_set = list(zip(multi_label_patient_id, predicted_labels))
true_set = list(zip(multi_label_patient_id, true_labels))
lengths = [len(true_labels[i]) for i in range(len(true_labels))]
label_cardinality = np.mean(lengths)
print("label cardinality = ", label_cardinality)
sum_sen = 0
sum_spe = 0
sum_ppv = 0
sum_npv = 0
sum_f1 = 0
n = 0
for i in range(len(predicted_set)):
# predicted_set[i][0] is the patient id
pid = predicted_set[i][0]
for j in range(len(true_set)):
if true_set[j][0] == pid:
YZ_intersection = len(np.intersect1d(predicted_set[i][1], true_set[j][1]))
tn = len(np.intersect1d(np.setdiff1d(labels, predicted_set[i][1]), np.setdiff1d(labels, true_set[j][1])))
sp_dn = len(np.setdiff1d(labels, true_set[j][1]))
npv_dn = len(np.setdiff1d(labels, predicted_set[i][1]))
Yi = len(predicted_set[i][1])
Zi = len(true_set[j][1])
break
n = n + 1
sum_sen += YZ_intersection / Zi
sum_spe += tn / sp_dn
sum_ppv += YZ_intersection / Yi
sum_npv += tn / npv_dn
sum_f1 += (2 * YZ_intersection) / (Yi + Zi)
sensitivity = sum_sen / n
specificity = sum_spe / n
ppv = sum_ppv / n
npv = sum_npv / n
f1_score = sum_f1 / n
return sensitivity, specificity, ppv, npv, f1_score
| 44.49711 | 121 | 0.585087 | 1,172 | 7,698 | 3.563993 | 0.127986 | 0.196074 | 0.201101 | 0.236533 | 0.643763 | 0.625808 | 0.566435 | 0.440029 | 0.410582 | 0.401963 | 0 | 0.08289 | 0.268122 | 7,698 | 172 | 122 | 44.755814 | 0.658502 | 0.528969 | 0 | 0.028986 | 0 | 0 | 0.021795 | 0.010473 | 0 | 0 | 0 | 0 | 0 | 1 | 0.014493 | false | 0 | 0.028986 | 0 | 0.057971 | 0.014493 | 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 |
f184d60d395575da1087557c69b00525f2976fd6 | 2,944 | py | Python | pyriemann/utils/base.py | aizmeng/pyRiemann | e1876de486b8ae047015a0c20284f626c4a92871 | [
"BSD-3-Clause"
] | 2 | 2020-12-08T07:12:43.000Z | 2020-12-22T06:58:02.000Z | pyriemann/utils/base.py | aizmeng/pyRiemann | e1876de486b8ae047015a0c20284f626c4a92871 | [
"BSD-3-Clause"
] | null | null | null | pyriemann/utils/base.py | aizmeng/pyRiemann | e1876de486b8ae047015a0c20284f626c4a92871 | [
"BSD-3-Clause"
] | 1 | 2021-08-02T05:44:23.000Z | 2021-08-02T05:44:23.000Z | import numpy
import scipy
from numpy.core.numerictypes import typecodes
def _matrix_operator(Ci, operator):
"""matrix equivalent of an operator."""
if Ci.dtype.char in typecodes['AllFloat'] and not numpy.isfinite(Ci).all():
raise ValueError("Covariance matrices must be positive definite. Add regularization to avoid this error.")
eigvals, eigvects = scipy.linalg.eigh(Ci, check_finite=False)
eigvals = numpy.diag(operator(eigvals))
Out = numpy.dot(numpy.dot(eigvects, eigvals), eigvects.T)
return Out
def sqrtm(Ci):
"""Return the matrix square root of a covariance matrix defined by :
.. math::
\mathbf{C} = \mathbf{V} \left( \mathbf{\Lambda} \\right)^{1/2} \mathbf{V}^T
where :math:`\mathbf{\Lambda}` is the diagonal matrix of eigenvalues
and :math:`\mathbf{V}` the eigenvectors of :math:`\mathbf{Ci}`
:param Ci: the coavriance matrix
:returns: the matrix square root
"""
return _matrix_operator(Ci, numpy.sqrt)
def logm(Ci):
"""Return the matrix logarithm of a covariance matrix defined by :
.. math::
\mathbf{C} = \mathbf{V} \log{(\mathbf{\Lambda})} \mathbf{V}^T
where :math:`\mathbf{\Lambda}` is the diagonal matrix of eigenvalues
and :math:`\mathbf{V}` the eigenvectors of :math:`\mathbf{Ci}`
:param Ci: the coavriance matrix
:returns: the matrix logarithm
"""
return _matrix_operator(Ci, numpy.log)
def expm(Ci):
"""Return the matrix exponential of a covariance matrix defined by :
.. math::
\mathbf{C} = \mathbf{V} \exp{(\mathbf{\Lambda})} \mathbf{V}^T
where :math:`\mathbf{\Lambda}` is the diagonal matrix of eigenvalues
and :math:`\mathbf{V}` the eigenvectors of :math:`\mathbf{Ci}`
:param Ci: the coavriance matrix
:returns: the matrix exponential
"""
return _matrix_operator(Ci, numpy.exp)
def invsqrtm(Ci):
"""Return the inverse matrix square root of a covariance matrix defined by :
.. math::
\mathbf{C} = \mathbf{V} \left( \mathbf{\Lambda} \\right)^{-1/2} \mathbf{V}^T
where :math:`\mathbf{\Lambda}` is the diagonal matrix of eigenvalues
and :math:`\mathbf{V}` the eigenvectors of :math:`\mathbf{Ci}`
:param Ci: the coavriance matrix
:returns: the inverse matrix square root
"""
isqrt = lambda x: 1. / numpy.sqrt(x)
return _matrix_operator(Ci, isqrt)
def powm(Ci, alpha):
"""Return the matrix power :math:`\\alpha` of a covariance matrix defined by :
.. math::
\mathbf{C} = \mathbf{V} \left( \mathbf{\Lambda} \\right)^{\\alpha} \mathbf{V}^T
where :math:`\mathbf{\Lambda}` is the diagonal matrix of eigenvalues
and :math:`\mathbf{V}` the eigenvectors of :math:`\mathbf{Ci}`
:param Ci: the coavriance matrix
:param alpha: the power to apply
:returns: the matrix power
"""
power = lambda x: x**alpha
return _matrix_operator(Ci, power)
| 30.040816 | 114 | 0.652514 | 400 | 2,944 | 4.77 | 0.22 | 0.104822 | 0.050314 | 0.04979 | 0.615828 | 0.55608 | 0.55608 | 0.55608 | 0.55608 | 0.55608 | 0 | 0.002147 | 0.208899 | 2,944 | 97 | 115 | 30.350515 | 0.817089 | 0.631454 | 0 | 0 | 0 | 0 | 0.105028 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.136364 | 0 | 0.681818 | 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 |
f185facea8282cc0016cbc65358c5ac551a0f4d1 | 349 | py | Python | bookstore/utils/const.py | AlvinToh/complete-backend-development-python | d633cebe88aad1e3225dc1fc4c1b77f485c4b1a3 | [
"MIT"
] | null | null | null | bookstore/utils/const.py | AlvinToh/complete-backend-development-python | d633cebe88aad1e3225dc1fc4c1b77f485c4b1a3 | [
"MIT"
] | null | null | null | bookstore/utils/const.py | AlvinToh/complete-backend-development-python | d633cebe88aad1e3225dc1fc4c1b77f485c4b1a3 | [
"MIT"
] | null | null | null | JWT_SECRET_KEY = "e75a9e10168350b2a8869a8eb8a0f946a15eec8452048c0b51923f98ea9ea43b"
JWT_ALGORITHM = "HS256"
JWT_EXPIRATION_TIME_MINUTES = 60 * 24 * 5
TOKEN_DESCRIPTION = "It checks username and password if they are true, it returns JWT token to you."
TOKEN_SUMMARY = "It returns JWT Token."
ISBN_DESCRIPTION = "It is unique identifier for books."
| 38.777778 | 100 | 0.805158 | 45 | 349 | 6.044444 | 0.733333 | 0.095588 | 0.088235 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.165017 | 0.131805 | 349 | 8 | 101 | 43.625 | 0.732673 | 0 | 0 | 0 | 0 | 0 | 0.578797 | 0.183381 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.166667 | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
f191c1e508db64a880056ee3df1969af6ce484d0 | 1,357 | py | Python | tests/test_demand_deploy.py | jbae11/cyclus_input_gen | 05485033f93227804697f39da61b515249cf9118 | [
"BSD-3-Clause"
] | 1 | 2019-03-11T12:40:07.000Z | 2019-03-11T12:40:07.000Z | tests/test_demand_deploy.py | jbae11/cyclus_input_gen | 05485033f93227804697f39da61b515249cf9118 | [
"BSD-3-Clause"
] | 3 | 2018-10-25T18:31:38.000Z | 2019-07-02T16:04:09.000Z | tests/test_demand_deploy.py | jbae11/cyclus_input_gen | 05485033f93227804697f39da61b515249cf9118 | [
"BSD-3-Clause"
] | 3 | 2018-12-13T17:21:40.000Z | 2020-04-29T18:22:48.000Z | import numpy as np
import collections
import os
import sys
import cyclus_input_gen.demand_deploy as dd
def test_get_new_deployment_prev():
"""Test get new deployment"""
length = 10
prev_power = {'instA': np.zeros(length)}
deploy_array, power_array = dd.get_new_deployment(prev_power,
['instA'],
'1*t',
1,
2,
100)
assert sum(deploy_array) == 20
assert max(power_array) == 8
def test_get_new_deployment_aft():
"""Test get new deployment"""
length = 10
prev_power = {'instA': np.zeros(length)}
deploy_array, power_array = dd.get_new_deployment(prev_power,
['instA'],
'1*t',
1,
2,
5,
new=True)
# check if nothing is deployed before avail timestep
assert sum(deploy_array[:5]) == 0
assert max(power_array) == 9
| 36.675676 | 65 | 0.388357 | 117 | 1,357 | 4.273504 | 0.401709 | 0.072 | 0.192 | 0.16 | 0.54 | 0.448 | 0.448 | 0.448 | 0.448 | 0.448 | 0 | 0.032154 | 0.541636 | 1,357 | 36 | 66 | 37.694444 | 0.771704 | 0.072955 | 0 | 0.5 | 0 | 0 | 0.02085 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.071429 | false | 0 | 0.178571 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
74c42d7bd2da0823a5937751d26b2cbf355d915c | 1,116 | py | Python | imports.py | AhzamAhmed6/UNet-Image-Segmentation | 804b66b647f5290755ad94b1fd4cb795d7776826 | [
"MIT"
] | null | null | null | imports.py | AhzamAhmed6/UNet-Image-Segmentation | 804b66b647f5290755ad94b1fd4cb795d7776826 | [
"MIT"
] | null | null | null | imports.py | AhzamAhmed6/UNet-Image-Segmentation | 804b66b647f5290755ad94b1fd4cb795d7776826 | [
"MIT"
] | null | null | null | import albumentations
import albumentations as A
from albumentations import (HorizontalFlip, ShiftScaleRotate, Normalize, Resize, Compose, GaussNoise)
from albumentations.pytorch.transforms import ToTensor
import os
import time
import torch.utils.data as data
import glob
import copy
from collections import defaultdict
import torch
import shutil
import pandas as pd
from skimage import io, transform
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
from torch.utils.data import Dataset, DataLoader, random_split
from torchvision import transforms, utils
import torchvision
from torch import nn
#import tqdm as tqdm
from tqdm import tqdm as tqdm
import cv2
from torch.autograd import Variable
from torch.nn import Linear, ReLU, CrossEntropyLoss, Sequential, Conv2d, MaxPool2d, Module, Softmax, BatchNorm2d, Dropout
from torch.optim import Adam, SGD
import torch.nn.functional as F
from PIL import Image
from torch import nn
import zipfile
import random
import imageio
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') | 25.363636 | 122 | 0.789427 | 154 | 1,116 | 5.707792 | 0.461039 | 0.061433 | 0.031854 | 0.040956 | 0.052332 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005388 | 0.168459 | 1,116 | 44 | 123 | 25.363636 | 0.94181 | 0.017025 | 0 | 0.121212 | 0 | 0 | 0.008539 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.969697 | 0 | 0.969697 | 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 |
74dba4e65ca45522d561ebc8c8ac9345d56b0e19 | 1,156 | py | Python | custom/icds_reports/migrations/0164_auto_20200123_0702.py | satyaakam/commcare-hq | 233f255ff20ab3a16013e9fdfdb9c1dcf632e415 | [
"BSD-3-Clause"
] | 1 | 2020-07-14T13:00:23.000Z | 2020-07-14T13:00:23.000Z | custom/icds_reports/migrations/0164_auto_20200123_0702.py | satyaakam/commcare-hq | 233f255ff20ab3a16013e9fdfdb9c1dcf632e415 | [
"BSD-3-Clause"
] | 1 | 2021-06-02T04:45:16.000Z | 2021-06-02T04:45:16.000Z | custom/icds_reports/migrations/0164_auto_20200123_0702.py | satyaakam/commcare-hq | 233f255ff20ab3a16013e9fdfdb9c1dcf632e415 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-01-23 07:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icds_reports', '0163_update_agg_awc_monthly_view'),
]
operations = [
migrations.AddField(
model_name='agggovernancedashboard',
name='anc_today',
field=models.NullBooleanField(),
),
migrations.AddField(
model_name='agggovernancedashboard',
name='anm_mpw_present',
field=models.NullBooleanField(),
),
migrations.AddField(
model_name='agggovernancedashboard',
name='asha_present',
field=models.NullBooleanField(),
),
migrations.AddField(
model_name='agggovernancedashboard',
name='child_immu',
field=models.NullBooleanField(),
),
migrations.AddField(
model_name='agggovernancedashboard',
name='vhsnd_date_past_month',
field=models.DateField(null=True),
)
]
| 28.195122 | 61 | 0.595156 | 100 | 1,156 | 6.64 | 0.56 | 0.135542 | 0.173193 | 0.203313 | 0.582831 | 0.582831 | 0.503012 | 0.503012 | 0.503012 | 0.262048 | 0 | 0.027228 | 0.301038 | 1,156 | 40 | 62 | 28.9 | 0.794554 | 0.059689 | 0 | 0.545455 | 1 | 0 | 0.203875 | 0.150369 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.060606 | 0 | 0.151515 | 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 |
74dd84e7ae28be6df1eb50c430788fc76e1ebd68 | 1,039 | py | Python | src/dask_awkward/tests/test_ufunc.py | douglasdavis/dask-awkward-sandbox | 901eec69a92957dc5c3e64339705567c970b55bf | [
"BSD-3-Clause"
] | 21 | 2021-09-09T19:32:30.000Z | 2022-03-01T15:42:06.000Z | src/dask_awkward/tests/test_ufunc.py | douglasdavis/dask-awkward-sandbox | 901eec69a92957dc5c3e64339705567c970b55bf | [
"BSD-3-Clause"
] | 14 | 2021-09-23T16:54:10.000Z | 2022-03-23T19:24:53.000Z | src/dask_awkward/tests/test_ufunc.py | douglasdavis/dask-awkward-sandbox | 901eec69a92957dc5c3e64339705567c970b55bf | [
"BSD-3-Clause"
] | 3 | 2021-09-09T19:32:32.000Z | 2021-11-18T17:27:35.000Z | from __future__ import annotations
import numpy as np
import pytest
from .helpers import ( # noqa: F401
assert_eq,
line_delim_records_file,
load_records_eager,
load_records_lazy,
)
def test_ufunc_add(line_delim_records_file) -> None: # noqa: F811
daa = load_records_lazy(line_delim_records_file).analysis.x1
caa = load_records_eager(line_delim_records_file).analysis.x1
a1 = daa + 2
a2 = caa + 2
assert_eq(a1, a2)
def test_ufunc_sin(line_delim_records_file) -> None: # noqa: F811
daa = load_records_lazy(line_delim_records_file).analysis.x1
caa = load_records_eager(line_delim_records_file).analysis.x1
a1 = np.sin(daa)
a2 = np.sin(caa)
assert_eq(a1, a2)
@pytest.mark.parametrize("f", [np.add.accumulate, np.add.reduce])
def test_ufunc_method_raise(line_delim_records_file, f) -> None: # noqa: F811
daa = load_records_lazy(line_delim_records_file).analysis.x1
with pytest.raises(NotImplementedError, match="Array ufunc supports only method"):
f(daa, daa)
| 29.685714 | 86 | 0.735322 | 157 | 1,039 | 4.515924 | 0.305732 | 0.114245 | 0.203103 | 0.253879 | 0.454161 | 0.454161 | 0.454161 | 0.454161 | 0.454161 | 0.454161 | 0 | 0.03125 | 0.168431 | 1,039 | 34 | 87 | 30.558824 | 0.789352 | 0.041386 | 0 | 0.269231 | 0 | 0 | 0.0333 | 0 | 0 | 0 | 0 | 0 | 0.115385 | 1 | 0.115385 | false | 0 | 0.153846 | 0 | 0.269231 | 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 |
2d01619f33643cd737c942d5e85e6212622ecf67 | 1,738 | py | Python | utils/bin/new.py | DavidCPorter/janus-framework | ebf3ad1a7053ba9929330a4bfce4d30fffa2549f | [
"Apache-2.0"
] | null | null | null | utils/bin/new.py | DavidCPorter/janus-framework | ebf3ad1a7053ba9929330a4bfce4d30fffa2549f | [
"Apache-2.0"
] | 3 | 2020-07-16T17:49:03.000Z | 2020-10-19T14:20:42.000Z | utils/bin/new.py | DavidCPorter/janus-framework | ebf3ad1a7053ba9929330a4bfce4d30fffa2549f | [
"Apache-2.0"
] | 1 | 2020-12-14T10:31:54.000Z | 2020-12-14T10:31:54.000Z | import pip
import sys
import os
import subprocess
from yaml import safe_load, safe_dump
from shutil import copyfile
def main(args):
print(args)
arg_dict = {args[x]: args[x + 1] for x in range(0, len(args) - 1) if x % 2 == 0}
branch_list=arg_dict.get("--branches")
exp_name=arg_dict.get("--name")
home=arg_dict.get("--home")
branch_list = branch_list.split(',')
output = subprocess.run(['mkdir', home + '/experiments/' + exp_name ], capture_output=True)
for i in branch_list:
output = subprocess.run(['mkdir', home+'/experiments/'+exp_name+'/'+i], capture_output=True)
# open(home+'/experiments/'+exp_name+'/inventory', )
# could add multi-inventory mode here, for now it's a single inv for all branches.
copyfile(home+'/utils/inventory', home+'/experiments/'+exp_name+'/inventory')
copyfile(home+'/utils/janusfile', home+'/experiments/'+exp_name+'/janusfile')
subprocess.run(['mkdir', home+'/experiments/'+exp_name+'/'+i+'/env'])
subprocess.run(['mkdir', home+'/experiments/'+exp_name+'/'+i+'/load'])
subprocess.run(['mkdir', home+'/experiments/'+exp_name+'/'+i+'/pipeline'])
subprocess.run(['mkdir', home+'/experiments/'+exp_name+'/'+i+'/service'])
subprocess.run(['mkdir', home+'/experiments/'+exp_name+'/'+i+'/viz'])
with open(home+'/experiments/'+exp_name+'/'+i+'/mod_order.yml', 'w+') as f:
safe_dump({'module_order': None}, f)
open(home+'/experiments/'+exp_name+'/'+i+'/user_variables.yml', 'a').close()
open(home + '/experiments/' + exp_name + '/' + i + '/branch_globals.yml', 'a').close()
if __name__ == '__main__':
# print (sys.argv)
main(sys.argv[2:])
sys.exit()
| 44.564103 | 100 | 0.623705 | 231 | 1,738 | 4.52381 | 0.333333 | 0.09378 | 0.223923 | 0.273684 | 0.425837 | 0.362679 | 0.285167 | 0.285167 | 0 | 0 | 0 | 0.004149 | 0.168009 | 1,738 | 38 | 101 | 45.736842 | 0.718534 | 0.085155 | 0 | 0 | 0 | 0 | 0.240379 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.033333 | false | 0 | 0.2 | 0 | 0.233333 | 0.033333 | 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 |
2d173a9abd0770082aab94b7b9cd550b6cf25565 | 435 | py | Python | examples/minimal/main_2_manual_task.py | TheCheapestPixels/panda3d-keybindings | c89a531fafe4e5f8c4fbf61a087ed53299cccf85 | [
"BSD-3-Clause"
] | null | null | null | examples/minimal/main_2_manual_task.py | TheCheapestPixels/panda3d-keybindings | c89a531fafe4e5f8c4fbf61a087ed53299cccf85 | [
"BSD-3-Clause"
] | null | null | null | examples/minimal/main_2_manual_task.py | TheCheapestPixels/panda3d-keybindings | c89a531fafe4e5f8c4fbf61a087ed53299cccf85 | [
"BSD-3-Clause"
] | 1 | 2021-10-10T11:52:46.000Z | 2021-10-10T11:52:46.000Z | from direct.showbase.ShowBase import ShowBase
from keybindings.device_listener import add_device_listener
from keybindings.device_listener import SinglePlayerAssigner
ShowBase()
add_device_listener(
assigner=SinglePlayerAssigner(),
task=False,
)
def read(task):
base.device_listener.read(globalClock.dt)
print(base.device_listener.read_context('demo_context'))
return task.cont
base.add_task(read)
base.run()
| 20.714286 | 60 | 0.797701 | 54 | 435 | 6.222222 | 0.425926 | 0.25 | 0.125 | 0.172619 | 0.208333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117241 | 435 | 20 | 61 | 21.75 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0.027586 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0.214286 | 0 | 0.357143 | 0.071429 | 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 |
2d1a62859c0ea94dc29e805ed77ae0880a804233 | 16,448 | py | Python | probe/tests/modules/antivirus/test_virusblokada.py | krisshol/bach-kmno | f40d85b3397bb340e26a671c54d4a753dbbb0d43 | [
"Apache-2.0"
] | null | null | null | probe/tests/modules/antivirus/test_virusblokada.py | krisshol/bach-kmno | f40d85b3397bb340e26a671c54d4a753dbbb0d43 | [
"Apache-2.0"
] | null | null | null | probe/tests/modules/antivirus/test_virusblokada.py | krisshol/bach-kmno | f40d85b3397bb340e26a671c54d4a753dbbb0d43 | [
"Apache-2.0"
] | null | null | null | from .test_antivirus import AbstractTests
import modules.antivirus.virusblokada.virusblokada as module
import modules.antivirus.base as base
from mock import patch
from pathlib import Path
class TestVirusBlokada(AbstractTests.TestAntivirus):
name = "VirusBlokAda Console Scanner (Linux)"
scan_path = Path("/usr/bin/vbacl")
scan_args = ('-AF+', '-PM+', '-RW+', '-HA=3', '-VM+', '-AR+', '-ML+',
'-CH+', '-SFX+',)
module = module.VirusBlokAda
scan_clean_stdout = """
+----------------------------------------------------+
| VirusBlokAda (Console scanner) |
| Vba32 Linux 3.12.32.0 / 2018.05.21 09:08 (Vba32.L) |
| Copyright (c) 1993-2018 by VBA Ltd. |
+----------------------------------------------------+
Key file not found
Demo mode
Program settings:
-QU -AF -AR -CH -ML -PM -RW -SFX -VM -HA=3 -J=1
filename
Directories : 0 Files in archives: Files on disks:
Archives: - total : 0 - total : 1
- scanned : 0 - scanned : 0 - scanned : 1
- contain viruses : 0 - infected : 0 - infected : 0
- deleted : 0 - suspicious : 0 - suspicious : 0
- cured : 0
Mail messages: Attached files - deleted : 0
- scanned : 0 - total : 0 - renamed : 0
- contain viruses : 0 - scanned : 0 - quarantined: 0
- suspicious : 0 - infected : 0
- deleted : 0 - suspicious : 0
- cured : 0
- deleted : 0
Startup : 15:50:36 22-05-2018
End : 15:50:36 22-05-2018
Total time : 00:00:00
""" # nopep8
scan_virus_retcode = 6
scan_virus_stdout = """
+----------------------------------------------------+
| VirusBlokAda (Console scanner) |
| Vba32 Linux 3.12.32.0 / 2018.05.21 09:08 (Vba32.L) |
| Copyright (c) 1993-2018 by VBA Ltd. |
+----------------------------------------------------+
Key file not found
Demo mode
Program settings:
-QU -AF -AR -CH -ML -PM -RW -SFX -VM -HA=3 -J=1
eicar.com.txt
eicar.com.txt : infected EICAR-Test-File
Directories : 0 Files in archives: Files on disks:
Archives: - total : 0 - total : 1
- scanned : 0 - scanned : 0 - scanned : 1
- contain viruses : 0 - infected : 0 - infected : 1
- deleted : 0 - suspicious : 0 - suspicious : 0
- cured : 0
Mail messages: Attached files - deleted : 0
- scanned : 0 - total : 0 - renamed : 0
- contain viruses : 0 - scanned : 0 - quarantined: 0
- suspicious : 0 - infected : 0
- deleted : 0 - suspicious : 0
- cured : 0
- deleted : 0
Startup : 15:51:37 22-05-2018
End : 15:51:37 22-05-2018
Total time : 00:00:00""" # nopep8
virusname = "EICAR-Test-File"
version = "3.12.32.0"
version_stdout = """
+----------------------------------------------------+
| VirusBlokAda (Console scanner) |
| Vba32 Linux 3.12.32.0 / 2018.05.21 09:08 (Vba32.L) |
| Copyright (c) 1993-2018 by VBA Ltd. |
+----------------------------------------------------+
Key file not found
Demo mode
Start from the command line:
vba32l [path] ... [path] [-switch] ... [-switch],
@filename - scan files from filelist
switch - specifies program options:
-?[+|-] - show help screen;
-H[+|-] - show help screen;
-HELP[+|-] - show help screen;
-AF[+|-] - all files;
-SL[+|-] - follow symbolic links;
-PM[+|-] - thorough scanning mode;
-RW[+|-] - detect Spyware, Adware, Riskware;
-CH[+|-] - switch on cache while scanning objects;
-FC[+|-] - cure infected files;
-FD[+|-] - delete infected files;
-FR[+|-] - rename infected files;
-FM+[directory]- move infected files to selected directory (by default /var/virus);
-SD[+|-] - delete suspicious files;
-SR[+|-] - rename suspicious files;
-SM+[directory]- move suspicious files to selected directory (by default /var/virus);
-HA=[0|1|2|3] - heuristic analysis level (0 - disabled, 2 - maximum);
-QI[+[directory]|-] - copy infected object to Quarantine;
-QS[+[directory]|-] - copy suspicious object to Quarantine;
-R=[filename] - save report to file (VBA32.RPT by default);
-R+[filename] - append report to file (VBA32.RPT by default);
-SYSLOG[+|-] - send scanning events to syslog;
-L=[filename] - save list of infected files to file (VBA32.LST);
-L+[filename] - append list of infected files to file (VBA32.LST);
-QU[+|-] - allow the program to be interrupted (by default);
-DB=directory - search virus definitions update in
selected directory on startup;
-OK[+|-] - include "clean" filenames in report;
-TRUSTZONE[+|-] - distinguish "trusted" files (use with -OK);
-AR[+|-] - enable archives scanning;
-AL=[file_size,kB] - don't scan archives larger than the specified value;
-AD[+|-] - delete archives containing infected files;
-SFX[+|-] - detect installers of malware;
-ML[+|-] - mail scanning;
-MD[+|-] - delete messages containing infected files;
-VL[+|-] - view list of viruses known to program;
-VM[+|-] - show macros information in documents;
-SI[+|-] - additional information about program support;
-LNG=suffix - select language file VBA32<suffix>.LNG;
-KF={directory|path} - specify path to key file;
-EXT= - specify list of file extensions to be checked;
-EXT+ - add user defined file extensions to default list;
-EXT- - remove file extensions from default list;
-WK[+|-] - wait for any key when finished;
-SP[+|-] - show overall check progress;
-J[+|-|=thread_count] - multithreaded mode, count of simultaneously
processed files can be set to default value (-J, -J+,
preferred) or explicitely (-J=count);
The following switches are active by default: -QU -RW
Program settings:
-HELP -QU -AF -RW -HA=1 -J=1
""" # nopep8
virus_database_version = "2018.05.21 09:08"
virus_database_version_stdout = version_stdout
@patch.object(module, "get_virus_database_version")
@patch.object(base.AntivirusUnix, "locate")
@patch.object(base.AntivirusUnix, "locate_one")
@patch.object(base.AntivirusUnix, "run_cmd")
def setUp(self, m_run_cmd, m_locate_one, m_locate,
m_get_virus_database_version):
m_run_cmd.return_value = 0, self.version_stdout, ""
m_locate_one.return_value = self.scan_path
m_locate.return_value = self.database
m_get_virus_database_version.return_value = self.virus_database_version
super().setUp()
@patch.object(module, "locate_one")
@patch.object(base.AntivirusUnix, "run_cmd")
def test_get_virus_db(self, m_run_cmd, m_locate_one):
m_locate_one.return_value = self.scan_path
m_run_cmd.return_value = 0, self.virus_database_version_stdout, ""
version = self.plugin.get_virus_database_version()
self.assertEquals(version, self.virus_database_version)
| 97.325444 | 120 | 0.252006 | 878 | 16,448 | 4.637813 | 0.297267 | 0.028733 | 0.044204 | 0.005894 | 0.43664 | 0.388998 | 0.380157 | 0.354617 | 0.318271 | 0.252701 | 0 | 0.048566 | 0.675766 | 16,448 | 168 | 121 | 97.904762 | 0.714982 | 0.001216 | 0 | 0.366013 | 0 | 0.039216 | 0.906965 | 0.022589 | 0 | 0 | 0 | 0 | 0.006536 | 1 | 0.013072 | false | 0 | 0.03268 | 0 | 0.130719 | 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 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
2d2996886a5c8e3dc907204933c8e59667b32e5a | 616 | py | Python | APP_aaaaaaaa/page/G_personal_center_page.py | 15008477526/- | e58e4879bd9001b4b27eafcbddce9daeadd5aa51 | [
"bzip2-1.0.6"
] | null | null | null | APP_aaaaaaaa/page/G_personal_center_page.py | 15008477526/- | e58e4879bd9001b4b27eafcbddce9daeadd5aa51 | [
"bzip2-1.0.6"
] | null | null | null | APP_aaaaaaaa/page/G_personal_center_page.py | 15008477526/- | e58e4879bd9001b4b27eafcbddce9daeadd5aa51 | [
"bzip2-1.0.6"
] | null | null | null | from page.F_my_order import MyOrderPage
class PersonalCenterPage(MyOrderPage):
"""个人中心页面"""
to_appraisal_loc = ('xpath', '//*[@text="待评价"]')
mine_balance_loc = ('id', 'com.tpshop.malls:id/balance_tv') # 我的--余额
mine_points_loc = ('id', 'com.tpshop.malls:id/point_tv') # 我的--积分
def click_to_appraisal(self):
"""点击待评价"""
self.click(self.to_appraisal_loc)
def get_mine_balance(self):
"""获取我的--余额"""
return self.get_ele_text(self.mine_balance_loc)
def get_mine_ponits(self):
"""获取我的--积分"""
return self.get_ele_text(self.mine_points_loc)
| 28 | 73 | 0.641234 | 85 | 616 | 4.341176 | 0.435294 | 0.089431 | 0.075881 | 0.075881 | 0.265583 | 0.265583 | 0.151762 | 0 | 0 | 0 | 0 | 0 | 0.196429 | 616 | 21 | 74 | 29.333333 | 0.745455 | 0.073052 | 0 | 0 | 0 | 0 | 0.151184 | 0.105647 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.090909 | 0 | 0.909091 | 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 |
2d2b5901bb0e0744d4c9587792bc1fecb4ff4b5b | 526 | py | Python | tests/__init__.py | joshuadavidthomas/django_coverage_plugin | c4ec0691906dc0923c494efc9c9236d3aa21be73 | [
"Apache-2.0"
] | 172 | 2015-01-03T20:26:42.000Z | 2022-02-18T20:38:59.000Z | tests/__init__.py | joshuadavidthomas/django_coverage_plugin | c4ec0691906dc0923c494efc9c9236d3aa21be73 | [
"Apache-2.0"
] | 71 | 2015-01-17T19:22:53.000Z | 2022-02-03T09:09:35.000Z | tests/__init__.py | BillSchumacher/django_coverage_plugin | 597f07d60fffe05b9062b6c41afa722a4b32f3ba | [
"Apache-2.0"
] | 31 | 2015-01-18T14:32:46.000Z | 2022-02-18T20:39:07.000Z | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/django_coverage_plugin/blob/master/NOTICE.txt
"""The tests for the Django Coverage Plugin."""
# Define URLs here so we can use ROOT_URLCONF="tests"
try:
from django.urls import re_path
except ImportError:
from django.conf.urls import url as re_path
def index(request):
"""A bogus view to use in the urls below."""
pass
urlpatterns = [
re_path(r'^home$', index, name='index'),
]
| 23.909091 | 86 | 0.714829 | 82 | 526 | 4.512195 | 0.707317 | 0.048649 | 0.108108 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004545 | 0.163498 | 526 | 21 | 87 | 25.047619 | 0.836364 | 0.562738 | 0 | 0 | 0 | 0 | 0.050691 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0.111111 | 0.333333 | 0 | 0.444444 | 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 |
741576b4d98abca6f3124aea28f8a0aae02977e9 | 355 | py | Python | gatherQuestion.py | emht/competitive_coding | 4883c1afc75953dd87ce40c29a48e6ec76252edf | [
"MIT"
] | null | null | null | gatherQuestion.py | emht/competitive_coding | 4883c1afc75953dd87ce40c29a48e6ec76252edf | [
"MIT"
] | null | null | null | gatherQuestion.py | emht/competitive_coding | 4883c1afc75953dd87ce40c29a48e6ec76252edf | [
"MIT"
] | null | null | null | #! usr/bin/python3
"""
This is the python script used to download few codechef questions from the website.
Put them in the correct place as the structure demands like beginner questions in beginner and so on.
Add the question statement as a Readme.md for each question and the link to the question.
<Add the features of @SuperCodeBot on telegram.>
"""
| 32.272727 | 101 | 0.774648 | 59 | 355 | 4.661017 | 0.711864 | 0.043636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003413 | 0.174648 | 355 | 10 | 102 | 35.5 | 0.935154 | 0.966197 | 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 |
7424f39dffb3de96bf9eeac7f0dc701258e29e5b | 836 | py | Python | programacao-para-internet-ifpi-2017-master/StudentMy-master/core/migrations/0006_auto_20180322_0723.py | danieldsf/ads-activities | 3da8168f685dfdbe146e20023fbdaefd46c21b54 | [
"Apache-2.0"
] | 1 | 2021-08-19T12:13:21.000Z | 2021-08-19T12:13:21.000Z | programacao-para-internet-ifpi-2017-master/StudentMy-master/core/migrations/0006_auto_20180322_0723.py | danieldsf/ads-activities | 3da8168f685dfdbe146e20023fbdaefd46c21b54 | [
"Apache-2.0"
] | null | null | null | programacao-para-internet-ifpi-2017-master/StudentMy-master/core/migrations/0006_auto_20180322_0723.py | danieldsf/ads-activities | 3da8168f685dfdbe146e20023fbdaefd46c21b54 | [
"Apache-2.0"
] | null | null | null | # Generated by Django 2.0.3 on 2018-03-22 10:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0005_auto_20180321_2140'),
]
operations = [
migrations.AddField(
model_name='student',
name='name',
field=models.CharField(default=1, max_length=255),
preserve_default=False,
),
migrations.AddField(
model_name='teacher',
name='name',
field=models.CharField(default=1, max_length=255),
preserve_default=False,
),
migrations.AddField(
model_name='user',
name='who_is',
field=models.CharField(choices=[('ST', 'Student'), ('TE', 'Teacher')], default='TE', max_length=2),
),
]
| 26.967742 | 111 | 0.558612 | 86 | 836 | 5.290698 | 0.534884 | 0.118681 | 0.151648 | 0.178022 | 0.417582 | 0.417582 | 0.417582 | 0.417582 | 0.417582 | 0.417582 | 0 | 0.069204 | 0.308612 | 836 | 30 | 112 | 27.866667 | 0.717993 | 0.053828 | 0 | 0.5 | 1 | 0 | 0.100127 | 0.029151 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.041667 | 0 | 0.166667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
742d3fbfc2a61ebe63ed02c5ee887f5852fe24bd | 1,423 | py | Python | src/main.py | guildenstern70/pyfab | 34d786fec17192591ac3c5f73913a9b04311695a | [
"MIT"
] | null | null | null | src/main.py | guildenstern70/pyfab | 34d786fec17192591ac3c5f73913a9b04311695a | [
"MIT"
] | 7 | 2015-12-18T15:37:07.000Z | 2021-06-10T23:35:04.000Z | src/main.py | guildenstern70/pyfab | 34d786fec17192591ac3c5f73913a9b04311695a | [
"MIT"
] | null | null | null | """
FableMe.com
A LittleLite Web Application
(c) 2013-15
main.py
"""
import logging
import webapp2
import fableme.pages
import fableme.services
import fableme.printer
config = {'webapp2_extras.sessions': {
'secret_key': 'bludream',
}}
logging.getLogger().setLevel(logging.DEBUG)
APPLICATION = webapp2.WSGIApplication(
[('/', fableme.pages.Index),
('/myaccount', fableme.pages.MyAccount),
('/allfables', fableme.pages.AllFables),
('/book', fableme.pages.Book),
('/buy', fableme.pages.Buy),
('/changepassword', fableme.pages.ChangePassword),
('/contacts', fableme.pages.Contacts),
('/create', fableme.pages.Create),
('/deletefable', fableme.pages.DeleteFable),
('/editexisting', fableme.pages.EditExisting),
('/forgotpwd', fableme.pages.ForgotPassword),
('/howitworks', fableme.pages.HowItWorks),
('/howtoreadepub', fableme.pages.HowEPub),
('/likeit', fableme.services.LikeItHandler),
('/order', fableme.pages.Order),
('/preview', fableme.pages.Preview),
('/print', fableme.printer.Print),
('/register', fableme.pages.Register),
('/review', fableme.pages.Review),
('/serve/([^/]+)?', fableme.printer.ServeHandler),
('/thankyou', fableme.pages.ThankYouReg),
('/login', fableme.pages.Login),
('/logout', fableme.pages.Logout),
('/step', fableme.pages.Step)],
debug=True, config=config)
| 28.46 | 55 | 0.654252 | 138 | 1,423 | 6.731884 | 0.413043 | 0.284177 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007494 | 0.156008 | 1,423 | 49 | 56 | 29.040816 | 0.766028 | 0.04357 | 0 | 0 | 0 | 0 | 0.184191 | 0.017151 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.057143 | 0.142857 | 0 | 0.142857 | 0.085714 | 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 |
7437a443612ef9f8f48acf1ff072d21f86294f9b | 7,551 | py | Python | deepsim_btree/deepsim_btree/decorators/status_flippers.py | aws-deepracer/deepsim | cad2639f525c2f94ec5c03d8b855cc65b0b8ee55 | [
"Apache-2.0"
] | 1 | 2022-03-25T07:20:49.000Z | 2022-03-25T07:20:49.000Z | deepsim_btree/deepsim_btree/decorators/status_flippers.py | aws-deepracer/deepsim | cad2639f525c2f94ec5c03d8b855cc65b0b8ee55 | [
"Apache-2.0"
] | null | null | null | deepsim_btree/deepsim_btree/decorators/status_flippers.py | aws-deepracer/deepsim | cad2639f525c2f94ec5c03d8b855cc65b0b8ee55 | [
"Apache-2.0"
] | null | null | null | #################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# 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. #
#################################################################################
"""Classes for status flipper nodes."""
from deepsim_btree.decorators.decorator import Decorator
import deepsim_btree.constants as const
class Inverter(Decorator):
"""
Inverter behaviour class that returns inverted child status.
"""
def update(self) -> const.Status:
"""
Returns SUCCESS if child status is FAILURE,
returns FAILURE if child status is SUCCESS,
and returns RUNNING if child status is RUNNING
Returns:
const.Status: SUCCESS if child status is FAILURE,
FAILURE if child status is SUCCESS,
and RUNNING if child status is RUNNING
"""
if self.child.status == const.Status.SUCCESS:
self._feedback_message = "success -> failure"
return const.Status.FAILURE
elif self.child.status == const.Status.FAILURE:
self._feedback_message = "failure -> success"
return const.Status.SUCCESS
self._feedback_message = self.child.feedback_message
return self.child.status
class Succeeder(Decorator):
"""
Succeeder behaviour class that returns SUCCESS regardless of child finish status.
"""
def update(self) -> const.Status:
"""
Returns RUNNING if child is RUNNING, otherwise returns SUCCESS.
Returns:
const.Status: RUNNING if child is RUNNING, otherwise returns SUCCESS.
"""
if self.child.status != const.Status.RUNNING:
return const.Status.SUCCESS
return const.Status.RUNNING
class UntilFail(Decorator):
"""
UntilFail behaviour class that runs the child behaviour until fails.
"""
def update(self) -> const.Status:
"""
Returns SUCCESS when child status is FAILURE, otherwise returns RUNNING.
Returns:
const.Status: SUCCESS when child status is FAILURE, otherwise returns RUNNING.
"""
if self.child.status == const.Status.FAILURE:
return const.Status.SUCCESS
return const.Status.RUNNING
class RunningIsFailure(Decorator):
"""
RunningIsFailure behaviour class that returns FAILURE when child is RUNNING status.
"""
def update(self) -> const.Status:
"""
Returns FAILURE if child is RUNNING status, otherwise returns child status.
Returns:
const.Status: FAILURE if child is RUNNING status, otherwise returns child status.
"""
if self.child.status == const.Status.RUNNING:
self._feedback_message = "running is failure ({})".format(self.child.feedback_message)
return const.Status.FAILURE
else:
self._feedback_message = self.child.feedback_message
return self.child.status
class RunningIsSuccess(Decorator):
"""
RunningIsSuccess behaviour class that returns SUCCESS when child is RUNNING status.
"""
def update(self) -> const.Status:
"""
Returns SUCCESS if child is RUNNING status, otherwise returns child status.
Returns:
const.Status: SUCCESS if child is RUNNING status, otherwise returns child status.
"""
if self.child.status == const.Status.RUNNING:
self._feedback_message = "running is success ({})".format(self.child.feedback_message)
return const.Status.SUCCESS
else:
self._feedback_message = self.child.feedback_message
return self.child.status
class FailureIsSuccess(Decorator):
"""
FailureIsSuccess behaviour class that returns FAILURE when child is SUCCESS status.
"""
def update(self) -> const.Status:
"""
Returns FAILURE if child is SUCCESS status, otherwise returns child status.
Returns:
const.Status: FAILURE if child is SUCCESS status, otherwise returns child status.
"""
if self.child.status == const.Status.FAILURE:
self._feedback_message = "failure is success ({})".format(self.child.feedback_message)
return const.Status.SUCCESS
else:
self._feedback_message = self.child.feedback_message
return self.child.status
class FailureIsRunning(Decorator):
"""
FailureIsRunning behaviour class that returns RUNNING when child is FAILURE status.
"""
def update(self) -> const.Status:
"""
Returns RUNNING if child is FAILURE status, otherwise returns child status.
Returns:
const.Status: RUNNING if child is FAILURE status, otherwise returns child status.
"""
if self.child.status == const.Status.FAILURE:
self._feedback_message = "failure is running ({})".format(self.child.feedback_message)
return const.Status.RUNNING
else:
self._feedback_message = self.child.feedback_message
return self.child.status
class SuccessIsFailure(Decorator):
"""
SuccessIsFailure behaviour class that returns FAILURE when child is SUCCESS status.
"""
def update(self) -> const.Status:
"""
Returns FAILURE if child is SUCCESS status, otherwise returns child status.
Returns:
const.Status: FAILURE if child is SUCCESS status, otherwise returns child status.
"""
if self.child.status == const.Status.SUCCESS:
self._feedback_message = "success is failure ({})".format(self.child.feedback_message)
return const.Status.FAILURE
else:
self._feedback_message = self.child.feedback_message
return self.child.status
class SuccessIsRunning(Decorator):
"""
SuccessIsRunning behaviour class that returns RUNNING when child is SUCCESS status.
"""
def update(self) -> const.Status:
"""
Returns RUNNING if child is SUCCESS status, otherwise returns child status.
Returns:
const.Status: RUNNING if child is SUCCESS status, otherwise returns child status.
"""
if self.child.status == const.Status.SUCCESS:
self._feedback_message = "success is running ({})".format(self.child.feedback_message)
return const.Status.RUNNING
else:
self._feedback_message = self.child.feedback_message
return self.child.status
| 41.262295 | 98 | 0.604026 | 788 | 7,551 | 5.730964 | 0.145939 | 0.097431 | 0.056466 | 0.069088 | 0.758636 | 0.740478 | 0.71147 | 0.669398 | 0.628875 | 0.581488 | 0 | 0.000757 | 0.300622 | 7,551 | 182 | 99 | 41.489011 | 0.854384 | 0.44855 | 0 | 0.7 | 0 | 0 | 0.051071 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.128571 | false | 0 | 0.028571 | 0 | 0.557143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 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 |
743ac41952f00aaf089ef861bce645b18f8e24d0 | 3,755 | py | Python | src/test/tinc/tincrepo/mpp/models/test/sql_related/test_sql_performance_test_case.py | zhangh43/gpdb | 3e2d569b3d5faacdb5813f5a1d4f967607553498 | [
"PostgreSQL",
"Apache-2.0"
] | 1 | 2017-09-15T06:09:56.000Z | 2017-09-15T06:09:56.000Z | src/test/tinc/tincrepo/mpp/models/test/sql_related/test_sql_performance_test_case.py | guofengrichard/gpdb | 29bdd6ef38d8d9b9cb04ca31d44e279eb9f640d3 | [
"PostgreSQL",
"Apache-2.0"
] | null | null | null | src/test/tinc/tincrepo/mpp/models/test/sql_related/test_sql_performance_test_case.py | guofengrichard/gpdb | 29bdd6ef38d8d9b9cb04ca31d44e279eb9f640d3 | [
"PostgreSQL",
"Apache-2.0"
] | 1 | 2018-12-04T09:13:57.000Z | 2018-12-04T09:13:57.000Z | """
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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 datetime import datetime
import unittest2 as unittest
from tinctest import TINCTestLoader
from mpp.models import SQLPerformanceTestCase
@unittest.skip('mock')
class MockSQLPerformanceTestCase(SQLPerformanceTestCase):
"""
@description test case with metadata
@created 2012-07-05 12:00:00
@modified 2012-07-05 12:00:02
@tags orca hashagg performance
@repetitions 3
@threshold 10
"""
def setUp(self):
pass
def test_explicit_definition(self):
pass
class SQLPerformanceTestCaseTests(unittest.TestCase):
def test_infer_metadata(self):
test_loader = TINCTestLoader()
test_suite = test_loader.loadTestsFromTestCase(MockSQLPerformanceTestCase)
test_case = None
for case in test_suite._tests:
if case.name == "MockSQLPerformanceTestCase.test_query02":
test_case = case
self.assertNotEqual(test_case, None)
self.assertEqual(test_case.name, "MockSQLPerformanceTestCase.test_query02")
self.assertEqual(test_case.author, 'kumara64')
self.assertEqual(test_case.description, 'test sql test case')
self.assertEqual(test_case.created_datetime, datetime.strptime('2012-07-05 12:00:00', '%Y-%m-%d %H:%M:%S'))
self.assertEqual(test_case.modified_datetime, datetime.strptime('2012-07-08 12:00:02', '%Y-%m-%d %H:%M:%S'))
self.assertEqual(test_case.tags, set(['orca', 'hashagg', 'executor', 'performance']))
self.assertEqual(test_case.repetitions, 3)
self.assertEqual(test_case.threshold, 10)
def test_direct_instantiation(self):
test_case = MockSQLPerformanceTestCase('test_query02')
self.assertEqual(test_case.name, "MockSQLPerformanceTestCase.test_query02")
self.assertEqual(test_case.author, 'kumara64')
self.assertEqual(test_case.description, 'test sql test case')
self.assertEqual(test_case.created_datetime, datetime.strptime('2012-07-05 12:00:00', '%Y-%m-%d %H:%M:%S'))
self.assertEqual(test_case.modified_datetime, datetime.strptime('2012-07-08 12:00:02', '%Y-%m-%d %H:%M:%S'))
self.assertEqual(test_case.tags, set(['orca', 'hashagg', 'executor', 'performance']))
self.assertEqual(test_case.repetitions, 3)
self.assertEqual(test_case.threshold, 10)
def test_explicit_test_fixtures(self):
test_case = MockSQLPerformanceTestCase('test_explicit_definition')
self.assertEqual(test_case.name, "MockSQLPerformanceTestCase.test_explicit_definition")
self.assertEqual(test_case.author, 'balasr3')
self.assertEqual(test_case.description, 'test case with metadata')
self.assertEqual(test_case.created_datetime, datetime.strptime('2012-07-05 12:00:00', '%Y-%m-%d %H:%M:%S'))
self.assertEqual(test_case.modified_datetime, datetime.strptime('2012-07-05 12:00:02', '%Y-%m-%d %H:%M:%S'))
self.assertEqual(test_case.tags, set(['orca', 'hashagg', 'performance']))
self.assertEqual(test_case.repetitions, 3)
self.assertEqual(test_case.threshold, 10)
| 45.240964 | 116 | 0.717443 | 487 | 3,755 | 5.414784 | 0.293635 | 0.100114 | 0.172924 | 0.209329 | 0.573 | 0.526735 | 0.501706 | 0.486159 | 0.431551 | 0.431551 | 0 | 0.047985 | 0.16751 | 3,755 | 82 | 117 | 45.792683 | 0.795585 | 0.218642 | 0 | 0.446809 | 0 | 0 | 0.203884 | 0.066574 | 0 | 0 | 0 | 0 | 0.531915 | 1 | 0.106383 | false | 0.042553 | 0.085106 | 0 | 0.234043 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
743d90ef1afa334c60b1b438bbe1162a1328eb0b | 820 | py | Python | {{cookiecutter.project_slug}}/{{cookiecutter.module_name}}/config.py | Senth/python-template | 29b79fdfad4a664f7e473237209a8b78dedc9176 | [
"MIT"
] | null | null | null | {{cookiecutter.project_slug}}/{{cookiecutter.module_name}}/config.py | Senth/python-template | 29b79fdfad4a664f7e473237209a8b78dedc9176 | [
"MIT"
] | 4 | 2021-11-16T21:14:00.000Z | 2022-03-16T16:55:01.000Z | {{cookiecutter.project_slug}}/{{cookiecutter.module_name}}/config.py | Senth/python-template | 29b79fdfad4a664f7e473237209a8b78dedc9176 | [
"MIT"
] | null | null | null | from tealprint import TealLevel
from .utils.config_file_args import ConfigFileArgs
_app_name = "{{cookiecutter.project_slug}}"
class Config:
def __init__(self):
# Default values
self.app_name: str = _app_name
self.level = TealLevel.info
def set_from_cli(self, args):
"""Set additional configuration from script arguments
Args:
args (list): All the parsed arguments
"""
if args.debug:
self.level = TealLevel.debug
elif args.verbose:
self.level = TealLevel.verbose
{%- if cookiecutter.external_config == "y" -%}
def set_from_config_file(self, args: ConfigFileArgs) -> None:
# TODO set config arguments
# if args.port:
# self.port = args.port
{%- endif -%}
config = Config()
| 24.848485 | 65 | 0.621951 | 94 | 820 | 5.234043 | 0.457447 | 0.042683 | 0.109756 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.280488 | 820 | 32 | 66 | 25.625 | 0.833898 | 0.097561 | 0 | 0 | 0 | 0 | 0.049587 | 0.047934 | 0 | 0 | 0 | 0.03125 | 0 | 0 | null | null | 0 | 0.125 | null | null | 0.0625 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
744110d8242cb327d7eb1c2d3995646d72944dae | 844 | py | Python | addons/l10n_pe/__manifest__.py | jjiege/odoo | fd5b8ad387c1881f349d125cbd56433f4d49398f | [
"MIT"
] | null | null | null | addons/l10n_pe/__manifest__.py | jjiege/odoo | fd5b8ad387c1881f349d125cbd56433f4d49398f | [
"MIT"
] | null | null | null | addons/l10n_pe/__manifest__.py | jjiege/odoo | fd5b8ad387c1881f349d125cbd56433f4d49398f | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# Copyright (c) 2011 Cubic ERP - Teradata SAC. (http://cubicerp.com).
{
'name': 'Peru - Accounting',
'description': """
Peruvian accounting chart and tax localization. According the PCGE 2010.
========================================================================
Plan contable peruano e impuestos de acuerdo a disposiciones vigentes de la
SUNAT 2011 (PCGE 2010).
""",
'author': ['Cubic ERP'],
'category': 'Localization',
'depends': ['account'],
'data': [
'data/l10n_pe_chart_data.xml',
'data/account.account.template.csv',
'data/l10n_pe_chart_post_data.xml',
'data/account_data.xml',
'data/account_tax_data.xml',
'data/account_chart_template_data.xml',
],
}
| 30.142857 | 75 | 0.592417 | 96 | 844 | 5.072917 | 0.614583 | 0.071869 | 0.090349 | 0.147844 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030882 | 0.194313 | 844 | 27 | 76 | 31.259259 | 0.685294 | 0.191943 | 0 | 0 | 0 | 0 | 0.755162 | 0.362832 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
744512bbc378f0e6cf935152e3af2ff79cf9837f | 27,862 | py | Python | Language.py | JackTriton/OoT-Randomizer | 96c6117e7eb360248a754a220e9fcea214c464d7 | [
"MIT"
] | null | null | null | Language.py | JackTriton/OoT-Randomizer | 96c6117e7eb360248a754a220e9fcea214c464d7 | [
"MIT"
] | null | null | null | Language.py | JackTriton/OoT-Randomizer | 96c6117e7eb360248a754a220e9fcea214c464d7 | [
"MIT"
] | null | null | null | import importlib.util
import os
import ListE
from Utils import data_path as dataPath
def getLang(world, set, name=None):
if world.settings.language_selection == "extra":
Path = world.settings.lang_path
dan = os.path.join(Path, "ListX.py")
data = os.path.join(Path, "data")
get = importlib.util.spec_from_file_location("ListX", dan)
lang = importlib.util.module_from_spec(get)
get.loader.exec_module(lang)
if set == "items":
if name is None:
return lang.NEW_ITEMS_X
else:
return lang.NEW_ITEMS_X[name]
elif set == "navi":
if name is None:
return lang.NAVI_X
else:
return lang.NAVI_X[name]
elif set == "shop":
if name is None:
return lang.SHOP_X
else:
return lang.SHOP_X[name]
elif set == "misc":
if name is None:
return lang.MISC_X
else:
return lang.MISC_X[name]
elif set == "text":
if name is None:
return lang.textTableX
else:
return lang.textTableX[name]
elif set == "special":
if name is None:
return lang.specialTableX
else:
return lang.specialTableX[name]
elif set == "reward text":
if name is None:
return lang.reward_text_X
else:
return lang.reward_text_X[name]
elif set == "reward list":
if name is None:
return lang.reward_list_X
else:
return lang.reward_list_X[name]
elif set == "dungeon list":
if name is None:
return lang.dungeon_list_X
else:
return lang.dungeon_list_X[name]
elif set == "hint":
if name is None:
return lang.hintTableX
else:
return lang.hintTableX[name]
elif set == "trial":
if name is None:
return lang.trial_X
else:
return lang.trial_X[name]
elif set == "goal":
if name is None:
return lang.goalTableX
else:
return lang.goalTableX[name]
elif set == "return":
if name is None:
return lang.retX
else:
return lang.retX[name]
elif set == "data":
if name is None:
return data
else:
x = os.path.join(data, name)
return x
elif world.settings.language_selection != "extra":
lang = ListE
if set == "items":
if name is None:
return lang.NEW_ITEMS_X
else:
return lang.NEW_ITEMS_X[name]
elif set == "navi":
if name is None:
return lang.NAVI_X
else:
return lang.NAVI_X[name]
elif set == "shop":
if name is None:
return lang.SHOP_X
else:
return lang.SHOP_X[name]
elif set == "misc":
if name is None:
return lang.MISC_X
else:
return lang.MISC_X[name]
elif set == "text":
if name is None:
return lang.textTableX
else:
return lang.textTableX[name]
elif set == "special":
if name is None:
return lang.specialTableX
else:
return lang.specialTableX[name]
elif set == "reward text":
if name is None:
return lang.reward_text_X
else:
return lang.reward_text_X[name]
elif set == "reward list":
if name is None:
return lang.reward_list_X
else:
return lang.reward_list_X[name]
elif set == "dungeon list":
if name is None:
return lang.dungeon_list_X
else:
return lang.dungeon_list_X[name]
elif set == "hint":
if name is None:
return lang.hintTableX
else:
return lang.hintTableX[name]
elif set == "goal":
if name is None:
return lang.goalTableX
else:
return lang.goalTableX[name]
elif set == "trial":
if name is None:
return lang.trial_X
else:
return lang.trial_X[name]
elif set == "return":
if name is None:
return lang.retX
else:
return lang.retX[name]
elif set == "data":
if name is None:
return dataPath()
else:
return dataPath(name)
# DataName: AddressStart #AddressEnd
dataList = {
"title": 0x01795300, # 0x017AE300
"continue_JP": 0x00862000, # 0x00862980
"continue_EN": 0x00862980, # 0x00863300
"IDTTitle_JP": 0x00864000, # 0x00864600
"DDCTitle_JP": 0x00864600, # 0x00864C00
"JJBTitle_JP": 0x00864C00, # 0x00865200
"FoTTitle_JP": 0x00865200, # 0x00865800
"FiTTitle_JP": 0x00865800, # 0x00865E00
"WaTTitle_JP": 0x00865E00, # 0x00866400
"SpTTitle_JP": 0x00866400, # 0x00866A00
"ShTTitle_JP": 0x00866A00, # 0x00867000
"BoWTitle_JP": 0x00867000, # 0x00867600
"IcCTitle_JP": 0x00867600, # 0x00867C00
"To_Equip_JP": 0x00867C00, # 0x00867F80
"To_Decide_JP": 0x00867F80, # 0x00868380
"To_Play_M_JP": 0x00868380, # 0x00868880
"To_Select_I_JP": 0x00868880, # 0x00869080
"To_Map_JP": 0x00869080, # 0x00869880
"To_Quest_Stat_JP": 0x00869880, # 0x0086A080
"To_Equip_JP": 0x0086A080, # 0x0086A880
"Save_Text_JP": 0x0086A880, # 0x0086B200
"Saved_Text_JP": 0x0086B200, # 0x0086BB80
"Yes_JP": 0x0086BB80, # 0x0086BE80
"No_JP": 0x0086BE80, # 0x0086C180
"Cur_Pos_JP": 0x0086C180, # 0x0086C280
"Equip_1,0_JP": 0x0086C280, # 0x0086CC80
"Select_I_0,0_JP": 0x0086CC80, # 0x0086D680
"Select_I_1,0_JP": 0x0086D680, # 0x0086E080
"Select_I_2,0_JP": 0x0086E080, # 0x0086EA80
"Map_1,0_JP": 0x0086EA80, # 0x0086F480
"Quest_Stat_0,0_JP": 0x0086F480, # 0x0086FE80
"Quest_Status_1,0_JP": 0x0086FE80, # 0x00870880
"Quest_Status_2,0_JP": 0x00870880, # 0x00871280
"Save_1,0_JP": 0x00871280, # 0x00872000
"IDTTitle_EN": 0x00872000, # 0x00872600
"DDCTitle_EN": 0x00872600, # 0x00872C00
"JJBTitle_EN": 0x00873C00, # 0x00873200
"FoTTitle_EN": 0x00873200, # 0x00873800
"FiTTitle_EN": 0x00873800, # 0x00873E00
"WaTTitle_EN": 0x00873E00, # 0x00874400
"SpTTitle_EN": 0x00874400, # 0x00874A00
"ShTTitle_EN": 0x00874A00, # 0x00875000
"BoWTitle_EN": 0x00875000, # 0x00875600
"IcCTitle_EN": 0x00875600, # 0x00875C00
"To_Equip_EN": 0x00875C00, # 0x00875F80
"To_Decide_EN": 0x00875F80, # 0x00876380
"To_Play_M_EN": 0x00876380, # 0x00876880
"To_Select_I_EN": 0x00876880, # 0x00877080
"To_Map_EN": 0x00877080, # 0x00877880
"To_Quest_Stat_EN": 0x00877880, # 0x00878080
"To_Equip_EN": 0x00878080, # 0x00878880
"Save_Text_EN": 0x00878880, # 0x00879200
"Saved_Text_EN": 0x00879200, # 0x00879B80
"Yes_EN": 0x00879B80, # 0x00879E80
"No_EN": 0x00879E80, # 0x0087A180
"Cur_Pos_EN": 0x0087A180, # 0x0087A280
"Equip_1,0_EN": 0x0087A280, # 0x0087AC80
"Select_I_0,0_EN": 0x0087AC80, # 0x0087B680
"Select_I_1,0_EN": 0x0087B680, # 0x0087C080
"Select_I_2,0_EN": 0x0087C080, # 0x0087CA80
"Map_1,0_EN": 0x0087CA80, # 0x0087D480
"Quest_Stat_0,0_EN": 0x0087D480, # 0x0087DE80
"Quest_Status_1,0_EN": 0x0087DE80, # 0x0087E880
"Quest_Status_2,0_EN": 0x0087E880, # 0x0087F280
"Save_1,0_EN": 0x0087F280, # 0x00880000
"Stick_JP": 0x00880000, # 0x00880400
"Nut_JP": 0x00880400, # 0x00880800
"Bomb_JP": 0x00880800, # 0x00880C00
"Bow_JP": 0x00880C00, # 0x00881000
"Fire_Arrow_JP": 0x00881000, # 0x00881400
"Din_Fire_JP": 0x00881400, # 0x00881800
"Slingshot_JP": 0x00881800, # 0x00881C00
"FOcarina_JP": 0x00881C00, # 0x00882000
"TOcarina_JP": 0x00882000, # 0x00882400
"Bombchu_JP": 0x00882400, # 0x00882800
"Hookshot_JP": 0x00882800, # 0x00882C00
"Longshot_JP": 0x00882C00, # 0x00883000
"Ice_Arrow_JP": 0x00883000, # 0x00883400
"Farore_Wind_JP": 0x00883400, # 0x00883800
"Boomerang_JP": 0x00883800, # 0x00883C00
"LoTruth_JP": 0x00883C00, # 0x00884000
"Beans_JP": 0x00884000, # 0x00884400
"Hammer_JP": 0x00884400, # 0x00884800
"Light_Arrow_JP": 0x00884800, # 0x00884C00
"Nayru_Love_JP": 0x00884C00, # 0x00885000
"Bottle_JP": 0x00885000, # 0x00885400
"Red_Potion_JP": 0x00885400, # 0x00885800
"Green_Potion_JP": 0x00885800, # 0x00885C00
"Blue_Potion_JP": 0x00885C00, # 0x00886000
"Fairy_JP": 0x00886000, # 0x00886400
"Fish_JP": 0x00886400, # 0x00886800
"Milk_JP": 0x00886800, # 0x00886C00
"RLetter_JP": 0x00886C00, # 0x00887000
"Blue_Fire_JP": 0x00887000, # 0x00887400
"Bug_JP": 0x00887400, # 0x00887800
"B_Poe_JP": 0x00887800, # 0x00887C00
"Milk_H_JP": 0x00887C00, # 0x00888000
"Poe_JP": 0x00888000, # 0x00888400
"Weird_Egg_JP": 0x00888400, # 0x00888800
"Cucco_JP": 0x00888800, # 0x00888C00
"ZLetter_JP": 0x00888C00, # 0x00889000
"Keaton_JP": 0x00889000, # 0x00889400
"Skull_JP": 0x00889400, # 0x00889800
"Spook_JP": 0x00889800, # 0x00889C00
"Bunny_JP": 0x00889C00, # 0x0088A000
"Goron_JP": 0x0088A000, # 0x0088A400
"Zora_JP": 0x0088A400, # 0x0088A800
"Gerudo_JP": 0x0088A800, # 0x0088AC00
"MoTruth_JP": 0x0088AC00, # 0x0088B000
"SOLD_OUT_JP": 0x0088B000, # 0x0088B400
"Pocket_Egg_JP": 0x0088B400, # 0x0088B800
"Pocket_Cucco_JP": 0x0088B800, # 0x0088BC00
"Cojiro_JP": 0x0088BC00, # 0x0088C000
"Mushroom_JP": 0x0088C000, # 0x0088C400
"OPotion_JP": 0x0088C400, # 0x0088C800
"Saw_JP": 0x0088C800, # 0x0088CC00
"GoronSB_JP": 0x0088CC00, # 0x0088D000
"Prescription_JP": 0x0088D000, # 0x0088D400
"Frog_JP": 0x0088D400, # 0x0088D800
"Eye_Drop_JP": 0x0088D800, # 0x0088DC00
"Claim_JP": 0x0088DC00, # 0x0088EC00
"KSword_JP": 0x0088EC00, # 0x0088F000
"MSword_JP": 0x0088F000, # 0x0088F400
"BKnife_JP": 0x0088F400, # 0x0088F800
"DekuS_JP": 0x0088F800, # 0x0088FC00
"HylianS_JP": 0x0088FC00, # 0x00890000
"MirrorS_JP": 0x00890000, # 0x00890400
"KTunic_JP": 0x00890400, # 0x00890800
"GTunic_JP": 0x00890800, # 0x00890C00
"ZTunic_JP": 0x00890C00, # 0x00891000
"KBoots_JP": 0x00891000, # 0x00891400
"IBoots_JP": 0x00891400, # 0x00891800
"HBoots_JP": 0x00891800, # 0x00891C00
"BuBag30_JP": 0x00891C00, # 0x00892000
"BuBag40_JP": 0x00892000, # 0x00892400
"BuBag50_JP": 0x00892400, # 0x00892800
"Quiver30_JP": 0x00892800, # 0x00892C00
"Quiver40_JP": 0x00892C00, # 0x00893000
"Quiver50_JP": 0x00893000, # 0x00893400
"BombBag20_JP": 0x00893400, # 0x00893800
"BombBag30_JP": 0x00893800, # 0x00893C00
"BombBag40_JP": 0x00893C00, # 0x00894000
"GoronBracelet_JP": 0x00894000, # 0x00894400
"SilverGauntlets_JP": 0x00894400, # 0x00894800
"GoldenGauntlets_JP": 0x00894800, # 0x00894C00
"SilverScale_JP": 0x00894C00, # 0x00895000
"GoldenScale_JP": 0x00895000, # 0x00895400
"GiantsKnife B_JP": 0x00895400, # 0x00895800
"AdultsWallet_JP": 0x00895800, # 0x00895C00
"GiantsWallet_JP": 0x00895C00, # 0x00896000
"DekuSeeds_JP": 0x00896000, # 0x00896400
"FishPole_JP": 0x00896400, # 0x00896800
"MoF_JP": 0x00896800, # 0x00896C00
"BoF_JP": 0x00896C00, # 0x00897000
"SoW_JP": 0x00897000, # 0x00897400
"RoS_JP": 0x00897400, # 0x00897800
"NoS_JP": 0x00897800, # 0x00897C00
"PoL_JP": 0x00897C00, # 0x00898000
"ZeL_JP": 0x00898000, # 0x00898400
"EpS_JP": 0x00898400, # 0x00898800
"SaS_JP": 0x00898800, # 0x00898C00
"SunS_JP": 0x00898C00, # 0x00899000
"SoT_JP": 0x00899000, # 0x00899400
"SoS_JP": 0x00899400, # 0x00899800
"ForMedal_JP": 0x00899800, # 0x00899C00
"FirMedal_JP": 0x00899C00, # 0x0089A000
"WatMedal_JP": 0x0089A000, # 0x0089A400
"SpiMedal_JP": 0x0089A400, # 0x0089A800
"ShaMedal_JP": 0x0089A800, # 0x0089AC00
"LigMedal_JP": 0x0089AC00, # 0x0089B000
"Emerald_JP": 0x0089B000, # 0x0089B400
"Ruby_JP": 0x0089B400, # 0x0089B800
"Sapphire_JP": 0x0089B800, # 0x0089BC00
"Agony_JP": 0x0089BC00, # 0x0089C000
"Gerudo_Card_JP": 0x0089C000, # 0x0089C400
"GS_JP": 0x0089C400, # 0x0089C800
"HContainer_JP": 0x0089C800, # 0x0089D000
"Boss_Key_JP": 0x0089D000, # 0x0089D400
"Compass_JP": 0x0089D400, # 0x0089D800
"Dungeon_Map_JP": 0x0089D800, # 0x0089E800
"BSword_JP": 0x0089E800, # 0x0089EC00
"Stick_EN": 0x0089EC00, # 0x0089F000
"Nut_EN": 0x0089F000, # 0x0089F400
"Bomb_EN": 0x0089F400, # 0x0089F800
"Bow_EN": 0x0089F800, # 0x0089FC00
"Fire_Arrow_EN": 0x0089FC00, # 0x008A0000
"Din_Fire_EN": 0x008A0000, # 0x008A0400
"Slingshot_EN": 0x008A0400, # 0x008A0800
"FOcarina_EN": 0x008A0800, # 0x008A0C00
"TOcarina_EN": 0x008A0C00, # 0x008A1000
"Bombchu_EN": 0x008A1000, # 0x008A1400
"Hookshot_EN": 0x008A1400, # 0x008A1800
"Longshot_EN": 0x008A1800, # 0x008A1C00
"Ice_Arrow_EN": 0x008A1C00, # 0x008A2000
"Farore_Wind_EN": 0x008A2000, # 0x008A2400
"Boomerang_EN": 0x008A2400, # 0x008A2800
"LoTruth_EN": 0x008A2800, # 0x008A2C00
"Beans_EN": 0x008A2C00, # 0x008A3000
"Hammer_EN": 0x008A3000, # 0x008A3400
"Light_Arrow_EN": 0x008A3400, # 0x008A3800
"Nayru_Love_EN": 0x008A3800, # 0x008A3C00
"Bottle_EN": 0x008A3C00, # 0x008A4000
"Red_Potion_EN": 0x008A4000, # 0x008A4400
"Green_Potion_EN": 0x008A4400, # 0x008A4800
"Blue_Potion_EN": 0x008A4800, # 0x008A4C00
"Fairy_EN": 0x008A4C00, # 0x008A5000
"Fish_EN": 0x008A5000, # 0x008A5400
"Milk_EN": 0x008A5400, # 0x008A5800
"RLetter_EN": 0x008A5800, # 0x008A5C00
"Blue_Fire_EN": 0x008A5C00, # 0x008A6000
"Bug_EN": 0x008A6000, # 0x008A6400
"B_Poe_EN": 0x008A6400, # 0x008A6800
"Milk_H_EN": 0x008A6800, # 0x008A6C00
"Poe_EN": 0x008A6C00, # 0x008A7000
"Weird_Egg_EN": 0x008A7000, # 0x008A7400
"Cucco_EN": 0x008A7400, # 0x008A7800
"ZLetter_EN": 0x008A7800, # 0x008A7C00
"Keaton_EN": 0x008A7C00, # 0x008A8000
"Skull_EN": 0x008A8000, # 0x008A8400
"Spook_EN": 0x008A8400, # 0x008A8800
"Bunny_EN": 0x008A8800, # 0x008A8C00
"Goron_EN": 0x008A8C00, # 0x008A9000
"Zora_EN": 0x008A9000, # 0x008A9400
"Gerudo_EN": 0x008A9400, # 0x008A9800
"MoTruth_EN": 0x008A9800, # 0x008A9C00
"SOLD_OUT_EN": 0x008A9C00, # 0x008AA000
"Pocket_Egg_EN": 0x008AA000, # 0x008AA400
"Pocket_Cucco_EN": 0x008AA400, # 0x008AA800
"Cojiro_EN": 0x008AA800, # 0x008AAC00
"Mushroom_EN": 0x008AAC00, # 0x008AB000
"OPotion_EN": 0x008AB000, # 0x008AB400
"Saw_EN": 0x008AB400, # 0x008AB800
"GoronSB_EN": 0x008AB800, # 0x008ABC00
"Prescription_EN": 0x008ABC00, # 0x008AC000
"Frog_EN": 0x008AC000, # 0x008AC400
"Eye_Drop_EN": 0x008AC400, # 0x008AC800
"Claim_EN": 0x008AC800, # 0x008AD800
"KSword_EN": 0x008AD800, # 0x008ADC00
"MSword_EN": 0x008ADC00, # 0x008AE000
"BKnife_EN": 0x008AE000, # 0x008AE400
"DekuS_EN": 0x008AE400, # 0x008AE800
"HylianS_EN": 0x008AE800, # 0x008AEC00
"MirrorS_EN": 0x008AEC00, # 0x008AF000
"KTunic_EN": 0x008AF000, # 0x008AF400
"GTunic_EN": 0x008AF400, # 0x008AF800
"ZTunic_EN": 0x008AF800, # 0x008AFC00
"KBoots_EN": 0x008AFC00, # 0x008B0000
"IBoots_EN": 0x008B0000, # 0x008B0400
"HBoots_EN": 0x008B0400, # 0x008B0800
"BuBag30_EN": 0x008B0800, # 0x008B0C00
"BuBag40_EN": 0x008B0C00, # 0x008B1000
"BuBag50_EN": 0x008B1000, # 0x008B1400
"Quiver30_EN": 0x008B1400, # 0x008B1800
"Quiver40_EN": 0x008B1800, # 0x008B1C00
"Quiver50_EN": 0x008B1C00, # 0x008B2000
"BombBag20_EN": 0x008B2000, # 0x008B2400
"BombBag30_EN": 0x008B2400, # 0x008B2800
"BombBag40_EN": 0x008B2800, # 0x008B2C00
"GoronBracelet_EN": 0x008B2C00, # 0x008B3000
"SilverGauntlets_EN": 0x008B3000, # 0x008B3400
"GoldenGauntlets_EN": 0x008B3400, # 0x008B3800
"SilverScale_EN": 0x008B3800, # 0x008B3C00
"GoldenScale_EN": 0x008B3C00, # 0x008B4000
"GiantsKnife B_EN": 0x008B4000, # 0x008B4400
"AdultsWallet_EN": 0x008B4400, # 0x008B4800
"GiantsWallet_EN": 0x008B4800, # 0x008B4C00
"DekuSeeds_EN": 0x008B4C00, # 0x008B5000
"FishPole_EN": 0x008B5000, # 0x008B5400
"MoF_EN": 0x008B5400, # 0x008B5800
"BoF_EN": 0x008B5800, # 0x008B5C00
"SoW_EN": 0x008B5C00, # 0x008B6000
"RoS_EN": 0x008B6000, # 0x008B6400
"NoS_EN": 0x008B6400, # 0x008B6800
"PoL_EN": 0x008B6800, # 0x008B6C00
"ZeL_EN": 0x008B6C00, # 0x008B7000
"EpS_EN": 0x008B7000, # 0x008B7400
"SaS_EN": 0x008B7400, # 0x008B7800
"SunS_EN": 0x008B7800, # 0x008B7C00
"SoT_EN": 0x008B7C00, # 0x008B8000
"SoS_EN": 0x008B8000, # 0x008B8400
"ForMedal_EN": 0x008B8400, # 0x008B8800
"FirMedal_EN": 0x008B8800, # 0x008B8C00
"WatMedal_EN": 0x008B8C00, # 0x008B9000
"SpiMedal_EN": 0x008B9000, # 0x008B9400
"ShaMedal_EN": 0x008B9400, # 0x008B9800
"LigMedal_EN": 0x008B9800, # 0x008B9C00
"Emerald_EN": 0x008B9C00, # 0x008BA000
"Ruby_EN": 0x008BA000, # 0x008BA400
"Sapphire_EN": 0x008BA400, # 0x008BA800
"Agony_EN": 0x008BA800, # 0x008BAC00
"Gerudo_Card_EN": 0x008BAC00, # 0x008BB000
"GS_EN": 0x008BB000, # 0x008BB400
"HContainer_EN": 0x008BB400, # 0x008BBC00
"Boss_Key_EN": 0x008BBC00, # 0x008BC000
"Compass_EN": 0x008BC000, # 0x008BC400
"Dungeon_Map_EN": 0x008BC400, # 0x008BD400
"BSword_EN": 0x008BD400, # 0x008BD800
"Wasteland_JP": 0x008BE000, # 0x008BE400
"Fortress_JP": 0x008BE400, # 0x008BE800
"Valley_JP": 0x008BE800, # 0x008BEC00
"Lakeside_JP": 0x008BEC00, # 0x008BF000
"LLR_JP": 0x008BF000, # 0x008BF400
"Market_JP": 0x008BF400, # 0x008BF800
"Field_JP": 0x008BF800, # 0x008BFC00
"Mountain_JP": 0x008BFC00, # 0x008C0000
"Village_JP": 0x008C0000, # 0x008C0400
"Woods_JP": 0x008C0400, # 0x008C0800
"Forest_JP": 0x008C0800, # 0x008C0C00
"Domain_JP": 0x008C0C00, # 0x008C1000
"Wasteland_EN": 0x008C1000, # 0x008C1400
"Fortress_EN": 0x008C1400, # 0x008C1800
"Valley_EN": 0x008C1800, # 0x008C1C00
"Lakeside_EN": 0x008C1C00, # 0x008C2000
"LLR_EN": 0x008C2000, # 0x008C2400
"Market_EN": 0x008C2400, # 0x008C2800
"Field_EN": 0x008C2800, # 0x008C2C00
"Mountain_EN": 0x008C2C00, # 0x008C3000
"Village_EN": 0x008C3000, # 0x008C3400
"Woods_EN": 0x008C3400, # 0x008C3800
"Forest_EN": 0x008C3800, # 0x008C3C00
"Domain_EN": 0x008C3C00, # 0x008E0000
"Attack_JP": 0x008E0000, # 0x008E0180
"Check_JP": 0x008E0180, # 0x008E0300
"Enter_JP": 0x008E0300, # 0x008E0480
"Return_JP": 0x008E0480, # 0x008E0600
"Open_JP": 0x008E0600, # 0x008E0780
"Jump_JP": 0x008E0780, # 0x008E0900
"Decide_JP": 0x008E0900, # 0x008E0A80
"Dive_JP": 0x008E0A80, # 0x008E0C00
"Faster_JP": 0x008E0C00, # 0x008E0D80
"Throw_JP": 0x008E0D80, # 0x008E0F00
"Climb_JP": 0x008E1080, # 0x008E1200
"Drop_JP": 0x008E1200, # 0x008E1380
"Down_JP": 0x008E1380, # 0x008E1500
"Save_JP": 0x008E1500, # 0x008E1680
"Speak_JP": 0x008E1680, # 0x008E1800
"Next_JP": 0x008E1800, # 0x008E1980
"Grab_JP": 0x008E1980, # 0x008E1B00
"Stop_JP": 0x008E1B00, # 0x008E1C80
"PutAway_JP": 0x008E1C80, # 0x008E1E00
"Reel_JP": 0x008E1E00, # 0x008E1F80
"Attack_EN": 0x008E2B80, # 0x008E2D00
"Check_EN": 0x008E2D00, # 0x008E2E80
"Enter_EN": 0x008E2E80, # 0x008E3000
"Return_EN": 0x008E3000, # 0x008E3180
"Open_EN": 0x008E3180, # 0x008E3300
"Jump_EN": 0x008E3300, # 0x008E3480
"Decide_EN": 0x008E3480, # 0x008E3600
"Dive_EN": 0x008E3600, # 0x008E3780
"Faster_EN": 0x008E3780, # 0x008E3900
"Throw_EN": 0x008E3900, # 0x008E3A80
"Climb_EN": 0x008E3C00, # 0x008E3D80
"Drop_EN": 0x008E3D80, # 0x008E3F00
"Down_EN": 0x008E3F00, # 0x008E4080
"Save_EN": 0x008E4080, # 0x008E4200
"Speak_EN": 0x008E4200, # 0x008E4380
"Next_EN": 0x008E4380, # 0x008E4500
"Grab_EN": 0x008E4500, # 0x008E4680
"Stop_EN": 0x008E4680, # 0x008E4800
"PutAway_EN": 0x008E4800, # 0x008E4980
"Reel_EN": 0x008E4980, # 0x008E4B00
}
| 53.273423 | 78 | 0.474876 | 2,111 | 27,862 | 6.024159 | 0.290384 | 0.04089 | 0.017614 | 0.026421 | 0.153024 | 0.147519 | 0.147519 | 0.147519 | 0.147519 | 0.147519 | 0 | 0.377147 | 0.446235 | 27,862 | 522 | 79 | 53.375479 | 0.44708 | 0.145108 | 0 | 0.262548 | 0 | 0 | 0.167372 | 0 | 0 | 0 | 0.157429 | 0 | 0 | 1 | 0.001931 | false | 0.003861 | 0.011583 | 0 | 0.121622 | 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 |
745aa011019e99c64005e6d8a7bef7e4671d81c9 | 4,437 | py | Python | hackerrank/contests/30_days_of_code/operators-class-instance.py | spradeepv/dive-into-python | ec27d4686b7b007d21f9ba4f85d042be31ee2639 | [
"MIT"
] | null | null | null | hackerrank/contests/30_days_of_code/operators-class-instance.py | spradeepv/dive-into-python | ec27d4686b7b007d21f9ba4f85d042be31ee2639 | [
"MIT"
] | null | null | null | hackerrank/contests/30_days_of_code/operators-class-instance.py | spradeepv/dive-into-python | ec27d4686b7b007d21f9ba4f85d042be31ee2639 | [
"MIT"
] | null | null | null | """
Problem Statement
Welcome to Day 4! Check out a video review of logical operations here,
or just jump right into the problem.
Note: This task is focused on Object Oriented concepts, so it is only
enabled in a few languages.
You will create a class Person and write a constructor that takes an
integer, initial_Age. In this constructor, you should check that the
initial_Age is not negative because we can't have people with negative ages.
If the initial_Age is negative, set the instance's age equal to zero then print
"This person is not valid, setting age to 0."
without the quotations..
Inside of this class, you will also create an instance variable called age
and if initial_Age is not negative, then you will set age to equal the value
of initial_Age. In addition, you will write an instance method, amIOld(),
that prints whether people are old or not to the console.
In amIOld(), do the following things:
If the age of the Person instance is less than 13, then print "You are young."
If the age of the Person instance is equal or greater than 13, but less 18,
print "You are a teenager."
Otherwise, print "You are old."
In addition, create an instance function called yearPasses() that increases
the age of the person instance by one.
Much of the structure of the code is given to you below, but in the future,
you will write this. The code that will create instances of your Person
class is in the main function. You may not understand it all yet, but take a
look just to see what's going on. Do not change any of the variable names or
remove any of the code given.
Input Format
First line contains T, number of test cases. Each test case contains an
integer age, representing age of the person.
Constraints
1<=T<=4
-5<=age<=30
Output Format
The code that will test your methods is already in the editor. All you have
to do is edit the methods given to you in the editor so that they perform
correctly as stated above. If your methods are implemented correctly,
each testcase will print out either two or three lines.
If the age is less than zero, then your program should print out:
This person is not valid, setting age to 0.
You are young.
You are young.
If the age is equal or greater than 0, then your program should print out
two lines. The first line that the program prints out should be the output
of amIOld() on the current age. Then, three years pass via yearPasses() and
the second line the program prints should be the output of amIOld() after
the time has passed.
Sample Input
4
-1
10
16
18
Sample Output
This person is not valid, setting age to 0.
You are young.
You are young.
You are young.
You are a teenager.
You are a teenager.
You are old.
You are old.
You are old.
Explanation
For the first testcase, the age is less than 0 so we set the age to 0.Three
years pass and the age is 3. So we print out:
This person is not valid, setting age to 0.
You are young.
You are young.
For the second testcase, the age is 10, which is considered young according
to our program. Three years pass and the age is 13. 13 is considered a
'teenager' age so we print out:
You are young.
You are a teenager.
For the third testcase, the age is 16, which is the age of a teenager. Three
years pass and the age is 19. 19 is considered an 'old' age according to our
program so we print out:
You are a teenager.
You are old.
For the last testcase, the age is 18, which is considered an old age
according to our program. Three years pass and the age is 21. 21 is still
considered old so we print out:
You are old.
You are old.
"""
class Person:
def __init__(self, initial_Age):
# Add some more code to run some checks on initial_Age
if initial_Age < 0:
print "This person is not valid, setting age to 0."
self.initial_age = 0
self.age = initial_Age
def amIOld(self):
# Do some computations in here and print out the correct statement to
# the console
if self.age < 13:
print "You are young."
elif self.age >= 13 and self.age < 18:
print "You are a teenager."
else:
print "You are old."
def yearPasses(self):
# Increment the age of the person in here
self.age += 1
T = int(raw_input())
for i in range(0, T):
age = int(raw_input())
p = Person(age)
p.amIOld()
for j in range(0, 3):
p.yearPasses()
p.amIOld()
print ""
| 30.183673 | 79 | 0.725265 | 803 | 4,437 | 3.987547 | 0.254047 | 0.044972 | 0.034354 | 0.028107 | 0.31574 | 0.274204 | 0.193004 | 0.151468 | 0.128045 | 0.108994 | 0 | 0.017161 | 0.225152 | 4,437 | 146 | 80 | 30.390411 | 0.914194 | 0.038765 | 0 | 0.083333 | 0 | 0 | 0.126255 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.083333 | 0 | null | null | 0.208333 | 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 |
7470e7d36180fa6fd6be49f3010184f9001b3162 | 209 | py | Python | mabe/types.py | nebw/mabe | 2f8d4c4ad82202f614147791a9d1b5ab799fd86f | [
"MIT"
] | 4 | 2022-01-29T21:09:48.000Z | 2022-02-27T20:17:20.000Z | mabe/types.py | nebw/mabe | 2f8d4c4ad82202f614147791a9d1b5ab799fd86f | [
"MIT"
] | null | null | null | mabe/types.py | nebw/mabe | 2f8d4c4ad82202f614147791a9d1b5ab799fd86f | [
"MIT"
] | null | null | null | # dummy variables for flake8
# see: https://github.com/patrick-kidger/torchtyping/blob/master/FURTHER-DOCUMENTATION.md
batch = None
channels = None
time = None
behavior = None
annotator = None
classes = None
| 20.9 | 89 | 0.770335 | 28 | 209 | 5.75 | 0.821429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005495 | 0.129187 | 209 | 9 | 90 | 23.222222 | 0.879121 | 0.545455 | 0 | 0 | 0 | 0 | 0 | 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 |
7472e3be5412907fb220685c2a4cf95014e22f63 | 1,882 | py | Python | kinsumer/checkpointer.py | ungikim/kinsumer | 01bd9626d985bc3c239b979f0d98094f78cc102f | [
"MIT"
] | 5 | 2018-03-09T05:16:38.000Z | 2021-11-12T11:56:18.000Z | kinsumer/checkpointer.py | ungikim/kinsumer | 01bd9626d985bc3c239b979f0d98094f78cc102f | [
"MIT"
] | 2 | 2017-10-16T06:38:28.000Z | 2017-10-18T08:05:37.000Z | kinsumer/checkpointer.py | balancehero/kinsumer | 01bd9626d985bc3c239b979f0d98094f78cc102f | [
"MIT"
] | 1 | 2017-10-18T08:15:28.000Z | 2017-10-18T08:15:28.000Z | """:mod:`kinsumer.checkpointer` --- Persisting positions for Kinesis shards
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import abc
import json
import os.path
from typing import Optional, Dict
class Checkpointer(abc.ABC, object):
"""Checkpointer is the interface for persisting positions for Kinesis shards
"""
@abc.abstractmethod
def get_checkpoints(self) -> Dict[str, str]:
"""Get a dictionary whose keys are all the shard ids we are aware of,
and whose values are the sequence id of the last record processed for
its shard
"""
@abc.abstractmethod
def checkpoint(self, shard_id: str, sequence: str) -> None:
"""Persist the sequence number for a given shard"""
@abc.abstractmethod
def get_checkpoint(self, shard_id: str) -> Optional[str]:
"""Get the sequence number of the last successfully processed record"""
class InMemoryCheckpointer(Checkpointer):
def __init__(self) -> None:
self._checkpoints = {}
def get_checkpoints(self) -> Dict[str, str]:
return self._checkpoints.copy()
def checkpoint(self, shard_id: str, sequence: str) -> None:
self._checkpoints[shard_id] = sequence
def get_checkpoint(self, shard_id: str) -> Optional[str]:
return self._checkpoints.get(shard_id)
class FileCheckpointer(InMemoryCheckpointer):
def __init__(self, file: str) -> None:
super().__init__()
self.file = os.path.expanduser(file)
if os.path.exists(self.file):
with open(self.file, 'rb') as f:
self._checkpoints = json.load(f)
def checkpoint(self, shard_id: str, sequence: str) -> None:
super().checkpoint(shard_id, sequence)
with open(self.file, 'wb') as f:
f.write(json.dumps(self._checkpoints, ensure_ascii=False).encode())
| 31.898305 | 80 | 0.635494 | 228 | 1,882 | 5.109649 | 0.333333 | 0.048069 | 0.081545 | 0.090129 | 0.291845 | 0.23176 | 0.23176 | 0.178541 | 0.178541 | 0 | 0 | 0 | 0.217853 | 1,882 | 58 | 81 | 32.448276 | 0.79144 | 0.258767 | 0 | 0.322581 | 0 | 0 | 0.002983 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.290323 | false | 0 | 0.129032 | 0.064516 | 0.580645 | 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 |
7480403d4a70c4c4cd355fbd33b2191d73207ff8 | 454 | py | Python | omegaup/__init__.py | frcepeda/libomegaup | d474aea1ea6dbba970bf53d74a2244c405991636 | [
"BSD-3-Clause"
] | 1 | 2021-03-23T20:00:23.000Z | 2021-03-23T20:00:23.000Z | omegaup/__init__.py | frcepeda/libomegaup | d474aea1ea6dbba970bf53d74a2244c405991636 | [
"BSD-3-Clause"
] | 3 | 2021-10-15T04:06:58.000Z | 2022-01-15T22:35:34.000Z | omegaup/__init__.py | omegaup/libomegaup | 6dcbfbf319eef68d79da0d5b60225012dbd66388 | [
"BSD-3-Clause"
] | null | null | null | """A library to help interacting with omegaUp.
This is composed of two modules:
- [**`omegaup.api`**](./omegaup/api/) helps interacting with [omegaUp's
API](https://github.com/omegaup/omegaup/blob/master/frontend/server/src/Controllers/README.md)
and is auto-generated with correct types and the docstrings straight from the
code.
- [**`omegaup.validator`**](./omegaup/validator/) has runtime helper functions
to aid in problem validation.
"""
| 37.833333 | 96 | 0.742291 | 63 | 454 | 5.349206 | 0.730159 | 0.089021 | 0.130564 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121145 | 454 | 11 | 97 | 41.272727 | 0.844612 | 0.982379 | 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 |
7481464d3931fb0d0168505808f1f3b439c78924 | 474 | py | Python | general/myforms/login.py | zmb4973992/pangu | c79abf2f52dfc8cbb1420e88a555f19d3b903c77 | [
"Apache-2.0"
] | null | null | null | general/myforms/login.py | zmb4973992/pangu | c79abf2f52dfc8cbb1420e88a555f19d3b903c77 | [
"Apache-2.0"
] | null | null | null | general/myforms/login.py | zmb4973992/pangu | c79abf2f52dfc8cbb1420e88a555f19d3b903c77 | [
"Apache-2.0"
] | null | null | null | from django import forms
def validator1():
return True
class LoginForm(forms.Form):
username = forms.CharField(max_length=15, min_length=3, label='用户名',
error_messages={'required': '需要填写用户名', 'min_length': '太短了!'},
widget=forms.widgets.TextInput(attrs={'class': 'form-control'}))
password = forms.CharField(max_length=100, label='密码', widget=forms.PasswordInput(attrs={'class': 'form-control'}))
| 36.461538 | 119 | 0.626582 | 53 | 474 | 5.509434 | 0.641509 | 0.09589 | 0.116438 | 0.157534 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01897 | 0.221519 | 474 | 12 | 120 | 39.5 | 0.772358 | 0 | 0 | 0 | 0 | 0 | 0.14346 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0.125 | 0.125 | 0.125 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 2 |
74878f8e5a96b6a46e01a83165fed1aeb3c45257 | 496 | py | Python | core/helpers/circle.py | echim/pySteps | c33ac3446593b545aece475062d140527dcb443c | [
"MIT"
] | 8 | 2018-05-15T21:20:40.000Z | 2021-08-19T00:25:18.000Z | core/helpers/circle.py | echim/pySteps | c33ac3446593b545aece475062d140527dcb443c | [
"MIT"
] | null | null | null | core/helpers/circle.py | echim/pySteps | c33ac3446593b545aece475062d140527dcb443c | [
"MIT"
] | 2 | 2018-09-12T01:33:54.000Z | 2021-01-25T02:21:58.000Z | from core.helpers.point import Point
class Circle:
def __init__(self, center: Point, radius: int):
self._center: Point = center
self._radius: int = radius
@property
def center(self):
return self._center
@center.setter
def center(self, new_center: Point):
self._center = new_center
@property
def radius(self):
return self._radius
@radius.setter
def radius(self, new_radius: int):
self._radius = new_radius
| 19.84 | 51 | 0.635081 | 61 | 496 | 4.934426 | 0.278689 | 0.13289 | 0.099668 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.27621 | 496 | 24 | 52 | 20.666667 | 0.83844 | 0 | 0 | 0.117647 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.294118 | false | 0 | 0.058824 | 0.117647 | 0.529412 | 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 |
74a2cf3e0aa4d146fc1712d9ae135a0f9fab0e9a | 745 | py | Python | trinity/db/base.py | jestersimpps/py-evm | 6135904fb27b322619559e7637be40014ae254ac | [
"MIT"
] | 2 | 2018-05-03T03:02:36.000Z | 2018-05-03T03:02:39.000Z | trinity/db/base.py | jestersimpps/py-evm | 6135904fb27b322619559e7637be40014ae254ac | [
"MIT"
] | 4 | 2018-12-07T21:32:48.000Z | 2019-02-22T15:25:01.000Z | trinity/db/base.py | jestersimpps/py-evm | 6135904fb27b322619559e7637be40014ae254ac | [
"MIT"
] | null | null | null | # Typeshed definitions for multiprocessing.managers is incomplete, so ignore them for now:
# https://github.com/python/typeshed/blob/85a788dbcaa5e9e9a62e55f15d44530cd28ba830/stdlib/3/multiprocessing/managers.pyi#L3
from multiprocessing.managers import ( # type: ignore
BaseProxy,
)
class DBProxy(BaseProxy):
_exposed_ = (
'get',
'set',
'delete',
'exists',
)
def __getitem__(self, key):
return self._callmethod('get', (key,))
def __setitem__(self, key, value):
return self._callmethod('set', (key, value))
def __delitem__(self, key):
return self._callmethod('delete', (key,))
def __contains__(self, key):
return self._callmethod('exists', (key,))
| 27.592593 | 123 | 0.65906 | 78 | 745 | 6.012821 | 0.538462 | 0.059701 | 0.170576 | 0.108742 | 0.172708 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044293 | 0.212081 | 745 | 26 | 124 | 28.653846 | 0.754685 | 0.297987 | 0 | 0 | 0 | 0 | 0.069498 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.055556 | 0.222222 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
74a6a58978766529303c8597cb6ec864fa482020 | 728 | py | Python | test_environment.py | mpff/hpa-single-cell-classification | 30521ff5e755fb4a02b17ff4bdd5451574dd7ef1 | [
"BSD-3-Clause"
] | null | null | null | test_environment.py | mpff/hpa-single-cell-classification | 30521ff5e755fb4a02b17ff4bdd5451574dd7ef1 | [
"BSD-3-Clause"
] | null | null | null | test_environment.py | mpff/hpa-single-cell-classification | 30521ff5e755fb4a02b17ff4bdd5451574dd7ef1 | [
"BSD-3-Clause"
] | null | null | null | import sys
REQUIRED_PYTHON = 3
REQUIRED_PYTHON_MINOR = 8
def main():
system_major = sys.version_info.major
system_minor = sys.version_info.minor
if system_major != REQUIRED_PYTHON:
raise TypeError(
"This project requires Python {}. Found: Python {}".format(
REQUIRED_PYTHON, sys.version))
else:
if system_minor < REQUIRED_PYTHON_MINOR:
raise TypeError(
"This project requires at least Python {}.{}. Found: Python {}.{}".format(
REQUIRED_PYTHON, REQUIRED_PYTHON_MINOR, system_major, system_minor))
else:
print(">>> Development environment passes all tests!")
if __name__ == '__main__':
main() | 30.333333 | 90 | 0.627747 | 79 | 728 | 5.455696 | 0.392405 | 0.227378 | 0.132251 | 0.116009 | 0.324826 | 0.171694 | 0 | 0 | 0 | 0 | 0 | 0.003795 | 0.276099 | 728 | 24 | 91 | 30.333333 | 0.814042 | 0 | 0 | 0.210526 | 0 | 0 | 0.227709 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | false | 0.052632 | 0.052632 | 0 | 0.105263 | 0.052632 | 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 |
74a70857b5314f38979b83748aea7372a73753b8 | 1,815 | py | Python | flexneuart/models/base_bert.py | gitter-badger/FlexNeuART | f69e5421bdebe9db0d993b5470dace61872f90df | [
"Apache-2.0"
] | 101 | 2020-08-06T07:06:00.000Z | 2022-03-02T15:25:59.000Z | flexneuart/models/base_bert.py | gitter-badger/FlexNeuART | f69e5421bdebe9db0d993b5470dace61872f90df | [
"Apache-2.0"
] | 9 | 2020-11-05T23:17:06.000Z | 2021-08-21T06:07:30.000Z | flexneuart/models/base_bert.py | gitter-badger/FlexNeuART | f69e5421bdebe9db0d993b5470dace61872f90df | [
"Apache-2.0"
] | 17 | 2020-09-09T22:08:03.000Z | 2022-03-25T09:50:30.000Z | #
# This code is a modified version of CEDR: https://github.com/Georgetown-IR-Lab/cedr
#
# (c) Georgetown IR lab & Carnegie Mellon University
#
# It's distributed under the MIT License
# MIT License is compatible with Apache 2 license for the code in this repo.
#
from flexneuart.models.base import BaseModel
from flexneuart.models.utils import init_model, BERT_ATTR
USE_BATCH_COEFF = True
DEFAULT_BERT_DROPOUT = 0.1
class BertBaseRanker(BaseModel):
"""
The base class for all Transformer-based ranking models.
We generally/broadly consider these models to be BERT-variants, hence, the name of the base class.
"""
def __init__(self, bert_flavor):
"""Bert ranker constructor.
:param bert_flavor: the name of the underlying Transformer/BERT. Various
Transformer models are possible as long as they return
the object BaseModelOutputWithPoolingAndCrossAttentions.
"""
super().__init__()
init_model(self, bert_flavor)
def bert_param_names(self):
"""
:return: a list of the main BERT-parameters. Because we assigned the main BERT model
to an attribute with the name BERT_ATTR, all parameter keys must start with this
value followed by a dot.
"""
return set([k for k in self.state_dict().keys() if k.startswith( f'{BERT_ATTR}.')])
def tokenize_and_encode(self, text):
"""Tokenizes the text and converts tokens to respective IDs
:param text: input text
:return: an array of token IDs
"""
toks = self.tokenizer.tokenize(text)
return self.tokenizer.convert_tokens_to_ids(toks)
def forward(self, **inputs):
raise NotImplementedError
| 33 | 105 | 0.6573 | 234 | 1,815 | 4.978632 | 0.538462 | 0.020601 | 0.025751 | 0.020601 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002264 | 0.269972 | 1,815 | 54 | 106 | 33.611111 | 0.876981 | 0.545455 | 0 | 0 | 0 | 0 | 0.01791 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0.133333 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
7766e6a9db9ccea0a652f48ee3210202ad309fc9 | 447 | py | Python | plumeria/core/echo.py | sk89q/plumeria | 601adffedc745ae7ecc32824e119789a51eaf237 | [
"MIT"
] | 18 | 2018-06-23T13:52:49.000Z | 2021-09-12T09:36:40.000Z | plumeria/core/echo.py | Tominous/plumeria | 601adffedc745ae7ecc32824e119789a51eaf237 | [
"MIT"
] | 2 | 2018-02-03T16:21:06.000Z | 2020-02-24T22:31:16.000Z | plumeria/core/echo.py | Tominous/plumeria | 601adffedc745ae7ecc32824e119789a51eaf237 | [
"MIT"
] | 2 | 2019-05-30T13:19:56.000Z | 2019-12-10T02:30:56.000Z | """Add an echo/say command that prints out text."""
from plumeria.command import commands
from plumeria.message import Response
@commands.create('echo', 'say', cost=0.2, category="Utility")
async def echo(message):
"""
Simply returns the input string.
Can be used to create an alias::
/alias website echo Our website is http://example.com
"""
return Response(message.content)
def setup():
commands.add(echo)
| 21.285714 | 61 | 0.686801 | 62 | 447 | 4.951613 | 0.677419 | 0.045603 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005571 | 0.196868 | 447 | 20 | 62 | 22.35 | 0.849582 | 0.100671 | 0 | 0 | 0 | 0 | 0.05668 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | true | 0 | 0.285714 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
7774f9a3c078105bf746377e6eaf8333fad1036d | 1,896 | py | Python | prorateapp/models.py | mangowilliam/prorate | 6330df7c6383efad97b36829f3c620f07f9233a7 | [
"MIT"
] | null | null | null | prorateapp/models.py | mangowilliam/prorate | 6330df7c6383efad97b36829f3c620f07f9233a7 | [
"MIT"
] | 4 | 2020-06-05T22:14:41.000Z | 2021-06-10T21:47:44.000Z | prorateapp/models.py | mangowilliam/prorate | 6330df7c6383efad97b36829f3c620f07f9233a7 | [
"MIT"
] | null | null | null | from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Profile(models.Model):
image = models.ImageField(default = 'default.jpg',upload_to='images/')
bio = models.CharField(max_length=150)
email = models.EmailField()
phone_number = models.CharField(max_length = 10)
user = models.OneToOneField(User, on_delete=models.CASCADE,blank=True, related_name='profile')
def __str__(self):
return self.user.username
class Meta:
ordering =['bio']
def save_profile(self):
self.save()
def update_profile(self):
self.update()
def delete_profile(self):
self.delete()
class Project(models.Model):
title = models.CharField(max_length =30)
image = models.ImageField(default = 'default.jpg',upload_to='images/')
description = models.CharField(max_length =200)
link = models.URLField(blank=True, null=True)
ratings = models.IntegerField(blank=True, null=True)
profile = models.ForeignKey(User, on_delete=models.CASCADE)
pub_date = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.title
class Meta:
ordering =['pub_date']
def save_project(self):
self.save()
def delete_project(self):
self.delete()
@classmethod
def get_projects(cls):
projects = cls.objects.all()
return projects
@classmethod
def search_project(cls, repos):
project = cls.objects.filter(title__icontains=repos)
return project
@classmethod
def filter_by_user_id(cls,user_id):
projects = Project.objects.filter(profile=user_id)
return projects
@classmethod
def filter_by_title(cls,title):
projectd = Project.objects.filter(project=title)
return projectd
| 27.478261 | 99 | 0.655591 | 224 | 1,896 | 5.379464 | 0.348214 | 0.033195 | 0.059751 | 0.079668 | 0.160996 | 0.086307 | 0.086307 | 0.086307 | 0.086307 | 0 | 0 | 0.006949 | 0.241034 | 1,896 | 69 | 100 | 27.478261 | 0.830438 | 0.012658 | 0 | 0.32 | 0 | 0 | 0.028862 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.22 | false | 0 | 0.04 | 0.04 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
777afc4cbe507623d0887e259c5b027dfd0f3f4d | 497 | py | Python | util/logger.py | christian-stockinger/UnityBuilder | d1a893eeb561c49475f3b2a0bde21c6d6b468153 | [
"MIT"
] | 4 | 2019-10-10T05:50:04.000Z | 2022-02-08T06:26:14.000Z | util/logger.py | christian-stockinger/UnityBuilder | d1a893eeb561c49475f3b2a0bde21c6d6b468153 | [
"MIT"
] | 2 | 2018-11-21T12:52:41.000Z | 2018-11-21T12:55:46.000Z | util/logger.py | christian-stockinger/UnityBuilder | d1a893eeb561c49475f3b2a0bde21c6d6b468153 | [
"MIT"
] | 3 | 2019-05-29T14:03:31.000Z | 2022-02-08T06:26:18.000Z | from datetime import datetime
class Logger(object):
def __init__(self, no_timer):
self._no_Timer = no_timer
def log(self, level, msg):
if self._no_Timer:
print("[" + level + "] " + msg.rstrip())
else:
print(str(datetime.now()) + " [" + level + "] " + msg.rstrip())
def warn(self, msg):
self.log("Warning", msg)
def error(self, msg):
self.log("Error", msg)
def info(self,msg):
self.log("Info", msg)
| 21.608696 | 75 | 0.533199 | 62 | 497 | 4.112903 | 0.387097 | 0.109804 | 0.129412 | 0.164706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.303823 | 497 | 22 | 76 | 22.590909 | 0.736994 | 0 | 0 | 0 | 0 | 0 | 0.046278 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.066667 | 0 | 0.466667 | 0.133333 | 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 |
77824153b05ae1dfcb9fb4e45f66c53c7f2809ff | 319 | py | Python | src/266B.py | viing937/codeforces | d694eb6967cd56af02963c3a662066048cb78d07 | [
"MIT"
] | 2 | 2016-08-19T09:47:03.000Z | 2016-10-01T10:15:03.000Z | src/266B.py | viing937/codeforces | d694eb6967cd56af02963c3a662066048cb78d07 | [
"MIT"
] | null | null | null | src/266B.py | viing937/codeforces | d694eb6967cd56af02963c3a662066048cb78d07 | [
"MIT"
] | 1 | 2015-07-01T23:57:32.000Z | 2015-07-01T23:57:32.000Z | # coding: utf-8
n, t = [int(i) for i in input().split()]
queue = list(input())
for i in range(t):
queue_new = list(queue)
for j in range(n-1):
if queue[j]=='B' and queue[j+1]=='G':
queue_new[j], queue_new[j+1] = queue_new[j+1], queue_new[j]
queue = list(queue_new)
print(''.join(queue))
| 29 | 71 | 0.573668 | 60 | 319 | 2.95 | 0.383333 | 0.271186 | 0.20339 | 0.158192 | 0.163842 | 0.163842 | 0.163842 | 0 | 0 | 0 | 0 | 0.02008 | 0.219436 | 319 | 10 | 72 | 31.9 | 0.690763 | 0.040752 | 0 | 0 | 0 | 0 | 0.006579 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.111111 | 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 |
779a20c899c6d8573620935c4779262550e546ab | 331 | py | Python | Alignment.py | shendi-project/shendi | 30a1c0dd29f123269a5fb31caccaf113a94f6ddf | [
"MIT"
] | 3 | 2020-09-02T16:57:16.000Z | 2021-08-22T06:23:39.000Z | Alignment.py | shendi-project/shendi | 30a1c0dd29f123269a5fb31caccaf113a94f6ddf | [
"MIT"
] | 29 | 2020-09-13T13:34:16.000Z | 2020-09-22T11:42:06.000Z | Alignment.py | shendi-project/shendi | 30a1c0dd29f123269a5fb31caccaf113a94f6ddf | [
"MIT"
] | null | null | null | import enum
from enum import Enum
class Alignment(Enum):
LawfulGood = enum.auto()
NeutralGood = enum.auto()
ChaoticGood = enum.auto()
LawfulNeutral = enum.auto()
TrueNeutral = enum.auto()
ChaoticNeutral = enum.auto()
LawfulEvil = enum.auto()
NeutralEvil = enum.auto()
ChaoticEvil = enum.auto()
| 23.642857 | 32 | 0.664653 | 36 | 331 | 6.111111 | 0.416667 | 0.327273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.217523 | 331 | 13 | 33 | 25.461538 | 0.849421 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 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 |
779a6eb291cffba58deaca47677b2888a42f771d | 528 | py | Python | pymctdh/units.py | addschile/pymctdh | 20a93ce543526de1919757defceef16f9005f423 | [
"MIT"
] | null | null | null | pymctdh/units.py | addschile/pymctdh | 20a93ce543526de1919757defceef16f9005f423 | [
"MIT"
] | null | null | null | pymctdh/units.py | addschile/pymctdh | 20a93ce543526de1919757defceef16f9005f423 | [
"MIT"
] | null | null | null | ### global constants ###
hbar = None
### dictionary for hbar ###
hbars = {'ev': 0.658229,
'cm': 5308.8,
'au': 1.0
}
### energy units ###
conv = {'ev': 0.0367493,
'cm': 4.556e-6,
'au': 1.0,
'fs': 41.3413745758,
'ps': 41.3413745758*1000.}
### mass units ###
me2au = 0.00054858 # amu/m_e
### distance units ###
ang2bohr = 1.88973 # bohr/ang
def convert_to(unit):
"""
"""
return conv[unit]
def convert_from(unit):
"""
"""
return 1./conv[unit]
| 16 | 34 | 0.496212 | 67 | 528 | 3.865672 | 0.656716 | 0.023166 | 0.030888 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.201613 | 0.295455 | 528 | 32 | 35 | 16.5 | 0.494624 | 0.183712 | 0 | 0 | 0 | 0 | 0.042667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0 | 0 | 0.25 | 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 |
77b63c26cef9764c8310b4181c951d959ff4f2c6 | 79 | py | Python | napps/kytos/of_topology/constants.py | cemsbr/legacy | 88fe3764d160e638bb9875c00d10821d5ef25f82 | [
"MIT"
] | 2 | 2017-05-11T18:18:43.000Z | 2017-07-30T20:54:06.000Z | napps/kytos/of_topology/constants.py | cemsbr/legacy | 88fe3764d160e638bb9875c00d10821d5ef25f82 | [
"MIT"
] | 87 | 2016-08-30T15:09:26.000Z | 2017-02-24T17:19:57.000Z | napps/kytos/of_topology/constants.py | cemsbr/legacy | 88fe3764d160e638bb9875c00d10821d5ef25f82 | [
"MIT"
] | 9 | 2017-03-03T19:11:12.000Z | 2017-08-09T14:26:50.000Z | """Constants for the of_topology NApp."""
# Ether type
LLDP_ETHERTYPE = 0x88cc
| 19.75 | 41 | 0.746835 | 11 | 79 | 5.181818 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044118 | 0.139241 | 79 | 3 | 42 | 26.333333 | 0.794118 | 0.594937 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.230769 | 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 |
77d8985f6e1a7675bf179a2a1f02597854a72f50 | 5,386 | py | Python | Dependencies/Core3D/Preprocessing/generatePathFromObj.py | yangzhengxing/LibVT | 464397d9e2c655f72ad59cd1166b14e29e1bad3a | [
"MIT"
] | 89 | 2015-12-11T12:05:02.000Z | 2022-03-10T15:07:05.000Z | Dependencies/Core3D/Preprocessing/generatePathFromObj.py | yangzhengxing/LibVT | 464397d9e2c655f72ad59cd1166b14e29e1bad3a | [
"MIT"
] | 1 | 2021-12-20T09:11:22.000Z | 2022-01-14T11:10:23.000Z | Dependencies/Core3D/Preprocessing/generatePathFromObj.py | yangzhengxing/LibVT | 464397d9e2c655f72ad59cd1166b14e29e1bad3a | [
"MIT"
] | 16 | 2017-10-29T12:11:33.000Z | 2022-03-14T04:07:13.000Z | #!/usr/bin/env python
#
# generatePathFromObj.py
# Core3D
#
# Created by Julian Mayer on 16.12.07.
# Copyright (c) 2010 A. Julian Mayer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitationthe rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import sys, random
from struct import *
from vecmath import *
try:
from numpy import *
from scipy.interpolate import splprep, splev
except:
print "Error: NumPy or SkiPy not found"
sys.exit()
x = []
y = []
z = []
SCALE = 1.0
numberOfPoints = 3600
pointsPerUnit = 0
splineOrder = 2
smoothnessParameter = 3.0
try:
if (len(sys.argv)) == 1: raise Exception('input', 'error')
f = open(sys.argv[len(sys.argv) - 1], 'r')
of = 0
for i in range(1, len(sys.argv) - 1):
if sys.argv[i].startswith("-p="): smoothnessParameter = float(sys.argv[i][3:])
elif sys.argv[i].startswith("-i="): splineOrder = int(sys.argv[i][3:])
elif sys.argv[i].startswith("-s="): SCALE = float(sys.argv[i][3:])
elif sys.argv[i].startswith("-f="): numberOfPoints = int(sys.argv[i][3:])
elif sys.argv[i].startswith("-u="): pointsPerUnit = float(sys.argv[i][3:])
elif sys.argv[i].startswith("-o="): of = open(sys.argv[i][3:], 'w')
else: raise Exception('input', 'error')
if of == 0: of = open(sys.argv[len(sys.argv) - 1][:sys.argv[len(sys.argv) - 1].rfind(".")] + ".path", 'w')
except:
print """Usage: generateInterpolatedPathFromObj [options] obj_file
Options:
-s=<scale> Scale all coordinates by <scale>
-p=<smoothness> Use <smoothness> as smoothness parameter (Default: 3.0)
-i=<spline_order> Use interpolation of order <spline_order> (Default: 2)
-f=<num_points> Produce <num_points> points (Default: 3600)
-u=<points_per_unit> Produce <points_per_unit> points per unit of path length
-o=<path_file> Place the output path into <path_file>"""
sys.exit()
lines = f.readlines()
for line in lines:
c = line.split(" ")
if c[0] == "v":
x.append(SCALE * float(c[1]))
y.append(SCALE * float(c[2]))
z.append(SCALE * float(c[3]))
x.append(x[0])
y.append(y[0])
z.append(z[0])
if pointsPerUnit != 0:
distance = 0
for i in range(len(x)-1):
prevvec = [x[i], y[i], z[i]]
vec = [x[i+1], y[i+1], z[i+1]]
distance += magnitude(substract(vec, prevvec))
numberOfPoints = distance * pointsPerUnit
tckp,u = splprep([array(x), array(y), array(z)], s=smoothnessParameter, k=splineOrder, nest=-1) # find the knot points
xnew, ynew, znew = splev(linspace(0, 1, numberOfPoints), tckp) # evaluate spline, including interpolated points
out = ""
for i in range(len(xnew)):
out += pack('fff', xnew[i], ynew[i], znew[i])
of.write(out)
nearest = []
for i in range(len(x)):
nearest.append([1000, 0])
for v in range(len(xnew)-1):
vec1 = [x[i], y[i], z[i]]
vec2 = [xnew[v], ynew[v], znew[v]]
dist = magnitude(substract(vec1, vec2))
if (dist < nearest[i][0]):
nearest[i] = [dist, v]
random.seed()
for v in range(8):
xr = []
yr = []
zr = []
fewrandom = []
manyrandom = []
for i in range((len(nearest) / 10)):
fewrandom.append(random.uniform(-8,8))
fewrandom.append(fewrandom[0])
fewrandom.append(fewrandom[0])
for i in range(len(nearest)):
manyrandom.append(fewrandom[i / 10] * ((10 - (i % 10)) / 10.0) + fewrandom[i / 10 + 1] * ((i % 10) / 10.0))
for i in range(len(nearest)):
vec = [0,0,0]
if (i > 0):
prevtocurr = subtract([xnew[nearest[i][1]], ynew[nearest[i][1]], znew[nearest[i][1]]], [xnew[nearest[i-1][1]], ynew[nearest[i-1][1]], znew[nearest[i-1][1]]])
vec = add(vec, prevtocurr)
if (i < len(nearest) - 1):
currtonext = subtract([xnew[nearest[i+1][1]], ynew[nearest[i+1][1]], znew[nearest[i+1][1]]], [xnew[nearest[i][1]], ynew[nearest[i][1]], znew[nearest[i][1]]])
vec = add(vec, currtonext)
perpendicular = normalize([vec[2], 0, -vec[0]])
perpendicular = multiply(perpendicular, manyrandom[i])
xr.append(xnew[nearest[i][1]] + perpendicular[0])
yr.append(ynew[nearest[i][1]])
zr.append(znew[nearest[i][1]] + perpendicular[2])
xr.append(xr[0])
yr.append(yr[0])
zr.append(zr[0])
tckp,u = splprep([array(xr), array(yr), array(zr)], s=smoothnessParameter, k=splineOrder, nest=-1) # find the knot points
xs, ys, zs = splev(linspace(0, 1, numberOfPoints), tckp) # evaluate spline, including interpolated points
off = open(sys.argv[len(sys.argv) - 1][:sys.argv[len(sys.argv) - 1].rfind(".")] + ".path" + str(v), 'w')
out = ""
for i in range(len(xnew)):
out += pack('fff', xs[i], ys[i], zs[i])
off.write(out) | 38.471429 | 462 | 0.665615 | 863 | 5,386 | 4.141367 | 0.271147 | 0.047006 | 0.037773 | 0.024622 | 0.255176 | 0.247342 | 0.229435 | 0.210968 | 0.210968 | 0.210968 | 0 | 0.02912 | 0.158374 | 5,386 | 140 | 463 | 38.471429 | 0.759321 | 0.238025 | 0 | 0.12963 | 1 | 0 | 0.133985 | 0.007579 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.046296 | null | null | 0.018519 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
77d8d932e255333211d1367e1e6f58c805a8da5f | 2,204 | py | Python | glesys/endpoints/base.py | pyglesys/pyglesys | e4ec4ef583e4e0e257ca6a2481209fba1dc043fc | [
"MIT"
] | null | null | null | glesys/endpoints/base.py | pyglesys/pyglesys | e4ec4ef583e4e0e257ca6a2481209fba1dc043fc | [
"MIT"
] | 20 | 2018-11-04T08:48:28.000Z | 2018-11-04T20:43:26.000Z | glesys/endpoints/base.py | pyglesys/pyglesys | e4ec4ef583e4e0e257ca6a2481209fba1dc043fc | [
"MIT"
] | null | null | null | import collections
import operator
import os.path
def format_args_get(**kwargs):
args = ""
for k, v in kwargs.items():
args = os.path.join(args, "{}/{}".format(k, v))
return args
class ApiObject(collections.MutableMapping):
"""Represents an object returned from the API.
``ApiObject`` instances behave basically like :class:`dict` with the
addition of the handy dot notation for accessing attributes (i.e.
keys) as well as (optionally) sorting attributes alphabetically for
output.
Keyword Args
------------
sort_attrs : bool
Wether or not attributes should be sorted in output.
"""
def __init__(self, sort_attrs=False, **kwargs):
self._sort_attrs = sort_attrs
self._dict = dict(**kwargs)
def __getitem__(self, key):
return self._dict[key]
def __setitem__(self, key, value):
self._dict[key] = value
def __delitem__(self, key, value):
self._dict[key] = value
def __getattr__(self, attr):
try:
return self[attr]
except KeyError:
msg = "'{}' object has no attribute '{}'"
raise AttributeError(msg.format(self.__class__.__name__, attr))
def __iter__(self):
return iter(self._dict)
def __len__(self):
return len(self._dict)
def __repr__(self):
attrs = self.items()
if self._sort_attrs:
attrs = sorted(attrs, key=operator.itemgetter(0))
return "{}({})".format(self.__class__.__name__, dict(attrs))
class ApiResource(ApiObject):
"""Represents an API resource returned from the API.
An API resource differs from an API object in that further calls to
the API can be made by the resource while the object is inert and
only represents information.
Args
----
glesys : Glesys
A GleSYS instance. Used for calls to the API.
"""
def __init__(self, glesys, sort_attrs=False, **kwargs):
self.glesys = glesys
super(ApiResource, self).__init__(sort_attrs=sort_attrs, **kwargs)
class Endpoint(object):
"""Base class for all endpoints."""
def __init__(self, glesys):
self.glesys = glesys
| 26.878049 | 75 | 0.63657 | 275 | 2,204 | 4.818182 | 0.4 | 0.05434 | 0.024906 | 0.02717 | 0.083019 | 0.046792 | 0.046792 | 0.046792 | 0 | 0 | 0 | 0.000609 | 0.254991 | 2,204 | 81 | 76 | 27.209877 | 0.806334 | 0.307623 | 0 | 0.1 | 0 | 0 | 0.030556 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.275 | false | 0 | 0.075 | 0.075 | 0.575 | 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 |
77dbd487922b617a5c1f8e5d272198391722bb9d | 1,468 | py | Python | model/vgg16_structure.py | Bearchat/VGG16_TXQ | 30ee6b2ebf231d83ba5c09f313d3a9211f3cd7e3 | [
"MIT"
] | 17 | 2017-10-10T06:18:51.000Z | 2020-10-28T08:52:19.000Z | model/vgg16_structure.py | Bearchat/VGG16_TXQ | 30ee6b2ebf231d83ba5c09f313d3a9211f3cd7e3 | [
"MIT"
] | 16 | 2019-10-19T16:27:17.000Z | 2020-08-08T02:00:01.000Z | model/vgg16_structure.py | Bearchat/VGG16_TXQ | 30ee6b2ebf231d83ba5c09f313d3a9211f3cd7e3 | [
"MIT"
] | 5 | 2018-02-03T13:44:08.000Z | 2020-10-28T08:52:24.000Z | """
network-structure of vgg16 excludes fully-connection layer
date: 9/17
author: arabian9ts
"""
# structure of convolution and pooling layer up to fully-connection layer
"""
size-format:
[ [ convolution_kernel ], [ bias ] ]
[ [ f_h, f_w, in_size, out_size ], [ out_size ] ]
"""
structure = {
# convolution layer 1
'conv1_1': [[3, 3, 3, 64], [64]],
'conv1_2': [[3, 3, 64, 64], [64]],
# convolution layer 2
'conv2_1': [[3, 3, 64, 128], [128]],
'conv2_2': [[3, 3, 128, 128], [128]],
# convolution layer 3
'conv3_1': [[3, 3, 128, 256], [256]],
'conv3_2': [[3, 3, 256, 256], [256]],
'conv3_3': [[3, 3, 256, 256], [256]],
# convolution layer 4
'conv4_1': [[3, 3, 256, 512], [512]],
'conv4_2': [[3, 3, 512, 512], [512]],
'conv4_3': [[3, 3, 512, 512], [512]],
# convolution layer 5
'conv5_1': [[3, 3, 512, 512], [512]],
'conv5_2': [[3, 3, 512, 512], [512]],
'conv5_3': [[3, 3, 512, 512], [512]],
# fully-connection 6
'fc6': [[4096, 0, 0, 0], [4096]],
# fully-connection 7
'fc7': [[4096, 0, 0, 0], [4096]],
# fully-connection 8
'fc8': [[1000, 0, 0, 0], [1000]],
# for cifar
'cifar': [[512, 0, 0, 0], [512]],
}
# kernel_size is constant, so defined here
ksize = [1, 2, 2, 1,]
# convolution-layer-strides is already below
conv_strides = [1, 1, 1, 1,]
# pooling-layer-strides is already below
pool_strides = [1, 2, 2, 1,] | 24.466667 | 73 | 0.526567 | 217 | 1,468 | 3.460829 | 0.290323 | 0.045273 | 0.019973 | 0.053262 | 0.259654 | 0.161119 | 0.069241 | 0 | 0 | 0 | 0 | 0.21226 | 0.25545 | 1,468 | 60 | 74 | 24.466667 | 0.47484 | 0.307902 | 0 | 0 | 0 | 0 | 0.123384 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
77e21c352f4d9ed970301f1570ce57c34d5171bc | 15,986 | py | Python | tests/testapp/migrate/page/0001_initial.py | mjl/feincms | fe147ec0fcf779f812e35a31f30ee29ccd7088fd | [
"BSD-3-Clause"
] | 325 | 2015-01-07T08:20:09.000Z | 2022-03-22T02:55:13.000Z | tests/testapp/migrate/page/0001_initial.py | mjl/feincms | fe147ec0fcf779f812e35a31f30ee29ccd7088fd | [
"BSD-3-Clause"
] | 148 | 2015-01-09T06:19:35.000Z | 2022-01-07T15:36:35.000Z | tests/testapp/migrate/page/0001_initial.py | mjl/feincms | fe147ec0fcf779f812e35a31f30ee29ccd7088fd | [
"BSD-3-Clause"
] | 109 | 2015-01-13T09:30:20.000Z | 2022-01-03T09:24:07.000Z | # Generated by Django 3.0.2 on 2020-01-21 15:21
import django.db.models.deletion
from django.db import migrations, models
import feincms.contrib.fields
import feincms.extensions.base
import feincms.extensions.datepublisher
import feincms.module.medialibrary.fields
import feincms.module.mixins
class Migration(migrations.Migration):
initial = True
dependencies = [
("sites", "0001_initial"),
("medialibrary", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="Page",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("active", models.BooleanField(default=True, verbose_name="active")),
(
"title",
models.CharField(
help_text="This title is also used for navigation menu items.",
max_length=200,
verbose_name="title",
),
),
(
"slug",
models.SlugField(
help_text="This is used to build the URL for this page",
max_length=150,
verbose_name="slug",
),
),
(
"in_navigation",
models.BooleanField(default=False, verbose_name="in navigation"),
),
(
"override_url",
models.CharField(
blank=True,
help_text="Override the target URL. Be sure to include slashes at the beginning and at the end if it is a local URL. This affects both the navigation and subpages' URLs.",
max_length=255,
verbose_name="override URL",
),
),
(
"redirect_to",
models.CharField(
blank=True,
help_text="Target URL for automatic redirects or the primary key of a page.",
max_length=255,
verbose_name="redirect to",
),
),
(
"_cached_url",
models.CharField(
blank=True,
db_index=True,
default="",
editable=False,
max_length=255,
verbose_name="Cached URL",
),
),
("lft", models.PositiveIntegerField(editable=False)),
("rght", models.PositiveIntegerField(editable=False)),
("tree_id", models.PositiveIntegerField(db_index=True, editable=False)),
("level", models.PositiveIntegerField(editable=False)),
(
"template_key",
models.CharField(
choices=[("base", "Base Template")],
default="base",
max_length=255,
verbose_name="template",
),
),
(
"navigation_extension",
models.CharField(
blank=True,
choices=[],
help_text="Select the module providing subpages for this page if you need to customize the navigation.",
max_length=200,
null=True,
verbose_name="navigation extension",
),
),
(
"language",
models.CharField(
choices=[("en", "English"), ("de", "German")],
default="en",
max_length=10,
verbose_name="language",
),
),
(
"publication_date",
models.DateTimeField(
default=feincms.extensions.datepublisher.granular_now,
verbose_name="publication date",
),
),
(
"publication_end_date",
models.DateTimeField(
blank=True,
help_text="Leave empty if the entry should stay active forever.",
null=True,
verbose_name="publication end date",
),
),
(
"_ct_inventory",
feincms.contrib.fields.JSONField(
blank=True,
editable=False,
null=True,
verbose_name="content types",
),
),
(
"meta_keywords",
models.TextField(
blank=True,
help_text="Keywords are ignored by most search engines.",
verbose_name="meta keywords",
),
),
(
"meta_description",
models.TextField(
blank=True,
help_text="This text is displayed on the search results page. It is however not used for the SEO ranking. Text longer than 140 characters is truncated.",
verbose_name="meta description",
),
),
(
"creation_date",
models.DateTimeField(
editable=False, null=True, verbose_name="creation date"
),
),
(
"modification_date",
models.DateTimeField(
editable=False, null=True, verbose_name="modification date"
),
),
(
"_content_title",
models.TextField(
blank=True,
help_text="The first line is the main title, the following lines are subtitles.",
verbose_name="content title",
),
),
(
"_page_title",
models.CharField(
blank=True,
help_text="Page title for browser window. Same as title by default. Must be 69 characters or fewer.",
max_length=69,
verbose_name="page title",
),
),
(
"navigation_group",
models.CharField(
blank=True,
choices=[("default", "Default"), ("footer", "Footer")],
db_index=True,
default="default",
max_length=20,
verbose_name="navigation group",
),
),
(
"parent",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="children",
to="page.Page",
verbose_name="Parent",
),
),
(
"site",
models.ForeignKey(
default=1,
on_delete=django.db.models.deletion.CASCADE,
to="sites.Site",
verbose_name="Site",
),
),
(
"symlinked_page",
models.ForeignKey(
blank=True,
help_text="All content is inherited from this page if given.",
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="page_page_symlinks",
to="page.Page",
verbose_name="symlinked page",
),
),
(
"translation_of",
models.ForeignKey(
blank=True,
help_text="Leave this empty for entries in the primary language.",
limit_choices_to={"language": "en"},
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="translations",
to="page.Page",
verbose_name="translation of",
),
),
],
options={
"verbose_name": "page",
"verbose_name_plural": "pages",
"ordering": ["tree_id", "lft"],
},
bases=(
models.Model,
feincms.extensions.base.ExtensionsMixin,
feincms.module.mixins.ContentModelMixin,
),
),
migrations.CreateModel(
name="TemplateContent",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("region", models.CharField(max_length=255)),
("ordering", models.IntegerField(default=0, verbose_name="ordering")),
(
"template",
models.CharField(
choices=[("templatecontent_1.html", "template 1")],
max_length=100,
verbose_name="template",
),
),
(
"parent",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="templatecontent_set",
to="page.Page",
),
),
],
options={
"verbose_name": "template content",
"verbose_name_plural": "template contents",
"db_table": "page_page_templatecontent",
"ordering": ["ordering"],
"permissions": [],
"abstract": False,
},
),
migrations.CreateModel(
name="RawContent",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("text", models.TextField(blank=True, verbose_name="content")),
("region", models.CharField(max_length=255)),
("ordering", models.IntegerField(default=0, verbose_name="ordering")),
(
"parent",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="rawcontent_set",
to="page.Page",
),
),
],
options={
"verbose_name": "raw content",
"verbose_name_plural": "raw contents",
"db_table": "page_page_rawcontent",
"ordering": ["ordering"],
"permissions": [],
"abstract": False,
},
),
migrations.CreateModel(
name="MediaFileContent",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("region", models.CharField(max_length=255)),
("ordering", models.IntegerField(default=0, verbose_name="ordering")),
(
"type",
models.CharField(
choices=[("default", "Default position")],
default="default",
max_length=20,
verbose_name="type",
),
),
(
"mediafile",
feincms.module.medialibrary.fields.MediaFileForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="medialibrary.MediaFile",
verbose_name="media file",
),
),
(
"parent",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="mediafilecontent_set",
to="page.Page",
),
),
],
options={
"verbose_name": "media file",
"verbose_name_plural": "media files",
"db_table": "page_page_mediafilecontent",
"ordering": ["ordering"],
"permissions": [],
"abstract": False,
},
),
migrations.CreateModel(
name="ApplicationContent",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"parameters",
feincms.contrib.fields.JSONField(editable=False, null=True),
),
("region", models.CharField(max_length=255)),
("ordering", models.IntegerField(default=0, verbose_name="ordering")),
(
"urlconf_path",
models.CharField(
choices=[("whatever", "Test Urls")],
max_length=100,
verbose_name="application",
),
),
(
"parent",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="applicationcontent_set",
to="page.Page",
),
),
],
options={
"verbose_name": "application content",
"verbose_name_plural": "application contents",
"db_table": "page_page_applicationcontent",
"ordering": ["ordering"],
"permissions": [],
"abstract": False,
},
),
]
| 37.70283 | 195 | 0.381584 | 1,035 | 15,986 | 5.737198 | 0.219324 | 0.088919 | 0.023577 | 0.03705 | 0.416639 | 0.344392 | 0.290502 | 0.251263 | 0.218424 | 0.199899 | 0 | 0.010909 | 0.529776 | 15,986 | 423 | 196 | 37.791962 | 0.779034 | 0.002815 | 0 | 0.561446 | 1 | 0.004819 | 0.172721 | 0.009097 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.016867 | 0 | 0.026506 | 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 |
77eed03633dbee41f995d4870a363bb44f226ac0 | 89 | py | Python | helita/obs/__init__.py | temcomp/helita | 33c71837f79cb2acb89144fcfb59a7ae84fe6db0 | [
"BSD-3-Clause"
] | 4 | 2017-06-14T14:43:18.000Z | 2021-01-14T15:34:32.000Z | helita/obs/__init__.py | temcomp/helita | 33c71837f79cb2acb89144fcfb59a7ae84fe6db0 | [
"BSD-3-Clause"
] | 22 | 2017-06-29T18:32:51.000Z | 2021-06-29T13:18:34.000Z | helita/obs/__init__.py | temcomp/helita | 33c71837f79cb2acb89144fcfb59a7ae84fe6db0 | [
"BSD-3-Clause"
] | 19 | 2017-05-23T15:36:29.000Z | 2021-11-23T06:51:44.000Z | """
Set of tools to work with different observations.
"""
__all__ = ["hinode", "iris"]
| 12.714286 | 49 | 0.651685 | 11 | 89 | 4.909091 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.179775 | 89 | 6 | 50 | 14.833333 | 0.739726 | 0.550562 | 0 | 0 | 0 | 0 | 0.322581 | 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 |
77f0ce8feaaec971b405a80237c8004db95fcef6 | 672 | py | Python | wiki_JSON.py | oknono/IDDY | 8da83948858e3c2f729fec233f9630d00f5ab1fa | [
"MIT"
] | null | null | null | wiki_JSON.py | oknono/IDDY | 8da83948858e3c2f729fec233f9630d00f5ab1fa | [
"MIT"
] | 2 | 2015-10-06T21:11:05.000Z | 2016-01-13T22:08:13.000Z | wiki_JSON.py | oknono/IDDY | 8da83948858e3c2f729fec233f9630d00f5ab1fa | [
"MIT"
] | null | null | null | def wiki_json(name):
name = name.strip().title()
url = 'https://en.wikipedia.org/w/api.php?action=query&titles={0}&continue=&prop=categories&format=json'.format(name)
return url
def categories(response):
return response.json()["query"]["pages"].values()[0]["categories"]
def is_ambiguous(dic):
for item in dic:
if 'disambiguation' in item["title"]:
return True
return False
def is_dead(dic):
for item in dic:
if 'deaths' in item["title"]:
return True
return False
def was_born(dic):
for item in dic:
if 'births' in item["title"]:
return True
return False
| 24.888889 | 121 | 0.605655 | 91 | 672 | 4.428571 | 0.450549 | 0.044665 | 0.074442 | 0.08933 | 0.379653 | 0.379653 | 0.253102 | 0.173697 | 0 | 0 | 0 | 0.004008 | 0.25744 | 672 | 27 | 122 | 24.888889 | 0.803607 | 0 | 0 | 0.428571 | 0 | 0.047619 | 0.233284 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.238095 | false | 0 | 0 | 0.047619 | 0.619048 | 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 |
7ac414b56168198fede3c3cc47c8c56ded693c59 | 59 | py | Python | constants/styling.py | sahaab-io/banter.ly | 200e2977a98ab79d90bc943b5a34a94ee6550ae9 | [
"MIT"
] | 1 | 2020-05-12T04:51:55.000Z | 2020-05-12T04:51:55.000Z | constants/styling.py | sahaab-io/banter.ly | 200e2977a98ab79d90bc943b5a34a94ee6550ae9 | [
"MIT"
] | 3 | 2020-05-10T05:23:29.000Z | 2022-01-13T02:45:29.000Z | constants/styling.py | sahaab-io/banter.ly | 200e2977a98ab79d90bc943b5a34a94ee6550ae9 | [
"MIT"
] | null | null | null | CONTAINER = "container"
BLUE = "#33aeff"
GREEN = "#a4c639"
| 14.75 | 23 | 0.661017 | 6 | 59 | 6.5 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12 | 0.152542 | 59 | 3 | 24 | 19.666667 | 0.66 | 0 | 0 | 0 | 0 | 0 | 0.389831 | 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 |
7ac9b1fbcc6520967a30599805706a9037a644e5 | 2,594 | py | Python | sonosco/serialization/serialization_utils.py | anniyanvr/sonosco | 170bc58e52229e2da33cdaf228c5dc6c88a03fb8 | [
"BSD-3-Clause"
] | 15 | 2019-07-08T23:50:09.000Z | 2022-02-10T23:25:40.000Z | sonosco/serialization/serialization_utils.py | anniyanvr/sonosco | 170bc58e52229e2da33cdaf228c5dc6c88a03fb8 | [
"BSD-3-Clause"
] | 7 | 2019-06-23T14:04:41.000Z | 2022-03-11T23:51:09.000Z | sonosco/serialization/serialization_utils.py | anniyanvr/sonosco | 170bc58e52229e2da33cdaf228c5dc6c88a03fb8 | [
"BSD-3-Clause"
] | 4 | 2020-05-07T18:02:04.000Z | 2020-12-17T20:04:53.000Z | import inspect
from typing import Set
from sonosco.common.constants import COLLECTIONS, PRIMITIVES, CLASS_MODULE_FIELD, CLASS_NAME_FIELD, SERIALIZED_FIELD
def get_constructor_args(cls) -> Set[str]:
"""
E.g.
class Bar():
def __init__(self, arg1, arg2):
get_constructor_args(Bar)
# returns ['arg1', 'arg2']
Args:
cls (object):
Returns: set containing names of constructor arguments
"""
return set(inspect.getfullargspec(cls.__init__).args[1:])
def get_class_by_name(name: str) -> type:
"""
Returns type object of class specified by name
Args:
name: full name of the class (with packages)
Returns: class object
"""
components = name.split('.')
mod = __import__(components[0])
for comp in components[1:]:
mod = getattr(mod, comp)
return mod
def is_serialized_collection_of_serializables(obj: any) -> bool:
return is_serialized_collection(obj) and \
len(obj) != 0 and \
all(is_serialized_dataclass(o) for o in obj)
# TODOL Will catch collections of types as well, change this
def is_serialized_collection_of_callables(obj: any) -> bool:
return is_serialized_collection(obj) and \
len(obj) != 0 and \
all(is_serialized_type(o) for o in obj)
def is_serialized_collection(obj: object) -> bool:
"""
Checks if object is a collection
Args:
obj: any python object
Returns: True if object is a collection
"""
return type(obj) in COLLECTIONS
def is_serialized_primitive(obj: object) -> bool:
"""
Checks if object is a primitive
Args:
obj: any python object
Returns: True if object is a primitive
"""
return type(obj) in PRIMITIVES
def is_serialized_type(obj: object) -> bool:
"""
Checks if object is a type
Args:
obj: any python object
Returns: True if object is a type
"""
return type(obj) is dict and CLASS_MODULE_FIELD in obj and CLASS_NAME_FIELD in obj
def is_serialized_dataclass(obj: object) -> bool:
"""
Checks if object is a type
Args:
obj: any python object
Returns: True if object is a type
"""
return type(obj) is dict and CLASS_MODULE_FIELD in obj and CLASS_NAME_FIELD in obj \
and SERIALIZED_FIELD in obj
def raise_unsupported_data_type():
"""
Raises TypeError
Returns:
"""
raise TypeError("Unsupported data type. Currently only primitives, lists of primitives and types"
"objects can be serialized")
| 22.362069 | 116 | 0.650732 | 348 | 2,594 | 4.678161 | 0.258621 | 0.07371 | 0.04914 | 0.054054 | 0.443489 | 0.356265 | 0.356265 | 0.356265 | 0.31941 | 0.31941 | 0 | 0.004727 | 0.265998 | 2,594 | 115 | 117 | 22.556522 | 0.850315 | 0.318427 | 0 | 0.129032 | 0 | 0 | 0.067179 | 0 | 0 | 0 | 0 | 0.008696 | 0 | 1 | 0.290323 | false | 0 | 0.129032 | 0.064516 | 0.677419 | 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 |
7acd7c6bc65a390d7b057a45e99b4a8e4e660719 | 376 | py | Python | streaming_form_data/validators.py | patrislav1/streaming-form-data | c9a5f5a542712fdc3ef41dd84889af9619f93822 | [
"MIT"
] | null | null | null | streaming_form_data/validators.py | patrislav1/streaming-form-data | c9a5f5a542712fdc3ef41dd84889af9619f93822 | [
"MIT"
] | null | null | null | streaming_form_data/validators.py | patrislav1/streaming-form-data | c9a5f5a542712fdc3ef41dd84889af9619f93822 | [
"MIT"
] | null | null | null | class ValidationError(Exception):
pass
class MaxSizeValidator:
def __init__(self, max_size):
self.so_far = 0
self.max_size = max_size
def __call__(self, chunk):
self.so_far += len(chunk)
if self.so_far > self.max_size:
raise ValidationError(
'Size must not be greater than {}'.format(self.max_size))
| 23.5 | 73 | 0.617021 | 48 | 376 | 4.5 | 0.5 | 0.162037 | 0.203704 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003745 | 0.289894 | 376 | 15 | 74 | 25.066667 | 0.805243 | 0 | 0 | 0 | 0 | 0 | 0.085106 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0.090909 | 0 | 0 | 0.363636 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
7acf36aa691dc01d17fe4f3926913057c57d27f1 | 129 | py | Python | bot_config/checks.py | liamjbryant/discordpy-lotus | d533b316f42c280a3dbd24f24c16eb5bdddd6c1c | [
"MIT"
] | null | null | null | bot_config/checks.py | liamjbryant/discordpy-lotus | d533b316f42c280a3dbd24f24c16eb5bdddd6c1c | [
"MIT"
] | null | null | null | bot_config/checks.py | liamjbryant/discordpy-lotus | d533b316f42c280a3dbd24f24c16eb5bdddd6c1c | [
"MIT"
] | null | null | null | import discord
async def check_owner(ctx):
inf = await ctx.bot.application_info()
return ctx.author.id == inf.owner.id
| 18.428571 | 42 | 0.713178 | 20 | 129 | 4.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178295 | 129 | 6 | 43 | 21.5 | 0.849057 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 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.