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
4c1d5fb32d1e1d2d5d1c66764d0df4922e0a8130
344
py
Python
atest/testresources/testlibs/newstyleclasses3.py
phil-davis/robotframework
4d4ce686cbe01e293bb86ea6ff34330e8c45fc43
[ "ECL-2.0", "Apache-2.0" ]
9
2020-04-22T08:30:52.000Z
2020-12-07T08:25:09.000Z
atest/testresources/testlibs/newstyleclasses3.py
phil-davis/robotframework
4d4ce686cbe01e293bb86ea6ff34330e8c45fc43
[ "ECL-2.0", "Apache-2.0" ]
63
2020-03-04T17:31:39.000Z
2022-03-01T09:12:16.000Z
atest/testresources/testlibs/newstyleclasses3.py
phil-davis/robotframework
4d4ce686cbe01e293bb86ea6ff34330e8c45fc43
[ "ECL-2.0", "Apache-2.0" ]
4
2016-02-29T15:42:22.000Z
2018-05-08T08:58:18.000Z
class MyMetaClass(type): def __new__(cls, name, bases, ns): ns['kw_created_by_metaclass'] = lambda self, arg: arg.upper() return type.__new__(cls, name, bases, ns) def method_in_metaclass(cls): pass class MetaClassLibrary(metaclass=MyMetaClass): def greet(self, name): return 'Hello %s!' % name
22.933333
69
0.648256
44
344
4.772727
0.568182
0.057143
0.095238
0.142857
0.161905
0
0
0
0
0
0
0
0.232558
344
14
70
24.571429
0.795455
0
0
0
0
0
0.093023
0.06686
0
0
0
0
0
1
0.333333
false
0.111111
0
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
1
0
1
0
1
1
0
0
4
4c2a15016afe9bd39d99602e6c454f436e1ff40b
192
py
Python
Problems/snake_case/task.py
gabrielizalo/jetbrains-academy-python-coffee-machine
e22cb502f7998855ef4afbc4ef7ecb8226418225
[ "MIT" ]
null
null
null
Problems/snake_case/task.py
gabrielizalo/jetbrains-academy-python-coffee-machine
e22cb502f7998855ef4afbc4ef7ecb8226418225
[ "MIT" ]
null
null
null
Problems/snake_case/task.py
gabrielizalo/jetbrains-academy-python-coffee-machine
e22cb502f7998855ef4afbc4ef7ecb8226418225
[ "MIT" ]
null
null
null
lower_camel_case = input() snake_case = "" for char in lower_camel_case: if char.isupper(): snake_case += "_" + char.lower() else: snake_case += char print(snake_case)
21.333333
40
0.635417
26
192
4.346154
0.461538
0.318584
0.247788
0
0
0
0
0
0
0
0
0
0.239583
192
8
41
24
0.773973
0
0
0
0
0
0.005208
0
0
0
0
0
0
1
0
false
0
0
0
0
0.125
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4c2f53a6e8450c6a3ef4e67313cdc6a15824822e
363
py
Python
api/permissions.py
plaunezkiy/conomy
4769508c0ffb4b1e2e14e09a69c3199d1296e485
[ "MIT" ]
null
null
null
api/permissions.py
plaunezkiy/conomy
4769508c0ffb4b1e2e14e09a69c3199d1296e485
[ "MIT" ]
null
null
null
api/permissions.py
plaunezkiy/conomy
4769508c0ffb4b1e2e14e09a69c3199d1296e485
[ "MIT" ]
null
null
null
from rest_framework.permissions import BasePermission, IsAuthenticated class IsOwner(BasePermission): def has_object_permission(self, request, view, obj): return obj.owner == request.user class IsParty(BasePermission): def has_object_permission(self, request, view, obj): return request.user in (obj.sender.owner, obj.recipient.owner)
30.25
70
0.757576
44
363
6.136364
0.545455
0.125926
0.148148
0.192593
0.444444
0.444444
0.444444
0.444444
0.444444
0.444444
0
0
0.15427
363
11
71
33
0.879479
0
0
0.285714
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0.142857
0.285714
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
4c4e9d45d841b6949ac28eaf2f10c32ff4b396a1
373
py
Python
Utility/LandmarkRecognitionMeta.py
logisticAKB/course-paper1
8455d5148e0871912791516126819b0d0b51c7c1
[ "MIT" ]
1
2021-03-13T17:05:02.000Z
2021-03-13T17:05:02.000Z
Utility/LandmarkRecognitionMeta.py
logisticAKB/LandmarkRecognition
8455d5148e0871912791516126819b0d0b51c7c1
[ "MIT" ]
null
null
null
Utility/LandmarkRecognitionMeta.py
logisticAKB/LandmarkRecognition
8455d5148e0871912791516126819b0d0b51c7c1
[ "MIT" ]
null
null
null
""" Модуль реализации метакласса, необходимого для работы представления. QObject - метакласс общий для оконных компонентов Qt. ABCMeta - метакласс для реализации абстрактных суперклассов. LandmarkRecognitionMeta - метакласс для представления. """ from PyQt5.QtCore import QObject from abc import ABCMeta class LandmarkRecognitionMeta(type(QObject), ABCMeta): pass
23.3125
68
0.809651
39
373
7.74359
0.641026
0.07947
0
0
0
0
0
0
0
0
0
0.003096
0.134048
373
15
69
24.866667
0.931889
0.643432
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.25
0.5
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
1
0
1
0
0
4
4c56e58af53d92cedd1963c5d5edfa90ad2522de
1,273
py
Python
tests/100_compiler/001_write.py
sveetch/boussole
26727a12449f66efa13e33469ef1fb587f6606f5
[ "MIT" ]
13
2016-05-19T15:18:41.000Z
2022-03-22T15:37:32.000Z
tests/100_compiler/001_write.py
sveetch/boussole
26727a12449f66efa13e33469ef1fb587f6606f5
[ "MIT" ]
38
2016-04-07T00:30:58.000Z
2022-02-28T13:29:33.000Z
tests/100_compiler/001_write.py
sveetch/boussole
26727a12449f66efa13e33469ef1fb587f6606f5
[ "MIT" ]
3
2016-05-20T09:21:57.000Z
2020-10-12T10:56:49.000Z
# -*- coding: utf-8 -*- import io def test_001(compiler, temp_builds_dir): """ Just creating file with latin content """ filepath = temp_builds_dir.join("compiler_write_001") content = """Some sample latin text""" compiler.write_content(content, filepath.strpath) # Read file to compare with io.open(filepath.strpath, "r", encoding="utf-8") as f: result = f.read() assert content == result def test_002(compiler, temp_builds_dir): """ Creating file with unicode content """ filepath = temp_builds_dir.join("compiler_write_002") content = """Some sample unicode text: フランス Furansu""" compiler.write_content(content, filepath.strpath) # Read file to compare with io.open(filepath.strpath, "r", encoding="utf-8") as f: result = f.read() assert content == result def test_003(compiler, temp_builds_dir): """ Creating file into subdirectory """ filepath = temp_builds_dir.join("foo/bar/home.txt") content = """Some sample unicode text: フランス Furansu""" compiler.write_content(content, filepath.strpath) # Read file to compare with io.open(filepath.strpath, "r", encoding="utf-8") as f: result = f.read() assert content == result
23.574074
63
0.657502
166
1,273
4.909639
0.277108
0.07362
0.095706
0.077301
0.813497
0.782822
0.70184
0.70184
0.591411
0.591411
0
0.019095
0.218382
1,273
53
64
24.018868
0.8
0.149254
0
0.636364
0
0
0.162476
0
0
0
0
0
0.136364
1
0.136364
false
0
0.045455
0
0.181818
0
0
0
0
null
0
0
0
1
1
1
1
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
4
4c6f44fbecd6005460783a3589fbbab2af23dc11
65
py
Python
run-local.py
DextrousInc/board-me-server
07015f307254dab821171d55f56a5c14f1700cfd
[ "MIT" ]
null
null
null
run-local.py
DextrousInc/board-me-server
07015f307254dab821171d55f56a5c14f1700cfd
[ "MIT" ]
null
null
null
run-local.py
DextrousInc/board-me-server
07015f307254dab821171d55f56a5c14f1700cfd
[ "MIT" ]
null
null
null
from boardme import app, db app.debug = True app.run(port=8090)
13
27
0.738462
12
65
4
0.833333
0
0
0
0
0
0
0
0
0
0
0.072727
0.153846
65
4
28
16.25
0.8
0
0
0
0
0
0
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
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
4c70791c0665dbd7c45c15e49ebc6d314acc3c6e
5,369
py
Python
pyramboia/tasks/forms.py
bicofino/Pyramboia
1c291b8fdc71f057a99e7ffbfaa8ba4e713346fd
[ "MIT" ]
1
2016-03-09T13:40:06.000Z
2016-03-09T13:40:06.000Z
pyramboia/tasks/forms.py
bicofino/Pyramboia
1c291b8fdc71f057a99e7ffbfaa8ba4e713346fd
[ "MIT" ]
null
null
null
pyramboia/tasks/forms.py
bicofino/Pyramboia
1c291b8fdc71f057a99e7ffbfaa8ba4e713346fd
[ "MIT" ]
1
2018-03-24T18:03:09.000Z
2018-03-24T18:03:09.000Z
from django import forms from crispy_forms.helper import FormHelper from crispy_forms.layout import * from crispy_forms.bootstrap import * from .models import Task, Project, Argument, Target, Header class ProjectForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(ProjectForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_method = 'POST' self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-lg-2' self.helper.field_class = 'col-lg-8' self.helper.layout = Layout( Field('project_name', css_class="input-sm"), Field('description', css_class="input-lg"), FormActions( Submit('submit', "Submit", css_class='btn'), Submit('cancel', "Cancel", css_class='btn'), ) ) #self.helper.layout.append(Submit('save', 'save')) class Meta: model = Project class TaskForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(TaskForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_method = 'POST' self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-lg-2' self.helper.field_class = 'col-lg-8' self.helper.layout = Layout( Field('project_name', css_class="input-sm"), Field('task_name', css_class="input-sm"), Field('target', css_class="input-sm", HTML='<a href="/addtarget"/>a</a>'), Field('request', css_class="input-lg"), Field('requires', css_class="input-sm"), Field('threshold', css_class="input-sm"), Field('header', css_class="input-sm"), Field('arguments', css_class="input-sm"), Field('test', css_class="input-sm"), Field('steps', css_class="input-sm"), FormActions( Submit('submit', "Submit", css_class='btn'), Submit('cancel', "Cancel", css_class='btn'), ) ) class Meta: model = Task class ArgumentForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(ArgumentForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_method = 'POST' self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-lg-2' self.helper.field_class = 'col-lg-8' self.helper.layout = Layout( Field('name', css_class="input-sm"), Field('argument', css_class="input-sm"), Field('value', css_class="input-sm"), FormActions( Submit('submit', "Submit", css_class='btn'), Submit('cancel', "Cancel", css_class='btn'), ) ) #self.helper.layout.append(Submit('save', 'save')) class Meta: model = Argument class HeaderForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(HeaderForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_method = 'POST' self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-lg-2' self.helper.field_class = 'col-lg-8' self.helper.layout = Layout( Field('name', css_class="input-sm"), Field('contenttype', css_class="input-sm"), Field('charset', css_class="input-sm"), Field('soapaction', css_class="input-sm"), FormActions( Submit('submit', "Submit", css_class='btn'), Submit('cancel', "Cancel", css_class='btn'), ) ) #self.helper.layout.append(Submit('save', 'save')) class Meta: model = Header class TargetForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(TargetForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_method = 'POST' self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-lg-2' self.helper.field_class = 'col-lg-8' self.helper.layout = Layout( Field('name', css_class="input-sm"), Field('url', css_class="input-sm"), FormActions( Submit('submit', "Submit", css_class='btn'), Submit('cancel', "Cancel", css_class='btn'), ) ) #self.helper.layout.append(Submit('save', 'save')) class Meta: model = Target
40.674242
68
0.486497
511
5,369
4.921722
0.129159
0.135189
0.108549
0.11332
0.792445
0.728827
0.719284
0.719284
0.639761
0.639761
0
0.003014
0.382008
5,369
131
69
40.984733
0.754973
0.036506
0
0.560748
0
0
0.130393
0.004643
0
0
0
0
0
1
0.046729
false
0
0.046729
0
0.186916
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4c7a9d083d36061c8e0f35d3b9695e335d5ee88a
364
py
Python
ecommerce/shop_management/managers.py
mhdirajabi/django-drf-e-commerce
526044a728f9f073a21386ff7f67ac570f4755c6
[ "MIT" ]
null
null
null
ecommerce/shop_management/managers.py
mhdirajabi/django-drf-e-commerce
526044a728f9f073a21386ff7f67ac570f4755c6
[ "MIT" ]
null
null
null
ecommerce/shop_management/managers.py
mhdirajabi/django-drf-e-commerce
526044a728f9f073a21386ff7f67ac570f4755c6
[ "MIT" ]
null
null
null
from django.db.models import Manager class ShopManager(Manager): def get_queryset(self): return super(ShopManager, self).get_queryset().all().exclude(status="deleted") class ConfirmedShopManager(Manager): def get_queryset(self): return ( super(ConfirmedShopManager, self).get_queryset().filter(status="confirmed") )
26
87
0.695055
39
364
6.384615
0.538462
0.176707
0.104418
0.168675
0.289157
0.289157
0.289157
0
0
0
0
0
0.186813
364
13
88
28
0.841216
0
0
0.222222
0
0
0.043956
0
0
0
0
0
0
1
0.222222
false
0
0.111111
0.222222
0.777778
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
9108d53d5b33dc8ccbae3169a981f917d78407ce
113
py
Python
handlers/test_handler.py
stdex/sailplay_python_case
fa3c04099a2148bdeef6857e25f8480aafb3f9ff
[ "MIT" ]
null
null
null
handlers/test_handler.py
stdex/sailplay_python_case
fa3c04099a2148bdeef6857e25f8480aafb3f9ff
[ "MIT" ]
null
null
null
handlers/test_handler.py
stdex/sailplay_python_case
fa3c04099a2148bdeef6857e25f8480aafb3f9ff
[ "MIT" ]
null
null
null
from handlers import BaseHandler class TestHandler(BaseHandler): def test_echo(test): return (test)
18.833333
32
0.725664
13
113
6.230769
0.769231
0
0
0
0
0
0
0
0
0
0
0
0.20354
113
5
33
22.6
0.9
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
910d148e642368ac967eb20527c4b2d6a09fe7e5
38
py
Python
ABC_A/ABC068_A.py
ryosuke0825/atcoder_python
185cdbe7db44ecca1aaf357858d16d31ce515ddb
[ "MIT" ]
null
null
null
ABC_A/ABC068_A.py
ryosuke0825/atcoder_python
185cdbe7db44ecca1aaf357858d16d31ce515ddb
[ "MIT" ]
null
null
null
ABC_A/ABC068_A.py
ryosuke0825/atcoder_python
185cdbe7db44ecca1aaf357858d16d31ce515ddb
[ "MIT" ]
null
null
null
n = input() print("ABC" + n.zfill(3))
12.666667
25
0.552632
7
38
3
0.857143
0
0
0
0
0
0
0
0
0
0
0.03125
0.157895
38
2
26
19
0.625
0
0
0
0
0
0.078947
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
911127e1164dd47156f273c9a8f862805fc6a462
656
py
Python
fdk_client/platform/models/AppSupportedCurrency.py
kavish-d/fdk-client-python
a1023eb530473322cb52e095fc4ceb226c1e6037
[ "MIT" ]
null
null
null
fdk_client/platform/models/AppSupportedCurrency.py
kavish-d/fdk-client-python
a1023eb530473322cb52e095fc4ceb226c1e6037
[ "MIT" ]
null
null
null
fdk_client/platform/models/AppSupportedCurrency.py
kavish-d/fdk-client-python
a1023eb530473322cb52e095fc4ceb226c1e6037
[ "MIT" ]
null
null
null
"""Platform Models.""" from marshmallow import fields, Schema from marshmallow.validate import OneOf from ..enums import * from ..models.BaseSchema import BaseSchema from .DefaultCurrency import DefaultCurrency class AppSupportedCurrency(BaseSchema): # Configuration swagger.json _id = fields.Str(required=False) supported_currency = fields.List(fields.Str(required=False), required=False) application = fields.Str(required=False) default_currency = fields.Nested(DefaultCurrency, required=False) created_at = fields.Str(required=False) updated_at = fields.Str(required=False)
17.263158
80
0.719512
69
656
6.768116
0.434783
0.194861
0.182013
0.235546
0.102784
0
0
0
0
0
0
0
0.193598
656
37
81
17.72973
0.882798
0.067073
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.416667
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
1
0
1
0
0
4
9119c51f9a907e70797271e9088ff06fa1a30f23
78
py
Python
openBMC/__init__.py
kevinkellyspacey/openBMC-rpi
468f3ec39a29e7d89e0601ba6d51279cd4617b93
[ "MIT" ]
null
null
null
openBMC/__init__.py
kevinkellyspacey/openBMC-rpi
468f3ec39a29e7d89e0601ba6d51279cd4617b93
[ "MIT" ]
null
null
null
openBMC/__init__.py
kevinkellyspacey/openBMC-rpi
468f3ec39a29e7d89e0601ba6d51279cd4617b93
[ "MIT" ]
null
null
null
'''The openBMC toolset is used for RPI module to do thermal control as BMC'''
39
77
0.74359
14
78
4.142857
1
0
0
0
0
0
0
0
0
0
0
0
0.179487
78
1
78
78
0.90625
0.910256
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
912ea9f70558fe27bae3c8dd08e2cdbdd842376c
48,674
py
Python
managesf/tests/test_resources_engine.py
softwarefactory-project/managesf
7018d041291f50b90e782ca31d0cfc67abd10170
[ "Apache-2.0" ]
1
2018-08-02T23:30:03.000Z
2018-08-02T23:30:03.000Z
managesf/tests/test_resources_engine.py
softwarefactory-project/managesf
7018d041291f50b90e782ca31d0cfc67abd10170
[ "Apache-2.0" ]
1
2021-12-13T18:24:10.000Z
2021-12-13T20:10:39.000Z
managesf/tests/test_resources_engine.py
softwarefactory-project/managesf
7018d041291f50b90e782ca31d0cfc67abd10170
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # # Copyright (c) 2016 Red Hat, 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. import os import shutil import tempfile from unittest import TestCase from mock import patch from managesf.tests import dummy_conf from managesf.model.yamlbkd import engine from managesf.model.yamlbkd.engine import SFResourceBackendEngine from managesf.model.yamlbkd.engine import ResourceDepsException from managesf.model.yamlbkd.engine import ResourceUnicityException from managesf.model.yamlbkd.engine import RTYPENotDefinedException from managesf.model.yamlbkd.yamlbackend import YAMLDBException from managesf.model.yamlbkd.resource import BaseResource from managesf.model.yamlbkd.resource import ModelInvalidException from managesf.model.yamlbkd.resource import ResourceInvalidException from managesf.model.yamlbkd.resources.dummy import Dummy class EngineTest(TestCase): @classmethod def setupClass(cls): cls.conf = dummy_conf() engine.conf = cls.conf def setUp(self): self.to_delete = [] def tearDown(self): for d in self.to_delete: shutil.rmtree(d) def test_init_engine(self): SFResourceBackendEngine('/tmp/dir', 'resources') def test_get_resources_priority(self): class A(BaseResource): PRIORITY = 60 PRIMARY_KEY = None class B(BaseResource): PRIORITY = 40 PRIMARY_KEY = None class C(BaseResource): PRIORITY = 55 PRIMARY_KEY = None en = SFResourceBackendEngine(None, None) with patch.dict(engine.MAPPING, {'dummies': Dummy, 'A': A, 'B': B, 'C': C}, clear=True): # Resource callback will be called in that # order A, C, dummies, B self.assertEqual([('A', 60), ('C', 55), ('dummies', 50), ('B', 40)], en._get_resources_priority()) self.assertTrue(len(en._get_resources_priority()), 4) def test_load_resource_data(self): path = tempfile.mkdtemp() self.to_delete.append(path) with patch('managesf.model.yamlbkd.yamlbackend.' 'YAMLBackend.__init__') as i, \ patch('managesf.model.yamlbkd.yamlbackend.' 'YAMLBackend.get_data') as g: i.return_value = None g.return_value = {} en = SFResourceBackendEngine(path, 'resources') en._load_resource_data( 'http://sftests.com/r/config.git', 'heads/master', 'mark') self.assertTrue(os.path.isdir( os.path.join(path, 'mark'))) self.assertTrue(i.called) self.assertTrue(g.called) def test_load_resources_data(self): with patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._load_resource_data') as lrd: lrd.return_value = {} en = SFResourceBackendEngine(None, None) en._load_resources_data( 'http://sftests.com/r/config.git', 'heads/master', 'http://sftests.com/r/config.git', 'changes/99/899/1') self.assertEqual(len(lrd.mock_calls), 2) def test_validate(self): path = tempfile.mkdtemp() self.to_delete.append(path) with patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._load_resources_data') as lrd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_get_data_diff') as gdd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_deps_constraints') as cdc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_unicity_constraints') as cu, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_validate_changes') as vc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_rtype_defined') as cd: lrd.return_value = (None, None) eng = SFResourceBackendEngine(path, None) status, _ = eng.validate(None, None, None, None) self.assertTrue(lrd.called) self.assertTrue(gdd.called) self.assertTrue(cdc.called) self.assertTrue(cu.called) self.assertTrue(vc.called) self.assertTrue(cd.called) self.assertTrue(status) with patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._load_resources_data') as lrd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_get_data_diff') as gdd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_deps_constraints') as cdc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_unicity_constraints') as cu, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_validate_changes') as vc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_rtype_defined') as cd: lrd.side_effect = YAMLDBException('') eng = SFResourceBackendEngine(path, None) status, logs = eng.validate(None, None, None, None) self.assertEqual(len(logs), 1) self.assertFalse(status) with patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._load_resources_data') as lrd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_get_data_diff') as gdd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_deps_constraints') as cdc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_unicity_constraints') as cu, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_validate_changes') as vc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_rtype_defined') as cd: lrd.return_value = (None, None) vc.side_effect = ResourceInvalidException('') eng = SFResourceBackendEngine(path, None) status, logs = eng.validate(None, None, None, None) self.assertEqual(len(logs), 1) self.assertFalse(status) with patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._load_resources_data') as lrd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_get_data_diff') as gdd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_deps_constraints') as cdc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_unicity_constraints') as cu, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_validate_changes') as vc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_rtype_defined') as cd: lrd.return_value = (None, None) vc.side_effect = ResourceDepsException('') eng = SFResourceBackendEngine(path, None) status, logs = eng.validate(None, None, None, None) self.assertEqual(len(logs), 1) self.assertFalse(status) with patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._load_resources_data') as lrd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_get_data_diff') as gdd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_deps_constraints') as cdc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_unicity_constraints') as cu, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_validate_changes') as vc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_rtype_defined') as cd: lrd.return_value = (None, None) cu.side_effect = ResourceUnicityException('') eng = SFResourceBackendEngine(path, None) status, logs = eng.validate(None, None, None, None) self.assertEqual(len(logs), 1) self.assertFalse(status) with patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._load_resources_data') as lrd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_get_data_diff') as gdd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_deps_constraints') as cdc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_unicity_constraints') as cu, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_validate_changes') as vc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_rtype_defined') as cd: lrd.return_value = (None, None) cd.side_effect = RTYPENotDefinedException('') eng = SFResourceBackendEngine(path, None) status, logs = eng.validate(None, None, None, None) self.assertEqual(len(logs), 1) self.assertFalse(status) def test_validate_from_structured_data(self): path = tempfile.mkdtemp() self.to_delete.append(path) with patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._load_resource_data') as lrd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_deps_constraints') as cdc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_unicity_constraints') as cu, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_load_resource_data_from_memory') as lm, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_get_data_diff') as gdd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_validate_changes') as vc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_rtype_defined') as cd: lrd.return_value = (None, None) eng = SFResourceBackendEngine(path, None) status, _ = eng.validate_from_structured_data( None, None, None) self.assertTrue(lrd.called) self.assertTrue(cdc.called) self.assertTrue(cu.called) self.assertTrue(lm.called) self.assertTrue(gdd.called) self.assertTrue(vc.called) self.assertTrue(cd.called) self.assertTrue(status) with patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._load_resource_data') as lrd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_deps_constraints') as cdc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_unicity_constraints') as cu, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_load_resource_data_from_memory') as lm, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_get_data_diff') as gdd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_validate_changes') as vc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_rtype_defined') as cd: lrd.side_effect = YAMLDBException('') eng = SFResourceBackendEngine(path, None) status, logs = eng.validate_from_structured_data( None, None, None) self.assertEqual(len(logs), 1) self.assertFalse(status) with patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._load_resource_data') as lrd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_deps_constraints') as cdc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_unicity_constraints') as cu, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_load_resource_data_from_memory') as lm, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_get_data_diff') as gdd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_validate_changes') as v, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_rtype_defined') as cd: lrd.return_value = (None, None) v.side_effect = ResourceInvalidException('') eng = SFResourceBackendEngine(path, None) status, logs = eng.validate_from_structured_data( None, None, None) self.assertEqual(len(logs), 1) self.assertFalse(status) with patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._load_resource_data') as lrd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_deps_constraints') as cdc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_unicity_constraints') as cu, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_load_resource_data_from_memory') as lm, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_get_data_diff') as gdd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_validate_changes') as v, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_rtype_defined') as cd: lrd.return_value = (None, None) v.side_effect = ResourceInvalidException('') eng = SFResourceBackendEngine(path, None) status, logs = eng.validate_from_structured_data( None, None, None) self.assertEqual(len(logs), 1) self.assertFalse(status) with patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._load_resource_data') as lrd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_deps_constraints') as cdc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_unicity_constraints') as cu, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_load_resource_data_from_memory') as lm, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_get_data_diff') as gdd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_validate_changes') as v, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_rtype_defined') as cd: lrd.return_value = (None, None) cd.side_effect = RTYPENotDefinedException('') eng = SFResourceBackendEngine(path, None) status, logs = eng.validate_from_structured_data( None, None, None) self.assertEqual(len(logs), 1) self.assertFalse(status) def test_apply(self): path = tempfile.mkdtemp() self.to_delete.append(path) with patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._load_resources_data') as lrd, \ patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._get_data_diff') as gdd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_resolv_resources_need_refresh') as rrnr, \ patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._apply_changes') as ac: lrd.return_value = (None, None) ac.return_value = False rrnr.return_value = [] eng = SFResourceBackendEngine(path, None) status, logs = eng.apply(None, None, None, None) self.assertTrue(lrd.called) self.assertTrue(gdd.called) self.assertTrue(rrnr.called) self.assertTrue(ac.called) self.assertTrue(status) with patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._load_resources_data') as lrd, \ patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._get_data_diff') as gdd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_resolv_resources_need_refresh') as rrnr, \ patch('managesf.model.yamlbkd.engine.' 'SFResourceBackendEngine._apply_changes') as ac: lrd.side_effect = YAMLDBException('') eng = SFResourceBackendEngine(path, None) status, logs = eng.apply(None, None, None, None) self.assertEqual(len(logs), 1) self.assertFalse(status) def test_direct_apply(self): path = tempfile.mkdtemp() self.to_delete.append(path) with patch('yaml.safe_load'), \ patch('managesf.model.yamlbkd.yamlbackend.YAMLBackend.' '_validate_base_struct'), \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_get_data_diff') as gdd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_deps_constraints') as cd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_unicity_constraints') as cu, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_validate_changes') as vc, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_resolv_resources_need_refresh') as rrnr, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_apply_changes') as ac: ac.return_value = False eng = SFResourceBackendEngine(path, None) status, logs = eng.direct_apply(None, None) self.assertTrue(status) self.assertEqual(len(logs), 0) self.assertTrue(gdd.called) self.assertTrue(cd.called) self.assertTrue(cu.called) self.assertTrue(vc.called) self.assertTrue(rrnr.called) self.assertTrue(ac.called) self.assertTrue(status) with patch('yaml.safe_load'), \ patch('managesf.model.yamlbkd.yamlbackend.YAMLBackend.' '_validate_base_struct'), \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_get_data_diff') as g, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_deps_constraints') as cd, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_check_unicity_constraints') as cu, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_validate_changes') as v, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_resolv_resources_need_refresh') as r, \ patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_apply_changes') as a: v.side_effect = ResourceInvalidException('') eng = SFResourceBackendEngine(path, None) status, logs = eng.direct_apply(None, None) self.assertFalse(status) self.assertEqual(len(logs), 1) self.assertTrue(g.called) self.assertTrue(cd.called) self.assertTrue(cu.called) self.assertFalse(r.called) self.assertFalse(a.called) with patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_apply_changes') as a, \ patch.dict(engine.MAPPING, {'dummies': Dummy}, clear=True): a.return_value = False prev = "resources: {}" new = """resources: dummies: id1: name: dum namespace: a """ eng = SFResourceBackendEngine(path, None) status, logs = eng.direct_apply(prev, new) self.assertIn( 'id1', a.call_args[0][0]['dummies']['create']) self.assertEqual( len(a.call_args[0][0]['dummies']['update']), 0) self.assertEqual( len(a.call_args[0][0]['dummies']['delete']), 0) self.assertTrue(status) with patch('managesf.model.yamlbkd.engine.SFResourceBackendEngine.' '_apply_changes') as a, \ patch.dict(engine.MAPPING, {'dummies': Dummy}, clear=True): new = "a: True" eng = SFResourceBackendEngine(path, None) status, logs = eng.direct_apply(prev, new) self.assertFalse(status) self.assertListEqual( ['The main resource data structure is invalid'], logs) self.assertFalse(status) def test_get(self): with patch('managesf.model.yamlbkd.yamlbackend.' 'YAMLBackend.__init__') as i, \ patch('managesf.model.yamlbkd.yamlbackend.' 'YAMLBackend.get_data') as g: i.return_value = None g.return_value = {} eng = SFResourceBackendEngine('/tmp/adir', None) data = eng.get('https://sftests.com/r/config', None) self.assertTrue( data.get('config-repo'), 'https://sftests.com/r/config') self.assertNotIn('connections', data['resources']) with patch('managesf.model.yamlbkd.engine.conf') as c: c.resources.get.return_value = { 'github.com': {'base_url': 'https://github.com'}} data = eng.get('https://sftests.com/r/config', None) self.assertTrue( data.get('config-repo'), 'https://sftests.com/r/config') self.assertIn('connections', data['resources']) self.assertIn('github.com', data['resources']['connections']) def test_get_data_diff(self): with patch.dict(engine.MAPPING, {'dummies': Dummy}): # Test add resource change detected prev = {'resources': {'dummies': {}}} new = {'resources': {'dummies': {'myprojectid': { 'namespace': 'sf', 'name': 'myproject'}, }}} eng = SFResourceBackendEngine(None, None) ret = eng._get_data_diff(prev, new) self.assertIn('dummies', ret) self.assertIn('create', ret['dummies']) self.assertIn('myprojectid', ret['dummies']['create']) self.assertDictEqual(new['resources']['dummies']['myprojectid'], ret['dummies']['create']['myprojectid']) self.assertEqual(len(ret['dummies']['delete'].keys()), 0) self.assertEqual(len(ret['dummies']['update'].keys()), 0) # Test delete resource change detected prev = {'resources': {'dummies': {'myprojectid': { 'namespace': 'sf', 'name': 'myproject'}, }}} new = {'resources': {'dummies': {}}} eng = SFResourceBackendEngine(None, None) ret = eng._get_data_diff(prev, new) self.assertIn('myprojectid', ret['dummies']['delete']) self.assertEqual(len(ret['dummies']['create'].keys()), 0) self.assertEqual(len(ret['dummies']['update'].keys()), 0) # Test update resource change detected prev = {'resources': {'dummies': {'myprojectid': { 'namespace': 'sf'}, }}} new = {'resources': {'dummies': {'myprojectid': { 'namespace': 'sf2'}, }}} path = tempfile.mkdtemp() self.to_delete.append(path) eng = SFResourceBackendEngine(path, None) ret = eng._get_data_diff(prev, new) self.assertIn('myprojectid', ret['dummies']['update']) self.assertIn( 'namespace', ret['dummies']['update']['myprojectid']['changed']) self.assertDictEqual( new['resources']['dummies']['myprojectid'], ret['dummies']['update']['myprojectid']['data']) # Test that multiple resource changes are detected prev = {'resources': { 'dummies': { 'myprojectid': { 'namespace': 'sf', 'name': 'myproject'}, 'superid': { 'namespace': 'super', 'name': 'project'} }, 'groups': {} }} new = {'resources': { 'dummies': { 'myprojectid': { 'namespace': 'sfnew', 'name': 'mynewproject'}, 'myproject2id': { 'namespace': 'sfnew', 'name': 'newproject'} }, 'groups': { 'mygroupid': { 'name': 'mynewgroup'}, } }} eng = SFResourceBackendEngine(None, None) ret = eng._get_data_diff(prev, new) self.assertDictEqual(ret['dummies']['delete']['superid'], prev['resources']['dummies']['superid']) self.assertDictEqual(ret['dummies']['create']['myproject2id'], new['resources']['dummies']['myproject2id']) self.assertIn('namespace', ret['dummies']['update']['myprojectid']['changed']) self.assertDictEqual( ret['dummies']['update']['myprojectid']['data'], new['resources']['dummies']['myprojectid']) self.assertDictEqual(ret['groups']['create']['mygroupid'], new['resources']['groups']['mygroupid']) # Test update resource change detected on a list prev = {'resources': {'dummies': {'myprojectid': { 'members': ['joe', 'paul']}}}} new = {'resources': {'dummies': {'myprojectid': { 'members': ['paul']}}}} path = tempfile.mkdtemp() self.to_delete.append(path) eng = SFResourceBackendEngine(path, None) ret = eng._get_data_diff(prev, new) self.assertSetEqual( ret['dummies']['update']['myprojectid']['changed'], set(['members'])) def test_validate_changes(self): eng = SFResourceBackendEngine(None, None) validation_logs = [] with patch.dict(engine.MAPPING, {'dummies': Dummy}): with patch.object(Dummy, 'validate') as v: changes = {'dummies': {'create': {'myprojectid': {}}}} eng._validate_changes(changes, validation_logs, {}) self.assertTrue(v.called) v.reset_mock() changes = {'dummies': {'update': { 'myprojectid': {'data': {}, 'changed': []}}}} eng._validate_changes(changes, validation_logs, {}) self.assertTrue(v.called) with patch.object(Dummy, 'is_mutable') as i: v.reset_mock() changes = {'dummies': {'update': { 'myprojectid': {'data': {}, 'changed': ['name']}}}} eng._validate_changes(changes, validation_logs, {}) self.assertTrue(v.called) self.assertTrue(i.called) # Be sure we have 3 validation msgs self.assertTrue(len(validation_logs), 3) validation_logs = [] with patch.object(Dummy, 'validate') as v: v.side_effect = ResourceInvalidException('') changes = {'dummies': {'create': {'myprojectid': {}}}} self.assertRaises(ResourceInvalidException, eng._validate_changes, changes, validation_logs, {}) with patch.object(Dummy, 'validate') as v: v.side_effect = ModelInvalidException('') changes = {'dummies': {'create': {'myprojectid': {}}}} self.assertRaises(ModelInvalidException, eng._validate_changes, changes, validation_logs, {}) # Verify extra validations will be handled validation_logs = [] with patch('managesf.model.yamlbkd.resources.' 'dummy.DummyOps.extra_validations') as xv: xv.return_value = ['error msg1', ' error msg2'] changes = {'dummies': {'create': {'myprojectid': { 'namespace': 'sf', 'name': 'p1'}}}} self.assertRaises(ResourceInvalidException, eng._validate_changes, changes, validation_logs, {}) self.assertTrue(xv.called) self.assertListEqual(['error msg1', ' error msg2'], validation_logs) def test_check_unicity_constraints(self): class Master(BaseResource): MODEL_TYPE = 'master' MODEL = { 'name': (str, "+*", True, None, True, "desc"), } PRIORITY = 40 PRIMARY_KEY = 'name' new = { 'resources': { 'masters': { 'm1': { 'name': 'ichiban', }, 'm2': { 'name': 'ichiban', } } } } en = SFResourceBackendEngine(None, None) with patch.dict(engine.MAPPING, {'masters': Master}): self.assertRaises(ResourceUnicityException, en._check_unicity_constraints, new) def test_check_deps_constraints(self): class Master(BaseResource): MODEL_TYPE = 'master' MODEL = { 'name': (str, "+*", True, None, True, "desc"), 'key1': (str, "+*", True, None, True, "desc"), 'key2': (list, "+*", True, None, True, "desc"), } PRIORITY = 40 PRIMARY_KEY = None def get_deps(self): deps = {'dummies': set([])} deps['dummies'].add(self.resource['key1']) for e in self.resource['key2']: deps['dummies'].add(e) return deps new = { 'resources': { 'dummies': { 'd1': { 'name': 'dummy1', 'namespace': 'space', }, 'd2': { 'name': 'dummy2', 'namespace': 'space', }, 'd3': { 'name': 'dummy3', 'namespace': 'space', }, }, 'masters': { 'm1': { 'key1': 'd1', 'key2': ['d1', 'd2'], } } } } en = SFResourceBackendEngine(None, None) with patch.dict(engine.MAPPING, {'dummies': Dummy, 'masters': Master}): en._check_deps_constraints(new) # Add an unknown dependency new['resources']['masters']['m1']['key1'] = 'd4' self.assertRaises(ResourceDepsException, en._check_deps_constraints, new) def test_resolv_resources_need_refresh(self): class Master(BaseResource): MODEL_TYPE = 'master' MODEL = { 'name': (str, "+*", True, None, True, "desc"), 'key': (list, "+*", True, None, True, "desc"), } PRIORITY = 40 PRIMARY_KEY = None def get_deps(self): deps = {'dummies': set([])} deps['dummies'].add(self.resource['key']) return deps # Engine dectected dummies:d1 has been updated changes = {'dummies': {'update': {'d1': {}}}} # masters:m1:key depends on dummies:d1 tree = { 'resources': { 'dummies': { 'd1': { 'name': 'dummy1', 'namespace': 'space', }, }, 'masters': { 'm1': { 'key': 'd1', } } } } en = SFResourceBackendEngine(None, None) with patch.dict(engine.MAPPING, {'dummies': Dummy, 'masters': Master}): logs = en._resolv_resources_need_refresh(changes, tree) self.assertIn('m1', changes['masters']['update']) self.assertIn('d1', changes['dummies']['update']) self.assertEqual(len(changes['masters']['update']), 1) self.assertEqual(len(changes['dummies']['update']), 1) self.assertIn('Resource [type: masters, ID: m1] need a ' 'refresh as at least one of its dependencies ' 'has been updated', logs) self.assertEqual(len(logs), 1) # Engine dectected masters:m1 has been updated changes = {'masters': {'update': {'m1': {}}}} en = SFResourceBackendEngine(None, None) with patch.dict(engine.MAPPING, {'dummies': Dummy, 'masters': Master}): logs = en._resolv_resources_need_refresh(changes, tree) # masters:m1 is on top of dependency chain # no addtionnal update trigger will be scheduled then self.assertEqual(len(logs), 0) self.assertIn('m1', changes['masters']['update']) self.assertEqual(len(changes['masters']['update']), 1) self.assertNotIn('dummies', changes) class Master2(BaseResource): MODEL_TYPE = 'master2' MODEL = { 'name': (str, "+*", True, None, True, "desc"), 'key': (str, "+*", True, None, True, "desc"), } PRIORITY = 30 PRIMARY_KEY = None def get_deps(self): return {'masters': set([self.resource['key']])} # Engine dectected dummies:d1 has been updated changes = {'dummies': {'update': {'d1': {}}}} # masters:m1:key depends on dummies:d1 # masters2:m1:key depends on master:m1 tree = { 'resources': { 'dummies': { 'd1': { 'name': 'dummy1', 'namespace': 'space', }, }, 'masters': { 'm1': { 'key': 'd1', } }, 'masters2': { 'm1': { 'key': 'm1', } } } } en = SFResourceBackendEngine(None, None) with patch.dict(engine.MAPPING, {'dummies': Dummy, 'masters': Master, 'masters2': Master2}): logs = en._resolv_resources_need_refresh(changes, tree) self.assertTrue(len(logs), 2) self.assertIn('Resource [type: masters, ID: m1] need a refresh ' 'as at least one of its dependencies has been ' 'updated', logs) self.assertIn('Resource [type: masters2, ID: m1] need a refresh ' 'as at least one of its dependencies has been ' 'updated', logs) self.assertIn('m1', changes['masters2']['update']) self.assertIn('m1', changes['masters']['update']) self.assertIn('d1', changes['dummies']['update']) self.assertTrue(len(changes['masters2']['update']), 1) self.assertTrue(len(changes['masters']['update']), 1) self.assertTrue(len(changes['dummies']['update']), 1) def test_apply_changes(self): eng = SFResourceBackendEngine(None, None) apply_logs = [] with patch.dict(engine.MAPPING, {'dummies': Dummy}): with patch('managesf.model.yamlbkd.resources.' 'dummy.DummyOps.create') as c: c.return_value = [] changes = {'dummies': {'create': {'myprojectid': {}}}} self.assertFalse(eng._apply_changes(changes, apply_logs, {})) self.assertTrue(c.called) self.assertIn( 'Resource [type: dummies, ID: myprojectid] ' 'will be created.', apply_logs) self.assertIn( 'Resource [type: dummies, ID: myprojectid] ' 'has been created.', apply_logs) self.assertTrue(len(apply_logs), 2) apply_logs = [] with patch('managesf.model.yamlbkd.resources.' 'dummy.DummyOps.create') as c: c.return_value = ["Resource API error"] changes = {'dummies': {'create': {'myprojectid': {}}}} self.assertTrue(eng._apply_changes(changes, apply_logs, {})) apply_logs = [] with patch('managesf.model.yamlbkd.resources.' 'dummy.DummyOps.create') as c: c.return_value = ["Resource API error"] changes = { 'dummies': { 'create': { 'myprojectid': {} }, 'update': { 'myprojectid2': { 'data': {'key': 'value'}, 'changed': ['key'] } } } } self.assertTrue(eng._apply_changes(changes, apply_logs, {})) self.assertIn('Resource [type: dummies, ID: myprojectid] ' 'will be created.', apply_logs) self.assertIn('Resource API error', apply_logs) self.assertIn('Resource [type: dummies, ID: myprojectid] ' 'create op failed.', apply_logs) self.assertIn('Resource [type: dummies, ID: myprojectid2] ' 'will be updated.', apply_logs) self.assertIn('Resource [type: dummies, ID: myprojectid2] ' 'has been updated.', apply_logs) # Verify an unexpected exception is properly catched apply_logs = [] with patch('managesf.model.yamlbkd.resources.' 'dummy.DummyOps.create') as c: c.side_effect = Exception('Random Error msg') changes = {'dummies': {'create': {'myprojectid': {}}}} self.assertTrue(eng._apply_changes(changes, apply_logs, {})) self.assertIn('Resource [type: dummies, ID: myprojectid] ' 'create op error (Random Error msg).', apply_logs) # Verify an unexpected exception does not exit _apply_changes apply_logs = [] with patch('managesf.model.yamlbkd.resources.' 'dummy.DummyOps.create') as c: c.side_effect = Exception('Random Error msg') changes = { 'dummies': { 'create': { 'myprojectid1': {}, 'myprojectid2': {}, 'myprojectid3': {}, }, } } self.assertTrue(eng._apply_changes(changes, apply_logs, {})) for r in ('myprojectid1', 'myprojectid2', 'myprojectid3'): self.assertIn( 'Resource [type: dummies, ID: %s] will be created.' % ( r), apply_logs) self.assertIn( 'Resource [type: dummies, ID: %s] create op error ' '(Random Error msg).' % r, apply_logs) self.assertIn( 'Resource [type: dummies, ID: %s] create op ' 'failed.' % r, apply_logs) def test_get_missing_resources(self): class Dummy2(Dummy): MODEL_TYPE = 'dummy2' MODEL = { 'name': ( str, '.*', True, None, False, "Resource name", ), 'deps': ( list, '.*', False, [], True, "Resource dependencies", ), } PRIMARY_KEY = 'name' def get_deps(self, keyname=False): if keyname: return 'deps' else: return {'dummies': set(self.resource['deps'])} with patch('managesf.model.yamlbkd.yamlbackend.' 'YAMLBackend.__init__'), \ patch.object(SFResourceBackendEngine, 'get') as g, \ patch.dict(engine.MAPPING, {'dummies': Dummy, 'dummies2': Dummy2}, clear=True), \ patch('managesf.model.yamlbkd.resources.' 'dummy.DummyOps.get_all') as ga: eng = SFResourceBackendEngine(None, None) # PRIMARY_KEY of Dummy is 'name' # PRIMARY_KEY of Dummy2 is 'name' # Check basic scenario. dummies:d2 is really new current_resources = { 'dummies': { 'd1': { 'namespace': 'sf', 'name': 'd1', }, } } real_resources = { 'dummies': { 'd2': { 'namespace': 'sf', 'name': 'd2', }, } } g.return_value = {'resources': current_resources} ga.return_value = ([], real_resources) logs, ret = eng.get_missing_resources(None, None) expected = { 'resources': { 'dummies': { 'd2': { 'namespace': 'sf', }, } } } self.assertDictEqual(ret, expected) self.assertListEqual(logs, []) # Check both resources are detected similar. # dummies:d1 is dummies:dummy-d1-id current_resources = { 'dummies': { 'd1': { 'namespace': 'sf', }, } } real_resources = { 'dummies': { 'd1': { 'namespace': 'sf', }, } } g.return_value = {'resources': current_resources} ga.return_value = ([], real_resources) logs, ret = eng.get_missing_resources(None, None) expected = { 'resources': {} } self.assertDictEqual(ret, expected) self.assertListEqual(logs, []) # Check both resources are detected similar. # dummies:d1 is dummies:dummy-d1-id # dummies2:d2_1 depends on dummies:d1 but # dummies:d1 is know under dummies:dummy-d1-id # This check make sure the deps if is updated. current_resources = { 'dummies': { 'd1': { 'namespace': 'sf', }, } } real_resources = { 'dummies': { 'd1': { 'namespace': 'sf', }, }, 'dummies2': { 'd2_1': { 'deps': ['d1'], }, }, } g.return_value = {'resources': current_resources} ga.return_value = ([], real_resources) logs, ret = eng.get_missing_resources(None, None) expected = { 'resources': { 'dummies2': { 'd2_1': { 'deps': ['d1'], } } } } self.assertDictEqual(ret, expected) self.assertListEqual(logs, [])
44.532479
79
0.502424
4,050
48,674
5.897284
0.084691
0.064771
0.099648
0.114093
0.79078
0.762016
0.721906
0.705116
0.693937
0.650812
0
0.006345
0.384743
48,674
1,092
80
44.57326
0.791198
0.036775
0
0.671429
0
0
0.259106
0.150583
0
0
0
0
0.15
1
0.023469
false
0
0.016327
0.00102
0.054082
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
9138877829798d12c8e49b6202ca50764c4b2c49
5,252
py
Python
pynanopoolapi/__init__.py
concongo/pynanopoolapi
98cc186f446089ae82802e362b8b10af8c01c4eb
[ "MIT" ]
1
2020-03-07T15:53:14.000Z
2020-03-07T15:53:14.000Z
pynanopoolapi/__init__.py
concongo/pynanopoolapi
98cc186f446089ae82802e362b8b10af8c01c4eb
[ "MIT" ]
null
null
null
pynanopoolapi/__init__.py
concongo/pynanopoolapi
98cc186f446089ae82802e362b8b10af8c01c4eb
[ "MIT" ]
null
null
null
import urllib import urllib2 import json import sys class nanopoolapi: __wallet = '' __coing = '' def __init__(self, wallet, coin): self.__wallet = wallet self.__coin = coin def getbalance(self): #Returns the current Balance endpoint = 'https://api.nanopool.org/v1/' + self.__coin + '/balance/' + self.__wallet headers = { 'User-agent': 'Mozilla/4.0 (compatible; pynanopoolapi; ' + str(sys.platform) + '; ' + str(sys.version).replace('\n', '') + ')' } req = urllib2.Request(endpoint, None, headers) page = urllib2.urlopen(req).read() return json.loads(page)["data"] def getaveragehashratelimited(self, hours): #Returns the averagehasrate for a time endpoint = 'https://api.nanopool.org/v1/' + self.__coin + '/avghashratelimited/' + self.__wallet + '/' + str(hours) headers = { 'User-agent': 'Mozilla/4.0 (compatible; pynanopoolapi; ' + str(sys.platform) + '; ' + str(sys.version).replace('\n', '') + ')' } req = urllib2.Request(endpoint, None, headers) page = urllib2.urlopen(req).read() return json.loads(page)["data"] def getaveragehashrate(self): #Returns the averagehasrate for 1, 3, 6, 12, 24 endpoint = 'https://api.nanopool.org/v1/' + self.__coin + '/avghashrate/' + self.__wallet headers = { 'User-agent': 'Mozilla/4.0 (compatible; pynanopoolapi; ' + str(sys.platform) + '; ' + str(sys.version).replace('\n', '') + ')' } req = urllib2.Request(endpoint, None, headers) page = urllib2.urlopen(req).read() return json.loads(page)["data"] def hashrate(self): endpoint = 'https://api.nanopool.org/v1/' + self.__coin + '/hashrate/' + self.__wallet headers = { 'User-agent': 'Mozilla/4.0 (compatible; pynanopoolapi; ' + str(sys.platform) + '; ' + str(sys.version).replace('\n', '') + ')' } req = urllib2.Request(endpoint, None, headers) page = urllib2.urlopen(req).read() return json.loads(page)["data"] def generalinfo(self): endpoint = 'https://api.nanopool.org/v1/' + self.__coin + '/user/' + self.__wallet headers = { 'User-agent': 'Mozilla/4.0 (compatible; pynanopoolapi; ' + str(sys.platform) + '; ' + str(sys.version).replace('\n', '') + ')' } req = urllib2.Request(endpoint, None, headers) page = urllib2.urlopen(req).read() return json.loads(page)["data"] def historyhashrate(self): endpoint = 'https://api.nanopool.org/v1/' + self.__coin + '/history/' + self.__wallet headers = { 'User-agent': 'Mozilla/4.0 (compatible; pynanopoolapi; ' + str(sys.platform) + '; ' + str(sys.version).replace('\n', '') + ')' } req = urllib2.Request(endpoint, None, headers) page = urllib2.urlopen(req).read() return json.loads(page)["data"] def balancehashrate(self): #Returns current balance and hashrate endpoint = 'https://api.nanopool.org/v1/' + self.__coin + '/balance_hashrate/' + self.__wallet headers = { 'User-agent': 'Mozilla/4.0 (compatible; pynanopoolapi; ' + str(sys.platform) + '; ' + str(sys.version).replace('\n', '') + ')' } req = urllib2.Request(endpoint, None, headers) page = urllib2.urlopen(req).read() return json.loads(page)["data"] def calculator(self, hashrate): # Returns current balance and hashrate endpoint = 'https://api.nanopool.org/v1/' + self.__coin + '/approximated_earnings/' + str(hashrate) headers = { 'User-agent': 'Mozilla/4.0 (compatible; pynanopoolapi; ' + str(sys.platform) + '; ' + str(sys.version).replace('\n', '') + ')' } req = urllib2.Request(endpoint, None, headers) page = urllib2.urlopen(req).read() return json.loads(page)["data"] def prices(self): # Returns current balance and hashrate endpoint = 'https://api.nanopool.org/v1/' + self.__coin + '/prices' headers = { 'User-agent': 'Mozilla/4.0 (compatible; pynanopoolapi; ' + str(sys.platform) + '; ' + str(sys.version).replace('\n', '') + ')' } req = urllib2.Request(endpoint, None, headers) page = urllib2.urlopen(req).read() return json.loads(page)["data"] def paymenttimeestimate(self, hours_average): hashrate = self.getaveragehashratelimited(hours_average) earning_estimate = self.calculator(hashrate)['minute']['coins'] current_balance = self.getbalance() payouts = [1.0, 0.5, 0.25, 0.10, 0.05] estimate = {'Minutes':{}, 'Hours':{}, 'Days':{}} for p in payouts: min_to_pay = (p - current_balance) / earning_estimate estimate['Minutes'][str(p)]=min_to_pay estimate['Hours'][str(p)]=min_to_pay/60 estimate['Days'][str(p)]=(min_to_pay/60)/24 return estimate
42.699187
123
0.558835
549
5,252
5.236794
0.162113
0.037565
0.050087
0.07513
0.733565
0.729391
0.719652
0.719652
0.693913
0.633391
0
0.018992
0.27818
5,252
122
124
43.04918
0.739383
0.041889
0
0.524272
0
0
0.187425
0.004576
0
0
0
0
0
1
0.106796
false
0
0.038835
0
0.271845
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
e66b130b913d1f0a847fe9e23bd062e2860526d4
145
py
Python
py2030/collections/changes.py
markkorput/2030-controller
e6f11599e62b1ba5c20ecb20e452b2a8d88e8e9f
[ "MIT" ]
null
null
null
py2030/collections/changes.py
markkorput/2030-controller
e6f11599e62b1ba5c20ecb20e452b2a8d88e8e9f
[ "MIT" ]
null
null
null
py2030/collections/changes.py
markkorput/2030-controller
e6f11599e62b1ba5c20ecb20e452b2a8d88e8e9f
[ "MIT" ]
null
null
null
from py2030.collections.collection import Collection from py2030.collections.change import Change class Changes(Collection): model = Change
24.166667
52
0.82069
17
145
7
0.529412
0.168067
0.352941
0
0
0
0
0
0
0
0
0.062992
0.124138
145
5
53
29
0.874016
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
1
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
e66e21c5147e84e922236b36fa279238a1756bd2
1,498
py
Python
challenges/bringing-a-gun-to-a-trainer-fight/solution.py
cowboysmall-scratch/foobar-coding-challenge
b4a3a703a44bc3e61184629ff6082e40be2e1704
[ "MIT" ]
null
null
null
challenges/bringing-a-gun-to-a-trainer-fight/solution.py
cowboysmall-scratch/foobar-coding-challenge
b4a3a703a44bc3e61184629ff6082e40be2e1704
[ "MIT" ]
null
null
null
challenges/bringing-a-gun-to-a-trainer-fight/solution.py
cowboysmall-scratch/foobar-coding-challenge
b4a3a703a44bc3e61184629ff6082e40be2e1704
[ "MIT" ]
null
null
null
import sys import solution_01 def main(argv): print("") print("Solution 1: ") print(" input: [3, 2], [1, 1], [2, 1], 4") print(" expected: 7") print(" actual: {}".format(solution_01.solution([3, 2], [1, 1], [2, 1], 4))) print("") print("") print("Solution 1: ") print(" input: [300, 275], [150, 150], [185, 100], 500") print(" expected: 9") print(" actual: {}".format(solution_01.solution([300, 275], [150, 150], [185, 100], 500))) print("") print("") print("Solution 1: ") print(" input: [2, 5], [1, 2], [1, 4], 11") print(" expected: 27") print(" actual: {}".format(solution_01.solution([2, 5], [1, 2], [1, 4], 11))) print("") print("") print("Solution 1: ") print(" input: [23, 10], [6, 4], [3, 2], 23") print(" expected: 8") print(" actual: {}".format(solution_01.solution([23, 10], [6, 4], [3, 2], 23))) print("") print("") print("Solution 1: ") print(" input: [1250, 1250], [1000, 1000], [500, 400], 10000") print(" expected: 196") print(" actual: {}".format(solution_01.solution([1250, 1250], [1000, 1000], [500, 400], 10000))) print("") print("") print("Solution 1: ") print(" input: [10, 10], [4, 4], [3, 3], 5000") print(" expected: 739323") print(" actual: {}".format(solution_01.solution([10, 10], [4, 4], [3, 3], 5000))) print("") if __name__ == "__main__": main(sys.argv[1:])
27.740741
103
0.5
195
1,498
3.764103
0.205128
0.149864
0.147139
0.155313
0.836512
0.836512
0.510899
0.313352
0
0
0
0.182547
0.250334
1,498
53
104
28.264151
0.47106
0
0
0.439024
0
0
0.343792
0
0
0
0
0
0
1
0.02439
false
0
0.04878
0
0.073171
0.878049
0
0
0
null
0
0
0
1
1
0
0
0
0
0
0
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
1
0
4
e68f7655142793f76e5cc10899d5395865b56c20
83
py
Python
QGen/apps.py
JavonDavis/QGen-UI
949669a3145aa72141127afadc016e45d6c584a6
[ "MIT" ]
3
2016-04-10T05:52:47.000Z
2017-05-24T14:46:22.000Z
QGen/apps.py
JavonDavis/QGen-UI
949669a3145aa72141127afadc016e45d6c584a6
[ "MIT" ]
1
2016-05-15T01:10:52.000Z
2016-05-15T01:10:52.000Z
QGen/apps.py
JavonDavis/QGen-UI
949669a3145aa72141127afadc016e45d6c584a6
[ "MIT" ]
null
null
null
from django.apps import AppConfig class QgenConfig(AppConfig): name = 'QGen'
13.833333
33
0.73494
10
83
6.1
0.9
0
0
0
0
0
0
0
0
0
0
0
0.180723
83
5
34
16.6
0.897059
0
0
0
0
0
0.048193
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
e6b066091542671a72b6c4964dd5e164ed3c1913
209
py
Python
timezone/data/util/test.py
arminfriedl/netclock
f83f0faa1f2c8f06dc04d2d6de315a7b35f1c361
[ "MIT" ]
null
null
null
timezone/data/util/test.py
arminfriedl/netclock
f83f0faa1f2c8f06dc04d2d6de315a7b35f1c361
[ "MIT" ]
null
null
null
timezone/data/util/test.py
arminfriedl/netclock
f83f0faa1f2c8f06dc04d2d6de315a7b35f1c361
[ "MIT" ]
null
null
null
import preprocessor import sys p = preprocessor.geonames_allcountries("/home/armin/Downloads/allCountries/allCountries10000.txt") with open("/home/armin/Desktop/test.dot", "w") as sys.stdout: p.to_dot()
26.125
98
0.770335
28
209
5.678571
0.714286
0.113208
0
0
0
0
0
0
0
0
0
0.026316
0.090909
209
7
99
29.857143
0.810526
0
0
0
0
0
0.406699
0.401914
0
0
0
0
0
1
0
false
0
0.4
0
0.4
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
1
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
e6eeaaf37148d22eac6de4aa96d6471be02457bf
79
py
Python
webapp-google-container-engine/pv/apps.py
Grace-luning-fu/PV_Rooftop
1c20e8b9fff718aceec9383c6d9ee8dc3bc27f9e
[ "MIT" ]
null
null
null
webapp-google-container-engine/pv/apps.py
Grace-luning-fu/PV_Rooftop
1c20e8b9fff718aceec9383c6d9ee8dc3bc27f9e
[ "MIT" ]
null
null
null
webapp-google-container-engine/pv/apps.py
Grace-luning-fu/PV_Rooftop
1c20e8b9fff718aceec9383c6d9ee8dc3bc27f9e
[ "MIT" ]
null
null
null
from django.apps import AppConfig class PvConfig(AppConfig): name = 'pv'
13.166667
33
0.721519
10
79
5.7
0.9
0
0
0
0
0
0
0
0
0
0
0
0.189873
79
5
34
15.8
0.890625
0
0
0
0
0
0.025316
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
e6ffef5db3f47e764d2856787e0d47a8929e6506
190
py
Python
7 kyu/Alternate capitalization/Alternate capitalization.py
anthonyjatoba/codewars
76b0d66dd1ba76a4d136b658920cdf85fd5c4b06
[ "MIT" ]
null
null
null
7 kyu/Alternate capitalization/Alternate capitalization.py
anthonyjatoba/codewars
76b0d66dd1ba76a4d136b658920cdf85fd5c4b06
[ "MIT" ]
null
null
null
7 kyu/Alternate capitalization/Alternate capitalization.py
anthonyjatoba/codewars
76b0d66dd1ba76a4d136b658920cdf85fd5c4b06
[ "MIT" ]
null
null
null
def capitalize(s): return [''.join(s[i].upper() if i % 2 == 0 else s[i].lower() for i in range(len(s))), ''.join(s[i].lower() if i % 2 == 0 else s[i].upper() for i in range(len(s)))]
63.333333
89
0.547368
40
190
2.6
0.4
0.076923
0.115385
0.096154
0.5
0.5
0.211538
0
0
0
0
0.025974
0.189474
190
3
90
63.333333
0.649351
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.333333
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
fc30a09ede22320db236e2ee1f92e8d6b4c51968
2,548
py
Python
tests/fixtures/test_body_block_content_render/content_08_expected.py
elifesciences/elife-tools
ee345bf0e6703ef0f7e718355e85730abbdfd117
[ "MIT" ]
9
2015-04-16T08:13:31.000Z
2020-05-18T14:03:06.000Z
tests/fixtures/test_body_block_content_render/content_08_expected.py
elifesciences/elife-tools
ee345bf0e6703ef0f7e718355e85730abbdfd117
[ "MIT" ]
310
2015-02-11T00:30:09.000Z
2021-07-14T23:58:50.000Z
tests/fixtures/test_body_block_content_render/content_08_expected.py
elifesciences/elife-tools
ee345bf0e6703ef0f7e718355e85730abbdfd117
[ "MIT" ]
9
2015-02-04T01:21:28.000Z
2021-06-15T12:50:47.000Z
from collections import OrderedDict expected = [ OrderedDict( [ ( "content", [ OrderedDict([("type", "paragraph"), ("text", u"This")]), OrderedDict( [ ("type", "mathml"), ("id", u"equ2"), ("label", u"(2)"), ("mathml", "<math><mrow/></math>"), ] ), OrderedDict([("type", "paragraph"), ("text", u"was also")]), OrderedDict( [ ("type", "figure"), ( "assets", [ OrderedDict( [ ("type", "image"), ("doi", u"10.7554/eLife.01944.005"), ("id", u"fig3"), ("label", u"Figure 3"), ("title", u"Title"), ( "caption", [ OrderedDict( [ ("type", "paragraph"), ("text", u"Caption"), ] ) ], ), ( "image", { "alt": "", "uri": u"elife-01944-fig3-v1.tif", }, ), ] ) ], ), ] ), ], ) ] ) ]
41.770492
86
0.139325
73
2,548
4.863014
0.506849
0.253521
0.202817
0.23662
0.24507
0
0
0
0
0
0
0.043029
0.771978
2,548
60
87
42.466667
0.567986
0
0
0.220339
0
0
0.097331
0.018053
0
0
0
0
0
1
0
false
0
0.016949
0
0.016949
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
fc3505bad611a3fde6fd00dc93c3c9199638c4d2
17,792
py
Python
sympy/polys/tests/test_numberfields.py
minrk/sympy
1cc6e3837b8ed20ba52ea97298f31aa08b43c508
[ "BSD-3-Clause" ]
2
2015-11-13T16:40:57.000Z
2017-09-15T15:37:19.000Z
openrave/sympy/polys/tests/test_numberfields.py
jdsika/holy
a2ac55fa1751a3a8038cf61d29b95005f36d6264
[ "MIT" ]
1
2016-06-13T01:29:51.000Z
2016-06-14T00:38:27.000Z
openrave/sympy/polys/tests/test_numberfields.py
jdsika/holy
a2ac55fa1751a3a8038cf61d29b95005f36d6264
[ "MIT" ]
null
null
null
"""Tests for computational algebraic number field theory. """ from sympy import S, Rational, Symbol, Poly, sin, sqrt, I, oo from sympy.utilities.pytest import raises from sympy.polys.numberfields import ( minimal_polynomial, primitive_element, is_isomorphism_possible, field_isomorphism_pslq, field_isomorphism, to_number_field, AlgebraicNumber, isolate, ) from sympy.polys.polyerrors import ( IsomorphismFailed, NotAlgebraic, ) from sympy.polys.polyclasses import DMP from sympy.polys.domains import QQ from sympy.abc import x, y Q = Rational def test_minimal_polynomial(): assert minimal_polynomial(-7, x) == x + 7 assert minimal_polynomial(-1, x) == x + 1 assert minimal_polynomial( 0, x) == x assert minimal_polynomial( 1, x) == x - 1 assert minimal_polynomial( 7, x) == x - 7 assert minimal_polynomial(sqrt(2), x) == x**2 - 2 assert minimal_polynomial(sqrt(5), x) == x**2 - 5 assert minimal_polynomial(sqrt(6), x) == x**2 - 6 assert minimal_polynomial(2*sqrt(2), x) == x**2 - 8 assert minimal_polynomial(3*sqrt(5), x) == x**2 - 45 assert minimal_polynomial(4*sqrt(6), x) == x**2 - 96 assert minimal_polynomial(2*sqrt(2) + 3, x) == x**2 - 6*x + 1 assert minimal_polynomial(3*sqrt(5) + 6, x) == x**2 - 12*x - 9 assert minimal_polynomial(4*sqrt(6) + 7, x) == x**2 - 14*x - 47 assert minimal_polynomial(2*sqrt(2) - 3, x) == x**2 + 6*x + 1 assert minimal_polynomial(3*sqrt(5) - 6, x) == x**2 + 12*x - 9 assert minimal_polynomial(4*sqrt(6) - 7, x) == x**2 + 14*x - 47 assert minimal_polynomial(sqrt(1 + sqrt(6)), x) == x**4 - 2*x**2 - 5 assert minimal_polynomial(sqrt(I + sqrt(6)), x) == x**8 - 10*x**4 + 49 assert minimal_polynomial(2*I + sqrt(2 + I), x) == x**4 + 4*x**2 + 8*x + 37 assert minimal_polynomial(sqrt(2) + sqrt(3), x) == x**4 - 10*x**2 + 1 assert minimal_polynomial(sqrt(2) + sqrt(3) + sqrt(6), x) == x**4 - 22*x**2 - 48*x - 23 a = 1 - 9*sqrt(2) + 7*sqrt(3) assert minimal_polynomial(1/a, x) == 392*x**4 - 1232*x**3 + 612*x**2 + 4*x - 1 assert minimal_polynomial(1/sqrt(a), x) == 392*x**8 - 1232*x**6 + 612*x**4 + 4*x**2 - 1 raises(NotAlgebraic, "minimal_polynomial(y, x)") raises(NotAlgebraic, "minimal_polynomial(oo, x)") raises(NotAlgebraic, "minimal_polynomial(2**y, x)") raises(NotAlgebraic, "minimal_polynomial(sin(1), x)") assert minimal_polynomial(sqrt(2)).dummy_eq(x**2 - 2) assert minimal_polynomial(sqrt(2), x) == x**2 - 2 assert minimal_polynomial(sqrt(2), polys=True) == Poly(x**2 - 2) assert minimal_polynomial(sqrt(2), x, polys=True) == Poly(x**2 - 2) a = AlgebraicNumber(sqrt(2)) b = AlgebraicNumber(sqrt(3)) assert minimal_polynomial(a, x) == x**2 - 2 assert minimal_polynomial(b, x) == x**2 - 3 assert minimal_polynomial(a, x, polys=True) == Poly(x**2 - 2) assert minimal_polynomial(b, x, polys=True) == Poly(x**2 - 3) assert minimal_polynomial(sqrt(a/2 + 17), x) == 2*x**4 - 68*x**2 + 577 assert minimal_polynomial(sqrt(b/2 + 17), x) == 4*x**4 - 136*x**2 + 1153 a, b = sqrt(2)/3 + 7, AlgebraicNumber(sqrt(2)/3 + 7) f = 81*x**8 - 2268*x**6 - 4536*x**5 + 22644*x**4 + 63216*x**3 - 31608*x**2 - 189648*x + 141358 assert minimal_polynomial(sqrt(a) + sqrt(sqrt(a)), x) == f assert minimal_polynomial(sqrt(b) + sqrt(sqrt(b)), x) == f assert minimal_polynomial(a**Rational(3, 2), x) == 729*x**4 - 506898*x**2 + 84604519 def test_primitive_element(): assert primitive_element([sqrt(2)], x) == (x**2 - 2, [1]) assert primitive_element([sqrt(2), sqrt(3)], x) == (x**4 - 10*x**2 + 1, [1, 1]) assert primitive_element([sqrt(2)], x, polys=True) == (Poly(x**2 - 2), [1]) assert primitive_element([sqrt(2), sqrt(3)], x, polys=True) == (Poly(x**4 - 10*x**2 + 1), [1, 1]) assert primitive_element([sqrt(2)], x, ex=True) == (x**2 - 2, [1], [[1, 0]]) assert primitive_element([sqrt(2), sqrt(3)], x, ex=True) == \ (x**4 - 10*x**2 + 1, [1, 1], [[Q(1,2), 0, -Q(9,2), 0], [-Q(1,2), 0, Q(11,2), 0]]) assert primitive_element([sqrt(2)], x, ex=True, polys=True) == (Poly(x**2 - 2), [1], [[1, 0]]) assert primitive_element([sqrt(2), sqrt(3)], x, ex=True, polys=True) == \ (Poly(x**4 - 10*x**2 + 1), [1, 1], [[Q(1,2), 0, -Q(9,2), 0], [-Q(1,2), 0, Q(11,2), 0]]) assert primitive_element([sqrt(2)], polys=True) == (Poly(x**2 - 2), [1]) raises(ValueError, "primitive_element([], x, ex=False)") raises(ValueError, "primitive_element([], x, ex=True)") def test_field_isomorphism_pslq(): a = AlgebraicNumber(I) b = AlgebraicNumber(I*sqrt(3)) raises(NotImplementedError, "field_isomorphism_pslq(a, b)") a = AlgebraicNumber(sqrt(2)) b = AlgebraicNumber(sqrt(3)) c = AlgebraicNumber(sqrt(7)) d = AlgebraicNumber(sqrt(2)+sqrt(3)) e = AlgebraicNumber(sqrt(2)+sqrt(3)+sqrt(7)) assert field_isomorphism_pslq(a, a) == [1, 0] assert field_isomorphism_pslq(a, b) == None assert field_isomorphism_pslq(a, c) == None assert field_isomorphism_pslq(a, d) == [Q(1,2), 0, -Q(9,2), 0] assert field_isomorphism_pslq(a, e) == [Q(1,80), 0, -Q(1,2), 0, Q(59,20), 0] assert field_isomorphism_pslq(b, a) == None assert field_isomorphism_pslq(b, b) == [1, 0] assert field_isomorphism_pslq(b, c) == None assert field_isomorphism_pslq(b, d) == [-Q(1,2), 0, Q(11,2), 0] assert field_isomorphism_pslq(b, e) == [-Q(3,640), 0, Q(67,320), 0, -Q(297,160), 0, Q(313,80), 0] assert field_isomorphism_pslq(c, a) == None assert field_isomorphism_pslq(c, b) == None assert field_isomorphism_pslq(c, c) == [1, 0] assert field_isomorphism_pslq(c, d) == None assert field_isomorphism_pslq(c, e) == [Q(3,640), 0, -Q(71,320), 0, Q(377,160), 0, -Q(469,80), 0] assert field_isomorphism_pslq(d, a) == None assert field_isomorphism_pslq(d, b) == None assert field_isomorphism_pslq(d, c) == None assert field_isomorphism_pslq(d, d) == [1, 0] assert field_isomorphism_pslq(d, e) == [-Q(3,640), 0, Q(71,320), 0, -Q(377,160), 0, Q(549,80), 0] assert field_isomorphism_pslq(e, a) == None assert field_isomorphism_pslq(e, b) == None assert field_isomorphism_pslq(e, c) == None assert field_isomorphism_pslq(e, d) == None assert field_isomorphism_pslq(e, e) == [1, 0] f = AlgebraicNumber(3*sqrt(2)+8*sqrt(7)-5) assert field_isomorphism_pslq(f, e) == [Q(3,80), 0, -Q(139,80), 0, Q(347,20), 0, -Q(761,20), -5] def test_field_isomorphism(): assert field_isomorphism(3, sqrt(2)) == [3] assert field_isomorphism( I*sqrt(3), I*sqrt(3)/2) == [ 2, 0] assert field_isomorphism(-I*sqrt(3), I*sqrt(3)/2) == [-2, 0] assert field_isomorphism( I*sqrt(3),-I*sqrt(3)/2) == [-2, 0] assert field_isomorphism(-I*sqrt(3),-I*sqrt(3)/2) == [ 2, 0] assert field_isomorphism( 2*I*sqrt(3)/7, 5*I*sqrt(3)/3) == [ S(6)/35, 0] assert field_isomorphism(-2*I*sqrt(3)/7, 5*I*sqrt(3)/3) == [-S(6)/35, 0] assert field_isomorphism( 2*I*sqrt(3)/7,-5*I*sqrt(3)/3) == [-S(6)/35, 0] assert field_isomorphism(-2*I*sqrt(3)/7,-5*I*sqrt(3)/3) == [ S(6)/35, 0] assert field_isomorphism( 2*I*sqrt(3)/7+27, 5*I*sqrt(3)/3) == [ S(6)/35, 27] assert field_isomorphism(-2*I*sqrt(3)/7+27, 5*I*sqrt(3)/3) == [-S(6)/35, 27] assert field_isomorphism( 2*I*sqrt(3)/7+27,-5*I*sqrt(3)/3) == [-S(6)/35, 27] assert field_isomorphism(-2*I*sqrt(3)/7+27,-5*I*sqrt(3)/3) == [ S(6)/35, 27] p = AlgebraicNumber( sqrt(2) + sqrt(3)) q = AlgebraicNumber(-sqrt(2) + sqrt(3)) r = AlgebraicNumber( sqrt(2) - sqrt(3)) s = AlgebraicNumber(-sqrt(2) - sqrt(3)) pos_coeffs = [ S(1)/2, S(0), -S(9)/2, S(0)] neg_coeffs = [-S(1)/2, S(0), S(9)/2, S(0)] a = AlgebraicNumber(sqrt(2)) assert is_isomorphism_possible(a, p) == True assert is_isomorphism_possible(a, q) == True assert is_isomorphism_possible(a, r) == True assert is_isomorphism_possible(a, s) == True assert field_isomorphism(a, p, fast=True) == pos_coeffs assert field_isomorphism(a, q, fast=True) == neg_coeffs assert field_isomorphism(a, r, fast=True) == pos_coeffs assert field_isomorphism(a, s, fast=True) == neg_coeffs assert field_isomorphism(a, p, fast=False) == pos_coeffs assert field_isomorphism(a, q, fast=False) == neg_coeffs assert field_isomorphism(a, r, fast=False) == pos_coeffs assert field_isomorphism(a, s, fast=False) == neg_coeffs a = AlgebraicNumber(-sqrt(2)) assert is_isomorphism_possible(a, p) == True assert is_isomorphism_possible(a, q) == True assert is_isomorphism_possible(a, r) == True assert is_isomorphism_possible(a, s) == True assert field_isomorphism(a, p, fast=True) == neg_coeffs assert field_isomorphism(a, q, fast=True) == pos_coeffs assert field_isomorphism(a, r, fast=True) == neg_coeffs assert field_isomorphism(a, s, fast=True) == pos_coeffs assert field_isomorphism(a, p, fast=False) == neg_coeffs assert field_isomorphism(a, q, fast=False) == pos_coeffs assert field_isomorphism(a, r, fast=False) == neg_coeffs assert field_isomorphism(a, s, fast=False) == pos_coeffs pos_coeffs = [ S(1)/2, S(0), -S(11)/2, S(0)] neg_coeffs = [-S(1)/2, S(0), S(11)/2, S(0)] a = AlgebraicNumber(sqrt(3)) assert is_isomorphism_possible(a, p) == True assert is_isomorphism_possible(a, q) == True assert is_isomorphism_possible(a, r) == True assert is_isomorphism_possible(a, s) == True assert field_isomorphism(a, p, fast=True) == neg_coeffs assert field_isomorphism(a, q, fast=True) == neg_coeffs assert field_isomorphism(a, r, fast=True) == pos_coeffs assert field_isomorphism(a, s, fast=True) == pos_coeffs assert field_isomorphism(a, p, fast=False) == neg_coeffs assert field_isomorphism(a, q, fast=False) == neg_coeffs assert field_isomorphism(a, r, fast=False) == pos_coeffs assert field_isomorphism(a, s, fast=False) == pos_coeffs a = AlgebraicNumber(-sqrt(3)) assert is_isomorphism_possible(a, p) == True assert is_isomorphism_possible(a, q) == True assert is_isomorphism_possible(a, r) == True assert is_isomorphism_possible(a, s) == True assert field_isomorphism(a, p, fast=True) == pos_coeffs assert field_isomorphism(a, q, fast=True) == pos_coeffs assert field_isomorphism(a, r, fast=True) == neg_coeffs assert field_isomorphism(a, s, fast=True) == neg_coeffs assert field_isomorphism(a, p, fast=False) == pos_coeffs assert field_isomorphism(a, q, fast=False) == pos_coeffs assert field_isomorphism(a, r, fast=False) == neg_coeffs assert field_isomorphism(a, s, fast=False) == neg_coeffs pos_coeffs = [ S(3)/2, S(0), -S(33)/2, -S(8)] neg_coeffs = [-S(3)/2, S(0), S(33)/2, -S(8)] a = AlgebraicNumber(3*sqrt(3)-8) assert is_isomorphism_possible(a, p) == True assert is_isomorphism_possible(a, q) == True assert is_isomorphism_possible(a, r) == True assert is_isomorphism_possible(a, s) == True assert field_isomorphism(a, p, fast=True) == neg_coeffs assert field_isomorphism(a, q, fast=True) == neg_coeffs assert field_isomorphism(a, r, fast=True) == pos_coeffs assert field_isomorphism(a, s, fast=True) == pos_coeffs assert field_isomorphism(a, p, fast=False) == neg_coeffs assert field_isomorphism(a, q, fast=False) == neg_coeffs assert field_isomorphism(a, r, fast=False) == pos_coeffs assert field_isomorphism(a, s, fast=False) == pos_coeffs a = AlgebraicNumber(3*sqrt(2)+2*sqrt(3)+1) pos_1_coeffs = [ S(1)/2, S(0), -S(5)/2, S(1)] neg_5_coeffs = [-S(5)/2, S(0), S(49)/2, S(1)] pos_5_coeffs = [ S(5)/2, S(0), -S(49)/2, S(1)] neg_1_coeffs = [-S(1)/2, S(0), S(5)/2, S(1)] assert is_isomorphism_possible(a, p) == True assert is_isomorphism_possible(a, q) == True assert is_isomorphism_possible(a, r) == True assert is_isomorphism_possible(a, s) == True assert field_isomorphism(a, p, fast=True) == pos_1_coeffs assert field_isomorphism(a, q, fast=True) == neg_5_coeffs assert field_isomorphism(a, r, fast=True) == pos_5_coeffs assert field_isomorphism(a, s, fast=True) == neg_1_coeffs assert field_isomorphism(a, p, fast=False) == pos_1_coeffs assert field_isomorphism(a, q, fast=False) == neg_5_coeffs assert field_isomorphism(a, r, fast=False) == pos_5_coeffs assert field_isomorphism(a, s, fast=False) == neg_1_coeffs a = AlgebraicNumber(sqrt(2)) b = AlgebraicNumber(sqrt(3)) c = AlgebraicNumber(sqrt(7)) assert is_isomorphism_possible(a, b) == True assert is_isomorphism_possible(b, a) == True assert is_isomorphism_possible(c, p) == False assert field_isomorphism(sqrt(2), sqrt(3), fast=True) is None assert field_isomorphism(sqrt(3), sqrt(2), fast=True) is None assert field_isomorphism(sqrt(2), sqrt(3), fast=False) is None assert field_isomorphism(sqrt(3), sqrt(2), fast=False) is None def test_to_number_field(): assert to_number_field(sqrt(2)) == AlgebraicNumber(sqrt(2)) assert to_number_field([sqrt(2), sqrt(3)]) == AlgebraicNumber(sqrt(2)+sqrt(3)) a = AlgebraicNumber(sqrt(2)+sqrt(3), [S(1)/2, S(0), -S(9)/2, S(0)]) assert to_number_field(sqrt(2), sqrt(2)+sqrt(3)) == a assert to_number_field(sqrt(2), AlgebraicNumber(sqrt(2)+sqrt(3))) == a raises(IsomorphismFailed, "to_number_field(sqrt(2), sqrt(3))") def test_AlgebraicNumber(): minpoly, root = x**2 - 2, sqrt(2) a = AlgebraicNumber(root, gen=x) assert a.rep == DMP([QQ(1),QQ(0)], QQ) assert a.root == root assert a.alias is None assert a.minpoly == minpoly assert a.is_aliased == False assert a.coeffs() == [S(1), S(0)] assert a.native_coeffs() == [QQ(1), QQ(0)] a = AlgebraicNumber(root, gen=x, alias='y') assert a.rep == DMP([QQ(1),QQ(0)], QQ) assert a.root == root assert a.alias == Symbol('y') assert a.minpoly == minpoly assert a.is_aliased == True a = AlgebraicNumber(root, gen=x, alias=Symbol('y')) assert a.rep == DMP([QQ(1),QQ(0)], QQ) assert a.root == root assert a.alias == Symbol('y') assert a.minpoly == minpoly assert a.is_aliased == True assert AlgebraicNumber(sqrt(2), []).rep == DMP([], QQ) assert AlgebraicNumber(sqrt(2), [8]).rep == DMP([QQ(8)], QQ) assert AlgebraicNumber(sqrt(2), [S(8)/3]).rep == DMP([QQ(8,3)], QQ) assert AlgebraicNumber(sqrt(2), [7, 3]).rep == DMP([QQ(7),QQ(3)], QQ) assert AlgebraicNumber(sqrt(2), [S(7)/9, S(3)/2]).rep == DMP([QQ(7,9),QQ(3,2)], QQ) assert AlgebraicNumber(sqrt(2), [1, 2, 3]).rep == DMP([QQ(2),QQ(5)], QQ) a = AlgebraicNumber(AlgebraicNumber(root, gen=x), [1,2]) assert a.rep == DMP([QQ(1),QQ(2)], QQ) assert a.root == root assert a.alias is None assert a.minpoly == minpoly assert a.is_aliased == False assert a.coeffs() == [S(1), S(2)] assert a.native_coeffs() == [QQ(1), QQ(2)] a = AlgebraicNumber((minpoly, root), [1,2]) assert a.rep == DMP([QQ(1),QQ(2)], QQ) assert a.root == root assert a.alias is None assert a.minpoly == minpoly assert a.is_aliased == False a = AlgebraicNumber((Poly(minpoly), root), [1,2]) assert a.rep == DMP([QQ(1),QQ(2)], QQ) assert a.root == root assert a.alias is None assert a.minpoly == minpoly assert a.is_aliased == False assert AlgebraicNumber( sqrt(3)).rep == DMP([ QQ(1),QQ(0)], QQ) assert AlgebraicNumber(-sqrt(3)).rep == DMP([-QQ(1),QQ(0)], QQ) a = AlgebraicNumber(sqrt(2)) b = AlgebraicNumber(sqrt(2)) assert a == b and a == sqrt(2) a = AlgebraicNumber(sqrt(2), gen=x) b = AlgebraicNumber(sqrt(2), gen=x) assert a == b and a == sqrt(2) a = AlgebraicNumber(sqrt(2), [1,2]) b = AlgebraicNumber(sqrt(2), [1,3]) assert a != b and a != sqrt(2)+3 assert (a == x) == False and (a != x) == True a = AlgebraicNumber(sqrt(2), [1,0]) b = AlgebraicNumber(sqrt(2), [1,0], alias=y) assert a.as_poly(x) == Poly(x) assert b.as_poly() == Poly(y) assert a.as_expr() == sqrt(2) assert a.as_expr(x) == x assert b.as_expr() == sqrt(2) assert b.as_expr(x) == x a = AlgebraicNumber(sqrt(2), [2,3]) b = AlgebraicNumber(sqrt(2), [2,3], alias=y) p = a.as_poly() assert p == Poly(2*p.gen+3) assert a.as_poly(x) == Poly(2*x+3) assert b.as_poly() == Poly(2*y+3) assert a.as_expr() == 2*sqrt(2)+3 assert a.as_expr(x) == 2*x+3 assert b.as_expr() == 2*sqrt(2)+3 assert b.as_expr(x) == 2*x+3 def test_to_algebraic_integer(): a = AlgebraicNumber(sqrt(3), gen=x).to_algebraic_integer() assert a.minpoly == x**2 - 3 assert a.root == sqrt(3) assert a.rep == DMP([QQ(1),QQ(0)], QQ) a = AlgebraicNumber(2*sqrt(3), gen=x).to_algebraic_integer() assert a.minpoly == x**2 - 12 assert a.root == 2*sqrt(3) assert a.rep == DMP([QQ(1),QQ(0)], QQ) a = AlgebraicNumber(sqrt(3)/2, gen=x).to_algebraic_integer() assert a.minpoly == x**2 - 12 assert a.root == 2*sqrt(3) assert a.rep == DMP([QQ(1),QQ(0)], QQ) a = AlgebraicNumber(sqrt(3)/2, [S(7)/19, 3], gen=x).to_algebraic_integer() assert a.minpoly == x**2 - 12 assert a.root == 2*sqrt(3) assert a.rep == DMP([QQ(7,19),QQ(3)], QQ) def test_isolate(): assert isolate(1) == (1, 1) assert isolate(S(1)/2) == (S(1)/2, S(1)/2) assert isolate(sqrt(2)) == (1, 2) assert isolate(-sqrt(2)) == (-2, -1) assert isolate(sqrt(2), eps=S(1)/100) == (S(24)/17, S(17)/12) assert isolate(-sqrt(2), eps=S(1)/100) == (-S(17)/12, -S(24)/17) raises(NotImplementedError, "isolate(I)")
36.609053
101
0.622246
2,959
17,792
3.619466
0.048327
0.143417
0.186928
0.103081
0.842764
0.760598
0.625584
0.594211
0.57535
0.522129
0
0.06493
0.193233
17,792
485
102
36.684536
0.681204
0.003035
0
0.341108
0
0
0.01393
0.010377
0
0
0
0
0.714286
1
0.023324
false
0
0.020408
0
0.043732
0
0
0
0
null
0
1
0
1
1
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
4
fc4a164946c4dc36fca31c9f6bc8414cc7044c6e
291
py
Python
fast_arrow_auth/__init__.py
westonplatter/fast_arrow_auth
07f36f696b700b9c488648a578794f0f75cfaa5d
[ "MIT" ]
6
2019-08-11T20:22:50.000Z
2020-02-08T21:44:32.000Z
fast_arrow_auth/__init__.py
westonplatter/fast_arrow_auth
07f36f696b700b9c488648a578794f0f75cfaa5d
[ "MIT" ]
3
2019-08-06T17:32:12.000Z
2019-11-16T21:36:21.000Z
fast_arrow_auth/__init__.py
westonplatter/fast_arrow_auth
07f36f696b700b9c488648a578794f0f75cfaa5d
[ "MIT" ]
3
2019-09-27T19:48:22.000Z
2020-01-24T21:01:52.000Z
# library util and client stuff from fast_arrow_auth.client import Client from fast_arrow_auth.exceptions import ( AuthenticationError, NotImplementedError) # user from fast_arrow_auth.resources.user import User import warnings warnings.simplefilter('always', DeprecationWarning)
22.384615
51
0.821306
35
291
6.657143
0.542857
0.103004
0.167382
0.218884
0
0
0
0
0
0
0
0
0.127148
291
12
52
24.25
0.917323
0.116838
0
0
0
0
0.023622
0
0
0
0
0
0
1
0
true
0
0.571429
0
0.571429
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
1
0
1
0
1
0
0
4
fc549ff17b61618636e2397d5a3813ea712ad807
83
py
Python
setup.py
mchancan/Hierarchical-Localization
e310e311a722405f19a54f9e833834feb5e70a47
[ "Apache-2.0" ]
2
2021-06-11T21:12:11.000Z
2021-06-12T01:24:08.000Z
setup.py
mihaidusmanu/Hierarchical-Localization
dfa5cc5368ce419c46b6a10f751a6f9c758f67dd
[ "Apache-2.0" ]
null
null
null
setup.py
mihaidusmanu/Hierarchical-Localization
dfa5cc5368ce419c46b6a10f751a6f9c758f67dd
[ "Apache-2.0" ]
null
null
null
from setuptools import setup setup(name='hloc', version="0.0", packages=['hloc'])
20.75
52
0.710843
12
83
4.916667
0.75
0
0
0
0
0
0
0
0
0
0
0.026667
0.096386
83
3
53
27.666667
0.76
0
0
0
0
0
0.13253
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
fc5c50f164c1d89e90531e226e86abad73cbd474
34
py
Python
tests/__init__.py
ywangd/peek
25d196b614acaf9c2f9fe4b8fea36a06554950cd
[ "MIT" ]
16
2020-08-31T02:06:23.000Z
2022-01-31T23:56:44.000Z
tests/__init__.py
ywangd/peek
25d196b614acaf9c2f9fe4b8fea36a06554950cd
[ "MIT" ]
97
2020-08-27T14:51:32.000Z
2021-10-21T00:19:31.000Z
tests/__init__.py
ywangd/peek
25d196b614acaf9c2f9fe4b8fea36a06554950cd
[ "MIT" ]
1
2021-02-07T13:10:38.000Z
2021-02-07T13:10:38.000Z
"""Unit test package for peek."""
17
33
0.647059
5
34
4.4
1
0
0
0
0
0
0
0
0
0
0
0
0.147059
34
1
34
34
0.758621
0.794118
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
fc6e37906249ea0ab9613e91a0107ade269ee171
146
py
Python
parte-1/week-5/maximo_2.py
tfn10/ciencia-computacao-python-conceitos
15e58738f632ec63c72e2bc07d6938c7dac738ed
[ "MIT" ]
null
null
null
parte-1/week-5/maximo_2.py
tfn10/ciencia-computacao-python-conceitos
15e58738f632ec63c72e2bc07d6938c7dac738ed
[ "MIT" ]
null
null
null
parte-1/week-5/maximo_2.py
tfn10/ciencia-computacao-python-conceitos
15e58738f632ec63c72e2bc07d6938c7dac738ed
[ "MIT" ]
null
null
null
def maximo(numero1, numero2): """Devolve o maior número""" if numero1 >= numero2: return numero1 else: return numero2
20.857143
32
0.60274
16
146
5.5
0.6875
0.318182
0
0
0
0
0
0
0
0
0
0.058824
0.30137
146
6
33
24.333333
0.803922
0.150685
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0
0.6
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
1
0
0
4
fc87e3f959c4f0dfc4ca1b0b0f7b44c2e337ab06
1,170
py
Python
evalml/data_checks/__init__.py
ObinnaObeleagu/evalml
3b5bf62b08a5a5bc6485ba5387a08c32e1857473
[ "BSD-3-Clause" ]
1
2021-07-28T14:20:35.000Z
2021-07-28T14:20:35.000Z
evalml/data_checks/__init__.py
ObinnaObeleagu/evalml
3b5bf62b08a5a5bc6485ba5387a08c32e1857473
[ "BSD-3-Clause" ]
null
null
null
evalml/data_checks/__init__.py
ObinnaObeleagu/evalml
3b5bf62b08a5a5bc6485ba5387a08c32e1857473
[ "BSD-3-Clause" ]
null
null
null
from .data_check import DataCheck from .data_check_message_code import DataCheckMessageCode from .data_check_action import DataCheckAction from .data_check_action_code import DataCheckActionCode from .data_checks import DataChecks from .data_check_message import DataCheckMessage, DataCheckWarning, DataCheckError from .data_check_message_type import DataCheckMessageType from .default_data_checks import DefaultDataChecks from .utils import EmptyDataChecks from .invalid_targets_data_check import InvalidTargetDataCheck from .highly_null_data_check import HighlyNullDataCheck from .id_columns_data_check import IDColumnsDataCheck from .target_leakage_data_check import TargetLeakageDataCheck from .outliers_data_check import OutliersDataCheck from .no_variance_data_check import NoVarianceDataCheck from .class_imbalance_data_check import ClassImbalanceDataCheck from .multicollinearity_data_check import MulticollinearityDataCheck from .sparsity_data_check import SparsityDataCheck from .uniqueness_data_check import UniquenessDataCheck from .datetime_nan_data_check import DateTimeNaNDataCheck from .natural_language_nan_data_check import NaturalLanguageNaNDataCheck
53.181818
82
0.906838
136
1,170
7.433824
0.397059
0.160237
0.192878
0.059347
0
0
0
0
0
0
0
0
0.073504
1,170
21
83
55.714286
0.932657
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
fc8c32ef5bf49b6573e14ba06e3fd4fff2623352
95
py
Python
wonderBits/__init__.py
daejong123/pySocket
981ecf22f4b6c4fc8a93f0d430699ba7a571f352
[ "MIT" ]
1
2019-04-22T06:04:20.000Z
2019-04-22T06:04:20.000Z
wonderBits/__init__.py
daejong123/pySocket
981ecf22f4b6c4fc8a93f0d430699ba7a571f352
[ "MIT" ]
null
null
null
wonderBits/__init__.py
daejong123/pySocket
981ecf22f4b6c4fc8a93f0d430699ba7a571f352
[ "MIT" ]
null
null
null
from .core import * from .__version__ import __version__ v = __version__ version = __version__
19
36
0.8
11
95
5.454545
0.454545
0.466667
0
0
0
0
0
0
0
0
0
0
0.147368
95
5
37
19
0.740741
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
fc9488cb686786343ec5718487f1e641b775394a
84
py
Python
lib/clustering/__init__.py
datasciencecampus/optimus
3696f63497b82c00c55806629445661d12c60b6d
[ "MIT" ]
11
2018-09-17T18:30:42.000Z
2021-12-31T13:40:19.000Z
lib/clustering/__init__.py
datasciencecampus/optimus
3696f63497b82c00c55806629445661d12c60b6d
[ "MIT" ]
6
2019-10-10T10:25:59.000Z
2021-08-23T07:27:07.000Z
lib/clustering/__init__.py
datasciencecampus/optimus
3696f63497b82c00c55806629445661d12c60b6d
[ "MIT" ]
4
2019-10-14T16:21:38.000Z
2021-06-25T04:57:54.000Z
from .clusterer import Clusterer from .clusterconstructor import ClusterConstructor
28
50
0.880952
8
84
9.25
0.5
0
0
0
0
0
0
0
0
0
0
0
0.095238
84
2
51
42
0.973684
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
fca829c774a287ecfb725719f267ead91a54c910
56
py
Python
src/squared.py
bdavies3/Calculator
ea524e141e19d8e6894b55d9ee72f07c3005f914
[ "MIT" ]
null
null
null
src/squared.py
bdavies3/Calculator
ea524e141e19d8e6894b55d9ee72f07c3005f914
[ "MIT" ]
null
null
null
src/squared.py
bdavies3/Calculator
ea524e141e19d8e6894b55d9ee72f07c3005f914
[ "MIT" ]
null
null
null
def squared(a, b) -> object: c = a ** b return c
18.666667
28
0.5
10
56
2.8
0.7
0.142857
0
0
0
0
0
0
0
0
0
0
0.339286
56
3
29
18.666667
0.756757
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
5d8c6a3bc39d5a61f49a1377d5427b4e20cec2fe
350
py
Python
Connector/luna/apirpc.py
bridgedragon/NodeChain
2554eb7fa7f677037a800eca43e58e1ab15c41a6
[ "MIT" ]
null
null
null
Connector/luna/apirpc.py
bridgedragon/NodeChain
2554eb7fa7f677037a800eca43e58e1ab15c41a6
[ "MIT" ]
null
null
null
Connector/luna/apirpc.py
bridgedragon/NodeChain
2554eb7fa7f677037a800eca43e58e1ab15c41a6
[ "MIT" ]
null
null
null
#!/usr/bin/python3 from httputils import httpmethod, httputils from rpcutils import rpcmethod from logger import logger from rpcutils import error from rpcutils.rpcconnector import RPCConnector from . import utils from .constants import * # TODO: MAKE ENDPOINTS FOR LUNA/TERRA # Libraries have been imported so as not to upload an empty file to git
29.166667
71
0.811429
51
350
5.568627
0.647059
0.126761
0.126761
0
0
0
0
0
0
0
0
0.003356
0.148571
350
11
72
31.818182
0.949664
0.351429
0
0
0
0
0
0
0
0
0
0.090909
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
1
0
0
0
1
0
1
0
1
0
0
4
5d9c670f9bdb77775cc9b02048d81147a0007e7d
2,532
py
Python
librespot/structure.py
Footsiefat/librespot-python
d1dec16e650b17d17af1aafd206ff3499cc33048
[ "Apache-2.0" ]
1
2021-11-27T18:29:40.000Z
2021-11-27T18:29:40.000Z
librespot/structure.py
Footsiefat/librespot-python
d1dec16e650b17d17af1aafd206ff3499cc33048
[ "Apache-2.0" ]
null
null
null
librespot/structure.py
Footsiefat/librespot-python
d1dec16e650b17d17af1aafd206ff3499cc33048
[ "Apache-2.0" ]
null
null
null
from __future__ import annotations import typing if typing.TYPE_CHECKING: from librespot.audio import AbsChunkedInputStream from librespot.audio.format import SuperAudioFormat from librespot.core import DealerClient, Session from librespot.crypto import Packet from librespot.mercury import MercuryClient from librespot.proto import Metadata_pb2 as Metadata class AudioDecrypt: def decrypt_chunk(self, chunk_index: int, buffer: bytes): raise NotImplementedError def decrypt_time_ms(self): raise NotImplementedError class AudioQualityPicker: def get_file(self, files: typing.List[Metadata.AudioFile]) -> Metadata.AudioFile: raise NotImplementedError class Closeable: def close(self) -> None: raise NotImplementedError class GeneralAudioStream: def stream(self) -> AbsChunkedInputStream: raise NotImplementedError def codec(self) -> SuperAudioFormat: raise NotImplementedError def describe(self) -> str: raise NotImplementedError def decrypt_time_ms(self) -> int: raise NotImplementedError class GeneralWritableStream: def write_chunk(self, buffer: bytearray, chunk_index: int, cached: bool): raise NotImplementedError class HaltListener: def stream_read_halted(self, chunk: int, _time: int) -> None: raise NotImplementedError def stream_read_resumed(self, chunk: int, _time: int) -> None: raise NotImplementedError class MessageListener: def on_message(self, uri: str, headers: typing.Dict[str, str], payload: bytes): raise NotImplementedError class NoopAudioDecrypt(AudioDecrypt): def decrypt_chunk(self, chunk_index: int, buffer: bytes): raise NotImplementedError def decrypt_time_ms(self): return 0 class PacketsReceiver: def dispatch(self, packet: Packet): raise NotImplementedError class RequestListener: def on_request(self, mid: str, pid: int, sender: str, command: typing.Any) -> DealerClient.RequestResult: raise NotImplementedError class Runnable: def run(self): raise NotImplementedError class SessionListener: def session_closing(self, session: Session) -> None: raise NotImplementedError def session_changed(self, session: Session) -> None: raise NotImplementedError class SubListener: def event(self, resp: MercuryClient.Response) -> None: raise NotImplementedError
25.32
79
0.7109
261
2,532
6.785441
0.344828
0.257482
0.180124
0.057595
0.241671
0.241671
0.189723
0.164879
0.111801
0.111801
0
0.001017
0.223144
2,532
99
80
25.575758
0.899339
0
0
0.353846
0
0
0
0
0
0
0
0
0
1
0.307692
false
0
0.123077
0.015385
0.646154
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
5dce8eb034396a468a6a60e4fc0e27d99f9681d5
23
py
Python
ue4docker/version.py
Greenroom-Robotics/ue4-docker
760229709110cdb4133cd99aa11674adff3f3935
[ "MIT" ]
null
null
null
ue4docker/version.py
Greenroom-Robotics/ue4-docker
760229709110cdb4133cd99aa11674adff3f3935
[ "MIT" ]
null
null
null
ue4docker/version.py
Greenroom-Robotics/ue4-docker
760229709110cdb4133cd99aa11674adff3f3935
[ "MIT" ]
null
null
null
__version__ = "0.0.96"
11.5
22
0.652174
4
23
2.75
0.75
0
0
0
0
0
0
0
0
0
0
0.2
0.130435
23
1
23
23
0.35
0
0
0
0
0
0.26087
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
5dd6e99e8658a0f4c1c3b1bf89ed7583108b58f1
44
py
Python
LoadTesting/load_testing_je/utils/exception/exception_tag.py
JE-Chen/je_old_repo
a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5
[ "MIT" ]
null
null
null
LoadTesting/load_testing_je/utils/exception/exception_tag.py
JE-Chen/je_old_repo
a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5
[ "MIT" ]
null
null
null
LoadTesting/load_testing_je/utils/exception/exception_tag.py
JE-Chen/je_old_repo
a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5
[ "MIT" ]
null
null
null
not_found_locust_error = "locust not found"
22
43
0.818182
7
44
4.714286
0.571429
0.484848
0
0
0
0
0
0
0
0
0
0
0.113636
44
1
44
44
0.846154
0
0
0
0
0
0.363636
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
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
4
5df050771b94cdb706982d24c9ffa6dd97025d59
240
py
Python
terrascript/resource/invidian/sshcommand.py
mjuenema/python-terrascript
6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d
[ "BSD-2-Clause" ]
507
2017-07-26T02:58:38.000Z
2022-01-21T12:35:13.000Z
terrascript/resource/invidian/sshcommand.py
mjuenema/python-terrascript
6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d
[ "BSD-2-Clause" ]
135
2017-07-20T12:01:59.000Z
2021-10-04T22:25:40.000Z
terrascript/resource/invidian/sshcommand.py
mjuenema/python-terrascript
6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d
[ "BSD-2-Clause" ]
81
2018-02-20T17:55:28.000Z
2022-01-31T07:08:40.000Z
# terrascript/resource/invidian/sshcommand.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:27:44 UTC) import terrascript class sshcommand_command(terrascript.Resource): pass __all__ = [ "sshcommand_command", ]
18.461538
73
0.766667
29
240
6.137931
0.758621
0.213483
0
0
0
0
0
0
0
0
0
0.057692
0.133333
240
12
74
20
0.798077
0.479167
0
0
1
0
0.147541
0
0
0
0
0
0
1
0
false
0.166667
0.166667
0
0.333333
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
1
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
5dfe101e70734662973e329282e8446b62868867
50
py
Python
complexTorch/models/__init__.py
IAmSuyogJadhav/complexPyTorch
31951b584901f579e78e7ad9fbd4d5357a8d19e7
[ "MIT" ]
2
2020-06-14T07:11:11.000Z
2020-08-12T23:35:21.000Z
complexTorch/models/__init__.py
IAmSuyogJadhav/complexPyTorch
31951b584901f579e78e7ad9fbd4d5357a8d19e7
[ "MIT" ]
null
null
null
complexTorch/models/__init__.py
IAmSuyogJadhav/complexPyTorch
31951b584901f579e78e7ad9fbd4d5357a8d19e7
[ "MIT" ]
null
null
null
from .unet import Unet from .resnet import ResNet
16.666667
26
0.8
8
50
5
0.5
0
0
0
0
0
0
0
0
0
0
0
0.16
50
2
27
25
0.952381
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
b9023d0bf00edc24311bdcb12cd5f70f8f88a9f2
46
py
Python
tests/__init__.py
padeny/tastypie_api
696a17535d921fabe35d693565684803d39c451a
[ "MIT" ]
2
2019-07-10T12:09:25.000Z
2019-07-10T12:09:26.000Z
tests/__init__.py
padeny/tastypie_api
696a17535d921fabe35d693565684803d39c451a
[ "MIT" ]
4
2020-06-05T21:24:48.000Z
2021-11-08T00:57:37.000Z
tests/__init__.py
padeny/tastypie_api
696a17535d921fabe35d693565684803d39c451a
[ "MIT" ]
null
null
null
default_app_config = 'tests.apps.TestsConfig'
23
45
0.826087
6
46
6
1
0
0
0
0
0
0
0
0
0
0
0
0.065217
46
1
46
46
0.837209
0
0
0
0
0
0.478261
0.478261
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
f8dd275be52b12be5f3bd73887177383dfae66e5
161
py
Python
LearningCode/2_7_deleteBlank.py
jercas/PythonCrashCourse
464cf1dfa4c33adc73e15e15a37da94da0912e19
[ "Apache-2.0" ]
1
2017-07-03T09:41:22.000Z
2017-07-03T09:41:22.000Z
LearningCode/2_7_deleteBlank.py
jercas/PythonCrashCourse
464cf1dfa4c33adc73e15e15a37da94da0912e19
[ "Apache-2.0" ]
null
null
null
LearningCode/2_7_deleteBlank.py
jercas/PythonCrashCourse
464cf1dfa4c33adc73e15e15a37da94da0912e19
[ "Apache-2.0" ]
null
null
null
#coding=utf-8 #剔除任命中空白P24 2017.4.8 name=" jercas " print(name) print("\t"+name) print("\n\n"+name) print(name.lstrip()) print(name.rstrip()) print(name.strip())
16.1
20
0.68323
27
161
4.074074
0.518519
0.327273
0
0
0
0
0
0
0
0
0
0.060403
0.074534
161
9
21
17.888889
0.677852
0.192547
0
0
0
0
0.109375
0
0
0
0
0
0
1
0
false
0
0
0
0
0.857143
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
1
0
4
f8e6d85eda6880cdb234eb2a663197f33f3c9c4f
168
py
Python
django_inventory/apps/common/templatetags/project_tags.py
alka653/inventory
b8fc944962666652189ff73ae53b1c2194553e02
[ "Apache-2.0" ]
null
null
null
django_inventory/apps/common/templatetags/project_tags.py
alka653/inventory
b8fc944962666652189ff73ae53b1c2194553e02
[ "Apache-2.0" ]
1
2022-03-12T01:03:39.000Z
2022-03-12T01:03:39.000Z
django_inventory/apps/common/templatetags/project_tags.py
alka653/inventory
b8fc944962666652189ff73ae53b1c2194553e02
[ "Apache-2.0" ]
1
2020-06-08T11:57:08.000Z
2020-06-08T11:57:08.000Z
from django.conf import settings from django.template import Library register = Library() @register.simple_tag def project_name(): return settings.PROJECT_TITLE
16.8
35
0.797619
22
168
5.954545
0.681818
0.152672
0
0
0
0
0
0
0
0
0
0
0.136905
168
9
36
18.666667
0.903448
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0.166667
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
1
0
0
0
4
f8fb849bf8e2755d0a066e2fc90f6f6fd6987f50
7,603
py
Python
src/main/scripts/modules/.py
Kynarth/ryrycipe
e689ba5859a3641c7ff9ea0b868280bfeaf34ec9
[ "MIT" ]
null
null
null
src/main/scripts/modules/.py
Kynarth/ryrycipe
e689ba5859a3641c7ff9ea0b868280bfeaf34ec9
[ "MIT" ]
null
null
null
src/main/scripts/modules/.py
Kynarth/ryrycipe
e689ba5859a3641c7ff9ea0b868280bfeaf34ec9
[ "MIT" ]
null
null
null
class Res: logo = '../resources/images/logo.png' SH_buckler = '../resources/images/plans/SH_buckler.png' PA_diadem = '../resources/images/plans/PA_diadem.png' MW_dagger = '../resources/images/plans/MW_dagger.png' RW_autolaunch = '../resources/images/plans/RW_autolaunch.png' AR_hand = '../resources/images/plans/AR_hand.png' AR_helmet = '../resources/images/plans/AR_helmet.png' PA_bracelet = '../resources/images/plans/PA_bracelet.png' MW_mace = '../resources/images/plans/MW_mace.png' RW_launcher = '../resources/images/plans/RW_launcher.png' AR_botte = '../resources/images/plans/AR_botte.png' RW_pistolarc = '../resources/images/plans/RW_pistolarc.png' MG_Glove = '../resources/images/plans/MG_Glove.png' RW_rifle = '../resources/images/plans/RW_rifle.png' MW_axe = '../resources/images/plans/MW_axe.png' MW_sword = '../resources/images/plans/MW_sword.png' RW_harpoongun = '../resources/images/plans/RW_harpoongun.png' AR_pantabotte = '../resources/images/plans/AR_pantabotte.png' MW_2h_sword = '../resources/images/plans/MW_2h_sword.png' PA_pendant = '../resources/images/plans/PA_pendant.png' MW_staff = '../resources/images/plans/MW_staff.png' RW_grenade = '../resources/images/plans/RW_grenade.png' RW_pistol = '../resources/images/plans/RW_pistol.png' AR_gilet = '../resources/images/plans/AR_gilet.png' SH_large_shield = '../resources/images/plans/SH_large_shield.png' PA_earring = '../resources/images/plans/PA_earring.png' AR_armpad = '../resources/images/plans/AR_armpad.png' MW_2h_mace = '../resources/images/plans/MW_2h_mace.png' RW_bowgun = '../resources/images/plans/RW_bowgun.png' MW_2h_lance = '../resources/images/plans/MW_2h_lance.png' PA_ring = '../resources/images/plans/PA_ring.png' MW_2h_axe = '../resources/images/plans/MW_2h_axe.png' MW_lance = '../resources/images/plans/MW_lance.png' PA_anklet = '../resources/images/plans/PA_anklet.png' Numbers_5 = '../resources/images/foregrounds/Numbers_5.png' Numbers_6 = '../resources/images/foregrounds/Numbers_6.png' Numbers_2 = '../resources/images/foregrounds/Numbers_2.png' Numbers_9 = '../resources/images/foregrounds/Numbers_9.png' PW_light = '../resources/images/foregrounds/PW_light.png' PW_medium = '../resources/images/foregrounds/PW_medium.png' AM_logo = '../resources/images/foregrounds/AM_logo.png' Numbers_8 = '../resources/images/foregrounds/Numbers_8.png' Numbers_1 = '../resources/images/foregrounds/Numbers_1.png' PW_heavy = '../resources/images/foregrounds/PW_heavy.png' Numbers_4 = '../resources/images/foregrounds/Numbers_4.png' Numbers_3 = '../resources/images/foregrounds/Numbers_3.png' Numbers_0 = '../resources/images/foregrounds/Numbers_0.png' Numbers_7 = '../resources/images/foregrounds/Numbers_7.png' W_quantity = '../resources/images/foregrounds/W_quantity.png' ICO_armor_clip = '../resources/images/components/ICO_armor_clip.png' ICO_Jewel_stone = '../resources/images/components/ICO_Jewel_stone.png' ICO_Explosif = '../resources/images/components/ICO_Explosif.png' ICO_Jewel_stone_support = '../resources/images/components/ICO_Jewel_stone_support.png' ICO_Lining = '../resources/images/components/ICO_Lining.png' ICO_Counterweight = '../resources/images/components/ICO_Counterweight.png' ICO_Firing_pin = '../resources/images/components/ICO_Firing_pin.png' ICO_Blade = '../resources/images/components/ICO_Blade.png' ICO_trigger = '../resources/images/components/ICO_trigger.png' ICO_Grip = '../resources/images/components/ICO_Grip.png' ICO_Armor_shell = '../resources/images/components/ICO_Armor_shell.png' ICO_Pointe = '../resources/images/components/ICO_Pointe.png' ICO_Ammo_jacket = '../resources/images/components/ICO_Ammo_jacket.png' ICO_Magic_focus = '../resources/images/components/ICO_Magic_focus.png' ICO_Clothes = '../resources/images/components/ICO_Clothes.png' ICO_Ammo_bullet = '../resources/images/components/ICO_Ammo_bullet.png' ICO_Stuffing = '../resources/images/components/ICO_Stuffing.png' ICO_Shaft = '../resources/images/components/ICO_Shaft.png' ICO_hammer = '../resources/images/components/ICO_hammer.png' ICO_barrel = '../resources/images/components/ICO_barrel.png' MP_Oil = '../resources/images/materials/MP_Oil.png' MP_Wood_Node = '../resources/images/materials/MP_Wood_Node.png' MP_Wood = '../resources/images/materials/MP_Wood.png' MP_Bone = '../resources/images/materials/MP_Bone.png' MP_Horn = '../resources/images/materials/MP_Horn.png' MP_Eye = '../resources/images/materials/MP_Eye.png' MP_Secretion = '../resources/images/materials/MP_Secretion.png' MP_Ligament = '../resources/images/materials/MP_Ligament.png' MP_Kitin_Shell = '../resources/images/materials/MP_Kitin_Shell.png' MP_Moss = '../resources/images/materials/MP_Moss.png' MP_Leather = '../resources/images/materials/MP_Leather.png' MP_Sap = '../resources/images/materials/MP_Sap.png' MP_Nail = '../resources/images/materials/MP_Nail.png' MP_Seed = '../resources/images/materials/MP_Seed.png' MP_Tooth = '../resources/images/materials/MP_Tooth.png' MP_Wing = '../resources/images/materials/MP_Wing.png' MP_Fiber = '../resources/images/materials/MP_Fiber.png' MP_Amber = '../resources/images/materials/MP_Amber.png' MP_Resin = '../resources/images/materials/MP_Resin.png' MP_Sting = '../resources/images/materials/MP_Sting.png' MP_Rostrum = '../resources/images/materials/MP_Rostrum.png' MP_Whiskers = '../resources/images/materials/MP_Whiskers.png' MP_Fang = '../resources/images/materials/MP_Fang.png' MP_Trunk = '../resources/images/materials/MP_Trunk.png' MP_Beak = '../resources/images/materials/MP_Beak.png' MP_Shell = '../resources/images/materials/MP_Shell.png' MP_Bud = '../resources/images/materials/MP_Bud.png' MP_Hoof = '../resources/images/materials/MP_Hoof.png' MP_Mushroom = '../resources/images/materials/MP_Mushroom.png' MP_generic = '../resources/images/materials/MP_generic.png' MP_Spine = '../resources/images/materials/MP_Spine.png' MP_Pelvis = '../resources/images/materials/MP_Pelvis.png' MP_Claw = '../resources/images/materials/MP_Claw.png' MP_Tail = '../resources/images/materials/MP_Tail.png' MP_Mandible = '../resources/images/materials/MP_Mandible.png' MP_Bark = '../resources/images/materials/MP_Bark.png' MP_Skin = '../resources/images/materials/MP_Skin.png' new = '../resources/images/toolbar/new.png' upload = '../resources/images/toolbar/upload.png' save = '../resources/images/toolbar/save.png' search = '../resources/images/toolbar/search.png' select_plan = '../resources/images/toolbar/select_plan.png' change_lang = '../resources/images/toolbar/change_lang.png' BK_tryker = '../resources/images/backgrounds/BK_tryker.png' BK_karavan = '../resources/images/backgrounds/BK_karavan.png' BK_zoraï = '../resources/images/backgrounds/BK_zoraï.png' BK_empty = '../resources/images/backgrounds/BK_empty.png' BK_fyros = '../resources/images/backgrounds/BK_fyros.png' BK_matis = '../resources/images/backgrounds/BK_matis.png' BK_kami = '../resources/images/backgrounds/BK_kami.png' BK_generic = '../resources/images/backgrounds/BK_generic.png' BK_primes = '../resources/images/backgrounds/BK_primes.png' @classmethod def get(cls, string): return cls.__getattribute__(cls, string)
60.34127
90
0.724977
1,001
7,603
5.238761
0.153846
0.34611
0.169336
0.183448
0.104119
0.014493
0
0
0
0
0
0.00416
0.114692
7,603
126
91
60.34127
0.774922
0
0
0
0
0
0.678459
0.678459
0
0
0
0
0
1
0.008
false
0
0
0.008
0.992
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
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
5d3b1e06289d4ef04600b7a44715f6e8f367b1bc
76
py
Python
mumblr/__init__.py
cleemesser/django-mumblr
d9b3c54ff81a3cf03393418e67021b2b9c646bcf
[ "MIT" ]
35
2015-02-10T12:44:33.000Z
2020-12-27T19:47:33.000Z
mumblr/__init__.py
cleemesser/django-mumblr
d9b3c54ff81a3cf03393418e67021b2b9c646bcf
[ "MIT" ]
null
null
null
mumblr/__init__.py
cleemesser/django-mumblr
d9b3c54ff81a3cf03393418e67021b2b9c646bcf
[ "MIT" ]
16
2015-02-20T19:13:43.000Z
2022-02-16T04:38:12.000Z
# To ensure that the core entry types are registered import entrytypes.core
25.333333
52
0.815789
12
76
5.166667
0.916667
0
0
0
0
0
0
0
0
0
0
0
0.157895
76
2
53
38
0.96875
0.657895
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
5d4a9ae8c6ed99f2e1081d0254d6a0e0b4293fdd
467
py
Python
src/ol_data_pipelines/mitx_bigquery/repositories.py
mitodl/ol-data-pipelines
26766947d39c38f3eaf5dc3ad7a3a67295bdcda5
[ "BSD-3-Clause" ]
11
2020-09-10T18:51:24.000Z
2022-03-19T01:18:46.000Z
src/ol_data_pipelines/mitx_bigquery/repositories.py
mitodl/ol-data-pipelines
26766947d39c38f3eaf5dc3ad7a3a67295bdcda5
[ "BSD-3-Clause" ]
170
2020-05-19T19:40:38.000Z
2022-03-28T15:35:24.000Z
src/ol_data_pipelines/mitx_bigquery/repositories.py
mitodl/ol-data-pipelines
26766947d39c38f3eaf5dc3ad7a3a67295bdcda5
[ "BSD-3-Clause" ]
5
2020-11-19T21:20:08.000Z
2021-11-01T21:10:20.000Z
"""Repository for pipeline pulling MITx bigquery data to S3.""" from dagster import repository from ol_data_pipelines.mitx_bigquery.schedule import mitx_bigquery_daily_schedule from ol_data_pipelines.mitx_bigquery.solids import mitx_bigquery_pipeline @repository def mitx_bigquery_repository(): """Repository for mitx bigquery pipeline. :returns: open data pipelines and schedules """ return [mitx_bigquery_pipeline, mitx_bigquery_daily_schedule]
31.133333
81
0.815846
60
467
6.05
0.383333
0.297521
0.165289
0.104683
0.170799
0.170799
0
0
0
0
0
0.002451
0.126338
467
14
82
33.357143
0.887255
0.301927
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
true
0
0.5
0
0.833333
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
5d4adc62273a8e8cf0b2e596196d3debe4b182dc
111
py
Python
PYTHON CODES/AgeCalculator.py
Pavan1199/PURE-PYTHON-CODES
f0b9823e264e67a498a742eb66ab569cc1861b5e
[ "MIT" ]
2
2019-03-31T14:10:44.000Z
2019-05-03T17:19:00.000Z
PYTHON CODES/AgeCalculator.py
Pavan1199/PURE-PYTHON-CODES
f0b9823e264e67a498a742eb66ab569cc1861b5e
[ "MIT" ]
null
null
null
PYTHON CODES/AgeCalculator.py
Pavan1199/PURE-PYTHON-CODES
f0b9823e264e67a498a742eb66ab569cc1861b5e
[ "MIT" ]
null
null
null
#WAP to find your age a=input("Enter the year of birth = ") b=2015-a print"Your age is approximately = ",b
22.2
38
0.675676
21
111
3.571429
0.809524
0.186667
0
0
0
0
0
0
0
0
0
0.045455
0.207207
111
4
39
27.75
0.806818
0.18018
0
0
0
0
0.627907
0
0
0
0
0
0
0
null
null
0
0
null
null
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
5d6634616537a2608953f64e93c5c13661e99946
159
py
Python
Exercises/Exercise 12 - Intermediate.py
MikelShifrin/Python1
0096a327023a28e0c639042ae01268b07e61943e
[ "MIT" ]
3
2019-07-02T13:46:23.000Z
2019-08-19T14:41:25.000Z
Exercises/Exercise 12 - Intermediate.py
MikelShifrin/Python1
0096a327023a28e0c639042ae01268b07e61943e
[ "MIT" ]
null
null
null
Exercises/Exercise 12 - Intermediate.py
MikelShifrin/Python1
0096a327023a28e0c639042ae01268b07e61943e
[ "MIT" ]
null
null
null
#Assignment 9 #write a km to miles converter #Miles = KM x 0.6214 #write it using void functions #HINT: #you will have 2 functions: #main(): #km_to_miles(km):
17.666667
30
0.72327
29
159
3.896552
0.724138
0.070796
0.159292
0
0
0
0
0
0
0
0
0.052632
0.163522
159
8
31
19.875
0.796992
0.899371
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
54deea1ac88edf0cc30e4bb3375667e87b90ed15
111
py
Python
5time.py
Dyavathrocky/rocky
693833e61ce9317ab003ca61d4654c6b3806cd22
[ "Apache-2.0" ]
null
null
null
5time.py
Dyavathrocky/rocky
693833e61ce9317ab003ca61d4654c6b3806cd22
[ "Apache-2.0" ]
null
null
null
5time.py
Dyavathrocky/rocky
693833e61ce9317ab003ca61d4654c6b3806cd22
[ "Apache-2.0" ]
null
null
null
#5times range print('my name i') for i in range (5): print('jimee my name ('+ str(i) +')')
18.5
42
0.495495
17
111
3.235294
0.647059
0.218182
0
0
0
0
0
0
0
0
0
0.026667
0.324324
111
5
43
22.2
0.706667
0.108108
0
0
0
0
0.268817
0
0
0
0
0
0
1
0
false
0
0
0
0
0.666667
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
1
0
4
54e7af09ee580ad36c84df2470aa0de8b272697b
139
py
Python
opy/_regtest/src/spec/bin/printenv.py
Schweinepriester/oil
8b0e5c58a825223341896064d63a95c8b57a9c05
[ "Apache-2.0" ]
2,209
2016-11-20T10:32:58.000Z
2022-03-31T20:51:27.000Z
opy/_regtest/src/spec/bin/printenv.py
Schweinepriester/oil
8b0e5c58a825223341896064d63a95c8b57a9c05
[ "Apache-2.0" ]
1,074
2016-12-07T05:02:48.000Z
2022-03-22T02:09:11.000Z
opy/_regtest/src/spec/bin/printenv.py
Schweinepriester/oil
8b0e5c58a825223341896064d63a95c8b57a9c05
[ "Apache-2.0" ]
147
2016-12-11T04:13:28.000Z
2022-03-27T14:50:00.000Z
#!/usr/bin/env python from __future__ import print_function import os import sys for name in sys.argv[1:]: print(os.environ.get(name))
15.444444
37
0.748201
24
139
4.125
0.75
0
0
0
0
0
0
0
0
0
0
0.008333
0.136691
139
8
38
17.375
0.816667
0.143885
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.6
0
0.6
0.4
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
070ad3a3aa723b27b9eb62ae1cece2d69adc47b6
26
py
Python
src/version.py
Ancient-Relic/botty
dd2628708e89b1c2cbdea1402e860dc2b338155e
[ "MIT" ]
null
null
null
src/version.py
Ancient-Relic/botty
dd2628708e89b1c2cbdea1402e860dc2b338155e
[ "MIT" ]
null
null
null
src/version.py
Ancient-Relic/botty
dd2628708e89b1c2cbdea1402e860dc2b338155e
[ "MIT" ]
null
null
null
__version__ = '0.6.3-dev'
13
25
0.653846
5
26
2.6
1
0
0
0
0
0
0
0
0
0
0
0.130435
0.115385
26
1
26
26
0.434783
0
0
0
0
0
0.346154
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
070d49a0c294112b2609452ac4f13f7ae443c6df
83
py
Python
mapp/apps.py
zszwoaini/ygsc
9edff2b7ebc2d56879de1ab2c7cabbe4744940f2
[ "Apache-2.0" ]
4
2020-10-09T19:30:04.000Z
2020-11-23T10:05:43.000Z
mapp/apps.py
zszwoaini/ygsc
9edff2b7ebc2d56879de1ab2c7cabbe4744940f2
[ "Apache-2.0" ]
29
2021-01-28T14:03:05.000Z
2022-02-03T18:21:09.000Z
hasty/mapp/apps.py
NREL/haste
18e4941d933a90a53c162a64993ff46608a7128f
[ "BSD-3-Clause" ]
null
null
null
from django.apps import AppConfig class MappConfig(AppConfig): name = 'mapp'
13.833333
33
0.73494
10
83
6.1
0.9
0
0
0
0
0
0
0
0
0
0
0
0.180723
83
5
34
16.6
0.897059
0
0
0
0
0
0.048193
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
0755537e045bdbc9bccdde90ed1b7662dfcbf61e
64
py
Python
wifi_client_cfg.py
ecorobot/micropython-boot
b495d4c52cb567a39722aadea06d03138f28d5f6
[ "MIT" ]
null
null
null
wifi_client_cfg.py
ecorobot/micropython-boot
b495d4c52cb567a39722aadea06d03138f28d5f6
[ "MIT" ]
null
null
null
wifi_client_cfg.py
ecorobot/micropython-boot
b495d4c52cb567a39722aadea06d03138f28d5f6
[ "MIT" ]
null
null
null
EXTERNEL_WIFI_SSID = 'ssid' EXTERNEL_WIFI_PASSWORD = 'password'
21.333333
35
0.8125
8
64
6
0.5
0.5
0
0
0
0
0
0
0
0
0
0
0.09375
64
2
36
32
0.827586
0
0
0
0
0
0.1875
0
0
0
0
0
0
1
0
false
0.5
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
1
0
0
0
0
0
4
4acf18fa475b3c3d752ebced89ef13a685163907
1,009
py
Python
tests/test_validators.py
insilichem/gpathfinder
e6c7df14d473857acb007efbae3cc7b4fee1b330
[ "Apache-2.0" ]
5
2020-03-22T20:21:47.000Z
2022-03-08T07:50:25.000Z
tests/test_validators.py
insilichem/gpathfinder
e6c7df14d473857acb007efbae3cc7b4fee1b330
[ "Apache-2.0" ]
2
2020-04-09T10:49:26.000Z
2022-03-08T04:37:27.000Z
tests/test_validators.py
insilichem/gpathfinder
e6c7df14d473857acb007efbae3cc7b4fee1b330
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- ############## # GPathFinder: Identification of ligand pathways by a multi-objective # genetic algorithm # # https://github.com/insilichem/gpathfinder # # Copyright 2019 José-Emilio Sánchez Aparicio, Giuseppe Sciortino, # Daniel Villadrich Herrmannsdoerfer, Pablo Orenes Chueca, # Jaime Rodríguez-Guerra Pedregal and Jean-Didier Maréchal # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############## import pytest from conftest import datapath, expressed
33.633333
74
0.74331
138
1,009
5.434783
0.76087
0.08
0.034667
0.042667
0
0
0
0
0
0
0
0.010563
0.1556
1,009
29
75
34.793103
0.869718
0.869177
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
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
4adc32ce73c585a0c2ddf483133eac258d2b6b10
197
py
Python
setup.py
supplepentan/penta-paint-transformer
52de1ae9d29bf4dbde2f4480d9b86e9217b90c6d
[ "Apache-2.0" ]
null
null
null
setup.py
supplepentan/penta-paint-transformer
52de1ae9d29bf4dbde2f4480d9b86e9217b90c6d
[ "Apache-2.0" ]
null
null
null
setup.py
supplepentan/penta-paint-transformer
52de1ae9d29bf4dbde2f4480d9b86e9217b90c6d
[ "Apache-2.0" ]
null
null
null
import gdown import os gdown.download("https://drive.google.com/u/0/uc?id=1NDD54BLligyr8tzo8QGI5eihZisXK1nq&export=download", './model.pth', quiet=False) os.makedirs("input") os.makedirs("output")
32.833333
130
0.77665
27
197
5.666667
0.777778
0.130719
0
0
0
0
0
0
0
0
0
0.042553
0.045685
197
6
131
32.833333
0.771277
0
0
0
0
0.2
0.535354
0
0
0
0
0
0
1
0
true
0
0.4
0
0.4
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
ab172c709a2518d370cdda87b5215262b6efa2cd
178
py
Python
testing/noauth/test_news.py
North14/avanza
bc2b0054ba9e8f93ebeaad14acd19452e60f8713
[ "MIT" ]
11
2020-03-17T08:17:12.000Z
2021-11-27T12:18:14.000Z
testing/noauth/test_news.py
North14/avanza
bc2b0054ba9e8f93ebeaad14acd19452e60f8713
[ "MIT" ]
19
2020-03-12T09:44:33.000Z
2021-04-29T21:15:50.000Z
testing/noauth/test_news.py
North14/avanza
bc2b0054ba9e8f93ebeaad14acd19452e60f8713
[ "MIT" ]
null
null
null
import avanza def test_news(): news = avanza.News(3) assert news assert news.results assert isinstance(news.pretty, str) assert isinstance(news.info, dict)
17.8
39
0.691011
24
178
5.083333
0.541667
0.163934
0.327869
0
0
0
0
0
0
0
0
0.007194
0.219101
178
9
40
19.777778
0.870504
0
0
0
0
0
0
0
0
0
0
0
0.571429
1
0.142857
false
0
0.142857
0
0.285714
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
ab406b0f5ebedd14e995c4b7d533b17a6b65804a
1,142
py
Python
bch_params.py
kubaszpak/Forward_error_correction
d5f1d0fc4cd64fc48d98b95b0b258f6ffe5ac36b
[ "MIT" ]
null
null
null
bch_params.py
kubaszpak/Forward_error_correction
d5f1d0fc4cd64fc48d98b95b0b258f6ffe5ac36b
[ "MIT" ]
null
null
null
bch_params.py
kubaszpak/Forward_error_correction
d5f1d0fc4cd64fc48d98b95b0b258f6ffe5ac36b
[ "MIT" ]
1
2021-06-15T17:51:18.000Z
2021-06-15T17:51:18.000Z
bch_code_parameters = { 3:{ 1:4 }, 4:{ 1:11, 2:7, 3:5 }, 5:{ 1:26, 2:21, 3:16, 5:11, 7:6 }, 6:{ 1:57, 2:51, 3:45, 4:39, 5:36, 6:30, 7:24, 10:18, 11:16, 13:10, 15:7 }, 7:{ 1:120, 2:113, 3:106, 4:99, 5:92, 6:85, 7:78, 9:71, 10:64, 11:57, 13:50, 14:43, 15:36, 21:29, 23:22, 27:15, 31:8 }, 8:{ 1:247, 2:239, 3:231, 4:223, 5:215, 6:207, 7:199, 8:191, 9:187, 10:179, 11:171, 12:163, 13:155, 14:147, 15:139, 18:131, 19:123, 21:115, 22:107, 23:99, 25:91, 26:87, 27:79, 29:71, 30:63, 31:55, 42:47, 43:45, 45:37, 47:29, 55:21, 59:13, 63:9 } }
13.435294
23
0.251313
149
1,142
1.912752
0.503356
0
0
0
0
0
0
0
0
0
0
0.599553
0.608581
1,142
84
24
13.595238
0.038031
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
1
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
4
ab4e122fea20f38f2071f61a8912fe0c4790cb60
1,911
py
Python
tests/integration/test_type_conversion_util.py
helxplatform/roger
60c1c1198c41949804692217c74848e2aa8b9ea2
[ "MIT" ]
null
null
null
tests/integration/test_type_conversion_util.py
helxplatform/roger
60c1c1198c41949804692217c74848e2aa8b9ea2
[ "MIT" ]
7
2021-04-08T12:17:27.000Z
2022-02-08T23:12:32.000Z
tests/integration/test_type_conversion_util.py
helxplatform/roger
60c1c1198c41949804692217c74848e2aa8b9ea2
[ "MIT" ]
3
2020-12-07T20:49:43.000Z
2021-06-12T19:49:43.000Z
from roger.components.data_conversion_utils import TypeConversionUtil def test_type_comparision(): datatype_1 = list.__name__ datatype_2 = str.__name__ datatype_3 = bool.__name__ datatype_4 = float.__name__ datatype_5 = int.__name__ # list should always come first assert datatype_1 == TypeConversionUtil.compare_types(datatype_1, datatype_2) assert datatype_1 == TypeConversionUtil.compare_types(datatype_1, datatype_3) assert datatype_1 == TypeConversionUtil.compare_types(datatype_1, datatype_4) assert datatype_1 == TypeConversionUtil.compare_types(datatype_1, datatype_5) # then string assert datatype_2 == TypeConversionUtil.compare_types(datatype_2, datatype_3) assert datatype_2 == TypeConversionUtil.compare_types(datatype_2, datatype_4) assert datatype_2 == TypeConversionUtil.compare_types(datatype_2, datatype_5) # the rest should always be casted up to string assert datatype_2 == TypeConversionUtil.compare_types(datatype_3, datatype_4) assert datatype_2 == TypeConversionUtil.compare_types(datatype_4, datatype_5) assert datatype_2 == TypeConversionUtil.compare_types(datatype_5, datatype_3) # should raise error when sent 'Unknown' data types bogus_dt = "bogus" try: TypeConversionUtil.compare_types(bogus_dt, datatype_1) except AssertionError as error: exception_raised = True assert exception_raised try: TypeConversionUtil.compare_types(datatype_1, bogus_dt) except AssertionError as error: exception_raised = True assert exception_raised def test_casting_values(): castable = [ ["True", bool.__name__, True], [1 , bool.__name__, True], [1.0, bool.__name__, True], [[], bool.__name__, False] ] for items in castable: assert items[-1] == TypeConversionUtil.cast(*items[:-1]) # cast (value, type)
38.22
86
0.736264
230
1,911
5.691304
0.273913
0.229183
0.275019
0.319328
0.601986
0.572193
0.572193
0.531704
0.482047
0.102368
0
0.026975
0.185243
1,911
49
87
39
0.813744
0.081633
0
0.216216
0
0
0.005149
0
0
0
0
0
0.405405
1
0.054054
false
0
0.027027
0
0.081081
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
1
0
0
0
0
0
0
0
0
0
4
db463ac6a19b4d1ae28e035153b36e5bbf18bf10
1,479
py
Python
ontask/action/views/__init__.py
LucasFranciscoCorreia/ontask_b
5473e9faa24c71a2a1102d47ebc2cbf27608e42a
[ "MIT" ]
null
null
null
ontask/action/views/__init__.py
LucasFranciscoCorreia/ontask_b
5473e9faa24c71a2a1102d47ebc2cbf27608e42a
[ "MIT" ]
null
null
null
ontask/action/views/__init__.py
LucasFranciscoCorreia/ontask_b
5473e9faa24c71a2a1102d47ebc2cbf27608e42a
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """Module with all the views used related to actions.""" from ontask.action.views.action import ( ActionCreateView, ActionUpdateView, action_index, delete_action, edit_action, ) from ontask.action.views.clone import clone_action, clone_condition from ontask.action.views.condition import ( ConditionCreateView, FilterCreateView, delete_condition, delete_filter, edit_condition, edit_filter, ) from ontask.action.views.edit_personalized import ( action_out_save_content, edit_action_out, showurl, ) from ontask.action.views.edit_survey import ( edit_action_in, edit_description, select_column_action, select_condition_for_question, shuffle_questions, unselect_column_action, ) from ontask.action.views.import_export import ( action_import, export_ask, export_done, export_download, ) from ontask.action.views.preview import ( preview_next_all_false_response, preview_response, ) from ontask.action.views.run import ( run_action, run_action_item_filter, serve_action, serve_action_lti ) from ontask.action.views.run_canvas_email import run_canvas_email_done from ontask.action.views.run_email import run_email_done from ontask.action.views.run_json import run_json_done from ontask.action.views.run_survey import ( run_survey_row, run_survey_ss, survey_thanks, ) from ontask.action.views.run_zip import ( action_zip_export, run_zip_done, zip_action, ) from ontask.action.views.timeline import show_timeline
36.975
77
0.812035
206
1,479
5.5
0.300971
0.123566
0.197705
0.259488
0.262136
0.082966
0.058252
0
0
0
0
0.000762
0.112238
1,479
39
78
37.923077
0.862148
0.049358
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.428571
0
0.428571
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
db634b54d94bc17a9aab672ae1e293b857c5f0a7
62
py
Python
user/__init__.py
PeinW/seeyes
666d8e2da9b1adb57b40189603245061de5d4bf9
[ "MIT" ]
null
null
null
user/__init__.py
PeinW/seeyes
666d8e2da9b1adb57b40189603245061de5d4bf9
[ "MIT" ]
null
null
null
user/__init__.py
PeinW/seeyes
666d8e2da9b1adb57b40189603245061de5d4bf9
[ "MIT" ]
null
null
null
# user/__init.py import pymysql pymysql.install_as_MySQLdb()
12.4
28
0.806452
9
62
5.111111
0.888889
0
0
0
0
0
0
0
0
0
0
0
0.096774
62
4
29
15.5
0.821429
0.225806
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
db73ea51bf9a467f697d10c4534857348b3b9630
692
py
Python
example_settings.py
droberson/usb-watch
8fb5ecabcbca9262a9750c9e37202291d82cb749
[ "MIT" ]
4
2018-01-23T03:21:46.000Z
2022-01-24T16:52:52.000Z
example_settings.py
droberson/usb-watch
8fb5ecabcbca9262a9750c9e37202291d82cb749
[ "MIT" ]
1
2019-12-19T21:08:50.000Z
2019-12-19T21:08:50.000Z
example_settings.py
droberson/usb-watch
8fb5ecabcbca9262a9750c9e37202291d82cb749
[ "MIT" ]
1
2022-01-24T16:52:52.000Z
2022-01-24T16:52:52.000Z
### WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ### ### This file MUST be edited properly and copied to settings.py in order for ### SMS functionality to work. Get set up on Twilio.com for the required API ### keys and phone number settings. ### ### WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING # These are Twilio API settings. Sign up at Twilio to get them. account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" auth_token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" # The number the SMS is from. Must be valid on your Twilio account. phone_from="+1213XXXYYYY" # The number to send the SMS to (your cell phone number) phone_to="+1808XXXYYYY"
36.421053
76
0.776012
99
692
5.383838
0.494949
0.420263
0.551595
0.630394
0.236398
0.236398
0.236398
0.236398
0.236398
0
0
0.013675
0.154624
692
18
77
38.444444
0.897436
0.728324
0
0
0
0
0.555556
0.407407
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
db7782926887e0ad6e191f6a2162494b859822c6
212
py
Python
config.py
gagnokenneth/foodle
d18279fbdfb2919a7f66366a33bbf29db68475e3
[ "MIT" ]
null
null
null
config.py
gagnokenneth/foodle
d18279fbdfb2919a7f66366a33bbf29db68475e3
[ "MIT" ]
null
null
null
config.py
gagnokenneth/foodle
d18279fbdfb2919a7f66366a33bbf29db68475e3
[ "MIT" ]
1
2022-03-23T08:38:40.000Z
2022-03-23T08:38:40.000Z
from os import getenv SECRET_KEY = getenv("SECRET_KEY") DB_NAME = getenv("DB_NAME") DB_USERNAME = getenv("DB_USERNAME") DB_PASSWORD = getenv("DB_PASSWORD") DB_HOST = getenv("DB_HOST") DB_PORT = getenv("DB_PORT")
26.5
35
0.754717
34
212
4.352941
0.352941
0.27027
0.202703
0
0
0
0
0
0
0
0
0
0.103774
212
8
36
26.5
0.778947
0
0
0
0
0
0.248826
0
0
0
0
0
0
1
0
false
0.142857
0.142857
0
0.142857
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
db78334558eab700ce40b688a7ef1fd140cf6466
783
py
Python
src/utils.py
ray5273/gpt_hackathon
95ad1a3c630472d3524845c0ed57c50a73605ca9
[ "MIT" ]
4
2019-11-17T12:41:18.000Z
2020-02-21T11:03:59.000Z
src/utils.py
inspirit941/gpt_hackathon
f8fb11dae8ce3324dadc7425b7b28835caa0f915
[ "MIT" ]
8
2020-09-25T22:40:56.000Z
2022-02-09T23:39:35.000Z
src/utils.py
inspirit941/gpt_hackathon
f8fb11dae8ce3324dadc7425b7b28835caa0f915
[ "MIT" ]
2
2021-11-12T16:28:31.000Z
2021-11-20T18:05:40.000Z
import re def convert_text(text): ''' convert text for sentence split split token: '.. ' ''' out = re.sub('[\n]+', '', re.sub('[?]', '?.. ', re.sub('다\.', '다... ', re.sub('\."', '"', re.sub('[!]', '!.. ', re.sub('[.?]+', '.', re.sub('[ ]+', ' ', re.sub('[.]+', '.', text)))))))) return out def rm_sp(x): while 1: try: x.remove('') except: try: x.remove(' ') except: break return x
26.1
91
0.232439
53
783
3.396226
0.433962
0.222222
0.194444
0.277778
0.138889
0.138889
0.138889
0.138889
0
0
0
0.003067
0.583653
783
29
92
27
0.54908
0.063857
0
0.285714
0
0
0.069869
0
0
0
0
0
0
1
0.095238
false
0
0.047619
0
0.238095
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
db8cd8d124c24dea07e5379da9e323786673a9b9
324
py
Python
dask_ml/metrics/__init__.py
prasunanand/dask-ml
69680f79d0dff57bec50818998edc20b71b6846f
[ "BSD-3-Clause" ]
1
2022-02-11T12:06:31.000Z
2022-02-11T12:06:31.000Z
dask_ml/metrics/__init__.py
prasunanand/dask-ml
69680f79d0dff57bec50818998edc20b71b6846f
[ "BSD-3-Clause" ]
5
2019-02-27T22:38:25.000Z
2020-08-13T18:16:36.000Z
dask_ml/metrics/__init__.py
prasunanand/dask-ml
69680f79d0dff57bec50818998edc20b71b6846f
[ "BSD-3-Clause" ]
3
2020-05-11T07:38:05.000Z
2022-02-11T12:33:50.000Z
from .classification import accuracy_score, log_loss # noqa from .pairwise import ( # noqa euclidean_distances, pairwise_distances, pairwise_distances_argmin_min, ) from .regression import mean_absolute_error, mean_squared_error, r2_score # noqa from .scorer import SCORERS, check_scoring, get_scorer # noqa
36
81
0.79321
41
324
5.926829
0.585366
0.065844
0.213992
0
0
0
0
0
0
0
0
0.003636
0.151235
324
8
82
40.5
0.88
0.058642
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
dbad49539e47b5a35203c8ee146c5d09b3abbba0
183
py
Python
cap3/ex10.py
felipesch92/livroPython
061b1c095c3ec2d25fb1d5fdfbf9e9dbe10b3307
[ "MIT" ]
null
null
null
cap3/ex10.py
felipesch92/livroPython
061b1c095c3ec2d25fb1d5fdfbf9e9dbe10b3307
[ "MIT" ]
null
null
null
cap3/ex10.py
felipesch92/livroPython
061b1c095c3ec2d25fb1d5fdfbf9e9dbe10b3307
[ "MIT" ]
null
null
null
km = float(input('Informe a KM percorrida: ')) # 0.15 d = int(input('Informe quantos dias: ')) # 60 print(f'{d} dias e {km} km rodados. Valor final: R$ {(km * 0.15) + (d * 60):.2f}')
45.75
82
0.590164
33
183
3.272727
0.636364
0.222222
0.074074
0
0
0
0
0
0
0
0
0.073333
0.180328
183
3
83
61
0.646667
0.038251
0
0
0
0.333333
0.687861
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
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
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
dbc1bf7c970f86dad89ed14c24e882a5f441b3d7
15,652
py
Python
tests/components/wled/test_select.py
nickna/core
c682d5d5e430de52e3da7e06026cd8b4087e864f
[ "Apache-2.0" ]
1
2021-06-16T09:29:20.000Z
2021-06-16T09:29:20.000Z
tests/components/wled/test_select.py
flexy2dd/core
1019ee22ff13e5f542e868179d791e6a0d87369a
[ "Apache-2.0" ]
70
2020-07-16T02:07:46.000Z
2022-03-31T06:01:48.000Z
tests/components/wled/test_select.py
Vaarlion/core
f3de8b9f28de01abf72c0f5bb0b457eb1841f201
[ "Apache-2.0" ]
1
2020-03-09T19:15:38.000Z
2020-03-09T19:15:38.000Z
"""Tests for the WLED select platform.""" import json from unittest.mock import MagicMock import pytest from wled import Device as WLEDDevice, WLEDConnectionError, WLEDError from homeassistant.components.select import DOMAIN as SELECT_DOMAIN from homeassistant.components.select.const import ATTR_OPTION, ATTR_OPTIONS from homeassistant.components.wled.const import DOMAIN, SCAN_INTERVAL from homeassistant.const import ( ATTR_ENTITY_ID, ATTR_ICON, SERVICE_SELECT_OPTION, STATE_UNAVAILABLE, STATE_UNKNOWN, ) from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er import homeassistant.util.dt as dt_util from tests.common import MockConfigEntry, async_fire_time_changed, load_fixture @pytest.fixture async def enable_all(hass: HomeAssistant) -> None: """Enable all disabled by default select entities.""" registry = er.async_get(hass) # Pre-create registry entries for disabled by default sensors registry.async_get_or_create( SELECT_DOMAIN, DOMAIN, "aabbccddeeff_palette_0", suggested_object_id="wled_rgb_light_color_palette", disabled_by=None, ) registry.async_get_or_create( SELECT_DOMAIN, DOMAIN, "aabbccddeeff_palette_1", suggested_object_id="wled_rgb_light_segment_1_color_palette", disabled_by=None, ) async def test_color_palette_state( hass: HomeAssistant, enable_all: None, init_integration: MockConfigEntry ) -> None: """Test the creation and values of the WLED selects.""" entity_registry = er.async_get(hass) # First segment of the strip state = hass.states.get("select.wled_rgb_light_segment_1_color_palette") assert state assert state.attributes.get(ATTR_ICON) == "mdi:palette-outline" assert state.attributes.get(ATTR_OPTIONS) == [ "Analogous", "April Night", "Autumn", "Based on Primary", "Based on Set", "Beach", "Beech", "Breeze", "C9", "Cloud", "Cyane", "Default", "Departure", "Drywet", "Fire", "Forest", "Grintage", "Hult", "Hult 64", "Icefire", "Jul", "Landscape", "Lava", "Light Pink", "Magenta", "Magred", "Ocean", "Orange & Teal", "Orangery", "Party", "Pastel", "Primary Color", "Rainbow", "Rainbow Bands", "Random Cycle", "Red & Blue", "Rewhi", "Rivendell", "Sakura", "Set Colors", "Sherbet", "Splash", "Sunset", "Sunset 2", "Tertiary", "Tiamat", "Vintage", "Yelblu", "Yellowout", "Yelmag", ] assert state.state == "Random Cycle" entry = entity_registry.async_get("select.wled_rgb_light_segment_1_color_palette") assert entry assert entry.unique_id == "aabbccddeeff_palette_1" async def test_color_palette_segment_change_state( hass: HomeAssistant, enable_all: None, init_integration: MockConfigEntry, mock_wled: MagicMock, ) -> None: """Test the option change of state of the WLED segments.""" await hass.services.async_call( SELECT_DOMAIN, SERVICE_SELECT_OPTION, { ATTR_ENTITY_ID: "select.wled_rgb_light_segment_1_color_palette", ATTR_OPTION: "Some Other Palette", }, blocking=True, ) await hass.async_block_till_done() assert mock_wled.segment.call_count == 1 mock_wled.segment.assert_called_with( segment_id=1, palette="Some Other Palette", ) @pytest.mark.parametrize("mock_wled", ["wled/rgb_single_segment.json"], indirect=True) async def test_color_palette_dynamically_handle_segments( hass: HomeAssistant, enable_all: None, init_integration: MockConfigEntry, mock_wled: MagicMock, ) -> None: """Test if a new/deleted segment is dynamically added/removed.""" segment0 = hass.states.get("select.wled_rgb_light_color_palette") segment1 = hass.states.get("select.wled_rgb_light_segment_1_color_palette") assert segment0 assert segment0.state == "Default" assert not segment1 return_value = mock_wled.update.return_value mock_wled.update.return_value = WLEDDevice( json.loads(load_fixture("wled/rgb.json")) ) async_fire_time_changed(hass, dt_util.utcnow() + SCAN_INTERVAL) await hass.async_block_till_done() segment0 = hass.states.get("select.wled_rgb_light_color_palette") segment1 = hass.states.get("select.wled_rgb_light_segment_1_color_palette") assert segment0 assert segment0.state == "Default" assert segment1 assert segment1.state == "Random Cycle" # Test adding if segment shows up again, including the master entity mock_wled.update.return_value = return_value async_fire_time_changed(hass, dt_util.utcnow() + SCAN_INTERVAL) await hass.async_block_till_done() segment0 = hass.states.get("select.wled_rgb_light_color_palette") segment1 = hass.states.get("select.wled_rgb_light_segment_1_color_palette") assert segment0 assert segment0.state == "Default" assert segment1 assert segment1.state == STATE_UNAVAILABLE async def test_color_palette_select_error( hass: HomeAssistant, enable_all: None, init_integration: MockConfigEntry, mock_wled: MagicMock, caplog: pytest.LogCaptureFixture, ) -> None: """Test error handling of the WLED selects.""" mock_wled.segment.side_effect = WLEDError await hass.services.async_call( SELECT_DOMAIN, SERVICE_SELECT_OPTION, { ATTR_ENTITY_ID: "select.wled_rgb_light_segment_1_color_palette", ATTR_OPTION: "Whatever", }, blocking=True, ) await hass.async_block_till_done() state = hass.states.get("select.wled_rgb_light_segment_1_color_palette") assert state assert state.state == "Random Cycle" assert "Invalid response from API" in caplog.text assert mock_wled.segment.call_count == 1 mock_wled.segment.assert_called_with(segment_id=1, palette="Whatever") async def test_color_palette_select_connection_error( hass: HomeAssistant, enable_all: None, init_integration: MockConfigEntry, mock_wled: MagicMock, caplog: pytest.LogCaptureFixture, ) -> None: """Test error handling of the WLED selects.""" mock_wled.segment.side_effect = WLEDConnectionError await hass.services.async_call( SELECT_DOMAIN, SERVICE_SELECT_OPTION, { ATTR_ENTITY_ID: "select.wled_rgb_light_segment_1_color_palette", ATTR_OPTION: "Whatever", }, blocking=True, ) await hass.async_block_till_done() state = hass.states.get("select.wled_rgb_light_segment_1_color_palette") assert state assert state.state == STATE_UNAVAILABLE assert "Error communicating with API" in caplog.text assert mock_wled.segment.call_count == 1 mock_wled.segment.assert_called_with(segment_id=1, palette="Whatever") async def test_preset_unavailable_without_presets( hass: HomeAssistant, init_integration: MockConfigEntry, ) -> None: """Test WLED preset entity is unavailable when presets are not available.""" state = hass.states.get("select.wled_rgb_light_preset") assert state assert state.state == STATE_UNAVAILABLE @pytest.mark.parametrize("mock_wled", ["wled/rgbw.json"], indirect=True) async def test_preset_state( hass: HomeAssistant, init_integration: MockConfigEntry, mock_wled: MagicMock, ) -> None: """Test the creation and values of the WLED selects.""" entity_registry = er.async_get(hass) state = hass.states.get("select.wled_rgbw_light_preset") assert state assert state.attributes.get(ATTR_ICON) == "mdi:playlist-play" assert state.attributes.get(ATTR_OPTIONS) == ["Preset 1", "Preset 2"] assert state.state == "Preset 1" entry = entity_registry.async_get("select.wled_rgbw_light_preset") assert entry assert entry.unique_id == "aabbccddee11_preset" await hass.services.async_call( SELECT_DOMAIN, SERVICE_SELECT_OPTION, { ATTR_ENTITY_ID: "select.wled_rgbw_light_preset", ATTR_OPTION: "Preset 2", }, blocking=True, ) await hass.async_block_till_done() assert mock_wled.preset.call_count == 1 mock_wled.preset.assert_called_with(preset="Preset 2") @pytest.mark.parametrize("mock_wled", ["wled/rgbw.json"], indirect=True) async def test_old_style_preset_active( hass: HomeAssistant, init_integration: MockConfigEntry, mock_wled: MagicMock, caplog: pytest.LogCaptureFixture, ) -> None: """Test unknown preset returned (when old style/unknown) preset is active.""" # Set device preset state to a random number mock_wled.update.return_value.state.preset = 99 async_fire_time_changed(hass, dt_util.utcnow() + SCAN_INTERVAL) await hass.async_block_till_done() state = hass.states.get("select.wled_rgbw_light_preset") assert state assert state.state == STATE_UNKNOWN @pytest.mark.parametrize("mock_wled", ["wled/rgbw.json"], indirect=True) async def test_preset_select_error( hass: HomeAssistant, init_integration: MockConfigEntry, mock_wled: MagicMock, caplog: pytest.LogCaptureFixture, ) -> None: """Test error handling of the WLED selects.""" mock_wled.preset.side_effect = WLEDError await hass.services.async_call( SELECT_DOMAIN, SERVICE_SELECT_OPTION, { ATTR_ENTITY_ID: "select.wled_rgbw_light_preset", ATTR_OPTION: "Preset 2", }, blocking=True, ) await hass.async_block_till_done() state = hass.states.get("select.wled_rgbw_light_preset") assert state assert state.state == "Preset 1" assert "Invalid response from API" in caplog.text assert mock_wled.preset.call_count == 1 mock_wled.preset.assert_called_with(preset="Preset 2") @pytest.mark.parametrize("mock_wled", ["wled/rgbw.json"], indirect=True) async def test_preset_select_connection_error( hass: HomeAssistant, init_integration: MockConfigEntry, mock_wled: MagicMock, caplog: pytest.LogCaptureFixture, ) -> None: """Test error handling of the WLED selects.""" mock_wled.preset.side_effect = WLEDConnectionError await hass.services.async_call( SELECT_DOMAIN, SERVICE_SELECT_OPTION, { ATTR_ENTITY_ID: "select.wled_rgbw_light_preset", ATTR_OPTION: "Preset 2", }, blocking=True, ) await hass.async_block_till_done() state = hass.states.get("select.wled_rgbw_light_preset") assert state assert state.state == STATE_UNAVAILABLE assert "Error communicating with API" in caplog.text assert mock_wled.preset.call_count == 1 mock_wled.preset.assert_called_with(preset="Preset 2") async def test_playlist_unavailable_without_playlists( hass: HomeAssistant, init_integration: MockConfigEntry, ) -> None: """Test WLED playlist entity is unavailable when playlists are not available.""" state = hass.states.get("select.wled_rgb_light_playlist") assert state assert state.state == STATE_UNAVAILABLE @pytest.mark.parametrize("mock_wled", ["wled/rgbw.json"], indirect=True) async def test_playlist_state( hass: HomeAssistant, init_integration: MockConfigEntry, mock_wled: MagicMock, ) -> None: """Test the creation and values of the WLED selects.""" entity_registry = er.async_get(hass) state = hass.states.get("select.wled_rgbw_light_playlist") assert state assert state.attributes.get(ATTR_ICON) == "mdi:play-speed" assert state.attributes.get(ATTR_OPTIONS) == ["Playlist 1", "Playlist 2"] assert state.state == "Playlist 1" entry = entity_registry.async_get("select.wled_rgbw_light_playlist") assert entry assert entry.unique_id == "aabbccddee11_playlist" await hass.services.async_call( SELECT_DOMAIN, SERVICE_SELECT_OPTION, { ATTR_ENTITY_ID: "select.wled_rgbw_light_playlist", ATTR_OPTION: "Playlist 2", }, blocking=True, ) await hass.async_block_till_done() assert mock_wled.playlist.call_count == 1 mock_wled.playlist.assert_called_with(playlist="Playlist 2") @pytest.mark.parametrize("mock_wled", ["wled/rgbw.json"], indirect=True) async def test_old_style_playlist_active( hass: HomeAssistant, init_integration: MockConfigEntry, mock_wled: MagicMock, caplog: pytest.LogCaptureFixture, ) -> None: """Test when old style playlist cycle is active.""" # Set device playlist to 0, which meant "cycle" previously. mock_wled.update.return_value.state.playlist = 0 async_fire_time_changed(hass, dt_util.utcnow() + SCAN_INTERVAL) await hass.async_block_till_done() state = hass.states.get("select.wled_rgbw_light_playlist") assert state assert state.state == STATE_UNKNOWN @pytest.mark.parametrize("mock_wled", ["wled/rgbw.json"], indirect=True) async def test_playlist_select_error( hass: HomeAssistant, init_integration: MockConfigEntry, mock_wled: MagicMock, caplog: pytest.LogCaptureFixture, ) -> None: """Test error handling of the WLED selects.""" mock_wled.playlist.side_effect = WLEDError await hass.services.async_call( SELECT_DOMAIN, SERVICE_SELECT_OPTION, { ATTR_ENTITY_ID: "select.wled_rgbw_light_playlist", ATTR_OPTION: "Playlist 2", }, blocking=True, ) await hass.async_block_till_done() state = hass.states.get("select.wled_rgbw_light_playlist") assert state assert state.state == "Playlist 1" assert "Invalid response from API" in caplog.text assert mock_wled.playlist.call_count == 1 mock_wled.playlist.assert_called_with(playlist="Playlist 2") @pytest.mark.parametrize("mock_wled", ["wled/rgbw.json"], indirect=True) async def test_playlist_select_connection_error( hass: HomeAssistant, init_integration: MockConfigEntry, mock_wled: MagicMock, caplog: pytest.LogCaptureFixture, ) -> None: """Test error handling of the WLED selects.""" mock_wled.playlist.side_effect = WLEDConnectionError await hass.services.async_call( SELECT_DOMAIN, SERVICE_SELECT_OPTION, { ATTR_ENTITY_ID: "select.wled_rgbw_light_playlist", ATTR_OPTION: "Playlist 2", }, blocking=True, ) await hass.async_block_till_done() state = hass.states.get("select.wled_rgbw_light_playlist") assert state assert state.state == STATE_UNAVAILABLE assert "Error communicating with API" in caplog.text assert mock_wled.playlist.call_count == 1 mock_wled.playlist.assert_called_with(playlist="Playlist 2") @pytest.mark.parametrize( "entity_id", ( "select.wled_rgb_light_color_palette", "select.wled_rgb_light_segment_1_color_palette", ), ) async def test_disabled_by_default_selects( hass: HomeAssistant, init_integration: MockConfigEntry, entity_id: str ) -> None: """Test the disabled by default WLED selects.""" registry = er.async_get(hass) state = hass.states.get(entity_id) assert state is None entry = registry.async_get(entity_id) assert entry assert entry.disabled assert entry.disabled_by == er.DISABLED_INTEGRATION
31.241517
86
0.69416
1,902
15,652
5.437434
0.116719
0.038677
0.027654
0.034906
0.796558
0.767356
0.73042
0.709631
0.694547
0.675305
0
0.006145
0.209877
15,652
500
87
31.304
0.830112
0.018592
0
0.584767
0
0
0.171655
0.094021
0
0
0
0
0.189189
1
0
false
0
0.029484
0
0.029484
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
dbcb68eae6de632384caacb5b45f84d3fd71a8c3
194
py
Python
BlogExercise/Blog/models.py
joacocruz6/djangoExerciseApp
05836ffa18c0376853f36b8c73f861cf60027c33
[ "MIT" ]
null
null
null
BlogExercise/Blog/models.py
joacocruz6/djangoExerciseApp
05836ffa18c0376853f36b8c73f861cf60027c33
[ "MIT" ]
null
null
null
BlogExercise/Blog/models.py
joacocruz6/djangoExerciseApp
05836ffa18c0376853f36b8c73f861cf60027c33
[ "MIT" ]
null
null
null
from django.db import models # Create your models here. class Article(models.Model): title = models.CharField(max_length=600) summary = models.TextField() body = models.TextField()
24.25
44
0.726804
25
194
5.6
0.76
0.214286
0
0
0
0
0
0
0
0
0
0.018634
0.170103
194
7
45
27.714286
0.850932
0.123711
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.2
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
dbd293c74b1de2fd554e606094ee80397aae3a66
103
py
Python
app/postoffices/admin.py
swelanauguste/refactored-sniffle
1c0ea2f4d07a74d694ae3409b8b2ea3d57b9db4f
[ "MIT" ]
null
null
null
app/postoffices/admin.py
swelanauguste/refactored-sniffle
1c0ea2f4d07a74d694ae3409b8b2ea3d57b9db4f
[ "MIT" ]
null
null
null
app/postoffices/admin.py
swelanauguste/refactored-sniffle
1c0ea2f4d07a74d694ae3409b8b2ea3d57b9db4f
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import PostalAddress admin.site.register(PostalAddress)
20.6
34
0.84466
13
103
6.692308
0.692308
0
0
0
0
0
0
0
0
0
0
0
0.097087
103
5
34
20.6
0.935484
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
dbd79374dbcfd4330525a4211eccbb6e43959e8c
99
py
Python
ja/code_snippets/results/result.api-monitor-cancel-downtime-by-scope.py
quotecenter/documentation-1
f365703264761aa2b19d5d1d8ec55a3a6082ef4d
[ "BSD-3-Clause" ]
null
null
null
ja/code_snippets/results/result.api-monitor-cancel-downtime-by-scope.py
quotecenter/documentation-1
f365703264761aa2b19d5d1d8ec55a3a6082ef4d
[ "BSD-3-Clause" ]
null
null
null
ja/code_snippets/results/result.api-monitor-cancel-downtime-by-scope.py
quotecenter/documentation-1
f365703264761aa2b19d5d1d8ec55a3a6082ef4d
[ "BSD-3-Clause" ]
null
null
null
# This is not yet supported by the Python Client for Datadog API # Please consult the curl example
49.5
64
0.787879
17
99
4.588235
0.941176
0
0
0
0
0
0
0
0
0
0
0
0.191919
99
2
65
49.5
0.975
0.949495
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
916ca5e6be972f211f85ed1830a2297f64be2bf7
128
py
Python
ui/__init__.py
ctwardy/sitehound
0f928a82f761e3d0335d1d4d01f6105b726fd889
[ "Apache-2.0" ]
13
2017-12-05T20:06:33.000Z
2021-11-03T22:27:15.000Z
ui/__init__.py
ctwardy/sitehound
0f928a82f761e3d0335d1d4d01f6105b726fd889
[ "Apache-2.0" ]
2
2020-03-24T15:33:28.000Z
2020-03-30T20:08:03.000Z
ui/__init__.py
ctwardy/sitehound
0f928a82f761e3d0335d1d4d01f6105b726fd889
[ "Apache-2.0" ]
8
2018-03-01T05:01:05.000Z
2020-08-25T15:31:16.000Z
import os from flask import Flask from ui.singleton import Singleton app = Flask(__name__) app.config.from_object('settings')
16
34
0.796875
19
128
5.105263
0.578947
0
0
0
0
0
0
0
0
0
0
0
0.125
128
7
35
18.285714
0.866071
0
0
0
0
0
0.0625
0
0
0
0
0
0
1
0
false
0
0.6
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
1
0
1
0
0
4
918636f4a4c95db68ae126fc4a7716aee1e8d9bb
92
py
Python
test_rsync.py
rguillon/rlog
097cdae4aec42f55dc08bb173dbeb98bf232f1d8
[ "MIT" ]
null
null
null
test_rsync.py
rguillon/rlog
097cdae4aec42f55dc08bb173dbeb98bf232f1d8
[ "MIT" ]
null
null
null
test_rsync.py
rguillon/rlog
097cdae4aec42f55dc08bb173dbeb98bf232f1d8
[ "MIT" ]
null
null
null
import auto_rsync sync = auto_rsync.main(".", "renaud@server1:/var/log/syslog", "10", " ")
23
72
0.663043
13
92
4.538462
0.846154
0.305085
0
0
0
0
0
0
0
0
0
0.036585
0.108696
92
3
73
30.666667
0.682927
0
0
0
0
0
0.369565
0.326087
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
91975b796828ad3f1af2a1ed6efa51e31fa3cf5f
96
py
Python
social/backends/linkedin.py
raccoongang/python-social-auth
81c0a542d158772bd3486d31834c10af5d5f08b0
[ "BSD-3-Clause" ]
1,987
2015-01-01T16:12:45.000Z
2022-03-29T14:24:25.000Z
social/backends/linkedin.py
raccoongang/python-social-auth
81c0a542d158772bd3486d31834c10af5d5f08b0
[ "BSD-3-Clause" ]
731
2015-01-01T22:55:25.000Z
2022-03-10T15:07:51.000Z
virtual/lib/python3.6/site-packages/social/backends/linkedin.py
dennismwaniki67/awards
80ed10541f5f751aee5f8285ab1ad54cfecba95f
[ "MIT" ]
1,082
2015-01-01T16:27:26.000Z
2022-03-22T21:18:33.000Z
from social_core.backends.linkedin import BaseLinkedinAuth, LinkedinOAuth, \ LinkedinOAuth2
32
76
0.833333
9
96
8.777778
1
0
0
0
0
0
0
0
0
0
0
0.011765
0.114583
96
2
77
48
0.917647
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
919b1aa78239b07199bc65be85d2de269ed1c921
218
py
Python
files/exercises/libraries-error-messages.py
mforneris/introduction_to_python_course
8075973ee89a921a5e2693f649adbf1fc0e0b2cb
[ "CC-BY-4.0" ]
null
null
null
files/exercises/libraries-error-messages.py
mforneris/introduction_to_python_course
8075973ee89a921a5e2693f649adbf1fc0e0b2cb
[ "CC-BY-4.0" ]
null
null
null
files/exercises/libraries-error-messages.py
mforneris/introduction_to_python_course
8075973ee89a921a5e2693f649adbf1fc0e0b2cb
[ "CC-BY-4.0" ]
1
2020-01-09T10:58:56.000Z
2020-01-09T10:58:56.000Z
# Reading Error Messages # 1. Read the code below and try to identify what the errors are without running it. # 2. Run the code, and read the error message. # What type of error is it? from math import log log(0)
27.25
84
0.724771
40
218
3.95
0.725
0.088608
0
0
0
0
0
0
0
0
0
0.017647
0.220183
218
8
85
27.25
0.911765
0.825688
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
91a29bb86d347fc55f83ab20ca7e93c30539dd65
34
py
Python
virtualenv/lib/python3.7/struct.py
mvolpe11/watson-box-skills-lab-docs
0cecde651b8a1f4763570b7012ac7d3e50453c34
[ "Apache-2.0" ]
2
2022-01-21T12:51:19.000Z
2022-01-21T12:51:30.000Z
virtualenv/lib/python3.7/struct.py
mvolpe11/watson-box-skills-lab-docs
0cecde651b8a1f4763570b7012ac7d3e50453c34
[ "Apache-2.0" ]
6
2021-03-18T23:29:22.000Z
2021-09-22T18:31:46.000Z
virtualenv/lib/python3.7/struct.py
mvolpe11/watson-box-skills-lab-docs
0cecde651b8a1f4763570b7012ac7d3e50453c34
[ "Apache-2.0" ]
1
2019-12-30T08:22:13.000Z
2019-12-30T08:22:13.000Z
/usr/local/lib/python3.7/struct.py
34
34
0.794118
7
34
3.857143
1
0
0
0
0
0
0
0
0
0
0
0.058824
0
34
1
34
34
0.735294
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
91e982ade0282e71cf4592472c642a659ceb9070
63
py
Python
python/testData/resolve/HasattrResolveConditionalExpression.py
Sajaki/intellij-community
6748af2c40567839d11fd652ec77ba263c074aad
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/resolve/HasattrResolveConditionalExpression.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
2
2022-02-19T09:45:05.000Z
2022-02-27T20:32:55.000Z
python/testData/resolve/HasattrResolveConditionalExpression.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
def foo(x): return x.f<ref>ld if hasattr(x, "fld") else 42
21
50
0.619048
14
63
2.785714
0.857143
0
0
0
0
0
0
0
0
0
0
0.04
0.206349
63
2
51
31.5
0.74
0
0
0
0
0
0.047619
0
0
0
0
0
0
1
0.5
false
0
0
0.5
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
91eb44810db419f032391871573dcc1010eeb50a
749
py
Python
tests/res/apps/feeds_app/feeds.py
appsumo/Coffin-custom
172a8efa4f3deeac1d0c7adbd0f114dbb73bbd8a
[ "BSD-3-Clause" ]
null
null
null
tests/res/apps/feeds_app/feeds.py
appsumo/Coffin-custom
172a8efa4f3deeac1d0c7adbd0f114dbb73bbd8a
[ "BSD-3-Clause" ]
null
null
null
tests/res/apps/feeds_app/feeds.py
appsumo/Coffin-custom
172a8efa4f3deeac1d0c7adbd0f114dbb73bbd8a
[ "BSD-3-Clause" ]
null
null
null
from coffin.contrib.syndication.feeds import Feed as OldFeed class TestOldFeed(OldFeed): title = 'Foo' link = '/' def items(self): return [1,2,3] def item_link(self, item): return '/item' title_template = 'feeds_app/feed_title.html' description_template = 'feeds_app/feed_description.html' try: from coffin.contrib.syndication.views import Feed as NewFeed except ImportError: pass else: class TestNewFeed(NewFeed): title = 'Foo' link = '/' def items(self): return [1,2,3] def item_link(self, item): return '/item' title_template = 'feeds_app/feed_title.html' description_template = 'feeds_app/feed_description.html'
22.029412
64
0.635514
91
749
5.076923
0.373626
0.112554
0.138528
0.17316
0.614719
0.614719
0.614719
0.614719
0.614719
0.614719
0
0.01085
0.261682
749
34
65
22.029412
0.824593
0
0
0.666667
0
0
0.173333
0.149333
0
0
0
0
0
1
0.166667
false
0.041667
0.125
0.166667
0.875
0
0
0
0
null
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
4
37cdfbfa4a1cf6507c5d0eaa7e03f1d20e789ee5
1,118
py
Python
Bio/SearchIO/_index.py
rht/biopython
3a44496d7bd79446266a4951b7d1f64569e4a96d
[ "BSD-3-Clause" ]
3
2016-11-21T09:55:56.000Z
2019-04-09T17:39:43.000Z
Bio/SearchIO/_index.py
rht/biopython
3a44496d7bd79446266a4951b7d1f64569e4a96d
[ "BSD-3-Clause" ]
32
2016-11-21T07:38:21.000Z
2017-08-16T13:00:03.000Z
Bio/SearchIO/_index.py
rht/biopython
3a44496d7bd79446266a4951b7d1f64569e4a96d
[ "BSD-3-Clause" ]
8
2016-11-24T18:57:35.000Z
2022-01-16T08:15:25.000Z
# Copyright 2012 by Wibowo Arindrarto. All rights reserved. # Revisions copyright 2012-2016 by Peter Cock. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Custom indexing for Bio.SearchIO objects.""" from Bio._py3k import StringIO from Bio._py3k import _bytes_to_string from Bio import bgzf from Bio.File import _IndexedSeqFileProxy, _open_for_random_access class SearchIndexer(_IndexedSeqFileProxy): """Base class for file format specific random access. Subclasses for each file format should define '_parser' and optionally 'get_raw' methods. """ def __init__(self, filename, **kwargs): self._handle = _open_for_random_access(filename) self._kwargs = kwargs def _parse(self, handle): return next(iter(self._parser(handle, **self._kwargs))) def get(self, offset): return self._parse(StringIO(_bytes_to_string(self.get_raw(offset))))
33.878788
76
0.744186
154
1,118
5.201299
0.525974
0.034956
0.042447
0.042447
0
0
0
0
0
0
0
0.016304
0.177102
1,118
32
77
34.9375
0.854348
0.481216
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.333333
0.166667
0.833333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
1
1
0
0
4
37d50d40e0cb06e64724a35873908a5d029446e2
14,026
py
Python
stratus-plot/workload/zipfian.py
gitferry/bamboo-stratus
e066dbdfe690478dd8fa94105eea7b4a1c9f4d58
[ "MIT" ]
1
2022-03-27T18:12:38.000Z
2022-03-27T18:12:38.000Z
stratus-plot/workload/zipfian.py
gitferry/bamboo-stratus
e066dbdfe690478dd8fa94105eea7b4a1c9f4d58
[ "MIT" ]
null
null
null
stratus-plot/workload/zipfian.py
gitferry/bamboo-stratus
e066dbdfe690478dd8fa94105eea7b4a1c9f4d58
[ "MIT" ]
null
null
null
from cProfile import label import matplotlib.pyplot as plt import numpy as np SMALL_SIZE = 14 MEDIUM_SIZE = 20 BIGGER_SIZE = 20 plt.rc('font', size=20) # controls default text sizes plt.rc('axes', titlesize=20) # fontsize of the axes title plt.rc('axes', labelsize=MEDIUM_SIZE) # fontsize of the x and y labels plt.rc('xtick', labelsize=BIGGER_SIZE) # fontsize of the tick labels plt.rc('ytick', labelsize=BIGGER_SIZE) # fontsize of the tick labels plt.rc('legend', fontsize=SMALL_SIZE) # legend fontsize # s=1.01, v=10 data1_100 = [41201,37531,34123,31485,29420,27773,25527,24119,23052,21844,20654,19530,18682,17832,17189,16665,15528,15035,14653,14189,13684,13491,12778,12316,11927,11824,11241,11071,10731,10533,10131,9960,9720,9643,9453,8991,8955,8740,8479,8312,8101,7963,7754,7832,7712,7473,7173,7227,6915,6861,6801,6770,6479,6421,6475,6306,6121,6117,5862,5886,5756,5709,5558,5632,5460,5361,5314,5178,5217,5131,5099,5164,5009,4829,4834,4853,4626,4658,4453,4600,4439,4451,4419,4271,4268,4317,4268,4235,4070,4085,4126,3984,3989,3750,3828,3839,3799,3812,3733] # s=1.01, v=1 data2_100 = [196116,97756,64886,48887,38326,32322,27867,23880,21445,19176,17581,15947,14693,14056,12789,12041,11196,10598,10065,9431,9208,8895,8334,7881,7652,7207,7098,6861,6582,6164,6185,6068,5775,5609,5448,5167,5119,4965,4926,4607,4602,4584,4385,4272,4250,4037,3952,3941,3891,3759,3699,3736,3695,3484,3408,3366,3332,3369,3180,3079,3077,3007,2892,2980,2923,2824,2822,2752,2746,2641,2619,2591,2562,2595,2557,2507,2480,2432,2341,2368,2282,2317,2341,2252,2191,2189,2137,2054,2048,2029,2053,2081,1939,2026,1995,2001,1927,1904,1813] # s=1.01, v=10 data1_200 = [32625,29575,27383,24997,23062,21578,20658,19369,18039,16988,16223,15790,14889,14190,13560,13090,12497,11977,11633,11192,10883,10529,10342,9768,9384,9260,8819,8760,8605,8396,8014,7908,7921,7650,7154,7252,7065,6789,6669,6759,6354,6364,6141,6049,6068,5885,5769,5654,5604,5377,5375,5341,5128,5136,5093,5144,4984,4769,4662,4788,4633,4592,4431,4374,4382,4299,4187,4105,4160,4064,3989,3972,3851,3974,3868,3911,3783,3730,3675,3573,3503,3540,3594,3357,3409,3335,3297,3396,3264,3309,3213,3201,3131,3007,3052,3131,3048,3060,3021,2883,2980,2861,2861,2829,2818,2693,2689,2812,2686,2682,2730,2571,2602,2598,2533,2563,2577,2548,2484,2452,2422,2487,2346,2380,2380,2359,2363,2326,2327,2286,2311,2262,2301,2289,2310,2200,2210,2112,2157,2141,2096,2229,2154,2056,2051,2008,2027,2066,1934,1960,1970,2006,2004,1958,1877,1950,1935,1932,1887,1838,1898,1783,1816,1882,1833,1809,1869,1784,1833,1833,1810,1676,1766,1758,1717,1727,1707,1709,1765,1676,1662,1658,1701,1565,1581,1590,1572,1628,1572,1647,1506,1584,1620,1595,1557,1555,1537,1557,1432] # s=1.01, v=1 data2_200 = [173292,86762,57688,42833,34603,28359,24246,21453,19078,17143,15391,14206,12954,12034,11410,10620,9985,9353,8874,8440,8337,7779,7264,7156,6789,6440,6245,6111,5624,5675,5439,5231,5015,5068,4859,4786,4618,4422,4191,4201,4208,3878,3902,3773,3746,3661,3635,3518,3454,3320,3168,3192,3237,3127,3104,3018,2932,2957,2780,2786,2758,2681,2557,2529,2660,2509,2478,2453,2486,2297,2320,2294,2260,2272,2294,2143,2198,2123,2100,2031,2141,1985,1980,1879,1986,1943,1920,1871,1876,1877,1815,1819,1801,1773,1808,1773,1786,1706,1662,1717,1643,1584,1626,1563,1562,1628,1632,1569,1501,1518,1479,1417,1481,1459,1435,1387,1359,1386,1353,1427,1409,1352,1365,1365,1241,1343,1302,1296,1249,1317,1286,1209,1224,1237,1232,1145,1183,1211,1221,1150,1198,1168,1214,1163,1142,1153,1148,1151,1107,1165,1050,1064,1080,1064,1074,1071,1011,1090,1037,1003,1039,1118,1011,1019,978,995,989,977,1023,972,891,914,945,900,953,903,900,921,955,874,918,924,872,873,867,900,919,902,884,853,904,856,871,820,830,867,785,789,850] # s=1.01, v=10 data1_300 = [29010,26354,24342,22126,20716,19217,17944,17174,16411,15151,14450,13790,13055,12825,12036,11753,11126,10730,10424,9945,9628,9257,9034,8771,8491,8283,8008,7975,7662,7331,7029,6991,6856,6543,6543,6433,6308,6101,5999,5903,5736,5812,5691,5273,5397,5163,5156,4950,4877,4848,4899,4753,4500,4543,4523,4340,4326,4334,4127,4248,4118,4026,3968,3956,3819,3842,3726,3725,3635,3554,3674,3537,3605,3564,3534,3326,3284,3265,3228,3324,3216,3144,3128,3053,3011,3057,2924,2924,3018,2802,2773,2857,2786,2735,2814,2644,2735,2578,2666,2668,2647,2547,2677,2545,2529,2544,2449,2441,2374,2330,2444,2298,2411,2335,2237,2236,2258,2216,2153,2238,2274,2154,2168,2204,2114,2108,2159,2032,2023,1967,1981,2042,2099,1929,2057,2000,1992,1943,1908,1928,1939,1809,1871,1873,1906,1812,1798,1736,1719,1755,1848,1779,1730,1729,1720,1744,1761,1636,1644,1690,1663,1614,1633,1658,1685,1561,1663,1616,1581,1568,1541,1551,1635,1542,1468,1543,1454,1498,1505,1522,1508,1461,1491,1477,1460,1440,1455,1455,1395,1447,1473,1450,1453,1465,1378,1345,1430,1359,1312,1378,1327,1334,1294,1380,1358,1381,1341,1272,1301,1265,1270,1236,1277,1279,1266,1211,1199,1218,1200,1255,1252,1253,1220,1231,1217,1114,1233,1191,1206,1113,1236,1200,1112,1157,1118,1191,1106,1090,1142,1139,1136,1124,1126,1121,1162,1129,1107,1110,1109,1096,1107,1136,1057,1038,1062,1064,1078,1075,979,1084,1044,1039,1043,1094,1055,1028,1018,1006,1001,1019,1043,999,933,949,970,961,970,969,934,991,951,941,1038,925,906,950,969,983,944,974,914,982,925,941,907,931,916,828,937] # s=1.01, v=1 data2_300 = [162332,81183,54223,40283,32148,27026,22702,19844,17816,15987,14653,13254,12358,11239,10718,9876,9269,8851,8380,7877,7597,7138,6883,6615,6316,6101,6077,5774,5368,5197,5237,4969,4801,4598,4487,4383,4294,4069,4021,3926,3890,3769,3542,3578,3583,3414,3480,3330,3257,3155,3072,2948,2990,2880,2934,2774,2690,2684,2629,2584,2601,2565,2480,2544,2365,2412,2341,2286,2165,2197,2202,2245,2116,2185,2113,2114,2043,1991,1993,2012,1855,1934,1853,1911,1820,1795,1744,1661,1756,1816,1738,1663,1660,1655,1657,1674,1549,1574,1535,1568,1509,1528,1503,1508,1565,1388,1491,1452,1437,1398,1384,1339,1412,1406,1362,1273,1344,1261,1286,1305,1255,1296,1288,1259,1213,1254,1211,1235,1187,1197,1216,1172,1180,1156,1202,1177,1157,1176,1172,1096,1104,1079,1116,1073,1027,1066,1069,1042,1010,1034,1028,1053,1056,1067,1000,1039,946,995,935,986,938,917,987,902,966,923,912,898,859,873,909,880,906,930,880,912,876,861,885,893,768,828,889,821,850,849,806,814,833,874,784,769,784,776,788,820,775,739,731,753,787,772,794,736,751,785,716,754,787,752,741,735,694,770,727,736,710,735,706,748,682,677,656,689,695,680,677,707,676,665,608,688,702,649,663,627,658,647,716,692,613,647,633,629,616,616,638,598,641,643,626,605,575,571,586,567,593,584,586,586,568,587,537,581,597,611,529,572,566,619,569,543,520,550,544,558,558,587,579,568,540,531,571,525,547,587,517,532,539,521,517,528,542,538,471,476,509,517,521] # s=1.01, v=10 data1_400 = [26846,24504,22499,20662,19104,17773,16737,15670,15153,14305,13337,12825,12101,11553,11274,10956,10235,10077,9555,9272,8901,8718,8363,8121,7768,7637,7367,7380,6961,6932,6692,6659,6438,6237,5930,5803,5835,5533,5488,5428,5335,5283,5094,5101,4934,4808,4762,4694,4774,4526,4504,4264,4354,4182,4125,4105,3965,3911,3884,3893,3890,3743,3576,3691,3612,3484,3417,3430,3490,3329,3267,3321,3267,3167,3175,3095,3129,2990,3016,2969,2905,2931,2906,2815,2768,2865,2702,2827,2817,2768,2747,2604,2607,2485,2526,2456,2607,2504,2492,2456,2413,2350,2336,2345,2312,2274,2289,2262,2312,2169,2213,2068,2197,2120,2161,2082,2166,2005,2126,1970,1986,1999,2065,2026,2008,1923,1999,2036,1894,1968,1927,1850,1863,1866,1785,1789,1747,1871,1746,1768,1823,1760,1698,1648,1723,1675,1695,1642,1634,1674,1689,1666,1584,1628,1671,1634,1551,1575,1630,1525,1539,1511,1433,1526,1445,1542,1571,1486,1470,1516,1508,1473,1485,1447,1410,1377,1453,1445,1390,1354,1373,1414,1358,1395,1346,1324,1314,1282,1268,1298,1354,1328,1304,1278,1267,1265,1278,1281,1319,1248,1200,1215,1246,1214,1200,1199,1185,1233,1215,1183,1277,1139,1173,1244,1132,1180,1167,1121,1118,1131,1208,1132,1138,1079,1045,1150,1080,1081,1120,1056,1112,1086,1093,1068,1072,1094,1081,1057,1059,1013,1070,1065,1010,1060,1035,1060,1066,1047,1045,1033,1038,1000,1005,982,1030,979,948,972,997,958,968,951,934,957,1007,988,1007,940,971,919,936,886,933,898,896,931,893,926,890,895,891,849,856,902,852,878,927,887,900,859,884,883,871,852,801,864,876,846,882,814,810,889,821,854,793,813,824,799,870,802,779,750,795,829,810,839,762,827,792,790,825,804,807,788,754,816,793,788,775,777,852,748,719,704,800,745,748,753,758,788,723,696,763,726,755,712,758,715,817,739,698,747,714,696,713,727,693,730,750,689,657,672,684,672,676,681,683,641,686,672,686,726,635,677,687,711,646,620,679,654,677,684,685,684,664,676,622,680,697,628,669,628,637,653,665,589,591,636,649] # s=1.01, v=1 data2_400 = [155462,77775,51874,38682,30736,25663,22113,18981,16828,15347,13963,12695,12028,10782,10111,9507,8901,8584,7870,7520,7272,6798,6677,6350,6100,5738,5644,5382,5177,5073,4880,4925,4707,4454,4265,4118,4230,3973,3926,3746,3657,3607,3452,3475,3325,3230,3170,3151,3019,3060,2945,2847,2772,2850,2810,2692,2669,2703,2571,2552,2465,2430,2356,2285,2271,2343,2224,2268,2133,2084,2128,2040,2019,1981,2041,2018,1934,1928,1904,1943,1825,1833,1878,1733,1744,1634,1711,1626,1728,1733,1610,1654,1706,1581,1593,1595,1546,1475,1550,1526,1475,1431,1456,1441,1428,1423,1381,1367,1324,1303,1262,1342,1380,1349,1300,1246,1281,1240,1252,1242,1276,1208,1174,1201,1170,1177,1148,1125,1137,1146,1175,1116,1184,1110,1062,1111,1122,1054,1069,1060,1044,1009,1014,1061,1078,995,1052,924,954,1007,962,949,956,987,961,950,952,949,913,917,958,923,901,908,914,866,900,901,870,865,885,884,875,886,868,868,865,865,859,814,819,801,827,837,791,811,731,796,803,773,768,751,774,740,766,791,788,780,773,765,755,736,704,709,730,689,746,677,681,689,722,681,703,701,666,691,668,667,623,634,670,675,623,658,691,663,656,678,646,644,642,642,645,643,615,578,594,653,644,589,618,660,570,584,581,675,577,641,562,574,575,580,579,558,565,626,550,581,520,525,563,552,567,577,560,589,525,532,585,546,528,556,560,559,542,560,521,558,508,501,569,533,536,515,532,546,511,539,540,514,451,509,459,517,486,516,494,486,497,495,499,515,465,449,484,483,519,452,491,494,448,479,470,459,513,526,461,461,434,504,453,449,441,467,428,481,436,417,478,446,473,451,444,425,408,411,431,416,413,428,401,431,426,417,408,411,428,403,399,417,427,435,437,380,394,422,421,426,429,390,398,384,374,409,386,407,409,389,411,415,409,425,371,395,398,421,383,368,389,424,404,369,365,402,393,360,357,394,380,389,388,362,343,338,344,370,384,372,375] def do_plot(): f, ax = plt.subplots(1,4, figsize=(14,4),sharey=True, frameon=False, constrained_layout=True) replicaNo1 = range(1,100) replicaNo2 = range(1,200) replicaNo3 = range(1,300) replicaNo4 = range(1,400) x1_100 = np.array(data1_100) x1_100 = x1_100/(x1_100.sum() * 1.0) x2_100 = np.array(data2_100) x2_100 = x2_100/(x2_100.sum() * 1.0) x1_200 = np.array(data1_200) x1_200 = x1_200/(x1_200.sum() * 1.0) x2_200 = np.array(data2_200) x2_200 = x2_200/(x2_200.sum() * 1.0) x1_300 = np.array(data1_300) x1_300 = x1_300/(x1_300.sum() * 1.0) x2_300 = np.array(data2_300) x2_300 = x2_300/(x2_300.sum() * 1.0) x1_400 = np.array(data1_400) x1_400 = x1_400/(x1_400.sum() * 1.0) x2_400 = np.array(data2_400) x2_400 = x2_400/(x2_400.sum() * 1.0) ax[0].plot(replicaNo1, x2_100/(x2_100.sum() * 1.0), color = 'indianred', label='Zipf') ax[0].plot(replicaNo1, x1_100/(x1_100.sum() * 1.0), linestyle = 'dashed', label='Zipf') ax[1].plot(replicaNo2, x2_200/(x2_200.sum() * 1.0), color = 'indianred') ax[1].plot(replicaNo2, x1_200/(x1_200.sum() * 1.0), linestyle = 'dashed') ax[2].plot(replicaNo3, x2_300/(x2_300.sum() * 1.0), color = 'indianred') ax[2].plot(replicaNo3, x1_300/(x1_300.sum() * 1.0), linestyle = 'dashed') ax[3].plot(replicaNo4, x2_400/(x2_400.sum() * 1.0), color = 'indianred', label='Zipf1') ax[3].plot(replicaNo4, x1_400/(x1_400.sum() * 1.0), linestyle = 'dashed', label='Zipf10') ax[0].set_title("(a) 100 replicas") ax[1].set_title("(b) 200 replicas") ax[2].set_title("(c) 300 replicas") ax[3].set_title("(d) 400 replicas") ax[0].annotate(str(round(x1_100[0],3)), xy=(1, x1_100[0]), xytext=(30, 0.04), arrowprops=dict(facecolor='black', arrowstyle='->')) ax[0].annotate(str(round(x2_100[0],3)), xy=(1, x2_100[0]), xytext=(30, 0.15), arrowprops=dict(facecolor='black', arrowstyle='->')) ax[1].annotate(str(round(x1_200[0],3)), xy=(1, x1_200[0]), xytext=(60, 0.04), arrowprops=dict(facecolor='black', arrowstyle='->')) ax[1].annotate(str(round(x2_200[0],3)), xy=(1, x2_200[0]), xytext=(60, 0.15), arrowprops=dict(facecolor='black', arrowstyle='->')) ax[2].annotate(str(round(x1_300[0],3)), xy=(1, x1_300[0]), xytext=(90, 0.04), arrowprops=dict(facecolor='black', arrowstyle='->')) ax[2].annotate(str(round(x2_300[0],3)), xy=(1, x2_300[0]), xytext=(90, 0.15), arrowprops=dict(facecolor='black', arrowstyle='->')) ax[3].annotate(str(round(x1_400[0],3)), xy=(1, x1_400[0]), xytext=(120, 0.04), arrowprops=dict(facecolor='black', arrowstyle='->')) ax[3].annotate(str(round(x2_400[0],3)), xy=(1, x2_400[0]), xytext=(120, 0.14), arrowprops=dict(facecolor='black', arrowstyle='->')) # ax[0][0].set_ylabel("Workload distribution") ax[0].set_ylim([0,0.24]) ax[2].set_xticks([0, 150, 300]) # ax[0].set_xlim([-5,100]) # ax[1].set_xlim([-5,200]) # ax[2].set_xlim([-5,300]) # ax[3].set_xlim([-5,400]) # ax[1].set_ylim([0,0.2]) # ax[1].set_ylim([0,0.2]) # ax[0].set_ylim([0,0.2]) # plt.subplots_adjust(wspace=0.15) # plt.tight_layout() # plt.subplots_adjust(hspace=0.3) f.supxlabel("Replica ID") # plt.xlabel("Replica ID") f.supylabel("Load distribution") # ax[0].legend(loc='best', fancybox=True,frameon=False,framealpha=0.3,ncol=2,bbox_to_anchor=(1, 1)) # plt.plot(replicaNo1, x2_100/(x2_100.sum() * 1.0), color = 'indianred', label='Zipf s=1.01, v=1') plt.legend(loc='upper right', fancybox=True,framealpha=0.3,ncol=1) plt.savefig('zipfian.pdf', format='pdf') plt.show() if __name__ == '__main__': do_plot()
120.913793
1,883
0.735563
2,767
14,026
3.68558
0.630647
0.006668
0.008335
0.004413
0.139243
0.111296
0.08786
0.061679
0.052952
0.052952
0
0.613808
0.054042
14,026
115
1,884
121.965217
0.154809
0.055468
0
0.101266
0
0
0.021711
0
0
0
0
0
0
1
0.012658
false
0
0.037975
0
0.050633
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
1
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
37ed37b35811117f98371c8d42bc523c1cb800a5
168
py
Python
reddit2telegram/channels/r_cyberpunk2077/app.py
mainyordle/reddit2telegram
1163e15aed3b6ff0fba65b222d3d9798f644c386
[ "MIT" ]
187
2016-09-20T09:15:54.000Z
2022-03-29T12:22:33.000Z
reddit2telegram/channels/r_cyberpunk2077/app.py
mainyordle/reddit2telegram
1163e15aed3b6ff0fba65b222d3d9798f644c386
[ "MIT" ]
84
2016-09-22T14:25:07.000Z
2022-03-19T01:26:17.000Z
reddit2telegram/channels/r_cyberpunk2077/app.py
mainyordle/reddit2telegram
1163e15aed3b6ff0fba65b222d3d9798f644c386
[ "MIT" ]
172
2016-09-21T15:39:39.000Z
2022-03-16T15:15:58.000Z
#encoding:utf-8 subreddit = 'cyberpunkgame+LowSodiumCyberpunk' t_channel = '@r_cyberpunk2077' def send_post(submission, r2t): return r2t.send_simple(submission)
18.666667
46
0.779762
20
168
6.35
0.85
0
0
0
0
0
0
0
0
0
0
0.04698
0.113095
168
8
47
21
0.805369
0.083333
0
0
0
0
0.313725
0.20915
0
0
0
0
0
1
0.25
false
0
0
0.25
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
5302911440c6f4a17e76a82630b084e48665fde1
55,777
py
Python
lopper/vendor/lib/python3.8/site-packages/libfdt.py
devicetree-org/lopper
d9f1abb3595b18fe27eefdab1133270a481c546a
[ "BSD-3-Clause" ]
12
2020-10-04T16:53:52.000Z
2022-01-31T20:11:32.000Z
lopper/vendor/lib/python3.8/site-packages/libfdt.py
devicetree-org/lopper
d9f1abb3595b18fe27eefdab1133270a481c546a
[ "BSD-3-Clause" ]
59
2020-06-08T17:43:12.000Z
2022-03-31T13:36:04.000Z
lopper/vendor/lib/python3.8/site-packages/libfdt.py
devicetree-org/lopper
d9f1abb3595b18fe27eefdab1133270a481c546a
[ "BSD-3-Clause" ]
15
2020-06-05T21:40:17.000Z
2022-01-31T20:11:34.000Z
# This file was automatically generated by SWIG (http://www.swig.org). # Version 3.0.12 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info if _swig_python_version_info >= (2, 7, 0): def swig_import_helper(): import importlib pkg = __name__.rpartition('.')[0] mname = '.'.join((pkg, '_libfdt')).lstrip('.') try: return importlib.import_module(mname) except ImportError: return importlib.import_module('_libfdt') _libfdt = swig_import_helper() del swig_import_helper elif _swig_python_version_info >= (2, 6, 0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_libfdt', [dirname(__file__)]) except ImportError: import _libfdt return _libfdt try: _mod = imp.load_module('_libfdt', fp, pathname, description) finally: if fp is not None: fp.close() return _mod _libfdt = swig_import_helper() del swig_import_helper else: import _libfdt del _swig_python_version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. try: import builtins as __builtin__ except ImportError: import __builtin__ def _swig_setattr_nondynamic(self, class_type, name, value, static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name, None) if method: return method(self, value) if (not static): if _newclass: object.__setattr__(self, name, value) else: self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self, class_type, name, value): return _swig_setattr_nondynamic(self, class_type, name, value, 0) def _swig_getattr(self, class_type, name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name, None) if method: return method(self) raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name)) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except __builtin__.Exception: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except __builtin__.Exception: class _object: pass _newclass = 0 import struct # Error codes, corresponding to FDT_ERR_... in libfdt.h (NOTFOUND, EXISTS, NOSPACE, BADOFFSET, BADPATH, BADPHANDLE, BADSTATE, TRUNCATED, BADMAGIC, BADVERSION, BADSTRUCTURE, BADLAYOUT, INTERNAL, BADNCELLS, BADVALUE, BADOVERLAY, NOPHANDLES) = QUIET_ALL = range(1, 18) # QUIET_ALL can be passed as the 'quiet' parameter to avoid exceptions # altogether. All # functions passed this value will return an error instead # of raising an exception. # Pass this as the 'quiet' parameter to return -ENOTFOUND on NOTFOUND errors, # instead of raising an exception. QUIET_NOTFOUND = (NOTFOUND,) QUIET_NOSPACE = (NOSPACE,) class FdtException(Exception): """An exception caused by an error such as one of the codes above""" def __init__(self, err): self.err = err def __str__(self): return 'pylibfdt error %d: %s' % (self.err, fdt_strerror(self.err)) def strerror(fdt_err): """Get the string for an error number Args: fdt_err: Error number (-ve) Returns: String containing the associated error """ return fdt_strerror(fdt_err) def check_err(val, quiet=()): """Raise an error if the return value is -ve This is used to check for errors returned by libfdt C functions. Args: val: Return value from a libfdt function quiet: Errors to ignore (empty to raise on all errors) Returns: val if val >= 0 Raises FdtException if val < 0 """ if isinstance(val, int) and val < 0: if -val not in quiet: raise FdtException(val) return val def check_err_null(val, quiet=()): """Raise an error if the return value is NULL This is used to check for a NULL return value from certain libfdt C functions Args: val: Return value from a libfdt function quiet: Errors to ignore (empty to raise on all errors) Returns: val if val is a list, None if not Raises FdtException if val indicates an error was reported and the error is not in @quiet. """ # Normally a list is returned which contains the data and its length. # If we get just an integer error code, it means the function failed. if not isinstance(val, list): if -val not in quiet: raise FdtException(val) return val class FdtRo(object): """Class for a read-only device-tree This is a base class used by FdtRw (read-write access) and FdtSw (sequential-write access). It implements read-only access to the device tree. Here are the three classes and when you should use them: FdtRo - read-only access to an existing FDT FdtRw - read-write access to an existing FDT (most common case) FdtSw - for creating a new FDT, as well as allowing read-only access """ def __init__(self, data): self._fdt = bytearray(data) check_err(fdt_check_header(self._fdt)); def as_bytearray(self): """Get the device tree contents as a bytearray This can be passed directly to libfdt functions that access a const void * for the device tree. Returns: bytearray containing the device tree """ return bytearray(self._fdt) def next_node(self, nodeoffset, depth, quiet=()): """Find the next subnode Args: nodeoffset: Node offset of previous node depth: The depth of the node at nodeoffset. This is used to calculate the depth of the returned node quiet: Errors to ignore (empty to raise on all errors) Returns: Typle: Offset of the next node, if any, else a -ve error Depth of the returned node, if any, else undefined Raises: FdtException if no more nodes found or other error occurs """ return check_err(fdt_next_node(self._fdt, nodeoffset, depth), quiet) def first_subnode(self, nodeoffset, quiet=()): """Find the first subnode of a parent node Args: nodeoffset: Node offset of parent node quiet: Errors to ignore (empty to raise on all errors) Returns: The offset of the first subnode, if any Raises: FdtException if no subnodes found or other error occurs """ return check_err(fdt_first_subnode(self._fdt, nodeoffset), quiet) def next_subnode(self, nodeoffset, quiet=()): """Find the next subnode Args: nodeoffset: Node offset of previous subnode quiet: Errors to ignore (empty to raise on all errors) Returns: The offset of the next subnode, if any Raises: FdtException if no more subnodes found or other error occurs """ return check_err(fdt_next_subnode(self._fdt, nodeoffset), quiet) def magic(self): """Return the magic word from the header Returns: Magic word """ return fdt_magic(self._fdt) def totalsize(self): """Return the total size of the device tree Returns: Total tree size in bytes """ return fdt_totalsize(self._fdt) def off_dt_struct(self): """Return the start of the device-tree struct area Returns: Start offset of struct area """ return fdt_off_dt_struct(self._fdt) def off_dt_strings(self): """Return the start of the device-tree string area Returns: Start offset of string area """ return fdt_off_dt_strings(self._fdt) def off_mem_rsvmap(self): """Return the start of the memory reserve map Returns: Start offset of memory reserve map """ return fdt_off_mem_rsvmap(self._fdt) def version(self): """Return the version of the device tree Returns: Version number of the device tree """ return fdt_version(self._fdt) def last_comp_version(self): """Return the last compatible version of the device tree Returns: Last compatible version number of the device tree """ return fdt_last_comp_version(self._fdt) def boot_cpuid_phys(self): """Return the physical boot CPU ID Returns: Physical boot CPU ID """ return fdt_boot_cpuid_phys(self._fdt) def size_dt_strings(self): """Return the start of the device-tree string area Returns: Start offset of string area """ return fdt_size_dt_strings(self._fdt) def size_dt_struct(self): """Return the start of the device-tree struct area Returns: Start offset of struct area """ return fdt_size_dt_struct(self._fdt) def num_mem_rsv(self, quiet=()): """Return the number of memory reserve-map records Returns: Number of memory reserve-map records """ return check_err(fdt_num_mem_rsv(self._fdt), quiet) def get_mem_rsv(self, index, quiet=()): """Return the indexed memory reserve-map record Args: index: Record to return (0=first) Returns: Number of memory reserve-map records """ return check_err(fdt_get_mem_rsv(self._fdt, index), quiet) def subnode_offset(self, parentoffset, name, quiet=()): """Get the offset of a named subnode Args: parentoffset: Offset of the parent node to check name: Name of the required subnode, e.g. 'subnode@1' quiet: Errors to ignore (empty to raise on all errors) Returns: The node offset of the found node, if any Raises FdtException if there is no node with that name, or other error """ return check_err(fdt_subnode_offset(self._fdt, parentoffset, name), quiet) def path_offset(self, path, quiet=()): """Get the offset for a given path Args: path: Path to the required node, e.g. '/node@3/subnode@1' quiet: Errors to ignore (empty to raise on all errors) Returns: Node offset Raises FdtException if the path is not valid or not found """ return check_err(fdt_path_offset(self._fdt, path), quiet) def get_name(self, nodeoffset): """Get the name of a node Args: nodeoffset: Offset of node to check Returns: Node name Raises: FdtException on error (e.g. nodeoffset is invalid) """ return check_err_null(fdt_get_name(self._fdt, nodeoffset))[0] def first_property_offset(self, nodeoffset, quiet=()): """Get the offset of the first property in a node offset Args: nodeoffset: Offset to the node to check quiet: Errors to ignore (empty to raise on all errors) Returns: Offset of the first property Raises FdtException if the associated node has no properties, or some other error occurred """ return check_err(fdt_first_property_offset(self._fdt, nodeoffset), quiet) def next_property_offset(self, prop_offset, quiet=()): """Get the next property in a node Args: prop_offset: Offset of the previous property quiet: Errors to ignore (empty to raise on all errors) Returns: Offset of the next property Raises: FdtException if the associated node has no more properties, or some other error occurred """ return check_err(fdt_next_property_offset(self._fdt, prop_offset), quiet) def get_property_by_offset(self, prop_offset, quiet=()): """Obtains a property that can be examined Args: prop_offset: Offset of property (e.g. from first_property_offset()) quiet: Errors to ignore (empty to raise on all errors) Returns: Property object, or None if not found Raises: FdtException on error (e.g. invalid prop_offset or device tree format) """ pdata = check_err_null( fdt_get_property_by_offset(self._fdt, prop_offset), quiet) if isinstance(pdata, (int)): return pdata return Property(pdata[0], pdata[1]) def getprop(self, nodeoffset, prop_name, quiet=()): """Get a property from a node Args: nodeoffset: Node offset containing property to get prop_name: Name of property to get quiet: Errors to ignore (empty to raise on all errors) Returns: Value of property as a Property object (which can be used as a bytearray/string), or -ve error number. On failure, returns an integer error Raises: FdtError if any error occurs (e.g. the property is not found) """ pdata = check_err_null(fdt_getprop(self._fdt, nodeoffset, prop_name), quiet) if isinstance(pdata, (int)): return pdata return Property(prop_name, bytearray(pdata[0])) def get_phandle(self, nodeoffset): """Get the phandle of a node Args: nodeoffset: Node offset to check Returns: phandle of node, or 0 if the node has no phandle or another error occurs """ return fdt_get_phandle(self._fdt, nodeoffset) def get_alias(self, name): """Get the full path referenced by a given alias Args: name: name of the alias to lookup Returns: Full path to the node for the alias named 'name', if it exists None, if the given alias or the /aliases node does not exist """ return fdt_get_alias(self._fdt, name) def parent_offset(self, nodeoffset, quiet=()): """Get the offset of a node's parent Args: nodeoffset: Node offset to check quiet: Errors to ignore (empty to raise on all errors) Returns: The offset of the parent node, if any Raises: FdtException if no parent found or other error occurs """ return check_err(fdt_parent_offset(self._fdt, nodeoffset), quiet) def node_offset_by_phandle(self, phandle, quiet=()): """Get the offset of a node with the given phandle Args: phandle: Phandle to search for quiet: Errors to ignore (empty to raise on all errors) Returns: The offset of node with that phandle, if any Raises: FdtException if no node found or other error occurs """ return check_err(fdt_node_offset_by_phandle(self._fdt, phandle), quiet) class Fdt(FdtRo): """Device tree class, supporting all operations The Fdt object is created is created from a device tree binary file, e.g. with something like: fdt = Fdt(open("filename.dtb").read()) Operations can then be performed using the methods in this class. Each method xxx(args...) corresponds to a libfdt function fdt_xxx(fdt, args...). All methods raise an FdtException if an error occurs. To avoid this behaviour a 'quiet' parameter is provided for some functions. This defaults to empty, but you can pass a list of errors that you expect. If one of these errors occurs, the function will return an error number (e.g. -NOTFOUND). """ def __init__(self, data): FdtRo.__init__(self, data) @staticmethod def create_empty_tree(size, quiet=()): """Create an empty device tree ready for use Args: size: Size of device tree in bytes Returns: Fdt object containing the device tree """ data = bytearray(size) err = check_err(fdt_create_empty_tree(data, size), quiet) if err: return err return Fdt(data) def resize(self, size, quiet=()): """Move the device tree into a larger or smaller space This creates a new device tree of size @size and moves the existing device tree contents over to that. It can be used to create more space in a device tree. Note that the Fdt object remains the same, but it now has a new bytearray holding the contents. Args: size: Required new size of device tree in bytes """ fdt = bytearray(size) err = check_err(fdt_open_into(self._fdt, fdt, size), quiet) if err: return err self._fdt = fdt def pack(self, quiet=()): """Pack the device tree to remove unused space This adjusts the tree in place. Args: quiet: Errors to ignore (empty to raise on all errors) Returns: Error code, or 0 if OK Raises: FdtException if any error occurs """ err = check_err(fdt_pack(self._fdt), quiet) if err: return err del self._fdt[self.totalsize():] return err def set_name(self, nodeoffset, name, quiet=()): """Set the name of a node Args: nodeoffset: Node offset of node to update name: New node name (string without \0) Returns: Error code, or 0 if OK Raises: FdtException if no parent found or other error occurs """ if chr(0) in name: raise ValueError('Property contains embedded nul characters') return check_err(fdt_set_name(self._fdt, nodeoffset, name), quiet) def setprop(self, nodeoffset, prop_name, val, quiet=()): """Set the value of a property Args: nodeoffset: Node offset containing the property to create/update prop_name: Name of property val: Value to write (string or bytearray) quiet: Errors to ignore (empty to raise on all errors) Returns: Error code, or 0 if OK Raises: FdtException if no parent found or other error occurs """ return check_err(fdt_setprop(self._fdt, nodeoffset, prop_name, val, len(val)), quiet) def setprop_u32(self, nodeoffset, prop_name, val, quiet=()): """Set the value of a property Args: nodeoffset: Node offset containing the property to create/update prop_name: Name of property val: Value to write (integer) quiet: Errors to ignore (empty to raise on all errors) Returns: Error code, or 0 if OK Raises: FdtException if no parent found or other error occurs """ return check_err(fdt_setprop_u32(self._fdt, nodeoffset, prop_name, val), quiet) def setprop_u64(self, nodeoffset, prop_name, val, quiet=()): """Set the value of a property Args: nodeoffset: Node offset containing the property to create/update prop_name: Name of property val: Value to write (integer) quiet: Errors to ignore (empty to raise on all errors) Returns: Error code, or 0 if OK Raises: FdtException if no parent found or other error occurs """ return check_err(fdt_setprop_u64(self._fdt, nodeoffset, prop_name, val), quiet) def setprop_str(self, nodeoffset, prop_name, val, quiet=()): """Set the string value of a property The property is set to the string, with a nul terminator added Args: nodeoffset: Node offset containing the property to create/update prop_name: Name of property val: Value to write (string without nul terminator). Unicode is supposed by encoding to UTF-8 quiet: Errors to ignore (empty to raise on all errors) Returns: Error code, or 0 if OK Raises: FdtException if no parent found or other error occurs """ val = val.encode('utf-8') + b'\0' return check_err(fdt_setprop(self._fdt, nodeoffset, prop_name, val, len(val)), quiet) def delprop(self, nodeoffset, prop_name, quiet=()): """Delete a property from a node Args: nodeoffset: Node offset containing property to delete prop_name: Name of property to delete quiet: Errors to ignore (empty to raise on all errors) Returns: Error code, or 0 if OK Raises: FdtError if the property does not exist, or another error occurs """ return check_err(fdt_delprop(self._fdt, nodeoffset, prop_name), quiet) def add_subnode(self, parentoffset, name, quiet=()): """Add a new subnode to a node Args: parentoffset: Parent offset to add the subnode to name: Name of node to add Returns: offset of the node created, or negative error code on failure Raises: FdtError if there is not enough space, or another error occurs """ return check_err(fdt_add_subnode(self._fdt, parentoffset, name), quiet) def del_node(self, nodeoffset, quiet=()): """Delete a node Args: nodeoffset: Offset of node to delete Returns: Error code, or 0 if OK Raises: FdtError if an error occurs """ return check_err(fdt_del_node(self._fdt, nodeoffset), quiet) class Property(bytearray): """Holds a device tree property name and value. This holds a copy of a property taken from the device tree. It does not reference the device tree, so if anything changes in the device tree, a Property object will remain valid. Properties: name: Property name value: Property value as a bytearray """ def __init__(self, name, value): bytearray.__init__(self, value) self.name = name def as_cell(self, fmt): return struct.unpack('>' + fmt, self)[0] def as_uint32(self): return self.as_cell('L') def as_int32(self): return self.as_cell('l') def as_uint64(self): return self.as_cell('Q') def as_int64(self): return self.as_cell('q') def as_str(self): """Unicode is supported by decoding from UTF-8""" if self[-1] != 0: raise ValueError('Property lacks nul termination') if 0 in self[:-1]: raise ValueError('Property contains embedded nul characters') return self[:-1].decode('utf-8') class FdtSw(FdtRo): """Software interface to create a device tree from scratch The methods in this class work by adding to an existing 'partial' device tree buffer of a fixed size created by instantiating this class. When the tree is complete, call as_fdt() to obtain a device tree ready to be used. Similarly with nodes, a new node is started with begin_node() and finished with end_node(). The context manager functions can be used to make this a bit easier: # First create the device tree with a node and property: sw = FdtSw() sw.finish_reservemap() with sw.add_node(''): with sw.add_node('node'): sw.property_u32('reg', 2) fdt = sw.as_fdt() # Now we can use it as a real device tree fdt.setprop_u32(0, 'reg', 3) The size hint provides a starting size for the space to be used by the device tree. This will be increased automatically as needed as new items are added to the tree. """ INC_SIZE = 1024 # Expand size by this much when out of space def __init__(self, size_hint=None): """Create a new FdtSw object Args: size_hint: A hint as to the initial size to use Raises: ValueError if size_hint is negative Returns: FdtSw object on success, else integer error code (if not raising) """ if not size_hint: size_hint = self.INC_SIZE fdtsw = bytearray(size_hint) err = check_err(fdt_create(fdtsw, size_hint)) if err: return err self._fdt = fdtsw def as_fdt(self): """Convert a FdtSw into an Fdt so it can be accessed as normal Creates a new Fdt object from the work-in-progress device tree. This does not call fdt_finish() on the current object, so it is possible to add more nodes/properties and call as_fdt() again to get an updated tree. Returns: Fdt object allowing access to the newly created device tree """ fdtsw = bytearray(self._fdt) check_err(fdt_finish(fdtsw)) return Fdt(fdtsw) def check_space(self, val): """Check if we need to add more space to the FDT This should be called with the error code from an operation. If this is -NOSPACE then the FDT will be expanded to have more space, and True will be returned, indicating that the operation needs to be tried again. Args: val: Return value from the operation that was attempted Returns: True if the operation must be retried, else False """ if check_err(val, QUIET_NOSPACE) < 0: self.resize(len(self._fdt) + self.INC_SIZE) return True return False def resize(self, size): """Resize the buffer to accommodate a larger tree Args: size: New size of tree Raises: FdtException on any error """ fdt = bytearray(size) err = check_err(fdt_resize(self._fdt, fdt, size)) self._fdt = fdt def add_reservemap_entry(self, addr, size): """Add a new memory reserve map entry Once finished adding, you must call finish_reservemap(). Args: addr: 64-bit start address size: 64-bit size Raises: FdtException on any error """ while self.check_space(fdt_add_reservemap_entry(self._fdt, addr, size)): pass def finish_reservemap(self): """Indicate that there are no more reserve map entries to add Raises: FdtException on any error """ while self.check_space(fdt_finish_reservemap(self._fdt)): pass def begin_node(self, name): """Begin a new node Use this before adding properties to the node. Then call end_node() to finish it. You can also use the context manager as shown in the FdtSw class comment. Args: name: Name of node to begin Raises: FdtException on any error """ while self.check_space(fdt_begin_node(self._fdt, name)): pass def property_string(self, name, string): """Add a property with a string value The string will be nul-terminated when written to the device tree Args: name: Name of property to add string: String value of property Raises: FdtException on any error """ while self.check_space(fdt_property_string(self._fdt, name, string)): pass def property_u32(self, name, val): """Add a property with a 32-bit value Write a single-cell value to the device tree Args: name: Name of property to add val: Value of property Raises: FdtException on any error """ while self.check_space(fdt_property_u32(self._fdt, name, val)): pass def property_u64(self, name, val): """Add a property with a 64-bit value Write a double-cell value to the device tree in big-endian format Args: name: Name of property to add val: Value of property Raises: FdtException on any error """ while self.check_space(fdt_property_u64(self._fdt, name, val)): pass def property_cell(self, name, val): """Add a property with a single-cell value Write a single-cell value to the device tree Args: name: Name of property to add val: Value of property quiet: Errors to ignore (empty to raise on all errors) Raises: FdtException on any error """ while self.check_space(fdt_property_cell(self._fdt, name, val)): pass def property(self, name, val): """Add a property Write a new property with the given value to the device tree. The value is taken as is and is not nul-terminated Args: name: Name of property to add val: Value of property (bytes) quiet: Errors to ignore (empty to raise on all errors) Raises: FdtException on any error """ while self.check_space(fdt_property_stub(self._fdt, name, val, len(val))): pass def end_node(self): """End a node Use this after adding properties to a node to close it off. You can also use the context manager as shown in the FdtSw class comment. Args: quiet: Errors to ignore (empty to raise on all errors) Raises: FdtException on any error """ while self.check_space(fdt_end_node(self._fdt)): pass def add_node(self, name): """Create a new context for adding a node When used in a 'with' clause this starts a new node and finishes it afterward. Args: name: Name of node to add """ return NodeAdder(self, name) class NodeAdder(): """Class to provide a node context This allows you to add nodes in a more natural way: with fdtsw.add_node('name'): fdtsw.property_string('test', 'value') The node is automatically completed with a call to end_node() when the context exits. """ def __init__(self, fdtsw, name): self._fdt = fdtsw self._name = name def __enter__(self): self._fdt.begin_node(self._name) def __exit__(self, type, value, traceback): self._fdt.end_node() class fdt_header(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, fdt_header, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, fdt_header, name) __repr__ = _swig_repr __swig_setmethods__["magic"] = _libfdt.fdt_header_magic_set __swig_getmethods__["magic"] = _libfdt.fdt_header_magic_get if _newclass: magic = _swig_property(_libfdt.fdt_header_magic_get, _libfdt.fdt_header_magic_set) __swig_setmethods__["totalsize"] = _libfdt.fdt_header_totalsize_set __swig_getmethods__["totalsize"] = _libfdt.fdt_header_totalsize_get if _newclass: totalsize = _swig_property(_libfdt.fdt_header_totalsize_get, _libfdt.fdt_header_totalsize_set) __swig_setmethods__["off_dt_struct"] = _libfdt.fdt_header_off_dt_struct_set __swig_getmethods__["off_dt_struct"] = _libfdt.fdt_header_off_dt_struct_get if _newclass: off_dt_struct = _swig_property(_libfdt.fdt_header_off_dt_struct_get, _libfdt.fdt_header_off_dt_struct_set) __swig_setmethods__["off_dt_strings"] = _libfdt.fdt_header_off_dt_strings_set __swig_getmethods__["off_dt_strings"] = _libfdt.fdt_header_off_dt_strings_get if _newclass: off_dt_strings = _swig_property(_libfdt.fdt_header_off_dt_strings_get, _libfdt.fdt_header_off_dt_strings_set) __swig_setmethods__["off_mem_rsvmap"] = _libfdt.fdt_header_off_mem_rsvmap_set __swig_getmethods__["off_mem_rsvmap"] = _libfdt.fdt_header_off_mem_rsvmap_get if _newclass: off_mem_rsvmap = _swig_property(_libfdt.fdt_header_off_mem_rsvmap_get, _libfdt.fdt_header_off_mem_rsvmap_set) __swig_setmethods__["version"] = _libfdt.fdt_header_version_set __swig_getmethods__["version"] = _libfdt.fdt_header_version_get if _newclass: version = _swig_property(_libfdt.fdt_header_version_get, _libfdt.fdt_header_version_set) __swig_setmethods__["last_comp_version"] = _libfdt.fdt_header_last_comp_version_set __swig_getmethods__["last_comp_version"] = _libfdt.fdt_header_last_comp_version_get if _newclass: last_comp_version = _swig_property(_libfdt.fdt_header_last_comp_version_get, _libfdt.fdt_header_last_comp_version_set) __swig_setmethods__["boot_cpuid_phys"] = _libfdt.fdt_header_boot_cpuid_phys_set __swig_getmethods__["boot_cpuid_phys"] = _libfdt.fdt_header_boot_cpuid_phys_get if _newclass: boot_cpuid_phys = _swig_property(_libfdt.fdt_header_boot_cpuid_phys_get, _libfdt.fdt_header_boot_cpuid_phys_set) __swig_setmethods__["size_dt_strings"] = _libfdt.fdt_header_size_dt_strings_set __swig_getmethods__["size_dt_strings"] = _libfdt.fdt_header_size_dt_strings_get if _newclass: size_dt_strings = _swig_property(_libfdt.fdt_header_size_dt_strings_get, _libfdt.fdt_header_size_dt_strings_set) __swig_setmethods__["size_dt_struct"] = _libfdt.fdt_header_size_dt_struct_set __swig_getmethods__["size_dt_struct"] = _libfdt.fdt_header_size_dt_struct_get if _newclass: size_dt_struct = _swig_property(_libfdt.fdt_header_size_dt_struct_get, _libfdt.fdt_header_size_dt_struct_set) def __init__(self): this = _libfdt.new_fdt_header() try: self.this.append(this) except __builtin__.Exception: self.this = this __swig_destroy__ = _libfdt.delete_fdt_header __del__ = lambda self: None fdt_header_swigregister = _libfdt.fdt_header_swigregister fdt_header_swigregister(fdt_header) class fdt_reserve_entry(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, fdt_reserve_entry, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, fdt_reserve_entry, name) __repr__ = _swig_repr __swig_setmethods__["address"] = _libfdt.fdt_reserve_entry_address_set __swig_getmethods__["address"] = _libfdt.fdt_reserve_entry_address_get if _newclass: address = _swig_property(_libfdt.fdt_reserve_entry_address_get, _libfdt.fdt_reserve_entry_address_set) __swig_setmethods__["size"] = _libfdt.fdt_reserve_entry_size_set __swig_getmethods__["size"] = _libfdt.fdt_reserve_entry_size_get if _newclass: size = _swig_property(_libfdt.fdt_reserve_entry_size_get, _libfdt.fdt_reserve_entry_size_set) def __init__(self): this = _libfdt.new_fdt_reserve_entry() try: self.this.append(this) except __builtin__.Exception: self.this = this __swig_destroy__ = _libfdt.delete_fdt_reserve_entry __del__ = lambda self: None fdt_reserve_entry_swigregister = _libfdt.fdt_reserve_entry_swigregister fdt_reserve_entry_swigregister(fdt_reserve_entry) class fdt_node_header(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, fdt_node_header, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, fdt_node_header, name) __repr__ = _swig_repr __swig_setmethods__["tag"] = _libfdt.fdt_node_header_tag_set __swig_getmethods__["tag"] = _libfdt.fdt_node_header_tag_get if _newclass: tag = _swig_property(_libfdt.fdt_node_header_tag_get, _libfdt.fdt_node_header_tag_set) __swig_setmethods__["name"] = _libfdt.fdt_node_header_name_set __swig_getmethods__["name"] = _libfdt.fdt_node_header_name_get if _newclass: name = _swig_property(_libfdt.fdt_node_header_name_get, _libfdt.fdt_node_header_name_set) def __init__(self): this = _libfdt.new_fdt_node_header() try: self.this.append(this) except __builtin__.Exception: self.this = this __swig_destroy__ = _libfdt.delete_fdt_node_header __del__ = lambda self: None fdt_node_header_swigregister = _libfdt.fdt_node_header_swigregister fdt_node_header_swigregister(fdt_node_header) class fdt_property(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, fdt_property, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, fdt_property, name) __repr__ = _swig_repr __swig_setmethods__["tag"] = _libfdt.fdt_property_tag_set __swig_getmethods__["tag"] = _libfdt.fdt_property_tag_get if _newclass: tag = _swig_property(_libfdt.fdt_property_tag_get, _libfdt.fdt_property_tag_set) __swig_setmethods__["len"] = _libfdt.fdt_property_len_set __swig_getmethods__["len"] = _libfdt.fdt_property_len_get if _newclass: len = _swig_property(_libfdt.fdt_property_len_get, _libfdt.fdt_property_len_set) __swig_setmethods__["nameoff"] = _libfdt.fdt_property_nameoff_set __swig_getmethods__["nameoff"] = _libfdt.fdt_property_nameoff_get if _newclass: nameoff = _swig_property(_libfdt.fdt_property_nameoff_get, _libfdt.fdt_property_nameoff_set) __swig_setmethods__["data"] = _libfdt.fdt_property_data_set __swig_getmethods__["data"] = _libfdt.fdt_property_data_get if _newclass: data = _swig_property(_libfdt.fdt_property_data_get, _libfdt.fdt_property_data_set) def __init__(self): this = _libfdt.new_fdt_property() try: self.this.append(this) except __builtin__.Exception: self.this = this __swig_destroy__ = _libfdt.delete_fdt_property __del__ = lambda self: None fdt_property_swigregister = _libfdt.fdt_property_swigregister fdt_property_swigregister(fdt_property) FDT_MAGIC = _libfdt.FDT_MAGIC FDT_BEGIN_NODE = _libfdt.FDT_BEGIN_NODE FDT_END_NODE = _libfdt.FDT_END_NODE FDT_PROP = _libfdt.FDT_PROP FDT_NOP = _libfdt.FDT_NOP FDT_END = _libfdt.FDT_END def fdt_magic(fdt): return _libfdt.fdt_magic(fdt) fdt_magic = _libfdt.fdt_magic def fdt_totalsize(fdt): return _libfdt.fdt_totalsize(fdt) fdt_totalsize = _libfdt.fdt_totalsize def fdt_off_dt_struct(fdt): return _libfdt.fdt_off_dt_struct(fdt) fdt_off_dt_struct = _libfdt.fdt_off_dt_struct def fdt_off_dt_strings(fdt): return _libfdt.fdt_off_dt_strings(fdt) fdt_off_dt_strings = _libfdt.fdt_off_dt_strings def fdt_off_mem_rsvmap(fdt): return _libfdt.fdt_off_mem_rsvmap(fdt) fdt_off_mem_rsvmap = _libfdt.fdt_off_mem_rsvmap def fdt_version(fdt): return _libfdt.fdt_version(fdt) fdt_version = _libfdt.fdt_version def fdt_last_comp_version(fdt): return _libfdt.fdt_last_comp_version(fdt) fdt_last_comp_version = _libfdt.fdt_last_comp_version def fdt_boot_cpuid_phys(fdt): return _libfdt.fdt_boot_cpuid_phys(fdt) fdt_boot_cpuid_phys = _libfdt.fdt_boot_cpuid_phys def fdt_size_dt_strings(fdt): return _libfdt.fdt_size_dt_strings(fdt) fdt_size_dt_strings = _libfdt.fdt_size_dt_strings def fdt_size_dt_struct(fdt): return _libfdt.fdt_size_dt_struct(fdt) fdt_size_dt_struct = _libfdt.fdt_size_dt_struct def fdt_property_string(fdt, name, val): return _libfdt.fdt_property_string(fdt, name, val) fdt_property_string = _libfdt.fdt_property_string def fdt_property_cell(fdt, name, val): return _libfdt.fdt_property_cell(fdt, name, val) fdt_property_cell = _libfdt.fdt_property_cell def fdt_property_stub(fdt, name, val, len): return _libfdt.fdt_property_stub(fdt, name, val, len) fdt_property_stub = _libfdt.fdt_property_stub FDT_FIRST_SUPPORTED_VERSION = _libfdt.FDT_FIRST_SUPPORTED_VERSION FDT_LAST_SUPPORTED_VERSION = _libfdt.FDT_LAST_SUPPORTED_VERSION FDT_ERR_NOTFOUND = _libfdt.FDT_ERR_NOTFOUND FDT_ERR_EXISTS = _libfdt.FDT_ERR_EXISTS FDT_ERR_NOSPACE = _libfdt.FDT_ERR_NOSPACE FDT_ERR_BADOFFSET = _libfdt.FDT_ERR_BADOFFSET FDT_ERR_BADPATH = _libfdt.FDT_ERR_BADPATH FDT_ERR_BADPHANDLE = _libfdt.FDT_ERR_BADPHANDLE FDT_ERR_BADSTATE = _libfdt.FDT_ERR_BADSTATE FDT_ERR_TRUNCATED = _libfdt.FDT_ERR_TRUNCATED FDT_ERR_BADMAGIC = _libfdt.FDT_ERR_BADMAGIC FDT_ERR_BADVERSION = _libfdt.FDT_ERR_BADVERSION FDT_ERR_BADSTRUCTURE = _libfdt.FDT_ERR_BADSTRUCTURE FDT_ERR_BADLAYOUT = _libfdt.FDT_ERR_BADLAYOUT FDT_ERR_INTERNAL = _libfdt.FDT_ERR_INTERNAL FDT_ERR_BADNCELLS = _libfdt.FDT_ERR_BADNCELLS FDT_ERR_BADVALUE = _libfdt.FDT_ERR_BADVALUE FDT_ERR_BADOVERLAY = _libfdt.FDT_ERR_BADOVERLAY FDT_ERR_NOPHANDLES = _libfdt.FDT_ERR_NOPHANDLES FDT_ERR_BADFLAGS = _libfdt.FDT_ERR_BADFLAGS FDT_ERR_MAX = _libfdt.FDT_ERR_MAX FDT_MAX_PHANDLE = _libfdt.FDT_MAX_PHANDLE def fdt_offset_ptr_w(fdt, offset, checklen): return _libfdt.fdt_offset_ptr_w(fdt, offset, checklen) fdt_offset_ptr_w = _libfdt.fdt_offset_ptr_w def fdt_next_tag(fdt, offset, nextoffset): return _libfdt.fdt_next_tag(fdt, offset, nextoffset) fdt_next_tag = _libfdt.fdt_next_tag def fdt32_ld(p): return _libfdt.fdt32_ld(p) fdt32_ld = _libfdt.fdt32_ld def fdt32_st(property, value): return _libfdt.fdt32_st(property, value) fdt32_st = _libfdt.fdt32_st def fdt64_ld(p): return _libfdt.fdt64_ld(p) fdt64_ld = _libfdt.fdt64_ld def fdt64_st(property, value): return _libfdt.fdt64_st(property, value) fdt64_st = _libfdt.fdt64_st def fdt_next_node(fdt, offset, depth): return _libfdt.fdt_next_node(fdt, offset, depth) fdt_next_node = _libfdt.fdt_next_node def fdt_first_subnode(fdt, offset): return _libfdt.fdt_first_subnode(fdt, offset) fdt_first_subnode = _libfdt.fdt_first_subnode def fdt_next_subnode(fdt, offset): return _libfdt.fdt_next_subnode(fdt, offset) fdt_next_subnode = _libfdt.fdt_next_subnode def fdt_set_magic(fdt, val): return _libfdt.fdt_set_magic(fdt, val) fdt_set_magic = _libfdt.fdt_set_magic def fdt_set_totalsize(fdt, val): return _libfdt.fdt_set_totalsize(fdt, val) fdt_set_totalsize = _libfdt.fdt_set_totalsize def fdt_set_off_dt_struct(fdt, val): return _libfdt.fdt_set_off_dt_struct(fdt, val) fdt_set_off_dt_struct = _libfdt.fdt_set_off_dt_struct def fdt_set_off_dt_strings(fdt, val): return _libfdt.fdt_set_off_dt_strings(fdt, val) fdt_set_off_dt_strings = _libfdt.fdt_set_off_dt_strings def fdt_set_off_mem_rsvmap(fdt, val): return _libfdt.fdt_set_off_mem_rsvmap(fdt, val) fdt_set_off_mem_rsvmap = _libfdt.fdt_set_off_mem_rsvmap def fdt_set_version(fdt, val): return _libfdt.fdt_set_version(fdt, val) fdt_set_version = _libfdt.fdt_set_version def fdt_set_last_comp_version(fdt, val): return _libfdt.fdt_set_last_comp_version(fdt, val) fdt_set_last_comp_version = _libfdt.fdt_set_last_comp_version def fdt_set_boot_cpuid_phys(fdt, val): return _libfdt.fdt_set_boot_cpuid_phys(fdt, val) fdt_set_boot_cpuid_phys = _libfdt.fdt_set_boot_cpuid_phys def fdt_set_size_dt_strings(fdt, val): return _libfdt.fdt_set_size_dt_strings(fdt, val) fdt_set_size_dt_strings = _libfdt.fdt_set_size_dt_strings def fdt_set_size_dt_struct(fdt, val): return _libfdt.fdt_set_size_dt_struct(fdt, val) fdt_set_size_dt_struct = _libfdt.fdt_set_size_dt_struct def fdt_header_size(fdt): return _libfdt.fdt_header_size(fdt) fdt_header_size = _libfdt.fdt_header_size def fdt_header_size_(version): return _libfdt.fdt_header_size_(version) fdt_header_size_ = _libfdt.fdt_header_size_ def fdt_check_header(fdt): return _libfdt.fdt_check_header(fdt) fdt_check_header = _libfdt.fdt_check_header def fdt_move(fdt, buf, bufsize): return _libfdt.fdt_move(fdt, buf, bufsize) fdt_move = _libfdt.fdt_move def fdt_check_full(fdt, bufsize): return _libfdt.fdt_check_full(fdt, bufsize) fdt_check_full = _libfdt.fdt_check_full def fdt_get_string(fdt, stroffset): return _libfdt.fdt_get_string(fdt, stroffset) fdt_get_string = _libfdt.fdt_get_string def fdt_string(fdt, stroffset): return _libfdt.fdt_string(fdt, stroffset) fdt_string = _libfdt.fdt_string def fdt_find_max_phandle(fdt, phandle): return _libfdt.fdt_find_max_phandle(fdt, phandle) fdt_find_max_phandle = _libfdt.fdt_find_max_phandle def fdt_get_max_phandle(fdt): return _libfdt.fdt_get_max_phandle(fdt) fdt_get_max_phandle = _libfdt.fdt_get_max_phandle def fdt_generate_phandle(fdt, phandle): return _libfdt.fdt_generate_phandle(fdt, phandle) fdt_generate_phandle = _libfdt.fdt_generate_phandle def fdt_num_mem_rsv(fdt): return _libfdt.fdt_num_mem_rsv(fdt) fdt_num_mem_rsv = _libfdt.fdt_num_mem_rsv def fdt_get_mem_rsv(fdt, n): return _libfdt.fdt_get_mem_rsv(fdt, n) fdt_get_mem_rsv = _libfdt.fdt_get_mem_rsv def fdt_subnode_offset(fdt, parentoffset, name): return _libfdt.fdt_subnode_offset(fdt, parentoffset, name) fdt_subnode_offset = _libfdt.fdt_subnode_offset def fdt_path_offset(fdt, path): return _libfdt.fdt_path_offset(fdt, path) fdt_path_offset = _libfdt.fdt_path_offset def fdt_get_name(fdt, nodeoffset): return _libfdt.fdt_get_name(fdt, nodeoffset) fdt_get_name = _libfdt.fdt_get_name def fdt_first_property_offset(fdt, nodeoffset): return _libfdt.fdt_first_property_offset(fdt, nodeoffset) fdt_first_property_offset = _libfdt.fdt_first_property_offset def fdt_next_property_offset(fdt, offset): return _libfdt.fdt_next_property_offset(fdt, offset) fdt_next_property_offset = _libfdt.fdt_next_property_offset def fdt_get_property_by_offset(fdt, offset): return _libfdt.fdt_get_property_by_offset(fdt, offset) fdt_get_property_by_offset = _libfdt.fdt_get_property_by_offset def fdt_get_property(fdt, nodeoffset, name): return _libfdt.fdt_get_property(fdt, nodeoffset, name) fdt_get_property = _libfdt.fdt_get_property def fdt_get_property_w(fdt, nodeoffset, name): return _libfdt.fdt_get_property_w(fdt, nodeoffset, name) fdt_get_property_w = _libfdt.fdt_get_property_w def fdt_getprop(fdt, nodeoffset, name): return _libfdt.fdt_getprop(fdt, nodeoffset, name) fdt_getprop = _libfdt.fdt_getprop def fdt_getprop_w(fdt, nodeoffset, name): return _libfdt.fdt_getprop_w(fdt, nodeoffset, name) fdt_getprop_w = _libfdt.fdt_getprop_w def fdt_get_phandle(fdt, nodeoffset): return _libfdt.fdt_get_phandle(fdt, nodeoffset) fdt_get_phandle = _libfdt.fdt_get_phandle def fdt_get_alias(fdt, name): return _libfdt.fdt_get_alias(fdt, name) fdt_get_alias = _libfdt.fdt_get_alias def fdt_get_path(fdt, nodeoffset, buf, buflen): return _libfdt.fdt_get_path(fdt, nodeoffset, buf, buflen) fdt_get_path = _libfdt.fdt_get_path def fdt_supernode_atdepth_offset(fdt, nodeoffset, supernodedepth, nodedepth): return _libfdt.fdt_supernode_atdepth_offset(fdt, nodeoffset, supernodedepth, nodedepth) fdt_supernode_atdepth_offset = _libfdt.fdt_supernode_atdepth_offset def fdt_node_depth(fdt, nodeoffset): return _libfdt.fdt_node_depth(fdt, nodeoffset) fdt_node_depth = _libfdt.fdt_node_depth def fdt_parent_offset(fdt, nodeoffset): return _libfdt.fdt_parent_offset(fdt, nodeoffset) fdt_parent_offset = _libfdt.fdt_parent_offset def fdt_node_offset_by_prop_value(fdt, startoffset, propname, propval, proplen): return _libfdt.fdt_node_offset_by_prop_value(fdt, startoffset, propname, propval, proplen) fdt_node_offset_by_prop_value = _libfdt.fdt_node_offset_by_prop_value def fdt_node_offset_by_phandle(fdt, phandle): return _libfdt.fdt_node_offset_by_phandle(fdt, phandle) fdt_node_offset_by_phandle = _libfdt.fdt_node_offset_by_phandle def fdt_node_check_compatible(fdt, nodeoffset, compatible): return _libfdt.fdt_node_check_compatible(fdt, nodeoffset, compatible) fdt_node_check_compatible = _libfdt.fdt_node_check_compatible def fdt_node_offset_by_compatible(fdt, startoffset, compatible): return _libfdt.fdt_node_offset_by_compatible(fdt, startoffset, compatible) fdt_node_offset_by_compatible = _libfdt.fdt_node_offset_by_compatible def fdt_stringlist_contains(strlist, listlen, str): return _libfdt.fdt_stringlist_contains(strlist, listlen, str) fdt_stringlist_contains = _libfdt.fdt_stringlist_contains def fdt_stringlist_count(fdt, nodeoffset, property): return _libfdt.fdt_stringlist_count(fdt, nodeoffset, property) fdt_stringlist_count = _libfdt.fdt_stringlist_count def fdt_stringlist_search(fdt, nodeoffset, property, string): return _libfdt.fdt_stringlist_search(fdt, nodeoffset, property, string) fdt_stringlist_search = _libfdt.fdt_stringlist_search def fdt_stringlist_get(fdt, nodeoffset, property, index): return _libfdt.fdt_stringlist_get(fdt, nodeoffset, property, index) fdt_stringlist_get = _libfdt.fdt_stringlist_get FDT_MAX_NCELLS = _libfdt.FDT_MAX_NCELLS def fdt_address_cells(fdt, nodeoffset): return _libfdt.fdt_address_cells(fdt, nodeoffset) fdt_address_cells = _libfdt.fdt_address_cells def fdt_size_cells(fdt, nodeoffset): return _libfdt.fdt_size_cells(fdt, nodeoffset) fdt_size_cells = _libfdt.fdt_size_cells def fdt_setprop_inplace_u32(fdt, nodeoffset, name, val): return _libfdt.fdt_setprop_inplace_u32(fdt, nodeoffset, name, val) fdt_setprop_inplace_u32 = _libfdt.fdt_setprop_inplace_u32 def fdt_setprop_inplace_u64(fdt, nodeoffset, name, val): return _libfdt.fdt_setprop_inplace_u64(fdt, nodeoffset, name, val) fdt_setprop_inplace_u64 = _libfdt.fdt_setprop_inplace_u64 def fdt_setprop_inplace_cell(fdt, nodeoffset, name, val): return _libfdt.fdt_setprop_inplace_cell(fdt, nodeoffset, name, val) fdt_setprop_inplace_cell = _libfdt.fdt_setprop_inplace_cell def fdt_nop_property(fdt, nodeoffset, name): return _libfdt.fdt_nop_property(fdt, nodeoffset, name) fdt_nop_property = _libfdt.fdt_nop_property def fdt_nop_node(fdt, nodeoffset): return _libfdt.fdt_nop_node(fdt, nodeoffset) fdt_nop_node = _libfdt.fdt_nop_node FDT_CREATE_FLAG_NO_NAME_DEDUP = _libfdt.FDT_CREATE_FLAG_NO_NAME_DEDUP FDT_CREATE_FLAGS_ALL = _libfdt.FDT_CREATE_FLAGS_ALL def fdt_create_with_flags(buf, bufsize, flags): return _libfdt.fdt_create_with_flags(buf, bufsize, flags) fdt_create_with_flags = _libfdt.fdt_create_with_flags def fdt_create(buf, bufsize): return _libfdt.fdt_create(buf, bufsize) fdt_create = _libfdt.fdt_create def fdt_resize(fdt, buf, bufsize): return _libfdt.fdt_resize(fdt, buf, bufsize) fdt_resize = _libfdt.fdt_resize def fdt_add_reservemap_entry(fdt, addr, size): return _libfdt.fdt_add_reservemap_entry(fdt, addr, size) fdt_add_reservemap_entry = _libfdt.fdt_add_reservemap_entry def fdt_finish_reservemap(fdt): return _libfdt.fdt_finish_reservemap(fdt) fdt_finish_reservemap = _libfdt.fdt_finish_reservemap def fdt_begin_node(fdt, name): return _libfdt.fdt_begin_node(fdt, name) fdt_begin_node = _libfdt.fdt_begin_node def fdt_property_u32(fdt, name, val): return _libfdt.fdt_property_u32(fdt, name, val) fdt_property_u32 = _libfdt.fdt_property_u32 def fdt_property_u64(fdt, name, val): return _libfdt.fdt_property_u64(fdt, name, val) fdt_property_u64 = _libfdt.fdt_property_u64 def fdt_property_placeholder(fdt, name, len, valp): return _libfdt.fdt_property_placeholder(fdt, name, len, valp) fdt_property_placeholder = _libfdt.fdt_property_placeholder def fdt_end_node(fdt): return _libfdt.fdt_end_node(fdt) fdt_end_node = _libfdt.fdt_end_node def fdt_finish(fdt): return _libfdt.fdt_finish(fdt) fdt_finish = _libfdt.fdt_finish def fdt_create_empty_tree(buf, bufsize): return _libfdt.fdt_create_empty_tree(buf, bufsize) fdt_create_empty_tree = _libfdt.fdt_create_empty_tree def fdt_open_into(fdt, buf, bufsize): return _libfdt.fdt_open_into(fdt, buf, bufsize) fdt_open_into = _libfdt.fdt_open_into def fdt_pack(fdt): return _libfdt.fdt_pack(fdt) fdt_pack = _libfdt.fdt_pack def fdt_add_mem_rsv(fdt, address, size): return _libfdt.fdt_add_mem_rsv(fdt, address, size) fdt_add_mem_rsv = _libfdt.fdt_add_mem_rsv def fdt_del_mem_rsv(fdt, n): return _libfdt.fdt_del_mem_rsv(fdt, n) fdt_del_mem_rsv = _libfdt.fdt_del_mem_rsv def fdt_set_name(fdt, nodeoffset, name): return _libfdt.fdt_set_name(fdt, nodeoffset, name) fdt_set_name = _libfdt.fdt_set_name def fdt_setprop(fdt, nodeoffset, name, val, len): return _libfdt.fdt_setprop(fdt, nodeoffset, name, val, len) fdt_setprop = _libfdt.fdt_setprop def fdt_setprop_placeholder(fdt, nodeoffset, name, len, prop_data): return _libfdt.fdt_setprop_placeholder(fdt, nodeoffset, name, len, prop_data) fdt_setprop_placeholder = _libfdt.fdt_setprop_placeholder def fdt_setprop_u32(fdt, nodeoffset, name, val): return _libfdt.fdt_setprop_u32(fdt, nodeoffset, name, val) fdt_setprop_u32 = _libfdt.fdt_setprop_u32 def fdt_setprop_u64(fdt, nodeoffset, name, val): return _libfdt.fdt_setprop_u64(fdt, nodeoffset, name, val) fdt_setprop_u64 = _libfdt.fdt_setprop_u64 def fdt_setprop_cell(fdt, nodeoffset, name, val): return _libfdt.fdt_setprop_cell(fdt, nodeoffset, name, val) fdt_setprop_cell = _libfdt.fdt_setprop_cell def fdt_appendprop(fdt, nodeoffset, name, val, len): return _libfdt.fdt_appendprop(fdt, nodeoffset, name, val, len) fdt_appendprop = _libfdt.fdt_appendprop def fdt_appendprop_u32(fdt, nodeoffset, name, val): return _libfdt.fdt_appendprop_u32(fdt, nodeoffset, name, val) fdt_appendprop_u32 = _libfdt.fdt_appendprop_u32 def fdt_appendprop_u64(fdt, nodeoffset, name, val): return _libfdt.fdt_appendprop_u64(fdt, nodeoffset, name, val) fdt_appendprop_u64 = _libfdt.fdt_appendprop_u64 def fdt_appendprop_cell(fdt, nodeoffset, name, val): return _libfdt.fdt_appendprop_cell(fdt, nodeoffset, name, val) fdt_appendprop_cell = _libfdt.fdt_appendprop_cell def fdt_appendprop_addrrange(fdt, parent, nodeoffset, name, addr, size): return _libfdt.fdt_appendprop_addrrange(fdt, parent, nodeoffset, name, addr, size) fdt_appendprop_addrrange = _libfdt.fdt_appendprop_addrrange def fdt_delprop(fdt, nodeoffset, name): return _libfdt.fdt_delprop(fdt, nodeoffset, name) fdt_delprop = _libfdt.fdt_delprop def fdt_add_subnode(fdt, parentoffset, name): return _libfdt.fdt_add_subnode(fdt, parentoffset, name) fdt_add_subnode = _libfdt.fdt_add_subnode def fdt_del_node(fdt, nodeoffset): return _libfdt.fdt_del_node(fdt, nodeoffset) fdt_del_node = _libfdt.fdt_del_node def fdt_overlay_apply(fdt, fdto): return _libfdt.fdt_overlay_apply(fdt, fdto) fdt_overlay_apply = _libfdt.fdt_overlay_apply def fdt_strerror(errval): return _libfdt.fdt_strerror(errval) fdt_strerror = _libfdt.fdt_strerror # This file is compatible with both classic and new-style classes.
33.479592
126
0.691163
7,755
55,777
4.610445
0.07234
0.078788
0.043212
0.011579
0.579991
0.461067
0.345052
0.259384
0.202327
0.156878
0
0.004535
0.236961
55,777
1,665
127
33.4997
0.83555
0.285763
0
0.162297
1
0
0.016803
0
0
0
0
0
0
1
0.23221
false
0.013733
0.024969
0.142322
0.525593
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
1
1
0
0
4
530eadafc0f389f987a99558c012178ceb46a3c2
12,794
py
Python
python/tvm/meta_schedule/testing/conv2d_winograd_cuda.py
XiaoSong9905/tvm
48940f697e15d5b50fa1f032003e6c700ae1e423
[ "Apache-2.0" ]
90
2021-11-30T11:58:10.000Z
2022-03-31T02:24:04.000Z
python/tvm/meta_schedule/testing/conv2d_winograd_cuda.py
XiaoSong9905/tvm
48940f697e15d5b50fa1f032003e6c700ae1e423
[ "Apache-2.0" ]
64
2021-11-22T23:58:23.000Z
2022-03-31T03:19:22.000Z
python/tvm/meta_schedule/testing/conv2d_winograd_cuda.py
XiaoSong9905/tvm
48940f697e15d5b50fa1f032003e6c700ae1e423
[ "Apache-2.0" ]
27
2021-12-09T22:39:27.000Z
2022-03-24T23:21:48.000Z
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # pylint: disable=missing-docstring from tvm.script import tir as T # pylint: disable=invalid-name,no-member,line-too-long,too-many-nested-blocks,no-self-argument,no-self-use,unused-argument,chained-comparison,misplaced-comparison-constant @T.prim_func def conv2d_winograd_cuda( # type: ignore placeholder: T.Buffer[(1, 14, 14, 128), "float32"], # type: ignore placeholder_1: T.Buffer[(6, 6, 128, 128), "float32"], # type: ignore conv2d_winograd: T.Buffer[(1, 12, 12, 128), "float32"], # type: ignore ) -> None: # type: ignore data_pad = T.alloc_buffer([1, 16, 16, 128]) input_tile = T.alloc_buffer([6, 6, 9, 128]) B = T.alloc_buffer([6, 6]) data_pack = T.alloc_buffer([6, 6, 9, 128]) bgemm = T.alloc_buffer([6, 6, 9, 128]) A = T.alloc_buffer([6, 4]) inverse = T.alloc_buffer([4, 4, 9, 128]) for i0, i1, i2, i3 in T.grid(1, 16, 16, 128): with T.block("data_pad"): i0_1, i1_1, i2_1, i3_1 = T.axis.remap("SSSS", [i0, i1, i2, i3]) T.block_attr({"schedule_rule": "None"}) T.reads([placeholder[i0_1, i1_1, i2_1, i3_1]]) T.writes([data_pad[i0_1, i1_1, i2_1, i3_1]]) data_pad[i0_1, i1_1, i2_1, i3_1] = T.if_then_else( 0 <= i1_1 and i1_1 < 14 and 0 <= i2_1 and i2_1 < 14, # type: ignore placeholder[i0_1, i1_1, i2_1, i3_1], T.float32(0), dtype="float32", ) for i0_2, i1_2, i2_2, i3_2 in T.grid(6, 6, 9, 128): with T.block("input_tile"): eps, nu, p, ci = T.axis.remap("SSSS", [i0_2, i1_2, i2_2, i3_2]) T.block_attr({"schedule_rule": "None"}) T.reads( [ data_pad[ T.floordiv(p, 9), # type: ignore ((T.floordiv(T.floormod(p, 9), 3) * 4) + eps), # type: ignore ((T.floormod(p, 3) * 4) + nu), # type: ignore ci, ] ] ) T.writes([input_tile[eps, nu, p, ci]]) input_tile[eps, nu, p, ci] = data_pad[ T.floordiv(p, 9), # type: ignore ((T.floordiv(T.floormod(p, 9), 3) * 4) + eps), # type: ignore ((T.floormod(p, 3) * 4) + nu), # type: ignore ci, ] for i0_3, i1_3 in T.grid(6, 6): with T.block("B"): i, j = T.axis.remap("SS", [i0_3, i1_3]) T.block_attr({"schedule_rule": "meta_schedule.compute_inline"}) T.writes([B[i, j]]) # fmt: off B[i, j] = T.Select(((T.floormod(i, 6) == 5) and (T.floormod(j, 6) == 5)), T.float32(1), T.Select(((T.floormod(i, 6) == 5) and (T.floormod(j, 6) == 4)), T.float32(0), T.Select(((T.floormod(i, 6) == 5) and (T.floormod(j, 6) == 3)), T.float32(0), T.Select(((T.floormod(i, 6) == 5) and (T.floormod(j, 6) == 2)), T.float32(0), T.Select(((T.floormod(i, 6) == 5) and (T.floormod(j, 6) == 1)), T.float32(0), T.Select(((T.floormod(i, 6) == 5) and (T.floormod(j, 6) == 0)), T.float32(0), T.Select(((T.floormod(i, 6) == 4) and (T.floormod(j, 6) == 5)), T.float32(1.5), T.Select(((T.floormod(i, 6) == 4) and (T.floormod(j, 6) == 4)), T.float32(1), T.Select(((T.floormod(i, 6) == 4) and (T.floormod(j, 6) == 3)), T.float32(1), T.Select(((T.floormod(i, 6) == 4) and (T.floormod(j, 6) == 2)), T.float32(1), T.Select(((T.floormod(i, 6) == 4) and (T.floormod(j, 6) == 1)), T.float32(1), T.Select(((T.floormod(i, 6) == 4) and (T.floormod(j, 6) == 0)), T.float32(1), T.Select(((T.floormod(i, 6) == 3) and (T.floormod(j, 6) == 5)), T.float32(-2), T.Select(((T.floormod(i, 6) == 3) and (T.floormod(j, 6) == 4)), T.float32(-0.5), T.Select(((T.floormod(i, 6) == 3) and (T.floormod(j, 6) == 3)), T.float32(2), T.Select(((T.floormod(i, 6) == 3) and (T.floormod(j, 6) == 2)), T.float32(2.5), T.Select(((T.floormod(i, 6) == 3) and (T.floormod(j, 6) == 1)), T.float32(0.5), T.Select(((T.floormod(i, 6) == 3) and (T.floormod(j, 6) == 0)), T.float32(1.5), T.Select(((T.floormod(i, 6) == 2) and (T.floormod(j, 6) == 5)), T.float32(-1.5), T.Select(((T.floormod(i, 6) == 2) and (T.floormod(j, 6) == 4)), T.float32(-1), T.Select(((T.floormod(i, 6) == 2) and (T.floormod(j, 6) == 3)), T.float32(-1), T.Select(((T.floormod(i, 6) == 2) and (T.floormod(j, 6) == 2)), T.float32(0.5), T.Select(((T.floormod(i, 6) == 2) and (T.floormod(j, 6) == 1)), T.float32(-2.5), T.Select(((T.floormod(i, 6) == 2) and (T.floormod(j, 6) == 0)), T.float32(-2), T.Select(((T.floormod(i, 6) == 1) and (T.floormod(j, 6) == 5)), T.float32(1), T.Select(((T.floormod(i, 6) == 1) and (T.floormod(j, 6) == 4)), T.float32(0.5), T.Select(((T.floormod(i, 6) == 1) and (T.floormod(j, 6) == 3)), T.float32(-2), T.Select(((T.floormod(i, 6) == 1) and (T.floormod(j, 6) == 2)), T.float32(-1), T.Select(((T.floormod(i, 6) == 1) and (T.floormod(j, 6) == 1)), T.float32(1), T.Select(((T.floormod(i, 6) == 1) and (T.floormod(j, 6) == 0)), T.float32(-1.5), T.Select(((T.floormod(i, 6) == 0) and (T.floormod(j, 6) == 5)), T.float32(0), T.Select(((T.floormod(i, 6) == 0) and (T.floormod(j, 6) == 4)), T.float32(0), T.Select(((T.floormod(i, 6) == 0) and (T.floormod(j, 6) == 3)), T.float32(0), T.Select(((T.floormod(i, 6) == 0) and (T.floormod(j, 6) == 2)), T.float32(0), T.Select(((T.floormod(i, 6) == 0) and (T.floormod(j, 6) == 1)), T.float32(0), T.Select(((T.floormod(i, 6) == 0) and (T.floormod(j, 6) == 0)), T.float32(1), T.float32(0))))))))))))))))))))))))))))))))))))) # type: ignore # fmt: on for i0_4, i1_4, i2_3, i3_3, i4, i5 in T.grid(6, 6, 9, 128, 6, 6): with T.block("data_pack"): eps_1, nu_1, p_1, ci_1, r_a, r_b = T.axis.remap( "SSSSRR", [i0_4, i1_4, i2_3, i3_3, i4, i5] ) T.block_attr({"schedule_rule": "meta_schedule.winograd_data_pack.cuda"}) T.reads( [ data_pack[eps_1, nu_1, p_1, ci_1], input_tile[r_a, r_b, p_1, ci_1], B[ T.min(r_a, r_b) : ( # type: ignore T.min(r_a, r_b) + ((T.max(r_a, r_b) + 1) - T.min(r_a, r_b)) # type: ignore ), T.min(eps_1, nu_1) : ( # type: ignore T.min(eps_1, nu_1) + ((T.max(eps_1, nu_1) + 1) - T.min(eps_1, nu_1)) # type: ignore ), ], ] ) T.writes([data_pack[eps_1, nu_1, p_1, ci_1]]) with T.init(): data_pack[eps_1, nu_1, p_1, ci_1] = T.float32(0) data_pack[eps_1, nu_1, p_1, ci_1] = data_pack[eps_1, nu_1, p_1, ci_1] + ( (input_tile[r_a, r_b, p_1, ci_1] * B[r_a, eps_1]) * B[r_b, nu_1] ) for i0_5, i1_5, i2_4, i3_4, i4_1 in T.grid(6, 6, 9, 128, 128): with T.block("bgemm"): eps_2, nu_2, p_2, co, ci_2 = T.axis.remap("SSSSR", [i0_5, i1_5, i2_4, i3_4, i4_1]) T.block_attr({"meta_schedule.write_cache_level": [3]}) T.reads( [ bgemm[eps_2, nu_2, p_2, co], data_pack[eps_2, nu_2, p_2, ci_2], placeholder_1[eps_2, nu_2, co, ci_2], ] ) T.writes([bgemm[eps_2, nu_2, p_2, co]]) with T.init(): bgemm[eps_2, nu_2, p_2, co] = T.float32(0) bgemm[eps_2, nu_2, p_2, co] = bgemm[eps_2, nu_2, p_2, co] + ( data_pack[eps_2, nu_2, p_2, ci_2] * placeholder_1[eps_2, nu_2, co, ci_2] ) for i0_6, i1_6 in T.grid(6, 4): with T.block("A"): i_1, j_1 = T.axis.remap("SS", [i0_6, i1_6]) T.block_attr({"schedule_rule": "meta_schedule.compute_inline"}) T.writes([A[i_1, j_1]]) # fmt: off A[i_1, j_1] = T.Select(((T.floormod(i_1, 6) == 5) and (T.floormod(j_1, 4) == 3)), T.float32(1), T.Select(((T.floormod(i_1, 6) == 5) and (T.floormod(j_1, 4) == 2)), T.float32(0), T.Select(((T.floormod(i_1, 6) == 5) and (T.floormod(j_1, 4) == 1)), T.float32(0), T.Select(((T.floormod(i_1, 6) == 5) and (T.floormod(j_1, 4) == 0)), T.float32(0), T.Select(((T.floormod(i_1, 6) == 4) and (T.floormod(j_1, 4) == 3)), T.float32(-8), T.Select(((T.floormod(i_1, 6) == 4) and (T.floormod(j_1, 4) == 2)), T.float32(4), T.Select(((T.floormod(i_1, 6) == 4) and (T.floormod(j_1, 4) == 1)), T.float32(-2), T.Select(((T.floormod(i_1, 6) == 4) and (T.floormod(j_1, 4) == 0)), T.float32(1), T.Select(((T.floormod(i_1, 6) == 3) and (T.floormod(j_1, 4) == 3)), T.float32(0.125), T.Select(((T.floormod(i_1, 6) == 3) and (T.floormod(j_1, 4) == 2)), T.float32(0.25), T.Select(((T.floormod(i_1, 6) == 3) and (T.floormod(j_1, 4) == 1)), T.float32(0.5), T.Select(((T.floormod(i_1, 6) == 3) and (T.floormod(j_1, 4) == 0)), T.float32(1), T.Select(((T.floormod(i_1, 6) == 2) and (T.floormod(j_1, 4) == 3)), T.float32(1), T.Select(((T.floormod(i_1, 6) == 2) and (T.floormod(j_1, 4) == 2)), T.float32(1), T.Select(((T.floormod(i_1, 6) == 2) and (T.floormod(j_1, 4) == 1)), T.float32(1), T.Select(((T.floormod(i_1, 6) == 2) and (T.floormod(j_1, 4) == 0)), T.float32(1), T.Select(((T.floormod(i_1, 6) == 1) and (T.floormod(j_1, 4) == 3)), T.float32(-1), T.Select(((T.floormod(i_1, 6) == 1) and (T.floormod(j_1, 4) == 2)), T.float32(1), T.Select(((T.floormod(i_1, 6) == 1) and (T.floormod(j_1, 4) == 1)), T.float32(-1), T.Select(((T.floormod(i_1, 6) == 1) and (T.floormod(j_1, 4) == 0)), T.float32(1), T.Select(((T.floormod(i_1, 6) == 0) and (T.floormod(j_1, 4) == 3)), T.float32(0), T.Select(((T.floormod(i_1, 6) == 0) and (T.floormod(j_1, 4) == 2)), T.float32(0), T.Select(((T.floormod(i_1, 6) == 0) and (T.floormod(j_1, 4) == 1)), T.float32(0), T.Select(((T.floormod(i_1, 6) == 0) and (T.floormod(j_1, 4) == 0)), T.float32(1), T.float32(0))))))))))))))))))))))))) # type: ignore # fmt: on for i0_7, i1_7, i2_5, i3_5, i4_2, i5_1 in T.grid(4, 4, 9, 128, 6, 6): with T.block("inverse"): vh, vw, p_3, co_1, r_a_1, r_b_1 = T.axis.remap( "SSSSRR", [i0_7, i1_7, i2_5, i3_5, i4_2, i5_1] ) T.block_attr({"schedule_rule": "meta_schedule.winograd_inverse"}) T.reads( [ inverse[vh, vw, p_3, co_1], bgemm[r_a_1, r_b_1, p_3, co_1], A[ T.min(r_a_1, r_b_1) : ( # type: ignore T.min(r_a_1, r_b_1) + ((T.max(r_a_1, r_b_1) + 1) - T.min(r_a_1, r_b_1)) # type: ignore ), T.min(vh, vw) : (T.min(vh, vw) + ((T.max(vh, vw) + 1) - T.min(vh, vw))), # type: ignore ], ] ) T.writes([inverse[vh, vw, p_3, co_1]]) with T.init(): inverse[vh, vw, p_3, co_1] = T.float32(0) inverse[vh, vw, p_3, co_1] = inverse[vh, vw, p_3, co_1] + ( (bgemm[r_a_1, r_b_1, p_3, co_1] * A[r_a_1, vh]) * A[r_b_1, vw] ) for i0_8, i1_8, i2_6, i3_6 in T.grid(1, 12, 12, 128): with T.block("conv2d_winograd"): n, h, w, co_2 = T.axis.remap("SSSS", [i0_8, i1_8, i2_6, i3_6]) T.reads( [ inverse[ T.floormod(h, 4), # type: ignore T.floormod(w, 4), # type: ignore (((n * 9) + (T.floordiv(h, 4) * 3)) + T.floordiv(w, 4)), # type: ignore co_2, ] ] ) T.writes([conv2d_winograd[n, h, w, co_2]]) conv2d_winograd[n, h, w, co_2] = inverse[ T.floormod(h, 4), # type: ignore T.floormod(w, 4), # type: ignore (((n * 9) + (T.floordiv(h, 4) * 3)) + T.floordiv(w, 4)), # type: ignore co_2, ]
73.528736
2,924
0.50977
2,268
12,794
2.727072
0.081129
0.186257
0.077607
0.155214
0.74325
0.716734
0.705255
0.664349
0.618755
0.605982
0
0.102503
0.275598
12,794
173
2,925
73.953757
0.564847
0.104815
0
0.226027
0
0
0.031308
0.013505
0
0
0
0
0
1
0.006849
false
0
0.006849
0
0.013699
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
531a305df80c17a54de7427e56aafaaa811d1c2c
2,325
py
Python
homura/callbacks/base.py
levelfour/homura
3f3b880fa1347d3419b2941b8bf1347bee237751
[ "Apache-2.0" ]
1
2020-11-24T07:41:01.000Z
2020-11-24T07:41:01.000Z
homura/callbacks/base.py
983632847/homura
81d9ffba3a8eb5172fc2bd08fec10e816138ef2e
[ "Apache-2.0" ]
null
null
null
homura/callbacks/base.py
983632847/homura
81d9ffba3a8eb5172fc2bd08fec10e816138ef2e
[ "Apache-2.0" ]
1
2020-09-26T05:35:49.000Z
2020-09-26T05:35:49.000Z
from abc import ABCMeta from collections import ChainMap from collections.abc import Mapping from typing import Iterable class Callback(metaclass=ABCMeta): """ Base class of Callback class """ def before_iteration(self, data: Mapping) -> Mapping: pass def after_iteration(self, data: Mapping) -> Mapping: pass def before_epoch(self, data: Mapping) -> Mapping: pass def after_epoch(self, data: Mapping) -> Mapping: pass def before_all(self, data: Mapping) -> Mapping: pass def after_all(self, data: Mapping) -> Mapping: pass def close(self): pass def __enter__(self): return self def __exit__(self, exc_type, exc_val, exc_tb): self.close() class _NoOpCallback(Callback): def __init__(self, *args, **kwargs): pass class CallbackList(Callback): """ Combine some callbacks :param callbacks: callbacks """ def __init__(self, *callbacks: Iterable[Callback] or Callback): if callbacks is None: raise TypeError("callbacks is expected to be Callback but None") if not isinstance(callbacks, Iterable): callbacks = [callbacks] callbacks = [c for c in callbacks if c is not None] for c in callbacks: if not isinstance(c, Callback): raise TypeError(f"{c} is not callback!") self._callbacks: Iterable[Callback] = list(callbacks) def before_iteration(self, data: Mapping): return self._cat([c.before_iteration(data) for c in self._callbacks]) def after_iteration(self, data: Mapping): return self._cat([c.after_iteration(data) for c in self._callbacks]) def before_epoch(self, data: Mapping): return self._cat([c.before_epoch(data) for c in self._callbacks]) def after_epoch(self, data: Mapping): return self._cat([c.after_epoch(data) for c in self._callbacks]) def after_all(self, data: Mapping): return self._cat([c.after_all(data) for c in self._callbacks]) def close(self): for c in self._callbacks: c.close() @staticmethod def _cat(maps: list): # make callbacks' return to a single map maps = [m for m in maps if m is not None] return dict(ChainMap(*maps))
26.724138
77
0.63957
301
2,325
4.777409
0.219269
0.061196
0.114743
0.091794
0.478442
0.441586
0.422809
0.241307
0.05007
0
0
0
0.263656
2,325
86
78
27.034884
0.839953
0.053763
0
0.185185
0
0
0.029844
0
0
0
0
0
0
1
0.333333
false
0.148148
0.074074
0.111111
0.592593
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
1
1
0
0
4
534459229ea2ed9e06db3291a9478fecbfb46526
191
py
Python
Libraries/TextoToVoiceInFile/Example.py
wisrovi/LibreriasPython
1caf9a36f83e71fc5f3b1394b6fd73ddd45f006a
[ "MIT" ]
null
null
null
Libraries/TextoToVoiceInFile/Example.py
wisrovi/LibreriasPython
1caf9a36f83e71fc5f3b1394b6fd73ddd45f006a
[ "MIT" ]
null
null
null
Libraries/TextoToVoiceInFile/Example.py
wisrovi/LibreriasPython
1caf9a36f83e71fc5f3b1394b6fd73ddd45f006a
[ "MIT" ]
null
null
null
from Libraries.TextoToVoiceInFile.TextoToVoiceInFile import TextoToVoiceInFile Emulador = TextoToVoiceInFile() rutaArchivo = Emulador.convertTextToVoiceAndSaveFile("prueba", "Hola mundo")
47.75
79
0.848168
14
191
11.571429
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.078534
191
4
80
47.75
0.920455
0
0
0
0
0
0.084656
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
5360a799fe5335bd5ba2e2e5d4d3a819d756ae2e
108
py
Python
coopihc/examples/basic_examples/inference_examples.py
jgori-ouistiti/CoopIHC
0fe24c618a430517c1394625275faff3ce344f7f
[ "MIT" ]
null
null
null
coopihc/examples/basic_examples/inference_examples.py
jgori-ouistiti/CoopIHC
0fe24c618a430517c1394625275faff3ce344f7f
[ "MIT" ]
52
2021-11-23T13:49:50.000Z
2022-03-15T12:28:18.000Z
coopihc/examples/basic_examples/inference_examples.py
jgori-ouistiti/CoopIHC
0fe24c618a430517c1394625275faff3ce344f7f
[ "MIT" ]
1
2022-03-08T11:10:24.000Z
2022-03-08T11:10:24.000Z
from coopihc.inference.ExampleInferenceEngine import ExampleInferenceEngine eie = ExampleInferenceEngine()
27
75
0.87963
8
108
11.875
0.75
0
0
0
0
0
0
0
0
0
0
0
0.074074
108
3
76
36
0.95
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
7268b91702e365863364a02d2adda1090802895a
247
py
Python
swachhbharat/images/views.py
avinassh/swach-bharat-backend
e0492ca0b6330cc8bac7d630fd6b690546990ab3
[ "MIT" ]
null
null
null
swachhbharat/images/views.py
avinassh/swach-bharat-backend
e0492ca0b6330cc8bac7d630fd6b690546990ab3
[ "MIT" ]
1
2016-07-31T04:43:55.000Z
2016-07-31T04:43:55.000Z
swachhbharat/images/views.py
avinassh/swach-bharat-backend
e0492ca0b6330cc8bac7d630fd6b690546990ab3
[ "MIT" ]
4
2016-07-28T17:41:05.000Z
2016-11-10T04:00:17.000Z
from rest_framework import viewsets from .models import Image from .serializers import ImageSerializer class ImageViewSet(viewsets.ModelViewSet): queryset = Image.objects.all().order_by('-created_on') serializer_class = ImageSerializer
24.7
58
0.801619
28
247
6.928571
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.125506
247
9
59
27.444444
0.898148
0
0
0
0
0
0.044534
0
0
0
0
0
0
1
0
false
0
0.5
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
1
0
1
0
0
4
72726cfc0ea309eb3922763495b67587a7efbac9
319
py
Python
Control_Exp1001/demo/thickener_chinese/common/exp_name.py
y18810919727/Control_Exp1001
f9fa0a46d838915de9c5f16c315c6c9eaba07f62
[ "MIT" ]
1
2019-01-03T01:38:50.000Z
2019-01-03T01:38:50.000Z
Control_Exp1001/demo/thickener/common/exp_name.py
y18810919727/Control_Exp1001
f9fa0a46d838915de9c5f16c315c6c9eaba07f62
[ "MIT" ]
null
null
null
Control_Exp1001/demo/thickener/common/exp_name.py
y18810919727/Control_Exp1001
f9fa0a46d838915de9c5f16c315c6c9eaba07f62
[ "MIT" ]
1
2019-09-15T14:33:40.000Z
2019-09-15T14:33:40.000Z
#!/usr/bin/python # -*- coding:utf8 -*- import numpy as np import math import Control_Exp1001 as CE import os import json EXP_NAME = "None" def _init(): global EXP_NAME EXP_NAME = "None" def get_exp_name(): return EXP_NAME def set_exp_name(new_exp_name): global EXP_NAME EXP_NAME = new_exp_name
15.190476
31
0.708464
53
319
3.962264
0.471698
0.333333
0.104762
0.133333
0.319048
0
0
0
0
0
0
0.019608
0.200627
319
21
32
15.190476
0.803922
0.112853
0
0.285714
0
0
0.028369
0
0
0
0
0
0
1
0.214286
false
0
0.357143
0.071429
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
1
0
1
0
0
4
7291821f0fc665f7b18172efebd0c18a436b71a6
18
py
Python
bot/__init__.py
diegorusso/discordbot
528ab3738b9fe759d65b73f59de8e9cb64f0ac45
[ "MIT" ]
null
null
null
bot/__init__.py
diegorusso/discordbot
528ab3738b9fe759d65b73f59de8e9cb64f0ac45
[ "MIT" ]
2
2018-02-11T16:39:47.000Z
2020-08-11T09:34:27.000Z
bot/__init__.py
diegorusso/discordbot
528ab3738b9fe759d65b73f59de8e9cb64f0ac45
[ "MIT" ]
1
2018-02-11T19:42:04.000Z
2018-02-11T19:42:04.000Z
"""Bot module."""
9
17
0.5
2
18
4.5
1
0
0
0
0
0
0
0
0
0
0
0
0.111111
18
1
18
18
0.5625
0.611111
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
72945239b679ef8c012970f952b63202ed89ab97
209
py
Python
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/commands/database.py
drgarcia1986/cookiecutter-muffin
7aa861787b4280477a726da99cf9de4047b01d91
[ "MIT" ]
3
2016-06-24T21:14:37.000Z
2017-03-07T05:36:33.000Z
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/commands/database.py
drgarcia1986/cookiecutter-muffin
7aa861787b4280477a726da99cf9de4047b01d91
[ "MIT" ]
null
null
null
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/commands/database.py
drgarcia1986/cookiecutter-muffin
7aa861787b4280477a726da99cf9de4047b01d91
[ "MIT" ]
null
null
null
from .. import app @app.manage.command def create_db(): """ Create all tables in configured database """ from ..users.models import User # noqa app.ps.peewee.database.create_table(User)
19
45
0.669856
28
209
4.928571
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.215311
209
10
46
20.9
0.841463
0.220096
0
0
0
0
0
0
0
0
0
0
0
1
0.2
true
0
0.4
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
72996d20dc32b2b36986e3f23cc9b678fd1f9c26
385
py
Python
tests/conftest.py
patryk-playground/google_colab
1b2fdfbae6c0d66a62838b4d759943032f9e5c1a
[ "MIT" ]
null
null
null
tests/conftest.py
patryk-playground/google_colab
1b2fdfbae6c0d66a62838b4d759943032f9e5c1a
[ "MIT" ]
null
null
null
tests/conftest.py
patryk-playground/google_colab
1b2fdfbae6c0d66a62838b4d759943032f9e5c1a
[ "MIT" ]
null
null
null
""" Pytest configuration tests fixtures and other helper methods """ import random import pytest from example.web.rest import Web @pytest.fixture(scope="module") def random_num(): """Random int number Yields: int: return a random number from 1 to 9 """ yield random.randint(1, 9) @pytest.fixture() def client(): """Get a web client""" yield Web()
17.5
68
0.662338
53
385
4.792453
0.584906
0.102362
0
0
0
0
0
0
0
0
0
0.013333
0.220779
385
21
69
18.333333
0.833333
0.384416
0
0
0
0
0.029126
0
0
0
0
0
0
1
0.222222
true
0
0.333333
0
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
1
0
1
0
0
4
72b05891c89755fe6a9d5343acf71da4182caeab
61
py
Python
tests/__init__.py
leaprovenzano/yabump
ceab6ffdd36167e511c3bd7b6b064346e3ce3e2e
[ "MIT" ]
null
null
null
tests/__init__.py
leaprovenzano/yabump
ceab6ffdd36167e511c3bd7b6b064346e3ce3e2e
[ "MIT" ]
null
null
null
tests/__init__.py
leaprovenzano/yabump
ceab6ffdd36167e511c3bd7b6b064346e3ce3e2e
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """Unit test package for yabump."""
15.25
35
0.557377
8
61
4.25
1
0
0
0
0
0
0
0
0
0
0
0.02
0.180328
61
3
36
20.333333
0.66
0.852459
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
72c62b15d13a11f0a6c26a8c64592fc98f630529
59
py
Python
backend/chineseocr_lite/psenet/__init__.py
MrZilinXiao/Fighting-Meme-python-wechaty
5fbd148635928ceb22fba7cf1a4880a0045a3764
[ "Apache-2.0" ]
6
2020-08-13T10:02:32.000Z
2020-12-07T14:22:03.000Z
backend/chineseocr_lite/psenet/__init__.py
MrZilinXiao/Fighting-Meme-python-wechaty
5fbd148635928ceb22fba7cf1a4880a0045a3764
[ "Apache-2.0" ]
3
2021-06-08T21:55:26.000Z
2022-03-12T00:38:10.000Z
backend/chineseocr_lite/psenet/__init__.py
MrZilinXiao/python-wechaty-meme-bo
5fbd148635928ceb22fba7cf1a4880a0045a3764
[ "Apache-2.0" ]
2
2020-08-19T02:34:01.000Z
2020-12-07T06:54:04.000Z
from .model import PSENet from .PSENET import PSENetHandel
19.666667
32
0.830508
8
59
6.125
0.625
0
0
0
0
0
0
0
0
0
0
0
0.135593
59
2
33
29.5
0.960784
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
72e439c889786e746ca5954e04ccfe4554f59cff
170
py
Python
bench/benchmarks/__init__.py
TedrosGitHub/TSA-yatsm
8e328f366c8fd94d5cc57cd2cc42080c43d1f391
[ "MIT" ]
59
2015-02-03T19:56:17.000Z
2022-03-17T13:45:23.000Z
bench/benchmarks/__init__.py
TedrosGitHub/TSA-yatsm
8e328f366c8fd94d5cc57cd2cc42080c43d1f391
[ "MIT" ]
97
2015-02-12T05:18:38.000Z
2020-06-09T16:10:38.000Z
bench/benchmarks/__init__.py
TedrosGitHub/TSA-yatsm
8e328f366c8fd94d5cc57cd2cc42080c43d1f391
[ "MIT" ]
35
2015-02-27T19:43:23.000Z
2021-06-21T02:29:14.000Z
import os # Fix OPENLBAS threads to 1 NP_THREAD_VARS = ['OPENBLAS_NUM_THREADS', 'MKL_NUM_THREADS', 'OPM_NUM_THREADS'] for ev in NP_THREAD_VARS: os.environ[ev] = '1'
24.285714
79
0.741176
29
170
4
0.62069
0.258621
0.206897
0
0
0
0
0
0
0
0
0.013793
0.147059
170
6
80
28.333333
0.786207
0.147059
0
0
0
0
0.356643
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
72fc7aa636af7d1969cc025df1b1dca3dcd5cb7e
130
py
Python
blindml/backend/search/preprocessing/transform.py
benclifford/blindml
ccb1d74f377bf474d84efe9bea5cda9e66daf3a5
[ "MIT" ]
1
2020-12-16T19:31:23.000Z
2020-12-16T19:31:23.000Z
blindml/backend/search/preprocessing/transform.py
benclifford/blindml
ccb1d74f377bf474d84efe9bea5cda9e66daf3a5
[ "MIT" ]
3
2021-01-27T12:08:04.000Z
2021-04-01T09:22:22.000Z
blindml/backend/search/preprocessing/transform.py
benclifford/blindml
ccb1d74f377bf474d84efe9bea5cda9e66daf3a5
[ "MIT" ]
1
2021-01-19T09:39:48.000Z
2021-01-19T09:39:48.000Z
from sklearn.preprocessing import StandardScaler def scale(X): scaler = StandardScaler() return scaler.fit_transform(X)
18.571429
48
0.761538
15
130
6.533333
0.8
0
0
0
0
0
0
0
0
0
0
0
0.161538
130
6
49
21.666667
0.899083
0
0
0
0
0
0
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
1
0
0
4
f42a3a093cbb748c7a447a2e6faf8c39ed92e60d
64
py
Python
tests/wasp1/AllAnswerSets/choice_3.test.py
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
19
2015-12-03T08:53:45.000Z
2022-03-31T02:09:43.000Z
tests/wasp1/AllAnswerSets/choice_3.test.py
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
80
2017-11-25T07:57:32.000Z
2018-06-10T19:03:30.000Z
tests/wasp1/AllAnswerSets/choice_3.test.py
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
6
2015-01-15T07:51:48.000Z
2020-06-18T14:47:48.000Z
input = """ a v b. a :- b. b :- a. """ output = """ {a, b} """
6.4
12
0.3125
11
64
1.818182
0.454545
0.2
0
0
0
0
0
0
0
0
0
0
0.3125
64
9
13
7.111111
0.454545
0
0
0.25
0
0
0.5
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
f43f55c1b88e46adbd742e438a0f60e7f445cdff
44
py
Python
jintaro/__init__.py
aisbergg/python-jintaro
34445923ea66ab9c69865c3dbf1c2ce188cb6b52
[ "MIT" ]
1
2021-06-17T08:37:30.000Z
2021-06-17T08:37:30.000Z
jintaro/__init__.py
aisbergg/python-jintaro
34445923ea66ab9c69865c3dbf1c2ce188cb6b52
[ "MIT" ]
null
null
null
jintaro/__init__.py
aisbergg/python-jintaro
34445923ea66ab9c69865c3dbf1c2ce188cb6b52
[ "MIT" ]
null
null
null
__version__ = "0.9.0" __all__ = ["jintaro"]
14.666667
21
0.636364
6
44
3.333333
0.833333
0
0
0
0
0
0
0
0
0
0
0.078947
0.136364
44
2
22
22
0.447368
0
0
0
0
0
0.272727
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
f45b0fd3ce82a976a62da2081e3a7e66b8621cba
2,692
py
Python
source/hsicbt/utils/color.py
choasma/HSIC-Bottleneck
9f1fe2447592d61c0ba524aad0ff0820ae2ba9cb
[ "MIT" ]
49
2019-12-05T03:03:43.000Z
2022-02-23T13:12:02.000Z
source/hsicbt/utils/color.py
choasma/HSIC-Bottleneck
9f1fe2447592d61c0ba524aad0ff0820ae2ba9cb
[ "MIT" ]
10
2020-04-02T22:22:02.000Z
2020-12-19T04:36:27.000Z
source/hsicbt/utils/color.py
choasma/HSIC-Bottleneck
9f1fe2447592d61c0ba524aad0ff0820ae2ba9cb
[ "MIT" ]
18
2020-01-18T00:17:11.000Z
2022-01-13T10:07:55.000Z
TEXT_BLACK = "\033[0;30;40m" TEXT_RED = "\033[1;31;40m" TEXT_GREEN = "\033[1;32;40m" TEXT_YELLOW = "\033[1;33;40m" TEXT_WHITE = "\033[1;37;40m" TEXT_BLUE = "\033[1;34;40m" TEXT_RESET = "\033[0;0m" def get_color(ctype): if ctype == 'yellow': color = TEXT_YELLOW elif ctype == 'green': color = TEXT_GREEN elif ctype == 'white': color = TEXT_WHITE elif ctype == 'black': color = TEXT_BLACK elif ctype == 'blue': color = TEXT_BLUE elif ctype == 'red': color = TEXT_RED return color def print_emph(msg): bar = "# # # # # # # # # # # # # # # # # # # #" print("{}{}".format(TEXT_WHITE, bar)) print("# {}".format(msg)) print("{}{}".format(bar, TEXT_RESET)) pass def print_highlight(msg, ctype='yellow'): color = get_color(ctype) print("{}{}{}".format(color, msg, TEXT_RESET)) def test(): print("\033[0;37;40m Normal text\n") print("\033[2;37;40m Underlined text\033[0;37;40m \n") print("\033[1;37;40m Bright Colour\033[0;37;40m \n") print("\033[3;37;40m Negative Colour\033[0;37;40m \n") print("\033[5;37;40m Negative Colour\033[0;37;40m\n") print("\033[1;37;40m \033[2;37:40m TextColour BlackBackground TextColour GreyBackground WhiteText ColouredBackground\033[0;37;40m\n") print("\033[1;30;40m Dark Gray \033[0m 1;30;40m \033[0;30;47m Black \033[0m 0;30;47m \033[0;37;41m Black \033[0m 0;37;41m") print("\033[1;31;40m Bright Red \033[0m 1;31;40m \033[0;31;47m Red \033[0m 0;31;47m \033[0;37;42m Black \033[0m 0;37;42m") print("\033[1;32;40m Bright Green \033[0m 1;32;40m \033[0;32;47m Green \033[0m 0;32;47m \033[0;37;43m Black \033[0m 0;37;43m") print("\033[1;33;40m Yellow \033[0m 1;33;40m \033[0;33;47m Brown \033[0m 0;33;47m \033[0;37;44m Black \033[0m 0;37;44m") print("\033[1;34;40m Bright Blue \033[0m 1;34;40m \033[0;34;47m Blue \033[0m 0;34;47m \033[0;37;45m Black \033[0m 0;37;45m") print("\033[1;35;40m Bright Magenta \033[0m 1;35;40m \033[0;35;47m Magenta \033[0m 0;35;47m \033[0;37;46m Black \033[0m 0;37;46m") print("\033[1;36;40m Bright Cyan \033[0m 1;36;40m \033[0;36;47m Cyan \033[0m 0;36;47m \033[0;37;47m Black \033[0m 0;37;47m") print("\033[1;37;40m White \033[0m 1;37;40m \033[0;37;40m Light Grey \033[0m 0;37;40m \033[0;37;48m Black \033[0m 0;37;48m")
48.945455
167
0.540119
451
2,692
3.179601
0.144124
0.066946
0.066946
0.069038
0.211994
0.10251
0.10251
0.10251
0.072524
0.072524
0
0.288452
0.282689
2,692
55
168
48.945455
0.454169
0
0
0
0
0.2
0.656018
0.020059
0
0
0
0
0
1
0.088889
false
0.022222
0
0
0.111111
0.444444
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
be61cd85c0718bafefa586198c4d1c55c7fe54b4
229
py
Python
FTSensor/pybind11-master/tests/test_embed/test_interpreter.py
yanglh14/InteractiveGrasping
b5bc1866a1847e7b0c11616fd6cbe949c64a355b
[ "MIT" ]
3
2021-04-14T08:24:40.000Z
2021-11-04T04:10:19.000Z
FTSensor/pybind11-master/tests/test_embed/test_interpreter.py
yanglh14/InteractiveGrasping
b5bc1866a1847e7b0c11616fd6cbe949c64a355b
[ "MIT" ]
null
null
null
FTSensor/pybind11-master/tests/test_embed/test_interpreter.py
yanglh14/InteractiveGrasping
b5bc1866a1847e7b0c11616fd6cbe949c64a355b
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from widget_module import Widget class DerivedWidget(Widget): def __init__(self, message): super(DerivedWidget, self).__init__(message) def the_answer(self): return 42
20.818182
53
0.641921
26
229
5.269231
0.692308
0
0
0
0
0
0
0
0
0
0
0.017442
0.248908
229
10
54
22.9
0.77907
0.091703
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.166667
0.166667
0.833333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
be7a7dc4eb0aaf6ad210a083db27ca5483b7cd09
71
py
Python
helloworld.py
Xponential11/Python
7e88f1a5609666891f73c949888b9f5426cc9670
[ "Unlicense" ]
null
null
null
helloworld.py
Xponential11/Python
7e88f1a5609666891f73c949888b9f5426cc9670
[ "Unlicense" ]
null
null
null
helloworld.py
Xponential11/Python
7e88f1a5609666891f73c949888b9f5426cc9670
[ "Unlicense" ]
null
null
null
print("Hello World") a =5 b = 6 sum = a+b print(sum) print(sum -11)
7.888889
20
0.591549
15
71
2.8
0.6
0.380952
0
0
0
0
0
0
0
0
0
0.072727
0.225352
71
8
21
8.875
0.690909
0
0
0
0
0
0.157143
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
1
0
4
be8132a5c9db91f9b49e8e50a12b1137e2410bb2
1,473
py
Python
tests/test_models/test_user.py
yonizbrown/AirBnB_clone
91d7018d88d67e1fccb44d8c031be4b348895cee
[ "MIT" ]
null
null
null
tests/test_models/test_user.py
yonizbrown/AirBnB_clone
91d7018d88d67e1fccb44d8c031be4b348895cee
[ "MIT" ]
18
2019-11-07T17:51:09.000Z
2019-11-15T15:03:04.000Z
tests/test_models/test_user.py
yonizbrown/AirBnB_clone
91d7018d88d67e1fccb44d8c031be4b348895cee
[ "MIT" ]
3
2019-11-13T23:55:53.000Z
2022-02-08T14:40:59.000Z
#!/usr/bin/python3 """ Unittest for user.py """ import unittest from models.user import User import datetime class UserCase(unittest.TestCase): """Tests instances and methods from user class""" u = User() def test_class_exists(self): """tests if class exists""" self.assertEqual(str(type(self.u)), "<class 'models.user.User'>") def test_user_inheritance(self): """test if User is a subclass of BaseModel""" self.assertIsInstance(self.u, User) def testHasAttributes(self): """verify if attributes exist""" self.assertTrue(hasattr(self.u, 'email')) self.assertTrue(hasattr(self.u, 'password')) self.assertTrue(hasattr(self.u, 'first_name')) self.assertTrue(hasattr(self.u, 'last_name')) self.assertTrue(hasattr(self.u, 'id')) self.assertTrue(hasattr(self.u, 'created_at')) self.assertTrue(hasattr(self.u, 'updated_at')) def test_types(self): """tests if the type of the attribute is the correct one""" self.assertIsInstance(self.u.first_name, str) self.assertIsInstance(self.u.last_name, str) self.assertIsInstance(self.u.email, str) self.assertIsInstance(self.u.password, str) self.assertIsInstance(self.u.id, str) self.assertIsInstance(self.u.created_at, datetime.datetime) self.assertIsInstance(self.u.updated_at, datetime.datetime) if __name__ == '__main__': unittest.main()
32.733333
73
0.66463
187
1,473
5.122995
0.294118
0.083507
0.200418
0.208768
0.352818
0.129436
0
0
0
0
0
0.000849
0.200272
1,473
44
74
33.477273
0.812394
0.152749
0
0
0
0
0.072428
0
0
0
0
0
0.592593
1
0.148148
false
0.074074
0.111111
0
0.333333
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
1
0
0
0
0
0
4
be98ae882d33e83c90d696d1faa3eb5b7e8a4998
105
py
Python
tests/ichild.py
akalsi87/curio
91fc337c5db609455b3ab375ca179efe305a527f
[ "BSD-3-Clause" ]
1
2017-10-11T07:15:15.000Z
2017-10-11T07:15:15.000Z
tests/ichild.py
akalsi87/curio
91fc337c5db609455b3ab375ca179efe305a527f
[ "BSD-3-Clause" ]
2
2018-02-01T02:54:17.000Z
2018-06-14T03:18:51.000Z
tests/ichild.py
akalsi87/curio
91fc337c5db609455b3ab375ca179efe305a527f
[ "BSD-3-Clause" ]
null
null
null
# ichild.py import sys for lineno, line in enumerate(sys.stdin, start=1): pass print(lineno)
10.5
50
0.666667
16
105
4.375
0.875
0
0
0
0
0
0
0
0
0
0
0.012346
0.228571
105
9
51
11.666667
0.851852
0.085714
0
0
0
0
0
0
0
0
0
0
0
1
0
true
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
1
1
0
0
0
0
0
4
bea745eab8a2616cce54bb9368e407e87ed1f031
154
py
Python
search/urls.py
bennylope/ciafactbook
9261b8f42986e2c5b66f1965bf2fa62cc90184fd
[ "BSD-2-Clause" ]
5
2015-04-16T11:19:47.000Z
2015-10-24T01:05:25.000Z
search/urls.py
bennylope/ciafactbook
9261b8f42986e2c5b66f1965bf2fa62cc90184fd
[ "BSD-2-Clause" ]
null
null
null
search/urls.py
bennylope/ciafactbook
9261b8f42986e2c5b66f1965bf2fa62cc90184fd
[ "BSD-2-Clause" ]
null
null
null
from django.conf.urls import patterns, url from .views import search urlpatterns = patterns('', url(r'^$', view=search, name='factbook_search'), )
17.111111
52
0.701299
20
154
5.35
0.7
0.205607
0
0
0
0
0
0
0
0
0
0
0.149351
154
8
53
19.25
0.816794
0
0
0
0
0
0.11039
0
0
0
0
0
0
1
0
false
0
0.4
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
1
0
0
0
0
4
beb419d27d1ccd2087a8af0ce81dea4ea7addfcc
3,960
py
Python
archive/classifiers/data_set.py
FloFincke/affective-chat
241c2b555541968f7e5e70b022fdb71102aed510
[ "MIT" ]
null
null
null
archive/classifiers/data_set.py
FloFincke/affective-chat
241c2b555541968f7e5e70b022fdb71102aed510
[ "MIT" ]
10
2020-01-28T22:17:46.000Z
2022-02-09T23:30:57.000Z
archive/classifiers/data_set.py
FloFincke/affective-chat
241c2b555541968f7e5e70b022fdb71102aed510
[ "MIT" ]
null
null
null
import glob import pandas as pd from itertools import groupby from operator import itemgetter import numpy as np import random def produce_data_set(path): data_sets_files = glob.glob(path) data_set = (pd.concat((pd.read_csv(f, sep=';', header=0) for f in data_sets_files))).values # print(data_set[3]) data_set = sorted(data_set, key=itemgetter(3)) data_set = np.array([list(g) for k, g in groupby(data_set, key=itemgetter(3))]) # datum_set = [x[0][2] for x in data_set] # print(len(datum_set)) # print(datum_set) # print(data_set[0][7]) # np.random.shuffle(data_set) # random.shuffle(data_set) # print(data_set[0][7]) # x_train, x_test, y_train, y_test = generate_train_test_data(data_set, size=0.2) # print(x_train[0]) # return x_train, x_test, y_train, y_test # return generate_train_test_data_per_day(data_set, size=1) return generate_train_test_data_per_5_min(data_set, size=0.2) def generate_train_test_data_per_day(data_set, size=1): """Works just for size = 1""" final_list = [] if size == 1: for i in range(len(data_set)): train_set = data_set[np.arange(len(data_set)) != i] test_set = np.array(data_set[i]) day = test_set[0][2] train_set = np.array([item for sublist in train_set for item in sublist]) np.random.shuffle(test_set) np.random.shuffle(train_set) x_train = train_set[:, 3:-1] y_train = train_set[:, -1] x_test = test_set[:, 3:-1] y_test = test_set[:, -1] final_list.append([x_train, x_test, y_train, y_test, day]) return final_list def generate_train_test_data_per_5_min(data_set, size=0.0): # test_size = int(len(data_set) * size) # final_list = [] random.shuffle(data_set) test_size = int(len(data_set) * size) big_test = data_set[-test_size:] big_training = data_set[:-test_size] test_set = np.array([item for sublist in big_test for item in sublist]) training_set = np.array([item for sublist in big_training for item in sublist]) print('here') print(training_set[0]) print(test_set[0]) # print('here: ' + str(training_set[0][7])) np.random.shuffle(test_set) np.random.shuffle(training_set) # print('here1: ' + str(training_set[0][7])) x_train = training_set[:, 4:-1] y_train = training_set[:, -1] x_test = test_set[:, 4:-1] y_test = test_set[:, -1] print(len(x_train)) print(len(x_test)) return [x_train, x_test, y_train, y_test] # # print(data_set[0]) # # print(len(data_set)) # # for i in range(len(data_set)): # train_set = data_set[np.arange(len(data_set)) != i] # test_set = np.array(data_set[i]) # five_min = test_set[0][3] # # train_set = np.array([item for sublist in train_set for item in sublist]) # # np.random.shuffle(test_set) # np.random.shuffle(train_set) # x_train = train_set[:, 4:-1] # y_train = train_set[:, -1] # # x_test = test_set[:, 4:-1] # y_test = test_set[:, -1] # # final_list.append([x_train, x_test, y_train, y_test, five_min]) # # return final_list def generate_train_test_data(data_set, size=0.0): test_size = int(len(data_set) * size) big_test = data_set[-test_size:] big_training = data_set[:-test_size] test_set = np.array([item for sublist in big_test for item in sublist]) training_set = np.array([item for sublist in big_training for item in sublist]) # print('here: ' + str(training_set[0][7])) np.random.shuffle(test_set) np.random.shuffle(training_set) # print('here1: ' + str(training_set[0][7])) x_train = training_set[:, 4:-1] y_train = training_set[:, -1] x_test = test_set[:, 4:-1] y_test = test_set[:, -1] return x_train, x_test, y_train, y_test
27.692308
95
0.626263
636
3,960
3.611635
0.11478
0.109708
0.039182
0.028733
0.762734
0.743143
0.715281
0.715281
0.666522
0.629952
0
0.021782
0.234848
3,960
142
96
27.887324
0.736304
0.299747
0
0.4
0
0
0.001834
0
0
0
0
0
0
1
0.066667
false
0
0.1
0
0.233333
0.083333
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
fe2653a60475c4086e297dbee138aca2dfa390dd
51
py
Python
runway/templates/k8s-tf-repo/gen-kubeconfig.cfn/k8s_hooks/__init__.py
paul-duffy/runway
a0c22eb7ca7b55df5317bdda92c08c4bb39569d2
[ "Apache-2.0" ]
134
2018-02-26T21:35:23.000Z
2022-03-03T00:30:27.000Z
runway/templates/k8s-tf-repo/gen-kubeconfig.cfn/k8s_hooks/__init__.py
asksmruti/runway
8aca76df9372e3d13eb35e12f81758f618e89e74
[ "Apache-2.0" ]
937
2018-03-08T22:04:35.000Z
2022-03-30T12:21:47.000Z
runway/templates/k8s-tf-repo/gen-kubeconfig.cfn/k8s_hooks/__init__.py
asksmruti/runway
8aca76df9372e3d13eb35e12f81758f618e89e74
[ "Apache-2.0" ]
70
2018-02-26T23:48:11.000Z
2022-03-02T18:44:30.000Z
"""Empty init file for python import traversal."""
25.5
50
0.72549
7
51
5.285714
1
0
0
0
0
0
0
0
0
0
0
0
0.137255
51
1
51
51
0.840909
0.862745
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
fe2d00f11cb4861f69f4dd4d2aba9ec6fca9b83c
337
py
Python
dandeliondiary/compare/templatetags/compare_extras.py
amberdiehl/dandeliondiary_project
e9bace5bd7980def6ca763840ab5b38f1e05cd3d
[ "FSFAP" ]
null
null
null
dandeliondiary/compare/templatetags/compare_extras.py
amberdiehl/dandeliondiary_project
e9bace5bd7980def6ca763840ab5b38f1e05cd3d
[ "FSFAP" ]
6
2020-04-29T23:54:15.000Z
2022-03-11T23:25:24.000Z
dandeliondiary/compare/templatetags/compare_extras.py
amberdiehl/dandeliondiary_project
e9bace5bd7980def6ca763840ab5b38f1e05cd3d
[ "FSFAP" ]
null
null
null
from django import template register = template.Library() # Returns dictionary value; usage: {{ mydict|get_item:item.NAME }} @register.filter def get_item(dictionary, key): return dictionary.get(key) # Returns array value adjusting index by -1 to assume template loop @register.filter def get_index(d, key): return d[key-1]
21.0625
67
0.744807
49
337
5.061224
0.55102
0.056452
0.137097
0.16129
0
0
0
0
0
0
0
0.007018
0.154303
337
15
68
22.466667
0.863158
0.385757
0
0.25
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.125
0.25
0.625
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4