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
945dc3fc0460c8ac451b0a653afc53bba8b33377
443
py
Python
hubspot/discovery/marketing/transactional/discovery.py
Ronfer/hubspot-api-python
1c87274ecbba4aa3c7728f890ccc6e77b2b6d2e4
[ "Apache-2.0" ]
117
2020-04-06T08:22:53.000Z
2022-03-18T03:41:29.000Z
hubspot/discovery/marketing/transactional/discovery.py
Ronfer/hubspot-api-python
1c87274ecbba4aa3c7728f890ccc6e77b2b6d2e4
[ "Apache-2.0" ]
62
2020-04-06T16:21:06.000Z
2022-03-17T16:50:44.000Z
hubspot/discovery/marketing/transactional/discovery.py
Ronfer/hubspot-api-python
1c87274ecbba4aa3c7728f890ccc6e77b2b6d2e4
[ "Apache-2.0" ]
45
2020-04-06T16:13:52.000Z
2022-03-30T21:33:17.000Z
import hubspot.marketing.transactional as api_client from ...discovery_base import DiscoveryBase class Discovery(DiscoveryBase): @property def public_smtp_tokens_api(self) -> api_client.PublicSmtpTokensApi: return self._configure_api_client(api_client, "PublicSmtpTokensApi") @property def single_send_api(self) -> api_client.SingleSendApi: return self._configure_api_client(api_client, "SingleSendApi")
34.076923
76
0.776524
50
443
6.54
0.48
0.192661
0.061162
0.097859
0.2263
0.2263
0.2263
0
0
0
0
0
0.146727
443
12
77
36.916667
0.865079
0
0
0.222222
0
0
0.072235
0
0
0
0
0
0
1
0.222222
false
0
0.222222
0.222222
0.777778
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
947eee5bef6502353af9560bc8b473dd8463484c
291
py
Python
mundo 2/051.py
thiagofreitascarneiro/Curso-de-Python---Curso-em-Video
0342e482780b5a1c6f78cddd51d9bfad785c79fa
[ "MIT" ]
1
2021-08-04T13:21:22.000Z
2021-08-04T13:21:22.000Z
mundo 2/051.py
thiagofreitascarneiro/Curso-de-Python---Curso-em-Video
0342e482780b5a1c6f78cddd51d9bfad785c79fa
[ "MIT" ]
null
null
null
mundo 2/051.py
thiagofreitascarneiro/Curso-de-Python---Curso-em-Video
0342e482780b5a1c6f78cddd51d9bfad785c79fa
[ "MIT" ]
null
null
null
print('Progressão aritmética') print(10*'_*_') termo = int(input('Digite o primeiro Termo ')) razao = int(input('Digite a razão de uma P.A ')) print('Os 10 primeiros termos da progressão aritmética são:') for c in range(1,11): print(f'{termo}') termo = termo + razao print('Acabou')
29.1
61
0.683849
45
291
4.377778
0.644444
0.203046
0.142132
0
0
0
0
0
0
0
0
0.028571
0.158076
291
9
62
32.333333
0.77551
0
0
0
0
0
0.477663
0
0
0
0
0
0
1
0
false
0
0
0
0
0.555556
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
84a2adea0b0c819e7ac0a3eb06e333c1278fb13b
74
py
Python
ch07/07_02.py
leeseedong/book-cryptocurrency
58c0bb3f5a80f8cc73ba47c4839be3bd33c9d67c
[ "Apache-2.0" ]
121
2019-03-23T13:53:06.000Z
2022-03-28T15:15:03.000Z
ch07/07_02.py
leeseedong/book-cryptocurrency
58c0bb3f5a80f8cc73ba47c4839be3bd33c9d67c
[ "Apache-2.0" ]
3
2021-04-14T14:31:26.000Z
2021-05-09T13:46:14.000Z
ch07/07_02.py
leeseedong/book-cryptocurrency
58c0bb3f5a80f8cc73ba47c4839be3bd33c9d67c
[ "Apache-2.0" ]
114
2019-03-21T13:43:03.000Z
2022-03-31T18:42:11.000Z
import pybithumb df = pybithumb.get_ohlcv("BTC") df.to_excel("btc.xlsx")
14.8
31
0.743243
12
74
4.416667
0.75
0
0
0
0
0
0
0
0
0
0
0
0.094595
74
4
32
18.5
0.791045
0
0
0
0
0
0.148649
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
84a97cff1808af227e90924ecda1f78bc4376b1b
180
py
Python
Python-Standard-Library/ApplicationBuildingBlock/getpass/getpass_noterminal.py
gaufung/CodeBase
0292b06cfe002b3ad0299e43bb51192816a02c74
[ "MIT" ]
1
2018-10-06T23:50:53.000Z
2018-10-06T23:50:53.000Z
Python-Standard-Library/ApplicationBuildingBlock/getpass/getpass_noterminal.py
wsgan001/CodeBase
0292b06cfe002b3ad0299e43bb51192816a02c74
[ "MIT" ]
null
null
null
Python-Standard-Library/ApplicationBuildingBlock/getpass/getpass_noterminal.py
wsgan001/CodeBase
0292b06cfe002b3ad0299e43bb51192816a02c74
[ "MIT" ]
1
2018-10-06T23:50:50.000Z
2018-10-06T23:50:50.000Z
import getpass import sys if sys.stdin.isatty(): p = getpass.getpass('Using getpass:') else: print('Using readline') p = sys.stdin.readline().rstrip() print('Read', p)
22.5
41
0.666667
25
180
4.8
0.52
0.133333
0
0
0
0
0
0
0
0
0
0
0.166667
180
8
42
22.5
0.8
0
0
0
0
0
0.176796
0
0
0
0
0
0
1
0
false
0.25
0.25
0
0.25
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
84bbcb35e1afe833a7d8fba99e5f5efbb130c4d6
1,545
py
Python
wiki_music/library/tags_handler/__init__.py
marian-code/wikipedia-music-tags
e8836c23b7b7e43661b59afd1bfc18d381b95d4a
[ "MIT" ]
5
2019-01-28T21:53:14.000Z
2020-06-27T08:52:36.000Z
wiki_music/library/tags_handler/__init__.py
marian-code/wikipedia-music-tags
e8836c23b7b7e43661b59afd1bfc18d381b95d4a
[ "MIT" ]
4
2019-01-15T16:33:59.000Z
2020-05-20T08:09:02.000Z
wiki_music/library/tags_handler/__init__.py
marian-code/wikipedia-music-tags
e8836c23b7b7e43661b59afd1bfc18d381b95d4a
[ "MIT" ]
1
2020-04-15T11:00:20.000Z
2020-04-15T11:00:20.000Z
"""Low level tags handling implementation based on mutagen library.""" import logging from typing import TYPE_CHECKING, Type, Union from pathlib import Path from wiki_music.utilities import exception, UnsupportedFileType # TODO does not work, not sure why? gives wird attribute errors # from lazy_import import lazy_callable # TagMp3 = lazy_callable("wiki_music.library.tags_handler.mp3.TagMp3") # TagFlac = lazy_callable("wiki_music.library.tags_handler.flac.TagFlac") # TagM4a = lazy_callable("wiki_music.library.tags_handler.m4a.TagM4a") if TYPE_CHECKING: from .tag_base import TagBase log = logging.getLogger(__name__) __all__ = ["File"] def File(filename: Union[str, Path]) -> "TagBase": """Class factory which returns coresponding class based on file type. Note ---- Currently supported types are: mp3, flac, m4a Raises ------ UnsupportedFileType if file is not one of supported types Returns ------- TagBase one of the low level tag handling classes """ if isinstance(filename, str): filename = Path(filename) if filename.suffix.endswith("mp3"): from .mp3 import TagMp3 return TagMp3(filename) elif filename.suffix.endswith("flac"): from .flac import TagFlac return TagFlac(filename) elif filename.suffix.endswith("m4a"): from .m4a import TagM4a return TagM4a(filename) else: e = (f"Tagging for {filename.suffix} files is not implemented") raise UnsupportedFileType(e)
27.589286
73
0.697087
192
1,545
5.489583
0.432292
0.034156
0.045541
0.059772
0.175522
0.111006
0.111006
0
0
0
0
0.013126
0.211003
1,545
55
74
28.090909
0.851518
0.41877
0
0
0
0
0.089928
0
0
0
0
0.018182
0
1
0.043478
false
0
0.347826
0
0.521739
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
1
0
1
0
0
3
84e37927417ff86ae1314d0e3d705e28c3e76248
161
py
Python
app/utils.py
sh4rpy/wllpprs
678a004bcdfdc6c512f1fc9894172a49befb7e53
[ "BSD-3-Clause" ]
null
null
null
app/utils.py
sh4rpy/wllpprs
678a004bcdfdc6c512f1fc9894172a49befb7e53
[ "BSD-3-Clause" ]
2
2021-04-06T18:09:10.000Z
2021-06-02T02:41:15.000Z
app/utils.py
sh4rpy/wllpprs
678a004bcdfdc6c512f1fc9894172a49befb7e53
[ "BSD-3-Clause" ]
null
null
null
import requests def get_photo_url(url, client_id, query): response = requests.get(url.format(query, client_id)).json() return response['urls']['full']
23
64
0.714286
23
161
4.826087
0.652174
0.144144
0
0
0
0
0
0
0
0
0
0
0.136646
161
6
65
26.833333
0.798561
0
0
0
0
0
0.049689
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
84ef47a97ece84d8e30163fcf18c6d471f1ed4ae
211
py
Python
mysite/booking/urls.py
Scottchiang90/Demo-Booking-App
4e2e9a283b011ab1e5ca2db737412ac646bac33c
[ "MIT" ]
null
null
null
mysite/booking/urls.py
Scottchiang90/Demo-Booking-App
4e2e9a283b011ab1e5ca2db737412ac646bac33c
[ "MIT" ]
5
2021-03-30T14:03:15.000Z
2021-09-22T19:26:27.000Z
mysite/booking/urls.py
Scottchiang90/Demo-Booking-App
4e2e9a283b011ab1e5ca2db737412ac646bac33c
[ "MIT" ]
null
null
null
from django.urls import path from .views import BookingCreateView, SuccessView urlpatterns = [ path('', BookingCreateView.as_view()), path('success/<int:pk>', SuccessView.as_view(), name='success'), ]
23.444444
68
0.71564
24
211
6.208333
0.625
0.080537
0
0
0
0
0
0
0
0
0
0
0.132701
211
8
69
26.375
0.814208
0
0
0
0
0
0.109005
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
ca21c1dad333ee951b0771299847ccae961ce0e0
208
py
Python
backend/youngun/youngun/apps/content/forms.py
aakashbajaj/Youngun-Campaign-Tracking
a3b4f283b22cefb92c72f7638ee2a9da72622de0
[ "Apache-2.0" ]
null
null
null
backend/youngun/youngun/apps/content/forms.py
aakashbajaj/Youngun-Campaign-Tracking
a3b4f283b22cefb92c72f7638ee2a9da72622de0
[ "Apache-2.0" ]
1
2021-09-22T19:27:06.000Z
2021-09-22T19:27:06.000Z
backend/youngun/youngun/apps/content/forms.py
aakashbajaj/Youngun-Campaign-Tracking
a3b4f283b22cefb92c72f7638ee2a9da72622de0
[ "Apache-2.0" ]
null
null
null
from django import forms class QuoteRTForm(forms.Form): _selected_action = forms.CharField(widget=forms.MultipleHiddenInput) imgurl = forms.URLField(label='Image URL', max_length=8000, required=True)
41.6
78
0.788462
26
208
6.192308
0.846154
0
0
0
0
0
0
0
0
0
0
0.021622
0.110577
208
5
78
41.6
0.848649
0
0
0
0
0
0.043062
0
0
0
0
0
0
1
0
false
0
0.25
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
ca2bf3f00b0a160fa97c95d4c16ca23bddac0e0d
186
py
Python
pages/forms.py
twoblokeswithapostie/bc_pages_in_django
178162ceb58e6e34a25ea0c5141377b850b6de37
[ "MIT" ]
null
null
null
pages/forms.py
twoblokeswithapostie/bc_pages_in_django
178162ceb58e6e34a25ea0c5141377b850b6de37
[ "MIT" ]
null
null
null
pages/forms.py
twoblokeswithapostie/bc_pages_in_django
178162ceb58e6e34a25ea0c5141377b850b6de37
[ "MIT" ]
null
null
null
from django import forms from .models import Page class PageForm(forms.ModelForm): class Meta: model = Page fields = ['name', 'url', 'enabled', 'expires', 'email']
20.666667
63
0.634409
22
186
5.363636
0.772727
0
0
0
0
0
0
0
0
0
0
0
0.236559
186
9
63
20.666667
0.830986
0
0
0
0
0
0.139037
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
ca4227ea78a5f74e9b2d97e666e428d5bbba22a0
865
py
Python
cms/middles/error.py
linzhiming0826/cms
bb9568b1edd9cd904b26130163bb6d9f9d449f4e
[ "MIT" ]
3
2018-05-01T07:00:51.000Z
2019-10-08T03:42:22.000Z
cms/middles/error.py
linzhiming0826/cms
bb9568b1edd9cd904b26130163bb6d9f9d449f4e
[ "MIT" ]
null
null
null
cms/middles/error.py
linzhiming0826/cms
bb9568b1edd9cd904b26130163bb6d9f9d449f4e
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- import sys from django.views.debug import technical_500_response from django.conf import settings from cms.apis.menus import Menus class ErrorMiddleware(object): def __init__(self, get_response): self.get_response = get_response # One-time configuration and initialization. def __call__(self, request): # Code to be executed for each request before # the view (and later middleware) are called. response = self.get_response(request) # Code to be executed for each request/response after # the view is called. return response def process_exception(self, request, exception): # 如果关闭debug模式,并且是管理员:可以看到错误页面,否则根据系统配置进行跳转。 if settings.DEBUG is False and request.user.is_superuser: return technical_500_response(request, *sys.exc_info())
33.269231
67
0.700578
109
865
5.385321
0.541284
0.074957
0.076661
0.078365
0.126065
0.126065
0.126065
0.126065
0
0
0
0.010448
0.225434
865
25
68
34.6
0.865672
0.307514
0
0
0
0
0
0
0
0
0
0
0
1
0.230769
false
0
0.307692
0
0.769231
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
3
ca4d58f26797d40447f4894d84f9c24989bfb074
1,743
py
Python
backend/api/migrations/0001_initial.py
s1071539/claw-machine
dfc71207458b04e6fa14f670bfd0771a32efcff0
[ "MIT" ]
null
null
null
backend/api/migrations/0001_initial.py
s1071539/claw-machine
dfc71207458b04e6fa14f670bfd0771a32efcff0
[ "MIT" ]
null
null
null
backend/api/migrations/0001_initial.py
s1071539/claw-machine
dfc71207458b04e6fa14f670bfd0771a32efcff0
[ "MIT" ]
null
null
null
# Generated by Django 2.2.4 on 2020-11-26 06:57 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Users', fields=[ ('user_id', models.IntegerField(blank=True, db_column='id', primary_key=True, serialize=False, unique=True)), ('user', models.TextField(blank=True)), ('password', models.TextField(blank=True)), ('email', models.TextField(blank=True)), ('groups', models.TextField(blank=True)), ('region', models.TextField(blank=True)), ('record', models.TextField(blank=True)), ('description', models.TextField(blank=True)), ('setting', models.TextField(blank=True)), ], options={ 'db_table': 'users', }, ), migrations.CreateModel( name='Product', fields=[ ('id', models.IntegerField(blank=True, db_column='id', primary_key=True, serialize=False, unique=True)), ('name', models.TextField(blank=True)), ('price', models.IntegerField(blank=True)), ('amount', models.IntegerField(blank=True)), ('hot', models.IntegerField(blank=True)), ('time', models.TextField(blank=True)), ('owner', models.TextField(blank=True)), ('group', models.TextField(blank=True)), ('url', models.TextField(blank=True)), ], options={ 'db_table': 'product', }, ), ]
35.571429
125
0.512909
155
1,743
5.722581
0.348387
0.182638
0.293123
0.351747
0.259301
0.259301
0.259301
0.173619
0.173619
0.173619
0
0.012965
0.336202
1,743
48
126
36.3125
0.753673
0.025818
0
0.243902
1
0
0.083137
0
0
0
0
0
0
1
0
false
0.02439
0.02439
0
0.121951
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
ca82c646c69fcb1b0121b1e51f0a1fa14d5b0adc
200
py
Python
app.py
halimi/calculatorservice
caf43110213444724e191156c2b1b204c40e8a4d
[ "MIT" ]
null
null
null
app.py
halimi/calculatorservice
caf43110213444724e191156c2b1b204c40e8a4d
[ "MIT" ]
null
null
null
app.py
halimi/calculatorservice
caf43110213444724e191156c2b1b204c40e8a4d
[ "MIT" ]
null
null
null
from wsgiref.simple_server import make_server from calculatorservice import main if __name__ == '__main__': app = main() server = make_server('0.0.0.0', 6543, app) server.serve_forever()
25
46
0.72
28
200
4.714286
0.535714
0.045455
0.045455
0
0
0
0
0
0
0
0
0.048193
0.17
200
7
47
28.571429
0.746988
0
0
0
0
0
0.075
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
ca9bef912f8d149117e97f53d52cd5599403c20b
138
py
Python
benchmarks/micro/table.py
matteomarchiori/RT.js
21360a291b4bfea34bc0c1f87ec193e47fc4508e
[ "MIT" ]
null
null
null
benchmarks/micro/table.py
matteomarchiori/RT.js
21360a291b4bfea34bc0c1f87ec193e47fc4508e
[ "MIT" ]
null
null
null
benchmarks/micro/table.py
matteomarchiori/RT.js
21360a291b4bfea34bc0c1f87ec193e47fc4508e
[ "MIT" ]
null
null
null
#!/usr/bin/python3 import pandas as pd df = pd.read_csv('context_switch_overhead.csv') print(df[['name', 'Mean', 'Std', 'Per Yield']])
17.25
47
0.673913
22
138
4.090909
0.863636
0
0
0
0
0
0
0
0
0
0
0.008197
0.115942
138
7
48
19.714286
0.729508
0.123188
0
0
0
0
0.391667
0.225
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
ca9d2095881b3be8dd4f16ee0e1088d9d145c006
370
py
Python
spectrum_agents/noop.py
lukeprince20/spectrum-agents
ece04fbf18d3cda2af007625d82ea43e4f204ac8
[ "MIT" ]
null
null
null
spectrum_agents/noop.py
lukeprince20/spectrum-agents
ece04fbf18d3cda2af007625d82ea43e4f204ac8
[ "MIT" ]
null
null
null
spectrum_agents/noop.py
lukeprince20/spectrum-agents
ece04fbf18d3cda2af007625d82ea43e4f204ac8
[ "MIT" ]
null
null
null
from spectrum_agents import Agent class Noop(Agent): """ Similar to Incumbent, but always returns no operation (no-op) """ def decide(self, observation, reward): if hasattr(observation, "__iter__"): return tuple(None for _ in observation) else: return None def learn(self, observation, reward): pass
24.666667
65
0.621622
42
370
5.333333
0.761905
0.133929
0.1875
0
0
0
0
0
0
0
0
0
0.291892
370
14
66
26.428571
0.854962
0.164865
0
0
0
0
0.027304
0
0
0
0
0
0
1
0.222222
false
0.111111
0.111111
0
0.666667
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
1
0
1
0
0
0
0
0
3
0486689413fb88662ae75e86500fb6284d651780
15,352
py
Python
kubernetes/client/models/com_coreos_monitoring_v1alpha1_alertmanager_config_spec_opsgenie_configs.py
mariusgheorghies/python
68ac7e168963d8b5a81dc493b1973d29e903a15b
[ "Apache-2.0" ]
null
null
null
kubernetes/client/models/com_coreos_monitoring_v1alpha1_alertmanager_config_spec_opsgenie_configs.py
mariusgheorghies/python
68ac7e168963d8b5a81dc493b1973d29e903a15b
[ "Apache-2.0" ]
null
null
null
kubernetes/client/models/com_coreos_monitoring_v1alpha1_alertmanager_config_spec_opsgenie_configs.py
mariusgheorghies/python
68ac7e168963d8b5a81dc493b1973d29e903a15b
[ "Apache-2.0" ]
null
null
null
# coding: utf-8 """ Kubernetes No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: v1.20.7 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six from kubernetes.client.configuration import Configuration class ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ openapi_types = { 'api_key': 'ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecApiKey', 'api_url': 'str', 'description': 'str', 'details': 'list[ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecHeaders]', 'http_config': 'ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecHttpConfig', 'message': 'str', 'note': 'str', 'priority': 'str', 'responders': 'list[ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecResponders]', 'send_resolved': 'bool', 'source': 'str', 'tags': 'str' } attribute_map = { 'api_key': 'apiKey', 'api_url': 'apiURL', 'description': 'description', 'details': 'details', 'http_config': 'httpConfig', 'message': 'message', 'note': 'note', 'priority': 'priority', 'responders': 'responders', 'send_resolved': 'sendResolved', 'source': 'source', 'tags': 'tags' } def __init__(self, api_key=None, api_url=None, description=None, details=None, http_config=None, message=None, note=None, priority=None, responders=None, send_resolved=None, source=None, tags=None, local_vars_configuration=None): # noqa: E501 """ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._api_key = None self._api_url = None self._description = None self._details = None self._http_config = None self._message = None self._note = None self._priority = None self._responders = None self._send_resolved = None self._source = None self._tags = None self.discriminator = None if api_key is not None: self.api_key = api_key if api_url is not None: self.api_url = api_url if description is not None: self.description = description if details is not None: self.details = details if http_config is not None: self.http_config = http_config if message is not None: self.message = message if note is not None: self.note = note if priority is not None: self.priority = priority if responders is not None: self.responders = responders if send_resolved is not None: self.send_resolved = send_resolved if source is not None: self.source = source if tags is not None: self.tags = tags @property def api_key(self): """Gets the api_key of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :return: The api_key of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :rtype: ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecApiKey """ return self._api_key @api_key.setter def api_key(self, api_key): """Sets the api_key of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. :param api_key: The api_key of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :type: ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecApiKey """ self._api_key = api_key @property def api_url(self): """Gets the api_url of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 The URL to send OpsGenie API requests to. # noqa: E501 :return: The api_url of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :rtype: str """ return self._api_url @api_url.setter def api_url(self, api_url): """Sets the api_url of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. The URL to send OpsGenie API requests to. # noqa: E501 :param api_url: The api_url of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :type: str """ self._api_url = api_url @property def description(self): """Gets the description of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 Description of the incident. # noqa: E501 :return: The description of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :rtype: str """ return self._description @description.setter def description(self, description): """Sets the description of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. Description of the incident. # noqa: E501 :param description: The description of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :type: str """ self._description = description @property def details(self): """Gets the details of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 A set of arbitrary key/value pairs that provide further detail about the incident. # noqa: E501 :return: The details of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :rtype: list[ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecHeaders] """ return self._details @details.setter def details(self, details): """Sets the details of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. A set of arbitrary key/value pairs that provide further detail about the incident. # noqa: E501 :param details: The details of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :type: list[ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecHeaders] """ self._details = details @property def http_config(self): """Gets the http_config of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :return: The http_config of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :rtype: ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecHttpConfig """ return self._http_config @http_config.setter def http_config(self, http_config): """Sets the http_config of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. :param http_config: The http_config of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :type: ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecHttpConfig """ self._http_config = http_config @property def message(self): """Gets the message of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 Alert text limited to 130 characters. # noqa: E501 :return: The message of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :rtype: str """ return self._message @message.setter def message(self, message): """Sets the message of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. Alert text limited to 130 characters. # noqa: E501 :param message: The message of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :type: str """ self._message = message @property def note(self): """Gets the note of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 Additional alert note. # noqa: E501 :return: The note of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :rtype: str """ return self._note @note.setter def note(self, note): """Sets the note of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. Additional alert note. # noqa: E501 :param note: The note of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :type: str """ self._note = note @property def priority(self): """Gets the priority of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 Priority level of alert. Possible values are P1, P2, P3, P4, and P5. # noqa: E501 :return: The priority of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :rtype: str """ return self._priority @priority.setter def priority(self, priority): """Sets the priority of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. Priority level of alert. Possible values are P1, P2, P3, P4, and P5. # noqa: E501 :param priority: The priority of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :type: str """ self._priority = priority @property def responders(self): """Gets the responders of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 List of responders responsible for notifications. # noqa: E501 :return: The responders of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :rtype: list[ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecResponders] """ return self._responders @responders.setter def responders(self, responders): """Sets the responders of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. List of responders responsible for notifications. # noqa: E501 :param responders: The responders of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :type: list[ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecResponders] """ self._responders = responders @property def send_resolved(self): """Gets the send_resolved of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 Whether or not to notify about resolved alerts. # noqa: E501 :return: The send_resolved of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :rtype: bool """ return self._send_resolved @send_resolved.setter def send_resolved(self, send_resolved): """Sets the send_resolved of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. Whether or not to notify about resolved alerts. # noqa: E501 :param send_resolved: The send_resolved of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :type: bool """ self._send_resolved = send_resolved @property def source(self): """Gets the source of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 Backlink to the sender of the notification. # noqa: E501 :return: The source of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :rtype: str """ return self._source @source.setter def source(self, source): """Sets the source of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. Backlink to the sender of the notification. # noqa: E501 :param source: The source of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :type: str """ self._source = source @property def tags(self): """Gets the tags of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 Comma separated list of tags attached to the notifications. # noqa: E501 :return: The tags of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :rtype: str """ return self._tags @tags.setter def tags(self, tags): """Sets the tags of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. Comma separated list of tags attached to the notifications. # noqa: E501 :param tags: The tags of this ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs. # noqa: E501 :type: str """ self._tags = tags def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict()) def __repr__(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs): return False return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" if not isinstance(other, ComCoreosMonitoringV1alpha1AlertmanagerConfigSpecOpsgenieConfigs): return True return self.to_dict() != other.to_dict()
35.953162
247
0.676329
1,403
15,352
7.287954
0.120456
0.046161
0.328606
0.260538
0.593839
0.497506
0.45555
0.311883
0.136528
0.0622
0
0.02894
0.252736
15,352
426
248
36.037559
0.862361
0.509836
0
0.089888
1
0
0.090087
0.038224
0
0
0
0
0
1
0.168539
false
0
0.022472
0
0.314607
0.011236
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
04b6212b02975954ff874ffdbf45f4c14ecc5127
75
py
Python
comma_equals_operator.py
CvanderStoep/VideosSampleCode
38a8d2538a041d5664d0040807ffac463d0fb79c
[ "MIT" ]
285
2021-02-16T21:08:57.000Z
2022-03-31T10:58:41.000Z
comma_equals_operator.py
CvanderStoep/VideosSampleCode
38a8d2538a041d5664d0040807ffac463d0fb79c
[ "MIT" ]
10
2021-05-01T17:20:50.000Z
2022-03-09T21:46:46.000Z
comma_equals_operator.py
CvanderStoep/VideosSampleCode
38a8d2538a041d5664d0040807ffac463d0fb79c
[ "MIT" ]
96
2021-02-15T14:23:15.000Z
2022-03-31T10:58:50.000Z
if __name__ == '__main__': x = 1 y = [2] x, = y print(x)
9.375
26
0.4
11
75
2
0.727273
0
0
0
0
0
0
0
0
0
0
0.046512
0.426667
75
7
27
10.714286
0.465116
0
0
0
0
0
0.106667
0
0
0
0
0
0
1
0
false
0
0
0
0
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
04bb46d689d19bd948522663f6783946155852d5
485
py
Python
plexapi/compat.py
Hellowlol/plexapi
313fef4de80fec5a187f71b76e53c3333efcb2fd
[ "BSD-3-Clause" ]
4
2016-11-18T07:01:03.000Z
2018-05-03T07:45:36.000Z
plexapi/compat.py
phongsathorn2540/plexapi
313fef4de80fec5a187f71b76e53c3333efcb2fd
[ "BSD-3-Clause" ]
1
2016-12-06T15:03:09.000Z
2016-12-06T15:03:09.000Z
plexapi/compat.py
Hellowlol/plexapi
313fef4de80fec5a187f71b76e53c3333efcb2fd
[ "BSD-3-Clause" ]
4
2018-01-04T20:15:26.000Z
2021-01-26T20:32:28.000Z
# -*- coding: utf-8 -*- # flake8:noqa """ Python 2/3 compatability Always try Py3 first """ try: from urllib.parse import urlencode except ImportError: from urllib import urlencode try: from urllib.parse import quote except ImportError: from urllib import quote try: from urllib.parse import unquote except ImportError: from urllib import unquote try: from configparser import ConfigParser except ImportError: from ConfigParser import ConfigParser
17.321429
41
0.740206
60
485
5.983333
0.383333
0.167131
0.233983
0.150418
0.476323
0
0
0
0
0
0
0.012887
0.2
485
27
42
17.962963
0.912371
0.164948
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0
0.75
0
0.75
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
3
04cd24c0c10bb6a3400bc56b0c8e2061f9d44ee2
1,198
py
Python
1244/solution.py
bossm0n5t3r/BOJ
03132388a0c76ef66d6b0dec2053aeca65c4aee6
[ "MIT" ]
2
2020-01-14T07:27:25.000Z
2020-02-12T07:49:58.000Z
1244/solution.py
bossm0n5t3r/BOJ
03132388a0c76ef66d6b0dec2053aeca65c4aee6
[ "MIT" ]
1
2020-01-14T07:29:30.000Z
2021-11-28T11:29:08.000Z
1244/solution.py
bossm0n5t3r/BOJ
03132388a0c76ef66d6b0dec2053aeca65c4aee6
[ "MIT" ]
null
null
null
import sys def sol(): input = sys.stdin.readline switch_count = int(input()) switch_status = [0] + list(map(int, input().split())) student_count = int(input()) student_data = [list(map(int, input().split())) for _ in range(student_count)] for data in student_data: gender, number = data if gender == 1: for i in range(number, switch_count + 1, number): switch_status[i] = 1 - switch_status[i] elif gender == 2: min_width = min(number - 1, switch_count - number) switch_status[number] = 1 - switch_status[number] for i in range(1, min_width + 1): if switch_status[number - i] != switch_status[number + i]: break switch_status[number - i] = 1 - switch_status[number - i] switch_status[number + i] = 1 - switch_status[number + i] print_switch_status(switch_status[1:]) def print_switch_status(switch_status): width = 20 for i in range(len(switch_status)): print(str(switch_status[i]), end=" ") if i != 0 and (i + 1) % width == 0: print() if __name__ == "__main__": sol()
33.277778
82
0.570952
157
1,198
4.121019
0.242038
0.315301
0.222566
0.176198
0.330757
0.179289
0.179289
0.179289
0.120556
0
0
0.020384
0.30384
1,198
35
83
34.228571
0.755396
0
0
0
0
0
0.007513
0
0
0
0
0
0
1
0.068966
false
0
0.034483
0
0.103448
0.137931
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
04dace431d77f0dc73d54430007231d2246b1335
5,791
py
Python
viewpoint/feeds.py
callowayproject/django-viewpoint
e75e16febb5948a4434d3417c162031948cb0ed8
[ "Apache-2.0" ]
1
2016-08-15T00:59:39.000Z
2016-08-15T00:59:39.000Z
viewpoint/feeds.py
callowayproject/django-viewpoint
e75e16febb5948a4434d3417c162031948cb0ed8
[ "Apache-2.0" ]
null
null
null
viewpoint/feeds.py
callowayproject/django-viewpoint
e75e16febb5948a4434d3417c162031948cb0ed8
[ "Apache-2.0" ]
null
null
null
from datetime import datetime from django.contrib.syndication.feeds import Feed from django.contrib.syndication.views import Feed as FeedView from django.contrib.contenttypes.models import ContentType from django.conf import settings from django.contrib.sites.models import Site from django.utils.feedgenerator import Rss201rev2Feed, Atom1Feed from viewpoint.settings import USE_CATEGORIES, DEFAULT_BLOG from models import Entry, Blog ENTRY_CONTENT_TYPE = ContentType.objects.get_for_model(Entry) FEED_GENERATORS = getattr(settings, "FEED_GENERATORS", { 'rss': Rss201rev2Feed, 'atom': Atom1Feed }) def LatestEntries(feed_title=None, feed_description=None, feed_link=None, entry_count=20, feed_type='rss'): """Factory function for latest entries""" class _LatestEntries(Feed): def title(self): if not feed_title: return "Latest entries on %s" % Site.objects.get_current().name return feed_title def link(self): if not feed_link: return "/" return feed_link def description(self): if not feed_description: return "Latest entries on %s" % Site.objects.get_current().name return feed_description def items(self): return Entry.objects.published( ).order_by('-pub_date')[:entry_count] def item_pubdate(self, item): d = item.pub_date t = item.pub_time dt = datetime(d.year, d.month, d.day, t.hour, t.minute, t.second) return dt feed_obj = _LatestEntries # Set the feed generator, default to rss. feed_obj.feed_type = FEED_GENERATORS.get(feed_type, Rss201rev2Feed) return feed_obj class LatestEntriesView(FeedView): title = "Latest entries on %s" % Site.objects.get_current().name description = "Latest entries on %s" % Site.objects.get_current().name link = '/' def items(self): return Entry.objects.published().order_by('-pub_date')[:15] def item_pubdate(self, item): d = item.pub_date t = item.pub_time dt = datetime(d.year, d.month, d.day, t.hour, t.minute, t.second) return dt if USE_CATEGORIES and 'categories' in settings.INSTALLED_APPS: from categories.models import Category def LatestEntriesByCategory(feed_title=None, feed_description=None, feed_link=None, entry_count=20, feed_type=None): class _LatestEntriesByCategory(Feed): def get_object(self, bits): if len(bits) < 1: return Category.objects.all()[0] return Category.objects.get(slug=bits[-1]) def title(self, obj): return feed_title or "My blog for category '%s'" % obj.name def link(self, obj): return feed_link or obj.get_absolute_url() def description(self, obj): return feed_description or "Blog entries recently posted in category %s" % obj.name def items(self, obj): return Entry.objects.published( category__slug=obj.slug).order_by('-pub_date')[:entry_count] feed_obj = _LatestEntriesByCategory # Set the feed generator, default to rss. feed_obj.feed_type = FEED_GENERATORS.get(feed_type, Rss201rev2Feed) return feed_obj def LatestEntriesByBlog(feed_title=None, feed_description=None, feed_link=None, entry_count=20, feed_type='rss' ): class _LatestEntriesByBlog(Feed): def get_object(self, bits): if len(bits) < 1 and DEFAULT_BLOG == '': return Blog.objects.all()[0] if DEFAULT_BLOG != '': return Blog.objects.get(slug__iexact=DEFAULT_BLOG, public=True) else: return Blog.objects.get(slug__iexact=bits[-1], public=True) def title(self, obj): return feed_title or "Latest entries for %s" % obj.title def link(self, obj): return feed_link or obj.get_absolute_url() def description(self, obj): return feed_description or "Latest entries posted for %s" % obj.title def items(self, obj): return Entry.objects.published( blog__pk=obj.pk).order_by('-pub_date')[:entry_count] def item_pubdate(self, item): d = item.pub_date t = item.pub_time dt = datetime(d.year, d.month, d.day, t.hour, t.minute, t.second) return dt feed_obj = _LatestEntriesByBlog # Set the feed generator, default to rss. feed_obj.feed_type = FEED_GENERATORS.get(feed_type, Rss201rev2Feed) return feed_obj class LatestEntriesByBlogView(Feed): def get_object(self, bits): if len(bits) < 1 and DEFAULT_BLOG == '': return Blog.objects.all()[0] if DEFAULT_BLOG != '': return Blog.objects.get(slug__iexact=DEFAULT_BLOG, public=True) else: return Blog.objects.get(slug__iexact=bits[-1], public=True) def title(self, obj): return "Latest entries for %s" % obj.title def link(self, obj): return obj.get_absolute_url() def description(self, obj): return "Latest entries posted for %s" % obj.title def items(self, obj): return Entry.objects.published( blog__pk=obj.pk).order_by('-pub_date')[:15] def item_pubdate(self, item): d = item.pub_date t = item.pub_time dt = datetime(d.year, d.month, d.day, t.hour, t.minute, t.second) return dt
34.676647
99
0.612502
718
5,791
4.774373
0.153203
0.035006
0.045508
0.029755
0.672987
0.663652
0.656651
0.656651
0.631855
0.595099
0
0.010005
0.29235
5,791
167
100
34.676647
0.826501
0.026938
0
0.520661
0
0
0.058813
0
0
0
0
0
0
1
0.223141
false
0
0.082645
0.115702
0.661157
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
04fc94a7f1042ba67a36e6d54ca170721f15463b
4,175
py
Python
plab/lasers/newport_venturi.py
joamatab/photonic-coupling-drivers
c12581d8e2158a292e1c585e45c0207c8129c0f1
[ "MIT" ]
null
null
null
plab/lasers/newport_venturi.py
joamatab/photonic-coupling-drivers
c12581d8e2158a292e1c585e45c0207c8129c0f1
[ "MIT" ]
null
null
null
plab/lasers/newport_venturi.py
joamatab/photonic-coupling-drivers
c12581d8e2158a292e1c585e45c0207c8129c0f1
[ "MIT" ]
null
null
null
import pygpib as gpib from plab.lasers.laser import Laser import time class NewportVenturi(Laser): def __init__(self, gpib_num, gpib_dev_num, units="mW"): self._dev = gpib.dev(gpib_num, gpib_dev_num) self.set_power_units(units) self._sleep = 0.1 def _write(self, cmd): gpib.write(self._dev, cmd + "\r\n") time.sleep(self._sleep) def _read(self, num_bytes=100): data = gpib.read(self._dev, num_bytes) time.sleep(self._sleep) return data.decode("ascii") def _query(self, cmd, num_bytes=100): self._write(cmd) data = self._read(num_bytes) data = [d.strip() for d in data.split()[1:]] return data def get_power_W(self): power = float(self._query(":conf:tls:powe?")[0]) if self._units == "mW": power_W = power * 1.0e-3 elif self._units == "dBm": power_W = las.laser.dbm_to_watts(power) return power_W def set_power_W(self, power_W): power_mW = power_W * 1.0e3 return float(self._query(":conf:tls:powe %.5f" % power_mW)[0]) def get_on_or_off(self): on_off = self._query(":conf:tls:outp?")[0] return True if on_off == "ON" else False def turn_on(self): return self._qurey(":conf:tls:outp on")[0] def turn_off(self): return self._query(":conf:tls:outp off")[0] def set_power_units(self, units): assert units in ("mW", "dBm") units = self._query(":config:tls:unit %s" % units)[0] self._units = units return units def get_power_units(self): return self._query(":config:tls:unit?")[0] def get_wavelength_m(self): return float(self._query(":conf:tls:wave?")[0]) def set_wavelength_m(self, wavelength_m): wavelength_nm = wavelength_m * 1.0e9 return float(self._query(":conf:tls:wave %.3f" % wavelength_nm)[0]) def start_sweep(self): self._query(":init") def get_sweep_start_wavelength_nm(self): return float(self._query(":conf:swee:start?")[1]) def set_sweep_start_wavelength_nm(self, wavelength_nm): return float( self._query(":conf:swee:start %s %.3f" % (self._mode, wavelength_nm))[1] ) def get_sweep_stop_wavelength_nm(self): return float(self._query(":conf:swee:stop?")[1]) def set_sweep_stop_wavelength_nm(self, wavelength_nm): return float( self._query(":conf:swee:stop %s %.3f" % (self._mode, wavelength_nm))[1] ) def get_sweep_speed_nm_s(self): return float(self._query(":conf:swee:rate?")[0]) def set_sweep_speed_nm_s(self, sweep_speed_nm_s): return float(self._query(":conf:swee:rate %.1f" % sweep_speed_nm_s)[0]) def get_sweep_mode(self): return self._query(":conf:swee:mode?")[0] def set_sweep_mode(self, mode): mode = mode.lower() assert mode in ("cont", "continuous", "step", "time") self._mode = mode return self._query(":conf:swee:mode %s" % mode)[0] def wait_command_complete(self): assert self._query("*opc?")[0] == "1/1" return True def set_num_sweeps(self, num_sweeps): """ Number of times to run the sweep when do sweep is run. If `0`, the laser will run continuously. Args: num_sweeps(int): Number of times to run the sweep. 0 for infinite repeats. Returns: int: Number of times the sweep will be run. """ num_sweeps = int(num_sweeps) assert 0 <= num_sweeps <= 10000 return int(self._query(":conf:swee:coun %i" % num_sweeps)[0]) def get_num_sweeps(self): return int(self._query(":conf:swee:coun?")[0]) def sweep( self, start_wavelength_nm, stop_wavelength_nm, sweep_speed_nm_s, power_mW ): self.set_sweep_start_wavelength_nm(start_wavelength_nm) self.set_sweep_stop_wavelength_nm(stop_wavelength_nm) self.set_sweep_speed_nm_s(sweep_speed_nm_s) self.set_power_mW(power_mW) self.start_sweep() return self.wait_command_complete()
31.628788
84
0.615569
605
4,175
3.966942
0.183471
0.075
0.086667
0.075
0.412083
0.268333
0.220833
0.1125
0.1125
0.075833
0
0.016998
0.253174
4,175
131
85
31.870229
0.752726
0.059401
0
0.043478
0
0
0.102937
0
0
0
0
0
0.043478
1
0.282609
false
0
0.032609
0.130435
0.576087
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
b6bd47078cbd0eb9706d58fab2c1d0c4c75d31a7
639
py
Python
aleph/tests/extractors/test_normalize.py
Ueland/aleph
d644e5f8b956c7186a59f3ce1c16798017961765
[ "MIT" ]
1
2019-06-18T21:35:59.000Z
2019-06-18T21:35:59.000Z
aleph/tests/extractors/test_normalize.py
heartofstone/aleph
d66b6615d2bfa10c291c63754f53b468de8bebde
[ "MIT" ]
null
null
null
aleph/tests/extractors/test_normalize.py
heartofstone/aleph
d66b6615d2bfa10c291c63754f53b468de8bebde
[ "MIT" ]
null
null
null
from aleph.tests.util import TestCase from aleph.logic.extractors.result import NamedResult class TestNormalize(TestCase): def test_clean_name(self): assert NamedResult.clean_name(' ') is None assert NamedResult.clean_name(None) is None assert NamedResult.clean_name('xx') is None # too short assert NamedResult.clean_name('Mr. Clean and Proper') == 'Clean and Proper' # noqa assert NamedResult.clean_name('The') is None # single token assert NamedResult.clean_name('The Thing Bling') == 'Thing Bling' assert NamedResult.clean_name('of The Thing Bling') == 'Thing Bling'
39.9375
91
0.704225
83
639
5.313253
0.39759
0.163265
0.349206
0.412698
0.37415
0.145125
0
0
0
0
0
0
0.201878
639
15
92
42.6
0.864706
0.042254
0
0
0
0
0.161184
0
0
0
0
0
0.636364
1
0.090909
false
0
0.181818
0
0.363636
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
3
b6c59aedda027fbf4b91d5ce5c723ac7bef622f6
361
py
Python
arithmetic_03/test/test_days_to_years_weeks_days.py
njoroge33/py_learn
6ad55f37789045bc5c03f3dd668cf1ea497f4e84
[ "MIT" ]
null
null
null
arithmetic_03/test/test_days_to_years_weeks_days.py
njoroge33/py_learn
6ad55f37789045bc5c03f3dd668cf1ea497f4e84
[ "MIT" ]
2
2019-04-15T06:29:55.000Z
2019-04-19T17:34:32.000Z
arithmetic_03/test/test_days_to_years_weeks_days.py
njoroge33/py_learn
6ad55f37789045bc5c03f3dd668cf1ea497f4e84
[ "MIT" ]
1
2019-11-19T04:51:18.000Z
2019-11-19T04:51:18.000Z
import pytest from ..convert_days_to_years_weeks_and_days_passed import days_to_years_weeks_days @pytest.mark.parametrize('days, expected', [ (375, (1, 1, 3)), (240, (0, 34, 2)), (765, (2, 5, 0)), (771, (2, 5, 6)) ]) def test_days_to_years_weeks_days(days, expected): actual = days_to_years_weeks_days(days) assert actual == expected
24.066667
82
0.67867
57
361
3.947368
0.491228
0.106667
0.195556
0.284444
0.302222
0.213333
0
0
0
0
0
0.083893
0.174515
361
14
83
25.785714
0.671141
0
0
0
0
0
0.038781
0
0
0
0
0
0.090909
1
0.090909
false
0.090909
0.181818
0
0.272727
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
b6fa0c0eb02289718feb7158e6a6f8eee855343b
310
py
Python
Gem/Codec.py
AmitGreen/Gem.Unsquashed
c51a82b4a3ed35e516126f406488923a86ef26e5
[ "MIT" ]
null
null
null
Gem/Codec.py
AmitGreen/Gem.Unsquashed
c51a82b4a3ed35e516126f406488923a86ef26e5
[ "MIT" ]
null
null
null
Gem/Codec.py
AmitGreen/Gem.Unsquashed
c51a82b4a3ed35e516126f406488923a86ef26e5
[ "MIT" ]
null
null
null
# # Copyright (c) 2017 Amit Green. All rights reserved. # @gem('Gem.Codec') def gem(): require_gem('Gem.Import') PythonCodec = import_module('codecs') python_encode_ascii = PythonCodec.getencoder('ascii') @export def encode_ascii(s): return python_encode_ascii(s)[0]
19.375
57
0.648387
38
310
5.105263
0.631579
0.170103
0.175258
0
0
0
0
0
0
0
0
0.020747
0.222581
310
15
58
20.666667
0.784232
0.167742
0
0
0
0
0.119048
0
0
0
0
0
0
1
0.25
false
0
0.25
0.125
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
1
1
0
0
3
b6fbd21958b4036a13c89be9fe3169978326cfca
107
py
Python
Python Programs/Sum of 2 numbers.py
fe2o3Akshay/letshack
a72a29f8916731765efa518ba9cf54f102e2bc97
[ "MIT" ]
8
2020-10-02T15:20:45.000Z
2020-10-13T07:00:05.000Z
Python Programs/Sum of 2 numbers.py
fe2o3Akshay/letshack
a72a29f8916731765efa518ba9cf54f102e2bc97
[ "MIT" ]
6
2020-10-04T05:39:31.000Z
2020-10-17T12:32:51.000Z
Python Programs/Sum of 2 numbers.py
fe2o3Akshay/letshack
a72a29f8916731765efa518ba9cf54f102e2bc97
[ "MIT" ]
96
2020-10-04T04:55:56.000Z
2020-10-30T09:56:05.000Z
num1 = 1.5 num2 = 6.3 sum = num1 + num2 print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))
11.888889
62
0.570093
22
107
2.772727
0.681818
0.262295
0
0
0
0
0
0
0
0
0
0.158537
0.233645
107
8
63
13.375
0.585366
0
0
0
0
0
0.271028
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
8e3b25861fb94c981244f3eb0bb7cfef23817062
298
wsgi
Python
myapp.wsgi
metaperl/freegold-focus
49cf86be57c76b265f711e337f85d8ee2b156301
[ "MIT" ]
null
null
null
myapp.wsgi
metaperl/freegold-focus
49cf86be57c76b265f711e337f85d8ee2b156301
[ "MIT" ]
null
null
null
myapp.wsgi
metaperl/freegold-focus
49cf86be57c76b265f711e337f85d8ee2b156301
[ "MIT" ]
null
null
null
# -*- python -*- # core import os import sys # 3rd party import cherrypy # local def full_path(*extra): return os.path.join(os.path.dirname(__file__), *extra) sys.path.insert(0, full_path()) import config import myapp application = cherrypy.Application(myapp.Root(), "/", config.config)
14.190476
68
0.704698
41
298
4.97561
0.560976
0.078431
0
0
0
0
0
0
0
0
0
0.007874
0.147651
298
20
69
14.9
0.795276
0.11745
0
0
0
0
0.003876
0
0
0
0
0
0
1
0.111111
false
0
0.555556
0.111111
0.777778
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
3
8e4b7f47baaedb8b363aea4f7d027abef94928fa
2,918
py
Python
tests/test_parse_idx.py
DEVESHTARASIA/mnist-1
7e4d8e78a5c61bbbfb7f135f12d020e0597be3eb
[ "BSD-3-Clause" ]
null
null
null
tests/test_parse_idx.py
DEVESHTARASIA/mnist-1
7e4d8e78a5c61bbbfb7f135f12d020e0597be3eb
[ "BSD-3-Clause" ]
null
null
null
tests/test_parse_idx.py
DEVESHTARASIA/mnist-1
7e4d8e78a5c61bbbfb7f135f12d020e0597be3eb
[ "BSD-3-Clause" ]
null
null
null
import io import unittest try: from unittest import mock except ImportError: import mock # py2 import numpy as np import mnist class TestParseIdx(unittest.TestCase): """Test that IDX files are parsed correctly""" def test_empty_file_raises_exception(self): fd = io.BytesIO(b'') with self.assertRaises(mnist.IdxDecodeError): mnist.parse_idx(fd) def test_missing_header_raises_exception(self): fd = io.BytesIO(b'\x00') with self.assertRaises(mnist.IdxDecodeError): mnist.parse_idx(fd) def test_missing_initial_zeros_raises_exception(self): fd = io.BytesIO(b'\xff\xff\x08\x00') with self.assertRaises(mnist.IdxDecodeError): mnist.parse_idx(fd) def test_unknown_data_type_raises_error(self): fd = io.BytesIO(b'\x00\x00\xff\x00') with self.assertRaises(mnist.IdxDecodeError): mnist.parse_idx(fd) def test_missing_items_raises_error(self): fd = io.BytesIO(b'\x00\x00\x08\x01' b'\x00\x00\x00\x02' b'\xff') with self.assertRaises(mnist.IdxDecodeError): mnist.parse_idx(fd) def test_unexpected_items_raises_error(self): fd = io.BytesIO(b'\x00\x00\x08\x01' b'\x00\x00\x00\x02' b'\x00\x01\x02') with self.assertRaises(mnist.IdxDecodeError): mnist.parse_idx(fd) def test_file_with_one_dimension_returns_correct_values(self): fd = io.BytesIO(b'\x00\x00\x08\x01' b'\x00\x00\x00\x02' b'\xff\x00') actual = mnist.parse_idx(fd) self.assertIsInstance(actual, np.ndarray) self.assertEqual([255, 0], actual.tolist()) def test_file_with_two_dimensions_returns_correct_values(self): fd = io.BytesIO(b'\x00\x00\x08\x02' b'\x00\x00\x00\x02' b'\x00\x00\x00\x03' b'\x00\x01\x02\x03\x04\x05') actual = mnist.parse_idx(fd) self.assertIsInstance(actual, np.ndarray) self.assertEqual([[0, 1, 2], [3, 4, 5]], actual.tolist()) def test_file_with_int_type_returns_correct_values(self): fd = io.BytesIO(b'\x00\x00\x0c\x01' b'\x00\x00\x00\x01' b'\x00\x00\x00\xff') # two's complement of 255 actual = mnist.parse_idx(fd) self.assertIsInstance(actual, np.ndarray) self.assertEqual([255], actual.tolist()) def test_file_with_negative_int_returns_correct_values(self): fd = io.BytesIO(b'\x00\x00\x0c\x01' b'\x00\x00\x00\x01' b'\xff\xff\xff\xff') # two's complement of -1 actual = mnist.parse_idx(fd) self.assertIsInstance(actual, np.ndarray) self.assertEqual([-1], actual.tolist())
36.475
71
0.596984
379
2,918
4.427441
0.208443
0.082241
0.062574
0.089392
0.787843
0.75447
0.706198
0.638856
0.638856
0.61919
0
0.076149
0.284441
2,918
79
72
36.936709
0.72749
0.031528
0
0.469697
0
0
0.114975
0.008517
0
0
0
0
0.212121
1
0.151515
false
0
0.106061
0
0.272727
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
f3cc772b6d8f96b49fe91023cf2b5f5714eeb191
357
py
Python
mboot/connection/__init__.py
robin-nitrokey/pyMBoot
ffcfecb9b12ee80683b57395c9c12758f6596b96
[ "BSD-3-Clause" ]
4
2019-04-24T09:57:27.000Z
2021-08-24T03:41:27.000Z
mboot/connection/__init__.py
robin-nitrokey/pyMBoot
ffcfecb9b12ee80683b57395c9c12758f6596b96
[ "BSD-3-Clause" ]
4
2019-04-24T09:59:09.000Z
2022-02-09T06:33:51.000Z
mboot/connection/__init__.py
robin-nitrokey/pyMBoot
ffcfecb9b12ee80683b57395c9c12758f6596b96
[ "BSD-3-Clause" ]
4
2019-06-18T07:54:04.000Z
2021-07-04T02:55:40.000Z
# Copyright (c) 2019 Martin Olejar # # SPDX-License-Identifier: BSD-3-Clause # The BSD-3-Clause license for this file can be found in the LICENSE file included with this distribution # or at https://spdx.org/licenses/BSD-3-Clause.html#licenseText from .base import DevConnBase from .usb import scan_usb, RawHid from .uart import scan_uart, Uart
32.454545
106
0.756303
57
357
4.701754
0.649123
0.044776
0.11194
0
0
0
0
0
0
0
0
0.023411
0.162465
357
10
107
35.7
0.87291
0.658263
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
f3d2d2eb4957bdfdc20f6d67a2c5509d5addce27
177
py
Python
examples/misc/BUILD.py
jachris/cook
dd451e11f9aef05ba54bd57cf03e941526ffceef
[ "MIT" ]
130
2017-07-27T15:29:50.000Z
2021-10-04T22:10:23.000Z
examples/misc/BUILD.py
jachris/cook
dd451e11f9aef05ba54bd57cf03e941526ffceef
[ "MIT" ]
25
2017-07-27T19:54:25.000Z
2020-02-22T16:15:06.000Z
examples/misc/BUILD.py
jachris/cook
dd451e11f9aef05ba54bd57cf03e941526ffceef
[ "MIT" ]
2
2017-08-02T02:52:28.000Z
2017-08-03T06:27:31.000Z
from cook import misc misc.run( inputs=['copy_me.txt'], outputs=['copied.txt'], command=['cp', '$INPUTS', '$OUTPUTS'], message='Doing that crazy copy stuff.' )
19.666667
42
0.615819
23
177
4.695652
0.782609
0
0
0
0
0
0
0
0
0
0
0
0.186441
177
8
43
22.125
0.75
0
0
0
0
0
0.372881
0
0
0
0
0
0
1
0
true
0
0.142857
0
0.142857
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
f3d94f294ad7343c758602f623484aafd1d6ff38
308
py
Python
cla_backend/apps/core/mail/backends.py
uk-gov-mirror/ministryofjustice.cla_backend
4d524c10e7bd31f085d9c5f7bf6e08a6bb39c0a6
[ "MIT" ]
3
2019-10-02T15:31:03.000Z
2022-01-13T10:15:53.000Z
cla_backend/apps/core/mail/backends.py
uk-gov-mirror/ministryofjustice.cla_backend
4d524c10e7bd31f085d9c5f7bf6e08a6bb39c0a6
[ "MIT" ]
206
2015-01-02T16:50:11.000Z
2022-02-16T20:16:05.000Z
cla_backend/apps/core/mail/backends.py
uk-gov-mirror/ministryofjustice.cla_backend
4d524c10e7bd31f085d9c5f7bf6e08a6bb39c0a6
[ "MIT" ]
6
2015-03-23T23:08:42.000Z
2022-02-15T17:04:44.000Z
# coding=utf-8 from django.conf import settings from django.core.mail.backends import smtp class TimeoutEmailBackend(smtp.EmailBackend): def __init__(self, *args, **kwargs): kwargs.setdefault("timeout", settings.EMAIL_TIMEOUT) super(TimeoutEmailBackend, self).__init__(*args, **kwargs)
30.8
66
0.743506
36
308
6.111111
0.666667
0.090909
0
0
0
0
0
0
0
0
0
0.003774
0.13961
308
9
67
34.222222
0.826415
0.038961
0
0
0
0
0.02381
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
f3dd27fde9928137e5f22b7a3673a3b479afde1e
650
py
Python
util/OpenElevationsWrapper.py
data301-2021-winter1/project-group53
b7dcb43527f6aac1f3e4028f1eb9757d1cb5fea0
[ "MIT" ]
null
null
null
util/OpenElevationsWrapper.py
data301-2021-winter1/project-group53
b7dcb43527f6aac1f3e4028f1eb9757d1cb5fea0
[ "MIT" ]
null
null
null
util/OpenElevationsWrapper.py
data301-2021-winter1/project-group53
b7dcb43527f6aac1f3e4028f1eb9757d1cb5fea0
[ "MIT" ]
null
null
null
import requests class OpenElevationsApi: URI = "https://api.open-elevation.com/api/v1/lookup" LOCATIONS = list() def withLoc(self, lat, long) -> None: self.LOCATIONS.append({ "latitude": lat, "longitude": long }) def withMultipleLoc(self, locations: list) -> None: self.LOCATIONS = locations def constructBody(self): return { "locations": self.LOCATIONS } def get(self): raise NotImplementedError("OpenElevationsApi.get() is not implemented") def post(self): return requests.post(self.URI, json=self.constructBody())
26
79
0.601538
65
650
6.015385
0.523077
0.132992
0.086957
0
0
0
0
0
0
0
0
0.002141
0.281538
650
25
80
26
0.835118
0
0
0
0
0
0.172043
0.03533
0
0
0
0
0
1
0.263158
false
0
0.052632
0.105263
0.578947
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
f3e66e8653579622d471250c2301e937640f5a8a
2,154
py
Python
python/zpmanga/main.py
zpace/zpmanga
320ac59e5cdf4c62b24165945d9a194b80ea07a2
[ "BSD-3-Clause" ]
5
2019-04-11T13:35:24.000Z
2019-11-14T06:12:51.000Z
python/datamodel_parser/main.py
sdss/datamodel_parser
a4ff123ff7daf88e7402a7d50c38141d206e8054
[ "BSD-3-Clause" ]
49
2018-09-29T01:03:25.000Z
2020-05-12T15:54:55.000Z
python/datamodel_parser/main.py
sdss/datamodel_parser
a4ff123ff7daf88e7402a7d50c38141d206e8054
[ "BSD-3-Clause" ]
5
2018-09-20T22:07:43.000Z
2021-01-15T07:13:38.000Z
# encoding: utf-8 # # @Author: José Sánchez-Gallego # @Date: Oct 12, 2017 # @Filename: main.py # @License: BSD 3-Clause # @Copyright: José Sánchez-Gallego from __future__ import division from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals import operator __all__ = ('math', 'MyClass') def math(arg1, arg2, arith_operator='+'): """Performs an arithmetic operation. This function accepts to numbers and performs an arithmetic operation with them. The arithmetic operation can be passed as a string. By default, the addition operator is assumed. Parameters: arg1,arg2 (float): The numbers that we will sub/subtract/multiply/divide. arith_operator ({'+', '-', '*', '/'}): A string indicating the arithmetic operation to perform. Returns: result (float): The result of the arithmetic operation. Example: >>> math(2, 2, arith_operator='*') >>> 4 """ str_to_operator = {'+': operator.add, '-': operator.sub, '*': operator.mul, '/': operator.truediv} return str_to_operator[arith_operator](arg1, arg2) class MyClass(object): """A description of the class. The top docstring in a class describes the class in general, and the parameters to be passed to the class ``__init__``. Parameters: arg1 (float): The first argument. arg2 (int): The second argument. kwarg1 (str): A keyword argument. Attributes: name (str): A description of what names gives acces to. """ def __init__(self, arg1, arg2, kwarg1='a'): self.name = arg1 def do_something(self): """A description of what this method does.""" pass def do_something_else(self, param): """A description of what this method does. If the class only has one or two arguments, you can describe them inline. ``param`` is the parameter that we use to do something else. """ pass
24.202247
78
0.615599
259
2,154
4.957529
0.471042
0.073988
0.049844
0.042056
0.049844
0.049844
0.049844
0
0
0
0
0.015666
0.288765
2,154
88
79
24.477273
0.822454
0.595636
0
0.105263
0
0
0.024079
0
0
0
0
0
0
1
0.210526
false
0.105263
0.263158
0
0.578947
0.052632
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
f3f143b6506e34de70d9253f5610badf3e0332aa
708
py
Python
scraping/xtremeloader.py
jeremejazz/my-scripts
ed1daf51b08e9679eaedac13731aa025f60c8aea
[ "MIT" ]
null
null
null
scraping/xtremeloader.py
jeremejazz/my-scripts
ed1daf51b08e9679eaedac13731aa025f60c8aea
[ "MIT" ]
1
2019-12-11T07:45:14.000Z
2019-12-11T10:58:55.000Z
scraping/xtremeloader.py
jeremejazz/my-scripts
ed1daf51b08e9679eaedac13731aa025f60c8aea
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 """ Xtremeloader reloaded... Lookup for lx products sample curl calls: curl -d 'state=productlist&substate=categorized&category=Cellphone+EPINs' -X POST 'https://loadxtreme.ph/cgi-bin/ajax.cgi' (refer to xtremeloader repo) List of cat: [Cellphone EPINs] [Internet / Broadband] - Internet / Broadband </option> [Landline] - Landline </option> [Online Entertainment] - Online Entertainment </option> [Online Games] - Online Games </option> [Over-The-Air (OTA)] - Over-The-Air (OTA) </option> [Satellite / Cable TV] - Satellite / Cable TV </option> [Utilities] - Utilities </option> [myLIFE] - myLIFE </option> """ if __name__ == '__main__': print("Hello, World!")
22.125
122
0.694915
86
708
5.627907
0.651163
0.057851
0.041322
0.053719
0
0
0
0
0
0
0
0.001658
0.148305
708
32
123
22.125
0.800995
0.909605
0
0
0
0
0.381818
0
0
0
0
0
0
1
0
true
0
0
0
0
0.5
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
3
6d0f7eba402ccdf8d01eb6b4e946a9403a84e13e
1,364
py
Python
tlib/platform/shell/__init__.py
txu2008/TXLIB
402f3730e8710803675736e0f2e25719cd646409
[ "MIT" ]
1
2019-08-08T05:06:28.000Z
2019-08-08T05:06:28.000Z
tlib/platform/shell/__init__.py
txu2008/TXLIB
402f3730e8710803675736e0f2e25719cd646409
[ "MIT" ]
1
2020-03-24T05:53:20.000Z
2020-03-24T05:53:20.000Z
tlib/platform/shell/__init__.py
txu2008/TXLIB
402f3730e8710803675736e0f2e25719cd646409
[ "MIT" ]
null
null
null
# !/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/8/8 12:49 # @Author : Tao.Xu # @Email : tao.xu2008@outlook.com """ :description: shell related module """ # import os # import time # import sys # import shutil # import signal # import random # import hashlib # import warnings # import datetime # import threading # import traceback # import subprocess # import collections # import tlib # from tlib import exceptions as err from tlib.platform.shell import oper from tlib.platform.shell.oper import md5file from tlib.platform.shell.oper import kill9_byname from tlib.platform.shell.oper import del_if_exist from tlib.platform.shell.oper import execshell from tlib.platform.shell.oper import execshell_withpipe from tlib.platform.shell.oper import execshell_withpipe_exwitherr from tlib.platform.shell.oper import is_proc_alive from tlib.platform.shell.oper import forkexe_shell from tlib.platform.shell.oper import execshell_withpipe_ex from tlib.platform.shell.oper import execshell_withpipe_str from tlib.platform.shell.oper import ShellExec from tlib.platform.shell.oper import rmtree from tlib.platform.shell.oper import Asynccontent _DEPRECATED_MSG = '''Plz use class tlib.shell.ShellExec instead. Function %s deprecated''' def _test(): pass __all__ = [ 'oper', 'expect' ] if __name__ == '__main__': _test()
22.733333
76
0.767595
191
1,364
5.329843
0.39267
0.117878
0.220039
0.288802
0.471513
0.471513
0.227898
0.188605
0
0
0
0.01453
0.142229
1,364
59
77
23.118644
0.855556
0.293255
0
0
0
0
0.090715
0
0
0
0
0
0
1
0.041667
false
0.041667
0.583333
0
0.625
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
6d157b3fc2946aabe0bcffad6d1e657b19ba26a1
721
py
Python
backend/doppelkopf/users.py
AlexRogalskiy/doppelkopf
cbfc95d56f102ab8e01e194603e9f4abf09e2e14
[ "MIT" ]
38
2018-02-14T19:28:00.000Z
2022-03-30T07:28:12.000Z
backend/doppelkopf/users.py
hamvocke/doppelkopf
b820619be2e9424df5aca83491d96c0a0af6f2a5
[ "MIT" ]
57
2018-10-01T10:54:32.000Z
2022-02-08T23:26:40.000Z
backend/doppelkopf/users.py
AlexRogalskiy/doppelkopf
cbfc95d56f102ab8e01e194603e9f4abf09e2e14
[ "MIT" ]
11
2018-12-17T17:02:31.000Z
2022-03-10T17:47:07.000Z
from datetime import datetime from flask_login import UserMixin import doppelkopf.login from .db import db class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True, autoincrement=True) username = db.Column(db.String(32), unique=True, nullable=False) created_at = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) password_hash = db.Column(db.LargeBinary(60), nullable=False) def __repr__(self) -> str: return f"<User: {self.id}, {self.username}>" def get_id(self) -> str: return str(self.id) def is_correct_password(self, plaintext: str) -> bool: return doppelkopf.login.crypt.check_password_hash(self.password_hash, plaintext)
31.347826
88
0.718447
100
721
5.04
0.45
0.063492
0.079365
0
0
0
0
0
0
0
0
0.006634
0.163662
721
22
89
32.772727
0.829187
0
0
0
0
0
0.047157
0
0
0
0
0
0
1
0.2
false
0.2
0.266667
0.2
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
1
1
0
0
3
6d2bdff4763b57e8d4392d9ef59a1adf6a36a15b
624
py
Python
app/jobHistory/migrations/0004_auto_20190804_1411.py
stephengtuggy/job-history
5c4931ff7b594494a687da0253262c7fc46f8b13
[ "MIT" ]
2
2020-01-18T00:39:35.000Z
2020-01-18T02:03:26.000Z
app/jobHistory/migrations/0004_auto_20190804_1411.py
stephengtuggy/job-history
5c4931ff7b594494a687da0253262c7fc46f8b13
[ "MIT" ]
18
2020-08-07T23:22:37.000Z
2021-06-10T18:38:42.000Z
app/jobHistory/migrations/0004_auto_20190804_1411.py
stephengtuggy/job-history
5c4931ff7b594494a687da0253262c7fc46f8b13
[ "MIT" ]
null
null
null
# Generated by Django 2.2.4 on 2019-08-04 21:11 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('jobHistory', '0003_auto_20190804_1403'), ] operations = [ migrations.AlterModelOptions( name='employer', options={'verbose_name': 'Employer'}, ), migrations.AlterModelOptions( name='jobtimeperiod', options={'verbose_name': 'Job Time Period'}, ), migrations.AlterModelOptions( name='position', options={'verbose_name': 'Position'}, ), ]
24
56
0.573718
54
624
6.518519
0.62963
0.230114
0.264205
0
0
0
0
0
0
0
0
0.071429
0.304487
624
25
57
24.96
0.739631
0.072115
0
0.315789
1
0
0.22357
0.039861
0
0
0
0
0
1
0
false
0
0.052632
0
0.210526
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
6d3e977f7885f09f1b9e4ab8e08e38d8b8089d20
345
py
Python
linked_list/node.py
MateuszMazurkiewicz/LinkedList
7a371f3d51079d2391242245e19d369d03181b6f
[ "MIT" ]
null
null
null
linked_list/node.py
MateuszMazurkiewicz/LinkedList
7a371f3d51079d2391242245e19d369d03181b6f
[ "MIT" ]
null
null
null
linked_list/node.py
MateuszMazurkiewicz/LinkedList
7a371f3d51079d2391242245e19d369d03181b6f
[ "MIT" ]
null
null
null
class Node: def __init__(self, value): self.value = value self.next = None self.previous = None def remove_node(self): if self.next: self.next.previous = self.previous if self.previous: self.previous.next = self.next self.next = None self.previous = None
23
46
0.55942
41
345
4.585366
0.268293
0.212766
0.191489
0.170213
0.297872
0.297872
0
0
0
0
0
0
0.353623
345
15
47
23
0.843049
0
0
0.333333
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0
0
0.25
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
6d53377896557b8992fda0c987918270f39da774
524
py
Python
project_euler/problem_06/test_solutions.py
AjaySinghPanwar/Python
a0bac6ab65b70bca4886962bde8d4c922a90c63a
[ "MIT" ]
14
2020-10-03T05:43:48.000Z
2021-11-01T21:02:26.000Z
project_euler/problem_06/test_solutions.py
AjaySinghPanwar/Python
a0bac6ab65b70bca4886962bde8d4c922a90c63a
[ "MIT" ]
1
2020-09-30T18:29:44.000Z
2020-09-30T18:29:44.000Z
project_euler/problem_06/test_solutions.py
AjaySinghPanwar/Python
a0bac6ab65b70bca4886962bde8d4c922a90c63a
[ "MIT" ]
12
2020-10-03T05:44:19.000Z
2022-01-16T05:37:54.000Z
from .sol1 import solution as sol1 from .sol2 import solution as sol2 from .sol3 import solution as sol3 from .sol4 import solution as sol4 def test_solutions() -> None: """ >>> test_solutions() """ assert sol1(10) == sol2(10) == sol3(10) == sol4(10) == 2640 assert sol1(15) == sol2(15) == sol3(15) == sol4(15) == 13160 assert sol1(20) == sol2(20) == sol3(20) == sol4(20) == 41230 assert sol1(50) == sol2(50) == sol3(50) == sol4(50) == 1582700 if __name__ == "__main__": test_solutions()
27.578947
66
0.610687
75
524
4.12
0.32
0.18123
0.20712
0
0
0
0
0
0
0
0
0.187348
0.215649
524
18
67
29.111111
0.564477
0.038168
0
0
0
0
0.016393
0
0
0
0
0
0.363636
1
0.090909
true
0
0.363636
0
0.454545
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
3
6d599b089b5dafef5a470c767fbb6d3ff3b069e9
1,987
py
Python
python/tests/test_pymarrow.py
Adriandorr/merge-arrow
8cb2893d8f87b64639c38dc89e2ffda86276e419
[ "Apache-2.0" ]
null
null
null
python/tests/test_pymarrow.py
Adriandorr/merge-arrow
8cb2893d8f87b64639c38dc89e2ffda86276e419
[ "Apache-2.0" ]
null
null
null
python/tests/test_pymarrow.py
Adriandorr/merge-arrow
8cb2893d8f87b64639c38dc89e2ffda86276e419
[ "Apache-2.0" ]
1
2020-10-09T12:30:30.000Z
2020-10-09T12:30:30.000Z
import unittest import pyarrow import pymarrow import pandas as pd class TestPyMarrow(unittest.TestCase): def test_add_index(self): batch = pyarrow.RecordBatch.from_arrays([ [5, 4, 3, 2, 1], [1, 2, 3, 4, 5] ], ["a", "b"]) actual = pymarrow.add_index(batch, ["a"]) expected = pyarrow.RecordBatch.from_arrays([ pyarrow.array([4, 3, 2, 1, 0], pyarrow.int8()), [5, 4, 3, 2, 1], [1, 2, 3, 4, 5] ], ["__marrow_index", "a", "b"], metadata={"_marrow:index": "a"}) pd.testing.assert_frame_equal(actual.to_pandas(), expected.to_pandas()) self.assertTrue(actual.equals(expected)) def test_sort(self): batch = pyarrow.RecordBatch.from_arrays([ [5, 4, 3, 2, 1], [1, 2, 3, 4, 5] ], ["a", "b"]) actual = pymarrow.sort(batch, ["a"]) expected = pyarrow.RecordBatch.from_arrays([ [1, 2, 3, 4, 5], [5, 4, 3, 2, 1] ], ["a", "b"], metadata={"_marrow:index": "a"}) pd.testing.assert_frame_equal(actual.to_pandas(), expected.to_pandas()) self.assertTrue(actual.equals(expected)) def test_merge(self): batch1 = pyarrow.RecordBatch.from_arrays([ [1, 1, 2, 3, 4, 5], [6, 5, 4, 3, 2, 1] ], ["a", "b"], metadata={"_marrow:index": "a"}) batch2 = pyarrow.RecordBatch.from_arrays([ [1, 2, 3, 4, 5, 5], [5, 4, 3, 2, 1, 0] ], ["a", "c"], metadata={"_marrow:index": "a"}) actual = pymarrow.merge(batch1, batch2, on=["a"], how="inner") expected = pyarrow.RecordBatch.from_arrays([ [1, 1, 2, 3, 4, 5, 5], [6, 5, 4, 3, 2, 1, 1], [5, 5, 4, 3, 2, 1, 0] ], ["a", "b", "c"]) pd.testing.assert_frame_equal(actual.to_pandas(), expected.to_pandas()) self.assertTrue(actual.equals(expected)) if __name__ == '__main__': unittest.main()
36.127273
79
0.514847
262
1,987
3.755725
0.198473
0.018293
0.027439
0.036585
0.732724
0.727642
0.718496
0.653455
0.638211
0.638211
0
0.067809
0.294917
1,987
54
80
36.796296
0.634547
0
0
0.428571
0
0
0.05083
0
0
0
0
0
0.122449
1
0.061224
false
0
0.081633
0
0.163265
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
6d5aa17f78d0d846ab0a4f9bd8baf3e842736fe9
167
py
Python
dunderscore/__init__.py
rectangletangle/dunderscore
8ef1c2c404c6e2c626f0f675607cd459500bb83b
[ "BSD-3-Clause" ]
null
null
null
dunderscore/__init__.py
rectangletangle/dunderscore
8ef1c2c404c6e2c626f0f675607cd459500bb83b
[ "BSD-3-Clause" ]
null
null
null
dunderscore/__init__.py
rectangletangle/dunderscore
8ef1c2c404c6e2c626f0f675607cd459500bb83b
[ "BSD-3-Clause" ]
null
null
null
""" Dunderscore, useful functions for Python 2 or 3 """ from .__ import (chunked, overlapped, grouped, pluralized)
23.857143
55
0.508982
14
167
5.928571
1
0
0
0
0
0
0
0
0
0
0
0.020408
0.413174
167
6
56
27.833333
0.826531
0.281437
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.25
0
0.25
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
ed92921b24ba68e7344aa61ea555f536f388b525
148
py
Python
programmers/Coding Test High-Score Kit/Tile Decoration.py
will-data/Self-Study-WIL
69d627c65130fcfa23f27f97948a20107bb33394
[ "MIT" ]
1
2020-04-11T09:51:54.000Z
2020-04-11T09:51:54.000Z
programmers/Coding Test High-Score Kit/Tile Decoration.py
will-data/Self-Study-WIL
69d627c65130fcfa23f27f97948a20107bb33394
[ "MIT" ]
null
null
null
programmers/Coding Test High-Score Kit/Tile Decoration.py
will-data/Self-Study-WIL
69d627c65130fcfa23f27f97948a20107bb33394
[ "MIT" ]
null
null
null
def solution(N): n = 0; current = 1; nex = 1 while n <N-1: current, nex = nex, current+nex n +=1 return 2*(current+nex)
21.142857
39
0.513514
24
148
3.166667
0.416667
0.394737
0
0
0
0
0
0
0
0
0
0.061856
0.344595
148
6
40
24.666667
0.721649
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0
0
0.333333
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
edac796116a7152a597fdef94ba34e5434c1e0e2
9,364
py
Python
networkx/algorithms/approximation/tests/test_treewidth.py
rakschahsa/networkx
6cac55b1064c3c346665f9281680fa3b66442ad0
[ "BSD-3-Clause" ]
445
2019-01-26T13:50:26.000Z
2022-03-18T05:17:38.000Z
Library/lib/python3.7/site-packages/networkx/algorithms/approximation/tests/test_treewidth.py
gengyong/Carnets
8930a14f69360d4db115a85ff9e0f6efa80fa2e7
[ "BSD-3-Clause" ]
242
2019-01-29T15:48:27.000Z
2022-03-31T22:09:21.000Z
site-packages/networkx/algorithms/approximation/tests/test_treewidth.py
Wristlebane/Pyto
901ac307b68486d8289105c159ca702318bea5b0
[ "MIT" ]
31
2019-03-10T09:51:27.000Z
2022-02-14T23:11:12.000Z
# -*- coding: utf-8 -*- # Copyright (C) 2018 by # Rudolf-Andreas Floren <rudi.floren@gmail.com> # Dominik Meier <dominik.meier@rwth-aachen.de> # All rights reserved. # BSD license. import networkx as nx from nose.tools import assert_equals, ok_ from networkx.algorithms.approximation import treewidth_min_degree from networkx.algorithms.approximation import treewidth_min_fill_in from networkx.algorithms.approximation.treewidth import min_fill_in_heuristic from networkx.algorithms.approximation.treewidth import MinDegreeHeuristic import itertools def is_tree_decomp(graph, decomp): """Check if the given tree decomposition is valid.""" for x in graph.nodes(): appear_once = False for bag in decomp.nodes(): if x in bag: appear_once = True break ok_(appear_once) # Check if each connected pair of nodes are at least once together in a bag for (x, y) in graph.edges(): appear_together = False for bag in decomp.nodes(): if x in bag and y in bag: appear_together = True break ok_(appear_together) # Check if the nodes associated with vertex v form a connected subset of T for v in graph.nodes(): subset = [] for bag in decomp.nodes(): if v in bag: subset.append(bag) sub_graph = decomp.subgraph(subset) ok_(nx.is_connected(sub_graph)) class TestTreewidthMinDegree(object): """Unit tests for the min_degree function""" def setUp(self): """Setup for different kinds of trees""" self.complete = nx.Graph() self.complete.add_edge(1, 2) self.complete.add_edge(2, 3) self.complete.add_edge(1, 3) self.small_tree = nx.Graph() self.small_tree.add_edge(1, 3) self.small_tree.add_edge(4, 3) self.small_tree.add_edge(2, 3) self.small_tree.add_edge(3, 5) self.small_tree.add_edge(5, 6) self.small_tree.add_edge(5, 7) self.small_tree.add_edge(6, 7) self.deterministic_graph = nx.Graph() self.deterministic_graph.add_edge(0, 1) # deg(0) = 1 self.deterministic_graph.add_edge(1, 2) # deg(1) = 2 self.deterministic_graph.add_edge(2, 3) self.deterministic_graph.add_edge(2, 4) # deg(2) = 3 self.deterministic_graph.add_edge(3, 4) self.deterministic_graph.add_edge(3, 5) self.deterministic_graph.add_edge(3, 6) # deg(3) = 4 self.deterministic_graph.add_edge(4, 5) self.deterministic_graph.add_edge(4, 6) self.deterministic_graph.add_edge(4, 7) # deg(4) = 5 self.deterministic_graph.add_edge(5, 6) self.deterministic_graph.add_edge(5, 7) self.deterministic_graph.add_edge(5, 8) self.deterministic_graph.add_edge(5, 9) # deg(5) = 6 self.deterministic_graph.add_edge(6, 7) self.deterministic_graph.add_edge(6, 8) self.deterministic_graph.add_edge(6, 9) # deg(6) = 6 self.deterministic_graph.add_edge(7, 8) self.deterministic_graph.add_edge(7, 9) # deg(7) = 5 self.deterministic_graph.add_edge(8, 9) # deg(8) = 4 def test_petersen_graph(self): """Test Petersen graph tree decomposition result""" G = nx.petersen_graph() _, decomp = treewidth_min_degree(G) is_tree_decomp(G, decomp) def test_small_tree_treewidth(self): """Test small tree Test if the computed treewidth of the known self.small_tree is 2. As we know which value we can expect from our heuristic, values other than two are regressions """ G = self.small_tree # the order of removal should be [1,2,4]3[5,6,7] # (with [] denoting any order of the containing nodes) # resulting in treewidth 2 for the heuristic treewidth, _ = treewidth_min_fill_in(G) assert_equals(treewidth, 2) def test_heuristic_abort(self): """Test heuristic abort condition for fully connected graph""" graph = {} for u in self.complete: graph[u] = set() for v in self.complete[u]: if u != v: # ignore self-loop graph[u].add(v) deg_heuristic = MinDegreeHeuristic(graph) node = deg_heuristic.best_node(graph) if node is None: pass else: assert False def test_empty_graph(self): """Test empty graph""" G = nx.Graph() _, _ = treewidth_min_degree(G) def test_two_component_graph(self): """Test empty graph""" G = nx.Graph() G.add_node(1) G.add_node(2) treewidth, _ = treewidth_min_degree(G) assert_equals(treewidth, 0) def test_heuristic_first_steps(self): """Test first steps of min_degree heuristic""" graph = {n: set(self.deterministic_graph[n]) - set([n]) for n in self.deterministic_graph} deg_heuristic = MinDegreeHeuristic(graph) elim_node = deg_heuristic.best_node(graph) print("Graph {}:".format(graph)) steps = [] while elim_node is not None: print("Removing {}:".format(elim_node)) steps.append(elim_node) nbrs = graph[elim_node] for u, v in itertools.permutations(nbrs, 2): if v not in graph[u]: graph[u].add(v) for u in graph: if elim_node in graph[u]: graph[u].remove(elim_node) del graph[elim_node] print("Graph {}:".format(graph)) elim_node = deg_heuristic.best_node(graph) # check only the first 5 elements for equality assert_equals(steps[:5], [0, 1, 2, 3, 4]) class TestTreewidthMinFillIn(object): """Unit tests for the treewidth_min_fill_in function.""" def setUp(self): """Setup for different kinds of trees""" self.complete = nx.Graph() self.complete.add_edge(1, 2) self.complete.add_edge(2, 3) self.complete.add_edge(1, 3) self.small_tree = nx.Graph() self.small_tree.add_edge(1, 2) self.small_tree.add_edge(2, 3) self.small_tree.add_edge(3, 4) self.small_tree.add_edge(1, 4) self.small_tree.add_edge(2, 4) self.small_tree.add_edge(4, 5) self.small_tree.add_edge(5, 6) self.small_tree.add_edge(5, 7) self.small_tree.add_edge(6, 7) self.deterministic_graph = nx.Graph() self.deterministic_graph.add_edge(1, 2) self.deterministic_graph.add_edge(1, 3) self.deterministic_graph.add_edge(3, 4) self.deterministic_graph.add_edge(2, 4) self.deterministic_graph.add_edge(3, 5) self.deterministic_graph.add_edge(4, 5) self.deterministic_graph.add_edge(3, 6) self.deterministic_graph.add_edge(5, 6) def test_petersen_graph(self): """Test Petersen graph tree decomposition result""" G = nx.petersen_graph() _, decomp = treewidth_min_fill_in(G) is_tree_decomp(G, decomp) def test_small_tree_treewidth(self): """Test if the computed treewidth of the known self.small_tree is 2""" G = self.small_tree # the order of removal should be [1,2,4]3[5,6,7] # (with [] denoting any order of the containing nodes) # resulting in treewidth 2 for the heuristic treewidth, _ = treewidth_min_fill_in(G) assert_equals(treewidth, 2) def test_heuristic_abort(self): """Test if min_fill_in returns None for fully connected graph""" graph = {} for u in self.complete: graph[u] = set() for v in self.complete[u]: if u != v: # ignore self-loop graph[u].add(v) next_node = min_fill_in_heuristic(graph) if next_node is None: pass else: assert False def test_empty_graph(self): """Test empty graph""" G = nx.Graph() _, _ = treewidth_min_fill_in(G) def test_two_component_graph(self): """Test empty graph""" G = nx.Graph() G.add_node(1) G.add_node(2) treewidth, _ = treewidth_min_fill_in(G) assert_equals(treewidth, 0) def test_heuristic_first_steps(self): """Test first steps of min_fill_in heuristic""" graph = {n: set(self.deterministic_graph[n]) - set([n]) for n in self.deterministic_graph} print("Graph {}:".format(graph)) elim_node = min_fill_in_heuristic(graph) steps = [] while elim_node is not None: print("Removing {}:".format(elim_node)) steps.append(elim_node) nbrs = graph[elim_node] for u, v in itertools.permutations(nbrs, 2): if v not in graph[u]: graph[u].add(v) for u in graph: if elim_node in graph[u]: graph[u].remove(elim_node) del graph[elim_node] print("Graph {}:".format(graph)) elim_node = min_fill_in_heuristic(graph) # check only the first 2 elements for equality assert_equals(steps[:2], [6, 5])
34.553506
79
0.604336
1,283
9,364
4.213562
0.132502
0.064743
0.138365
0.129486
0.811691
0.791158
0.689604
0.615612
0.603219
0.602109
0
0.024494
0.293678
9,364
270
80
34.681481
0.792864
0.176207
0
0.687831
0
0
0.007927
0
0
0
0
0
0.047619
1
0.079365
false
0.010582
0.037037
0
0.126984
0.031746
0
0
0
null
0
0
0
1
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
edb6cc3cbd89fe1e48a350a3e7c970b99329e6e7
3,299
py
Python
packtpub_grabber/get_todays_book.py
cchitsiang/py-scripts
699b2a02f6dc14ebca7e1077f9faea31af6e2bb5
[ "MIT" ]
1
2017-02-20T20:56:54.000Z
2017-02-20T20:56:54.000Z
packtpub_grabber/get_todays_book.py
cchitsiang/py-scripts
699b2a02f6dc14ebca7e1077f9faea31af6e2bb5
[ "MIT" ]
null
null
null
packtpub_grabber/get_todays_book.py
cchitsiang/py-scripts
699b2a02f6dc14ebca7e1077f9faea31af6e2bb5
[ "MIT" ]
null
null
null
import BeautifulSoup import bs4 import json import requests import sys try: with open('config.json', 'r') as config_file: config = json.load(config_file) except IOError: print "'config.json' does not appear to exist! Exiting" sys.exit() try: config['email'] and config['password'] except KeyError: print "'config.json' Does not appear to have the proper items. Exiting" sys.exit() class login_invalid(Exception): pass def create_session(): s = requests.Session() s.headers.update({ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Encoding":"gzip, deflate, sdch", "Accept-Language": "en-US,en;q=0.8", "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36", "content-type": "application/x-www-form-urlencoded" }) headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Encoding":"gzip, deflate, sdch", "Accept-Language": "en-US,en;q=0.8", "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36", "content-type": "application/x-www-form-urlencoded" } def get_todays_title(): pckpub = requests.get("https://www.packtpub.com/packt/offers/free-learning", headers=headers) if pckpub.status_code == 200: soup = BeautifulSoup.BeautifulSoup(pckpub.text) todays_title = soup.find("div", {"class": "dotd-title"}).text countdown_to = soup.find("span", {"class": "packt-js-countdown"}).get('data-countdown-to') get_url = soup.find("a", {"class": "twelve-days-claim"}).get('href') return dict(title=todays_title, epoch=int(countdown_to), url=get_url, nid=get_url.split('/')[-2:-1][0]) else: raise Exception("Unable to fetch todays title") def login_and_request_book(get_url): sess = requests.Session() payload = { "email": config['email'], "password": config['password'], "op": "Login", "form_id": "packt_user_login_form", "form_build_id": "" } r = sess.post("https://www.packtpub.com/packt/offers/free-learning", data=payload, headers=headers) soup = BeautifulSoup.BeautifulSoup(r.text) if soup.find("div", {"class": "messages error"}): raise login_invalid("Login Issue. Username or password incorrect.") get_url = soup.find("a", {"class": "twelve-days-claim"}).get('href') get_book_url = "https://www.packtpub.com" + get_url get_da_book = sess.get(get_book_url, headers=headers, allow_redirects=False) if get_da_book.status_code == 302: return sess else: return False def verify_todays_book(prev_session): my_ebooks = prev_session.get('https://www.packtpub.com/account/my-ebooks', headers=headers, allow_redirects=False) #TODO fix this if my_ebooks.status_code == 302: return False soup = bs4.BeautifulSoup(my_ebooks.text) book_list = soup.find_all("div", class_="product-line unseen") last_book = book_list[0] nid = last_book.get('nid') title = last_book.get('title') return {'nid': nid, 'title': title}
34.726316
145
0.658988
466
3,299
4.542918
0.349785
0.005668
0.005668
0.0359
0.389702
0.346717
0.346717
0.318375
0.278696
0.278696
0
0.029194
0.179751
3,299
94
146
35.095745
0.753141
0.003941
0
0.266667
0
0.053333
0.384756
0.071646
0
0
0
0.010638
0
0
null
null
0.053333
0.066667
null
null
0.026667
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
1
0
0
0
0
0
3
611386182ceec3c2621afc3c50f53b8ee42b8e28
1,077
py
Python
turtc/path.py
richardbenson91477/pygames
922193a6ad6eb5d673d9635af887426f8e18316a
[ "Unlicense" ]
1
2021-12-04T01:18:54.000Z
2021-12-04T01:18:54.000Z
turtc/path.py
richardbenson91477/pygames
922193a6ad6eb5d673d9635af887426f8e18316a
[ "Unlicense" ]
null
null
null
turtc/path.py
richardbenson91477/pygames
922193a6ad6eb5d673d9635af887426f8e18316a
[ "Unlicense" ]
1
2021-09-12T11:31:10.000Z
2021-09-12T11:31:10.000Z
''' © 2014 Richard A. Benson <richardbenson91477@protonmail.com> ''' class Path: # curves, curves_n def __init__ (self): self.curves = [] self.curves_n = 0 def curve_eval (self, t): # NOTE: returns ints if not self.curves_n: return curve_c = int(t) t2 = t - float(curve_c) t2p3 = t2 ** 3 t2p2 = t2 ** 2 c1 = -1 * t2p3 + 3 * t2p2 + -3 * t2 + 1 c2 = 3 * t2p3 + -6 * t2p2 + 3 * t2 c3 = -3 * t2p3 + 3 * t2p2 c4 = t2p3 return ( int(c1 * self.curves[curve_c][0][0] +\ c2 * self.curves[curve_c][1][0] +\ c3 * self.curves[curve_c][2][0] +\ c4 * self.curves[curve_c][3][0]), int(c1 * self.curves[curve_c][0][1] +\ c2 * self.curves[curve_c][1][1] +\ c3 * self.curves[curve_c][2][1] +\ c4 * self.curves[curve_c][3][1])) def curve_add (self, p1, p2, p3, p4): self.curves.append([p1, p2, p3, p4]) self.curves_n += 1
29.108108
68
0.460539
151
1,077
3.15894
0.298013
0.272537
0.251572
0.268344
0.406709
0.406709
0.092243
0
0
0
0
0.121805
0.382544
1,077
36
69
29.916667
0.593985
0.090994
0
0
0
0
0
0
0
0
0
0
0
1
0.111111
false
0
0
0
0.222222
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
611bdfabee1817d1882cfb2ed0e966f91c07451f
124
py
Python
seo/views.py
omerturner/manakinproducts
373116a473bfa741672757cf064fbe2147e100c9
[ "MIT" ]
1
2016-05-07T13:59:38.000Z
2016-05-07T13:59:38.000Z
seo/views.py
omerturner/manakinproducts
373116a473bfa741672757cf064fbe2147e100c9
[ "MIT" ]
null
null
null
seo/views.py
omerturner/manakinproducts
373116a473bfa741672757cf064fbe2147e100c9
[ "MIT" ]
null
null
null
from .models import SEO def get_seos(request): context = {} context['seos'] = SEO.objects.all() return context
17.714286
39
0.653226
16
124
5
0.75
0
0
0
0
0
0
0
0
0
0
0
0.217742
124
6
40
20.666667
0.824742
0
0
0
0
0
0.032258
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
61288d87a4bcc8fe127ebea75015670a5d817a6f
180
py
Python
sensemaking.py
kogsio/coursecatalog
3d326f33e66bd3b58e47311eecfda5f96d474dff
[ "MIT" ]
null
null
null
sensemaking.py
kogsio/coursecatalog
3d326f33e66bd3b58e47311eecfda5f96d474dff
[ "MIT" ]
null
null
null
sensemaking.py
kogsio/coursecatalog
3d326f33e66bd3b58e47311eecfda5f96d474dff
[ "MIT" ]
null
null
null
from bs4 import BeautifulSoup data = open("./data.txt", "r") soup = BeautifulSoup(data, 'html.parser') courseTitles = soup.find_all('h3') print(courseTitles) print('Ran to end!')
22.5
41
0.716667
25
180
5.12
0.76
0.265625
0
0
0
0
0
0
0
0
0
0.0125
0.111111
180
8
42
22.5
0.7875
0
0
0
0
0
0.19337
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
0.333333
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
b6507a1c6ac1e1bc82f3a8d07bf617993bf2b171
4,255
py
Python
Hyena_Analyse_FeatureImportance.py
SysBioChalmers/Hyena
1cc60b08e25c1d49c70e16808b047671d3706e55
[ "MIT" ]
null
null
null
Hyena_Analyse_FeatureImportance.py
SysBioChalmers/Hyena
1cc60b08e25c1d49c70e16808b047671d3706e55
[ "MIT" ]
null
null
null
Hyena_Analyse_FeatureImportance.py
SysBioChalmers/Hyena
1cc60b08e25c1d49c70e16808b047671d3706e55
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Script to analyse the feature importance of the final model Part of the Hyena Toolbox (see https://github.com/SysBioChalmers/Hyena) @author: Christoph S. Börlin; Chalmers University of Technology, Gothenburg Sweden """ import pandas as pd import numpy as np import matplotlib.pyplot as plt from xgboost.sklearn import XGBRegressor import pickle #load model model_name = 'FeatureSelection_Model' model = pickle.load(open('Results/' + model_name + '.pkl', 'rb')) #get feature importance and convert into list feature_importance = [[key, value] for key, value in model.get_booster().get_score(importance_type='gain').items()] #add features with 0 importance for feature in model.get_booster().feature_names: if feature not in [x[0] for x in feature_importance]: feature_importance.append([feature, 0]) feature_importance.sort(key = lambda x: x[1], reverse = False) # #Plot feature importance # plt.figure(figsize = (6,16)) # ax = plt.gca() # plt.barh([x[0] for x in feature_importance], [x[1] for x in feature_importance]) # plt.xlabel('Feature importance', fontSize = 13) # ax.xaxis.set_tick_params(labelsize = 13) # ax.yaxis.set_tick_params(labelsize = 13) # ax.spines['top'].set_visible(False) # ax.spines['right'].set_visible(False) # plt.savefig('Results/FeatureImportance_' + model_name + '.png', dpi = 300, bbox_inches = 'tight') # plt.show() #Split feature importance by TF, type, condition and interval feature_importance_categories = ['tf', 'condition', 'feature type', 'interval'] feature_importance_split = {x : {} for x in feature_importance_categories} for fi in feature_importance: for tmp_cat, tmp_value in zip(feature_importance_categories, fi[0].split('_')): feature_importance_split[tmp_cat][tmp_value] = feature_importance_split[tmp_cat].get(tmp_value, []) + [fi[1]] #change interval names key_list = list(feature_importance_split['interval'].keys()) for key in key_list: new_key = key.replace('-', '\nto ') .replace('m', '-') feature_importance_split['interval'][new_key] = feature_importance_split['interval'].pop(key) #change feature type name feature_importance_split['feature type']['Count > 0'] = feature_importance_split['feature type'].pop('az') feature_importance_split['feature type']['Count < 0'] = feature_importance_split['feature type'].pop('bz') #convert dict into list for sorting feature_importance_split_list = {x : [] for x in feature_importance_split.keys()} for tmp_cat in feature_importance_split.keys(): for tmp_key, tmp_value in feature_importance_split[tmp_cat].items(): feature_importance_split_list[tmp_cat].append([tmp_key, np.mean(tmp_value)]) feature_importance_split_list[tmp_cat].sort(key = lambda x: x[1], reverse = True) #resort tf the other way feature_importance_split_list['tf'].sort(key = lambda x: x[1], reverse = False) plt.figure(figsize = (16.8 / 2.54, 16.8 / 2.54)) plt.rcParams['font.sans-serif'] = 'Arial' ax = {} ax[1] = plt.subplot2grid((3, 2), (0, 0), rowspan=3) ax[2] = plt.subplot2grid((3, 2), (0, 1)) ax[3] = plt.subplot2grid((3, 2), (1, 1)) ax[4] = plt.subplot2grid((3, 2), (2, 1)) ax[1].barh([x[0] for x in feature_importance_split_list['tf']], [x[1] for x in feature_importance_split_list['tf']]) ax[1].set_xlabel('Feature importance', fontSize = 11) ax[1].xaxis.set_tick_params(labelsize = 11) ax[1].yaxis.set_tick_params(labelsize = 11) ax[1].spines['top'].set_visible(False) ax[1].spines['right'].set_visible(False) ax[1].set_title('Grouped by transcription factor', fontSize = 12) #display it for condition interval and feature type for i, cat in enumerate(['condition', 'feature type', 'interval',]): ax[i + 2].bar([x[0] for x in feature_importance_split_list[cat]], [x[1] for x in feature_importance_split_list[cat]]) ax[i + 2].set_ylabel('Feature importance', fontSize = 11) ax[i + 2].xaxis.set_tick_params(labelsize = 11) ax[i + 2].yaxis.set_tick_params(labelsize = 11) ax[i + 2].spines['top'].set_visible(False) ax[i + 2].spines['right'].set_visible(False) ax[i + 2].set_title('Grouped by ' + cat, fontSize = 12) plt.tight_layout() plt.savefig('Results/FeatureImportanceSplit_' + model_name + '.png', dpi = 600, tight = True) plt.show()
44.322917
121
0.719624
650
4,255
4.529231
0.247692
0.219429
0.156929
0.039742
0.407269
0.318954
0.222826
0.149796
0.097147
0.050951
0
0.02667
0.127615
4,255
96
122
44.322917
0.766433
0.233843
0
0
0
0
0.110767
0.016399
0
0
0
0
0
1
0
false
0
0.537037
0
0.537037
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
b6519acc2709ff036cf215b723831cc3ae0d369b
505
py
Python
character/migrations/0005_auto_20200926_1845.py
cmerwin3/Adventure_Project
1816978e952f1250049e8d1e7fcf172620903596
[ "Apache-2.0" ]
null
null
null
character/migrations/0005_auto_20200926_1845.py
cmerwin3/Adventure_Project
1816978e952f1250049e8d1e7fcf172620903596
[ "Apache-2.0" ]
null
null
null
character/migrations/0005_auto_20200926_1845.py
cmerwin3/Adventure_Project
1816978e952f1250049e8d1e7fcf172620903596
[ "Apache-2.0" ]
null
null
null
# Generated by Django 3.1.1 on 2020-09-26 23:45 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('character', '0004_auto_20200926_1843'), ] operations = [ migrations.RenameField( model_name='character', old_name='item', new_name='items', ), migrations.RenameField( model_name='character', old_name='spell', new_name='spells', ), ]
21.041667
49
0.556436
50
505
5.44
0.66
0.154412
0.191176
0.220588
0.338235
0.338235
0.338235
0
0
0
0
0.091716
0.330693
505
23
50
21.956522
0.713018
0.089109
0
0.352941
1
0
0.152838
0.050218
0
0
0
0
0
1
0
false
0
0.058824
0
0.235294
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
b695928d07eb83963ad12731cf223e777d9a4df2
743
py
Python
webapi/serializer.py
erisenlee/django_rest
e358a80f7a7d9214decb7756e2a7838727d025a6
[ "Apache-2.0" ]
null
null
null
webapi/serializer.py
erisenlee/django_rest
e358a80f7a7d9214decb7756e2a7838727d025a6
[ "Apache-2.0" ]
null
null
null
webapi/serializer.py
erisenlee/django_rest
e358a80f7a7d9214decb7756e2a7838727d025a6
[ "Apache-2.0" ]
null
null
null
from rest_framework import serializers from .models import EndPoint,Host class HostSerializer(serializers.HyperlinkedModelSerializer): login_url = serializers.URLField(source='get_login_url', read_only=True) link = serializers.URLField(source='get_absolute_url', read_only=True) class Meta: model = Host fields = ['id', 'created', 'title', 'login_endpoint','login_url', 'username', 'password', 'is_delete','link'] # fields='__all__' class EndpointSerializer(serializers.ModelSerializer): link = serializers.URLField(source='get_absolute_url', read_only=True) class Meta: model = EndPoint fields=['id','created','endpoint','description','host','link']
41.277778
118
0.687752
79
743
6.240506
0.443038
0.048682
0.15213
0.170385
0.279919
0.279919
0.279919
0.279919
0.279919
0.279919
0
0
0.185734
743
18
119
41.277778
0.814876
0.021534
0
0.307692
0
0
0.207334
0
0
0
0
0
0
1
0
false
0.076923
0.153846
0
0.692308
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
1
0
0
1
0
0
3
b6a3e9206a18744de60afd8e0f8a0d6baf9441bb
413
py
Python
stk/__init__.py
sayerhs/pystk
e211a13b45929b8bfbfe891532ea19990a19d324
[ "Apache-2.0" ]
null
null
null
stk/__init__.py
sayerhs/pystk
e211a13b45929b8bfbfe891532ea19990a19d324
[ "Apache-2.0" ]
null
null
null
stk/__init__.py
sayerhs/pystk
e211a13b45929b8bfbfe891532ea19990a19d324
[ "Apache-2.0" ]
1
2021-04-28T20:10:54.000Z
2021-04-28T20:10:54.000Z
# -*- coding: utf-8 -*- """ Sierra Toolkit (STK) ==================== This module provides a high-level interface to STK library """ from .api.util.parallel import Parallel from .api.topology.topology import rank_t as StkRank from .api.mesh.field import FieldState as StkState from .api.mesh.selector import StkSelector from .api.io.io import DatabasePurpose, TimeMatchOption from .stk.stk_mesh import StkMesh
25.8125
58
0.738499
58
413
5.224138
0.603448
0.115512
0.072607
0
0
0
0
0
0
0
0
0.00277
0.125908
413
15
59
27.533333
0.836565
0.300242
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
b6b37529ab463fa00b4c34d537fbbadfe1d6b340
170
py
Python
Exercises of Python courses World1-2 and 3/ex003 - Adding two numbers.py
RafaFurla/Python-Exercises
8c37ac5b13a28a5f22babfeac0d4b60f90c5aff7
[ "MIT" ]
1
2022-02-21T18:00:18.000Z
2022-02-21T18:00:18.000Z
Exercises of Python courses World1-2 and 3/ex003 - Adding two numbers.py
RafaFurla/Python-Exercises
8c37ac5b13a28a5f22babfeac0d4b60f90c5aff7
[ "MIT" ]
null
null
null
Exercises of Python courses World1-2 and 3/ex003 - Adding two numbers.py
RafaFurla/Python-Exercises
8c37ac5b13a28a5f22babfeac0d4b60f90c5aff7
[ "MIT" ]
null
null
null
n1 = int(input('Input an integer number: ')) n2 = int(input('Input another integer number: ')) print('The sum between {} and {} is equal to: {}'.format(n1, n2, n1 + n2))
42.5
74
0.641176
27
170
4.037037
0.62963
0.146789
0.238532
0
0
0
0
0
0
0
0
0.042254
0.164706
170
3
75
56.666667
0.725352
0
0
0
0
0
0.564706
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
b6b3f49a967b1074ee75ffc5b7e74b3254ab8e7e
194
py
Python
Taras_Lepa/codewars_5/will.py
kolyasalubov/Lv-639.pythonCore
06f10669a188318884adb00723127465ebdf2907
[ "MIT" ]
null
null
null
Taras_Lepa/codewars_5/will.py
kolyasalubov/Lv-639.pythonCore
06f10669a188318884adb00723127465ebdf2907
[ "MIT" ]
null
null
null
Taras_Lepa/codewars_5/will.py
kolyasalubov/Lv-639.pythonCore
06f10669a188318884adb00723127465ebdf2907
[ "MIT" ]
null
null
null
# Will you make it? def zero_fuel(distance_to_pump, mpg, fuel_left): if ( distance_to_pump - mpg*fuel_left )>0: result = False else: result = True return result
16.166667
48
0.623711
28
194
4.071429
0.678571
0.175439
0.245614
0.298246
0.438596
0.438596
0
0
0
0
0
0.007299
0.293814
194
11
49
17.636364
0.824818
0.087629
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0
0
0.333333
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
fcb02b3d2ded6653dde1950a6b93c79397ebeaca
163
py
Python
tests/main/test_main.py
oaguy1/votelist-api
676e4b3b2e31ec8605e99d6b38ebbd124ffaea64
[ "MIT" ]
null
null
null
tests/main/test_main.py
oaguy1/votelist-api
676e4b3b2e31ec8605e99d6b38ebbd124ffaea64
[ "MIT" ]
null
null
null
tests/main/test_main.py
oaguy1/votelist-api
676e4b3b2e31ec8605e99d6b38ebbd124ffaea64
[ "MIT" ]
null
null
null
import pytest def test_root(myapp): response = myapp.get('/') assert response.status_code == 200 assert response.json() == {"message": "Hello World"}
23.285714
56
0.662577
20
163
5.3
0.8
0.264151
0
0
0
0
0
0
0
0
0
0.022556
0.184049
163
7
56
23.285714
0.774436
0
0
0
0
0
0.115854
0
0
0
0
0
0.4
1
0.2
false
0
0.2
0
0.4
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
fcb42190cd3814bde7c635b492b8d3a20e6a0858
559
py
Python
PythonBlog/dataModels/dto/friendLinkDTO.py
Nohysiwe/FastAPIBlogBackend
2052c630a1a6e9bb9e6555f734c60020b107afc8
[ "MIT" ]
1
2022-02-09T06:58:44.000Z
2022-02-09T06:58:44.000Z
PythonBlog/dataModels/dto/friendLinkDTO.py
Nohysiwe/FastAPIBlogBackend
2052c630a1a6e9bb9e6555f734c60020b107afc8
[ "MIT" ]
null
null
null
PythonBlog/dataModels/dto/friendLinkDTO.py
Nohysiwe/FastAPIBlogBackend
2052c630a1a6e9bb9e6555f734c60020b107afc8
[ "MIT" ]
null
null
null
from pydantic import BaseModel, Field __all__ = [ "FriendLinkDTO", ] class FriendLinkDTO(BaseModel): """ 友链列表 """ id: int = Field( ... , title = "友链id" ) linkName: str = Field( ... , title = "链接名" ) linkAvatar: str = Field( ... , title = "链接头像" ) linkAddress: str = Field( ... , title = "链接地址" ) linkIntro: str = Field( ... , title = "链接介绍" )
15.108108
37
0.370304
36
559
5.638889
0.611111
0.246305
0.256158
0
0
0
0
0
0
0
0
0
0.502683
559
37
38
15.108108
0.730216
0.007156
0
0.2
0
0
0.059813
0
0
0
0
0
0
1
0
false
0
0.04
0
0.28
0
0
0
0
null
1
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
3
fcb9d6a9dae7f3c44d7c82de3973c98d9fa932e1
562
py
Python
src/keystore/javacard/applets/memorycard.py
nolim1t/specter-diy
4663d1916143a4e0e8ace26789259a19e949e94f
[ "MIT" ]
279
2019-08-31T02:26:24.000Z
2022-03-30T06:34:33.000Z
src/keystore/javacard/applets/memorycard.py
nolim1t/specter-diy
4663d1916143a4e0e8ace26789259a19e949e94f
[ "MIT" ]
125
2019-09-17T10:48:57.000Z
2022-03-11T11:06:51.000Z
src/keystore/javacard/applets/memorycard.py
nolim1t/specter-diy
4663d1916143a4e0e8ace26789259a19e949e94f
[ "MIT" ]
58
2019-09-03T17:11:13.000Z
2022-03-31T03:17:40.000Z
from .secureapplet import SecureApplet, SecureError from .applet import ISOException class MemoryCardApplet(SecureApplet): GET_SECRET = b"\x05\x00" SET_SECRET = b"\x05\x01" NAME = "MemoryCard" def __init__(self, connection): aid = b"\xB0\x0B\x51\x11\xCB\x01" super().__init__(connection, aid) def save_secret(self, secret: bytes): return self.sc.request(self.SET_SECRET + secret) def get_secret(self): return self.sc.request(self.GET_SECRET) @property def is_empty(self): return True
24.434783
56
0.672598
72
562
5.041667
0.513889
0.07438
0.055096
0.104683
0.126722
0
0
0
0
0
0
0.036446
0.218861
562
22
57
25.545455
0.790433
0
0
0
0
0
0.088968
0.042705
0
0
0
0
0
1
0.25
false
0
0.125
0.1875
0.8125
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
fcc311962eea5ebb0c67493d835ddff1cc7f41c5
1,105
py
Python
analysis.py
cynnjjs/HangingMobile
ec6388584843f6be63413c9723fe98c80275fcd9
[ "MIT" ]
null
null
null
analysis.py
cynnjjs/HangingMobile
ec6388584843f6be63413c9723fe98c80275fcd9
[ "MIT" ]
null
null
null
analysis.py
cynnjjs/HangingMobile
ec6388584843f6be63413c9723fe98c80275fcd9
[ "MIT" ]
null
null
null
from lpsolver import intlinprog class Structure: '''A hanging mobile structure which is a set of points and their masses''' def __init__(self, nodes, mass): self.nodes = nodes; self.mass = mass; # The mass of the i-th node is self.mass[i] def internal_forces(self): '''get internal forces. A force is defined as a tuple: (a,b) meaning the force from a on b. @return a list of tuples; ''' pass; def external_forces(self): '''get external forces''' pass; def inequality_constraints_ub(self): '''@return A_ub, b_ub''' pass; # def inequality_constraints_lb(self): '''@return A_lb, b_lb''' pass; def equality_constraints(self): '''@return A_eq, b_eq''' pass; def unknown(self): '''build X in this method.''' pass; def objective_function(self): '''@return C''' pass; def build_intlinprog(self): '''@return C, A_ub, b_ub, A_lb, b_lb, A_eq, b_eq, i''' pass; def solve(self): C, A_ub, b_ub, A_lb, b_lb, A_eq, b_eq, i = self.build_intlinprog(); result = intlinprog(C, A_ub, b_ub, A_lb, b_lb, A_eq, b_eq, i); return result;
21.666667
75
0.650679
184
1,105
3.701087
0.315217
0.082232
0.023495
0.035242
0.088106
0.088106
0.088106
0.088106
0.088106
0.088106
0
0
0.20905
1,105
50
76
22.1
0.779176
0.349321
0
0.32
0
0
0
0
0
0
0
0
0
1
0.4
false
0.32
0.04
0
0.52
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
fcc617d55fb9cc9a44cd0125d497e6a2513a6140
3,568
py
Python
tests/test_create_anonymous_lists.py
christianhelle/autofaker
d5395e8d22c5a1fc11ce7b3a22a5c46b52a2a188
[ "MIT" ]
null
null
null
tests/test_create_anonymous_lists.py
christianhelle/autofaker
d5395e8d22c5a1fc11ce7b3a22a5c46b52a2a188
[ "MIT" ]
1
2022-02-06T21:18:34.000Z
2022-02-06T21:18:34.000Z
tests/test_create_anonymous_lists.py
christianhelle/autofaker
d5395e8d22c5a1fc11ce7b3a22a5c46b52a2a188
[ "MIT" ]
null
null
null
import unittest from abc import abstractmethod from dataclasses import dataclass from datetime import datetime, date from typing import List from autofaker import Autodata class CreateTestCase(unittest.TestCase): @abstractmethod def getType(self): pass def create(self): return Autodata.create(self.getType()) def test_create_returns_not_none(self): if self.getType() is None: return self.assertIsNotNone(self.create()) def test_create_returns_not_type(self): if self.getType() is None: return self.assertNotIsInstance(self.create(), type) def test_create_returns_not_default(self): if self.getType() is None or self.getType() is bool: return collection = self.create() self.assertNotEqual(collection, list()) def test_create_returns_not_empty(self): if self.getType() is None or self.getType() is bool: return collection = self.create() self.assertNotEqual(len(collection), 0) class AnonymousIntegerListTestCase(CreateTestCase): def getType(self): return List[int] class AnonymousStringListTestCase(CreateTestCase): def getType(self): return List[str] class AnonymousFloatListTestCase(CreateTestCase): def getType(self): return List[float] class AnonymousBooleanListTestCase(CreateTestCase): def getType(self): return List[bool] class AnonymousComplexListTestCase(CreateTestCase): def getType(self): return List[complex] class AnonymousDatetimeListTestCase(CreateTestCase): def getType(self): return List[datetime] class AnonymousDateListTestCase(CreateTestCase): def getType(self): return List[date] class AnonymousNestedListTestCase(CreateTestCase): def getType(self): return List[List[int]] class AnonymousDoubleNestedListTestCase(CreateTestCase): def getType(self): return List[List[List[int]]] @dataclass class DataClass: name: str age: int class AnonymousDataClassListTestCase(CreateTestCase): def getType(self): return List[DataClass] def test_name_not_none(self): for data in self.create(): self.assertIsNotNone(data.name) def test_age_not_default(self): for data in self.create(): self.assertNotEqual(data.age, int()) @dataclass class NestedDataClass: a: DataClass b: DataClass c: DataClass class AnonymousNestedDataClassListTestCase(CreateTestCase): def getType(self): return List[NestedDataClass] def test_name_not_none(self): for data in self.create(): self.assertIsNotNone(data.a.name) self.assertIsNotNone(data.b.name) self.assertIsNotNone(data.c.name) def test_age_not_default(self): for data in self.create(): self.assertNotEqual(data.a.age, int()) self.assertIsNotNone(data.b.age, int()) self.assertIsNotNone(data.c.age, int()) class ConstructorWithNestedDataClassList: def __init__(self, inner: List[NestedDataClass]): self.inner = inner class AnonymousDoubleNestedDataClassListTestCase(CreateTestCase): def getType(self): return List[ConstructorWithNestedDataClassList] def test_inner_not_none(self): for data in self.create(): self.assertIsNotNone(data.inner) def test_inner_not_empty(self): for data in self.create(): self.assertNotEqual(len(data.inner), 0)
23.946309
65
0.684137
382
3,568
6.290576
0.175393
0.054099
0.075739
0.139825
0.506866
0.441948
0.283812
0.248856
0.204328
0.204328
0
0.000727
0.22926
3,568
148
66
24.108108
0.873091
0
0
0.35
0
0
0
0
0
0
0
0
0.14
1
0.25
false
0.01
0.06
0.13
0.69
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
fccde72768f77405842d995dddc531582680e26f
483
py
Python
storm_control/test/test_hal_tcp_gsp.py
shiwei23/STORM6
669067503ebd164b575ce529fcc4a9a3f576b3d7
[ "MIT" ]
47
2015-02-11T16:05:54.000Z
2022-03-26T14:13:12.000Z
storm_control/test/test_hal_tcp_gsp.py
shiwei23/STORM6
669067503ebd164b575ce529fcc4a9a3f576b3d7
[ "MIT" ]
110
2015-01-30T03:53:41.000Z
2021-11-03T15:58:44.000Z
storm_control/test/test_hal_tcp_gsp.py
shiwei23/STORM6
669067503ebd164b575ce529fcc4a9a3f576b3d7
[ "MIT" ]
61
2015-01-09T18:31:27.000Z
2021-12-21T13:07:51.000Z
#!/usr/bin/env python """ Test getting the stage position. """ from storm_control.test.hal.standardHalTest import halTest def test_hal_gsp_1(): halTest(config_xml = "none_tcp_config.xml", class_name = "GetStagePosition1", test_module = "storm_control.test.hal.tcp_tests") def test_hal_gsp_2(): halTest(config_xml = "none_tcp_config.xml", class_name = "GetStagePosition2", test_module = "storm_control.test.hal.tcp_tests")
25.421053
61
0.687371
63
483
4.936508
0.47619
0.11254
0.154341
0.18328
0.501608
0.501608
0.501608
0.501608
0.263666
0
0
0.010336
0.198758
483
18
62
26.833333
0.793282
0.109731
0
0.444444
0
0
0.322275
0.151659
0
0
0
0
0
1
0.222222
true
0
0.111111
0
0.333333
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
0
0
0
0
3
fcdff1f7e036a7b206feaa2cc45e4faf14a6a89a
190
py
Python
wagtail/contrib/settings/apps.py
stevedya/wagtail
52e5abfe62547cdfd90ea7dfeb8bf5a52f16324c
[ "BSD-3-Clause" ]
1
2022-02-09T05:25:30.000Z
2022-02-09T05:25:30.000Z
wagtail/contrib/settings/apps.py
stevedya/wagtail
52e5abfe62547cdfd90ea7dfeb8bf5a52f16324c
[ "BSD-3-Clause" ]
null
null
null
wagtail/contrib/settings/apps.py
stevedya/wagtail
52e5abfe62547cdfd90ea7dfeb8bf5a52f16324c
[ "BSD-3-Clause" ]
null
null
null
from django.apps import AppConfig class WagtailSettingsAppConfig(AppConfig): name = "wagtail.contrib.settings" label = "wagtailsettings" verbose_name = "Wagtail site settings"
23.75
42
0.757895
19
190
7.526316
0.789474
0.153846
0
0
0
0
0
0
0
0
0
0
0.163158
190
7
43
27.142857
0.899371
0
0
0
0
0
0.315789
0.126316
0
0
0
0
0
1
0
false
0
0.2
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
fce0d289f674d29efa7f832f5bad753351f3e14b
413
py
Python
bias-detect/bias_frontend/AvanadeIHP/app.py
zcabjwu/react-django-ml-app
7fc39f39c68653279e103aca5b942672d030405f
[ "MIT" ]
null
null
null
bias-detect/bias_frontend/AvanadeIHP/app.py
zcabjwu/react-django-ml-app
7fc39f39c68653279e103aca5b942672d030405f
[ "MIT" ]
null
null
null
bias-detect/bias_frontend/AvanadeIHP/app.py
zcabjwu/react-django-ml-app
7fc39f39c68653279e103aca5b942672d030405f
[ "MIT" ]
null
null
null
from flask import Flask, render_template,redirect,url_for app = Flask(__name__) @app.route('/') def menu(): return redirect(url_for('index')) @app.route('/menu') def index(): return render_template('index.html') @app.route('/menu/train') def train(): return render_template('train.html') @app.route('/menu/generate') def generate(): return render_template('generate.html')
20.65
58
0.668281
53
413
5.018868
0.339623
0.210526
0.135338
0.120301
0
0
0
0
0
0
0
0
0.164649
413
20
59
20.65
0.771014
0
0
0
0
0
0.175573
0
0
0
0
0
0
1
0.285714
false
0
0.071429
0.285714
0.642857
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
1
0
0
0
1
0
0
0
3
fceb8ed1d7dfb9498484f155b929faac1bc65f7f
536
py
Python
pyjs/src/pyjs/lib/os.py
certik/pyjamas
5bb72e63e50f09743ac986f4c9690ba50c499ba9
[ "ECL-2.0", "Apache-2.0" ]
1
2018-09-19T09:14:16.000Z
2018-09-19T09:14:16.000Z
pyjs/src/pyjs/lib/os.py
andreyvit/pyjamas
1154abe3340a84dba7530b8174aaddecfc1a0944
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
pyjs/src/pyjs/lib/os.py
andreyvit/pyjamas
1154abe3340a84dba7530b8174aaddecfc1a0944
[ "ECL-2.0", "Apache-2.0" ]
1
2019-08-13T20:32:25.000Z
2019-08-13T20:32:25.000Z
def urandom(n): # """urandom(n) -> str # Return a string of n random bytes suitable for cryptographic use. # """ #try: # _urandomfd = open("/dev/urandom", O_RDONLY) #except (OSError, IOError): # raise NotImplementedError("/dev/urandom (or equivalent) not found") #try: # bs = b"" # while n - len(bs) >= 1: # bs += read(_urandomfd, n - len(bs)) #finally: # close(_urandomfd) raise NotImplementedError("/dev/urandom (or equivalent) not found") return bs
28.210526
76
0.576493
62
536
4.919355
0.596774
0.098361
0.177049
0.222951
0.354098
0.354098
0.354098
0.354098
0
0
0
0.002591
0.279851
536
18
77
29.777778
0.787565
0.658582
0
0
0
0
0.227545
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
1e1f5c794c25ea197e3aa2ec39f2944376076019
6,073
py
Python
google/ads/google_ads/v4/proto/services/feed_placeholder_view_service_pb2.py
arammaliachi/google-ads-python
a4fe89567bd43eb784410523a6306b5d1dd9ee67
[ "Apache-2.0" ]
1
2021-04-09T04:28:47.000Z
2021-04-09T04:28:47.000Z
google/ads/google_ads/v4/proto/services/feed_placeholder_view_service_pb2.py
arammaliachi/google-ads-python
a4fe89567bd43eb784410523a6306b5d1dd9ee67
[ "Apache-2.0" ]
null
null
null
google/ads/google_ads/v4/proto/services/feed_placeholder_view_service_pb2.py
arammaliachi/google-ads-python
a4fe89567bd43eb784410523a6306b5d1dd9ee67
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/ads/googleads_v4/proto/services/feed_placeholder_view_service.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() from google.ads.google_ads.v4.proto.resources import feed_placeholder_view_pb2 as google_dot_ads_dot_googleads__v4_dot_proto_dot_resources_dot_feed__placeholder__view__pb2 from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 from google.api import client_pb2 as google_dot_api_dot_client__pb2 from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 DESCRIPTOR = _descriptor.FileDescriptor( name='google/ads/googleads_v4/proto/services/feed_placeholder_view_service.proto', package='google.ads.googleads.v4.services', syntax='proto3', serialized_options=_b('\n$com.google.ads.googleads.v4.servicesB\037FeedPlaceholderViewServiceProtoP\001ZHgoogle.golang.org/genproto/googleapis/ads/googleads/v4/services;services\242\002\003GAA\252\002 Google.Ads.GoogleAds.V4.Services\312\002 Google\\Ads\\GoogleAds\\V4\\Services\352\002$Google::Ads::GoogleAds::V4::Services'), serialized_pb=_b('\nJgoogle/ads/googleads_v4/proto/services/feed_placeholder_view_service.proto\x12 google.ads.googleads.v4.services\x1a\x43google/ads/googleads_v4/proto/resources/feed_placeholder_view.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\"l\n\x1dGetFeedPlaceholderViewRequest\x12K\n\rresource_name\x18\x01 \x01(\tB4\xe0\x41\x02\xfa\x41.\n,googleads.googleapis.com/FeedPlaceholderView2\x9d\x02\n\x1a\x46\x65\x65\x64PlaceholderViewService\x12\xe1\x01\n\x16GetFeedPlaceholderView\x12?.google.ads.googleads.v4.services.GetFeedPlaceholderViewRequest\x1a\x36.google.ads.googleads.v4.resources.FeedPlaceholderView\"N\x82\xd3\xe4\x93\x02\x38\x12\x36/v4/{resource_name=customers/*/feedPlaceholderViews/*}\xda\x41\rresource_name\x1a\x1b\xca\x41\x18googleads.googleapis.comB\x86\x02\n$com.google.ads.googleads.v4.servicesB\x1f\x46\x65\x65\x64PlaceholderViewServiceProtoP\x01ZHgoogle.golang.org/genproto/googleapis/ads/googleads/v4/services;services\xa2\x02\x03GAA\xaa\x02 Google.Ads.GoogleAds.V4.Services\xca\x02 Google\\Ads\\GoogleAds\\V4\\Services\xea\x02$Google::Ads::GoogleAds::V4::Servicesb\x06proto3') , dependencies=[google_dot_ads_dot_googleads__v4_dot_proto_dot_resources_dot_feed__placeholder__view__pb2.DESCRIPTOR,google_dot_api_dot_annotations__pb2.DESCRIPTOR,google_dot_api_dot_client__pb2.DESCRIPTOR,google_dot_api_dot_field__behavior__pb2.DESCRIPTOR,google_dot_api_dot_resource__pb2.DESCRIPTOR,]) _GETFEEDPLACEHOLDERVIEWREQUEST = _descriptor.Descriptor( name='GetFeedPlaceholderViewRequest', full_name='google.ads.googleads.v4.services.GetFeedPlaceholderViewRequest', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='resource_name', full_name='google.ads.googleads.v4.services.GetFeedPlaceholderViewRequest.resource_name', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=_b('\340A\002\372A.\n,googleads.googleapis.com/FeedPlaceholderView'), file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=296, serialized_end=404, ) DESCRIPTOR.message_types_by_name['GetFeedPlaceholderViewRequest'] = _GETFEEDPLACEHOLDERVIEWREQUEST _sym_db.RegisterFileDescriptor(DESCRIPTOR) GetFeedPlaceholderViewRequest = _reflection.GeneratedProtocolMessageType('GetFeedPlaceholderViewRequest', (_message.Message,), dict( DESCRIPTOR = _GETFEEDPLACEHOLDERVIEWREQUEST, __module__ = 'google.ads.googleads_v4.proto.services.feed_placeholder_view_service_pb2' , __doc__ = """Request message for [FeedPlaceholderViewService.GetFeedPlaceholderView][google.ads.googleads.v4.services.FeedPlaceholderViewService.GetFeedPlaceholderView]. Attributes: resource_name: Required. The resource name of the feed placeholder view to fetch. """, # @@protoc_insertion_point(class_scope:google.ads.googleads.v4.services.GetFeedPlaceholderViewRequest) )) _sym_db.RegisterMessage(GetFeedPlaceholderViewRequest) DESCRIPTOR._options = None _GETFEEDPLACEHOLDERVIEWREQUEST.fields_by_name['resource_name']._options = None _FEEDPLACEHOLDERVIEWSERVICE = _descriptor.ServiceDescriptor( name='FeedPlaceholderViewService', full_name='google.ads.googleads.v4.services.FeedPlaceholderViewService', file=DESCRIPTOR, index=0, serialized_options=_b('\312A\030googleads.googleapis.com'), serialized_start=407, serialized_end=692, methods=[ _descriptor.MethodDescriptor( name='GetFeedPlaceholderView', full_name='google.ads.googleads.v4.services.FeedPlaceholderViewService.GetFeedPlaceholderView', index=0, containing_service=None, input_type=_GETFEEDPLACEHOLDERVIEWREQUEST, output_type=google_dot_ads_dot_googleads__v4_dot_proto_dot_resources_dot_feed__placeholder__view__pb2._FEEDPLACEHOLDERVIEW, serialized_options=_b('\202\323\344\223\0028\0226/v4/{resource_name=customers/*/feedPlaceholderViews/*}\332A\rresource_name'), ), ]) _sym_db.RegisterServiceDescriptor(_FEEDPLACEHOLDERVIEWSERVICE) DESCRIPTOR.services_by_name['FeedPlaceholderViewService'] = _FEEDPLACEHOLDERVIEWSERVICE # @@protoc_insertion_point(module_scope)
53.743363
1,207
0.823646
747
6,073
6.373494
0.269076
0.064692
0.073514
0.088217
0.382063
0.334594
0.236085
0.173493
0.120143
0.096198
0
0.044803
0.070147
6,073
112
1,208
54.223214
0.7983
0.055162
0
0.114943
1
0.034483
0.459955
0.423661
0
0
0
0
0
1
0
false
0
0.114943
0
0.114943
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
1e205bd1709faa5e394bb9d778c6ecd2afde5f59
529
py
Python
5.2_CUSTOM_LIBRARY/custom_normalizer.py
pedroMoya/alaska_2_share
a5f958da45b97e8c8cdc0b868e4447dbc500c6f9
[ "MIT" ]
null
null
null
5.2_CUSTOM_LIBRARY/custom_normalizer.py
pedroMoya/alaska_2_share
a5f958da45b97e8c8cdc0b868e4447dbc500c6f9
[ "MIT" ]
null
null
null
5.2_CUSTOM_LIBRARY/custom_normalizer.py
pedroMoya/alaska_2_share
a5f958da45b97e8c8cdc0b868e4447dbc500c6f9
[ "MIT" ]
null
null
null
# function that makes last pre-process step to images, preparing data for training the CNNs import numpy as np import tensorflow as tf import cv2 from scipy.fftpack import dct class custom_image_normalizer(): def normalize(self, local_image_rgb): local_image_rgb = cv2.cvtColor(local_image_rgb, cv2.COLOR_RGB2YCR_CB) local_channel_y = local_image_rgb[:, :, 0: 1] # local_image_rgb[:, :, 1: 2] = local_channel_y # local_image_rgb[:, :, 2: 3] = local_channel_y return local_channel_y
33.0625
91
0.716446
80
529
4.4375
0.575
0.169014
0.219718
0.090141
0.146479
0.146479
0
0
0
0
0
0.023697
0.202268
529
15
92
35.266667
0.817536
0.342155
0
0
0
0
0
0
0
0
0
0
0
1
0.111111
false
0
0.444444
0
0.777778
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
1e3b3be8e8b39546b51daee853e1a7f0b2310f03
91
py
Python
TestModule/Tproduct.py
Oreder/PythonSelfStudy
64c774ef469dcede6f653ab8eafd3edc83452876
[ "MIT" ]
1
2017-07-28T03:42:29.000Z
2017-07-28T03:42:29.000Z
TestModule/Tproduct.py
Oreder/PythonSelfStudy
64c774ef469dcede6f653ab8eafd3edc83452876
[ "MIT" ]
null
null
null
TestModule/Tproduct.py
Oreder/PythonSelfStudy
64c774ef469dcede6f653ab8eafd3edc83452876
[ "MIT" ]
null
null
null
def Tproduct(arg0, *args): p = arg0 for arg in args: p *= arg return p
15.166667
26
0.516484
14
91
3.357143
0.642857
0.212766
0
0
0
0
0
0
0
0
0
0.035714
0.384615
91
5
27
18.2
0.803571
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0
0.4
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
1e406b5ca8858de34dfabb3c200b1f6509b3caf6
31,775
py
Python
pyboto3/ecr.py
thecraftman/pyboto3
653a0db2b00b06708334431da8f169d1f7c7734f
[ "MIT" ]
null
null
null
pyboto3/ecr.py
thecraftman/pyboto3
653a0db2b00b06708334431da8f169d1f7c7734f
[ "MIT" ]
null
null
null
pyboto3/ecr.py
thecraftman/pyboto3
653a0db2b00b06708334431da8f169d1f7c7734f
[ "MIT" ]
null
null
null
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud 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. ''' def batch_check_layer_availability(registryId=None, repositoryName=None, layerDigests=None): """ Check the availability of multiple image layers in a specified registry and repository. See also: AWS API Documentation :example: response = client.batch_check_layer_availability( registryId='string', repositoryName='string', layerDigests=[ 'string', ] ) :type registryId: string :param registryId: The AWS account ID associated with the registry that contains the image layers to check. If you do not specify a registry, the default registry is assumed. :type repositoryName: string :param repositoryName: [REQUIRED] The name of the repository that is associated with the image layers to check. :type layerDigests: list :param layerDigests: [REQUIRED] The digests of the image layers to check. (string) -- :rtype: dict :return: { 'layers': [ { 'layerDigest': 'string', 'layerAvailability': 'AVAILABLE'|'UNAVAILABLE', 'layerSize': 123, 'mediaType': 'string' }, ], 'failures': [ { 'layerDigest': 'string', 'failureCode': 'InvalidLayerDigest'|'MissingLayerDigest', 'failureReason': 'string' }, ] } """ pass def batch_delete_image(registryId=None, repositoryName=None, imageIds=None): """ Deletes a list of specified images within a specified repository. Images are specified with either imageTag or imageDigest . You can remove a tag from an image by specifying the image's tag in your request. When you remove the last tag from an image, the image is deleted from your repository. You can completely delete an image (and all of its tags) by specifying the image's digest in your request. See also: AWS API Documentation Examples This example deletes images with the tags precise and trusty in a repository called ubuntu in the default registry for an account. Expected Output: :example: response = client.batch_delete_image( registryId='string', repositoryName='string', imageIds=[ { 'imageDigest': 'string', 'imageTag': 'string' }, ] ) :type registryId: string :param registryId: The AWS account ID associated with the registry that contains the image to delete. If you do not specify a registry, the default registry is assumed. :type repositoryName: string :param repositoryName: [REQUIRED] The repository that contains the image to delete. :type imageIds: list :param imageIds: [REQUIRED] A list of image ID references that correspond to images to delete. The format of the imageIds reference is imageTag=tag or imageDigest=digest . (dict) --An object with identifying information for an Amazon ECR image. imageDigest (string) --The sha256 digest of the image manifest. imageTag (string) --The tag used for the image. :rtype: dict :return: { 'imageIds': [ { 'imageDigest': 'string', 'imageTag': 'string' }, ], 'failures': [ { 'imageId': { 'imageDigest': 'string', 'imageTag': 'string' }, 'failureCode': 'InvalidImageDigest'|'InvalidImageTag'|'ImageTagDoesNotMatchDigest'|'ImageNotFound'|'MissingDigestAndTag', 'failureReason': 'string' }, ] } """ pass def batch_get_image(registryId=None, repositoryName=None, imageIds=None, acceptedMediaTypes=None): """ Gets detailed information for specified images within a specified repository. Images are specified with either imageTag or imageDigest . See also: AWS API Documentation Examples This example obtains information for an image with a specified image digest ID from the repository named ubuntu in the current account. Expected Output: :example: response = client.batch_get_image( registryId='string', repositoryName='string', imageIds=[ { 'imageDigest': 'string', 'imageTag': 'string' }, ], acceptedMediaTypes=[ 'string', ] ) :type registryId: string :param registryId: The AWS account ID associated with the registry that contains the images to describe. If you do not specify a registry, the default registry is assumed. :type repositoryName: string :param repositoryName: [REQUIRED] The repository that contains the images to describe. :type imageIds: list :param imageIds: [REQUIRED] A list of image ID references that correspond to images to describe. The format of the imageIds reference is imageTag=tag or imageDigest=digest . (dict) --An object with identifying information for an Amazon ECR image. imageDigest (string) --The sha256 digest of the image manifest. imageTag (string) --The tag used for the image. :type acceptedMediaTypes: list :param acceptedMediaTypes: The accepted media types for the request. Valid values: application/vnd.docker.distribution.manifest.v1+json | application/vnd.docker.distribution.manifest.v2+json | application/vnd.oci.image.manifest.v1+json (string) -- :rtype: dict :return: { 'images': [ { 'registryId': 'string', 'repositoryName': 'string', 'imageId': { 'imageDigest': 'string', 'imageTag': 'string' }, 'imageManifest': 'string' }, ], 'failures': [ { 'imageId': { 'imageDigest': 'string', 'imageTag': 'string' }, 'failureCode': 'InvalidImageDigest'|'InvalidImageTag'|'ImageTagDoesNotMatchDigest'|'ImageNotFound'|'MissingDigestAndTag', 'failureReason': 'string' }, ] } """ pass def can_paginate(operation_name=None): """ Check if an operation can be paginated. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator('create_foo'). """ pass def complete_layer_upload(registryId=None, repositoryName=None, uploadId=None, layerDigests=None): """ Inform Amazon ECR that the image layer upload for a specified registry, repository name, and upload ID, has completed. You can optionally provide a sha256 digest of the image layer for data validation purposes. See also: AWS API Documentation :example: response = client.complete_layer_upload( registryId='string', repositoryName='string', uploadId='string', layerDigests=[ 'string', ] ) :type registryId: string :param registryId: The AWS account ID associated with the registry to which to upload layers. If you do not specify a registry, the default registry is assumed. :type repositoryName: string :param repositoryName: [REQUIRED] The name of the repository to associate with the image layer. :type uploadId: string :param uploadId: [REQUIRED] The upload ID from a previous InitiateLayerUpload operation to associate with the image layer. :type layerDigests: list :param layerDigests: [REQUIRED] The sha256 digest of the image layer. (string) -- :rtype: dict :return: { 'registryId': 'string', 'repositoryName': 'string', 'uploadId': 'string', 'layerDigest': 'string' } """ pass def create_repository(repositoryName=None): """ Creates an image repository. See also: AWS API Documentation Examples This example creates a repository called nginx-web-app inside the project-a namespace in the default registry for an account. Expected Output: :example: response = client.create_repository( repositoryName='string' ) :type repositoryName: string :param repositoryName: [REQUIRED] The name to use for the repository. The repository name may be specified on its own (such as nginx-web-app ) or it can be prepended with a namespace to group the repository into a category (such as project-a/nginx-web-app ). :rtype: dict :return: { 'repository': { 'repositoryArn': 'string', 'registryId': 'string', 'repositoryName': 'string', 'repositoryUri': 'string', 'createdAt': datetime(2015, 1, 1) } } """ pass def delete_repository(registryId=None, repositoryName=None, force=None): """ Deletes an existing image repository. If a repository contains images, you must use the force option to delete it. See also: AWS API Documentation Examples This example force deletes a repository named ubuntu in the default registry for an account. The force parameter is required if the repository contains images. Expected Output: :example: response = client.delete_repository( registryId='string', repositoryName='string', force=True|False ) :type registryId: string :param registryId: The AWS account ID associated with the registry that contains the repository to delete. If you do not specify a registry, the default registry is assumed. :type repositoryName: string :param repositoryName: [REQUIRED] The name of the repository to delete. :type force: boolean :param force: Force the deletion of the repository if it contains images. :rtype: dict :return: { 'repository': { 'repositoryArn': 'string', 'registryId': 'string', 'repositoryName': 'string', 'repositoryUri': 'string', 'createdAt': datetime(2015, 1, 1) } } """ pass def delete_repository_policy(registryId=None, repositoryName=None): """ Deletes the repository policy from a specified repository. See also: AWS API Documentation Examples This example deletes the policy associated with the repository named ubuntu in the current account. Expected Output: :example: response = client.delete_repository_policy( registryId='string', repositoryName='string' ) :type registryId: string :param registryId: The AWS account ID associated with the registry that contains the repository policy to delete. If you do not specify a registry, the default registry is assumed. :type repositoryName: string :param repositoryName: [REQUIRED] The name of the repository that is associated with the repository policy to delete. :rtype: dict :return: { 'registryId': 'string', 'repositoryName': 'string', 'policyText': 'string' } """ pass def describe_images(registryId=None, repositoryName=None, imageIds=None, nextToken=None, maxResults=None, filter=None): """ Returns metadata about the images in a repository, including image size, image tags, and creation date. See also: AWS API Documentation :example: response = client.describe_images( registryId='string', repositoryName='string', imageIds=[ { 'imageDigest': 'string', 'imageTag': 'string' }, ], nextToken='string', maxResults=123, filter={ 'tagStatus': 'TAGGED'|'UNTAGGED' } ) :type registryId: string :param registryId: The AWS account ID associated with the registry that contains the repository in which to describe images. If you do not specify a registry, the default registry is assumed. :type repositoryName: string :param repositoryName: [REQUIRED] A list of repositories to describe. If this parameter is omitted, then all repositories in a registry are described. :type imageIds: list :param imageIds: The list of image IDs for the requested repository. (dict) --An object with identifying information for an Amazon ECR image. imageDigest (string) --The sha256 digest of the image manifest. imageTag (string) --The tag used for the image. :type nextToken: string :param nextToken: The nextToken value returned from a previous paginated DescribeImages request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return. :type maxResults: integer :param maxResults: The maximum number of repository results returned by DescribeImages in paginated output. When this parameter is used, DescribeImages only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another DescribeImages request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, then DescribeImages returns up to 100 results and a nextToken value, if applicable. :type filter: dict :param filter: The filter key and value with which to filter your DescribeImages results. tagStatus (string) --The tag status with which to filter your DescribeImages results. You can filter results based on whether they are TAGGED or UNTAGGED . :rtype: dict :return: { 'imageDetails': [ { 'registryId': 'string', 'repositoryName': 'string', 'imageDigest': 'string', 'imageTags': [ 'string', ], 'imageSizeInBytes': 123, 'imagePushedAt': datetime(2015, 1, 1) }, ], 'nextToken': 'string' } :returns: (string) -- """ pass def describe_repositories(registryId=None, repositoryNames=None, nextToken=None, maxResults=None): """ Describes image repositories in a registry. See also: AWS API Documentation Examples The following example obtains a list and description of all repositories in the default registry to which the current user has access. Expected Output: :example: response = client.describe_repositories( registryId='string', repositoryNames=[ 'string', ], nextToken='string', maxResults=123 ) :type registryId: string :param registryId: The AWS account ID associated with the registry that contains the repositories to be described. If you do not specify a registry, the default registry is assumed. :type repositoryNames: list :param repositoryNames: A list of repositories to describe. If this parameter is omitted, then all repositories in a registry are described. (string) -- :type nextToken: string :param nextToken: The nextToken value returned from a previous paginated DescribeRepositories request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return. Note This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes. :type maxResults: integer :param maxResults: The maximum number of repository results returned by DescribeRepositories in paginated output. When this parameter is used, DescribeRepositories only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another DescribeRepositories request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, then DescribeRepositories returns up to 100 results and a nextToken value, if applicable. :rtype: dict :return: { 'repositories': [ { 'repositoryArn': 'string', 'registryId': 'string', 'repositoryName': 'string', 'repositoryUri': 'string', 'createdAt': datetime(2015, 1, 1) }, ], 'nextToken': 'string' } """ pass def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None): """ Generate a presigned url given a client, its method, and arguments :type ClientMethod: string :param ClientMethod: The client method to presign for :type Params: dict :param Params: The parameters normally passed to ClientMethod. :type ExpiresIn: int :param ExpiresIn: The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds) :type HttpMethod: string :param HttpMethod: The http method to use on the generated url. By default, the http method is whatever is used in the method's model. """ pass def get_authorization_token(registryIds=None): """ Retrieves a token that is valid for a specified registry for 12 hours. This command allows you to use the docker CLI to push and pull images with Amazon ECR. If you do not specify a registry, the default registry is assumed. The authorizationToken returned for each registry specified is a base64 encoded string that can be decoded and used in a docker login command to authenticate to a registry. The AWS CLI offers an aws ecr get-login command that simplifies the login process. See also: AWS API Documentation Examples This example gets an authorization token for your default registry. Expected Output: :example: response = client.get_authorization_token( registryIds=[ 'string', ] ) :type registryIds: list :param registryIds: A list of AWS account IDs that are associated with the registries for which to get authorization tokens. If you do not specify a registry, the default registry is assumed. (string) -- :rtype: dict :return: { 'authorizationData': [ { 'authorizationToken': 'string', 'expiresAt': datetime(2015, 1, 1), 'proxyEndpoint': 'string' }, ] } """ pass def get_download_url_for_layer(registryId=None, repositoryName=None, layerDigest=None): """ Retrieves the pre-signed Amazon S3 download URL corresponding to an image layer. You can only get URLs for image layers that are referenced in an image. See also: AWS API Documentation :example: response = client.get_download_url_for_layer( registryId='string', repositoryName='string', layerDigest='string' ) :type registryId: string :param registryId: The AWS account ID associated with the registry that contains the image layer to download. If you do not specify a registry, the default registry is assumed. :type repositoryName: string :param repositoryName: [REQUIRED] The name of the repository that is associated with the image layer to download. :type layerDigest: string :param layerDigest: [REQUIRED] The digest of the image layer to download. :rtype: dict :return: { 'downloadUrl': 'string', 'layerDigest': 'string' } """ pass def get_paginator(operation_name=None): """ Create a paginator for an operation. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator('create_foo'). :rtype: L{botocore.paginate.Paginator} """ pass def get_repository_policy(registryId=None, repositoryName=None): """ Retrieves the repository policy for a specified repository. See also: AWS API Documentation Examples This example obtains the repository policy for the repository named ubuntu. Expected Output: :example: response = client.get_repository_policy( registryId='string', repositoryName='string' ) :type registryId: string :param registryId: The AWS account ID associated with the registry that contains the repository. If you do not specify a registry, the default registry is assumed. :type repositoryName: string :param repositoryName: [REQUIRED] The name of the repository whose policy you want to retrieve. :rtype: dict :return: { 'registryId': 'string', 'repositoryName': 'string', 'policyText': 'string' } """ pass def get_waiter(): """ """ pass def initiate_layer_upload(registryId=None, repositoryName=None): """ Notify Amazon ECR that you intend to upload an image layer. See also: AWS API Documentation :example: response = client.initiate_layer_upload( registryId='string', repositoryName='string' ) :type registryId: string :param registryId: The AWS account ID associated with the registry that you intend to upload layers to. If you do not specify a registry, the default registry is assumed. :type repositoryName: string :param repositoryName: [REQUIRED] The name of the repository that you intend to upload layers to. :rtype: dict :return: { 'uploadId': 'string', 'partSize': 123 } """ pass def list_images(registryId=None, repositoryName=None, nextToken=None, maxResults=None, filter=None): """ Lists all the image IDs for a given repository. You can filter images based on whether or not they are tagged by setting the tagStatus parameter to TAGGED or UNTAGGED . For example, you can filter your results to return only UNTAGGED images and then pipe that result to a BatchDeleteImage operation to delete them. Or, you can filter your results to return only TAGGED images to list all of the tags in your repository. See also: AWS API Documentation Examples This example lists all of the images in the repository named ubuntu in the default registry in the current account. Expected Output: :example: response = client.list_images( registryId='string', repositoryName='string', nextToken='string', maxResults=123, filter={ 'tagStatus': 'TAGGED'|'UNTAGGED' } ) :type registryId: string :param registryId: The AWS account ID associated with the registry that contains the repository to list images in. If you do not specify a registry, the default registry is assumed. :type repositoryName: string :param repositoryName: [REQUIRED] The repository whose image IDs are to be listed. :type nextToken: string :param nextToken: The nextToken value returned from a previous paginated ListImages request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return. Note This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes. :type maxResults: integer :param maxResults: The maximum number of image results returned by ListImages in paginated output. When this parameter is used, ListImages only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another ListImages request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, then ListImages returns up to 100 results and a nextToken value, if applicable. :type filter: dict :param filter: The filter key and value with which to filter your ListImages results. tagStatus (string) --The tag status with which to filter your ListImages results. You can filter results based on whether they are TAGGED or UNTAGGED . :rtype: dict :return: { 'imageIds': [ { 'imageDigest': 'string', 'imageTag': 'string' }, ], 'nextToken': 'string' } """ pass def put_image(registryId=None, repositoryName=None, imageManifest=None, imageTag=None): """ Creates or updates the image manifest and tags associated with an image. See also: AWS API Documentation :example: response = client.put_image( registryId='string', repositoryName='string', imageManifest='string', imageTag='string' ) :type registryId: string :param registryId: The AWS account ID associated with the registry that contains the repository in which to put the image. If you do not specify a registry, the default registry is assumed. :type repositoryName: string :param repositoryName: [REQUIRED] The name of the repository in which to put the image. :type imageManifest: string :param imageManifest: [REQUIRED] The image manifest corresponding to the image to be uploaded. :type imageTag: string :param imageTag: The tag to associate with the image. This parameter is required for images that use the Docker Image Manifest V2 Schema 2 or OCI formats. :rtype: dict :return: { 'image': { 'registryId': 'string', 'repositoryName': 'string', 'imageId': { 'imageDigest': 'string', 'imageTag': 'string' }, 'imageManifest': 'string' } } """ pass def set_repository_policy(registryId=None, repositoryName=None, policyText=None, force=None): """ Applies a repository policy on a specified repository to control access permissions. See also: AWS API Documentation :example: response = client.set_repository_policy( registryId='string', repositoryName='string', policyText='string', force=True|False ) :type registryId: string :param registryId: The AWS account ID associated with the registry that contains the repository. If you do not specify a registry, the default registry is assumed. :type repositoryName: string :param repositoryName: [REQUIRED] The name of the repository to receive the policy. :type policyText: string :param policyText: [REQUIRED] The JSON repository policy text to apply to the repository. :type force: boolean :param force: If the policy you are attempting to set on a repository policy would prevent you from setting another policy in the future, you must force the SetRepositoryPolicy operation. This is intended to prevent accidental repository lock outs. :rtype: dict :return: { 'registryId': 'string', 'repositoryName': 'string', 'policyText': 'string' } """ pass def upload_layer_part(registryId=None, repositoryName=None, uploadId=None, partFirstByte=None, partLastByte=None, layerPartBlob=None): """ Uploads an image layer part to Amazon ECR. See also: AWS API Documentation :example: response = client.upload_layer_part( registryId='string', repositoryName='string', uploadId='string', partFirstByte=123, partLastByte=123, layerPartBlob=b'bytes' ) :type registryId: string :param registryId: The AWS account ID associated with the registry that you are uploading layer parts to. If you do not specify a registry, the default registry is assumed. :type repositoryName: string :param repositoryName: [REQUIRED] The name of the repository that you are uploading layer parts to. :type uploadId: string :param uploadId: [REQUIRED] The upload ID from a previous InitiateLayerUpload operation to associate with the layer part upload. :type partFirstByte: integer :param partFirstByte: [REQUIRED] The integer value of the first byte of the layer part. :type partLastByte: integer :param partLastByte: [REQUIRED] The integer value of the last byte of the layer part. :type layerPartBlob: bytes :param layerPartBlob: [REQUIRED] The base64-encoded layer part payload. :rtype: dict :return: { 'registryId': 'string', 'repositoryName': 'string', 'uploadId': 'string', 'lastByteReceived': 123 } """ pass
35.227273
555
0.645256
3,630
31,775
5.625344
0.126722
0.023164
0.036729
0.044074
0.669785
0.629628
0.584378
0.555681
0.517385
0.49383
0
0.004998
0.288529
31,775
901
556
35.266371
0.898262
0.84085
0
0.5
0
0
0
0
0
0
0
0
0
1
0.5
false
0.5
0
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
3
1e4f6589150550c86517b013b767c25136fcff82
1,025
py
Python
src/yellowdog_client/model/node_search.py
yellowdog/yellowdog-sdk-python-public
da69a7d6e45c92933e34fefcaef8b5d98dcd6036
[ "Apache-2.0" ]
null
null
null
src/yellowdog_client/model/node_search.py
yellowdog/yellowdog-sdk-python-public
da69a7d6e45c92933e34fefcaef8b5d98dcd6036
[ "Apache-2.0" ]
null
null
null
src/yellowdog_client/model/node_search.py
yellowdog/yellowdog-sdk-python-public
da69a7d6e45c92933e34fefcaef8b5d98dcd6036
[ "Apache-2.0" ]
null
null
null
from dataclasses import dataclass from typing import List, Optional from .cloud_provider import CloudProvider from .double_range import DoubleRange from .instant_range import InstantRange from .long_range import LongRange from .node_status import NodeStatus from .sort_direction import SortDirection from .worker_status import WorkerStatus @dataclass class NodeSearch: workerPoolId: Optional[str] = None statuses: Optional[List[NodeStatus]] = None providers: Optional[List[CloudProvider]] = None instanceId: Optional[str] = None region: Optional[str] = None instanceType: Optional[str] = None ram: Optional[DoubleRange] = None vcpus: Optional[DoubleRange] = None workerClaimCount: Optional[LongRange] = None workerRegisteredTime: Optional[InstantRange] = None workerTaskGroupId: Optional[str] = None workerTag: Optional[str] = None workerStatuses: Optional[List[WorkerStatus]] = None sortField: Optional[str] = None sortDirection: Optional[SortDirection] = None
34.166667
55
0.766829
110
1,025
7.081818
0.390909
0.098845
0.134788
0
0
0
0
0
0
0
0
0
0.159024
1,025
29
56
35.344828
0.903712
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.346154
0
0.961538
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
1e940367ac28d6ea47a97d3ea6cfd065d7d131c2
222
py
Python
profiler/profiler/domain/model_metrics.py
Hydrospheredata/hydro-profiler
bca177f8d71d9d8c93091f9a9fdf9a337582e194
[ "Apache-2.0" ]
null
null
null
profiler/profiler/domain/model_metrics.py
Hydrospheredata/hydro-profiler
bca177f8d71d9d8c93091f9a9fdf9a337582e194
[ "Apache-2.0" ]
14
2021-11-22T18:07:28.000Z
2022-01-14T08:51:45.000Z
profiler/profiler/domain/model_metrics.py
Hydrospheredata/hydro-profiler
bca177f8d71d9d8c93091f9a9fdf9a337582e194
[ "Apache-2.0" ]
1
2021-11-19T11:16:50.000Z
2021-11-19T11:16:50.000Z
class ModelMetrics: def __init__(self, model_name, model_version, metric_by_feature): self.model_name = model_name self.model_version = model_version self.metrics_by_feature = metric_by_feature
37
69
0.743243
29
222
5.137931
0.413793
0.181208
0.174497
0.241611
0
0
0
0
0
0
0
0
0.198198
222
5
70
44.4
0.837079
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0
0.4
0
1
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
1ea9e85022788423f3e15aa0d2c2a9556674b446
439
py
Python
pyleecan/Methods/Output/XOutput/get_xoutput_ref.py
tobsen2code/pyleecan
5b1ded9e389e0c79ed7b7c878b6e939f2d9962e9
[ "Apache-2.0" ]
95
2019-01-23T04:19:45.000Z
2022-03-17T18:22:10.000Z
pyleecan/Methods/Output/XOutput/get_xoutput_ref.py
ecs-kev/pyleecan
1faedde4b24acc6361fa1fdd4e980eaec4ca3a62
[ "Apache-2.0" ]
366
2019-02-20T07:15:08.000Z
2022-03-31T13:37:23.000Z
pyleecan/Methods/Output/XOutput/get_xoutput_ref.py
ecs-kev/pyleecan
1faedde4b24acc6361fa1fdd4e980eaec4ca3a62
[ "Apache-2.0" ]
74
2019-01-24T01:47:31.000Z
2022-02-25T05:44:42.000Z
def get_xoutput_ref(self): """Return the reference XOutput (or Output) either from xoutput_ref or output_list Parameters ---------- self : XOutput A XOutput object Returns ------- xoutput_ref: XOutput reference XOutput (or Output) (if defined) """ if self.xoutput_ref_index is not None: return self.output_list[self.xoutput_ref_index] else: return self.xoutput_ref
24.388889
86
0.640091
55
439
4.909091
0.436364
0.222222
0.155556
0.177778
0
0
0
0
0
0
0
0
0.264237
439
17
87
25.823529
0.835913
0.505695
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0
0.6
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
1eaa91da7f6473f0d728185b79abb986b685c2fc
1,813
py
Python
storyboard/db/api/story_tags.py
Sitcode-Zoograf/storyboard
5833f87e20722c524a1e4a0b8e1fb82206fb4e5c
[ "Apache-2.0" ]
null
null
null
storyboard/db/api/story_tags.py
Sitcode-Zoograf/storyboard
5833f87e20722c524a1e4a0b8e1fb82206fb4e5c
[ "Apache-2.0" ]
null
null
null
storyboard/db/api/story_tags.py
Sitcode-Zoograf/storyboard
5833f87e20722c524a1e4a0b8e1fb82206fb4e5c
[ "Apache-2.0" ]
null
null
null
# Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from sqlalchemy.orm import subqueryload from storyboard.db.api import base as api_base from storyboard.db import models def tag_get_by_id(id, session=None): if not session: session = api_base.get_session() query = session.query(models.StoryTag)\ .options(subqueryload(models.StoryTag.stories))\ .filter_by(id=id) return query.first() def tag_get_by_name(name, session=None): if not session: session = api_base.get_session() query = session.query(models.StoryTag)\ .options(subqueryload(models.StoryTag.stories))\ .filter_by(name=name) return query.first() def tag_get_all(name=None, marker=None, limit=None, offset=None): return api_base.entity_get_all(models.StoryTag, name=name, marker=marker, limit=limit, offset=offset) def tag_get_count(**kwargs): return api_base.entity_get_count(models.StoryTag, **kwargs) def tag_create(values): return api_base.entity_create(models.StoryTag, values) def tag_update(tag_id, values): return api_base.entity_update(models.StoryTag, tag_id, values)
30.216667
69
0.681743
246
1,813
4.898374
0.402439
0.092946
0.029876
0.063071
0.328631
0.250622
0.209129
0.209129
0.209129
0.209129
0
0.005735
0.230557
1,813
59
70
30.728814
0.858065
0.305019
0
0.344828
0
0
0
0
0
0
0
0
0
1
0.206897
false
0
0.103448
0.137931
0.517241
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
1eb3a885eaa5f39d979bc9858ac43dd6265ceaed
63
py
Python
rapmedusa/__init__.py
gleighto/rapmedusa
c706a339b385127165b123f45f8df89ce9147393
[ "MIT" ]
3
2015-05-15T03:57:28.000Z
2020-03-26T12:48:26.000Z
rapmedusa/__init__.py
gleighto/rapmedusa
c706a339b385127165b123f45f8df89ce9147393
[ "MIT" ]
null
null
null
rapmedusa/__init__.py
gleighto/rapmedusa
c706a339b385127165b123f45f8df89ce9147393
[ "MIT" ]
null
null
null
import mapreduce; from mapreduce import * __version__ = '1.0'
15.75
41
0.746032
8
63
5.375
0.75
0
0
0
0
0
0
0
0
0
0
0.037736
0.15873
63
3
42
21
0.773585
0
0
0
0
0
0.047619
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
1ed326e419258374b6a0617c5208c14318050eb4
231
py
Python
conanfile.py
alexsharamet/SFML
9a942fc493e34ea311f230ed16dcb8f9ba291019
[ "MIT" ]
null
null
null
conanfile.py
alexsharamet/SFML
9a942fc493e34ea311f230ed16dcb8f9ba291019
[ "MIT" ]
null
null
null
conanfile.py
alexsharamet/SFML
9a942fc493e34ea311f230ed16dcb8f9ba291019
[ "MIT" ]
null
null
null
from conans import ConanFile, CMake class ExampleSFML(ConanFile): name = "ExampleSFML" generators = "cmake", "cmake_find_package" def requirements(self): self.requires("sfml/2.5.1@bincrafters/stable")
25.666667
55
0.683983
26
231
6
0.807692
0
0
0
0
0
0
0
0
0
0
0.016304
0.203463
231
8
56
28.875
0.831522
0
0
0
0
0
0.282511
0.130045
0
0
0
0
0
1
0.166667
false
0
0.166667
0
0.833333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
949d8c741badea21da68b22bba141c9cf650ba26
430
py
Python
Modulo 1/029.py
thiago19maciel/Exercicios-em-Python
0d46816caf655c6e870510bb1136964854fc875f
[ "MIT" ]
1
2022-03-22T22:36:48.000Z
2022-03-22T22:36:48.000Z
Modulo 1/029.py
thiago19maciel/Exercicios-em-Python
0d46816caf655c6e870510bb1136964854fc875f
[ "MIT" ]
null
null
null
Modulo 1/029.py
thiago19maciel/Exercicios-em-Python
0d46816caf655c6e870510bb1136964854fc875f
[ "MIT" ]
null
null
null
#Escreva um programa que leia a velocidade de um carro. velocidade = float(input('Velocidade: ')) # Se ele ultrapassar 80Km/h, mostre uma mensagem dizendo que ele foi multado if velocidade > 80: print(f'Passou a {velocidade} numa pista de 80 !!! \nVai pagar R${((velocidade-80)*30):.2f} de multa') #A multa vai custar R$7,00 por cada Km acima do limite. else: print(f'{velocidade}Km. Voce estava dentro do limite de 80Km')
53.75
106
0.723256
73
430
4.260274
0.671233
0.07074
0
0
0
0
0
0
0
0
0
0.044568
0.165116
430
8
107
53.75
0.821727
0.425581
0
0
0
0.2
0.636735
0.114286
0
0
0
0
0
1
0
false
0.2
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
1
0
0
0
0
0
3
94b69ef6e5009c7c0db93acc8d6f09fe137c1280
125
py
Python
Kobold/__init__.py
alecnunn/Kobold
10105c71994628d5e47a3573f7c67266911f82e3
[ "0BSD" ]
1
2015-09-18T15:58:06.000Z
2015-09-18T15:58:06.000Z
Kobold/__init__.py
alecnunn/Kobold
10105c71994628d5e47a3573f7c67266911f82e3
[ "0BSD" ]
null
null
null
Kobold/__init__.py
alecnunn/Kobold
10105c71994628d5e47a3573f7c67266911f82e3
[ "0BSD" ]
null
null
null
# -*- coding: utf-8 -*- __author__ = 'Alec Nunn' __email__ = 'alec.nunn@gmail.com' __version__ = '0.1.0' from . import Base
17.857143
33
0.648
18
125
3.833333
0.833333
0.231884
0
0
0
0
0
0
0
0
0
0.038095
0.16
125
7
34
17.857143
0.619048
0.168
0
0
0
0
0.320388
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
94b8cd4f940f6f3fd732825a87c1d7a04c161bfc
945
py
Python
p005.py
neong83/euler
7d0a5867d0e574f517bff55f9b6920c0310ca98e
[ "MIT" ]
null
null
null
p005.py
neong83/euler
7d0a5867d0e574f517bff55f9b6920c0310ca98e
[ "MIT" ]
null
null
null
p005.py
neong83/euler
7d0a5867d0e574f517bff55f9b6920c0310ca98e
[ "MIT" ]
null
null
null
# Q: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. # . What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? # https://stackoverflow.com/questions/19348430/project-euler-getting-smallest-multiple-in-python from math import gcd from functools import reduce def lowset_common_divider(a, b) -> int: # gcd(4, 8) => 4 # 4 * 8 = 32 # 32 / 4 = 8 <- this is the lowest common divider from both 4 and 8 return (a * b) // gcd(a, b) if __name__ == "__main__": # test print("test") # reduce(func, seq) # this implies -> lowset_common_divider(lowset_common_divider(a, b), c) # taken the result and apply to another `lowset_common_divider` method as parameter print(reduce(lowset_common_divider, range(1, 10 + 1))) # actual print("result") print(reduce(lowset_common_divider, range(1, 20 + 1)))
33.75
111
0.689947
149
945
4.241611
0.510067
0.143987
0.18038
0.050633
0.240506
0.174051
0.113924
0
0
0
0
0.052069
0.207407
945
27
112
35
0.791722
0.61164
0
0
0
0
0.050704
0
0
0
0
0
0
1
0.111111
false
0
0.222222
0.111111
0.444444
0.444444
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
1
0
1
0
3
94cbb8dc2f062e50f2bd3a6f87b78102b2d2e665
7,748
py
Python
ether_sql/constants/mainnet_dao.py
Rothens/ether_sql
fab15a34962735825756a2a2c206e2e13fae00a0
[ "Apache-2.0" ]
65
2018-05-10T14:15:55.000Z
2022-03-06T07:33:20.000Z
ether_sql/constants/mainnet_dao.py
Rothens/ether_sql
fab15a34962735825756a2a2c206e2e13fae00a0
[ "Apache-2.0" ]
45
2018-05-17T15:11:23.000Z
2021-09-10T13:09:07.000Z
ether_sql/constants/mainnet_dao.py
Rothens/ether_sql
fab15a34962735825756a2a2c206e2e13fae00a0
[ "Apache-2.0" ]
20
2018-06-03T20:20:02.000Z
2022-03-06T07:32:58.000Z
# https://raw.githubusercontent.com/ethereum/go-ethereum/5f55d95aea433ef97c48ae927835d833772350de/params/dao.go from web3.utils.formatters import hex_to_integer from eth_utils import to_checksum_address from ether_sql.globals import get_current_session from ether_sql.models import StateDiff MAINNET_DAO_BLOCK = 1920000 MAINNET_DAO_TIMESTAMP = '2016-07-20T13:20:40' DAO_REFUND_CONTRACT = "0xbf4ed7b27f1d666546e30d74d50d173d20bca754" def add_dao_hardfork_state_diff(): current_session = get_current_session() with current_session.db_session_scope(): for dict_account in DAO_DRAIN_LIST: state_diff = StateDiff.add_state_diff( balance_diff=dict_account['balance_diff'], nonce_diff=None, code_from=None, code_to=None, address=to_checksum_address(dict_account['address']), transaction_hash=None, transaction_index=None, block_number=MAINNET_DAO_BLOCK, timestamp=MAINNET_DAO_TIMESTAMP, state_diff_type='dao-fork') current_session.db_session.add(state_diff) DAO_DRAIN_LIST = [ {'address': '0x253488078a4EdF4D6F42f113D1e62836A942Cf1a', 'balance_diff': -3486036451558542464}, {'address': '0x9Ea779F907f0B315B364b0Cfc39A0FDE5b02a416', 'balance_diff': -15841461690131427090010}, {'address': '0x200450F06520Bdd6C527622A273333384D870eFB', 'balance_diff': -1250001619314659344457}, {'address': '0xD9aef3A1E38A39C16B31D1AcE71bCa8ef58D315B', 'balance_diff': -100000129545172747556}, {'address': '0xB136707642A4EA12FB4BAE820F03d2562EBFF487', 'balance_diff': -7277385711515429122911683}, {'address': '0x5D2b2E6fcBE3B11D26B525E085Ff818DAE332479', 'balance_diff': -5000006477258637377}, {'address': '0x7602B46DF5390e432EF1c307d4F2c9Ff6D65Cc97', 'balance_diff': -369231179004682274248}, {'address': '0xA2F1CcbA9395D7Fcb155bBA8BC92dB9BAFaeAde7', 'balance_diff': -5000006477258637377}, {'address': '0xAcD87E28B0C9d1254E868B81Cba4cc20D9a32225', 'balance_diff': -207153967008322399135}, {'address': '0x057B56736d32b86616a10F619859c6CD6F59092a', 'balance_diff': -9900012824972102}, {'address': '0x0e0Da70933F4C7849fc0D203F5d1D43B9ae4532d', 'balance_diff': -19173240336954131945545}, {'address': '0x84EF4b2357079CD7A7C69fD7a37cd0609a679106', 'balance_diff': -598974326560793095813484}, {'address': '0xcc34673c6C40e791051898567A1222daF90Be287', 'balance_diff': -60000077727103648}, {'address': '0x914d1B8B43e92723E64FD0a06F5BDB8Dd9b10C79', 'balance_diff': -285714295714285714286}, {'address': '0xF4c64518EA10f995918A454158c6b61407EA345C', 'balance_diff': -269565591797974102411594}, {'address': '0x35a051a0010aBA705c9008D7A7eff6FB88F6EA7B', 'balance_diff': -15276059789372406985}, {'address': '0x542A9515200d14b68E934e9830d91645A980DD7A', 'balance_diff': -12548793143344641481996}, {'address': '0xAC1ECAb32727358DbA8962a0F3b261731AAD9723', 'balance_diff': -1}, {'address': '0x9f27DAEA7aca0AA0446220b98D028715E3Bc803D', 'balance_diff': -99998647723253121277}, {'address': '0x440c59B325D2997A134c2c7c60a8c61611212BaD', 'balance_diff': -266854104538362875475}, {'address': '0xE4AE1EfDfC53B73893aF49113D8694A057b9c0d1', 'balance_diff': -5000006477258637377}, {'address': '0x9C15B54878Ba618f494B38F0Ae7443db6aF648bA', 'balance_diff': -2236999142516500888}, {'address': '0x1cbA23d343A983e9b5cfd19496B9A9701ada385F', 'balance_diff': -68587370259945226}, {'address': '0x6F6704E5a10332aF6672E50B3d9754Dc460DFa4D', 'balance_diff': -41173345768012804300}, {'address': '0x2c19c7f9Ae8b751e37aEb2d93A699722395aE18F', 'balance_diff': -8519214441755701}, {'address': '0xfE24Cdd8648121A43a7C86d289bE4dD2951ed49F', 'balance_diff': -269833661813680507459}, {'address': '0x2a5ed960395e2a49B1c758CEF4aA15213cfd874c', 'balance_diff': -18693039890011849}, {'address': '0x0737a6B837F97f46eBaDe41b9bC3e1c509C85c53', 'balance_diff': -7144077587762826223}, {'address': '0xD4fE7Bc31cedB7BfB8A345F31e668033056B2728', 'balance_diff': -110000142499690430}, {'address': '0x1Ca6aBD14D30aFfe533b24D7a21bff4C2D5e1F3B', 'balance_diff': -76761842290232377901}, {'address': '0xBC07118b9aC290E4622f5e77A0853539789eFFbE', 'balance_diff': -5634097608979247392143}, {'address': '0x6131c42Fa982E56929107413a9D526fD99405560', 'balance_diff': -2121837249362469256186}, {'address': '0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413', 'balance_diff': -1200000000000000001}, {'address': '0x0101F3Be8Ebb4BbD39A2e3B9A3639d4259832FD9', 'balance_diff': -559384955979606013894}, {'address': '0xACcC230e8a6E5be9160b8CDF2864Dd2a001c28B6', 'balance_diff': -23997787866533545896}, {'address': '0x782495B7B3355efB2833D56ecb34dc22AD7dFCC4', 'balance_diff': -250000323862931868891}, {'address': '0xDA2FeF9e4a3230988ff17Df2165440f37e8B1708', 'balance_diff': -73722042576599901129491}, {'address': '0x779543A0491a837Ca36CE8c635d6154E3C4911A6', 'balance_diff': -100000000000000000}, {'address': '0xBf4eD7b27F1d666546E30D74d50d173d20bca754', 'balance_diff': 12001961845205763407115004}, {'address': '0x5C8536898FBb74FC7445814902FD08422EaC56D0', 'balance_diff': -205100000000392887672}, {'address': '0x5c6E67Ccd5849c0D29219c4F95F1a7a93b3F5dC5', 'balance_diff': -1}, {'address': '0x4613f3bca5c44EA06337A9e439FBc6D42E501D0a', 'balance_diff': -28927603152430302650042}, {'address': '0x4deb0033Bb26Bc534B197E61D19e0733e5679784', 'balance_diff': -1256101627216914882057}, {'address': '0x6d87578288B6cb5549d5076A207456A1f6a63DC0', 'balance_diff': -1944767821345229848}, {'address': '0xF14C14075d6C4Ed84B86798AF0956DEEf67365b5', 'balance_diff': -2123311222366559138}, {'address': '0x319F70bAb6845585F412ec7724b744FEc6095C85', 'balance_diff': -90658}, {'address': '0xD131637D5275fd1a68a3200f4aD25c71A2a9522E', 'balance_diff': -118886510785155274580}, {'address': '0x06706dd3f2c9aBF0a21DDCc6941d9B86F0596936', 'balance_diff': -1428573279216753537}, {'address': '0x1975BD06D486162d5DC297798DFC41EDD5D160a7', 'balance_diff': -989001281201758473335}, {'address': '0xaEEb8fF27288BDABC0FA5EBb731B6f409507516c', 'balance_diff': -859189750496835322093}, {'address': '0x3BA4D81DB016Dc2890C81F3AcEc2454BFf5AAda5', 'balance_diff': -1}, {'address': '0x9dA397b9E80755301a3B32173283a91c0ef6c87E', 'balance_diff': -934889382511061152962}, {'address': '0x21C7FDB9ED8D291D79fFD82EB2c4356Ec0D81241', 'balance_diff': -27428797178668633}, {'address': '0xbCF899e6C7d9d5a215aB1e3444c86806FA854c76', 'balance_diff': -30696803822257124360133}, {'address': '0x6B0c4d41Ba9ab8D8cFB5D379C69A612F2CEd8eCb', 'balance_diff': -854763543}, {'address': '0x52C5317c848ba20C7504cB2c8052abD1Fde29D03', 'balance_diff': -1996002585721648041229}, {'address': '0xD343B217DE44030AFAa275F54D31A9317c7F441e', 'balance_diff': -5192307692307692307692}, {'address': '0x5524c55fb03cf21f549444cCbeCB664D0aCAd706', 'balance_diff': -6773243673260677597543}, {'address': '0x807640A13483f8AC783c557fcDF27Be11ea4AC7A', 'balance_diff': -89472700}, {'address': '0xD164B088bd9108B60D0ca3751DA4bceb207b0782', 'balance_diff': -1000001295451727475566}, {'address': '0xd1ac8b1ef1b69Ff51D1D401a476e7e612414f091', 'balance_diff': -18387737083543350}, {'address': '0x304a554a310C7e546dfe434669C62820b7D83490', 'balance_diff': -3642408527612792706899331}, {'address': '0x51E0DDd9998364A2Eb38588679F0D2C42653E4A6', 'balance_diff': -10000012954517274755}, {'address': '0x9fcD2deAff372A39cc679D5c5e4de7bafB0B1339', 'balance_diff': -1409336722195117395464}, {'address': '0x492EA3bb0f3315521C31F273e565B868fC090F17', 'balance_diff': -367380383063135344585}, ]
79.876289
111
0.779685
463
7,748
12.790497
0.408207
0.124451
0.015198
0.018744
0
0
0
0
0
0
0
0.432611
0.1008
7,748
96
112
80.708333
0.417396
0.014068
0
0
0
0
0.530706
0.36297
0
0
0.36297
0
0
1
0.011111
false
0
0.044444
0
0.055556
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
94e3a32aed7fc515048a0b6da6489ffbc9df42f3
2,053
py
Python
openaerostruct/tests/data_TN2563_fig18_19.py
bbahiam/OpenAeroStruct
25d0e20a9ab9fafe82e28d80286e2fdc9cb050ae
[ "Apache-2.0" ]
null
null
null
openaerostruct/tests/data_TN2563_fig18_19.py
bbahiam/OpenAeroStruct
25d0e20a9ab9fafe82e28d80286e2fdc9cb050ae
[ "Apache-2.0" ]
null
null
null
openaerostruct/tests/data_TN2563_fig18_19.py
bbahiam/OpenAeroStruct
25d0e20a9ab9fafe82e28d80286e2fdc9cb050ae
[ "Apache-2.0" ]
1
2020-03-30T15:35:07.000Z
2020-03-30T15:35:07.000Z
import numpy as np """ Test data for control surfaces """ dcl_ddelta_data = { 'str': { # straight wing # span fraction q[psf] dcl_dda 'ail02': np.array([[10, 0.0018592], [20, 0.0015529], [25, 0.0013926], [30, 0.0012038], [35, 0.000894]]), 'ail04': np.array([[10, 0.0042741], [20, 0.0037898], [25, 0.0034442], [30, 0.0029634], [35, 0.0024825], [40, 0.0018449]]), 'ail06': np.array([[10, 0.0066106], [15, 0.006251], [20, 0.0057987]]), 'ail08': np.array([[10, 0.0078574], [15, 0.0073979]]), 'ail95': np.array([[10, 0.0085128], [15, 0.0079749]]), }, 'swp': { # swept wing # span fraction q[psf] dcl_dda 'ail02': np.array([[10, 0.0005353], [20, 0.0003198], [25, 0.000173], [30, 0.0001305], [35, 7.50E-05], [40, 1.95E-05], [45, -3.60E-05]]), 'ail04': np.array([[20, 0.0010642], [25, 0.0008063], [30, 0.000581], [35, 0.0004537], [40, 0.0003264]]), 'ail06': np.array([[20, 0.0019586], [25, 0.0016157], [30, 0.0013123], [35, 0.0011262]]), 'ail08': np.array([[20, 0.0029771], [25, 0.002543], [30, 0.0022328], [35, 0.0019162]]), 'ail95': np.array([[25, 0.003013], [30, 0.0027159], [35, 0.0023993]]), }, }
38.018519
45
0.315149
186
2,053
3.456989
0.435484
0.108865
0.083981
0.093313
0.127527
0.127527
0.127527
0.127527
0.127527
0.127527
0
0.430052
0.529956
2,053
53
46
38.735849
0.236269
0.042864
0
0
0
0
0.029136
0
0
0
0
0
0
1
0
false
0
0.020833
0
0.020833
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
a21f47d4358743adc44781c72f15cc7c10112d1e
1,541
py
Python
lib/ofxtools/__init__.py
arda2525/fixofx
1792d94697af682ca1d4a75cfefe98465d95a288
[ "Apache-2.0" ]
50
2015-01-01T00:14:04.000Z
2020-11-26T04:44:30.000Z
lib/ofxtools/__init__.py
arda2525/fixofx
1792d94697af682ca1d4a75cfefe98465d95a288
[ "Apache-2.0" ]
3
2016-01-31T17:14:41.000Z
2017-03-01T13:36:17.000Z
lib/ofxtools/__init__.py
arda2525/fixofx
1792d94697af682ca1d4a75cfefe98465d95a288
[ "Apache-2.0" ]
15
2015-10-29T09:04:21.000Z
2022-01-19T17:33:25.000Z
# Copyright 2005-2010 Wesabe, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # This code allows you to say in your scripts: # # import ofxtools # # and have access to all of the classes in the OFX tools library. Refer to # them with the prefix 'ofxtools.' and the class name. For instance, to # use the QIF converter, use the name 'ofxtools.QifConverter'. import sys def _ofxtoolsStartDebugAction( instring, loc, expr ): sys.stderr.write("Match %s at loc %s (%d,%d)" % (expr, loc, instring.count("\n", 0, loc) + 1, loc - instring.rfind("\n", 0, loc))) def _ofxtoolsSuccessDebugAction( instring, startloc, endloc, expr, toks ): sys.stderr.write("Matched %s -> %s" % (expr, str(toks.asList()))) def _ofxtoolsExceptionDebugAction( instring, loc, expr, exc ): sys.stderr.write("Exception raised: %s" % exc) from ofxtools.ofc_converter import * from ofxtools.ofc_parser import * from ofxtools.qif_converter import * from ofxtools.qif_parser import *
37.585366
75
0.698897
219
1,541
4.885845
0.52968
0.056075
0.039252
0.029907
0
0
0
0
0
0
0
0.012225
0.203764
1,541
40
76
38.525
0.859821
0.536016
0
0
0
0
0.095101
0
0
0
0
0
0
1
0.214286
false
0
0.357143
0
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
3
a22629ecf9c73780c5b573b2aa1d05bb981dbfff
118
py
Python
Pycharm_Project/0422/hashlibModule_Study.py
duanjiefei/Python-Study
88e17a3eab9112a2515f09b2bcf4e032059cc28b
[ "Apache-2.0" ]
null
null
null
Pycharm_Project/0422/hashlibModule_Study.py
duanjiefei/Python-Study
88e17a3eab9112a2515f09b2bcf4e032059cc28b
[ "Apache-2.0" ]
null
null
null
Pycharm_Project/0422/hashlibModule_Study.py
duanjiefei/Python-Study
88e17a3eab9112a2515f09b2bcf4e032059cc28b
[ "Apache-2.0" ]
null
null
null
import hashlib obj = hashlib.md5() obj = hashlib.sha256() obj.update("hello".encode("utf-8")) print(obj.hexdigest())
16.857143
35
0.70339
17
118
4.882353
0.705882
0.240964
0
0
0
0
0
0
0
0
0
0.046729
0.09322
118
7
36
16.857143
0.728972
0
0
0
0
0
0.084034
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0.2
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
bf42325433881cc863740cee2acfa75c470f9dcd
18,315
py
Python
website_api_loader.py
BadWolf1023/Lounge-Season-Reset-Updater-Bot
39374afb88805a345121954b3f2dc66571f3cdbd
[ "MIT" ]
null
null
null
website_api_loader.py
BadWolf1023/Lounge-Season-Reset-Updater-Bot
39374afb88805a345121954b3f2dc66571f3cdbd
[ "MIT" ]
null
null
null
website_api_loader.py
BadWolf1023/Lounge-Season-Reset-Updater-Bot
39374afb88805a345121954b3f2dc66571f3cdbd
[ "MIT" ]
null
null
null
''' Created on Aug 21, 2021 @author: willg ''' import CustomExceptions import core_data_loader import common from typing import List from datetime import datetime RT_PLAYER_DATA_API_URL = "https://www.mkwlounge.gg/api/ladderplayer.php?ladder_id=1&all=1" CT_PLAYER_DATA_API_URL = "https://www.mkwlounge.gg/api/ladderplayer.php?ladder_id=2&all=1" RT_MMR_CUTOFF_API_URL = "https://www.mkwlounge.gg/api/ladderclass.php?ladder_id=1" CT_MMR_CUTOFF_API_URL = "https://www.mkwlounge.gg/api/ladderclass.php?ladder_id=2" RT_LR_CUTOFF_API_URL = "https://www.mkwlounge.gg/api/ladderboundary.php?ladder_id=1" CT_LR_CUTOFF_API_URL = "https://www.mkwlounge.gg/api/ladderboundary.php?ladder_id=2" def print_key_data_error(key, data): print('key:', key, 'value:', data[key], "type:", type(data[key])) class CutoffDataLoader: order_json_name = "ladder_order" lr_role_json_name = "ladder_boundary_name" mmr_role_json_name = "ladder_class_name" lower_lr_cutoff_json_name = "minimum_lr" lower_mmr_cutoff_json_name = "minimum_mmr" API_REQUIRED_IN_LR_JSON = [order_json_name, lr_role_json_name, lower_lr_cutoff_json_name] API_REQUIRED_IN_MMR_JSON = [order_json_name, mmr_role_json_name, lower_mmr_cutoff_json_name] @staticmethod def __lr_cutoff_data_is_corrupt__(data): if not isinstance(data, dict) or "results" not in data or not isinstance(data["results"], list): return True for cutoff_piece in data["results"]: for key in CutoffDataLoader.API_REQUIRED_IN_LR_JSON: if key not in cutoff_piece: print(f'The key "{key}" should have been in the cutoff data: {cutoff_piece}') return True if not common.isint(cutoff_piece[CutoffDataLoader.order_json_name]): print_key_data_error(cutoff_piece, CutoffDataLoader.order_json_name) return True if not isinstance(cutoff_piece[CutoffDataLoader.lr_role_json_name], str): print_key_data_error(cutoff_piece, CutoffDataLoader.lr_role_json_name) return True if not (common.isint(cutoff_piece[CutoffDataLoader.lower_lr_cutoff_json_name]) or cutoff_piece[CutoffDataLoader.lower_lr_cutoff_json_name] is None): print_key_data_error(cutoff_piece, CutoffDataLoader.lower_lr_cutoff_json_name) return True return False @staticmethod def __mmr_cutoff_data_is_corrupt__(data): if not isinstance(data, dict) or "results" not in data or not isinstance(data["results"], list): return True for cutoff_piece in data["results"]: for key in CutoffDataLoader.API_REQUIRED_IN_MMR_JSON: if key not in cutoff_piece: print(f'The key "{key}" should have been in the cutoff data: {cutoff_piece}') return True if not common.isint(cutoff_piece[CutoffDataLoader.order_json_name]): print_key_data_error(cutoff_piece, CutoffDataLoader.order_json_name) return True if not isinstance(cutoff_piece[CutoffDataLoader.mmr_role_json_name], str): print_key_data_error(cutoff_piece, CutoffDataLoader.mmr_role_json_name) return True if not (common.isint(cutoff_piece[CutoffDataLoader.lower_mmr_cutoff_json_name]) or cutoff_piece[CutoffDataLoader.lower_mmr_cutoff_json_name] is None): print_key_data_error(cutoff_piece, CutoffDataLoader.lower_mmr_cutoff_json_name) return True return False @staticmethod async def __fix_cutoff_data__(cutoff_data:List, is_rt): for cutoff_data_piece in cutoff_data: cutoff_data_piece[CutoffDataLoader.order_json_name] = int(cutoff_data_piece[CutoffDataLoader.order_json_name]) to_append = "RT " if is_rt else "CT " if CutoffDataLoader.lr_role_json_name in cutoff_data_piece: cutoff_data_piece[CutoffDataLoader.lr_role_json_name] = to_append + cutoff_data_piece[CutoffDataLoader.lr_role_json_name] else: cutoff_data_piece[CutoffDataLoader.mmr_role_json_name] = to_append + cutoff_data_piece[CutoffDataLoader.mmr_role_json_name] if CutoffDataLoader.lower_lr_cutoff_json_name in cutoff_data_piece and cutoff_data_piece[CutoffDataLoader.lower_lr_cutoff_json_name] is not None: cutoff_data_piece[CutoffDataLoader.lower_lr_cutoff_json_name] = int(cutoff_data_piece[CutoffDataLoader.lower_lr_cutoff_json_name]) elif CutoffDataLoader.lower_mmr_cutoff_json_name in cutoff_data_piece and cutoff_data_piece[CutoffDataLoader.lower_mmr_cutoff_json_name] is not None: cutoff_data_piece[CutoffDataLoader.lower_mmr_cutoff_json_name] = int(cutoff_data_piece[CutoffDataLoader.lower_mmr_cutoff_json_name]) cutoff_data.sort(key=lambda data_piece: data_piece[CutoffDataLoader.order_json_name], reverse=True) @staticmethod async def __update_common_cutoffs__(rt_mmr_cutoff_data, ct_mmr_cutoff_data, rt_lr_cutoff_data, ct_lr_cutoff_data, message_sender, verbose=False, alternative_ctx=None): await CutoffDataLoader.__fix_cutoff_data__(rt_mmr_cutoff_data, is_rt=True) await CutoffDataLoader.__fix_cutoff_data__(ct_mmr_cutoff_data, is_rt=False) await CutoffDataLoader.__fix_cutoff_data__(rt_lr_cutoff_data, is_rt=True) await CutoffDataLoader.__fix_cutoff_data__(ct_lr_cutoff_data, is_rt=False) all_roles = message_sender.running_channel.guild.roles #RT Class role finding and loading temp_rt_class_role_cutoffs = [] for data_piece in rt_mmr_cutoff_data: role_name = data_piece[CutoffDataLoader.mmr_role_json_name] fixed_role_name = role_name.lower().replace(" ", "") role_id = None for role in all_roles: if role.name.lower().replace(" ", "") == fixed_role_name: role_id = role.id break else: error_message = f"No role found in the server named {role_name}" await message_sender.queue_message(error_message, True, alternative_ctx=alternative_ctx) raise CustomExceptions.NoRoleFound(error_message) temp_rt_class_role_cutoffs.append((data_piece[CutoffDataLoader.lower_mmr_cutoff_json_name], role_name, role_id)) #CT Class role finding and loading temp_ct_class_role_cutoffs = [] for data_piece in ct_mmr_cutoff_data: role_name = data_piece[CutoffDataLoader.mmr_role_json_name] fixed_role_name = role_name.lower().replace(" ", "") role_id = None for role in all_roles: if role.name.lower().replace(" ", "") == fixed_role_name: role_id = role.id break else: error_message = f"No role found in the server named {role_name}" await message_sender.queue_message(error_message, True, alternative_ctx=alternative_ctx) raise CustomExceptions.NoRoleFound(error_message) temp_ct_class_role_cutoffs.append((data_piece[CutoffDataLoader.lower_mmr_cutoff_json_name], role_name, role_id)) #RT Ranking role finding and loading temp_rt_rank_role_cutoffs = [] for data_piece in rt_lr_cutoff_data: role_name = data_piece[CutoffDataLoader.lr_role_json_name] fixed_role_name = role_name.lower().replace(" ", "") role_id = None for role in all_roles: if role.name.lower().replace(" ", "") == fixed_role_name: role_id = role.id break else: error_message = f"No role found in the server named {role_name}" await message_sender.queue_message(error_message, True, alternative_ctx=alternative_ctx) raise CustomExceptions.NoRoleFound(error_message) temp_rt_rank_role_cutoffs.append((data_piece[CutoffDataLoader.lower_lr_cutoff_json_name], role_name, role_id)) #CT Ranking role finding and loading temp_ct_rank_role_cutoffs = [] for data_piece in ct_lr_cutoff_data: role_name = data_piece[CutoffDataLoader.lr_role_json_name] fixed_role_name = role_name.lower().replace(" ", "") role_id = None for role in all_roles: if role.name.lower().replace(" ", "") == fixed_role_name: role_id = role.id break else: error_message = f"No role found in the server named {role_name}" await message_sender.queue_message(error_message, True, alternative_ctx=alternative_ctx) raise CustomExceptions.NoRoleFound(error_message) temp_ct_rank_role_cutoffs.append((data_piece[CutoffDataLoader.lower_lr_cutoff_json_name], role_name, role_id)) common.RT_CLASS_ROLE_CUTOFFS.clear() common.RT_CLASS_ROLE_CUTOFFS.extend(temp_rt_class_role_cutoffs) common.RT_MUST_HAVE_ROLE_ID_TO_UPDATE_CLASS_ROLE.clear() common.RT_MUST_HAVE_ROLE_ID_TO_UPDATE_CLASS_ROLE.update({data[2] for data in common.RT_CLASS_ROLE_CUTOFFS}) common.CT_CLASS_ROLE_CUTOFFS.clear() common.CT_CLASS_ROLE_CUTOFFS.extend(temp_ct_class_role_cutoffs) common.CT_MUST_HAVE_ROLE_ID_TO_UPDATE_CLASS_ROLE.clear() common.CT_MUST_HAVE_ROLE_ID_TO_UPDATE_CLASS_ROLE.update({data[2] for data in common.CT_CLASS_ROLE_CUTOFFS}) common.RT_RANKING_ROLE_CUTOFFS.clear() common.RT_RANKING_ROLE_CUTOFFS.extend(temp_rt_rank_role_cutoffs) common.RT_MUST_HAVE_ROLE_ID_TO_UPDATE_RANKING_ROLE.clear() common.RT_MUST_HAVE_ROLE_ID_TO_UPDATE_RANKING_ROLE.update({data[2] for data in common.RT_RANKING_ROLE_CUTOFFS}) common.CT_RANKING_ROLE_CUTOFFS.clear() common.CT_RANKING_ROLE_CUTOFFS.extend(temp_ct_rank_role_cutoffs) common.CT_MUST_HAVE_ROLE_ID_TO_UPDATE_RANKING_ROLE.clear() common.CT_MUST_HAVE_ROLE_ID_TO_UPDATE_RANKING_ROLE.update({data[2] for data in common.CT_RANKING_ROLE_CUTOFFS}) @staticmethod async def update_cutoff_data(message_sender, verbose=False, alternative_ctx=None): rt_mmr_cutoff_data = await common.getJSONData(RT_MMR_CUTOFF_API_URL) ct_mmr_cutoff_data = await common.getJSONData(CT_MMR_CUTOFF_API_URL) rt_lr_cutoff_data = await common.getJSONData(RT_LR_CUTOFF_API_URL) ct_lr_cutoff_data = await common.getJSONData(CT_LR_CUTOFF_API_URL) if CutoffDataLoader.__mmr_cutoff_data_is_corrupt__(rt_mmr_cutoff_data): await message_sender.queue_message("RT MMR Cutoff Data was corrupt.", True, alternative_ctx=alternative_ctx) raise CustomExceptions.CutoffAPIBadData("RT MMR Cutoff Data was corrupt.") if CutoffDataLoader.__mmr_cutoff_data_is_corrupt__(ct_mmr_cutoff_data): await message_sender.queue_message("CT MMR Cutoff Data was corrupt.", True, alternative_ctx=alternative_ctx) raise CustomExceptions.CutoffAPIBadData("CT MMR Cutoff Data was corrupt.") if CutoffDataLoader.__lr_cutoff_data_is_corrupt__(rt_lr_cutoff_data): await message_sender.queue_message("RT LR Cutoff Data was corrupt.", True, alternative_ctx=alternative_ctx) raise CustomExceptions.CutoffAPIBadData("RT LR Cutoff Data was corrupt.") if CutoffDataLoader.__lr_cutoff_data_is_corrupt__(ct_lr_cutoff_data): await message_sender.queue_message("CT LR Cutoff Data was corrupt.", True, alternative_ctx=alternative_ctx) raise CustomExceptions.CutoffAPIBadData("CT LR Cutoff Data was corrupt.") return await CutoffDataLoader.__update_common_cutoffs__(rt_mmr_cutoff_data["results"], ct_mmr_cutoff_data["results"], rt_lr_cutoff_data["results"], ct_lr_cutoff_data["results"], message_sender, verbose, alternative_ctx) class PlayerDataLoader: player_id_json_name = "player_id" player_name_json_name = "player_name" player_current_mmr_json_name = "current_mmr" player_current_lr_json_name = "current_lr" player_last_event_date_json_name = "last_event_date" player_events_played_json_name = "total_events" discord_id_json_name = "discord_user_id" API_REQUIRED_IN_JSON = [player_id_json_name, player_name_json_name, player_current_mmr_json_name, player_current_lr_json_name, player_last_event_date_json_name, player_events_played_json_name, discord_id_json_name] @staticmethod def player_data_is_corrupt(data): if not isinstance(data, dict) or "results" not in data or not isinstance(data["results"], list): return True for player_data in data["results"]: for key in PlayerDataLoader.API_REQUIRED_IN_JSON: if key not in player_data: print(f'The key "{key}" should have been in the player data: {player_data}') return True if not common.isint(player_data[PlayerDataLoader.player_id_json_name]): print_key_data_error(PlayerDataLoader.player_id_json_name, player_data) return True if not isinstance(player_data[PlayerDataLoader.player_name_json_name], str): print_key_data_error(PlayerDataLoader.player_name_json_name, player_data) return True if not common.isint(player_data[PlayerDataLoader.player_current_mmr_json_name]): print_key_data_error(PlayerDataLoader.player_current_mmr_json_name, player_data) return True if not common.isint(player_data[PlayerDataLoader.player_current_lr_json_name]): print_key_data_error(PlayerDataLoader.player_current_lr_json_name, player_data) return True if not isinstance(player_data[PlayerDataLoader.player_last_event_date_json_name], str): print_key_data_error(PlayerDataLoader.player_last_event_date_json_name, player_data) return True if not common.isint(player_data[PlayerDataLoader.player_events_played_json_name]): print_key_data_error(PlayerDataLoader.player_events_played_json_name, player_data) return True return False @staticmethod async def merge_data(rt_data, ct_data): results = {} for player in rt_data: player_id = player[PlayerDataLoader.player_id_json_name] if player_id not in results: results[player_id] = [None, None, None, None, None, None, None, None, None, None] results[player_id][0] = player[PlayerDataLoader.player_name_json_name] if results[player_id][1] is None: results[player_id][1] = player[PlayerDataLoader.discord_id_json_name] results[player_id][2] = player[PlayerDataLoader.player_current_mmr_json_name] results[player_id][4] = player[PlayerDataLoader.player_current_lr_json_name] results[player_id][6] = datetime.min results[player_id][8] = player[PlayerDataLoader.player_events_played_json_name] if results[player_id][8] != "0": try: last_rt_event = player[PlayerDataLoader.player_last_event_date_json_name] if isinstance(last_rt_event, str): results[player_id][6] = datetime.strptime(last_rt_event, '%Y-%m-%d %H:%M:%S') except: print(last_rt_event) for player in ct_data: player_id = player[PlayerDataLoader.player_id_json_name] if player_id not in results: results[player_id] = [None, None, None, None, None, None, None, None, None, None] results[player_id][0] = player[PlayerDataLoader.player_name_json_name] if results[player_id][1] is None: results[player_id][1] = player[PlayerDataLoader.discord_id_json_name] results[player_id][3] = player[PlayerDataLoader.player_current_mmr_json_name] results[player_id][5] = player[PlayerDataLoader.player_current_lr_json_name] results[player_id][7] = datetime.min results[player_id][9] = player[PlayerDataLoader.player_events_played_json_name] if results[player_id][9] != "0": try: last_ct_event = player[PlayerDataLoader.player_last_event_date_json_name] if isinstance(last_ct_event, str): results[player_id][7] = datetime.strptime(last_ct_event, '%Y-%m-%d %H:%M:%S') except: print(last_ct_event) return list(results.values()) @staticmethod async def get_player_data(message_sender, verbose=False, alternative_ctx=None): rt_data = await common.getJSONData(RT_PLAYER_DATA_API_URL) ct_data = await common.getJSONData(CT_PLAYER_DATA_API_URL) if PlayerDataLoader.player_data_is_corrupt(rt_data): await message_sender.queue_message("RT Data was corrupt.", True, alternative_ctx=alternative_ctx) raise CustomExceptions.PlayerDataAPIBadData("RT Data was corrupt.") if PlayerDataLoader.player_data_is_corrupt(ct_data): await message_sender.queue_message("CT Data was corrupt.", True, alternative_ctx=alternative_ctx) raise CustomExceptions.PlayerDataAPIBadData("CT Data was corrupt.") return await PlayerDataLoader.merge_data(rt_data["results"], ct_data["results"]) @staticmethod async def update_player_data(message_sender, verbose=False, alternative_ctx=None): to_load = await PlayerDataLoader.get_player_data(message_sender, verbose, alternative_ctx) await core_data_loader.read_player_data_in(message_sender, to_load, verbose, alternative_ctx)
56.180982
227
0.691073
2,366
18,315
4.91082
0.065089
0.061279
0.026508
0.019279
0.892676
0.802221
0.722782
0.672777
0.623117
0.564334
0
0.002716
0.2362
18,315
326
228
56.180982
0.827865
0.00961
0
0.395437
0
0.007605
0.076287
0
0
0
0
0
0
1
0.015209
false
0
0.019011
0
0.190114
0.072243
0
0
0
null
0
0
0
1
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
3
bf7c908c44f85c601016cedf73cd1859ab44a650
506
py
Python
rl/gym_converter.py
ebola777/gym-demo
6e075870020303fc073515df79f9a8da655d5dc3
[ "MIT" ]
null
null
null
rl/gym_converter.py
ebola777/gym-demo
6e075870020303fc073515df79f9a8da655d5dc3
[ "MIT" ]
null
null
null
rl/gym_converter.py
ebola777/gym-demo
6e075870020303fc073515df79f9a8da655d5dc3
[ "MIT" ]
null
null
null
'''The converter between RL raw data and OpenAI Gym ''' import gym import numpy as np def get_state_set(gym_env): return _gym_space_to_set(gym_env.observation_space) def get_action_set(gym_env): return _gym_space_to_set(gym_env.action_space) def _gym_space_to_set(space): if isinstance(space, gym.spaces.Discrete): return np.arange(space.n).tolist() else: raise ValueError( 'Gym environment class {} cannot be converted to discrete set' .format(type(space).__name__))
23
70
0.743083
79
506
4.43038
0.518987
0.068571
0.102857
0.111429
0.194286
0.194286
0.194286
0.194286
0.194286
0.194286
0
0
0.164032
506
21
71
24.095238
0.827423
0.094862
0
0
0
0
0.133038
0
0
0
0
0
0
1
0.230769
false
0
0.153846
0.153846
0.615385
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
bf8825e2b85d2bf7ecc73565055a4db1e99ba969
1,542
py
Python
Rbx1cnc/Axis.py
equinor/rbx1-cnc
3e359ddb84c0f77511f7c173f4213d6df774e003
[ "MIT" ]
null
null
null
Rbx1cnc/Axis.py
equinor/rbx1-cnc
3e359ddb84c0f77511f7c173f4213d6df774e003
[ "MIT" ]
null
null
null
Rbx1cnc/Axis.py
equinor/rbx1-cnc
3e359ddb84c0f77511f7c173f4213d6df774e003
[ "MIT" ]
null
null
null
import asyncio class NullAxis(): def isBusy(self): return False def getPosition(self): return 0 def goTo(self, pos): pass class Axis(): def __init__(self, min, max, driver): self._min = min self._max = max self._driver = driver def isBusy(self): return self._driver.isBusy() def getJoint(self): return self._driver def getPosition(self): return self._fromStep(self._driver.getPosition()) def goTo(self, pos): self._driver.goTo(self._toStep(pos)) def _toStep(self, value): value = (value + 1) / 2 value = value * (self._max - self._min) return int(value + self._min) def _fromStep(self, value): value -= self._min value = value / (self._max - self._min) return (value * 2) -1 class FakeAxis(): def __init__(self, loop = True): self._pos = 0 self._target = 0 if(loop): asyncio.create_task(self._updateLoop) def isBusy(self): return self._pos != self._target def getPosition(self): return self._toStep(self._pos) def goTo(self, nStep): self._target += nStep def _update(self): diff = self._pos - self._target diff = max( -15, min(15, diff)) self._pos -= diff async def _updateLoop(self): while True: self._update() await asyncio.sleep(0.1)
23.363636
58
0.536965
177
1,542
4.451977
0.237288
0.088832
0.088832
0.072335
0.205584
0.076142
0.076142
0
0
0
0
0.013065
0.354734
1,542
66
59
23.363636
0.778894
0
0
0.163265
0
0
0
0
0
0
0
0
0
1
0.306122
false
0.020408
0.020408
0.142857
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
1
1
0
0
3
bfb5ef663fe55e909021b8f90f733950eabcea01
197
py
Python
api/app/models/__init__.py
wafer-bw/generic-flask-api
b4ad6ac1ef3cab2d4e91f13a1fd1664f9de1fe6c
[ "MIT" ]
2
2019-11-08T16:57:44.000Z
2020-01-30T18:24:24.000Z
api/app/models/__init__.py
wafer-bw/generic-flask-api
b4ad6ac1ef3cab2d4e91f13a1fd1664f9de1fe6c
[ "MIT" ]
null
null
null
api/app/models/__init__.py
wafer-bw/generic-flask-api
b4ad6ac1ef3cab2d4e91f13a1fd1664f9de1fe6c
[ "MIT" ]
1
2019-11-04T13:30:03.000Z
2019-11-04T13:30:03.000Z
""" All Models are listed here for import or dynamic/generic use """ from app.models.users import Users from app.models.fruits import Fruits models = { "users": Users, "fruits": Fruits, }
17.909091
60
0.700508
28
197
4.928571
0.535714
0.101449
0.188406
0
0
0
0
0
0
0
0
0
0.187817
197
11
61
17.909091
0.8625
0.304569
0
0
0
0
0.084615
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
bfc8700ae863a93d8d3de54f419cbd6190bc06f5
166
py
Python
treespeed.py
jameshicks/avl
6807cf3a3c9f4c32c090e0e0f29ffb74c0a78199
[ "MIT" ]
null
null
null
treespeed.py
jameshicks/avl
6807cf3a3c9f4c32c090e0e0f29ffb74c0a78199
[ "MIT" ]
null
null
null
treespeed.py
jameshicks/avl
6807cf3a3c9f4c32c090e0e0f29ffb74c0a78199
[ "MIT" ]
null
null
null
import random, sys from avl import AVLTree rvals = list({random.randint(0, sys.maxsize) for x in range(5000)}) tree = AVLTree() for val in rvals: tree.insert(val)
18.444444
67
0.722892
28
166
4.285714
0.678571
0
0
0
0
0
0
0
0
0
0
0.035714
0.156627
166
8
68
20.75
0.821429
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
44ac050254e108da488a1e46ce73dcd54b91f411
630
py
Python
quest/forms.py
none-da/zeshare
6c13cd3bd9d82d89f53d4a8b287fe2c30f1d3779
[ "BSD-3-Clause" ]
null
null
null
quest/forms.py
none-da/zeshare
6c13cd3bd9d82d89f53d4a8b287fe2c30f1d3779
[ "BSD-3-Clause" ]
null
null
null
quest/forms.py
none-da/zeshare
6c13cd3bd9d82d89f53d4a8b287fe2c30f1d3779
[ "BSD-3-Clause" ]
1
2021-04-12T11:43:38.000Z
2021-04-12T11:43:38.000Z
from django import forms from utils import language_choices from tagging.forms import TagField class AddSnippetForm(forms.Form): title = forms.CharField(required=True, max_length=100) explanation = forms.CharField(required=True, max_length=200) code = forms.CharField(required=True, widget=forms.Textarea({'rows':'10', 'cols':'50'})) public = forms.BooleanField(required=False, initial=True) lang = forms.ChoiceField(choices=language_choices, required=True) tags = TagField(required=True, max_length=100) class SearchSnippetForm(forms.Form): query = forms.CharField(required=True, max_length=50)
45
92
0.75873
80
630
5.9
0.4625
0.152542
0.186441
0.220339
0.279661
0.222458
0
0
0
0
0
0.027223
0.125397
630
14
93
45
0.829401
0
0
0
0
0
0.019017
0
0
0
0
0
0
1
0
false
0
0.25
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
44be7edc9f6dd9b9ac44e178dacad52403e927cc
605
py
Python
ctzs/accounts/forms.py
dbms-ctzs/sage
4aea13a8706ffa71f0c37b544cfd93b4e271b6a5
[ "MIT" ]
null
null
null
ctzs/accounts/forms.py
dbms-ctzs/sage
4aea13a8706ffa71f0c37b544cfd93b4e271b6a5
[ "MIT" ]
13
2021-03-30T14:09:30.000Z
2022-01-13T02:49:10.000Z
ctzs/accounts/forms.py
dbms-ctzs/sage
4aea13a8706ffa71f0c37b544cfd93b4e271b6a5
[ "MIT" ]
3
2020-04-22T16:27:59.000Z
2020-10-10T04:47:55.000Z
from django.forms import ModelForm from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from django import forms from .models import Profile, Comment class CreateUserForm(UserCreationForm): class Meta: model=User fields=['username','email','password1','password2'] class CommentForm(forms.ModelForm): content = forms.CharField(label="", widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Text goes here!!!', 'rows':'4', 'cols':'50'})) class Meta: model = Comment fields = ('content',)
33.611111
156
0.694215
69
605
6.086957
0.550725
0.095238
0.080952
0.1
0
0
0
0
0
0
0
0.00996
0.170248
605
18
157
33.611111
0.826693
0
0
0.142857
0
0
0.155116
0
0
0
0
0
0
1
0
false
0.071429
0.357143
0
0.714286
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
3
44c3522633eb8f6a5578bdf8888a1257b497ea11
189
py
Python
taguette/__init__.py
hilljairus/taguette
a51afa3d7b535332489f89d60b4a0ef2ce0e927b
[ "BSD-3-Clause" ]
null
null
null
taguette/__init__.py
hilljairus/taguette
a51afa3d7b535332489f89d60b4a0ef2ce0e927b
[ "BSD-3-Clause" ]
null
null
null
taguette/__init__.py
hilljairus/taguette
a51afa3d7b535332489f89d60b4a0ef2ce0e927b
[ "BSD-3-Clause" ]
1
2022-01-20T09:16:51.000Z
2022-01-20T09:16:51.000Z
__version__ = '1.1.1' from gettext import NullTranslations trans = NullTranslations() del NullTranslations _exact_version = __version__ def exact_version(): return _exact_version
13.5
36
0.783069
21
189
6.428571
0.52381
0.266667
0
0
0
0
0
0
0
0
0
0.01875
0.153439
189
13
37
14.538462
0.825
0
0
0
0
0
0.026455
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0.142857
0.428571
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
1
0
0
0
3
44dd847b3011fb68b97a88e22e8884a8f20920ae
2,118
py
Python
Week 5 - Object Oriented Programming/Coordinate.py
marwan1023/MITX.6.00.1x
f054fe1a64c0868668998d1cd44d6bb3c5e431b3
[ "CNRI-Python" ]
null
null
null
Week 5 - Object Oriented Programming/Coordinate.py
marwan1023/MITX.6.00.1x
f054fe1a64c0868668998d1cd44d6bb3c5e431b3
[ "CNRI-Python" ]
null
null
null
Week 5 - Object Oriented Programming/Coordinate.py
marwan1023/MITX.6.00.1x
f054fe1a64c0868668998d1cd44d6bb3c5e431b3
[ "CNRI-Python" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Tue Dec 12 01:33:05 2017 @author: Mayur """ # ============================================================================= # Exercise: coordinate # # Consider the following code from the last lecture video: # # class Coordinate(object): # def __init__(self, x, y): # self.x = x # self.y = y # # def getX(self): # # Getter method for a Coordinate object's x coordinate. # # Getter methods are better practice than just accessing an attribute # # directly # return self.x # # def getY(self): # # Getter method for a Coordinate object's y coordinate # return self.y # # def __str__(self): # return '<' + str(self.getX()) + ',' + str(self.getY()) + '>' # Your task is to define the following two methods for the Coordinate class: # # Add an __eq__ method that returns True if coordinates refer to same point in # the plane (i.e., have the same x and y coordinate). # # Define __repr__, a special method that returns a string that looks like a valid # Python expression that could be used to recreate an object with the same value. # In other words, eval(repr(c)) == c given the definition of __eq__ from part 1. # # ============================================================================= #code class Coordinate(object): def __init__(self,x,y): self.x = x self.y = y def getX(self): # Getter method for a Coordinate object's x coordinate. # Getter methods are better practice than just accessing an attribute # directly return self.x def getY(self): # Getter method for a Coordinate object's y coordinate return self.y def __str__(self): return '<' + str(self.getX()) + ',' + str(self.getY()) + '>' def __eq__(self, other): return self.getX() == other.getX() and self.getY() == other.getY() def __repr__(self): return "Coordinate(" + str(self.getX()) + "," + str(self.getY()) + ")"
33.09375
83
0.546742
262
2,118
4.282443
0.362595
0.049911
0.057041
0.067736
0.522282
0.522282
0.502674
0.502674
0.502674
0.502674
0
0.009121
0.27526
2,118
64
84
33.09375
0.721824
0.680831
0
0
0
0
0.028319
0
0
0
0
0
0
1
0.428571
false
0
0
0.357143
0.857143
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
44f7b170ab8ea927bebc91879e68047a55d6d4ba
129
py
Python
config_web/pseudocap_go.py
NikkiBytes/pending.api
3c83bb8e413c3032a3a4539d19a779b5f0b67650
[ "Apache-2.0" ]
3
2019-02-17T23:36:35.000Z
2022-03-01T16:43:06.000Z
config_web/pseudocap_go.py
NikkiBytes/pending.api
3c83bb8e413c3032a3a4539d19a779b5f0b67650
[ "Apache-2.0" ]
56
2019-01-26T16:34:12.000Z
2022-03-23T06:57:03.000Z
config_web/pseudocap_go.py
NikkiBytes/pending.api
3c83bb8e413c3032a3a4539d19a779b5f0b67650
[ "Apache-2.0" ]
6
2020-10-22T17:37:54.000Z
2022-03-01T16:56:55.000Z
ES_HOST = 'localhost:9200' ES_INDEX = 'pending-pseudocap_go' ES_DOC_TYPE = 'gene' API_PREFIX = 'pseudocap_go' API_VERSION = ''
16.125
33
0.736434
19
129
4.578947
0.736842
0.252874
0
0
0
0
0
0
0
0
0
0.035714
0.131783
129
7
34
18.428571
0.741071
0
0
0
0
0
0.390625
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
44fc4dbba54b02ca4d184294f2b42aa9ec5d541d
872
py
Python
bootleg/embeddings/word_embeddings/base_sent_emb.py
mleszczy/bootleg
162d74001cdfbbe146753393641d549e0328acb1
[ "Apache-2.0" ]
1
2021-01-11T18:40:09.000Z
2021-01-11T18:40:09.000Z
bootleg/embeddings/word_embeddings/base_sent_emb.py
mleszczy/bootleg
162d74001cdfbbe146753393641d549e0328acb1
[ "Apache-2.0" ]
null
null
null
bootleg/embeddings/word_embeddings/base_sent_emb.py
mleszczy/bootleg
162d74001cdfbbe146753393641d549e0328acb1
[ "Apache-2.0" ]
null
null
null
"""Base sentence embedding class""" import torch.nn as nn from bootleg.utils import logging_utils class BaseSentEmbedding(nn.Module): """ Base sentence embedding class. We split the word embedding from the sentence encoder, similar to BERT. """ def __init__(self, emb_args, main_args, word_emb_dim, word_symbols): super(BaseSentEmbedding, self).__init__() self.logger = logging_utils.get_logger(main_args) self._key = "sentence" self._dim = word_emb_dim def freeze_params(self): for name, param in self.named_parameters(): param.requires_grad = False self.logger.debug(f'Freezing {name}') return def forward(self, word_package): raise ValueError("Not implemented.") def get_dim(self): return self._dim def get_key(self): return self._key
29.066667
106
0.667431
112
872
4.9375
0.491071
0.0434
0.075949
0.094033
0
0
0
0
0
0
0
0
0.240826
872
30
107
29.066667
0.835347
0.151376
0
0
0
0
0.054167
0
0
0
0
0
0
1
0.263158
false
0
0.105263
0.105263
0.578947
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
7820f00bc47b9a319cdfa1eb3e9738b344741d4b
137
py
Python
module3/0homework/course_system/manage.py
Strugglingrookie/oldboy2
8ed6723cab1f54f2ff8ea0947c6f982aef7e1b47
[ "Apache-2.0" ]
1
2021-06-15T07:01:23.000Z
2021-06-15T07:01:23.000Z
module3/0homework/object_practice23-27/manage.py
Strugglingrookie/oldboy2
8ed6723cab1f54f2ff8ea0947c6f982aef7e1b47
[ "Apache-2.0" ]
3
2020-02-13T14:35:36.000Z
2021-06-10T21:27:14.000Z
module3/0homework/object_practice23-27/manage.py
Strugglingrookie/oldboy2
8ed6723cab1f54f2ff8ea0947c6f982aef7e1b47
[ "Apache-2.0" ]
1
2020-04-09T02:13:12.000Z
2020-04-09T02:13:12.000Z
# -*- coding: utf-8 -*- # @Time : 2018/12/11 19:44 # @Author : Xiao from bin.main import run if __name__ == "__main__": run()
13.7
29
0.562044
20
137
3.45
0.9
0
0
0
0
0
0
0
0
0
0
0.126214
0.248175
137
10
30
13.7
0.543689
0.474453
0
0
0
0
0.115942
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
3
784e85533dc379298a1df24613b37b934600bb89
2,321
py
Python
jacdac/character_screen/client.py
microsoft/jacdac-python
712ad5559e29065f5eccb5dbfe029c039132df5a
[ "MIT" ]
1
2022-02-15T21:30:36.000Z
2022-02-15T21:30:36.000Z
jacdac/character_screen/client.py
microsoft/jacdac-python
712ad5559e29065f5eccb5dbfe029c039132df5a
[ "MIT" ]
null
null
null
jacdac/character_screen/client.py
microsoft/jacdac-python
712ad5559e29065f5eccb5dbfe029c039132df5a
[ "MIT" ]
1
2022-02-08T19:32:45.000Z
2022-02-08T19:32:45.000Z
# Autogenerated file. Do not edit. from jacdac.bus import Bus, Client from .constants import * from typing import Optional class CharacterScreenClient(Client): """ A screen that displays characters, typically a LCD/OLED character screen. Implements a client for the `Character Screen <https://microsoft.github.io/jacdac-docs/services/characterscreen>`_ service. """ def __init__(self, bus: Bus, role: str) -> None: super().__init__(bus, JD_SERVICE_CLASS_CHARACTER_SCREEN, JD_CHARACTER_SCREEN_PACK_FORMATS, role) @property def message(self) -> Optional[str]: """ Text to show. Use `\n` to break lines., """ return self.register(JD_CHARACTER_SCREEN_REG_MESSAGE).value() @message.setter def message(self, value: str) -> None: self.register(JD_CHARACTER_SCREEN_REG_MESSAGE).set_values(value) @property def brightness(self) -> Optional[float]: """ (Optional) Brightness of the screen. `0` means off., _: / """ return self.register(JD_CHARACTER_SCREEN_REG_BRIGHTNESS).float_value(100) @brightness.setter def brightness(self, value: float) -> None: self.register(JD_CHARACTER_SCREEN_REG_BRIGHTNESS).set_values(value / 100) @property def variant(self) -> Optional[CharacterScreenVariant]: """ (Optional) Describes the type of character LED screen., """ return self.register(JD_CHARACTER_SCREEN_REG_VARIANT).value() @property def text_direction(self) -> Optional[CharacterScreenTextDirection]: """ (Optional) Specifies the RTL or LTR direction of the text., """ return self.register(JD_CHARACTER_SCREEN_REG_TEXT_DIRECTION).value() @text_direction.setter def text_direction(self, value: CharacterScreenTextDirection) -> None: self.register(JD_CHARACTER_SCREEN_REG_TEXT_DIRECTION).set_values(value) @property def rows(self) -> Optional[int]: """ Gets the number of rows., _: # """ return self.register(JD_CHARACTER_SCREEN_REG_ROWS).value() @property def columns(self) -> Optional[int]: """ Gets the number of columns., _: # """ return self.register(JD_CHARACTER_SCREEN_REG_COLUMNS).value()
30.539474
127
0.666954
266
2,321
5.575188
0.315789
0.13149
0.114633
0.139582
0.3412
0.307485
0.307485
0.060688
0
0
0
0.0039
0.226626
2,321
75
128
30.946667
0.822284
0.227919
0
0.181818
1
0
0
0
0
0
0
0
0
1
0.30303
false
0
0.090909
0
0.606061
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
785161a082a35743bc503f0ba7e417c91a2b676f
152
py
Python
tastypie/__init__.py
uditagarwal/tastypie
ece398310040e9ddfeeacee6a699beb1dee6dad6
[ "BSD-3-Clause" ]
1
2018-02-28T03:35:59.000Z
2018-02-28T03:35:59.000Z
tastypie/__init__.py
uditagarwal/tastypie
ece398310040e9ddfeeacee6a699beb1dee6dad6
[ "BSD-3-Clause" ]
null
null
null
tastypie/__init__.py
uditagarwal/tastypie
ece398310040e9ddfeeacee6a699beb1dee6dad6
[ "BSD-3-Clause" ]
null
null
null
from __future__ import unicode_literals __author__ = 'Daniel Lindsley, Cody Soyland, Matt Croydon, Josh Bohde & Issac Kelly' __version__ = (0, 10, 0)
25.333333
84
0.763158
20
152
5.15
0.95
0
0
0
0
0
0
0
0
0
0
0.03125
0.157895
152
5
85
30.4
0.773438
0
0
0
0
0
0.453947
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
78806d388756057daa82457a71a1ea01c508db8c
1,995
py
Python
release/stubs.min/Autodesk/Revit/DB/__init___parts/StairsEditScope.py
htlcnn/ironpython-stubs
780d829e2104b2789d5f4d6f32b0ec9f2930ca03
[ "MIT" ]
182
2017-06-27T02:26:15.000Z
2022-03-30T18:53:43.000Z
release/stubs.min/Autodesk/Revit/DB/__init___parts/StairsEditScope.py
htlcnn/ironpython-stubs
780d829e2104b2789d5f4d6f32b0ec9f2930ca03
[ "MIT" ]
28
2017-06-27T13:38:23.000Z
2022-03-15T11:19:44.000Z
release/stubs.min/Autodesk/Revit/DB/__init___parts/StairsEditScope.py
htlcnn/ironpython-stubs
780d829e2104b2789d5f4d6f32b0ec9f2930ca03
[ "MIT" ]
67
2017-06-28T09:43:59.000Z
2022-03-20T21:17:10.000Z
class StairsEditScope(EditScope,IDisposable): """ StairsEditScope allows user to maintain a stairs-editing session. StairsEditScope(document: Document,transactionName: str) """ def Dispose(self): """ Dispose(self: EditScope,A_0: bool) """ pass def ReleaseUnmanagedResources(self,*args): """ ReleaseUnmanagedResources(self: EditScope,disposing: bool) """ pass def Start(self,*__args): """ Start(self: StairsEditScope,baseLevelId: ElementId,topLevelId: ElementId) -> ElementId Creates a new empty stairs element with a default stairs type in the specified levels and then starts stairs edit mode and editing the new stairs. baseLevelId: The base level on which the stairs is to be placed. topLevelId: The top level where the stairs is to reach. Returns: ElementId of the new stairs. Start(self: StairsEditScope,stairsId: ElementId) -> ElementId Starts an stairs edit mode for an existing Stairs element stairsId: The stairs element to be edited. Returns: ElementId of the editing stairs. It should be the same as the input stairsId """ pass def __enter__(self,*args): """ __enter__(self: IDisposable) -> object """ pass def __exit__(self,*args): """ __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """ pass def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass @staticmethod def __new__(self,document,transactionName): """ __new__(cls: type,document: Document,transactionName: str) """ pass IsPermitted=property(lambda self: object(),lambda self,v: None,lambda self: None) """Tells if the StairsEditScope is permitted to start. Get: IsPermitted(self: StairsEditScope) -> bool """
26.6
215
0.697243
241
1,995
5.481328
0.373444
0.026495
0.036336
0.043149
0.085541
0.085541
0.085541
0.085541
0.085541
0.085541
0
0.000628
0.201504
1,995
74
216
26.959459
0.828625
0.642607
0
0.411765
0
0
0
0
0
0
0
0
0
1
0.411765
false
0.411765
0
0
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
1
0
0
1
0
0
3
78a0a93f8a18eda088abcbb650deb720c9930501
980
py
Python
projectPython/projectPython/views.py
Latoomurua/sitio-Python
c41fc5734a49ddade2db2a8d9b4f0041ed5f3a3b
[ "MIT" ]
null
null
null
projectPython/projectPython/views.py
Latoomurua/sitio-Python
c41fc5734a49ddade2db2a8d9b4f0041ed5f3a3b
[ "MIT" ]
null
null
null
projectPython/projectPython/views.py
Latoomurua/sitio-Python
c41fc5734a49ddade2db2a8d9b4f0041ed5f3a3b
[ "MIT" ]
null
null
null
from os import close from django.http import HttpResponse from django.template import Template, Context from django.template import loader import datetime def saludo(request): return HttpResponse("Hola Django - Coder") def segundaView(request): return HttpResponse("Soy Lautaro Murua este es mi sitio web desarrollado en Django") def diaDeHoy(request): dia = datetime.datetime.now() documentoDeTexto = f"Hoy es dia: <br> {dia}" return HttpResponse(documentoDeTexto) def apellido(request, ape): return HttpResponse(f"El mejor programador se llama {ape}!!") def probandoTemplate(request): mejorProgramador = "Lautaro Murua" lenguaje = "Python" frameworksPython = ["flask", "Pyramid", "Django", "Web2py"] diccionario = {"nombre":mejorProgramador,"lenguaje":lenguaje, "frameworks": frameworksPython} plantilla = loader.get_template("template1.html") documento = plantilla.render(diccionario) return HttpResponse(documento)
29.69697
97
0.742857
109
980
6.669725
0.541284
0.123796
0.049519
0.066025
0
0
0
0
0
0
0
0.002418
0.156122
980
33
98
29.69697
0.876663
0
0
0
0
0
0.224261
0
0
0
0
0
0
1
0.217391
false
0
0.217391
0.130435
0.652174
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
1563b5511d580ddb8788b990ee41a20bb6631217
98
py
Python
datetime.py
stampyzfanz/snake-programmer
1c3baae1bd9bf49774cf8ef30674c23aa702dcda
[ "MIT" ]
2
2020-08-14T12:23:27.000Z
2021-08-20T14:39:49.000Z
datetime.py
stampyzfanz/snake-programmer
1c3baae1bd9bf49774cf8ef30674c23aa702dcda
[ "MIT" ]
null
null
null
datetime.py
stampyzfanz/snake-programmer
1c3baae1bd9bf49774cf8ef30674c23aa702dcda
[ "MIT" ]
1
2021-11-04T07:50:47.000Z
2021-11-04T07:50:47.000Z
import datetime dt = datetime.datetime.now() datetime.datetime() dt.time() < datetime.time(12)
14
29
0.72449
13
98
5.461538
0.461538
0.28169
0
0
0
0
0
0
0
0
0
0.023256
0.122449
98
6
30
16.333333
0.802326
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
1570b0969898bbb12f5ee1633e1bd2d6c80d412d
230
py
Python
Leetcode/1078. Occurrences After Bigram/solution1.py
asanoviskhak/Outtalent
c500e8ad498f76d57eb87a9776a04af7bdda913d
[ "MIT" ]
51
2020-07-12T21:27:47.000Z
2022-02-11T19:25:36.000Z
Leetcode/1078. Occurrences After Bigram/solution1.py
CrazySquirrel/Outtalent
8a10b23335d8e9f080e5c39715b38bcc2916ff00
[ "MIT" ]
null
null
null
Leetcode/1078. Occurrences After Bigram/solution1.py
CrazySquirrel/Outtalent
8a10b23335d8e9f080e5c39715b38bcc2916ff00
[ "MIT" ]
32
2020-07-27T13:54:24.000Z
2021-12-25T18:12:50.000Z
class Solution: def findOcurrences(self, text: str, first: str, second: str) -> List[str]: text = text.split(' ') return [text[i] for i in range(2, len(text)) if text[i - 2] == first and text[i - 1] == second]
46
103
0.591304
36
230
3.777778
0.583333
0.110294
0
0
0
0
0
0
0
0
0
0.017143
0.23913
230
4
104
57.5
0.76
0
0
0
0
0
0.004348
0
0
0
0
0
0
1
0.25
false
0
0
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
15850a60dcf0ad41138ba22cac235126ad4e5ac0
1,825
py
Python
homechallenge/migrations/0007_homeaddressmodel_ownersmodel.py
imuraki/RestAPI
e9123966bc250ab6d0948d9b707897cf3cd192c5
[ "MIT" ]
null
null
null
homechallenge/migrations/0007_homeaddressmodel_ownersmodel.py
imuraki/RestAPI
e9123966bc250ab6d0948d9b707897cf3cd192c5
[ "MIT" ]
7
2021-03-19T08:16:31.000Z
2021-09-08T01:36:48.000Z
homechallenge/migrations/0007_homeaddressmodel_ownersmodel.py
imuraki/RestAPI
e9123966bc250ab6d0948d9b707897cf3cd192c5
[ "MIT" ]
null
null
null
# Generated by Django 2.2.9 on 2020-01-24 16:20 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('homechallenge', '0006_addressmodel_businessmodel'), ] operations = [ migrations.CreateModel( name='OwnersModel', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('Name', models.CharField(max_length=100)), ('FirstName', models.CharField(max_length=100)), ('LastName', models.CharField(max_length=100)), ('Email', models.CharField(max_length=100)), ('DateOfBirth', models.DateTimeField()), ('HomePhone', models.CharField(max_length=100)), ('SSN', models.CharField(max_length=100)), ('PercentageOfOwnership', models.IntegerField()), ('loanapplication', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='homechallenge.LoanApplication')), ], ), migrations.CreateModel( name='HomeAddressModel', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('Address1', models.CharField(max_length=100)), ('Address2', models.CharField(max_length=100)), ('City', models.CharField(max_length=100)), ('State', models.CharField(max_length=100)), ('Zip', models.CharField(max_length=100)), ('owners', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='homechallenge.OwnersModel')), ], ), ]
43.452381
147
0.591781
173
1,825
6.121387
0.375723
0.155807
0.186969
0.249292
0.573182
0.292729
0.292729
0.292729
0.292729
0.292729
0
0.040329
0.266301
1,825
41
148
44.512195
0.75056
0.024658
0
0.285714
1
0
0.141732
0.059618
0
0
0
0
0
1
0
false
0
0.057143
0
0.142857
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
15a12c05027a8c9c1a0f20d215a15cffc6f3fff0
210
py
Python
custom_components/media_player_template/__init__.py
Seperis/media_player.template
c91c3c704fe2dd6dfa00390d88fa11f94f319685
[ "MIT" ]
59
2020-06-07T04:48:27.000Z
2022-03-22T17:03:55.000Z
custom_components/media_player_template/__init__.py
Seperis/media_player.template
c91c3c704fe2dd6dfa00390d88fa11f94f319685
[ "MIT" ]
31
2020-06-07T04:51:04.000Z
2022-02-03T11:16:31.000Z
custom_components/media_player_template/__init__.py
Seperis/media_player.template
c91c3c704fe2dd6dfa00390d88fa11f94f319685
[ "MIT" ]
20
2020-07-09T08:45:02.000Z
2022-03-18T22:22:47.000Z
""" Template for media-player https://github.com/Sennevds/media_player.template """ import logging from itertools import chain from homeassistant.const import MATCH_ALL _LOGGER = logging.getLogger(__name__)
17.5
49
0.804762
27
210
6
0.740741
0.135802
0
0
0
0
0
0
0
0
0
0
0.104762
210
11
50
19.090909
0.861702
0.357143
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
15a52bbb17f8d0dfaf9f5864f84d4ba0d0e4ccd2
989
py
Python
python/advanced_sw/HUNGAMA/test.py
SayanGhoshBDA/code-backup
8b6135facc0e598e9686b2e8eb2d69dd68198b80
[ "MIT" ]
16
2018-11-26T08:39:42.000Z
2019-05-08T10:09:52.000Z
python/advanced_sw/HUNGAMA/test.py
SayanGhoshBDA/code-backup
8b6135facc0e598e9686b2e8eb2d69dd68198b80
[ "MIT" ]
8
2020-05-04T06:29:26.000Z
2022-02-12T05:33:16.000Z
python/advanced_sw/HUNGAMA/test.py
SayanGhoshBDA/code-backup
8b6135facc0e598e9686b2e8eb2d69dd68198b80
[ "MIT" ]
5
2020-02-11T16:02:21.000Z
2021-02-05T07:48:30.000Z
def logo(): hello = """ ,________________________PYTHON_3___SCRAPER_________________________________, [ ,.__.____, ] |[_,, $,__+] (@) ,_____, | | |#| ,~, ,, ,, , , , , |((~))| Systems | | |#| [#] |^. .^| |=| |=| '^' | | .._|#| |$| || '\// || |$'__'$| |^| | | \%_./ [%] [_] '' [_] [..__..] [*] ---- Hungama Scraper | [,__________________________________________________________________________,] """ color_list = ['\033[1;30m','\033[1;31m','\033[1;32m','\033[1;33m','\033[1;34m','\033[1;35m','\033[1;36m','\033[1;37m','\033[1;38m'] end_c = '\033[1;m' import random k = 9 ran = int(random.random()*k) print(color_list[ran] + hello + end_c) logo() print("Hey!!!!!!")
41.208333
132
0.364004
62
989
3.209677
0.516129
0.201005
0
0
0
0
0
0
0
0
0
0.102564
0.408493
989
23
133
43
0.237607
0
0
0
0
0
0.801015
0.15736
0
0
0
0
0
1
0.052632
false
0
0.052632
0
0.105263
0.105263
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
15b82df7fdd0dd1325de3c246f7cfba1b52a98a4
4,302
py
Python
bot/utils/Time_Test.py
johnnyxh/PloverBot
02d3ede8d4a62750b45447f6699caefc217b70f1
[ "MIT" ]
1
2019-09-29T15:40:24.000Z
2019-09-29T15:40:24.000Z
bot/utils/Time_Test.py
johnnyxh/HummingBot
02d3ede8d4a62750b45447f6699caefc217b70f1
[ "MIT" ]
null
null
null
bot/utils/Time_Test.py
johnnyxh/HummingBot
02d3ede8d4a62750b45447f6699caefc217b70f1
[ "MIT" ]
null
null
null
import unittest from unittest.mock import patch, MagicMock from utils.Timer import Timer from utils.Timer import TimerError class TimerTest(unittest.TestCase): @patch('utils.Timer.time') def test_initialization_default(self, time_mock): timer = Timer() self.assertEqual(timer.initial_start_time, 0) self.assertEqual(timer.start_time, 0) self.assertEqual(timer.pause_started, None) self.assertEqual(timer.amount_time_paused, 0) @patch('utils.Timer.time') def test_initialization_start_time(self, time_mock): timer = Timer(50) self.assertEqual(timer.initial_start_time, 50) self.assertEqual(timer.start_time, 0) self.assertEqual(timer.pause_started, None) self.assertEqual(timer.amount_time_paused, 0) @patch('utils.Timer.time') def test_start(self, time_mock): time_mock.time.return_value = 1525628158.745443 timer = Timer() timer.start() self.assertEqual(timer.start_time, 1525628158) @patch('utils.Timer.time') def test_start_already_started(self, time_mock): time_mock.time.return_value = 1525628158.745443 timer = Timer() timer.start() self.assertRaises(TimerError, timer.start) @patch('utils.Timer.time') def test_pause(self, time_mock): timer = Timer() time_mock.time.return_value = 1525628158.745443 timer.start() time_mock.time.return_value = 1525628188.142346 timer.pause() self.assertEqual(timer.pause_started, 1525628188) def test_pause_not_started(self): timer = Timer() self.assertRaises(TimerError, timer.pause) @patch('utils.Timer.time') def test_pause_already_paused(self, time_mock): time_mock.time.return_value = 1525628188.142346 timer = Timer() timer.start() timer.pause() self.assertRaises(TimerError, timer.pause) @patch('utils.Timer.time') def test_resume(self, time_mock): timer = Timer() time_mock.time.return_value = 1525628158.745443 timer.start() time_mock.time.return_value = 1525628188.142346 timer.pause() time_mock.time.return_value = 1525628198.142346 timer.resume() self.assertEqual(timer.amount_time_paused, 10) self.assertEqual(timer.pause_started, None) @patch('utils.Timer.time') def test_resume_not_paused(self, time_mock): timer = Timer() time_mock.time.return_value = 1525628158.745443 timer.start() self.assertRaises(TimerError, timer.resume) def test_resume_not_started(self): timer = Timer() self.assertRaises(TimerError, timer.resume) @patch('utils.Timer.time') def test_get_elapsed_seconds(self, time_mock): timer = Timer() time_mock.time.return_value = 1525628158.745443 timer.start() time_mock.time.return_value = 1525628188.142346 self.assertEqual(timer.get_elapsed_seconds(), 30) @patch('utils.Timer.time') def test_get_elapsed_seconds_initial_start_time(self, time_mock): timer = Timer(20) time_mock.time.return_value = 1525628158.745443 timer.start() time_mock.time.return_value = 1525628188.142346 self.assertEqual(timer.get_elapsed_seconds(), 50) @patch('utils.Timer.time') def test_get_elapsed_seconds_paused(self, time_mock): timer = Timer() time_mock.time.return_value = 1525628158.745443 timer.start() time_mock.time.return_value = 1525628188.142346 timer.pause() time_mock.time.return_value = 1525628198.142346 self.assertEqual(timer.get_elapsed_seconds(), 30) @patch('utils.Timer.time') def test_get_elapsed_seconds_with_pause(self, time_mock): timer = Timer() time_mock.time.return_value = 1525628158.745443 timer.start() time_mock.time.return_value = 1525628188.142346 timer.pause() time_mock.time.return_value = 1525628198.142346 timer.resume() time_mock.time.return_value = 1525628208.142346 self.assertEqual(timer.get_elapsed_seconds(), 40) def test_get_elapsed_seconds_not_started(self): timer = Timer() self.assertEqual(timer.get_elapsed_seconds(), 0) @patch('utils.Timer.time') def test_get_current_timestamp_not_started(self, time_mock): timer = Timer() self.assertEqual(timer.get_current_timestamp(), '00h:00m:00s') @patch('utils.Timer.time') def test_get_current_timestamp(self, time_mock): timer = Timer() time_mock.time.return_value = 1525628158.745443 timer.start() time_mock.time.return_value = 1525664910.142346 self.assertEqual(timer.get_current_timestamp(), '10h:12m:32s')
25.157895
66
0.762901
592
4,302
5.302365
0.096284
0.091749
0.095572
0.126155
0.898694
0.859828
0.763619
0.679197
0.634597
0.553361
0
0.107181
0.119479
4,302
170
67
25.305882
0.721489
0
0
0.683761
0
0
0.057183
0
0
0
0
0
0.205128
1
0.145299
false
0
0.034188
0
0.188034
0
0
0
0
null
0
0
0
1
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
3
ec5fe5516bfdacf9ae882df0107a60ef49e24bd8
135
py
Python
build/lib/kat_ran/__init__.py
alanaby01/kat_ran_thru_my_keebord
17bf9300db794eba436d1f6061462ef7ecbe3aa0
[ "MIT" ]
3
2019-10-08T12:17:55.000Z
2019-10-13T16:05:49.000Z
build/lib/kat_ran/__init__.py
alanaby01/kat_ran_thru_my_keebord
17bf9300db794eba436d1f6061462ef7ecbe3aa0
[ "MIT" ]
5
2019-10-11T15:36:49.000Z
2020-08-11T04:32:09.000Z
build/lib/kat_ran/__init__.py
alanaby01/kat_ran_thru_my_keebord
17bf9300db794eba436d1f6061462ef7ecbe3aa0
[ "MIT" ]
8
2019-10-06T17:04:07.000Z
2020-03-18T14:16:43.000Z
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Oct 13 19:35:17 2019 @author: abhijithneilabraham """ name='katran'
15
35
0.651852
20
135
4.4
1
0
0
0
0
0
0
0
0
0
0
0.121739
0.148148
135
9
36
15
0.643478
0.807407
0
0
0
0
0.333333
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
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3