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
ba1f719590dd68de8a7e622e380fcc6338399207
115
py
Python
sentiweb/forms.py
NewFilmTracker/FilmTrackerWeb
1f09f4cbaf63e233b4c59012dac172c87b252944
[ "MIT" ]
null
null
null
sentiweb/forms.py
NewFilmTracker/FilmTrackerWeb
1f09f4cbaf63e233b4c59012dac172c87b252944
[ "MIT" ]
8
2018-10-16T10:31:10.000Z
2021-12-13T02:04:18.000Z
sentiweb/forms.py
NewFilmTracker/FilmTrackerWeb
1f09f4cbaf63e233b4c59012dac172c87b252944
[ "MIT" ]
2
2018-10-05T09:04:10.000Z
2020-08-31T06:09:58.000Z
from django import forms class SearchForm(forms.Form): query = forms.CharField(required=True, max_length=100)
23
58
0.773913
16
115
5.5
0.875
0
0
0
0
0
0
0
0
0
0
0.03
0.130435
115
4
59
28.75
0.85
0
0
0
0
0
0
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
0
0
0
3
e87f0d509cd113bc949a510b97c1317c698fb70e
212
py
Python
tests/conftest.py
SciKit-Surgery/scikit-surgeryutils
53343632dd8c2663036dcf9da1dcff299c678e8f
[ "BSD-3-Clause" ]
3
2021-02-01T10:20:41.000Z
2021-08-19T03:10:50.000Z
tests/conftest.py
UCL/scikit-surgeryutils
b25933693f435b01f937620bfb8ac5f69e7fe1c6
[ "BSD-3-Clause" ]
39
2020-07-03T09:20:02.000Z
2022-01-25T09:14:36.000Z
tests/conftest.py
UCL/scikit-surgerytutorial01
2e082710247a1a9cd550451d9d2b4af907bb2320
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- import pytest from PySide2.QtWidgets import QApplication @pytest.fixture(scope="session") def setup_qt(): """ Create the QT application. """ app = QApplication([]) return app
21.2
42
0.669811
25
212
5.64
0.8
0
0
0
0
0
0
0
0
0
0
0.011494
0.179245
212
10
43
21.2
0.798851
0.235849
0
0
0
0
0.044872
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
e89c345e7dc179f046d4e74c5f3485182c7715af
3,490
py
Python
dojo/unittests/test_sonarqube_updater.py
everable/django-DefectDojo
1548982c1f197f3f702162846d314b16bb687c78
[ "BSD-3-Clause" ]
1,772
2018-01-22T23:32:15.000Z
2022-03-31T14:49:33.000Z
dojo/unittests/test_sonarqube_updater.py
everable/django-DefectDojo
1548982c1f197f3f702162846d314b16bb687c78
[ "BSD-3-Clause" ]
3,461
2018-01-20T19:12:28.000Z
2022-03-31T17:14:39.000Z
dojo/unittests/test_sonarqube_updater.py
everable/django-DefectDojo
1548982c1f197f3f702162846d314b16bb687c78
[ "BSD-3-Clause" ]
1,173
2018-01-23T07:10:23.000Z
2022-03-31T14:40:43.000Z
from django.test import TestCase from dojo.models import Tool_Configuration, Tool_Type from dojo.tools.sonarqube_api.updater import SonarQubeApiUpdater class TestSonarQubeApiUpdater(TestCase): def setUp(self): tool_type = Tool_Type.objects.create(name='SonarQube') Tool_Configuration.objects.create(name='SonarQube', tool_type=tool_type, authentication_type="API") self.updater = SonarQubeApiUpdater() def test_transitions_for_sonarqube_from_open_1(self): self.assertEquals( self.updater.get_sonarqube_required_transitions_for('OPEN', 'CONFIRMED'), ['confirm'] ) def test_transitions_for_sonarqube_from_open_2(self): self.assertEquals( self.updater.get_sonarqube_required_transitions_for('OPEN', 'RESOLVED / FIXED'), ['resolve'] ) def test_transitions_for_sonarqube_from_reopened_1(self): self.assertEquals( self.updater.get_sonarqube_required_transitions_for('REOPENED', 'RESOLVED / FIXED'), ['resolve'] ) def test_transitions_for_sonarqube_from_reopened_2(self): self.assertEquals( self.updater.get_sonarqube_required_transitions_for('REOPENED', 'CONFIRMED'), ['confirm'] ) def test_transitions_for_sonarqube_from_resolved_1(self): self.assertEquals( self.updater.get_sonarqube_required_transitions_for('RESOLVED / FIXED', 'CONFIRMED'), ['reopen', 'confirm'] ) def test_transitions_for_sonarqube_from_resolved_2(self): self.assertEquals( self.updater.get_sonarqube_required_transitions_for('RESOLVED / FIXED', 'RESOLVED / FALSE-POSITIVE'), ['reopen', 'falsepositive'] ) def test_transitions_for_sonarqube_from_resolved_3(self): self.assertEquals( self.updater.get_sonarqube_required_transitions_for('RESOLVED / FIXED', 'RESOLVED / WONTFIX'), ['reopen', 'wontfix'] ) def test_transitions_for_sonarqube_fake_target_origin(self): self.assertEquals( self.updater.get_sonarqube_required_transitions_for('FAKE_STATUS', 'RESOLVED / FIXED'), None ) def test_transitions_for_sonarqube_fake_target_status(self): self.assertEquals( self.updater.get_sonarqube_required_transitions_for('RESOLVED / FIXED', 'FAKE_STATUS'), None ) def test_transitions_for_sonarqube_from_confirmed_1(self): self.assertEquals( self.updater.get_sonarqube_required_transitions_for('CONFIRMED', 'REOPENED'), ['unconfirm'] ) def test_transitions_for_sonarqube_from_confirmed_2(self): self.assertEquals( self.updater.get_sonarqube_required_transitions_for('CONFIRMED', 'RESOLVED / FIXED'), ['resolve'] ) def test_transitions_for_open_reopen_status_1(self): self.assertEquals( self.updater.get_sonarqube_required_transitions_for('OPEN', 'REOPENED'), None ) def test_transitions_for_open_reopen_status_2(self): self.assertEquals( self.updater.get_sonarqube_required_transitions_for('REOPENED', 'OPEN'), None ) def test_transitions_for_open_reopen_status_3(self): self.assertEquals( self.updater.get_sonarqube_required_transitions_for('REOPENED', 'REOPENED'), None )
35.979381
113
0.677364
361
3,490
6.130194
0.138504
0.177135
0.113873
0.132851
0.808857
0.781744
0.778129
0.639404
0.531405
0.531405
0
0.004476
0.231805
3,490
96
114
36.354167
0.820962
0
0
0.307692
0
0
0.120344
0
0
0
0
0
0.179487
1
0.192308
false
0
0.038462
0
0.24359
0
0
0
0
null
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
e8aaf14458990a530295e471a95ef4645f2041a9
276
py
Python
6 kyu/Valid string.py
mwk0408/codewars_solutions
9b4f502b5f159e68024d494e19a96a226acad5e5
[ "MIT" ]
6
2020-09-03T09:32:25.000Z
2020-12-07T04:10:01.000Z
6 kyu/Valid string.py
mwk0408/codewars_solutions
9b4f502b5f159e68024d494e19a96a226acad5e5
[ "MIT" ]
1
2021-12-13T15:30:21.000Z
2021-12-13T15:30:21.000Z
6 kyu/Valid string.py
mwk0408/codewars_solutions
9b4f502b5f159e68024d494e19a96a226acad5e5
[ "MIT" ]
null
null
null
def valid_word(seq, word): check=set(seq) def helper(count, index): if index>=len(word): return True if count>=1 else False return any(helper(count+1, i) for i in range(index+1, len(word)+1) if word[index:i] in seq) return helper(0, 0)
39.428571
99
0.612319
48
276
3.5
0.458333
0.130952
0
0
0
0
0
0
0
0
0
0.029126
0.253623
276
7
100
39.428571
0.786408
0
0
0
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0
0
0.714286
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
e8b3f173e9c1cb82ea61e751b8c088b30262e491
955
py
Python
dag/tests/test_utils.py
HAL-42/AlchemyCat
ca924755ff48e2ff74543bb0e446376eb2b1f150
[ "Apache-2.0" ]
8
2020-01-08T19:42:01.000Z
2021-12-28T08:30:56.000Z
dag/tests/test_utils.py
HAL-42/AlchemyCat
ca924755ff48e2ff74543bb0e446376eb2b1f150
[ "Apache-2.0" ]
2
2020-09-10T12:22:57.000Z
2022-02-17T05:21:22.000Z
dag/tests/test_utils.py
HAL-42/AlchemyCat
ca924755ff48e2ff74543bb0e446376eb2b1f150
[ "Apache-2.0" ]
1
2021-05-12T01:50:27.000Z
2021-05-12T01:50:27.000Z
import pytest from alchemy_cat.dag.errors import PyungoError from alchemy_cat.dag.utils import get_function_return_names def test_get_function_return_names_simple(): def a(): b = 2 return b assert get_function_return_names(a) == ['b'] def test_get_function_return_names_no_return(): def a(): pass with pytest.raises(PyungoError) as err: get_function_return_names(a) assert str(err.value) == 'No return statement found in a' def test_get_function_return_names_tuple(): def a(): b = 2 c = 3 return b, c assert get_function_return_names(a) == ['b', 'c'] def test_get_function_return_names_not_valid(): def a(): b = 2 c = 3 return b / c with pytest.raises(PyungoError) as err: get_function_return_names(a) msg = 'Variable name or Tuple of variable names are expected, got BinOp' assert str(err.value) == msg
19.489796
76
0.655497
140
955
4.192857
0.321429
0.168654
0.260647
0.337308
0.541738
0.541738
0.344123
0.241908
0.241908
0.187394
0
0.007062
0.258639
955
48
77
19.895833
0.822034
0
0
0.448276
0
0
0.101571
0
0
0
0
0
0.137931
1
0.275862
false
0.034483
0.103448
0
0.482759
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
e8d67250c50c0191200afd9db21690d6259c6dfe
1,241
py
Python
module4-acid-and-database-scalability-tradeoffs/lecture.py
John-G-Thomas/DS-Unit-3-Sprint-2-SQL-and-Databases
63996452fa705f1f032a94e4809bf5a7a692df2a
[ "MIT" ]
null
null
null
module4-acid-and-database-scalability-tradeoffs/lecture.py
John-G-Thomas/DS-Unit-3-Sprint-2-SQL-and-Databases
63996452fa705f1f032a94e4809bf5a7a692df2a
[ "MIT" ]
null
null
null
module4-acid-and-database-scalability-tradeoffs/lecture.py
John-G-Thomas/DS-Unit-3-Sprint-2-SQL-and-Databases
63996452fa705f1f032a94e4809bf5a7a692df2a
[ "MIT" ]
null
null
null
#!/usr/bin/env python import itertools import operator from collections import Iterable, Callable from itertools import product def transform_reduce(lhs: Iterable, rhs: Iterable, transformer: Callable, reducer: Callable): """ Transform Reduce Pairwise transform and then reduction across all results. DocTests: >>> transform_reduce(range(1, 6), range(1, 6), operator.mul, sum) 55 >>> transform_reduce(range(1, 6), range(1, 6), operator.add, product) 3840 @param lhs: Left Iterator @param rhs: Right Iterator @param transformer: Binary Functor F(x, y) -> Value @param reducer: Reduction Functor F(Iterable) -> Value @return: Reduced Value """ return reducer(itertools.starmap(transformer, zip(lhs, rhs))) def inner_product(lhs: Iterable, rhs: Iterable): """ Inner Product Performs pairwise multiplication across the iterables, then returns the sum of the products. DocTests: >>> inner_product(range(1, 6), range(1, 6)) 55 >>> inner_product(range(11), range(11)) 385 @param lhs: Left Iterator @param rhs: Right Iterator @return: Sum of the products. """ return transform_reduce(lhs, rhs, operator.mul, sum)
31.820513
73
0.676068
157
1,241
5.299363
0.375796
0.043269
0.050481
0.043269
0.204327
0.204327
0.1875
0.1875
0.088942
0
0
0.027806
0.217566
1,241
39
74
31.820513
0.829042
0.585818
0
0
0
0
0
0
0
0
0
0
0
1
0.222222
false
0
0.444444
0
0.888889
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
3
2cd71e870641ee6e7fd720bd30bc5b81ff1ac4af
134
py
Python
patient_tracker/apps.py
healthdesk-hackathon/backend
93c43ff1aeff493a6b4d0034807f0434507ab05d
[ "MIT" ]
null
null
null
patient_tracker/apps.py
healthdesk-hackathon/backend
93c43ff1aeff493a6b4d0034807f0434507ab05d
[ "MIT" ]
32
2020-03-27T23:50:02.000Z
2021-09-08T01:54:55.000Z
patient_tracker/apps.py
healthdesk-hackathon/backend
93c43ff1aeff493a6b4d0034807f0434507ab05d
[ "MIT" ]
null
null
null
from django.apps import AppConfig class PatientTrackerConfig(AppConfig): name = 'patient_tracker' verbose_name = 'Hospital'
19.142857
38
0.761194
14
134
7.142857
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.164179
134
6
39
22.333333
0.892857
0
0
0
0
0
0.171642
0
0
0
0
0
0
1
0
false
0
0.25
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
2cdd3aa3e6395018f6c0f8c122657fc4c0fb9a85
118
py
Python
src/gros/utils/const.py
BjoB/gros
5a89df34f03c3768488fb23f3c9c029693cfbfe3
[ "MIT" ]
6
2020-03-30T21:35:51.000Z
2022-01-28T16:24:53.000Z
src/gros/utils/const.py
BjoB/gros
5a89df34f03c3768488fb23f3c9c029693cfbfe3
[ "MIT" ]
null
null
null
src/gros/utils/const.py
BjoB/gros
5a89df34f03c3768488fb23f3c9c029693cfbfe3
[ "MIT" ]
null
null
null
from astropy import constants c = constants.c G = constants.G M_solar = constants.M_sun M_earth = constants.M_earth
14.75
29
0.779661
20
118
4.4
0.5
0.227273
0
0
0
0
0
0
0
0
0
0
0.152542
118
7
30
16.857143
0.88
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
2ce24d2e6e4326a123cdff531a7ee65a4c7fb8a9
60,964
py
Python
pypower/case300.py
Bengt/PYPOWER
78a0f8d4765d147f8237e9a905ef871508ecfee7
[ "BSD-3-Clause" ]
221
2015-01-03T23:18:11.000Z
2022-03-27T10:21:40.000Z
pypower/case300.py
Bengt/PYPOWER
78a0f8d4765d147f8237e9a905ef871508ecfee7
[ "BSD-3-Clause" ]
33
2015-05-12T08:48:02.000Z
2021-11-23T10:35:21.000Z
pypower/case300.py
Bengt/PYPOWER
78a0f8d4765d147f8237e9a905ef871508ecfee7
[ "BSD-3-Clause" ]
114
2015-02-02T15:07:38.000Z
2022-03-22T17:01:55.000Z
# Copyright (c) 1996-2015 PSERC. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. """Power flow data for IEEE 300 bus test case. """ from numpy import array def case300(): """Power flow data for IEEE 300 bus test case. Please see L{caseformat} for details on the case file format. This data was converted from IEEE Common Data Format (ieee300cdf.txt) on 20-Sep-2004 by cdf2matp, rev. 1.11 See end of file for warnings generated during conversion. Converted from IEEE CDF file from: U{http://www.ee.washington.edu/research/pstca/} 13/05/91 CYME INTERNATIONAL 100.0 1991 S IEEE 300-BUS TEST SYSTEM @return: Power flow data for IEEE 300 bus test case. """ ppc = {"version": '2'} ##----- Power Flow Data -----## ## system MVA base ppc["baseMVA"] = 100.0 ## bus data # bus_i type Pd Qd Gs Bs area Vm Va baseKV zone Vmax Vmin ppc["bus"] = array([ [1, 1, 90, 49, 0, 0, 1, 1.0284, 5.95, 115, 1, 1.06, 0.94], [2, 1, 56, 15, 0, 0, 1, 1.0354, 7.74, 115, 1, 1.06, 0.94], [3, 1, 20, 0, 0, 0, 1, 0.9971, 6.64, 230, 1, 1.06, 0.94], [4, 1, 0, 0, 0, 0, 1, 1.0308, 4.71, 345, 1, 1.06, 0.94], [5, 1, 353, 130, 0, 0, 1, 1.0191, 4.68, 115, 1, 1.06, 0.94], [6, 1, 120, 41, 0, 0, 1, 1.0312, 6.99, 115, 1, 1.06, 0.94], [7, 1, 0, 0, 0, 0, 1, 0.9934, 6.19, 230, 1, 1.06, 0.94], [8, 2, 63, 14, 0, 0, 1, 1.0153, 2.4, 115, 1, 1.06, 0.94], [9, 1, 96, 43, 0, 0, 1, 1.0034, 2.85, 115, 1, 1.06, 0.94], [10, 2, 153, 33, 0, 0, 1, 1.0205, 1.35, 230, 1, 1.06, 0.94], [11, 1, 83, 21, 0, 0, 1, 1.0057, 2.46, 115, 1, 1.06, 0.94], [12, 1, 0, 0, 0, 0, 1, 0.9974, 5.21, 230, 1, 1.06, 0.94], [13, 1, 58, 10, 0, 0, 1, 0.9977, -0.55, 115, 1, 1.06, 0.94], [14, 1, 160, 60, 0, 0, 1, 0.9991, -4.81, 115, 1, 1.06, 0.94], [15, 1, 126.7, 23, 0, 0, 1, 1.0343, -8.59, 115, 1, 1.06, 0.94], [16, 1, 0, 0, 0, 0, 1, 1.0315, -2.65, 345, 1, 1.06, 0.94], [17, 1, 561, 220, 0, 0, 1, 1.0649, -13.1, 115, 1, 1.06, 0.94], [19, 1, 0, 0, 0, 0, 1, 0.982, 1.08, 230, 1, 1.06, 0.94], [20, 2, 605, 120, 0, 0, 1, 1.001, -2.46, 115, 1, 1.06, 0.94], [21, 1, 77, 1, 0, 0, 1, 0.9752, 1.62, 230, 1, 1.06, 0.94], [22, 1, 81, 23, 0, 0, 1, 0.9963, -1.97, 115, 1, 1.06, 0.94], [23, 1, 21, 7, 0, 0, 1, 1.0501, 3.94, 115, 1, 1.06, 0.94], [24, 1, 0, 0, 0, 0, 1, 1.0057, 6.02, 230, 1, 1.06, 0.94], [25, 1, 45, 12, 0, 0, 1, 1.0234, 1.44, 115, 1, 1.06, 0.94], [26, 1, 28, 9, 0, 0, 1, 0.9986, -1.73, 115, 1, 1.06, 0.94], [27, 1, 69, 13, 0, 0, 1, 0.975, -4.9, 115, 1, 1.06, 0.94], [33, 1, 55, 6, 0, 0, 1, 1.0244, -12.02, 115, 1, 1.06, 0.94], [34, 1, 0, 0, 0, 0, 1, 1.0414, -7.94, 345, 1, 1.06, 0.94], [35, 1, 0, 0, 0, 0, 1, 0.9757, -25.72, 115, 1, 1.06, 0.94], [36, 1, 0, 0, 0, 0, 1, 1.0011, -22.59, 230, 1, 1.06, 0.94], [37, 1, 85, 32, 0, 0, 1, 1.0201, -11.23, 115, 1, 1.06, 0.94], [38, 1, 155, 18, 0, 0, 1, 1.0202, -12.56, 115, 1, 1.06, 0.94], [39, 1, 0, 0, 0, 0, 1, 1.0535, -5.81, 345, 1, 1.06, 0.94], [40, 1, 46, -21, 0, 0, 1, 1.0216, -12.78, 115, 1, 1.06, 0.94], [41, 1, 86, 0, 0, 0, 1, 1.0292, -10.45, 115, 1, 1.06, 0.94], [42, 1, 0, 0, 0, 0, 1, 1.0448, -7.44, 345, 1, 1.06, 0.94], [43, 1, 39, 9, 0, 0, 1, 1.0006, -16.79, 115, 1, 1.06, 0.94], [44, 1, 195, 29, 0, 0, 1, 1.0086, -17.47, 115, 1, 1.06, 0.94], [45, 1, 0, 0, 0, 0, 1, 1.0215, -14.74, 230, 1, 1.06, 0.94], [46, 1, 0, 0, 0, 0, 1, 1.0344, -11.75, 345, 1, 1.06, 0.94], [47, 1, 58, 11.8, 0, 0, 1, 0.9777, -23.17, 115, 1, 1.06, 0.94], [48, 1, 41, 19, 0, 0, 1, 1.0019, -16.09, 115, 1, 1.06, 0.94], [49, 1, 92, 26, 0, 0, 1, 1.0475, -2.95, 115, 1, 1.06, 0.94], [51, 1, -5, 5, 0, 0, 1, 1.0253, -8.15, 115, 1, 1.06, 0.94], [52, 1, 61, 28, 0, 0, 1, 0.9979, -11.86, 115, 1, 1.06, 0.94], [53, 1, 69, 3, 0, 0, 1, 0.9959, -17.6, 115, 1, 1.06, 0.94], [54, 1, 10, 1, 0, 0, 1, 1.005, -16.25, 115, 1, 1.06, 0.94], [55, 1, 22, 10, 0, 0, 1, 1.015, -12.21, 115, 1, 1.06, 0.94], [57, 1, 98, 20, 0, 0, 1, 1.0335, -8, 115, 1, 1.06, 0.94], [58, 1, 14, 1, 0, 0, 1, 0.9918, -5.99, 115, 1, 1.06, 0.94], [59, 1, 218, 106, 0, 0, 1, 0.9789, -5.29, 115, 1, 1.06, 0.94], [60, 1, 0, 0, 0, 0, 1, 1.0246, -9.56, 230, 1, 1.06, 0.94], [61, 1, 227, 110, 0, 0, 1, 0.9906, -3.47, 115, 1, 1.06, 0.94], [62, 1, 0, 0, 0, 0, 1, 1.016, -1.1, 230, 1, 1.06, 0.94], [63, 2, 70, 30, 0, 0, 1, 0.9583, -17.62, 115, 1, 1.06, 0.94], [64, 1, 0, 0, 0, 0, 1, 0.948, -12.97, 230, 1, 1.06, 0.94], [69, 1, 0, 0, 0, 0, 1, 0.963, -25.66, 115, 1, 1.06, 0.94], [70, 1, 56, 20, 0, 0, 1, 0.9513, -35.16, 115, 1, 1.06, 0.94], [71, 1, 116, 38, 0, 0, 1, 0.9793, -29.88, 115, 1, 1.06, 0.94], [72, 1, 57, 19, 0, 0, 1, 0.9696, -27.48, 115, 1, 1.06, 0.94], [73, 1, 224, 71, 0, 0, 1, 0.9775, -25.77, 115, 1, 1.06, 0.94], [74, 1, 0, 0, 0, 0, 1, 0.9964, -22, 230, 1, 1.06, 0.94], [76, 2, 208, 107, 0, 0, 1, 0.9632, -26.54, 115, 1, 1.06, 0.94], [77, 1, 74, 28, 0, 0, 1, 0.9837, -24.94, 115, 1, 1.06, 0.94], [78, 1, 0, 0, 0, 0, 1, 0.99, -24.05, 115, 1, 1.06, 0.94], [79, 1, 48, 14, 0, 0, 1, 0.982, -24.97, 115, 1, 1.06, 0.94], [80, 1, 28, 7, 0, 0, 1, 0.9872, -24.97, 115, 1, 1.06, 0.94], [81, 1, 0, 0, 0, 0, 1, 1.034, -18.89, 345, 1, 1.06, 0.94], [84, 2, 37, 13, 0, 0, 1, 1.025, -17.16, 115, 1, 1.06, 0.94], [85, 1, 0, 0, 0, 0, 1, 0.9872, -17.68, 230, 1, 1.06, 0.94], [86, 1, 0, 0, 0, 0, 1, 0.9909, -14.19, 230, 1, 1.06, 0.94], [87, 1, 0, 0, 0, 0, 1, 0.9921, -7.77, 230, 1, 1.06, 0.94], [88, 1, 0, 0, 0, 0, 1, 1.0151, -20.96, 230, 1, 1.06, 0.94], [89, 1, 44.2, 0, 0, 0, 1, 1.0317, -11.13, 115, 1, 1.06, 0.94], [90, 1, 66, 0, 0, 0, 1, 1.0272, -11.23, 115, 1, 1.06, 0.94], [91, 2, 17.4, 0, 0, 0, 1, 1.052, -9.4, 115, 1, 1.06, 0.94], [92, 2, 15.8, 0, 0, 0, 1, 1.052, -6.2, 115, 1, 1.06, 0.94], [94, 1, 60.3, 0, 0, 0, 1, 0.993, -9.42, 115, 1, 1.06, 0.94], [97, 1, 39.9, 0, 0, 0, 1, 1.0183, -13.24, 115, 1, 1.06, 0.94], [98, 2, 66.7, 0, 0, 0, 1, 1, -14.6, 115, 1, 1.06, 0.94], [99, 1, 83.5, 0, 0, 0, 1, 0.9894, -20.27, 115, 1, 1.06, 0.94], [100, 1, 0, 0, 0, 0, 1, 1.006, -14.45, 115, 1, 1.06, 0.94], [102, 1, 77.8, 0, 0, 0, 1, 1.0008, -15.23, 115, 1, 1.06, 0.94], [103, 1, 32, 0, 0, 0, 1, 1.0288, -12.06, 115, 1, 1.06, 0.94], [104, 1, 8.6, 0, 0, 0, 1, 0.9958, -17.33, 115, 1, 1.06, 0.94], [105, 1, 49.6, 0, 0, 0, 1, 1.0223, -12.94, 115, 1, 1.06, 0.94], [107, 1, 4.6, 0, 0, 0, 1, 1.0095, -16.03, 115, 1, 1.06, 0.94], [108, 2, 112.1, 0, 0, 0, 1, 0.99, -20.26, 115, 1, 1.06, 0.94], [109, 1, 30.7, 0, 0, 0, 1, 0.9749, -26.06, 115, 1, 1.06, 0.94], [110, 1, 63, 0, 0, 0, 1, 0.973, -24.72, 115, 1, 1.06, 0.94], [112, 1, 19.6, 0, 0, 0, 1, 0.9725, -28.69, 115, 1, 1.06, 0.94], [113, 1, 26.2, 0, 0, 0, 1, 0.97, -25.38, 115, 1, 1.06, 0.94], [114, 1, 18.2, 0, 0, 0, 1, 0.9747, -28.59, 115, 1, 1.06, 0.94], [115, 1, 0, 0, 0, 0, 1, 0.9603, -13.57, 115, 2, 1.06, 0.94], [116, 1, 0, 0, 0, 0, 1, 1.0249, -12.69, 115, 2, 1.06, 0.94], [117, 1, 0, 0, 0, 325, 1, 0.9348, -4.72, 115, 2, 1.06, 0.94], [118, 1, 14.1, 650, 0, 0, 1, 0.9298, -4.12, 115, 2, 1.06, 0.94], [119, 2, 0, 0, 0, 0, 1, 1.0435, 5.17, 115, 2, 1.06, 0.94], [120, 1, 777, 215, 0, 55, 1, 0.9584, -8.77, 115, 2, 1.06, 0.94], [121, 1, 535, 55, 0, 0, 1, 0.9871, -12.64, 115, 2, 1.06, 0.94], [122, 1, 229.1, 11.8, 0, 0, 1, 0.9728, -14.36, 115, 2, 1.06, 0.94], [123, 1, 78, 1.4, 0, 0, 1, 1.0006, -17.64, 115, 2, 1.06, 0.94], [124, 2, 276.4, 59.3, 0, 0, 1, 1.0233, -13.49, 115, 2, 1.06, 0.94], [125, 2, 514.8, 82.7, 0, 0, 1, 1.0103, -18.43, 115, 2, 1.06, 0.94], [126, 1, 57.9, 5.1, 0, 0, 1, 0.9978, -12.86, 115, 2, 1.06, 0.94], [127, 1, 380.8, 37, 0, 0, 1, 1.0001, -10.52, 230, 2, 1.06, 0.94], [128, 1, 0, 0, 0, 0, 1, 1.0024, -4.78, 230, 2, 1.06, 0.94], [129, 1, 0, 0, 0, 0, 1, 1.0028, -4.4, 230, 2, 1.06, 0.94], [130, 1, 0, 0, 0, 0, 1, 1.0191, 5.56, 230, 2, 1.06, 0.94], [131, 1, 0, 0, 0, 0, 1, 0.9861, 6.06, 230, 2, 1.06, 0.94], [132, 1, 0, 0, 0, 0, 1, 1.0045, 3.04, 230, 2, 1.06, 0.94], [133, 1, 0, 0, 0, 0, 1, 1.002, -5.46, 230, 2, 1.06, 0.94], [134, 1, 0, 0, 0, 0, 1, 1.022, -8.04, 230, 2, 1.06, 0.94], [135, 1, 169.2, 41.6, 0, 0, 1, 1.0193, -6.76, 230, 2, 1.06, 0.94], [136, 1, 55.2, 18.2, 0, 0, 1, 1.0476, 1.54, 230, 2, 1.06, 0.94], [137, 1, 273.6, 99.8, 0, 0, 1, 1.0471, -1.45, 230, 2, 1.06, 0.94], [138, 2, 1019.2, 135.2, 0, 0, 1, 1.055, -6.35, 230, 2, 1.06, 0.94], [139, 1, 595, 83.3, 0, 0, 1, 1.0117, -3.57, 115, 2, 1.06, 0.94], [140, 1, 387.7, 114.7, 0, 0, 1, 1.043, -3.44, 230, 2, 1.06, 0.94], [141, 2, 145, 58, 0, 0, 1, 1.051, 0.05, 230, 2, 1.06, 0.94], [142, 1, 56.5, 24.5, 0, 0, 1, 1.0155, -2.77, 230, 2, 1.06, 0.94], [143, 2, 89.5, 35.5, 0, 0, 1, 1.0435, 4.03, 230, 2, 1.06, 0.94], [144, 1, 0, 0, 0, 0, 1, 1.016, -0.7, 230, 2, 1.06, 0.94], [145, 1, 24, 14, 0, 0, 1, 1.0081, -0.16, 230, 2, 1.06, 0.94], [146, 2, 0, 0, 0, 0, 1, 1.0528, 4.32, 230, 2, 1.06, 0.94], [147, 2, 0, 0, 0, 0, 1, 1.0528, 8.36, 230, 2, 1.06, 0.94], [148, 1, 63, 25, 0, 0, 1, 1.0577, 0.28, 230, 2, 1.06, 0.94], [149, 2, 0, 0, 0, 0, 1, 1.0735, 5.23, 230, 2, 1.06, 0.94], [150, 1, 0, 0, 0, 0, 1, 0.9869, 6.34, 230, 2, 1.06, 0.94], [151, 1, 0, 0, 0, 0, 1, 1.0048, 4.13, 230, 2, 1.06, 0.94], [152, 2, 17, 9, 0, 0, 1, 1.0535, 9.24, 230, 2, 1.06, 0.94], [153, 2, 0, 0, 0, 0, 1, 1.0435, 10.46, 230, 2, 1.06, 0.94], [154, 1, 70, 5, 0, 34.5, 1, 0.9663, -1.8, 115, 2, 1.06, 0.94], [155, 1, 200, 50, 0, 0, 1, 1.0177, 6.75, 230, 2, 1.06, 0.94], [156, 2, 75, 50, 0, 0, 1, 0.963, 5.15, 115, 2, 1.06, 0.94], [157, 1, 123.5, -24.3, 0, 0, 1, 0.9845, -11.93, 230, 2, 1.06, 0.94], [158, 1, 0, 0, 0, 0, 1, 0.9987, -11.4, 230, 2, 1.06, 0.94], [159, 1, 33, 16.5, 0, 0, 1, 0.9867, -9.82, 230, 2, 1.06, 0.94], [160, 1, 0, 0, 0, 0, 1, 0.9998, -12.55, 230, 2, 1.06, 0.94], [161, 1, 35, 15, 0, 0, 1, 1.036, 8.85, 230, 2, 1.06, 0.94], [162, 1, 85, 24, 0, 0, 1, 0.9918, 18.5, 230, 2, 1.06, 0.94], [163, 1, 0, 0.4, 0, 0, 1, 1.041, 2.91, 230, 2, 1.06, 0.94], [164, 1, 0, 0, 0, -212, 1, 0.9839, 9.66, 230, 2, 1.06, 0.94], [165, 1, 0, 0, 0, 0, 1, 1.0002, 26.31, 230, 2, 1.06, 0.94], [166, 1, 0, 0, 0, -103, 1, 0.9973, 30.22, 230, 2, 1.06, 0.94], [167, 1, 299.9, 95.7, 0, 0, 1, 0.9715, -6.91, 230, 2, 1.06, 0.94], [168, 1, 0, 0, 0, 0, 1, 1.0024, -4.8, 230, 2, 1.06, 0.94], [169, 1, 0, 0, 0, 0, 1, 0.9879, -6.68, 230, 2, 1.06, 0.94], [170, 2, 481.8, 205, 0, 0, 1, 0.929, 0.09, 115, 2, 1.06, 0.94], [171, 2, 763.6, 291.1, 0, 0, 1, 0.9829, -9.94, 115, 2, 1.06, 0.94], [172, 1, 26.5, 0, 0, 0, 1, 1.0244, -6.22, 115, 2, 1.06, 0.94], [173, 1, 163.5, 43, 0, 53, 1, 0.9837, -12.75, 115, 2, 1.06, 0.94], [174, 1, 0, 0, 0, 0, 1, 1.0622, -2.69, 115, 2, 1.06, 0.94], [175, 1, 176, 83, 0, 0, 1, 0.973, -7.21, 115, 2, 1.06, 0.94], [176, 2, 5, 4, 0, 0, 1, 1.0522, 4.67, 115, 2, 1.06, 0.94], [177, 2, 28, 12, 0, 0, 1, 1.0077, 0.62, 115, 2, 1.06, 0.94], [178, 1, 427.4, 173.6, 0, 0, 1, 0.9397, -6.56, 115, 2, 1.06, 0.94], [179, 1, 74, 29, 0, 45, 1, 0.9699, -9.37, 115, 2, 1.06, 0.94], [180, 1, 69.5, 49.3, 0, 0, 1, 0.9793, -3.09, 115, 2, 1.06, 0.94], [181, 1, 73.4, 0, 0, 0, 1, 1.0518, -1.33, 230, 2, 1.06, 0.94], [182, 1, 240.7, 89, 0, 0, 1, 1.0447, -4.19, 230, 2, 1.06, 0.94], [183, 1, 40, 4, 0, 0, 1, 0.9717, 7.12, 115, 2, 1.06, 0.94], [184, 1, 136.8, 16.6, 0, 0, 1, 1.0386, -6.85, 230, 2, 1.06, 0.94], [185, 2, 0, 0, 0, 0, 1, 1.0522, -4.33, 230, 2, 1.06, 0.94], [186, 2, 59.8, 24.3, 0, 0, 1, 1.065, 2.17, 230, 2, 1.06, 0.94], [187, 2, 59.8, 24.3, 0, 0, 1, 1.065, 1.4, 230, 2, 1.06, 0.94], [188, 1, 182.6, 43.6, 0, 0, 1, 1.0533, -0.72, 230, 2, 1.06, 0.94], [189, 1, 7, 2, 0, 0, 1, 0.9975, -25.84, 66, 3, 1.06, 0.94], [190, 2, 0, 0, 0, -150, 1, 1.0551, -20.62, 345, 3, 1.06, 0.94], [191, 2, 489, 53, 0, 0, 1, 1.0435, 12.25, 230, 3, 1.06, 0.94], [192, 1, 800, 72, 0, 0, 1, 0.9374, -11.18, 230, 3, 1.06, 0.94], [193, 1, 0, 0, 0, 0, 1, 0.9897, -26.09, 66, 3, 1.06, 0.94], [194, 1, 0, 0, 0, 0, 1, 1.0489, -19.21, 345, 3, 1.06, 0.94], [195, 1, 0, 0, 0, 0, 1, 1.0357, -20.79, 345, 3, 1.06, 0.94], [196, 1, 10, 3, 0, 0, 1, 0.9695, -25.32, 115, 3, 1.06, 0.94], [197, 1, 43, 14, 0, 0, 1, 0.9907, -23.72, 115, 3, 1.06, 0.94], [198, 2, 64, 21, 0, 0, 1, 1.015, -20.58, 115, 3, 1.06, 0.94], [199, 1, 35, 12, 0, 0, 1, 0.9528, -26.05, 115, 3, 1.06, 0.94], [200, 1, 27, 12, 0, 0, 1, 0.955, -25.93, 115, 3, 1.06, 0.94], [201, 1, 41, 14, 0, 0, 1, 0.9692, -27.49, 66, 1, 1.06, 0.94], [202, 1, 38, 13, 0, 0, 1, 0.9908, -25.33, 66, 3, 1.06, 0.94], [203, 1, 42, 14, 0, 0, 1, 1.0033, -22.35, 115, 3, 1.06, 0.94], [204, 1, 72, 24, 0, 0, 1, 0.9718, -25.7, 66, 3, 1.06, 0.94], [205, 1, 0, -5, 0, 0, 1, 0.9838, -26.07, 66, 3, 1.06, 0.94], [206, 1, 12, 2, 0, 0, 1, 0.9992, -27.41, 66, 3, 1.06, 0.94], [207, 1, -21, -14.2, 0, 0, 1, 1.0137, -27.44, 66, 1, 1.06, 0.94], [208, 1, 7, 2, 0, 0, 1, 0.9929, -26.28, 66, 3, 1.06, 0.94], [209, 1, 38, 13, 0, 0, 1, 0.9999, -25.66, 66, 3, 1.06, 0.94], [210, 1, 0, 0, 0, 0, 1, 0.9788, -24.22, 115, 3, 1.06, 0.94], [211, 1, 96, 7, 0, 0, 1, 1.0017, -23.31, 115, 3, 1.06, 0.94], [212, 1, 0, 0, 0, 0, 1, 1.0132, -22.51, 138, 3, 1.06, 0.94], [213, 2, 0, 0, 0, 0, 1, 1.01, -11.67, 16.5, 3, 1.06, 0.94], [214, 1, 22, 16, 0, 0, 1, 0.9919, -17.53, 138, 3, 1.06, 0.94], [215, 1, 47, 26, 0, 0, 1, 0.9866, -20.23, 138, 3, 1.06, 0.94], [216, 1, 176, 105, 0, 0, 1, 0.9751, -22.53, 138, 3, 1.06, 0.94], [217, 1, 100, 75, 0, 0, 1, 1.0215, -22.2, 138, 3, 1.06, 0.94], [218, 1, 131, 96, 0, 0, 1, 1.0075, -22.63, 138, 3, 1.06, 0.94], [219, 1, 0, 0, 0, 0, 1, 1.0554, -21.15, 345, 3, 1.06, 0.94], [220, 2, 285, 100, 0, 0, 1, 1.008, -21.73, 138, 3, 1.06, 0.94], [221, 2, 171, 70, 0, 0, 1, 1, -22.49, 138, 3, 1.06, 0.94], [222, 2, 328, 188, 0, 0, 1, 1.05, -23.17, 20, 3, 1.06, 0.94], [223, 1, 428, 232, 0, 0, 1, 0.9965, -22.7, 138, 3, 1.06, 0.94], [224, 1, 173, 99, 0, 0, 1, 1.0002, -21.55, 230, 3, 1.06, 0.94], [225, 1, 410, 40, 0, 0, 1, 0.9453, -11.34, 230, 3, 1.06, 0.94], [226, 1, 0, 0, 0, 0, 1, 1.018, -21.61, 230, 3, 1.06, 0.94], [227, 2, 538, 369, 0, 0, 1, 1, -27.22, 27, 3, 1.06, 0.94], [228, 1, 223, 148, 0, 0, 1, 1.0423, -20.94, 138, 3, 1.06, 0.94], [229, 1, 96, 46, 0, 0, 1, 1.0496, -19.94, 138, 3, 1.06, 0.94], [230, 2, 0, 0, 0, 0, 1, 1.04, -13.82, 20, 3, 1.06, 0.94], [231, 1, 159, 107, 0, -300, 1, 1.0535, -21.22, 345, 3, 1.06, 0.94], [232, 1, 448, 143, 0, 0, 1, 1.0414, -23.19, 138, 3, 1.06, 0.94], [233, 2, 404, 212, 0, 0, 1, 1, -25.9, 66, 3, 1.06, 0.94], [234, 1, 572, 244, 0, 0, 1, 1.0387, -20.89, 138, 3, 1.06, 0.94], [235, 1, 269, 157, 0, 0, 1, 1.0095, -21.03, 138, 3, 1.06, 0.94], [236, 2, 0, 0, 0, 0, 1, 1.0165, -15.4, 20, 3, 1.06, 0.94], [237, 1, 0, 0, 0, 0, 1, 1.0558, -21.1, 345, 3, 1.06, 0.94], [238, 2, 255, 149, 0, -150, 1, 1.01, -20.94, 138, 3, 1.06, 0.94], [239, 2, 0, 0, 0, 0, 1, 1, -15.86, 138, 3, 1.06, 0.94], [240, 1, 0, 0, 0, -140, 1, 1.0237, -20.14, 230, 3, 1.06, 0.94], [241, 2, 0, 0, 0, 0, 1, 1.05, -16.5, 20, 3, 1.06, 0.94], [242, 2, 0, 0, 0, 0, 1, 0.993, -17.53, 138, 3, 1.06, 0.94], [243, 2, 8, 3, 0, 0, 1, 1.01, -19.27, 66, 3, 1.06, 0.94], [244, 1, 0, 0, 0, 0, 1, 0.9921, -20.21, 66, 3, 1.06, 0.94], [245, 1, 61, 30, 0, 0, 1, 0.9711, -20.9, 66, 3, 1.06, 0.94], [246, 1, 77, 33, 0, 0, 1, 0.9651, -21.74, 66, 3, 1.06, 0.94], [247, 1, 61, 30, 0, 0, 1, 0.9688, -21.67, 66, 3, 1.06, 0.94], [248, 1, 29, 14, 0, 45.6, 1, 0.976, -25.23, 66, 3, 1.06, 0.94], [249, 1, 29, 14, 0, 0, 1, 0.9752, -25.65, 66, 3, 1.06, 0.94], [250, 1, -23, -17, 0, 0, 1, 1.0196, -23.8, 66, 3, 1.06, 0.94], [281, 1, -33.1, -29.4, 0, 0, 1, 1.0251, -20.06, 230, 3, 1.06, 0.94], [319, 1, 115.8, -24, 0, 0, 1, 1.0152, 1.48, 230, 1, 1.06, 0.94], [320, 1, 2.4, -12.6, 0, 0, 1, 1.0146, -2.23, 115, 1, 1.06, 0.94], [322, 1, 2.4, -3.9, 0, 0, 1, 1.0005, -17.61, 115, 1, 1.06, 0.94], [323, 1, -14.9, 26.5, 0, 0, 1, 0.981, -13.69, 230, 1, 1.06, 0.94], [324, 1, 24.7, -1.2, 0, 0, 1, 0.975, -23.42, 115, 1, 1.06, 0.94], [526, 1, 145.3, -34.9, 0, 0, 1, 0.9429, -34.31, 115, 1, 1.06, 0.94], [528, 1, 28.1, -20.5, 0, 0, 1, 0.9723, -37.58, 115, 1, 1.06, 0.94], [531, 1, 14, 2.5, 0, 0, 1, 0.9604, -29.1, 115, 1, 1.06, 0.94], [552, 1, -11.1, -1.4, 0, 0, 1, 1.0009, -23.36, 115, 1, 1.06, 0.94], [562, 1, 50.5, 17.4, 0, 0, 1, 0.9777, -28, 230, 1, 1.06, 0.94], [609, 1, 29.6, 0.6, 0, 0, 1, 0.9583, -28.79, 115, 1, 1.06, 0.94], [664, 1, -113.7, 76.7, 0, 0, 1, 1.0309, -17, 345, 3, 1.06, 0.94], [1190, 1, 100.31, 29.17, 0, 0, 1, 1.0128, 3.9, 86, 2, 1.06, 0.94], [1200, 1, -100, 34.17, 0, 0, 1, 1.0244, -7.52, 86, 2, 1.06, 0.94], [1201, 1, 0, 0, 0, 0, 1, 1.0122, -15.18, 115, 2, 1.06, 0.94], [2040, 1, 0, 0, 0, 0, 1, 0.9653, -14.94, 115, 3, 1.06, 0.94], [7001, 2, 0, 0, 0, 0, 1, 1.0507, 10.79, 13.8, 1, 1.06, 0.94], [7002, 2, 0, 0, 0, 0, 1, 1.0507, 12.48, 13.8, 1, 1.06, 0.94], [7003, 2, 0, 0, 0, 0, 1, 1.0323, 13.76, 13.8, 1, 1.06, 0.94], [7011, 2, 0, 0, 0, 0, 1, 1.0145, 4.99, 13.8, 1, 1.06, 0.94], [7012, 2, 0, 0, 0, 0, 1, 1.0507, 11.57, 13.8, 1, 1.06, 0.94], [7017, 2, 0, 0, 0, 0, 1, 1.0507, -10.47, 13.8, 1, 1.06, 0.94], [7023, 2, 0, 0, 0, 0, 1, 1.0507, 6.15, 13.8, 1, 1.06, 0.94], [7024, 2, 0, 0, 0, 0, 1, 1.029, 12.6, 13.8, 1, 1.06, 0.94], [7039, 2, 0, 0, 0, 0, 1, 1.05, 2.11, 20, 1, 1.06, 0.94], [7044, 2, 0, 0, 0, 0, 1, 1.0145, -13.92, 13.8, 1, 1.06, 0.94], [7049, 3, 0, 0, 0, 0, 1, 1.0507, 0, 13.8, 1, 1.06, 0.94], [7055, 2, 0, 0, 0, 0, 1, 0.9967, -7.5, 13.8, 1, 1.06, 0.94], [7057, 2, 0, 0, 0, 0, 1, 1.0212, -3.44, 13.8, 1, 1.06, 0.94], [7061, 2, 0, 0, 0, 0, 1, 1.0145, 1.97, 13.8, 1, 1.06, 0.94], [7062, 2, 0, 0, 0, 0, 1, 1.0017, 5.8, 13.8, 1, 1.06, 0.94], [7071, 2, 0, 0, 0, 0, 1, 0.9893, -25.35, 13.8, 1, 1.06, 0.94], [7130, 2, 0, 0, 0, 0, 1, 1.0507, 19.02, 13.8, 2, 1.06, 0.94], [7139, 2, 0, 0, 0, 0, 1, 1.0507, 2.75, 13.8, 2, 1.06, 0.94], [7166, 2, 0, 0, 0, 0, 1, 1.0145, 35.05, 13.8, 2, 1.06, 0.94], [9001, 1, 0, 0, 0, 0, 1, 1.0117, -11.25, 115, 9, 1.06, 0.94], [9002, 2, 4.2, 0, 0, 0, 1, 0.9945, -18.86, 6.6, 9, 1.06, 0.94], [9003, 1, 2.71, 0.94, 0.14, 2.4, 1, 0.9833, -19.68, 6.6, 9, 1.06, 0.94], [9004, 1, 0.86, 0.28, 0, 0, 1, 0.9768, -19.82, 6.6, 9, 1.06, 0.94], [9005, 1, 0, 0, 0, 0, 1, 1.0117, -11.32, 115, 9, 1.06, 0.94], [9006, 1, 0, 0, 0, 0, 1, 1.0029, -17.42, 6.6, 9, 1.06, 0.94], [9007, 1, 0, 0, 0, 0, 1, 0.9913, -18.69, 6.6, 9, 1.06, 0.94], [9012, 1, 0, 0, 0, 0, 1, 1.0023, -17.27, 6.6, 9, 1.06, 0.94], [9021, 1, 4.75, 1.56, 0, 0, 1, 0.9887, -19.09, 6.6, 9, 1.06, 0.94], [9022, 1, 1.53, 0.53, 0.08, 0, 1, 0.9648, -21.67, 0.6, 9, 1.06, 0.94], [9023, 1, 0, 0, 0, 0, 1, 0.9747, -19.41, 6.6, 9, 1.06, 0.94], [9024, 1, 1.35, 0.47, 0.07, 0, 1, 0.9706, -21.43, 0.6, 9, 1.06, 0.94], [9025, 1, 0.45, 0.16, 0.02, 0, 1, 0.9649, -20.48, 0.6, 9, 1.06, 0.94], [9026, 1, 0.45, 0.16, 0.02, 0, 1, 0.9657, -20.39, 0.6, 9, 1.06, 0.94], [9031, 1, 1.84, 0.64, 0.1, 0, 1, 0.9318, -25.03, 0.6, 9, 1.06, 0.94], [9032, 1, 1.39, 0.48, 0.07, 0, 1, 0.9441, -23.84, 0.6, 9, 1.06, 0.94], [9033, 1, 1.89, 0.65, 0.1, 0, 1, 0.9286, -25.33, 0.6, 9, 1.06, 0.94], [9034, 1, 1.55, 0.54, 0.08, 1.72, 1, 0.9973, -21.1, 0.6, 9, 1.06, 0.94], [9035, 1, 1.66, 0.58, 0.09, 0, 1, 0.9506, -23.19, 0.6, 9, 1.06, 0.94], [9036, 1, 3.03, 1, 0, 0, 1, 0.9598, -22.67, 2.3, 9, 1.06, 0.94], [9037, 1, 1.86, 0.64, 0.1, 0, 1, 0.957, -22.58, 0.6, 9, 1.06, 0.94], [9038, 1, 2.58, 0.89, 0.14, 0, 1, 0.9391, -24.41, 0.6, 9, 1.06, 0.94], [9041, 1, 1.01, 0.35, 0.05, 0, 1, 0.9636, -21.33, 0.6, 9, 1.06, 0.94], [9042, 1, 0.81, 0.28, 0.04, 0, 1, 0.9501, -22.5, 0.6, 9, 1.06, 0.94], [9043, 1, 1.6, 0.52, 0, 0, 1, 0.9646, -21.42, 2.3, 9, 1.06, 0.94], [9044, 1, 0, 0, 0, 0, 1, 0.979, -19.78, 6.6, 9, 1.06, 0.94], [9051, 2, 35.81, 0, 0, 0, 1, 1, -19.4, 13.8, 9, 1.06, 0.94], [9052, 1, 30, 23, 0, 0, 1, 0.9786, -17.25, 13.8, 9, 1.06, 0.94], [9053, 2, 26.48, 0, 0, 0, 1, 1, -17.68, 13.8, 9, 1.06, 0.94], [9054, 2, 0, 0, 0, 0, 1, 1, -6.83, 13.8, 9, 1.06, 0.94], [9055, 2, 0, 0, 0, 0, 1, 1, -7.54, 13.8, 9, 1.06, 0.94], [9071, 1, 1.02, 0.35, 0.05, 0, 1, 0.9752, -20.48, 0.6, 9, 1.06, 0.94], [9072, 1, 1.02, 0.35, 0.05, 0, 1, 0.9803, -19.92, 0.6, 9, 1.06, 0.94], [9121, 1, 3.8, 1.25, 0, 0, 1, 0.9799, -19.3, 6.6, 9, 1.06, 0.94], [9533, 1, 1.19, 0.41, 0.1, 0, 1, 1.0402, -18.24, 2.3, 9, 1.06, 0.94] ]) ## generator data # bus, Pg, Qg, Qmax, Qmin, Vg, mBase, status, Pmax, Pmin, Pc1, Pc2, # Qc1min, Qc1max, Qc2min, Qc2max, ramp_agc, ramp_10, ramp_30, ramp_q, apf ppc["gen"] = array([ [8, 0, 0, 10, -10, 1.0153, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [10, 0, 0, 20, -20, 1.0205, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [20, 0, 0, 20, -20, 1.001, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [63, 0, 0, 25, -25, 0.9583, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [76, 0, 0, 35, 12, 0.9632, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [84, 375, 0, 240, -240, 1.025, 100, 1, 475, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [91, 155, 0, 96, -11, 1.052, 100, 1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [92, 290, 0, 153, -153, 1.052, 100, 1, 390, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [98, 68, 0, 56, -30, 1, 100, 1, 168, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [108, 117, 0, 77, -24, 0.99, 100, 1, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [119, 1930, 0, 1500, -500, 1.0435, 100, 1, 2030, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [124, 240, 0, 120, -60, 1.0233, 100, 1, 340, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [125, 0, 0, 200, -25, 1.0103, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [138, 0, 0, 350, -125, 1.055, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [141, 281, 0, 75, -50, 1.051, 100, 1, 381, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [143, 696, 0, 300, -100, 1.0435, 100, 1, 796, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [146, 84, 0, 35, -15, 1.0528, 100, 1, 184, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [147, 217, 0, 100, -50, 1.0528, 100, 1, 317, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [149, 103, 0, 50, -25, 1.0735, 100, 1, 203, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [152, 372, 0, 175, -50, 1.0535, 100, 1, 472, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [153, 216, 0, 90, -50, 1.0435, 100, 1, 316, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [156, 0, 0, 15, -10, 0.963, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [170, 205, 0, 90, -40, 0.929, 100, 1, 305, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [171, 0, 0, 150, -50, 0.9829, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [176, 228, 0, 90, -45, 1.0522, 100, 1, 328, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [177, 84, 0, 35, -15, 1.0077, 100, 1, 184, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [185, 200, 0, 80, -50, 1.0522, 100, 1, 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [186, 1200, 0, 400, -100, 1.065, 100, 1, 1300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [187, 1200, 0, 400, -100, 1.065, 100, 1, 1300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [190, 475, 0, 300, -300, 1.0551, 100, 1, 575, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [191, 1973, 0, 1000, -1000, 1.0435, 100, 1, 2073, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [198, 424, 0, 260, -260, 1.015, 100, 1, 524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [213, 272, 0, 150, -150, 1.01, 100, 1, 372, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [220, 100, 0, 60, -60, 1.008, 100, 1, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [221, 450, 0, 320, -320, 1, 100, 1, 550, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [222, 250, 0, 300, -300, 1.05, 100, 1, 350, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [227, 303, 0, 300, -300, 1, 100, 1, 403, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [230, 345, 0, 250, -250, 1.04, 100, 1, 445, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [233, 300, 0, 500, -500, 1, 100, 1, 400, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [236, 600, 0, 300, -300, 1.0165, 100, 1, 700, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [238, 250, 0, 200, -200, 1.01, 100, 1, 350, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [239, 550, 0, 400, -400, 1, 100, 1, 650, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [241, 575.43, 0, 600, -600, 1.05, 100, 1, 675.43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [242, 170, 0, 100, 40, 0.993, 100, 1, 270, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [243, 84, 0, 80, 40, 1.01, 100, 1, 184, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7001, 467, 0, 210, -210, 1.0507, 100, 1, 567, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7002, 623, 0, 280, -280, 1.0507, 100, 1, 723, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7003, 1210, 0, 420, -420, 1.0323, 100, 1, 1310, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7011, 234, 0, 100, -100, 1.0145, 100, 1, 334, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7012, 372, 0, 224, -224, 1.0507, 100, 1, 472, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7017, 330, 0, 350, 0, 1.0507, 100, 1, 430, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7023, 185, 0, 120, 0, 1.0507, 100, 1, 285, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7024, 410, 0, 224, -224, 1.029, 100, 1, 510, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7039, 500, 0, 200, -200, 1.05, 100, 1, 600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7044, 37, 0, 42, 0, 1.0145, 100, 1, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7049, 0, 0, 10, 0, 1.0507, 100, 1, 2399.01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7055, 45, 0, 25, 0, 0.9967, 100, 1, 145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7057, 165, 0, 90, -90, 1.0212, 100, 1, 265, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7061, 400, 0, 150, -150, 1.0145, 100, 1, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7062, 400, 0, 150, 0, 1.0017, 100, 1, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7071, 116, 0, 87, 0, 0.9893, 100, 1, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7130, 1292, 0, 600, -100, 1.0507, 100, 1, 1392, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7139, 700, 0, 325, -125, 1.0507, 100, 1, 800, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7166, 553, 0, 300, -200, 1.0145, 100, 1, 653, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [9002, 0, 0, 2, -2, 0.9945, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [9051, 0, 0, 17.35, -17.35, 1, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [9053, 0, 0, 12.83, -12.8, 1, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [9054, 50, 0, 38, -38, 1, 100, 1, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [9055, 8, 0, 6, -6, 1, 100, 1, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ]) ## branch data # fbus, tbus, r, x, b, rateA, rateB, rateC, ratio, angle, status, angmin, angmax ppc["branch"] = array([ [37, 9001, 6e-05, 0.00046, 0, 9900, 0, 75, 1.0082, 0, 1, -360, 360], [9001, 9005, 0.0008, 0.00348, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [9001, 9006, 0.02439, 0.43682, 0, 9900, 0, 0, 0.9668, 0, 1, -360, 360], [9001, 9012, 0.03624, 0.64898, 0, 9900, 0, 0, 0.9796, 0, 1, -360, 360], [9005, 9051, 0.01578, 0.37486, 0, 9900, 0, 0, 1.0435, 0, 1, -360, 360], [9005, 9052, 0.01578, 0.37486, 0, 9900, 0, 0, 0.9391, 0, 1, -360, 360], [9005, 9053, 0.01602, 0.38046, 0, 9900, 0, 0, 1.0435, 0, 1, -360, 360], [9005, 9054, 0, 0.152, 0, 9900, 0, 0, 1.0435, 0, 1, -360, 360], [9005, 9055, 0, 0.8, 0, 9900, 0, 0, 1.0435, 0, 1, -360, 360], [9006, 9007, 0.05558, 0.24666, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [9006, 9003, 0.11118, 0.49332, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [9006, 9003, 0.11118, 0.49332, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [9012, 9002, 0.07622, 0.43286, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [9012, 9002, 0.07622, 0.43286, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [9002, 9021, 0.0537, 0.07026, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [9021, 9023, 1.1068, 0.95278, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [9021, 9022, 0.44364, 2.8152, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9002, 9024, 0.50748, 3.2202, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9023, 9025, 0.66688, 3.944, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9023, 9026, 0.6113, 3.6152, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9007, 9071, 0.4412, 2.9668, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9007, 9072, 0.30792, 2.057, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9007, 9003, 0.0558, 0.24666, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [9003, 9031, 0.73633, 4.6724, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9003, 9032, 0.76978, 4.8846, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9003, 9033, 0.75732, 4.8056, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9003, 9044, 0.07378, 0.06352, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [9044, 9004, 0.03832, 0.02894, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [9004, 9041, 0.36614, 2.456, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9004, 9042, 1.0593, 5.4536, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9004, 9043, 0.1567, 1.6994, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9003, 9034, 0.13006, 1.3912, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9003, 9035, 0.54484, 3.4572, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9003, 9036, 0.15426, 1.6729, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9003, 9037, 0.3849, 2.5712, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9003, 9038, 0.4412, 2.9668, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [9012, 9121, 0.23552, 0.99036, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [9053, 9533, 0, 0.75, 0, 9900, 0, 0, 0.9583, 0, 1, -360, 360], [1, 5, 0.001, 0.006, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [2, 6, 0.001, 0.009, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [2, 8, 0.006, 0.027, 0.054, 9900, 0, 0, 0, 0, 1, -360, 360], [3, 7, 0, 0.003, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [3, 19, 0.008, 0.069, 0.139, 9900, 0, 0, 0, 0, 1, -360, 360], [3, 150, 0.001, 0.007, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [4, 16, 0.002, 0.019, 1.127, 9900, 0, 0, 0, 0, 1, -360, 360], [5, 9, 0.006, 0.029, 0.018, 9900, 0, 0, 0, 0, 1, -360, 360], [7, 12, 0.001, 0.009, 0.07, 9900, 0, 0, 0, 0, 1, -360, 360], [7, 131, 0.001, 0.007, 0.014, 9900, 0, 0, 0, 0, 1, -360, 360], [8, 11, 0.013, 0.0595, 0.033, 9900, 0, 0, 0, 0, 1, -360, 360], [8, 14, 0.013, 0.042, 0.081, 9900, 0, 0, 0, 0, 1, -360, 360], [9, 11, 0.006, 0.027, 0.013, 9900, 0, 0, 0, 0, 1, -360, 360], [11, 13, 0.008, 0.034, 0.018, 9900, 0, 0, 0, 0, 1, -360, 360], [12, 21, 0.002, 0.015, 0.118, 9900, 0, 0, 0, 0, 1, -360, 360], [13, 20, 0.006, 0.034, 0.016, 9900, 0, 0, 0, 0, 1, -360, 360], [14, 15, 0.014, 0.042, 0.097, 9900, 0, 0, 0, 0, 1, -360, 360], [15, 37, 0.065, 0.248, 0.121, 9900, 0, 0, 0, 0, 1, -360, 360], [15, 89, 0.099, 0.248, 0.035, 9900, 0, 0, 0, 0, 1, -360, 360], [15, 90, 0.096, 0.363, 0.048, 9900, 0, 0, 0, 0, 1, -360, 360], [16, 42, 0.002, 0.022, 1.28, 9900, 0, 0, 0, 0, 1, -360, 360], [19, 21, 0.002, 0.018, 0.036, 9900, 0, 0, 0, 0, 1, -360, 360], [19, 87, 0.013, 0.08, 0.151, 9900, 0, 0, 0, 0, 1, -360, 360], [20, 22, 0.016, 0.033, 0.015, 9900, 0, 0, 0, 0, 1, -360, 360], [20, 27, 0.069, 0.186, 0.098, 9900, 0, 0, 0, 0, 1, -360, 360], [21, 24, 0.004, 0.034, 0.28, 9900, 0, 0, 0, 0, 1, -360, 360], [22, 23, 0.052, 0.111, 0.05, 9900, 0, 0, 0, 0, 1, -360, 360], [23, 25, 0.019, 0.039, 0.018, 9900, 0, 0, 0, 0, 1, -360, 360], [24, 319, 0.007, 0.068, 0.134, 9900, 0, 0, 0, 0, 1, -360, 360], [25, 26, 0.036, 0.071, 0.034, 9900, 0, 0, 0, 0, 1, -360, 360], [26, 27, 0.045, 0.12, 0.065, 9900, 0, 0, 0, 0, 1, -360, 360], [26, 320, 0.043, 0.13, 0.014, 9900, 0, 0, 0, 0, 1, -360, 360], [33, 34, 0, 0.063, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [33, 38, 0.0025, 0.012, 0.013, 9900, 0, 0, 0, 0, 1, -360, 360], [33, 40, 0.006, 0.029, 0.02, 9900, 0, 0, 0, 0, 1, -360, 360], [33, 41, 0.007, 0.043, 0.026, 9900, 0, 0, 0, 0, 1, -360, 360], [34, 42, 0.001, 0.008, 0.042, 9900, 0, 0, 0, 0, 1, -360, 360], [35, 72, 0.012, 0.06, 0.008, 9900, 0, 0, 0, 0, 1, -360, 360], [35, 76, 0.006, 0.014, 0.002, 9900, 0, 0, 0, 0, 1, -360, 360], [35, 77, 0.01, 0.029, 0.003, 9900, 0, 0, 0, 0, 1, -360, 360], [36, 88, 0.004, 0.027, 0.043, 9900, 0, 0, 0, 0, 1, -360, 360], [37, 38, 0.008, 0.047, 0.008, 9900, 0, 0, 0, 0, 1, -360, 360], [37, 40, 0.022, 0.064, 0.007, 9900, 0, 0, 0, 0, 1, -360, 360], [37, 41, 0.01, 0.036, 0.02, 9900, 0, 0, 0, 0, 1, -360, 360], [37, 49, 0.017, 0.081, 0.048, 9900, 0, 0, 0, 0, 1, -360, 360], [37, 89, 0.102, 0.254, 0.033, 9900, 0, 0, 0, 0, 1, -360, 360], [37, 90, 0.047, 0.127, 0.016, 9900, 0, 0, 0, 0, 1, -360, 360], [38, 41, 0.008, 0.037, 0.02, 9900, 0, 0, 0, 0, 1, -360, 360], [38, 43, 0.032, 0.087, 0.04, 9900, 0, 0, 0, 0, 1, -360, 360], [39, 42, 0.0006, 0.0064, 0.404, 9900, 0, 0, 0, 0, 1, -360, 360], [40, 48, 0.026, 0.154, 0.022, 9900, 0, 0, 0, 0, 1, -360, 360], [41, 42, 0, 0.029, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [41, 49, 0.065, 0.191, 0.02, 9900, 0, 0, 0, 0, 1, -360, 360], [41, 51, 0.031, 0.089, 0.036, 9900, 0, 0, 0, 0, 1, -360, 360], [42, 46, 0.002, 0.014, 0.806, 9900, 0, 0, 0, 0, 1, -360, 360], [43, 44, 0.026, 0.072, 0.035, 9900, 0, 0, 0, 0, 1, -360, 360], [43, 48, 0.095, 0.262, 0.032, 9900, 0, 0, 0, 0, 1, -360, 360], [43, 53, 0.013, 0.039, 0.016, 9900, 0, 0, 0, 0, 1, -360, 360], [44, 47, 0.027, 0.084, 0.039, 9900, 0, 0, 0, 0, 1, -360, 360], [44, 54, 0.028, 0.084, 0.037, 9900, 0, 0, 0, 0, 1, -360, 360], [45, 60, 0.007, 0.041, 0.312, 9900, 0, 0, 0, 0, 1, -360, 360], [45, 74, 0.009, 0.054, 0.411, 9900, 0, 0, 0, 0, 1, -360, 360], [46, 81, 0.005, 0.042, 0.69, 9900, 0, 0, 0, 0, 1, -360, 360], [47, 73, 0.052, 0.145, 0.073, 9900, 0, 0, 0, 0, 1, -360, 360], [47, 113, 0.043, 0.118, 0.013, 9900, 0, 0, 0, 0, 1, -360, 360], [48, 107, 0.025, 0.062, 0.007, 9900, 0, 0, 0, 0, 1, -360, 360], [49, 51, 0.031, 0.094, 0.043, 9900, 0, 0, 0, 0, 1, -360, 360], [51, 52, 0.037, 0.109, 0.049, 9900, 0, 0, 0, 0, 1, -360, 360], [52, 55, 0.027, 0.08, 0.036, 9900, 0, 0, 0, 0, 1, -360, 360], [53, 54, 0.025, 0.073, 0.035, 9900, 0, 0, 0, 0, 1, -360, 360], [54, 55, 0.035, 0.103, 0.047, 9900, 0, 0, 0, 0, 1, -360, 360], [55, 57, 0.065, 0.169, 0.082, 9900, 0, 0, 0, 0, 1, -360, 360], [57, 58, 0.046, 0.08, 0.036, 9900, 0, 0, 0, 0, 1, -360, 360], [57, 63, 0.159, 0.537, 0.071, 9900, 0, 0, 0, 0, 1, -360, 360], [58, 59, 0.009, 0.026, 0.005, 9900, 0, 0, 0, 0, 1, -360, 360], [59, 61, 0.002, 0.013, 0.015, 9900, 0, 0, 0, 0, 1, -360, 360], [60, 62, 0.009, 0.065, 0.485, 9900, 0, 0, 0, 0, 1, -360, 360], [62, 64, 0.016, 0.105, 0.203, 9900, 0, 0, 0, 0, 1, -360, 360], [62, 144, 0.001, 0.007, 0.013, 9900, 0, 0, 0, 0, 1, -360, 360], [63, 526, 0.0265, 0.172, 0.026, 9900, 0, 0, 0, 0, 1, -360, 360], [69, 211, 0.051, 0.232, 0.028, 9900, 0, 0, 0, 0, 1, -360, 360], [69, 79, 0.051, 0.157, 0.023, 9900, 0, 0, 0, 0, 1, -360, 360], [70, 71, 0.032, 0.1, 0.062, 9900, 0, 0, 0, 0, 1, -360, 360], [70, 528, 0.02, 0.1234, 0.028, 9900, 0, 0, 0, 0, 1, -360, 360], [71, 72, 0.036, 0.131, 0.068, 9900, 0, 0, 0, 0, 1, -360, 360], [71, 73, 0.034, 0.099, 0.047, 9900, 0, 0, 0, 0, 1, -360, 360], [72, 77, 0.018, 0.087, 0.011, 9900, 0, 0, 0, 0, 1, -360, 360], [72, 531, 0.0256, 0.193, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [73, 76, 0.021, 0.057, 0.03, 9900, 0, 0, 0, 0, 1, -360, 360], [73, 79, 0.018, 0.052, 0.018, 9900, 0, 0, 0, 0, 1, -360, 360], [74, 88, 0.004, 0.027, 0.05, 9900, 0, 0, 0, 0, 1, -360, 360], [74, 562, 0.0286, 0.2013, 0.379, 9900, 0, 0, 0, 0, 1, -360, 360], [76, 77, 0.016, 0.043, 0.004, 9900, 0, 0, 0, 0, 1, -360, 360], [77, 78, 0.001, 0.006, 0.007, 9900, 0, 0, 0, 0, 1, -360, 360], [77, 80, 0.014, 0.07, 0.038, 9900, 0, 0, 0, 0, 1, -360, 360], [77, 552, 0.0891, 0.2676, 0.029, 9900, 0, 0, 0, 0, 1, -360, 360], [77, 609, 0.0782, 0.2127, 0.022, 9900, 0, 0, 0, 0, 1, -360, 360], [78, 79, 0.006, 0.022, 0.011, 9900, 0, 0, 0, 0, 1, -360, 360], [78, 84, 0, 0.036, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [79, 211, 0.099, 0.375, 0.051, 9900, 0, 0, 0, 0, 1, -360, 360], [80, 211, 0.022, 0.107, 0.058, 9900, 0, 0, 0, 0, 1, -360, 360], [81, 194, 0.0035, 0.033, 0.53, 9900, 0, 0, 0, 0, 1, -360, 360], [81, 195, 0.0035, 0.033, 0.53, 9900, 0, 0, 0, 0, 1, -360, 360], [85, 86, 0.008, 0.064, 0.128, 9900, 0, 0, 0, 0, 1, -360, 360], [86, 87, 0.012, 0.093, 0.183, 9900, 0, 0, 0, 0, 1, -360, 360], [86, 323, 0.006, 0.048, 0.092, 9900, 0, 0, 0, 0, 1, -360, 360], [89, 91, 0.047, 0.119, 0.014, 9900, 0, 0, 0, 0, 1, -360, 360], [90, 92, 0.032, 0.174, 0.024, 9900, 0, 0, 0, 0, 1, -360, 360], [91, 94, 0.1, 0.253, 0.031, 9900, 0, 0, 0, 0, 1, -360, 360], [91, 97, 0.022, 0.077, 0.039, 9900, 0, 0, 0, 0, 1, -360, 360], [92, 103, 0.019, 0.144, 0.017, 9900, 0, 0, 0, 0, 1, -360, 360], [92, 105, 0.017, 0.092, 0.012, 9900, 0, 0, 0, 0, 1, -360, 360], [94, 97, 0.278, 0.427, 0.043, 9900, 0, 0, 0, 0, 1, -360, 360], [97, 100, 0.022, 0.053, 0.007, 9900, 0, 0, 0, 0, 1, -360, 360], [97, 102, 0.038, 0.092, 0.012, 9900, 0, 0, 0, 0, 1, -360, 360], [97, 103, 0.048, 0.122, 0.015, 9900, 0, 0, 0, 0, 1, -360, 360], [98, 100, 0.024, 0.064, 0.007, 9900, 0, 0, 0, 0, 1, -360, 360], [98, 102, 0.034, 0.121, 0.015, 9900, 0, 0, 0, 0, 1, -360, 360], [99, 107, 0.053, 0.135, 0.017, 9900, 0, 0, 0, 0, 1, -360, 360], [99, 108, 0.002, 0.004, 0.002, 9900, 0, 0, 0, 0, 1, -360, 360], [99, 109, 0.045, 0.354, 0.044, 9900, 0, 0, 0, 0, 1, -360, 360], [99, 110, 0.05, 0.174, 0.022, 9900, 0, 0, 0, 0, 1, -360, 360], [100, 102, 0.016, 0.038, 0.004, 9900, 0, 0, 0, 0, 1, -360, 360], [102, 104, 0.043, 0.064, 0.027, 9900, 0, 0, 0, 0, 1, -360, 360], [103, 105, 0.019, 0.062, 0.008, 9900, 0, 0, 0, 0, 1, -360, 360], [104, 108, 0.076, 0.13, 0.044, 9900, 0, 0, 0, 0, 1, -360, 360], [104, 322, 0.044, 0.124, 0.015, 9900, 0, 0, 0, 0, 1, -360, 360], [105, 107, 0.012, 0.088, 0.011, 9900, 0, 0, 0, 0, 1, -360, 360], [105, 110, 0.157, 0.4, 0.047, 9900, 0, 0, 0, 0, 1, -360, 360], [108, 324, 0.074, 0.208, 0.026, 9900, 0, 0, 0, 0, 1, -360, 360], [109, 110, 0.07, 0.184, 0.021, 9900, 0, 0, 0, 0, 1, -360, 360], [109, 113, 0.1, 0.274, 0.031, 9900, 0, 0, 0, 0, 1, -360, 360], [109, 114, 0.109, 0.393, 0.036, 9900, 0, 0, 0, 0, 1, -360, 360], [110, 112, 0.142, 0.404, 0.05, 9900, 0, 0, 0, 0, 1, -360, 360], [112, 114, 0.017, 0.042, 0.006, 9900, 0, 0, 0, 0, 1, -360, 360], [115, 122, 0.0036, 0.0199, 0.004, 9900, 0, 0, 0, 0, 1, -360, 360], [116, 120, 0.002, 0.1049, 0.001, 9900, 0, 0, 0, 0, 1, -360, 360], [117, 118, 0.0001, 0.0018, 0.017, 9900, 0, 0, 0, 0, 1, -360, 360], [118, 119, 0, 0.0271, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [118, 1201, 0, 0.6163, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [1201, 120, 0, -0.3697, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [118, 121, 0.0022, 0.2915, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [119, 120, 0, 0.0339, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [119, 121, 0, 0.0582, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [122, 123, 0.0808, 0.2344, 0.029, 9900, 0, 0, 0, 0, 1, -360, 360], [122, 125, 0.0965, 0.3669, 0.054, 9900, 0, 0, 0, 0, 1, -360, 360], [123, 124, 0.036, 0.1076, 0.117, 9900, 0, 0, 0, 0, 1, -360, 360], [123, 125, 0.0476, 0.1414, 0.149, 9900, 0, 0, 0, 0, 1, -360, 360], [125, 126, 0.0006, 0.0197, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [126, 127, 0.0059, 0.0405, 0.25, 9900, 0, 0, 0, 0, 1, -360, 360], [126, 129, 0.0115, 0.1106, 0.185, 9900, 0, 0, 0, 0, 1, -360, 360], [126, 132, 0.0198, 0.1688, 0.321, 9900, 0, 0, 0, 0, 1, -360, 360], [126, 157, 0.005, 0.05, 0.33, 9900, 0, 0, 0, 0, 1, -360, 360], [126, 158, 0.0077, 0.0538, 0.335, 9900, 0, 0, 0, 0, 1, -360, 360], [126, 169, 0.0165, 0.1157, 0.171, 9900, 0, 0, 0, 0, 1, -360, 360], [127, 128, 0.0059, 0.0577, 0.095, 9900, 0, 0, 0, 0, 1, -360, 360], [127, 134, 0.0049, 0.0336, 0.208, 9900, 0, 0, 0, 0, 1, -360, 360], [127, 168, 0.0059, 0.0577, 0.095, 9900, 0, 0, 0, 0, 1, -360, 360], [128, 130, 0.0078, 0.0773, 0.126, 9900, 0, 0, 0, 0, 1, -360, 360], [128, 133, 0.0026, 0.0193, 0.03, 9900, 0, 0, 0, 0, 1, -360, 360], [129, 130, 0.0076, 0.0752, 0.122, 9900, 0, 0, 0, 0, 1, -360, 360], [129, 133, 0.0021, 0.0186, 0.03, 9900, 0, 0, 0, 0, 1, -360, 360], [130, 132, 0.0016, 0.0164, 0.026, 9900, 0, 0, 0, 0, 1, -360, 360], [130, 151, 0.0017, 0.0165, 0.026, 9900, 0, 0, 0, 0, 1, -360, 360], [130, 167, 0.0079, 0.0793, 0.127, 9900, 0, 0, 0, 0, 1, -360, 360], [130, 168, 0.0078, 0.0784, 0.125, 9900, 0, 0, 0, 0, 1, -360, 360], [133, 137, 0.0017, 0.0117, 0.289, 9900, 0, 0, 0, 0, 1, -360, 360], [133, 168, 0.0026, 0.0193, 0.03, 9900, 0, 0, 0, 0, 1, -360, 360], [133, 169, 0.0021, 0.0186, 0.03, 9900, 0, 0, 0, 0, 1, -360, 360], [133, 171, 0.0002, 0.0101, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [134, 135, 0.0043, 0.0293, 0.18, 9900, 0, 0, 0, 0, 1, -360, 360], [134, 184, 0.0039, 0.0381, 0.258, 9900, 0, 0, 0, 0, 1, -360, 360], [135, 136, 0.0091, 0.0623, 0.385, 9900, 0, 0, 0, 0, 1, -360, 360], [136, 137, 0.0125, 0.089, 0.54, 9900, 0, 0, 0, 0, 1, -360, 360], [136, 152, 0.0056, 0.039, 0.953, 9900, 0, 0, 0, 0, 1, -360, 360], [137, 140, 0.0015, 0.0114, 0.284, 9900, 0, 0, 0, 0, 1, -360, 360], [137, 181, 0.0005, 0.0034, 0.021, 9900, 0, 0, 0, 0, 1, -360, 360], [137, 186, 0.0007, 0.0151, 0.126, 9900, 0, 0, 0, 0, 1, -360, 360], [137, 188, 0.0005, 0.0034, 0.021, 9900, 0, 0, 0, 0, 1, -360, 360], [139, 172, 0.0562, 0.2248, 0.081, 9900, 0, 0, 0, 0, 1, -360, 360], [140, 141, 0.012, 0.0836, 0.123, 9900, 0, 0, 0, 0, 1, -360, 360], [140, 142, 0.0152, 0.1132, 0.684, 9900, 0, 0, 0, 0, 1, -360, 360], [140, 145, 0.0468, 0.3369, 0.519, 9900, 0, 0, 0, 0, 1, -360, 360], [140, 146, 0.043, 0.3031, 0.463, 9900, 0, 0, 0, 0, 1, -360, 360], [140, 147, 0.0489, 0.3492, 0.538, 9900, 0, 0, 0, 0, 1, -360, 360], [140, 182, 0.0013, 0.0089, 0.119, 9900, 0, 0, 0, 0, 1, -360, 360], [141, 146, 0.0291, 0.2267, 0.342, 9900, 0, 0, 0, 0, 1, -360, 360], [142, 143, 0.006, 0.057, 0.767, 9900, 0, 0, 0, 0, 1, -360, 360], [143, 145, 0.0075, 0.0773, 0.119, 9900, 0, 0, 0, 0, 1, -360, 360], [143, 149, 0.0127, 0.0909, 0.135, 9900, 0, 0, 0, 0, 1, -360, 360], [145, 146, 0.0085, 0.0588, 0.087, 9900, 0, 0, 0, 0, 1, -360, 360], [145, 149, 0.0218, 0.1511, 0.223, 9900, 0, 0, 0, 0, 1, -360, 360], [146, 147, 0.0073, 0.0504, 0.074, 9900, 0, 0, 0, 0, 1, -360, 360], [148, 178, 0.0523, 0.1526, 0.074, 9900, 0, 0, 0, 0, 1, -360, 360], [148, 179, 0.1371, 0.3919, 0.076, 9900, 0, 0, 0, 0, 1, -360, 360], [152, 153, 0.0137, 0.0957, 0.141, 9900, 0, 0, 0, 0, 1, -360, 360], [153, 161, 0.0055, 0.0288, 0.19, 9900, 0, 0, 0, 0, 1, -360, 360], [154, 156, 0.1746, 0.3161, 0.04, 9900, 0, 0, 0, 0, 1, -360, 360], [154, 183, 0.0804, 0.3054, 0.045, 9900, 0, 0, 0, 0, 1, -360, 360], [155, 161, 0.011, 0.0568, 0.388, 9900, 0, 0, 0, 0, 1, -360, 360], [157, 159, 0.0008, 0.0098, 0.069, 9900, 0, 0, 0, 0, 1, -360, 360], [158, 159, 0.0029, 0.0285, 0.19, 9900, 0, 0, 0, 0, 1, -360, 360], [158, 160, 0.0066, 0.0448, 0.277, 9900, 0, 0, 0, 0, 1, -360, 360], [162, 164, 0.0024, 0.0326, 0.236, 9900, 0, 0, 0, 0, 1, -360, 360], [162, 165, 0.0018, 0.0245, 1.662, 9900, 0, 0, 0, 0, 1, -360, 360], [163, 164, 0.0044, 0.0514, 3.597, 9900, 0, 0, 0, 0, 1, -360, 360], [165, 166, 0.0002, 0.0123, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [167, 169, 0.0018, 0.0178, 0.029, 9900, 0, 0, 0, 0, 1, -360, 360], [172, 173, 0.0669, 0.4843, 0.063, 9900, 0, 0, 0, 0, 1, -360, 360], [172, 174, 0.0558, 0.221, 0.031, 9900, 0, 0, 0, 0, 1, -360, 360], [173, 174, 0.0807, 0.3331, 0.049, 9900, 0, 0, 0, 0, 1, -360, 360], [173, 175, 0.0739, 0.3071, 0.043, 9900, 0, 0, 0, 0, 1, -360, 360], [173, 176, 0.1799, 0.5017, 0.069, 9900, 0, 0, 0, 0, 1, -360, 360], [175, 176, 0.0904, 0.3626, 0.048, 9900, 0, 0, 0, 0, 1, -360, 360], [175, 179, 0.077, 0.3092, 0.054, 9900, 0, 0, 0, 0, 1, -360, 360], [176, 177, 0.0251, 0.0829, 0.047, 9900, 0, 0, 0, 0, 1, -360, 360], [177, 178, 0.0222, 0.0847, 0.05, 9900, 0, 0, 0, 0, 1, -360, 360], [178, 179, 0.0498, 0.1855, 0.029, 9900, 0, 0, 0, 0, 1, -360, 360], [178, 180, 0.0061, 0.029, 0.084, 9900, 0, 0, 0, 0, 1, -360, 360], [181, 138, 0.0004, 0.0202, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [181, 187, 0.0004, 0.0083, 0.115, 9900, 0, 0, 0, 0, 1, -360, 360], [184, 185, 0.0025, 0.0245, 0.164, 9900, 0, 0, 0, 0, 1, -360, 360], [186, 188, 0.0007, 0.0086, 0.115, 9900, 0, 0, 0, 0, 1, -360, 360], [187, 188, 0.0007, 0.0086, 0.115, 9900, 0, 0, 0, 0, 1, -360, 360], [188, 138, 0.0004, 0.0202, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [189, 208, 0.033, 0.095, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [189, 209, 0.046, 0.069, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [190, 231, 0.0004, 0.0022, 6.2, 9900, 0, 0, 0, 0, 1, -360, 360], [190, 240, 0, 0.0275, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [191, 192, 0.003, 0.048, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [192, 225, 0.002, 0.009, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [193, 205, 0.045, 0.063, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [193, 208, 0.048, 0.127, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [194, 219, 0.0031, 0.0286, 0.5, 9900, 0, 0, 0, 0, 1, -360, 360], [194, 664, 0.0024, 0.0355, 0.36, 9900, 0, 0, 0, 0, 1, -360, 360], [195, 219, 0.0031, 0.0286, 0.5, 9900, 0, 0, 0, 0, 1, -360, 360], [196, 197, 0.014, 0.04, 0.004, 9900, 0, 0, 0, 0, 1, -360, 360], [196, 210, 0.03, 0.081, 0.01, 9900, 0, 0, 0, 0, 1, -360, 360], [197, 198, 0.01, 0.06, 0.009, 9900, 0, 0, 0, 0, 1, -360, 360], [197, 211, 0.015, 0.04, 0.006, 9900, 0, 0, 0, 0, 1, -360, 360], [198, 202, 0.332, 0.688, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [198, 203, 0.009, 0.046, 0.025, 9900, 0, 0, 0, 0, 1, -360, 360], [198, 210, 0.02, 0.073, 0.008, 9900, 0, 0, 0, 0, 1, -360, 360], [198, 211, 0.034, 0.109, 0.032, 9900, 0, 0, 0, 0, 1, -360, 360], [199, 200, 0.076, 0.135, 0.009, 9900, 0, 0, 0, 0, 1, -360, 360], [199, 210, 0.04, 0.102, 0.005, 9900, 0, 0, 0, 0, 1, -360, 360], [200, 210, 0.081, 0.128, 0.014, 9900, 0, 0, 0, 0, 1, -360, 360], [201, 204, 0.124, 0.183, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [203, 211, 0.01, 0.059, 0.008, 9900, 0, 0, 0, 0, 1, -360, 360], [204, 205, 0.046, 0.068, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [205, 206, 0.302, 0.446, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [206, 207, 0.073, 0.093, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [206, 208, 0.24, 0.421, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [212, 215, 0.0139, 0.0778, 0.086, 9900, 0, 0, 0, 0, 1, -360, 360], [213, 214, 0.0025, 0.038, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [214, 215, 0.0017, 0.0185, 0.02, 9900, 0, 0, 0, 0, 1, -360, 360], [214, 242, 0.0015, 0.0108, 0.002, 9900, 0, 0, 0, 0, 1, -360, 360], [215, 216, 0.0045, 0.0249, 0.026, 9900, 0, 0, 0, 0, 1, -360, 360], [216, 217, 0.004, 0.0497, 0.018, 9900, 0, 0, 0, 0, 1, -360, 360], [217, 218, 0, 0.0456, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [217, 219, 0.0005, 0.0177, 0.02, 9900, 0, 0, 0, 0, 1, -360, 360], [217, 220, 0.0027, 0.0395, 0.832, 9900, 0, 0, 0, 0, 1, -360, 360], [219, 237, 0.0003, 0.0018, 5.2, 9900, 0, 0, 0, 0, 1, -360, 360], [220, 218, 0.0037, 0.0484, 0.43, 9900, 0, 0, 0, 0, 1, -360, 360], [220, 221, 0.001, 0.0295, 0.503, 9900, 0, 0, 0, 0, 1, -360, 360], [220, 238, 0.0016, 0.0046, 0.402, 9900, 0, 0, 0, 0, 1, -360, 360], [221, 223, 0.0003, 0.0013, 1, 9900, 0, 0, 0, 0, 1, -360, 360], [222, 237, 0.0014, 0.0514, 0.33, 9900, 0, 0, 1, 0, 1, -360, 360], [224, 225, 0.01, 0.064, 0.48, 9900, 0, 0, 0, 0, 1, -360, 360], [224, 226, 0.0019, 0.0081, 0.86, 9900, 0, 0, 0, 0, 1, -360, 360], [225, 191, 0.001, 0.061, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [226, 231, 0.0005, 0.0212, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [227, 231, 0.0009, 0.0472, 0.186, 9900, 0, 0, 1, 0, 1, -360, 360], [228, 229, 0.0019, 0.0087, 1.28, 9900, 0, 0, 0, 0, 1, -360, 360], [228, 231, 0.0026, 0.0917, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [228, 234, 0.0013, 0.0288, 0.81, 9900, 0, 0, 0, 0, 1, -360, 360], [229, 190, 0, 0.0626, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [231, 232, 0.0002, 0.0069, 1.364, 9900, 0, 0, 0, 0, 1, -360, 360], [231, 237, 0.0001, 0.0006, 3.57, 9900, 0, 0, 0, 0, 1, -360, 360], [232, 233, 0.0017, 0.0485, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [234, 235, 0.0002, 0.0259, 0.144, 9900, 0, 0, 0, 0, 1, -360, 360], [234, 237, 0.0006, 0.0272, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [235, 238, 0.0002, 0.0006, 0.8, 9900, 0, 0, 0, 0, 1, -360, 360], [241, 237, 0.0005, 0.0154, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [240, 281, 0.0003, 0.0043, 0.009, 9900, 0, 0, 0, 0, 1, -360, 360], [242, 245, 0.0082, 0.0851, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [242, 247, 0.0112, 0.0723, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [243, 244, 0.0127, 0.0355, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [243, 245, 0.0326, 0.1804, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [244, 246, 0.0195, 0.0551, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [245, 246, 0.0157, 0.0732, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [245, 247, 0.036, 0.2119, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [246, 247, 0.0268, 0.1285, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [247, 248, 0.0428, 0.1215, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [248, 249, 0.0351, 0.1004, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [249, 250, 0.0616, 0.1857, 0, 9900, 0, 0, 0, 0, 1, -360, 360], [3, 1, 0, 0.052, 0, 9900, 0, 0, 0.947, 0, 1, -360, 360], [3, 2, 0, 0.052, 0, 9900, 0, 0, 0.956, 0, 1, -360, 360], [3, 4, 0, 0.005, 0, 9900, 0, 0, 0.971, 0, 1, -360, 360], [7, 5, 0, 0.039, 0, 9900, 0, 0, 0.948, 0, 1, -360, 360], [7, 6, 0, 0.039, 0, 9900, 0, 0, 0.959, 0, 1, -360, 360], [10, 11, 0, 0.089, 0, 9900, 0, 0, 1.046, 0, 1, -360, 360], [12, 10, 0, 0.053, 0, 9900, 0, 0, 0.985, 0, 1, -360, 360], [15, 17, 0.0194, 0.0311, 0, 9900, 0, 0, 0.9561, 0, 1, -360, 360], [16, 15, 0.001, 0.038, 0, 9900, 0, 0, 0.971, 0, 1, -360, 360], [21, 20, 0, 0.014, 0, 9900, 0, 0, 0.952, 0, 1, -360, 360], [24, 23, 0, 0.064, 0, 9900, 0, 0, 0.943, 0, 1, -360, 360], [36, 35, 0, 0.047, 0, 9900, 0, 0, 1.01, 0, 1, -360, 360], [45, 44, 0, 0.02, 0, 9900, 0, 0, 1.008, 0, 1, -360, 360], [45, 46, 0, 0.021, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [62, 61, 0, 0.059, 0, 9900, 0, 0, 0.975, 0, 1, -360, 360], [63, 64, 0, 0.038, 0, 9900, 0, 0, 1.017, 0, 1, -360, 360], [73, 74, 0, 0.0244, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [81, 88, 0, 0.02, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [85, 99, 0, 0.048, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [86, 102, 0, 0.048, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [87, 94, 0, 0.046, 0, 9900, 0, 0, 1.015, 0, 1, -360, 360], [114, 207, 0, 0.149, 0, 9900, 0, 0, 0.967, 0, 1, -360, 360], [116, 124, 0.0052, 0.0174, 0, 9900, 0, 0, 1.01, 0, 1, -360, 360], [121, 115, 0, 0.028, 0, 9900, 0, 0, 1.05, 0, 1, -360, 360], [122, 157, 0.0005, 0.0195, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [130, 131, 0, 0.018, 0, 9900, 0, 0, 1.0522, 0, 1, -360, 360], [130, 150, 0, 0.014, 0, 9900, 0, 0, 1.0522, 0, 1, -360, 360], [132, 170, 0.001, 0.0402, 0, 9900, 0, 0, 1.05, 0, 1, -360, 360], [141, 174, 0.0024, 0.0603, 0, 9900, 0, 0, 0.975, 0, 1, -360, 360], [142, 175, 0.0024, 0.0498, -0.087, 9900, 0, 0, 1, 0, 1, -360, 360], [143, 144, 0, 0.0833, 0, 9900, 0, 0, 1.035, 0, 1, -360, 360], [143, 148, 0.0013, 0.0371, 0, 9900, 0, 0, 0.9565, 0, 1, -360, 360], [145, 180, 0.0005, 0.0182, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [151, 170, 0.001, 0.0392, 0, 9900, 0, 0, 1.05, 0, 1, -360, 360], [153, 183, 0.0027, 0.0639, 0, 9900, 0, 0, 1.073, 0, 1, -360, 360], [155, 156, 0.0008, 0.0256, 0, 9900, 0, 0, 1.05, 0, 1, -360, 360], [159, 117, 0, 0.016, 0, 9900, 0, 0, 1.0506, 0, 1, -360, 360], [160, 124, 0.0012, 0.0396, 0, 9900, 0, 0, 0.975, 0, 1, -360, 360], [163, 137, 0.0013, 0.0384, -0.057, 9900, 0, 0, 0.98, 0, 1, -360, 360], [164, 155, 0.0009, 0.0231, -0.033, 9900, 0, 0, 0.956, 0, 1, -360, 360], [182, 139, 0.0003, 0.0131, 0, 9900, 0, 0, 1.05, 0, 1, -360, 360], [189, 210, 0, 0.252, 0, 9900, 0, 0, 1.03, 0, 1, -360, 360], [193, 196, 0, 0.237, 0, 9900, 0, 0, 1.03, 0, 1, -360, 360], [195, 212, 0.0008, 0.0366, 0, 9900, 0, 0, 0.985, 0, 1, -360, 360], [200, 248, 0, 0.22, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [201, 69, 0, 0.098, 0, 9900, 0, 0, 1.03, 0, 1, -360, 360], [202, 211, 0, 0.128, 0, 9900, 0, 0, 1.01, 0, 1, -360, 360], [204, 2040, 0.02, 0.204, -0.012, 9900, 0, 0, 1.05, 0, 1, -360, 360], [209, 198, 0.026, 0.211, 0, 9900, 0, 0, 1.03, 0, 1, -360, 360], [211, 212, 0.003, 0.0122, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [218, 219, 0.001, 0.0354, -0.01, 9900, 0, 0, 0.97, 0, 1, -360, 360], [223, 224, 0.0012, 0.0195, -0.364, 9900, 0, 0, 1, 0, 1, -360, 360], [229, 230, 0.001, 0.0332, 0, 9900, 0, 0, 1.02, 0, 1, -360, 360], [234, 236, 0.0005, 0.016, 0, 9900, 0, 0, 1.07, 0, 1, -360, 360], [238, 239, 0.0005, 0.016, 0, 9900, 0, 0, 1.02, 0, 1, -360, 360], [196, 2040, 0.0001, 0.02, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [119, 1190, 0.001, 0.023, 0, 9900, 0, 0, 1.0223, 0, 1, -360, 360], [120, 1200, 0, 0.023, 0, 9900, 0, 0, 0.9284, 0, 1, -360, 360], [7002, 2, 0.001, 0.0146, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [7003, 3, 0, 0.01054, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [7061, 61, 0, 0.0238, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [7062, 62, 0, 0.03214, 0, 9900, 0, 0, 0.95, 0, 1, -360, 360], [7166, 166, 0, 0.0154, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [7024, 24, 0, 0.0289, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [7001, 1, 0, 0.01953, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [7130, 130, 0, 0.0193, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [7011, 11, 0, 0.01923, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [7023, 23, 0, 0.023, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [7049, 49, 0, 0.0124, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [7139, 139, 0, 0.0167, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [7012, 12, 0, 0.0312, 0, 9900, 0, 0, 1, 0, 1, -360, 360], [7017, 17, 0, 0.01654, 0, 9900, 0, 0, 0.942, 0, 1, -360, 360], [7039, 39, 0, 0.03159, 0, 9900, 0, 0, 0.965, 0, 1, -360, 360], [7057, 57, 0, 0.05347, 0, 9900, 0, 0, 0.95, 0, 1, -360, 360], [7044, 44, 0, 0.18181, 0, 9900, 0, 0, 0.942, 0, 1, -360, 360], [7055, 55, 0, 0.19607, 0, 9900, 0, 0, 0.942, 0, 1, -360, 360], [7071, 71, 0, 0.06896, 0, 9900, 0, 0, 0.9565, 0, 1, -360, 360] ]) ##----- OPF Data -----## ## generator cost data # 1 startup shutdown n x1 y1 ... xn yn # 2 startup shutdown n c(n-1) ... c0 ppc["gencost"] = array([ [2, 0, 0, 3, 0.01, 40, 0], [2, 0, 0, 3, 0.01, 40, 0], [2, 0, 0, 3, 0.01, 40, 0], [2, 0, 0, 3, 0.01, 40, 0], [2, 0, 0, 3, 0.01, 40, 0], [2, 0, 0, 3, 0.0266667, 20, 0], [2, 0, 0, 3, 0.0645161, 20, 0], [2, 0, 0, 3, 0.0344828, 20, 0], [2, 0, 0, 3, 0.147059, 20, 0], [2, 0, 0, 3, 0.0854701, 20, 0], [2, 0, 0, 3, 0.00518135, 20, 0], [2, 0, 0, 3, 0.0416667, 20, 0], [2, 0, 0, 3, 0.01, 40, 0], [2, 0, 0, 3, 0.01, 40, 0], [2, 0, 0, 3, 0.0355872, 20, 0], [2, 0, 0, 3, 0.0143678, 20, 0], [2, 0, 0, 3, 0.119048, 20, 0], [2, 0, 0, 3, 0.0460829, 20, 0], [2, 0, 0, 3, 0.0970874, 20, 0], [2, 0, 0, 3, 0.0268817, 20, 0], [2, 0, 0, 3, 0.0462963, 20, 0], [2, 0, 0, 3, 0.01, 40, 0], [2, 0, 0, 3, 0.0487805, 20, 0], [2, 0, 0, 3, 0.01, 40, 0], [2, 0, 0, 3, 0.0438596, 20, 0], [2, 0, 0, 3, 0.119048, 20, 0], [2, 0, 0, 3, 0.05, 20, 0], [2, 0, 0, 3, 0.00833333, 20, 0], [2, 0, 0, 3, 0.00833333, 20, 0], [2, 0, 0, 3, 0.0210526, 20, 0], [2, 0, 0, 3, 0.00506842, 20, 0], [2, 0, 0, 3, 0.0235849, 20, 0], [2, 0, 0, 3, 0.0367647, 20, 0], [2, 0, 0, 3, 0.1, 20, 0], [2, 0, 0, 3, 0.0222222, 20, 0], [2, 0, 0, 3, 0.04, 20, 0], [2, 0, 0, 3, 0.0330033, 20, 0], [2, 0, 0, 3, 0.0289855, 20, 0], [2, 0, 0, 3, 0.0333333, 20, 0], [2, 0, 0, 3, 0.0166667, 20, 0], [2, 0, 0, 3, 0.04, 20, 0], [2, 0, 0, 3, 0.0181818, 20, 0], [2, 0, 0, 3, 0.0173783, 20, 0], [2, 0, 0, 3, 0.0588235, 20, 0], [2, 0, 0, 3, 0.119048, 20, 0], [2, 0, 0, 3, 0.0214133, 20, 0], [2, 0, 0, 3, 0.0160514, 20, 0], [2, 0, 0, 3, 0.00826446, 20, 0], [2, 0, 0, 3, 0.042735, 20, 0], [2, 0, 0, 3, 0.0268817, 20, 0], [2, 0, 0, 3, 0.030303, 20, 0], [2, 0, 0, 3, 0.0540541, 20, 0], [2, 0, 0, 3, 0.0243902, 20, 0], [2, 0, 0, 3, 0.02, 20, 0], [2, 0, 0, 3, 0.27027, 20, 0], [2, 0, 0, 3, 0.01, 40, 0], [2, 0, 0, 3, 0.222222, 20, 0], [2, 0, 0, 3, 0.0606061, 20, 0], [2, 0, 0, 3, 0.025, 20, 0], [2, 0, 0, 3, 0.025, 20, 0], [2, 0, 0, 3, 0.0862069, 20, 0], [2, 0, 0, 3, 0.00773994, 20, 0], [2, 0, 0, 3, 0.0142857, 20, 0], [2, 0, 0, 3, 0.0180832, 20, 0], [2, 0, 0, 3, 0.01, 40, 0], [2, 0, 0, 3, 0.01, 40, 0], [2, 0, 0, 3, 0.01, 40, 0], [2, 0, 0, 3, 0.2, 20, 0], [2, 0, 0, 3, 1.25, 20, 0] ]) return ppc
67.438053
94
0.429663
14,018
60,964
1.868241
0.086104
0.187254
0.177326
0.155638
0.572034
0.521326
0.448051
0.370461
0.33201
0.235862
0
0.593982
0.301161
60,964
903
95
67.512735
0.020726
0.018749
0
0.037123
0
0
0.000569
0
0
0
0
0
0
1
0.00116
false
0
0.00116
0
0.00348
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
fa07ed30a490325bb8247195dfec496cb4d821f2
140
py
Python
test/torch_multiple_comms_test.py
facebookresearch/torch_ucc
21bc1467d7df0ae173ac92d9f3cf1b36ec10c3ab
[ "MIT" ]
10
2021-06-04T17:05:18.000Z
2022-03-15T07:49:00.000Z
test/torch_multiple_comms_test.py
facebookresearch/torch_ucc
21bc1467d7df0ae173ac92d9f3cf1b36ec10c3ab
[ "MIT" ]
56
2021-06-04T18:24:24.000Z
2022-03-31T23:26:59.000Z
test/torch_multiple_comms_test.py
facebookresearch/torch_ucc
21bc1467d7df0ae173ac92d9f3cf1b36ec10c3ab
[ "MIT" ]
11
2021-06-04T17:44:41.000Z
2021-11-11T19:45:06.000Z
import os from torch_ucc_test_setup import * # create 2 UCC PGs ucc_pg = init_process_groups("ucc", False) dist.barrier() ucc_pg.barrier()
17.5
42
0.771429
24
140
4.208333
0.708333
0.09901
0
0
0
0
0
0
0
0
0
0.008197
0.128571
140
7
43
20
0.819672
0.114286
0
0
0
0
0.02459
0
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
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
fa231e87c0dc282cb0d5023d52ce8ba55ea7a089
1,769
py
Python
scipy/fft/tests/mock_backend.py
FranzForstmayr/scipy
9a12908f843aed87203b32e45d1001353d90c548
[ "BSD-3-Clause" ]
1
2019-07-12T16:40:35.000Z
2019-07-12T16:40:35.000Z
scipy/fft/tests/mock_backend.py
FranzForstmayr/scipy
9a12908f843aed87203b32e45d1001353d90c548
[ "BSD-3-Clause" ]
1
2019-07-24T19:52:07.000Z
2019-07-24T19:52:07.000Z
scipy/fft/tests/mock_backend.py
FranzForstmayr/scipy
9a12908f843aed87203b32e45d1001353d90c548
[ "BSD-3-Clause" ]
2
2019-12-29T20:29:20.000Z
2020-06-08T14:39:49.000Z
import numpy as np class _MockFunction: def __init__(self, return_value = None): self.number_calls = 0 self.return_value = return_value self.last_args = ([], {}) def __call__(self, *args, **kwargs): self.number_calls += 1 self.last_args = (args, kwargs) return self.return_value fft = _MockFunction(np.random.random(10)) fft2 = _MockFunction(np.random.random(10)) fftn = _MockFunction(np.random.random(10)) ifft = _MockFunction(np.random.random(10)) ifft2 = _MockFunction(np.random.random(10)) ifftn = _MockFunction(np.random.random(10)) rfft = _MockFunction(np.random.random(10)) rfft2 = _MockFunction(np.random.random(10)) rfftn = _MockFunction(np.random.random(10)) irfft = _MockFunction(np.random.random(10)) irfft2 = _MockFunction(np.random.random(10)) irfftn = _MockFunction(np.random.random(10)) hfft = _MockFunction(np.random.random(10)) hfft2 = _MockFunction(np.random.random(10)) hfftn = _MockFunction(np.random.random(10)) ihfft = _MockFunction(np.random.random(10)) ihfft2 = _MockFunction(np.random.random(10)) ihfftn = _MockFunction(np.random.random(10)) dct = _MockFunction(np.random.random(10)) idct = _MockFunction(np.random.random(10)) dctn = _MockFunction(np.random.random(10)) idctn = _MockFunction(np.random.random(10)) dst = _MockFunction(np.random.random(10)) idst = _MockFunction(np.random.random(10)) dstn = _MockFunction(np.random.random(10)) idstn = _MockFunction(np.random.random(10)) fht = _MockFunction(np.random.random(10)) ifht = _MockFunction(np.random.random(10)) __ua_domain__ = "numpy.scipy.fft" def __ua_function__(method, args, kwargs): fn = globals().get(method.__name__) return (fn(*args, **kwargs) if fn is not None else NotImplemented)
29.483333
49
0.724703
237
1,769
5.160338
0.270042
0.320523
0.45789
0.595258
0.641047
0
0
0
0
0
0
0.041585
0.130017
1,769
59
50
29.983051
0.753086
0
0
0
0
0
0.008479
0
0
0
0
0
0
1
0.069767
false
0
0.023256
0
0.162791
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
fa27f2fe7b2a2ee7f089ebbac000ee01cc62676f
145
py
Python
TUI/Scripts/Closing/Quick Close.py
StarkillerX42/stui
668628cf7539e7d2be12846033141e4eb8616fe1
[ "BSD-3-Clause" ]
null
null
null
TUI/Scripts/Closing/Quick Close.py
StarkillerX42/stui
668628cf7539e7d2be12846033141e4eb8616fe1
[ "BSD-3-Clause" ]
null
null
null
TUI/Scripts/Closing/Quick Close.py
StarkillerX42/stui
668628cf7539e7d2be12846033141e4eb8616fe1
[ "BSD-3-Clause" ]
null
null
null
def run(sr): # quickClose.py from datetime import datetime tt=datetime.utcnow() yield sr.waitCmd(actor="tcc", cmdStr="track 121,30 mount")
24.166667
60
0.724138
22
145
4.772727
0.863636
0
0
0
0
0
0
0
0
0
0
0.04
0.137931
145
5
61
29
0.8
0.089655
0
0
0
0
0.161538
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
fa2c472c9986e350755198c6eede805429c4cc18
2,708
py
Python
aclarknet/database/migrations/0048_settingscontract.py
aclarknet/aclarknet-database
26ba55f2b2846687d1593520836083f59608227b
[ "MIT" ]
2
2016-02-23T13:39:59.000Z
2017-07-12T15:16:54.000Z
aclarknet/database/migrations/0048_settingscontract.py
aclarknet/aclarknet-database
26ba55f2b2846687d1593520836083f59608227b
[ "MIT" ]
1
2016-01-25T00:09:40.000Z
2016-02-09T01:44:49.000Z
aclarknet/database/migrations/0048_settingscontract.py
ACLARKNET/aclarknet-database
26ba55f2b2846687d1593520836083f59608227b
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-09-03 14:08 from __future__ import unicode_literals from django.db import migrations, models import faker.providers.lorem.la class Migration(migrations.Migration): dependencies = [ ('database', '0047_auto_20170903_0956'), ] operations = [ migrations.CreateModel( name='SettingsContract', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('parties', models.TextField(blank=True, default=faker.providers.lorem.la.Provider.text, null=True, verbose_name='Parties')), ('scope_of_work', models.TextField(blank=True, default=faker.providers.lorem.la.Provider.text, null=True, verbose_name='Scope of Work')), ('payment_terms', models.TextField(blank=True, default=faker.providers.lorem.la.Provider.text, null=True, verbose_name='Payment Terms')), ('timing_of_payment', models.TextField(blank=True, default=faker.providers.lorem.la.Provider.text, null=True, verbose_name='Timing of Payment')), ('contributor_assignment_agreement', models.TextField(blank=True, default=faker.providers.lorem.la.Provider.text, null=True, verbose_name='Contributor Assignment Agreement')), ('authority_to_act', models.TextField(blank=True, default=faker.providers.lorem.la.Provider.text, null=True, verbose_name='Authority to Act')), ('termination', models.TextField(blank=True, default=faker.providers.lorem.la.Provider.text, null=True, verbose_name='Termination')), ('governing_laws', models.TextField(blank=True, default=faker.providers.lorem.la.Provider.text, null=True, verbose_name='Governing Laws')), ('period_of_agreement', models.TextField(blank=True, default=faker.providers.lorem.la.Provider.text, null=True, verbose_name='Period of Agreement')), ('confidentiality', models.TextField(blank=True, default=faker.providers.lorem.la.Provider.text, null=True, verbose_name='Confidentiality')), ('taxes', models.TextField(blank=True, default=faker.providers.lorem.la.Provider.text, null=True, verbose_name='Taxes')), ('limited_warranty', models.TextField(blank=True, default=faker.providers.lorem.la.Provider.text, null=True, verbose_name='Limited Warranty')), ('complete_agreement', models.TextField(blank=True, default=faker.providers.lorem.la.Provider.text, null=True, verbose_name='Complete Agreement')), ], options={ 'verbose_name': 'Settings Contract', }, ), ]
69.435897
191
0.685377
315
2,708
5.768254
0.253968
0.090809
0.146395
0.161805
0.608696
0.608696
0.608696
0.608696
0.608696
0.608696
0
0.014778
0.175406
2,708
38
192
71.263158
0.798925
0.025111
0
0
1
0
0.178991
0.020857
0
0
0
0
0
1
0
false
0
0.096774
0
0.193548
0
0
0
0
null
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
fa414bf427cc1d488aaa908d9007be9dd5ebd84c
19,439
py
Python
qpca/src/tests/test_data_sets.py
hpi-sam/QuantumProgramming
453e0f3417bf2d0bd6db3260f56e033f7532d127
[ "MIT" ]
null
null
null
qpca/src/tests/test_data_sets.py
hpi-sam/QuantumProgramming
453e0f3417bf2d0bd6db3260f56e033f7532d127
[ "MIT" ]
null
null
null
qpca/src/tests/test_data_sets.py
hpi-sam/QuantumProgramming
453e0f3417bf2d0bd6db3260f56e033f7532d127
[ "MIT" ]
2
2021-12-05T18:40:03.000Z
2021-12-30T22:10:06.000Z
import cirq import numpy as np class BaseDataSet(object): def __init__(self): self._expected = None @property def expected(self): return self._expected class BaseExampleDataSetQPE(BaseDataSet): def __init__(self, len_count, len_eigen, operation, eigenstate, expected): super().__init__() self._len_count_reg = len_count self._len_eigenstate_reg = len_eigen self._count_reg = cirq.LineQubit.range(0, self._len_count_reg) self._eigenstate_reg = cirq.LineQubit.range(self._len_count_reg, self._len_count_reg + self._len_eigenstate_reg) self._operation = operation self._str_diagram = "" self._eigenstate = eigenstate self._expected = expected def get_all_registers(self): return [self._count_reg, self._eigenstate_reg] @property def count_register(self): return self._count_reg @property def eigenstate_register(self): return self._eigenstate_reg @property def operation(self): return self._operation @property def eigenstate(self): return self._eigenstate def get_str_diagram(self): return self._str_diagram def get_test_data_array(self): return [self._len_count_reg, self._len_eigenstate_reg, self._operation, self._str_diagram] class ExampleDataSetRef19(BaseExampleDataSetQPE): def __init__(self): x = np.array([4, 3, 4, 4, 3, 3, 3, 3, 4, 4, 4, 5, 4, 3, 4]) y = np.array([3028, 1365, 2726, 2538, 1318, 1693, 1412, 1632, 2875, 3564, 4412, 4444, 4278, 3064, 3857]) / 1000 self._matrix = np.array([x, y]) self._sigma = np.cov(self._matrix) self._normed_covariance = self._sigma / np.trace(self._sigma) self._purity = np.trace(np.matmul(self._normed_covariance, self._normed_covariance)) self._e1 = 1.57286 self._e2 = 0.105029 super().__init__(4, 2, None, None, 1 / 3) self._eigenstate = self._compute_eigenstate() self._operation = self._compute_operation() self._expected = [self._e1, self._e2] self._str_diagram = "" def _compute_eigenstate(self): U, S, V = np.linalg.svd([self._normed_covariance]) # print(U) # print(S) # print(V) # U, S, V = np.linalg.svd(self._density_matrix) # B = 1/np.sqrt(S[0]**2 + S[1]**2) * np.array([S[0], S[1]]) B = np.sqrt(S) B = (np.sqrt(S) * np.identity(2)) # print(B, np.identity(2)) theta = 2 * np.arccos(S[0]) print(U, np.linalg.inv(U)) # print(B, np.matmul(B, np.linalg.inv(B))) # print(V, V[0][0]**2 + V[1][1]**2) circuit = cirq.Circuit() # circuit.append(cirq.MatrixGate(np.linalg.inv(U))(self._eigenstate_reg[0])) # circuit.append(cirq.CNOT(self._eigenstate_reg[0], self._eigenstate_reg[1])) # circuit.append(cirq.MatrixGate(U)(self._eigenstate_reg[0])) # circuit.append(cirq.MatrixGate(V)(self._eigenstate_reg[1])) # print(circuit) return circuit def _compute_operation(self): U, S, V = np.linalg.svd(self._matrix) matrix = np.matmul(np.array([[1, 0], [0, np.exp(2j * S[0])]]), np.array([[1, 0], [0, np.exp(2j * S[1])]])) return cirq.MatrixGate(matrix) def get_features(self): return self._matrix[0], self._matrix[1] def get_sigma(self): return self._sigma def get_purity(self): return self._purity class ExampleDataSetMain(BaseExampleDataSetQPE): def __init__(self): self._matrix = np.array([[1.5, 0.5], [0.5, 1.5]]) self._sigma = np.cov(self._matrix) normed_covariance = self._sigma / np.trace(self._sigma) self._purity = np.trace(np.matmul(normed_covariance, normed_covariance)) self._density_matrix = np.matmul(normed_covariance, normed_covariance) self._e1 = 2 self._e2 = 1 super().__init__(4, 2, None, None, 1 / 3) self._eigenstate = self._compute_eigenstate() self._operation = self._compute_operation() self._expected = [self._e1, self._e2] self._str_diagram = "" def _compute_eigenstate(self): U, S, V = np.linalg.svd([self._matrix]) # U, S, V = np.linalg.svd(self._density_matrix) # B = 1/np.sqrt(S[0]**2 + S[1]**2) * np.array([S[0], S[1]]) B = np.diag(S) #print(B, np.matmul(B, np.linalg.inv(B))) # print(V, V[0][0]**2 + V[1][1]**2) circuit = cirq.Circuit() # circuit.append(cirq.MatrixGate(np.linalg.inv(U))(self._eigenstate_reg[0])) # circuit.append(cirq.CNOT(self._eigenstate_reg[0], self._eigenstate_reg[1])) # circuit.append(cirq.MatrixGate(U)(self._eigenstate_reg[0])) # circuit.append(cirq.MatrixGate(V)(self._eigenstate_reg[1])) # print(circuit) return circuit def _compute_operation(self): U, S, V = np.linalg.svd(self._matrix) matrix = np.matmul(np.array([[1, 0], [0, np.exp(2j * S[0])]]), np.array([[1, 0], [0, np.exp(2j * S[1])]])) return cirq.MatrixGate(matrix) def get_features(self): return self._matrix[0], self._matrix[1] def get_sigma(self): return self._sigma def get_purity(self): return self._purity class ExampleDataSetQiskitTextbookTGate3CountQubits(BaseExampleDataSetQPE): def __init__(self): super().__init__(3, 1, cirq.T, None, 1 / 8) self._eigenstate = self._compute_eigenstate() self._str_diagram = """ 0: ───H───@───────────────────────────qft[norev]^-1─── │ │ 1: ───H───┼───@───@───────────────────#2────────────── │ │ │ │ 2: ───H───┼───┼───┼───@───@───@───@───#3────────────── │ │ │ │ │ │ │ 3: ───X───T───T───T───T───T───T───T─────────────────── """ self._expected = 1 / 8 def _compute_eigenstate(self): return cirq.Circuit(cirq.X(*self._eigenstate_reg)) class ExampleDataSetQiskitTextbookPGate5CountQubits(BaseExampleDataSetQPE): def __init__(self, angle=2 * np.pi / 3): super().__init__(5, 1, self._compute_operation(angle), None, 1 / 3) self._eigenstate = self._compute_eigenstate() self._str_diagram = """ 0: ───H───@───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────qft[norev]^-1─── │ │ 1: ───H───┼───────────────────────────@───────────────────────────@───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────#2────────────── │ │ │ │ 2: ───H───┼───────────────────────────┼───────────────────────────┼───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────#3────────────── │ │ │ │ │ │ │ │ 3: ───H───┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────#4────────────── │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ 4: ───H───┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────@───────────────────────────#5────────────── │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ 5: ───X───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │───│ 1. +0.j 0. +0.j │─────────────────── │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ │ 0. +0.j -0.5+0.866j│ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘ """ def _compute_eigenstate(self): return cirq.Circuit(cirq.X(*self._eigenstate_reg)) def _compute_operation(self, angle): matrix = np.array([[1, 0], [0, np.exp(1j * angle)]]) return cirq.MatrixGate(matrix) def get_test_data_3_times_2_swap(): return [3, 2, cirq.SWAP, """ 0: ───H───@───────────────────────────qft[norev]^-1─── │ │ 1: ───H───┼───@───@───────────────────#2────────────── │ │ │ │ 2: ───H───┼───┼───┼───@───@───@───@───#3────────────── │ │ │ │ │ │ │ 3: ───────×───×───×───×───×───×───×─────────────────── │ │ │ │ │ │ │ 4: ───────×───×───×───×───×───×───×─────────────────── """]
91.693396
894
0.230619
1,705
19,439
5.570088
0.076833
0.023586
0.022112
0.025692
0.448352
0.434453
0.42445
0.394546
0.393598
0.384648
0
0.054362
0.427491
19,439
211
895
92.127962
0.327073
0.050414
0
0.486842
0
0.032895
0.713821
0.266544
0
0
0
0
0
1
0.184211
false
0
0.013158
0.111842
0.381579
0.006579
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
3
fa6d8b56823c1eeb83a56d3684fbe6eb668904f6
212
py
Python
tests/models.py
jcp/django-names
3c3d9d2b81d6f95fab1c0b4246b99f8fd87b216d
[ "BSD-3-Clause" ]
2
2019-08-10T03:01:08.000Z
2020-05-16T19:42:11.000Z
tests/models.py
jcp/django-names
3c3d9d2b81d6f95fab1c0b4246b99f8fd87b216d
[ "BSD-3-Clause" ]
13
2019-08-20T22:03:30.000Z
2022-02-10T07:46:47.000Z
tests/models.py
jcp/django-names
3c3d9d2b81d6f95fab1c0b4246b99f8fd87b216d
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- from django.db import models from names.fields import NameField class Person(models.Model): name = NameField(on_delete=models.CASCADE) class Meta: app_label = "tests"
16.307692
46
0.679245
28
212
5.071429
0.785714
0
0
0
0
0
0
0
0
0
0
0.005952
0.207547
212
12
47
17.666667
0.839286
0.099057
0
0
0
0
0.026455
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.833333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
3afbed69a891036b686777af03933e61558ebab3
113
py
Python
HelloWorld_python/url/url_demo_py3.py
wang153723482/HelloWorld_my
b8642ad9742f95cfebafc61f25b00e917485e50c
[ "Apache-2.0" ]
null
null
null
HelloWorld_python/url/url_demo_py3.py
wang153723482/HelloWorld_my
b8642ad9742f95cfebafc61f25b00e917485e50c
[ "Apache-2.0" ]
null
null
null
HelloWorld_python/url/url_demo_py3.py
wang153723482/HelloWorld_my
b8642ad9742f95cfebafc61f25b00e917485e50c
[ "Apache-2.0" ]
null
null
null
import urllib.parse s = urllib.parse.quote('sdkf3243{}":|>?<') print(s) ss = urllib.parse.unquote(s) print(ss)
14.125
42
0.672566
17
113
4.470588
0.529412
0.434211
0
0
0
0
0
0
0
0
0
0.039604
0.106195
113
8
43
14.125
0.712871
0
0
0
0
0
0.141593
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0.4
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
d71d897ca34fc75bf8209dfbbd0e4e126aa557d8
250
py
Python
framework/scrapy_plus/items.py
Danny2024/scrapy-3.3.3
b67c4a3c3c8f5de1aefb30312b2935b9b59afc9f
[ "MIT" ]
null
null
null
framework/scrapy_plus/items.py
Danny2024/scrapy-3.3.3
b67c4a3c3c8f5de1aefb30312b2935b9b59afc9f
[ "MIT" ]
1
2018-09-01T08:43:08.000Z
2018-09-01T08:43:08.000Z
framework/scrapy_plus/items.py
Danny2024/scrapy-3.3.3
b67c4a3c3c8f5de1aefb30312b2935b9b59afc9f
[ "MIT" ]
null
null
null
# coding:utf8 """ 封装爬虫提取出来的数据 - 将来可以根据这个类型来判断爬虫提取的是数据还是请求 """ class Item(object): def __init__(self,data): # 这是为私有属性,为了保护Item中封装的数据 self.__data = data # 只能获取值,不能赋值 @property def data(self): return self.__data
16.666667
32
0.636
25
250
6.04
0.68
0.15894
0
0
0
0
0
0
0
0
0
0.005376
0.256
250
15
33
16.666667
0.806452
0.344
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.166667
0.666667
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
0
0
0
3
d720606cb8b54a4cd686ca26e2fde36a7361103a
471
py
Python
main.py
PioOba/etl-twitter-postgres
d59ba421fd96dcb8d41b87251c3492b8d334f437
[ "Apache-2.0" ]
null
null
null
main.py
PioOba/etl-twitter-postgres
d59ba421fd96dcb8d41b87251c3492b8d334f437
[ "Apache-2.0" ]
null
null
null
main.py
PioOba/etl-twitter-postgres
d59ba421fd96dcb8d41b87251c3492b8d334f437
[ "Apache-2.0" ]
null
null
null
from export_and_transform_data import main as export_and_transform_data_main from create_tables import main as create_tables_main from load_data import main as load_data_main if __name__ == "__main__": df_tweets_data, df_context_annotations_cleaned, df_tweets_includes, df_public_metrics = \ export_and_transform_data_main() create_tables_main() load_data_main(df_tweets_data, df_context_annotations_cleaned, df_tweets_includes, df_public_metrics)
39.25
105
0.838641
71
471
4.901408
0.295775
0.091954
0.155172
0.189655
0.574713
0.425287
0.425287
0.425287
0.425287
0.425287
0
0
0.121019
471
11
106
42.818182
0.84058
0
0
0
0
0
0.016985
0
0
0
0
0
0
1
0
true
0
0.375
0
0.375
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
0
0
0
3
d72fd82c15e02170ca2440e8c5ef8b64016433d8
512
py
Python
psidialogs/check/versions.py
ponty/psidialogs
381a34f5e732f199013073501ee7976f0c2a9a7f
[ "BSD-2-Clause" ]
17
2015-01-11T20:41:45.000Z
2021-09-08T16:48:08.000Z
psidialogs/check/versions.py
ponty/psidialogs
381a34f5e732f199013073501ee7976f0c2a9a7f
[ "BSD-2-Clause" ]
2
2017-09-19T15:24:06.000Z
2021-01-02T16:16:47.000Z
psidialogs/check/versions.py
ponty/psidialogs
381a34f5e732f199013073501ee7976f0c2a9a7f
[ "BSD-2-Clause" ]
2
2017-02-21T14:51:42.000Z
2020-06-17T06:59:13.000Z
import platform import psidialogs from psidialogs import backend_version def print_name_version(name, version): s = "{:<20} {}".format(name, version) print(s) def print_versions(): print_name_version("python", platform.python_version()) print_name_version("psidialogs", psidialogs.__version__) for name in psidialogs.backends(): v = backend_version(name) if not v: v = "" print_name_version(name, v) if __name__ == "__main__": print_versions()
20.48
60
0.671875
61
512
5.229508
0.344262
0.206897
0.200627
0.125392
0
0
0
0
0
0
0
0.004988
0.216797
512
24
61
21.333333
0.790524
0
0
0
0
0
0.064453
0
0
0
0
0
0
1
0.125
false
0
0.1875
0
0.3125
0.4375
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
d754cd40db84716dd02dd84f4dcbd543e9e6560a
102,947
py
Python
src/keycloak/keycloak_admin.py
ecederstrand/python-keycloak
77686a2764a3fcba092d78e02f42a58c7214c30e
[ "MIT" ]
null
null
null
src/keycloak/keycloak_admin.py
ecederstrand/python-keycloak
77686a2764a3fcba092d78e02f42a58c7214c30e
[ "MIT" ]
null
null
null
src/keycloak/keycloak_admin.py
ecederstrand/python-keycloak
77686a2764a3fcba092d78e02f42a58c7214c30e
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # # The MIT License (MIT) # # Copyright (C) 2017 Marcos Pereira <marcospereira.mpj@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of # the Software, and to permit persons to whom the Software is furnished to do so, # subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # Unless otherwise stated in the comments, "id", in e.g. user_id, refers to the # internal Keycloak server ID, usually a uuid string import json from builtins import isinstance from typing import Iterable from . import urls_patterns from .connection import ConnectionManager from .exceptions import ( KeycloakDeleteError, KeycloakGetError, KeycloakPostError, KeycloakPutError, raise_error_from_response, ) from .keycloak_openid import KeycloakOpenID class KeycloakAdmin: """ Keycloak Admin client. :param server_url: Keycloak server url :param username: admin username :param password: admin password :param totp: Time based OTP :param realm_name: realm name :param client_id: client id :param verify: True if want check connection SSL :param client_secret_key: client secret key (optional, required only for access type confidential) :param custom_headers: dict of custom header to pass to each HTML request :param user_realm_name: The realm name of the user, if different from realm_name :param auto_refresh_token: list of methods that allows automatic token refresh. Ex: ['get', 'put', 'post', 'delete'] """ PAGE_SIZE = 100 _server_url = None _username = None _password = None _totp = None _realm_name = None _client_id = None _verify = None _client_secret_key = None _auto_refresh_token = None _connection = None _token = None _custom_headers = None _user_realm_name = None def __init__( self, server_url, username=None, password=None, totp=None, realm_name="master", client_id="admin-cli", verify=True, client_secret_key=None, custom_headers=None, user_realm_name=None, auto_refresh_token=None, ): self.server_url = server_url self.username = username self.password = password self.totp = totp self.realm_name = realm_name self.client_id = client_id self.verify = verify self.client_secret_key = client_secret_key self.auto_refresh_token = auto_refresh_token or [] self.user_realm_name = user_realm_name self.custom_headers = custom_headers # Get token Admin self.get_token() @property def server_url(self): return self._server_url @server_url.setter def server_url(self, value): self._server_url = value @property def realm_name(self): return self._realm_name @realm_name.setter def realm_name(self, value): self._realm_name = value @property def connection(self): return self._connection @connection.setter def connection(self, value): self._connection = value @property def client_id(self): return self._client_id @client_id.setter def client_id(self, value): self._client_id = value @property def client_secret_key(self): return self._client_secret_key @client_secret_key.setter def client_secret_key(self, value): self._client_secret_key = value @property def verify(self): return self._verify @verify.setter def verify(self, value): self._verify = value @property def username(self): return self._username @username.setter def username(self, value): self._username = value @property def password(self): return self._password @password.setter def password(self, value): self._password = value @property def totp(self): return self._totp @totp.setter def totp(self, value): self._totp = value @property def token(self): return self._token @token.setter def token(self, value): self._token = value @property def auto_refresh_token(self): return self._auto_refresh_token @property def user_realm_name(self): return self._user_realm_name @user_realm_name.setter def user_realm_name(self, value): self._user_realm_name = value @property def custom_headers(self): return self._custom_headers @custom_headers.setter def custom_headers(self, value): self._custom_headers = value @auto_refresh_token.setter def auto_refresh_token(self, value): allowed_methods = {"get", "post", "put", "delete"} if not isinstance(value, Iterable): raise TypeError( "Expected a list of strings among {allowed}".format(allowed=allowed_methods) ) if not all(method in allowed_methods for method in value): raise TypeError( "Unexpected method in auto_refresh_token, accepted methods are {allowed}".format( allowed=allowed_methods ) ) self._auto_refresh_token = value def __fetch_all(self, url, query=None): """Wrapper function to paginate GET requests :param url: The url on which the query is executed :param query: Existing query parameters (optional) :return: Combined results of paginated queries """ results = [] # initalize query if it was called with None if not query: query = {} page = 0 query["max"] = self.PAGE_SIZE # fetch until we can while True: query["first"] = page * self.PAGE_SIZE partial_results = raise_error_from_response( self.raw_get(url, **query), KeycloakGetError ) if not partial_results: break results.extend(partial_results) if len(partial_results) < query["max"]: break page += 1 return results def __fetch_paginated(self, url, query=None): query = query or {} return raise_error_from_response(self.raw_get(url, **query), KeycloakGetError) def import_realm(self, payload): """ Import a new realm from a RealmRepresentation. Realm name must be unique. RealmRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_realmrepresentation :param payload: RealmRepresentation :return: RealmRepresentation """ data_raw = self.raw_post(urls_patterns.URL_ADMIN_REALMS, data=json.dumps(payload)) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[201]) def export_realm(self, export_clients=False, export_groups_and_role=False): """ Export the realm configurations in the json format RealmRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_partialexport :param export-clients: Skip if not want to export realm clients :param export-groups-and-roles: Skip if not want to export realm groups and roles :return: realm configurations JSON """ params_path = { "realm-name": self.realm_name, "export-clients": export_clients, "export-groups-and-roles": export_groups_and_role, } data_raw = self.raw_post( urls_patterns.URL_ADMIN_REALM_EXPORT.format(**params_path), data="" ) return raise_error_from_response(data_raw, KeycloakPostError) def get_realms(self): """ Lists all realms in Keycloak deployment :return: realms list """ data_raw = self.raw_get(urls_patterns.URL_ADMIN_REALMS) return raise_error_from_response(data_raw, KeycloakGetError) def get_realm(self, realm_name): """ Get a specific realm. RealmRepresentation: https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_realmrepresentation :param realm_name: Realm name (not the realm id) :return: RealmRepresentation """ params_path = {"realm-name": realm_name} data_raw = self.raw_get(urls_patterns.URL_ADMIN_REALM.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError, expected_codes=[200]) def create_realm(self, payload, skip_exists=False): """ Create a realm RealmRepresentation: https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_realmrepresentation :param payload: RealmRepresentation :param skip_exists: Skip if Realm already exist. :return: Keycloak server response (RealmRepresentation) """ data_raw = self.raw_post(urls_patterns.URL_ADMIN_REALMS, data=json.dumps(payload)) return raise_error_from_response( data_raw, KeycloakPostError, expected_codes=[201], skip_exists=skip_exists ) def update_realm(self, realm_name, payload): """ Update a realm. This wil only update top level attributes and will ignore any user, role, or client information in the payload. RealmRepresentation: https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_realmrepresentation :param realm_name: Realm name (not the realm id) :param payload: RealmRepresentation :return: Http response """ params_path = {"realm-name": realm_name} data_raw = self.raw_put( urls_patterns.URL_ADMIN_REALM.format(**params_path), data=json.dumps(payload) ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def delete_realm(self, realm_name): """ Delete a realm :param realm_name: Realm name (not the realm id) :return: Http response """ params_path = {"realm-name": realm_name} data_raw = self.raw_delete(urls_patterns.URL_ADMIN_REALM.format(**params_path)) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def get_users(self, query=None): """ Return a list of users, filtered according to query parameters UserRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_userrepresentation :param query: Query parameters (optional) :return: users list """ query = query or {} params_path = {"realm-name": self.realm_name} url = urls_patterns.URL_ADMIN_USERS.format(**params_path) if "first" in query or "max" in query: return self.__fetch_paginated(url, query) return self.__fetch_all(url, query) def create_idp(self, payload): """ Create an ID Provider, IdentityProviderRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_identityproviderrepresentation :param: payload: IdentityProviderRepresentation """ params_path = {"realm-name": self.realm_name} data_raw = self.raw_post( urls_patterns.URL_ADMIN_IDPS.format(**params_path), data=json.dumps(payload) ) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[201]) def add_mapper_to_idp(self, idp_alias, payload): """ Create an ID Provider, IdentityProviderRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_identityprovidermapperrepresentation :param: idp_alias: alias for Idp to add mapper in :param: payload: IdentityProviderMapperRepresentation """ params_path = {"realm-name": self.realm_name, "idp-alias": idp_alias} data_raw = self.raw_post( urls_patterns.URL_ADMIN_IDP_MAPPERS.format(**params_path), data=json.dumps(payload) ) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[201]) def get_idps(self): """ Returns a list of ID Providers, IdentityProviderRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_identityproviderrepresentation :return: array IdentityProviderRepresentation """ params_path = {"realm-name": self.realm_name} data_raw = self.raw_get(urls_patterns.URL_ADMIN_IDPS.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def delete_idp(self, idp_alias): """ Deletes ID Provider, :param: idp_alias: idp alias name """ params_path = {"realm-name": self.realm_name, "alias": idp_alias} data_raw = self.raw_delete(urls_patterns.URL_ADMIN_IDP.format(**params_path)) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def create_user(self, payload, exist_ok=False): """ Create a new user. Username must be unique UserRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_userrepresentation :param payload: UserRepresentation :param exist_ok: If False, raise KeycloakGetError if username already exists. Otherwise, return existing user ID. :return: UserRepresentation """ params_path = {"realm-name": self.realm_name} if exist_ok: exists = self.get_user_id(username=payload["username"]) if exists is not None: return str(exists) data_raw = self.raw_post( urls_patterns.URL_ADMIN_USERS.format(**params_path), data=json.dumps(payload) ) raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[201]) _last_slash_idx = data_raw.headers["Location"].rindex("/") return data_raw.headers["Location"][_last_slash_idx + 1 :] # noqa: E203 def users_count(self, query=None): """ User counter https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_users_resource :param query: (dict) Query parameters for users count :return: counter """ query = query or dict() params_path = {"realm-name": self.realm_name} data_raw = self.raw_get(urls_patterns.URL_ADMIN_USERS_COUNT.format(**params_path), **query) return raise_error_from_response(data_raw, KeycloakGetError) def get_user_id(self, username): """ Get internal keycloak user id from username This is required for further actions against this user. UserRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_userrepresentation :param username: id in UserRepresentation :return: user_id """ lower_user_name = username.lower() users = self.get_users(query={"search": lower_user_name}) return next((user["id"] for user in users if user["username"] == lower_user_name), None) def get_user(self, user_id): """ Get representation of the user :param user_id: User id UserRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_userrepresentation :return: UserRepresentation """ params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_USER.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_user_groups(self, user_id): """ Returns a list of groups of which the user is a member :param user_id: User id :return: user groups list """ params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_USER_GROUPS.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def update_user(self, user_id, payload): """ Update the user :param user_id: User id :param payload: UserRepresentation :return: Http response """ params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_put( urls_patterns.URL_ADMIN_USER.format(**params_path), data=json.dumps(payload) ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def delete_user(self, user_id): """ Delete the user :param user_id: User id :return: Http response """ params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_delete(urls_patterns.URL_ADMIN_USER.format(**params_path)) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def set_user_password(self, user_id, password, temporary=True): """ Set up a password for the user. If temporary is True, the user will have to reset the temporary password next time they log in. https://www.keycloak.org/docs-api/18.0/rest-api/#_users_resource https://www.keycloak.org/docs-api/18.0/rest-api/#_credentialrepresentation :param user_id: User id :param password: New password :param temporary: True if password is temporary :return: """ payload = {"type": "password", "temporary": temporary, "value": password} params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_put( urls_patterns.URL_ADMIN_RESET_PASSWORD.format(**params_path), data=json.dumps(payload) ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def get_credentials(self, user_id): """ Returns a list of credential belonging to the user. CredentialRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_credentialrepresentation :param: user_id: user id :return: Keycloak server response (CredentialRepresentation) """ params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_USER_CREDENTIALS.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def delete_credential(self, user_id, credential_id): """ Delete credential of the user. CredentialRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_credentialrepresentation :param: user_id: user id :param: credential_id: credential id :return: Keycloak server response (ClientRepresentation) """ params_path = { "realm-name": self.realm_name, "id": user_id, "credential_id": credential_id, } data_raw = self.raw_delete(urls_patterns.URL_ADMIN_USER_CREDENTIAL.format(**params_path)) return raise_error_from_response(data_raw, KeycloakDeleteError) def user_logout(self, user_id): """ Logs out user. https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_logout :param user_id: User id :return: """ params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_post( urls_patterns.URL_ADMIN_USER_LOGOUT.format(**params_path), data="" ) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[204]) def user_consents(self, user_id): """ Get consents granted by the user UserConsentRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_userconsentrepresentation :param user_id: User id :return: List of UserConsentRepresentations """ params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_USER_CONSENTS.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_user_social_logins(self, user_id): """ Returns a list of federated identities/social logins of which the user has been associated with :param user_id: User id :return: federated identities list """ params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_get( urls_patterns.URL_ADMIN_USER_FEDERATED_IDENTITIES.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakGetError) def add_user_social_login(self, user_id, provider_id, provider_userid, provider_username): """ Add a federated identity / social login provider to the user :param user_id: User id :param provider_id: Social login provider id :param provider_userid: userid specified by the provider :param provider_username: username specified by the provider :return: """ payload = { "identityProvider": provider_id, "userId": provider_userid, "userName": provider_username, } params_path = {"realm-name": self.realm_name, "id": user_id, "provider": provider_id} data_raw = self.raw_post( urls_patterns.URL_ADMIN_USER_FEDERATED_IDENTITY.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[201, 204]) def delete_user_social_login(self, user_id, provider_id): """ Delete a federated identity / social login provider from the user :param user_id: User id :param provider_id: Social login provider id :return: """ params_path = {"realm-name": self.realm_name, "id": user_id, "provider": provider_id} data_raw = self.raw_delete( urls_patterns.URL_ADMIN_USER_FEDERATED_IDENTITY.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def send_update_account( self, user_id, payload, client_id=None, lifespan=None, redirect_uri=None ): """ Send an update account email to the user. An email contains a link the user can click to perform a set of required actions. :param user_id: User id :param payload: A list of actions for the user to complete :param client_id: Client id (optional) :param lifespan: Number of seconds after which the generated token expires (optional) :param redirect_uri: The redirect uri (optional) :return: """ params_path = {"realm-name": self.realm_name, "id": user_id} params_query = {"client_id": client_id, "lifespan": lifespan, "redirect_uri": redirect_uri} data_raw = self.raw_put( urls_patterns.URL_ADMIN_SEND_UPDATE_ACCOUNT.format(**params_path), data=json.dumps(payload), **params_query ) return raise_error_from_response(data_raw, KeycloakPutError) def send_verify_email(self, user_id, client_id=None, redirect_uri=None): """ Send a update account email to the user An email contains a link the user can click to perform a set of required actions. :param user_id: User id :param client_id: Client id (optional) :param redirect_uri: Redirect uri (optional) :return: """ params_path = {"realm-name": self.realm_name, "id": user_id} params_query = {"client_id": client_id, "redirect_uri": redirect_uri} data_raw = self.raw_put( urls_patterns.URL_ADMIN_SEND_VERIFY_EMAIL.format(**params_path), data={}, **params_query ) return raise_error_from_response(data_raw, KeycloakPutError) def get_sessions(self, user_id): """ Get sessions associated with the user :param user_id: id of user UserSessionRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_usersessionrepresentation :return: UserSessionRepresentation """ params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_GET_SESSIONS.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_server_info(self): """ Get themes, social providers, auth providers, and event listeners available on this server ServerInfoRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_serverinforepresentation :return: ServerInfoRepresentation """ data_raw = self.raw_get(urls_patterns.URL_ADMIN_SERVER_INFO) return raise_error_from_response(data_raw, KeycloakGetError) def get_groups(self, query=None): """ Returns a list of groups belonging to the realm GroupRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/#_grouprepresentation :return: array GroupRepresentation """ query = query or {} params_path = {"realm-name": self.realm_name} url = urls_patterns.URL_ADMIN_GROUPS.format(**params_path) if "first" in query or "max" in query: return self.__fetch_paginated(url, query) return self.__fetch_all(url, query) def get_group(self, group_id): """ Get group by id. Returns full group details GroupRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/#_grouprepresentation :param group_id: The group id :return: Keycloak server response (GroupRepresentation) """ params_path = {"realm-name": self.realm_name, "id": group_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_GROUP.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_subgroups(self, group, path): """ Utility function to iterate through nested group structures GroupRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/#_grouprepresentation :param name: group (GroupRepresentation) :param path: group path (string) :return: Keycloak server response (GroupRepresentation) """ for subgroup in group["subGroups"]: if subgroup["path"] == path: return subgroup elif subgroup["subGroups"]: for subgroup in group["subGroups"]: result = self.get_subgroups(subgroup, path) if result: return result # went through the tree without hits return None def get_group_members(self, group_id, query=None): """ Get members by group id. Returns group members GroupRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/#_userrepresentation :param group_id: The group id :param query: Additional query parameters (see https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_getmembers) :return: Keycloak server response (UserRepresentation) """ query = query or {} params_path = {"realm-name": self.realm_name, "id": group_id} url = urls_patterns.URL_ADMIN_GROUP_MEMBERS.format(**params_path) if "first" in query or "max" in query: return self.__fetch_paginated(url, query) return self.__fetch_all(url, query) def get_group_by_path(self, path, search_in_subgroups=False): """ Get group id based on name or path. A straight name or path match with a top-level group will return first. Subgroups are traversed, the first to match path (or name with path) is returned. GroupRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/#_grouprepresentation :param path: group path :param search_in_subgroups: True if want search in the subgroups :return: Keycloak server response (GroupRepresentation) """ groups = self.get_groups() # TODO: Review this code is necessary for group in groups: if group["path"] == path: return group elif search_in_subgroups and group["subGroups"]: for group in group["subGroups"]: if group["path"] == path: return group res = self.get_subgroups(group, path) if res is not None: return res return None def create_group(self, payload, parent=None, skip_exists=False): """ Creates a group in the Realm :param payload: GroupRepresentation :param parent: parent group's id. Required to create a sub-group. :param skip_exists: If true then do not raise an error if it already exists GroupRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/#_grouprepresentation :return: Group id for newly created group or None for an existing group """ if parent is None: params_path = {"realm-name": self.realm_name} data_raw = self.raw_post( urls_patterns.URL_ADMIN_GROUPS.format(**params_path), data=json.dumps(payload) ) else: params_path = {"realm-name": self.realm_name, "id": parent} data_raw = self.raw_post( urls_patterns.URL_ADMIN_GROUP_CHILD.format(**params_path), data=json.dumps(payload) ) raise_error_from_response( data_raw, KeycloakPostError, expected_codes=[201], skip_exists=skip_exists ) try: _last_slash_idx = data_raw.headers["Location"].rindex("/") return data_raw.headers["Location"][_last_slash_idx + 1 :] # noqa: E203 except KeyError: return def update_group(self, group_id, payload): """ Update group, ignores subgroups. :param group_id: id of group :param payload: GroupRepresentation with updated information. GroupRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/#_grouprepresentation :return: Http response """ params_path = {"realm-name": self.realm_name, "id": group_id} data_raw = self.raw_put( urls_patterns.URL_ADMIN_GROUP.format(**params_path), data=json.dumps(payload) ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def group_set_permissions(self, group_id, enabled=True): """ Enable/Disable permissions for a group. Cannot delete group if disabled :param group_id: id of group :param enabled: boolean :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": group_id} data_raw = self.raw_put( urls_patterns.URL_ADMIN_GROUP_PERMISSIONS.format(**params_path), data=json.dumps({"enabled": enabled}), ) return raise_error_from_response(data_raw, KeycloakPutError) def group_user_add(self, user_id, group_id): """ Add user to group (user_id and group_id) :param user_id: id of user :param group_id: id of group to add to :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": user_id, "group-id": group_id} data_raw = self.raw_put( urls_patterns.URL_ADMIN_USER_GROUP.format(**params_path), data=None ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def group_user_remove(self, user_id, group_id): """ Remove user from group (user_id and group_id) :param user_id: id of user :param group_id: id of group to remove from :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": user_id, "group-id": group_id} data_raw = self.raw_delete(urls_patterns.URL_ADMIN_USER_GROUP.format(**params_path)) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def delete_group(self, group_id): """ Deletes a group in the Realm :param group_id: id of group to delete :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": group_id} data_raw = self.raw_delete(urls_patterns.URL_ADMIN_GROUP.format(**params_path)) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def get_clients(self): """ Returns a list of clients belonging to the realm ClientRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clientrepresentation :return: Keycloak server response (ClientRepresentation) """ params_path = {"realm-name": self.realm_name} data_raw = self.raw_get(urls_patterns.URL_ADMIN_CLIENTS.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_client(self, client_id): """ Get representation of the client ClientRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clientrepresentation :param client_id: id of client (not client-id) :return: Keycloak server response (ClientRepresentation) """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_CLIENT.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_client_id(self, client_name): """ Get internal keycloak client id from client-id. This is required for further actions against this client. :param client_name: name in ClientRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clientrepresentation :return: client_id (uuid as string) """ clients = self.get_clients() for client in clients: if client_name == client.get("name") or client_name == client.get("clientId"): return client["id"] return None def get_client_authz_settings(self, client_id): """ Get authorization json from client. :param client_id: id in ClientRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clientrepresentation :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_get( urls_patterns.URL_ADMIN_CLIENT_AUTHZ_SETTINGS.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakGetError) def create_client_authz_resource(self, client_id, payload, skip_exists=False): """ Create resources of client. :param client_id: id in ClientRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clientrepresentation :param payload: ResourceRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_resourcerepresentation :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_post( urls_patterns.URL_ADMIN_CLIENT_AUTHZ_RESOURCES.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response( data_raw, KeycloakPostError, expected_codes=[201], skip_exists=skip_exists ) def get_client_authz_resources(self, client_id): """ Get resources from client. :param client_id: id in ClientRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clientrepresentation :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_get( urls_patterns.URL_ADMIN_CLIENT_AUTHZ_RESOURCES.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakGetError) def create_client_authz_role_based_policy(self, client_id, payload, skip_exists=False): """ Create role-based policy of client. :param client_id: id in ClientRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clientrepresentation :param payload: No Document :return: Keycloak server response Payload example:: payload={ "type": "role", "logic": "POSITIVE", "decisionStrategy": "UNANIMOUS", "name": "Policy-1", "roles": [ { "id": id } ] } """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_post( urls_patterns.URL_ADMIN_CLIENT_AUTHZ_ROLE_BASED_POLICY.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response( data_raw, KeycloakPostError, expected_codes=[201], skip_exists=skip_exists ) def create_client_authz_resource_based_permission(self, client_id, payload, skip_exists=False): """ Create resource-based permission of client. :param client_id: id in ClientRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clientrepresentation :param payload: PolicyRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_policyrepresentation :return: Keycloak server response Payload example:: payload={ "type": "resource", "logic": "POSITIVE", "decisionStrategy": "UNANIMOUS", "name": "Permission-Name", "resources": [ resource_id ], "policies": [ policy_id ] """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_post( urls_patterns.URL_ADMIN_CLIENT_AUTHZ_RESOURCE_BASED_PERMISSION.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response( data_raw, KeycloakPostError, expected_codes=[201], skip_exists=skip_exists ) def get_client_authz_scopes(self, client_id): """ Get scopes from client. :param client_id: id in ClientRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clientrepresentation :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_CLIENT_AUTHZ_SCOPES.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_client_authz_permissions(self, client_id): """ Get permissions from client. :param client_id: id in ClientRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clientrepresentation :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_get( urls_patterns.URL_ADMIN_CLIENT_AUTHZ_PERMISSIONS.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakGetError) def get_client_authz_policies(self, client_id): """ Get policies from client. :param client_id: id in ClientRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clientrepresentation :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_get( urls_patterns.URL_ADMIN_CLIENT_AUTHZ_POLICIES.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakGetError) def get_client_service_account_user(self, client_id): """ Get service account user from client. :param client_id: id in ClientRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clientrepresentation :return: UserRepresentation """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_get( urls_patterns.URL_ADMIN_CLIENT_SERVICE_ACCOUNT_USER.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakGetError) def create_client(self, payload, skip_exists=False): """ Create a client ClientRepresentation: https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clientrepresentation :param skip_exists: If true then do not raise an error if client already exists :param payload: ClientRepresentation :return: Client ID """ if skip_exists: client_id = self.get_client_id(client_name=payload["name"]) if client_id is not None: return client_id params_path = {"realm-name": self.realm_name} data_raw = self.raw_post( urls_patterns.URL_ADMIN_CLIENTS.format(**params_path), data=json.dumps(payload) ) raise_error_from_response( data_raw, KeycloakPostError, expected_codes=[201], skip_exists=skip_exists ) _last_slash_idx = data_raw.headers["Location"].rindex("/") return data_raw.headers["Location"][_last_slash_idx + 1 :] # noqa: E203 def update_client(self, client_id, payload): """ Update a client :param client_id: Client id :param payload: ClientRepresentation :return: Http response """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_put( urls_patterns.URL_ADMIN_CLIENT.format(**params_path), data=json.dumps(payload) ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def delete_client(self, client_id): """ Get representation of the client ClientRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clientrepresentation :param client_id: keycloak client id (not oauth client-id) :return: Keycloak server response (ClientRepresentation) """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_delete(urls_patterns.URL_ADMIN_CLIENT.format(**params_path)) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def get_client_installation_provider(self, client_id, provider_id): """ Get content for given installation provider Related documentation: https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clients_resource Possible provider_id list available in the ServerInfoRepresentation#clientInstallations https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_serverinforepresentation :param client_id: Client id :param provider_id: provider id to specify response format """ params_path = {"realm-name": self.realm_name, "id": client_id, "provider-id": provider_id} data_raw = self.raw_get( urls_patterns.URL_ADMIN_CLIENT_INSTALLATION_PROVIDER.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakGetError, expected_codes=[200]) def get_realm_roles(self): """ Get all roles for the realm or client RoleRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_rolerepresentation :return: Keycloak server response (RoleRepresentation) """ params_path = {"realm-name": self.realm_name} data_raw = self.raw_get(urls_patterns.URL_ADMIN_REALM_ROLES.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_realm_role_members(self, role_name, query=None): """ Get role members of realm by role name. :param role_name: Name of the role. :param query: Additional Query parameters (see https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_roles_resource) :return: Keycloak Server Response (UserRepresentation) """ query = query or dict() params_path = {"realm-name": self.realm_name, "role-name": role_name} return self.__fetch_all( urls_patterns.URL_ADMIN_REALM_ROLES_MEMBERS.format(**params_path), query ) def get_client_roles(self, client_id): """ Get all roles for the client :param client_id: id of client (not client-id) RoleRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_rolerepresentation :return: Keycloak server response (RoleRepresentation) """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_CLIENT_ROLES.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_client_role(self, client_id, role_name): """ Get client role id by name This is required for further actions with this role. :param client_id: id of client (not client-id) :param role_name: role’s name (not id!) RoleRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_rolerepresentation :return: role_id """ params_path = {"realm-name": self.realm_name, "id": client_id, "role-name": role_name} data_raw = self.raw_get(urls_patterns.URL_ADMIN_CLIENT_ROLE.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_client_role_id(self, client_id, role_name): """ Warning: Deprecated Get client role id by name This is required for further actions with this role. :param client_id: id of client (not client-id) :param role_name: role’s name (not id!) RoleRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_rolerepresentation :return: role_id """ role = self.get_client_role(client_id, role_name) return role.get("id") def create_client_role(self, client_role_id, payload, skip_exists=False): """ Create a client role RoleRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_rolerepresentation :param client_role_id: id of client (not client-id) :param payload: RoleRepresentation :param skip_exists: If true then do not raise an error if client role already exists :return: Client role name """ if skip_exists: try: res = self.get_client_role(client_id=client_role_id, role_name=payload["name"]) return res["name"] except KeycloakGetError: pass params_path = {"realm-name": self.realm_name, "id": client_role_id} data_raw = self.raw_post( urls_patterns.URL_ADMIN_CLIENT_ROLES.format(**params_path), data=json.dumps(payload) ) raise_error_from_response( data_raw, KeycloakPostError, expected_codes=[201], skip_exists=skip_exists ) _last_slash_idx = data_raw.headers["Location"].rindex("/") return data_raw.headers["Location"][_last_slash_idx + 1 :] # noqa: E203 def add_composite_client_roles_to_role(self, client_role_id, role_name, roles): """ Add composite roles to client role :param client_role_id: id of client (not client-id) :param role_name: The name of the role :param roles: roles list or role (use RoleRepresentation) to be updated :return: Keycloak server response """ payload = roles if isinstance(roles, list) else [roles] params_path = {"realm-name": self.realm_name, "id": client_role_id, "role-name": role_name} data_raw = self.raw_post( urls_patterns.URL_ADMIN_CLIENT_ROLES_COMPOSITE_CLIENT_ROLE.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[204]) def update_client_role(self, client_role_id, role_name, payload): """ Update a client role RoleRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_rolerepresentation :param client_role_id: id of client (not client-id) :param role_name: role's name (not id!) :param payload: RoleRepresentation """ params_path = {"realm-name": self.realm_name, "id": client_role_id, "role-name": role_name} data_raw = self.raw_put( urls_patterns.URL_ADMIN_CLIENT_ROLE.format(**params_path), data=json.dumps(payload) ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def delete_client_role(self, client_role_id, role_name): """ Delete a client role RoleRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_rolerepresentation :param client_role_id: id of client (not client-id) :param role_name: role's name (not id!) """ params_path = {"realm-name": self.realm_name, "id": client_role_id, "role-name": role_name} data_raw = self.raw_delete(urls_patterns.URL_ADMIN_CLIENT_ROLE.format(**params_path)) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def assign_client_role(self, user_id, client_id, roles): """ Assign a client role to a user :param user_id: id of user :param client_id: id of client (not client-id) :param roles: roles list or role (use RoleRepresentation) :return: Keycloak server response """ payload = roles if isinstance(roles, list) else [roles] params_path = {"realm-name": self.realm_name, "id": user_id, "client-id": client_id} data_raw = self.raw_post( urls_patterns.URL_ADMIN_USER_CLIENT_ROLES.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[204]) def get_client_role_members(self, client_id, role_name, **query): """ Get members by client role . :param client_id: The client id :param role_name: the name of role to be queried. :param query: Additional query parameters (see https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clients_resource) :return: Keycloak server response (UserRepresentation) """ params_path = {"realm-name": self.realm_name, "id": client_id, "role-name": role_name} return self.__fetch_all( urls_patterns.URL_ADMIN_CLIENT_ROLE_MEMBERS.format(**params_path), query ) def get_client_role_groups(self, client_id, role_name, **query): """ Get group members by client role . :param client_id: The client id :param role_name: the name of role to be queried. :param query: Additional query parameters (see https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_clients_resource) :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": client_id, "role-name": role_name} return self.__fetch_all( urls_patterns.URL_ADMIN_CLIENT_ROLE_GROUPS.format(**params_path), query ) def create_realm_role(self, payload, skip_exists=False): """ Create a new role for the realm or client :param payload: The role (use RoleRepresentation) :param skip_exists: If true then do not raise an error if realm role already exists :return: Realm role name """ if skip_exists: try: role = self.get_realm_role(role_name=payload["name"]) return role["name"] except KeycloakGetError: pass params_path = {"realm-name": self.realm_name} data_raw = self.raw_post( urls_patterns.URL_ADMIN_REALM_ROLES.format(**params_path), data=json.dumps(payload) ) raise_error_from_response( data_raw, KeycloakPostError, expected_codes=[201], skip_exists=skip_exists ) _last_slash_idx = data_raw.headers["Location"].rindex("/") return data_raw.headers["Location"][_last_slash_idx + 1 :] # noqa: E203 def get_realm_role(self, role_name): """ Get realm role by role name :param role_name: role's name, not id! RoleRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_rolerepresentation :return: role_id """ params_path = {"realm-name": self.realm_name, "role-name": role_name} data_raw = self.raw_get( urls_patterns.URL_ADMIN_REALM_ROLES_ROLE_BY_NAME.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakGetError) def update_realm_role(self, role_name, payload): """ Update a role for the realm by name :param role_name: The name of the role to be updated :param payload: The role (use RoleRepresentation) :return Keycloak server response """ params_path = {"realm-name": self.realm_name, "role-name": role_name} data_raw = self.raw_put( urls_patterns.URL_ADMIN_REALM_ROLES_ROLE_BY_NAME.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def delete_realm_role(self, role_name): """ Delete a role for the realm by name :param payload: The role name {'role-name':'name-of-the-role'} :return Keycloak server response """ params_path = {"realm-name": self.realm_name, "role-name": role_name} data_raw = self.raw_delete( urls_patterns.URL_ADMIN_REALM_ROLES_ROLE_BY_NAME.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def add_composite_realm_roles_to_role(self, role_name, roles): """ Add composite roles to the role :param role_name: The name of the role :param roles: roles list or role (use RoleRepresentation) to be updated :return: Keycloak server response """ payload = roles if isinstance(roles, list) else [roles] params_path = {"realm-name": self.realm_name, "role-name": role_name} data_raw = self.raw_post( urls_patterns.URL_ADMIN_REALM_ROLES_COMPOSITE_REALM_ROLE.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[204]) def remove_composite_realm_roles_to_role(self, role_name, roles): """ Remove composite roles from the role :param role_name: The name of the role :param roles: roles list or role (use RoleRepresentation) to be removed :return: Keycloak server response """ payload = roles if isinstance(roles, list) else [roles] params_path = {"realm-name": self.realm_name, "role-name": role_name} data_raw = self.raw_delete( urls_patterns.URL_ADMIN_REALM_ROLES_COMPOSITE_REALM_ROLE.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def get_composite_realm_roles_of_role(self, role_name): """ Get composite roles of the role :param role_name: The name of the role :return: Keycloak server response (array RoleRepresentation) """ params_path = {"realm-name": self.realm_name, "role-name": role_name} data_raw = self.raw_get( urls_patterns.URL_ADMIN_REALM_ROLES_COMPOSITE_REALM_ROLE.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakGetError) def assign_realm_roles(self, user_id, roles): """ Assign realm roles to a user :param user_id: id of user :param roles: roles list or role (use RoleRepresentation) :return: Keycloak server response """ payload = roles if isinstance(roles, list) else [roles] params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_post( urls_patterns.URL_ADMIN_USER_REALM_ROLES.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[204]) def delete_realm_roles_of_user(self, user_id, roles): """ Deletes realm roles of a user :param user_id: id of user :param roles: roles list or role (use RoleRepresentation) :return: Keycloak server response """ payload = roles if isinstance(roles, list) else [roles] params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_delete( urls_patterns.URL_ADMIN_USER_REALM_ROLES.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def get_realm_roles_of_user(self, user_id): """ Get all realm roles for a user. :param user_id: id of user :return: Keycloak server response (array RoleRepresentation) """ params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_USER_REALM_ROLES.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_available_realm_roles_of_user(self, user_id): """ Get all available (i.e. unassigned) realm roles for a user. :param user_id: id of user :return: Keycloak server response (array RoleRepresentation) """ params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_get( urls_patterns.URL_ADMIN_USER_REALM_ROLES_AVAILABLE.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakGetError) def get_composite_realm_roles_of_user(self, user_id): """ Get all composite (i.e. implicit) realm roles for a user. :param user_id: id of user :return: Keycloak server response (array RoleRepresentation) """ params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_get( urls_patterns.URL_ADMIN_USER_REALM_ROLES_COMPOSITE.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakGetError) def assign_group_realm_roles(self, group_id, roles): """ Assign realm roles to a group :param group_id: id of groupp :param roles: roles list or role (use GroupRoleRepresentation) :return: Keycloak server response """ payload = roles if isinstance(roles, list) else [roles] params_path = {"realm-name": self.realm_name, "id": group_id} data_raw = self.raw_post( urls_patterns.URL_ADMIN_GROUPS_REALM_ROLES.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[204]) def delete_group_realm_roles(self, group_id, roles): """ Delete realm roles of a group :param group_id: id of group :param roles: roles list or role (use GroupRoleRepresentation) :return: Keycloak server response """ payload = roles if isinstance(roles, list) else [roles] params_path = {"realm-name": self.realm_name, "id": group_id} data_raw = self.raw_delete( urls_patterns.URL_ADMIN_GROUPS_REALM_ROLES.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def get_group_realm_roles(self, group_id): """ Get all realm roles for a group. :param user_id: id of the group :return: Keycloak server response (array RoleRepresentation) """ params_path = {"realm-name": self.realm_name, "id": group_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_GROUPS_REALM_ROLES.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def assign_group_client_roles(self, group_id, client_id, roles): """ Assign client roles to a group :param group_id: id of group :param client_id: id of client (not client-id) :param roles: roles list or role (use GroupRoleRepresentation) :return: Keycloak server response """ payload = roles if isinstance(roles, list) else [roles] params_path = {"realm-name": self.realm_name, "id": group_id, "client-id": client_id} data_raw = self.raw_post( urls_patterns.URL_ADMIN_GROUPS_CLIENT_ROLES.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[204]) def get_group_client_roles(self, group_id, client_id): """ Get client roles of a group :param group_id: id of group :param client_id: id of client (not client-id) :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": group_id, "client-id": client_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_GROUPS_CLIENT_ROLES.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def delete_group_client_roles(self, group_id, client_id, roles): """ Delete client roles of a group :param group_id: id of group :param client_id: id of client (not client-id) :param roles: roles list or role (use GroupRoleRepresentation) :return: Keycloak server response (array RoleRepresentation) """ payload = roles if isinstance(roles, list) else [roles] params_path = {"realm-name": self.realm_name, "id": group_id, "client-id": client_id} data_raw = self.raw_delete( urls_patterns.URL_ADMIN_GROUPS_CLIENT_ROLES.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def get_client_roles_of_user(self, user_id, client_id): """ Get all client roles for a user. :param user_id: id of user :param client_id: id of client (not client-id) :return: Keycloak server response (array RoleRepresentation) """ return self._get_client_roles_of_user( urls_patterns.URL_ADMIN_USER_CLIENT_ROLES, user_id, client_id ) def get_available_client_roles_of_user(self, user_id, client_id): """ Get available client role-mappings for a user. :param user_id: id of user :param client_id: id of client (not client-id) :return: Keycloak server response (array RoleRepresentation) """ return self._get_client_roles_of_user( urls_patterns.URL_ADMIN_USER_CLIENT_ROLES_AVAILABLE, user_id, client_id ) def get_composite_client_roles_of_user(self, user_id, client_id): """ Get composite client role-mappings for a user. :param user_id: id of user :param client_id: id of client (not client-id) :return: Keycloak server response (array RoleRepresentation) """ return self._get_client_roles_of_user( urls_patterns.URL_ADMIN_USER_CLIENT_ROLES_COMPOSITE, user_id, client_id ) def _get_client_roles_of_user(self, client_level_role_mapping_url, user_id, client_id): params_path = {"realm-name": self.realm_name, "id": user_id, "client-id": client_id} data_raw = self.raw_get(client_level_role_mapping_url.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def delete_client_roles_of_user(self, user_id, client_id, roles): """ Delete client roles from a user. :param user_id: id of user :param client_id: id of client containing role (not client-id) :param roles: roles list or role to delete (use RoleRepresentation) :return: Keycloak server response """ payload = roles if isinstance(roles, list) else [roles] params_path = {"realm-name": self.realm_name, "id": user_id, "client-id": client_id} data_raw = self.raw_delete( urls_patterns.URL_ADMIN_USER_CLIENT_ROLES.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def get_authentication_flows(self): """ Get authentication flows. Returns all flow details AuthenticationFlowRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_authenticationflowrepresentation :return: Keycloak server response (AuthenticationFlowRepresentation) """ params_path = {"realm-name": self.realm_name} data_raw = self.raw_get(urls_patterns.URL_ADMIN_FLOWS.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_authentication_flow_for_id(self, flow_id): """ Get one authentication flow by it's id. Returns all flow details AuthenticationFlowRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_authenticationflowrepresentation :param flow_id: the id of a flow NOT it's alias :return: Keycloak server response (AuthenticationFlowRepresentation) """ params_path = {"realm-name": self.realm_name, "flow-id": flow_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_FLOWS_ALIAS.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def create_authentication_flow(self, payload, skip_exists=False): """ Create a new authentication flow AuthenticationFlowRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_authenticationflowrepresentation :param payload: AuthenticationFlowRepresentation :param skip_exists: Do not raise an error if authentication flow already exists :return: Keycloak server response (RoleRepresentation) """ params_path = {"realm-name": self.realm_name} data_raw = self.raw_post( urls_patterns.URL_ADMIN_FLOWS.format(**params_path), data=json.dumps(payload) ) return raise_error_from_response( data_raw, KeycloakPostError, expected_codes=[201], skip_exists=skip_exists ) def copy_authentication_flow(self, payload, flow_alias): """ Copy existing authentication flow under a new name. The new name is given as 'newName' attribute of the passed payload. :param payload: JSON containing 'newName' attribute :param flow_alias: the flow alias :return: Keycloak server response (RoleRepresentation) """ params_path = {"realm-name": self.realm_name, "flow-alias": flow_alias} data_raw = self.raw_post( urls_patterns.URL_ADMIN_FLOWS_COPY.format(**params_path), data=json.dumps(payload) ) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[201]) def delete_authentication_flow(self, flow_id): """ Delete authentication flow AuthenticationInfoRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_authenticationinforepresentation :param flow_id: authentication flow id :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": flow_id} data_raw = self.raw_delete(urls_patterns.URL_ADMIN_FLOW.format(**params_path)) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def get_authentication_flow_executions(self, flow_alias): """ Get authentication flow executions. Returns all execution steps :param flow_alias: the flow alias :return: Response(json) """ params_path = {"realm-name": self.realm_name, "flow-alias": flow_alias} data_raw = self.raw_get(urls_patterns.URL_ADMIN_FLOWS_EXECUTIONS.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def update_authentication_flow_executions(self, payload, flow_alias): """ Update an authentication flow execution AuthenticationExecutionInfoRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_authenticationexecutioninforepresentation :param payload: AuthenticationExecutionInfoRepresentation :param flow_alias: The flow alias :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "flow-alias": flow_alias} data_raw = self.raw_put( urls_patterns.URL_ADMIN_FLOWS_EXECUTIONS.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[202, 204]) def get_authentication_flow_execution(self, execution_id): """ Get authentication flow execution. AuthenticationExecutionInfoRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_authenticationexecutioninforepresentation :param execution_id: the execution ID :return: Response(json) """ params_path = {"realm-name": self.realm_name, "id": execution_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_FLOWS_EXECUTION.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def create_authentication_flow_execution(self, payload, flow_alias): """ Create an authentication flow execution AuthenticationExecutionInfoRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_authenticationexecutioninforepresentation :param payload: AuthenticationExecutionInfoRepresentation :param flow_alias: The flow alias :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "flow-alias": flow_alias} data_raw = self.raw_post( urls_patterns.URL_ADMIN_FLOWS_EXECUTIONS_EXECUTION.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[201]) def delete_authentication_flow_execution(self, execution_id): """ Delete authentication flow execution AuthenticationExecutionInfoRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_authenticationexecutioninforepresentation :param execution_id: keycloak client id (not oauth client-id) :return: Keycloak server response (json) """ params_path = {"realm-name": self.realm_name, "id": execution_id} data_raw = self.raw_delete(urls_patterns.URL_ADMIN_FLOWS_EXECUTION.format(**params_path)) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def create_authentication_flow_subflow(self, payload, flow_alias, skip_exists=False): """ Create a new sub authentication flow for a given authentication flow AuthenticationFlowRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_authenticationflowrepresentation :param payload: AuthenticationFlowRepresentation :param flow_alias: The flow alias :param skip_exists: Do not raise an error if authentication flow already exists :return: Keycloak server response (RoleRepresentation) """ params_path = {"realm-name": self.realm_name, "flow-alias": flow_alias} data_raw = self.raw_post( urls_patterns.URL_ADMIN_FLOWS_EXECUTIONS_FLOW.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response( data_raw, KeycloakPostError, expected_codes=[201], skip_exists=skip_exists ) def get_authenticator_providers(self): """ Get authenticator providers list. :return: Response(json) """ params_path = {"realm-name": self.realm_name} data_raw = self.raw_get( urls_patterns.URL_ADMIN_AUTHENTICATOR_PROVIDERS.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakGetError) def get_authenticator_provider_config_description(self, provider_id): """ Get authenticator's provider configuration description. AuthenticatorConfigInfoRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_authenticatorconfiginforepresentation :param provider_id: Provider Id :return: AuthenticatorConfigInfoRepresentation """ params_path = {"realm-name": self.realm_name, "provider-id": provider_id} data_raw = self.raw_get( urls_patterns.URL_ADMIN_AUTHENTICATOR_CONFIG_DESCRIPTION.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakGetError) def get_authenticator_config(self, config_id): """ Get authenticator configuration. Returns all configuration details. :param config_id: Authenticator config id :return: Response(json) """ params_path = {"realm-name": self.realm_name, "id": config_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_AUTHENTICATOR_CONFIG.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def update_authenticator_config(self, payload, config_id): """ Update an authenticator configuration. AuthenticatorConfigRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_authenticatorconfigrepresentation :param payload: AuthenticatorConfigRepresentation :param config_id: Authenticator config id :return: Response(json) """ params_path = {"realm-name": self.realm_name, "id": config_id} data_raw = self.raw_put( urls_patterns.URL_ADMIN_AUTHENTICATOR_CONFIG.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def delete_authenticator_config(self, config_id): """ Delete a authenticator configuration. https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_authentication_management_resource :param config_id: Authenticator config id :return: Keycloak server Response """ params_path = {"realm-name": self.realm_name, "id": config_id} data_raw = self.raw_delete( urls_patterns.URL_ADMIN_AUTHENTICATOR_CONFIG.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def sync_users(self, storage_id, action): """ Function to trigger user sync from provider :param storage_id: The id of the user storage provider :param action: Action can be "triggerFullSync" or "triggerChangedUsersSync" :return: """ data = {"action": action} params_query = {"action": action} params_path = {"realm-name": self.realm_name, "id": storage_id} data_raw = self.raw_post( urls_patterns.URL_ADMIN_USER_STORAGE.format(**params_path), data=json.dumps(data), **params_query ) return raise_error_from_response(data_raw, KeycloakPostError) def get_client_scopes(self): """ Get representation of the client scopes for the realm where we are connected to https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_getclientscopes :return: Keycloak server response Array of (ClientScopeRepresentation) """ params_path = {"realm-name": self.realm_name} data_raw = self.raw_get(urls_patterns.URL_ADMIN_CLIENT_SCOPES.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_client_scope(self, client_scope_id): """ Get representation of the client scopes for the realm where we are connected to https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_getclientscopes :param client_scope_id: The id of the client scope :return: Keycloak server response (ClientScopeRepresentation) """ params_path = {"realm-name": self.realm_name, "scope-id": client_scope_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_CLIENT_SCOPE.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_client_scope_by_name(self, client_scope_name): """ Get representation of the client scope identified by the client scope name. https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_getclientscopes :param client_scope_name: (str) Name of the client scope :returns: ClientScopeRepresentation or None """ client_scopes = self.get_client_scopes() for client_scope in client_scopes: if client_scope["name"] == client_scope_name: return client_scope return None def create_client_scope(self, payload, skip_exists=False): """ Create a client scope ClientScopeRepresentation: https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_getclientscopes :param payload: ClientScopeRepresentation :param skip_exists: If true then do not raise an error if client scope already exists :return: Client scope id """ if skip_exists: exists = self.get_client_scope_by_name(client_scope_name=payload["name"]) if exists is not None: return exists["id"] params_path = {"realm-name": self.realm_name} data_raw = self.raw_post( urls_patterns.URL_ADMIN_CLIENT_SCOPES.format(**params_path), data=json.dumps(payload) ) raise_error_from_response( data_raw, KeycloakPostError, expected_codes=[201], skip_exists=skip_exists ) _last_slash_idx = data_raw.headers["Location"].rindex("/") return data_raw.headers["Location"][_last_slash_idx + 1 :] # noqa: E203 def update_client_scope(self, client_scope_id, payload): """ Update a client scope ClientScopeRepresentation: https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_client_scopes_resource :param client_scope_id: The id of the client scope :param payload: ClientScopeRepresentation :return: Keycloak server response (ClientScopeRepresentation) """ params_path = {"realm-name": self.realm_name, "scope-id": client_scope_id} data_raw = self.raw_put( urls_patterns.URL_ADMIN_CLIENT_SCOPE.format(**params_path), data=json.dumps(payload) ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def delete_client_scope(self, client_scope_id): """ Delete existing client scope. ClientScopeRepresentation: https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_client_scopes_resource :param client_scope_id: The id of the client scope :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "scope-id": client_scope_id} data_raw = self.raw_delete(urls_patterns.URL_ADMIN_CLIENT_SCOPE.format(**params_path)) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def get_mappers_from_client_scope(self, client_scope_id): """ Get a list of all mappers connected to the client scope https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_protocol_mappers_resource :param client_scope_id: Client scope id :returns: Keycloak server response (ProtocolMapperRepresentation) """ params_path = {"realm-name": self.realm_name, "scope-id": client_scope_id} data_raw = self.raw_get( urls_patterns.URL_ADMIN_CLIENT_SCOPES_ADD_MAPPER.format(**params_path), ) return raise_error_from_response(data_raw, KeycloakGetError, expected_codes=[200]) def add_mapper_to_client_scope(self, client_scope_id, payload): """ Add a mapper to a client scope https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_create_mapper :param client_scope_id: The id of the client scope :param payload: ProtocolMapperRepresentation :return: Keycloak server Response """ params_path = {"realm-name": self.realm_name, "scope-id": client_scope_id} data_raw = self.raw_post( urls_patterns.URL_ADMIN_CLIENT_SCOPES_ADD_MAPPER.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[201]) def delete_mapper_from_client_scope(self, client_scope_id, protocol_mapper_id): """ Delete a mapper from a client scope https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_delete_mapper :param client_scope_id: The id of the client scope :param protocol_mapper_id: Protocol mapper id :return: Keycloak server Response """ params_path = { "realm-name": self.realm_name, "scope-id": client_scope_id, "protocol-mapper-id": protocol_mapper_id, } data_raw = self.raw_delete( urls_patterns.URL_ADMIN_CLIENT_SCOPES_MAPPERS.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def update_mapper_in_client_scope(self, client_scope_id, protocol_mapper_id, payload): """ Update an existing protocol mapper in a client scope https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_protocol_mappers_resource :param client_scope_id: The id of the client scope :param protocol_mapper_id: The id of the protocol mapper which exists in the client scope and should to be updated :param payload: ProtocolMapperRepresentation :return: Keycloak server Response """ params_path = { "realm-name": self.realm_name, "scope-id": client_scope_id, "protocol-mapper-id": protocol_mapper_id, } data_raw = self.raw_put( urls_patterns.URL_ADMIN_CLIENT_SCOPES_MAPPERS.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def get_default_default_client_scopes(self): """ Return list of default default client scopes :return: Keycloak server response """ params_path = {"realm-name": self.realm_name} data_raw = self.raw_get( urls_patterns.URL_ADMIN_DEFAULT_DEFAULT_CLIENT_SCOPES.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakGetError) def delete_default_default_client_scope(self, scope_id): """ Delete default default client scope :param scope_id: default default client scope id :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": scope_id} data_raw = self.raw_delete( urls_patterns.URL_ADMIN_DEFAULT_DEFAULT_CLIENT_SCOPE.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def add_default_default_client_scope(self, scope_id): """ Add default default client scope :param scope_id: default default client scope id :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": scope_id} payload = {"realm": self.realm_name, "clientScopeId": scope_id} data_raw = self.raw_put( urls_patterns.URL_ADMIN_DEFAULT_DEFAULT_CLIENT_SCOPE.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def get_default_optional_client_scopes(self): """ Return list of default optional client scopes :return: Keycloak server response """ params_path = {"realm-name": self.realm_name} data_raw = self.raw_get( urls_patterns.URL_ADMIN_DEFAULT_OPTIONAL_CLIENT_SCOPES.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakGetError) def delete_default_optional_client_scope(self, scope_id): """ Delete default optional client scope :param scope_id: default optional client scope id :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": scope_id} data_raw = self.raw_delete( urls_patterns.URL_ADMIN_DEFAULT_OPTIONAL_CLIENT_SCOPE.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def add_default_optional_client_scope(self, scope_id): """ Add default optional client scope :param scope_id: default optional client scope id :return: Keycloak server response """ params_path = {"realm-name": self.realm_name, "id": scope_id} payload = {"realm": self.realm_name, "clientScopeId": scope_id} data_raw = self.raw_put( urls_patterns.URL_ADMIN_DEFAULT_OPTIONAL_CLIENT_SCOPE.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def get_mappers_from_client(self, client_id): """ List of all client mappers. https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_protocolmapperrepresentation :param client_id: Client id :returns: KeycloakServerResponse (list of ProtocolMapperRepresentation) """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_get( urls_patterns.URL_ADMIN_CLIENT_PROTOCOL_MAPPERS.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[200]) def add_mapper_to_client(self, client_id, payload): """ Add a mapper to a client https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_create_mapper :param client_id: The id of the client :param payload: ProtocolMapperRepresentation :return: Keycloak server Response """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_post( urls_patterns.URL_ADMIN_CLIENT_PROTOCOL_MAPPERS.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[201]) def update_client_mapper(self, client_id, mapper_id, payload): """ Update client mapper :param client_id: The id of the client :param client_mapper_id: The id of the mapper to be deleted :param payload: ProtocolMapperRepresentation :return: Keycloak server response """ params_path = { "realm-name": self.realm_name, "id": client_id, "protocol-mapper-id": mapper_id, } data_raw = self.raw_put( urls_patterns.URL_ADMIN_CLIENT_PROTOCOL_MAPPER.format(**params_path), data=json.dumps(payload), ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def remove_client_mapper(self, client_id, client_mapper_id): """ Removes a mapper from the client https://www.keycloak.org/docs-api/15.0/rest-api/index.html#_protocol_mappers_resource :param client_id: The id of the client :param client_mapper_id: The id of the mapper to be deleted :return: Keycloak server response """ params_path = { "realm-name": self.realm_name, "id": client_id, "protocol-mapper-id": client_mapper_id, } data_raw = self.raw_delete( urls_patterns.URL_ADMIN_CLIENT_PROTOCOL_MAPPER.format(**params_path) ) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def generate_client_secrets(self, client_id): """ Generate a new secret for the client https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_regeneratesecret :param client_id: id of client (not client-id) :return: Keycloak server response (ClientRepresentation) """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_post( urls_patterns.URL_ADMIN_CLIENT_SECRETS.format(**params_path), data=None ) return raise_error_from_response(data_raw, KeycloakPostError) def get_client_secrets(self, client_id): """ Get representation of the client secrets https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_getclientsecret :param client_id: id of client (not client-id) :return: Keycloak server response (ClientRepresentation) """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_CLIENT_SECRETS.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_components(self, query=None): """ Return a list of components, filtered according to query parameters ComponentRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_componentrepresentation :param query: Query parameters (optional) :return: components list """ query = query or dict() params_path = {"realm-name": self.realm_name} data_raw = self.raw_get( urls_patterns.URL_ADMIN_COMPONENTS.format(**params_path), data=None, **query ) return raise_error_from_response(data_raw, KeycloakGetError) def create_component(self, payload): """ Create a new component. ComponentRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_componentrepresentation :param payload: ComponentRepresentation :return: Component id """ params_path = {"realm-name": self.realm_name} data_raw = self.raw_post( urls_patterns.URL_ADMIN_COMPONENTS.format(**params_path), data=json.dumps(payload) ) raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[201]) _last_slash_idx = data_raw.headers["Location"].rindex("/") return data_raw.headers["Location"][_last_slash_idx + 1 :] # noqa: E203 def get_component(self, component_id): """ Get representation of the component :param component_id: Component id ComponentRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_componentrepresentation :return: ComponentRepresentation """ params_path = {"realm-name": self.realm_name, "component-id": component_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_COMPONENT.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def update_component(self, component_id, payload): """ Update the component :param component_id: Component id :param payload: ComponentRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_componentrepresentation :return: Http response """ params_path = {"realm-name": self.realm_name, "component-id": component_id} data_raw = self.raw_put( urls_patterns.URL_ADMIN_COMPONENT.format(**params_path), data=json.dumps(payload) ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def delete_component(self, component_id): """ Delete the component :param component_id: Component id :return: Http response """ params_path = {"realm-name": self.realm_name, "component-id": component_id} data_raw = self.raw_delete(urls_patterns.URL_ADMIN_COMPONENT.format(**params_path)) return raise_error_from_response(data_raw, KeycloakDeleteError, expected_codes=[204]) def get_keys(self): """ Return a list of keys, filtered according to query parameters KeysMetadataRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_key_resource :return: keys list """ params_path = {"realm-name": self.realm_name} data_raw = self.raw_get(urls_patterns.URL_ADMIN_KEYS.format(**params_path), data=None) return raise_error_from_response(data_raw, KeycloakGetError) def get_events(self, query=None): """ Return a list of events, filtered according to query parameters EventRepresentation array https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_eventrepresentation :return: events list """ query = query or dict() params_path = {"realm-name": self.realm_name} data_raw = self.raw_get( urls_patterns.URL_ADMIN_EVENTS.format(**params_path), data=None, **query ) return raise_error_from_response(data_raw, KeycloakGetError) def set_events(self, payload): """ Set realm events configuration RealmEventsConfigRepresentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_realmeventsconfigrepresentation :return: Http response """ params_path = {"realm-name": self.realm_name} data_raw = self.raw_put( urls_patterns.URL_ADMIN_EVENTS_CONFIG.format(**params_path), data=json.dumps(payload) ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) def raw_get(self, *args, **kwargs): """ Calls connection.raw_get. If auto_refresh is set for *get* and *access_token* is expired, it will refresh the token and try *get* once more. """ r = self.connection.raw_get(*args, **kwargs) if "get" in self.auto_refresh_token and r.status_code == 401: self.refresh_token() return self.connection.raw_get(*args, **kwargs) return r def raw_post(self, *args, **kwargs): """ Calls connection.raw_post. If auto_refresh is set for *post* and *access_token* is expired, it will refresh the token and try *post* once more. """ r = self.connection.raw_post(*args, **kwargs) if "post" in self.auto_refresh_token and r.status_code == 401: self.refresh_token() return self.connection.raw_post(*args, **kwargs) return r def raw_put(self, *args, **kwargs): """ Calls connection.raw_put. If auto_refresh is set for *put* and *access_token* is expired, it will refresh the token and try *put* once more. """ r = self.connection.raw_put(*args, **kwargs) if "put" in self.auto_refresh_token and r.status_code == 401: self.refresh_token() return self.connection.raw_put(*args, **kwargs) return r def raw_delete(self, *args, **kwargs): """ Calls connection.raw_delete. If auto_refresh is set for *delete* and *access_token* is expired, it will refresh the token and try *delete* once more. """ r = self.connection.raw_delete(*args, **kwargs) if "delete" in self.auto_refresh_token and r.status_code == 401: self.refresh_token() return self.connection.raw_delete(*args, **kwargs) return r def get_token(self): if self.user_realm_name: token_realm_name = self.user_realm_name elif self.realm_name: token_realm_name = self.realm_name else: token_realm_name = "master" self.keycloak_openid = KeycloakOpenID( server_url=self.server_url, client_id=self.client_id, realm_name=token_realm_name, verify=self.verify, client_secret_key=self.client_secret_key, custom_headers=self.custom_headers, ) grant_type = [] if self.client_secret_key: if self.user_realm_name: self.realm_name = self.user_realm_name grant_type.append("client_credentials") elif self.username and self.password: grant_type.append("password") if grant_type: self.token = self.keycloak_openid.token( self.username, self.password, grant_type=grant_type, totp=self.totp ) headers = { "Authorization": "Bearer " + self.token.get("access_token"), "Content-Type": "application/json", } else: self.token = None headers = {} if self.custom_headers is not None: # merge custom headers to main headers headers.update(self.custom_headers) self.connection = ConnectionManager( base_url=self.server_url, headers=headers, timeout=60, verify=self.verify ) def refresh_token(self): refresh_token = self.token.get("refresh_token", None) if refresh_token is None: self.get_token() else: try: self.token = self.keycloak_openid.refresh_token(refresh_token) except KeycloakGetError as e: list_errors = [ b"Refresh token expired", b"Token is not active", b"Session not active", ] if e.response_code == 400 and any(err in e.response_body for err in list_errors): self.get_token() else: raise self.connection.add_param_headers( "Authorization", "Bearer " + self.token.get("access_token") ) def get_client_all_sessions(self, client_id): """ Get sessions associated with the client :param client_id: id of client UserSessionRepresentation http://www.keycloak.org/docs-api/18.0/rest-api/index.html#_usersessionrepresentation :return: UserSessionRepresentation """ params_path = {"realm-name": self.realm_name, "id": client_id} data_raw = self.raw_get(urls_patterns.URL_ADMIN_CLIENT_ALL_SESSIONS.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError) def get_client_sessions_stats(self): """ Get current session count for all clients with active sessions https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_getclientsessionstats :return: Dict of clients and session count """ params_path = {"realm-name": self.realm_name} data_raw = self.raw_get(urls_patterns.URL_ADMIN_CLIENT_SESSION_STATS.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError)
37.820353
109
0.657552
12,539
102,947
5.137491
0.044023
0.042891
0.027849
0.042224
0.780453
0.744516
0.716698
0.690604
0.664074
0.650165
0
0.007247
0.250741
102,947
2,721
110
37.834252
0.82791
0.329383
0
0.437229
0
0
0.045102
0.000376
0
0
0
0.000368
0
1
0.153247
false
0.013853
0.006926
0.011255
0.32987
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
d78b52f6e8d298cf64ce6a19466a6063f1b371ef
224
py
Python
Searching Algorithms/2.1-linear_search.py
neeveermoree/data_structures_and_algorithms
8aa37cade53539909383fb9d4952b13ca19c931a
[ "MIT" ]
null
null
null
Searching Algorithms/2.1-linear_search.py
neeveermoree/data_structures_and_algorithms
8aa37cade53539909383fb9d4952b13ca19c931a
[ "MIT" ]
null
null
null
Searching Algorithms/2.1-linear_search.py
neeveermoree/data_structures_and_algorithms
8aa37cade53539909383fb9d4952b13ca19c931a
[ "MIT" ]
null
null
null
def linear_search(a, key): length = len(a) idx = 0 while idx < length: if a[idx] == key: return idx idx += 1 return -1 a = [1, 3, 5, 10, 13] key = 5 print(linear_search(a, key))
16
28
0.495536
36
224
3.027778
0.5
0.220183
0.238532
0.293578
0
0
0
0
0
0
0
0.077465
0.366071
224
13
29
17.230769
0.690141
0
0
0
0
0
0
0
0
0
0
0
0
1
0.090909
false
0
0
0
0.272727
0.090909
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
ad1661c6c350d50192a5a172021636880a1cd5cb
123
py
Python
error_report/urls.py
biolab/orange-web
f1b1e4fc6acd00dd4033cdf55baef0b8d216428a
[ "Qhull" ]
17
2016-04-14T17:07:20.000Z
2021-02-14T09:27:50.000Z
error_report/urls.py
biolab/orange-web
f1b1e4fc6acd00dd4033cdf55baef0b8d216428a
[ "Qhull" ]
38
2015-08-28T08:53:20.000Z
2019-05-10T11:49:24.000Z
error_report/urls.py
biolab/orange-web
f1b1e4fc6acd00dd4033cdf55baef0b8d216428a
[ "Qhull" ]
27
2015-01-29T10:44:12.000Z
2021-12-12T17:21:26.000Z
from django.conf.urls import url from error_report import views urlpatterns = [ url(r'^v1/$', views.v1, name='v1'), ]
17.571429
39
0.682927
19
123
4.368421
0.684211
0
0
0
0
0
0
0
0
0
0
0.029126
0.162602
123
6
40
20.5
0.776699
0
0
0
0
0
0.056911
0
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
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
ad24c6696fc9de0a6e9572d970ea9dac1105e220
350
py
Python
leetcode/offer_09.py
zhaipro/acm
b12a33ddcc19460491bec275f7ef77760bafaa9f
[ "MIT" ]
null
null
null
leetcode/offer_09.py
zhaipro/acm
b12a33ddcc19460491bec275f7ef77760bafaa9f
[ "MIT" ]
1
2019-07-13T13:51:58.000Z
2020-01-03T01:35:55.000Z
leetcode/offer_09.py
zhaipro/acm
b12a33ddcc19460491bec275f7ef77760bafaa9f
[ "MIT" ]
1
2020-01-15T05:31:05.000Z
2020-01-15T05:31:05.000Z
class CQueue: def __init__(self): self.q = [] def appendTail(self, value: int) -> None: self.q.append(value) def deleteHead(self) -> int: return self.q.pop(0) if self.q else -1 # Your CQueue object will be instantiated and called as such: # obj = CQueue() # obj.appendTail(value) # param_2 = obj.deleteHead()
20.588235
61
0.625714
50
350
4.28
0.6
0.093458
0
0
0
0
0
0
0
0
0
0.011364
0.245714
350
16
62
21.875
0.799242
0.351429
0
0
0
0
0
0
0
0
0
0
0
1
0.428571
false
0
0
0.142857
0.714286
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
ad2a78644eca93685326b3feac3a377b6c0f2031
192
py
Python
v1/tasks/urls.py
itsnikhil/Website-API
cd0d9692585c46b376b4c62bbae97f68720abc2d
[ "MIT" ]
null
null
null
v1/tasks/urls.py
itsnikhil/Website-API
cd0d9692585c46b376b4c62bbae97f68720abc2d
[ "MIT" ]
null
null
null
v1/tasks/urls.py
itsnikhil/Website-API
cd0d9692585c46b376b4c62bbae97f68720abc2d
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from rest_framework.routers import SimpleRouter from .views.task import TaskViewSet router = SimpleRouter(trailing_slash=False) router.register('tasks', TaskViewSet)
24
47
0.78125
23
192
6.434783
0.782609
0
0
0
0
0
0
0
0
0
0
0.005814
0.104167
192
7
48
27.428571
0.854651
0.109375
0
0
0
0
0.029586
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
ad312ce8272d339579908eead9a9e1f788854b83
88
py
Python
setuptools_conda/__init__.py
naegelyd-insitro/setuptools-conda
80c3e2cc38cfb6f2f78e9bdd01ba099f01aa4632
[ "BSD-2-Clause" ]
23
2020-06-25T14:28:47.000Z
2022-03-16T19:03:39.000Z
setuptools_conda/__init__.py
naegelyd-insitro/setuptools-conda
80c3e2cc38cfb6f2f78e9bdd01ba099f01aa4632
[ "BSD-2-Clause" ]
11
2020-05-30T06:17:14.000Z
2021-12-25T10:45:00.000Z
setuptools_conda/__init__.py
chrisjbillington/setuptools_conda
61a13226e23637b28c5ecf3e7a6dd61888ce5f20
[ "BSD-2-Clause" ]
3
2020-11-07T05:06:49.000Z
2021-08-05T16:04:05.000Z
try: from .__version__ import __version__ except ImportError: __version__ = None
22
40
0.761364
9
88
6.111111
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.193182
88
4
41
22
0.774648
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
ad33da03f07bfd03f80ffd06307fe250b3cf74eb
3,835
py
Python
gym_extensions/wrappers/transformers.py
nicofirst1/gym-extensions
0a5bb74a248484d2a7e5d2cb552e247612650f04
[ "MIT" ]
218
2017-07-03T21:29:19.000Z
2022-03-23T13:39:15.000Z
gym_extensions/wrappers/transformers.py
nicofirst1/gym-extensions
0a5bb74a248484d2a7e5d2cb552e247612650f04
[ "MIT" ]
13
2017-07-04T17:09:47.000Z
2021-03-19T02:47:11.000Z
gym_extensions/wrappers/transformers.py
nicofirst1/gym-extensions
0a5bb74a248484d2a7e5d2cb552e247612650f04
[ "MIT" ]
50
2017-07-03T19:32:55.000Z
2021-12-01T09:13:57.000Z
import numpy as np import scipy.misc from gym.spaces.box import Box from scipy.misc import imresize from cached_property import cached_property # TODO: move this to folder with different files class BaseTransformer(object): """ Base transformer interface, inherited objects should conform to this """ def transform(self, observation): """ observation to transform """ raise NotImplementedError def transformed_observation_space(self, prev_observation_space): """ prev_observation_space and how it is modified """ return prev_observation_space def reset(self): """ resets the transformer if there is an operation to be made """ return class AppendPrevTimeStepTransformer(BaseTransformer): """ Keeps track of and appends the previous observation timestep. """ def __init__(self): self.prev_timestep = None def transform(self, observation): if self.prev_timestep is None: self.prev_timestep = np.zeros(observation.shape) new_obs = np.concatenate([observation.reshape((1, -1)), self.prev_timestep.reshape((1, -1))], axis=1).reshape(-1) self.prev_timestep = observation return new_obs def transformed_observation_space(self, prev_observation_space): if type(prev_observation_space) is Box: #TODO: should use tile? copy = np.copy(prev_observation_space.low.reshape((1, -1))) low = np.concatenate([copy, copy], axis=1) copy = np.copy(prev_observation_space.high.reshape((1, -1))) high = np.concatenate([copy, copy], axis=1) return Box(low.reshape(-1), high.reshape(-1)) else: raise NotImplementedError("Currently only support Box observation spaces for ResizeImageTransformer") return prev_observation_space def reset(self): self.prev_timestep = None class SimpleNormalizePixelIntensitiesTransformer(BaseTransformer): """ Normalizes pixel intensities simply by dividing by 255. """ def transform(self, observation): return np.array(observation).astype(np.float32) / 255.0 def transformed_observation_space(self, wrapped_observation_space): return wrapped_observation_space class ResizeImageTransformer(BaseTransformer): """ Rescale a given image by a percentage """ def __init__(self, fraction_of_current_size): self.fraction_of_current_size = fraction_of_current_size def transform(self, observation): return scipy.misc.imresize(observation, self.fraction_of_current_size) def transformed_observation_space(self, wrapped_observation_space): if type(wrapped_observation_space) is Box: return Box(scipy.misc.imresize(wrapped_observation_space.low, self.fraction_of_current_size), scipy.misc.imresize(wrapped_observation_space.high, self.fraction_of_current_size)) else: raise NotImplementedError("Currently only support Box observation spaces for ResizeImageTransformer") class RandomSensorMaskTransformer(BaseTransformer): """ Randomly occlude a given percentage of sensors on every observation. Randomly occludes different ones every time """ def __init__(self, env, percent_of_sensors_to_occlude=.15): """ Knock out random sensors """ self.percent_of_sensors_to_occlude = percent_of_sensors_to_occlude self.obs_dims = env.observation_space.flat_dim def occlude(self, obs): sensor_idx = np.random.randint(0, self.obs_dims-1, size=int(self.obs_dims * self.percent_of_sensors_to_occlude)) obs[sensor_idx] = 0 return obs def transform(self, observation): return self.occlude(observation)
33.938053
189
0.696741
451
3,835
5.7051
0.281596
0.11815
0.062184
0.04897
0.417023
0.28527
0.188107
0.15857
0.072289
0.072289
0
0.009377
0.221382
3,835
112
190
34.241071
0.852311
0.146545
0
0.327586
0
0
0.046452
0.014194
0
0
0
0.017857
0
1
0.258621
false
0
0.086207
0.068966
0.62069
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
1
0
0
0
0
1
0
0
3
ad33f98f22c326998fb32194dd7084aa7e142a14
303
py
Python
modular_example.py
Sanjin84/CompetitionInterface
50ba1c58b874897d1991b6a28816f2424803a0b2
[ "CC0-1.0" ]
null
null
null
modular_example.py
Sanjin84/CompetitionInterface
50ba1c58b874897d1991b6a28816f2424803a0b2
[ "CC0-1.0" ]
null
null
null
modular_example.py
Sanjin84/CompetitionInterface
50ba1c58b874897d1991b6a28816f2424803a0b2
[ "CC0-1.0" ]
null
null
null
from cryptography.fernet import Fernet key = b'DqbtoOEMKXpTsYjm9FFRJOwOXEfUPn5vmUvlOnsx2MY=' fernet = Fernet(key) val = b'gAAAAABhKqyKrqOSza4x-xRDUy-0B4qVeZq-153pDn2I6eny4I-2r01OWyp0vcDWREII_cLgWCTGJ1do-nP-kPYyQZKk7w3vBO19DjNZWgzJ2Fvan1c1fqQ=' decrypted = fernet.decrypt(val).decode() print(decrypted)
37.875
129
0.851485
28
303
9.178571
0.714286
0.070039
0
0
0
0
0
0
0
0
0
0.084211
0.059406
303
8
130
37.875
0.817544
0
0
0
0
0
0.539474
0.539474
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
0.166667
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
0
0
0
0
0
3
ad3a7cb6a363dd277ea4324bb0171be7b927139f
465
py
Python
platform/core/polyaxon/conf/options/deployments.py
hackerwins/polyaxon
ff56a098283ca872abfbaae6ba8abba479ffa394
[ "Apache-2.0" ]
null
null
null
platform/core/polyaxon/conf/options/deployments.py
hackerwins/polyaxon
ff56a098283ca872abfbaae6ba8abba479ffa394
[ "Apache-2.0" ]
null
null
null
platform/core/polyaxon/conf/options/deployments.py
hackerwins/polyaxon
ff56a098283ca872abfbaae6ba8abba479ffa394
[ "Apache-2.0" ]
null
null
null
import conf from options.registry import deployments conf.subscribe(deployments.PlatformEnvironmentVersion) conf.subscribe(deployments.ChartVersion) conf.subscribe(deployments.ChartIsUpgrade) conf.subscribe(deployments.CliMinVersion) conf.subscribe(deployments.CliLatestVersion) conf.subscribe(deployments.PlatformMinVersion) conf.subscribe(deployments.PlatformLatestVersion) conf.subscribe(deployments.LibMinVersion) conf.subscribe(deployments.LibLatestVersion)
33.214286
54
0.883871
43
465
9.55814
0.372093
0.284672
0.525547
0
0
0
0
0
0
0
0
0
0.036559
465
13
55
35.769231
0.917411
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.181818
0
0.181818
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
ad3ed3dc6cb396250a37d71a105bf547cd60c382
205
py
Python
django_webdav_storage/compat.py
m-thielen/django-webdav-storage
c40d2ba53f171e23684769c0b41f0d12da4c9a49
[ "BSD-3-Clause" ]
27
2015-01-28T09:17:09.000Z
2021-06-21T20:48:01.000Z
django_webdav_storage/compat.py
m-thielen/django-webdav-storage
c40d2ba53f171e23684769c0b41f0d12da4c9a49
[ "BSD-3-Clause" ]
9
2015-08-07T15:03:00.000Z
2020-05-01T04:54:02.000Z
django_webdav_storage/compat.py
m-thielen/django-webdav-storage
c40d2ba53f171e23684769c0b41f0d12da4c9a49
[ "BSD-3-Clause" ]
19
2015-05-20T14:16:25.000Z
2022-03-31T06:31:59.000Z
import sys PY2 = sys.version_info.major == 2 PY3 = sys.version_info.major == 3 try: TEXT_TYPE = unicode except NameError: TEXT_TYPE = str def b(s): return s.encode('latin-1') if PY3 else s
14.642857
44
0.668293
35
205
3.8
0.714286
0.150376
0.210526
0.285714
0
0
0
0
0
0
0
0.0375
0.219512
205
13
45
15.769231
0.79375
0
0
0
0
0
0.034146
0
0
0
0
0
0
1
0.111111
false
0
0.111111
0.111111
0.333333
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
3
ad5ddb105386984c5f1d4aa1f8302184d1169a59
747
py
Python
WebBrickLibs/MiscLib/SuperGlobal.py
AndyThirtover/wb_gateway
69f9c870369085f4440033201e2fb263a463a523
[ "BSD-3-Clause" ]
null
null
null
WebBrickLibs/MiscLib/SuperGlobal.py
AndyThirtover/wb_gateway
69f9c870369085f4440033201e2fb263a463a523
[ "BSD-3-Clause" ]
null
null
null
WebBrickLibs/MiscLib/SuperGlobal.py
AndyThirtover/wb_gateway
69f9c870369085f4440033201e2fb263a463a523
[ "BSD-3-Clause" ]
null
null
null
# Copyright L.P.Klyne 2013 # Licenced under 3 clause BSD licence # $Id: SuperGlobal.py 2612 2008-08-11 20:08:49Z graham.klyne $ import __main__ class SuperGlobal: """ http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/457667 Here so can use in testing. Creates globals. i.e. superglobal = SuperGlobal() superglobal.data = .... However many times you create SuperGlobal it access the same data. """ def __getattr__(self, name): return __main__.__dict__.get(name, None) def __setattr__(self, name, value): __main__.__dict__[name] = value def __delattr__(self, name): if __main__.__dict__.has_key(name): del __main__.__dict__[name]
23.34375
70
0.651941
94
747
4.659574
0.712766
0.073059
0.054795
0
0
0
0
0
0
0
0
0.051601
0.247657
747
31
71
24.096774
0.727758
0.481928
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.111111
0.111111
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
ad6081517965da5a80c5f4159ddb005a12180f02
396
py
Python
bluebottle/bluebottle_drf2/middleware.py
jayvdb/bluebottle
305fea238e6aa831598a8b227223a1a2f34c4fcc
[ "BSD-3-Clause" ]
null
null
null
bluebottle/bluebottle_drf2/middleware.py
jayvdb/bluebottle
305fea238e6aa831598a8b227223a1a2f34c4fcc
[ "BSD-3-Clause" ]
null
null
null
bluebottle/bluebottle_drf2/middleware.py
jayvdb/bluebottle
305fea238e6aa831598a8b227223a1a2f34c4fcc
[ "BSD-3-Clause" ]
null
null
null
from builtins import object METHOD_OVERRIDE_HEADER = 'HTTP_X_HTTP_METHOD_OVERRIDE' class MethodOverrideMiddleware(object): def process_view(self, request, callback, callback_args, callback_kwargs): if request.method != 'POST': return if METHOD_OVERRIDE_HEADER not in request.META: return request.method = request.META[METHOD_OVERRIDE_HEADER]
33
78
0.724747
46
396
5.956522
0.543478
0.20438
0.218978
0
0
0
0
0
0
0
0
0
0.209596
396
11
79
36
0.875399
0
0
0.222222
0
0
0.078283
0.068182
0
0
0
0
0
1
0.111111
false
0
0.111111
0
0.555556
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
ad7170766dc6f9a0dcf55da84165005be8a43bde
430
py
Python
from_scratch.py
sidrakesh/Donna-Chat-Bot
3c7064107df037598c7f00718d63676e7d877ca2
[ "MIT" ]
null
null
null
from_scratch.py
sidrakesh/Donna-Chat-Bot
3c7064107df037598c7f00718d63676e7d877ca2
[ "MIT" ]
null
null
null
from_scratch.py
sidrakesh/Donna-Chat-Bot
3c7064107df037598c7f00718d63676e7d877ca2
[ "MIT" ]
null
null
null
#!/usr/bin/python import os import shutil def main(): try: shutil.rmtree('Knowledge_DB_common') shutil.rmtree('Knowledge_DB_data') except OSError: pass os.system('python data_entry.py') os.system('python question_answer_learning_rules.py question_formats.txt') os.system('python rules_entry.py common.txt') os.system('python seed_greetings.py') os.system('clear') if __name__ == '__main__': main()
20.47619
76
0.723256
61
430
4.786885
0.508197
0.136986
0.191781
0.157534
0
0
0
0
0
0
0
0
0.14186
430
21
77
20.47619
0.791328
0.037209
0
0
0
0
0.449275
0.07971
0
0
0
0
0
1
0.066667
true
0.066667
0.133333
0
0.2
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
1
0
0
0
0
0
3
a8f40978c72c5860f91b38cc255a4091195e23ad
3,124
py
Python
bitex/interfaces/gemini.py
ligggooo/quant2018
adbf68da414f422157dff8b744df214fc6631342
[ "MIT" ]
312
2018-01-06T13:51:48.000Z
2022-03-01T21:14:21.000Z
bitex/interfaces/gemini.py
ligggooo/quant2018
adbf68da414f422157dff8b744df214fc6631342
[ "MIT" ]
111
2016-06-14T18:44:12.000Z
2018-01-06T00:58:31.000Z
bitex/interfaces/gemini.py
ligggooo/quant2018
adbf68da414f422157dff8b744df214fc6631342
[ "MIT" ]
98
2018-01-06T15:24:36.000Z
2022-01-13T03:00:05.000Z
""" https://docs.gemini.com/rest-api/ """ # Import Built-Ins import logging # Import Third-Party # Import Homebrew from bitex.api.REST import GeminiREST from bitex.api.WSS.gemini import GeminiWSS from bitex.utils import return_api_response from bitex.formatters.gemini import GmniFormatter as fmt # Init Logging Facilities log = logging.getLogger(__name__) class Gemini(GeminiREST): def __init__(self, key='', secret='', key_file='', websocket=False): super(Gemini, self).__init__(key, secret) if key_file: self.load_key(key_file) if websocket: self.wss = GeminiWSS() self.wss.start() else: self.wss = None def public_query(self, endpoint, **kwargs): return self.query('GET', endpoint, **kwargs) def private_query(self, endpoint, method_verb='POST', **kwargs): return self.query(method_verb, endpoint, authenticate=True, **kwargs) """ BitEx Standardized Methods """ @return_api_response(fmt.ticker) def ticker(self, pair, **kwargs): return self.public_query('pubticker/%s' % pair, params=kwargs) @return_api_response(fmt.order_book) def order_book(self, pair, **kwargs): return self.public_query('book/%s' % pair, params=kwargs) @return_api_response(fmt.trades) def trades(self, pair, **kwargs): return self.public_query('trades/%s' % pair, params=kwargs) @return_api_response(fmt.order) def bid(self, pair, price, size, **kwargs): q = {'symbol': pair, 'amount': size, 'price': price, 'side': 'buy'} q.update(kwargs) return self.private_query('order/new', params=q) @return_api_response(fmt.order) def ask(self, pair, price, size, **kwargs): q = {'symbol': pair, 'amount': size, 'price': price, 'side': 'sell'} q.update(kwargs) return self.private_query('order/new', params=q) @return_api_response(fmt.cancel) def cancel_order(self, order_id, **kwargs): q = {'order_id': order_id} q.update(kwargs) return self.private_query('order/cancel', params=q) @return_api_response(fmt.order_status) def order(self, order_id, **kwargs): q = {'order_id': order_id} q.update(kwargs) return self.private_query('order/status', params=q) @return_api_response(fmt.balance) def balance(self, **kwargs): return self.private_query('balances', params=kwargs) @return_api_response(fmt.withdraw) def withdraw(self, size, tar_addr, **kwargs): raise NotImplementedError() @return_api_response(fmt.deposit) def deposit_address(self, **kwargs): raise NotImplementedError() """ Exchange Specific Methods """ @return_api_response(None) def pairs(self): return self.public_query('symbols') @return_api_response(None) def auction(self, pair): return self.public_query('auction/%s' % pair) @return_api_response(None) def auction_history(self, pair, **kwargs): return self.public_query('auction/%s/history' % pair, params=kwargs)
30.038462
77
0.654289
393
3,124
5.017812
0.24173
0.091278
0.12069
0.10142
0.46856
0.442191
0.359026
0.26927
0.250507
0.207911
0
0
0.211268
3,124
103
78
30.330097
0.800325
0.035211
0
0.223881
0
0
0.063356
0
0
0
0
0
0
1
0.238806
false
0
0.074627
0.134328
0.522388
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
a8f447c77040fdc52cb1844dd70ac0635ba47efb
89
py
Python
records/12-18/__init__.py
AaronYang2333/CSCI_570
03e34ce5ff192fc94612bc3afb51dcab3e854462
[ "Apache-2.0" ]
36
2020-07-25T00:13:25.000Z
2022-02-28T17:48:15.000Z
records/12-18/__init__.py
AaronYang2333/LeetCode
03e34ce5ff192fc94612bc3afb51dcab3e854462
[ "Apache-2.0" ]
6
2020-06-06T04:39:37.000Z
2021-04-03T01:45:39.000Z
records/12-18/__init__.py
AaronYang2333/LeetCode
03e34ce5ff192fc94612bc3afb51dcab3e854462
[ "Apache-2.0" ]
16
2020-12-16T02:38:16.000Z
2022-02-28T17:48:16.000Z
__author__ = 'Aaron Yang' __email__ = 'byang971@usc.edu' __date__ = '12/18/2020 11:14 AM'
29.666667
32
0.719101
14
89
3.714286
1
0
0
0
0
0
0
0
0
0
0
0.192308
0.123596
89
3
32
29.666667
0.474359
0
0
0
0
0
0.5
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
d109ba24507672dc3e0da0290258234dfc3ef88f
832
py
Python
lib/od/navigator/name_navigator.py
ZimCodes/Zyod
5f9e2138cef01930fdf8d29269495f862c183ccb
[ "MIT" ]
1
2022-03-19T19:12:58.000Z
2022-03-19T19:12:58.000Z
lib/od/navigator/name_navigator.py
ZimCodes/Zyod
5f9e2138cef01930fdf8d29269495f862c183ccb
[ "MIT" ]
1
2022-03-23T12:21:28.000Z
2022-03-24T02:18:45.000Z
lib/od/navigator/name_navigator.py
ZimCodes/Zyod
5f9e2138cef01930fdf8d29269495f862c183ccb
[ "MIT" ]
null
null
null
from .base_navigator import BaseNavigator from ...driver.support.driver_support import DriverSupport class NameNavigator(BaseNavigator): """NameNavigator object navigates ODs using the file/directory name""" def __init__(self, name, driver, opts, no_full_links=False): """Initializes BaseNavigator object :param name: type of OD :param WebDriver driver: Selenium Webdriver :param Opts opts: Opts class :param bool no_full_links: Whether or not correct file links can be recorded from this OD """ super().__init__(name, driver, opts, no_full_links) def _get_nav_info_elements(self, nav_info) -> list: return DriverSupport.get_elements_all(self._driver, self._opts, nav_info.css_name, nav_info.wait_err_message)
39.619048
96
0.692308
104
832
5.25
0.519231
0.051282
0.06044
0.058608
0.091575
0.091575
0
0
0
0
0
0
0.233173
832
20
97
41.6
0.855799
0.342548
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0.125
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
d153e4055285d94e846df3d9765030e40c383b46
139
py
Python
feature/auth/dffml_feature_auth/feature/log.py
pradeepbhadani/dffml
35bc31be462685efe78ede981dbef8fd5577882b
[ "MIT" ]
null
null
null
feature/auth/dffml_feature_auth/feature/log.py
pradeepbhadani/dffml
35bc31be462685efe78ede981dbef8fd5577882b
[ "MIT" ]
null
null
null
feature/auth/dffml_feature_auth/feature/log.py
pradeepbhadani/dffml
35bc31be462685efe78ede981dbef8fd5577882b
[ "MIT" ]
null
null
null
# SPDX-License-Identifier: MIT # Copyright (c) 2019 Intel Corporation '''Logging''' import logging LOGGER = logging.getLogger(__package__)
23.166667
39
0.769784
16
139
6.4375
0.875
0
0
0
0
0
0
0
0
0
0
0.032258
0.107914
139
5
40
27.8
0.798387
0.532374
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
d1592f9e5f383321dd7b6a6a64d7bb2b2f49c7e6
1,438
py
Python
futures/workflows/chain.py
TristenHarr/api2db
8c8b14280441f5153ff146c23359a0eb91022ddb
[ "MIT" ]
45
2021-05-05T01:34:20.000Z
2021-11-02T08:41:34.000Z
futures/workflows/chain.py
TristenHarr/api2db
8c8b14280441f5153ff146c23359a0eb91022ddb
[ "MIT" ]
1
2021-06-02T11:43:33.000Z
2021-06-02T20:32:29.000Z
futures/workflows/chain.py
TristenHarr/api2db
8c8b14280441f5153ff146c23359a0eb91022ddb
[ "MIT" ]
3
2021-05-08T21:49:24.000Z
2021-05-13T23:14:09.000Z
# TODO: Chain class """ The Chain class will support chaining multiple Digests together. The Chain feature should have support to be placed ANYWHERE within the ApiForm and chain together DigestFeatures A single Digest Feature should run within the same thread/process and be relatively simple. A series of Digest Features, or features that take more time should be placed into a chain, and chains should support the ability to: Run concurrently i.e. Support both -> ProcessPool/ThreadPool. with Pool(5) as p: res = p.map(DigestFeature, [df_1, df_2, df_3])) Run serially: Support both -> Thread/Process def mapper(f, df): do stuff to df return df mapping = [f1, f2, f2] def p_map(fs, df): Process(target=f1, args=(df,)) df = Process result Process(target=f2, args=(df,)) . . . Chain example: c = Chain( DigestGetLatLongs(**kwargs), DigestApiCallToGetCounty(**kwargs), DigestGenerateMapWithLatLongAsPng(**kwargs), DigestPostPngToGcs(**kwargs) . . etc. ) """
32.681818
117
0.504868
142
1,438
5.084507
0.570423
0.027701
0
0
0
0
0
0
0
0
0
0.010949
0.428373
1,438
44
118
32.681818
0.867397
0.993741
0
null
0
null
0
0
null
0
0
0.022727
null
1
null
true
0
0
null
null
null
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
1
0
0
0
1
0
0
0
0
0
0
3
d16ab791155ec44606115ba4f26ba6bbfe333ccb
200
py
Python
07_Function/Step02/gamjapark.py
StudyForCoding/BEAKJOON
84e1c5e463255e919ccf6b6a782978c205420dbf
[ "MIT" ]
null
null
null
07_Function/Step02/gamjapark.py
StudyForCoding/BEAKJOON
84e1c5e463255e919ccf6b6a782978c205420dbf
[ "MIT" ]
3
2020-11-04T05:38:53.000Z
2021-03-02T02:15:19.000Z
07_Function/Step02/gamjapark.py
StudyForCoding/BEAKJOON
84e1c5e463255e919ccf6b6a782978c205420dbf
[ "MIT" ]
null
null
null
def d(n): return n + sum(list(map(int, list(str(n))))) nums = [x for x in range(1, 10001)] for i in range(1, 10001): if d(i) in nums: nums.remove(d(i)) for num in nums: print(num)
22.222222
48
0.57
41
200
2.780488
0.512195
0.122807
0.140351
0.22807
0
0
0
0
0
0
0
0.08
0.25
200
9
49
22.222222
0.68
0
0
0
0
0
0
0
0
0
0
0
0
1
0.125
false
0
0
0.125
0.25
0.125
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
3
66f572eba1f7f8aaa652059aabd1db58123a0499
115
py
Python
src/13/prompting_for_a_password_at_runtime/example.py
tuanavu/python-gitbook
948a05e065b0f40afbfd22f697dff16238163cde
[ "MIT" ]
14
2017-05-20T04:06:46.000Z
2022-01-23T06:48:45.000Z
src/13/prompting_for_a_password_at_runtime/example.py
tuanavu/python-gitbook
948a05e065b0f40afbfd22f697dff16238163cde
[ "MIT" ]
1
2021-06-10T20:17:55.000Z
2021-06-10T20:17:55.000Z
src/13/prompting_for_a_password_at_runtime/example.py
tuanavu/python-gitbook
948a05e065b0f40afbfd22f697dff16238163cde
[ "MIT" ]
15
2017-03-29T17:57:33.000Z
2021-08-24T02:20:08.000Z
import getpass user = getpass.getuser() passwd = getpass.getpass() print('User:', user) print('Passwd:', passwd)
14.375
26
0.704348
14
115
5.785714
0.428571
0
0
0
0
0
0
0
0
0
0
0
0.121739
115
7
27
16.428571
0.80198
0
0
0
0
0
0.104348
0
0
0
0
0
0
1
0
false
0.8
0.2
0
0.2
0.4
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
66f9cea192a25cbcc4be771454546e917ce594ca
580
pyde
Python
sketch_191010a_list4.pyde
takoe-sebe/2019-fall-polytech-cs
a98472c7689cfdc42da710bf6ef8aef7278b276f
[ "MIT" ]
null
null
null
sketch_191010a_list4.pyde
takoe-sebe/2019-fall-polytech-cs
a98472c7689cfdc42da710bf6ef8aef7278b276f
[ "MIT" ]
null
null
null
sketch_191010a_list4.pyde
takoe-sebe/2019-fall-polytech-cs
a98472c7689cfdc42da710bf6ef8aef7278b276f
[ "MIT" ]
null
null
null
windowWight=650 windowHeight=650 ellipseSize=200 def setup(): size(windowWight,windowHeight) smooth() background(255) fill(50,80) stroke(100) strokeWeight(3) noLoop() def draw(): ellipse(windowWight/2, windowHeight/2 - ellipseSize/2, ellipseSize, ellipseSize) ellipse(windowWight/2 - ellipseSize/2, windowHeight/2, ellipseSize, ellipseSize) ellipse(windowWight/2 + ellipseSize/2, windowHeight/2, ellipseSize, ellipseSize) ellipse(windowWight/2, windowHeight/2 + ellipseSize/2, ellipseSize, ellipseSize)
26.363636
88
0.696552
60
580
6.733333
0.366667
0.237624
0.188119
0.247525
0.653465
0.653465
0.653465
0.653465
0.653465
0.430693
0
0.068817
0.198276
580
21
89
27.619048
0.8
0
0
0
0
0
0
0
0
0
0
0
0
1
0.125
false
0
0
0
0.125
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0f24c728a12e564d6ae42b760dc47f431da8726a
118
py
Python
pkg/enums/Platform/_platform.py
shrohilla/kafka-func-core-tool-test
110815f74bd035758542526c74ebaa55ce51046f
[ "Apache-2.0" ]
null
null
null
pkg/enums/Platform/_platform.py
shrohilla/kafka-func-core-tool-test
110815f74bd035758542526c74ebaa55ce51046f
[ "Apache-2.0" ]
null
null
null
pkg/enums/Platform/_platform.py
shrohilla/kafka-func-core-tool-test
110815f74bd035758542526c74ebaa55ce51046f
[ "Apache-2.0" ]
null
null
null
from enum import Enum class OSPlatform(Enum): LINUX = 0 WINDOW = 1 #KUBERNETES_AKS #KUBERNETES_LIMA
13.111111
23
0.669492
15
118
5.133333
0.8
0
0
0
0
0
0
0
0
0
0
0.023256
0.271186
118
8
24
14.75
0.872093
0.245763
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.25
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
0f41cc2ebc657ca622db73b5f1a27c3ddd79bb29
184
py
Python
HackerRank/Algorithms/Implementation/Find Digits/find_digits.py
Goyatuzo/HackerRank
ad836faa7e8ecfe751a72027e1312ae3ee19f4ca
[ "MIT" ]
null
null
null
HackerRank/Algorithms/Implementation/Find Digits/find_digits.py
Goyatuzo/HackerRank
ad836faa7e8ecfe751a72027e1312ae3ee19f4ca
[ "MIT" ]
4
2016-03-19T05:13:29.000Z
2021-05-10T16:42:42.000Z
HackerRank/Algorithms/Implementation/Find Digits/find_digits.py
Goyatuzo/Challenges
ad836faa7e8ecfe751a72027e1312ae3ee19f4ca
[ "MIT" ]
null
null
null
def find_digits(n): digits = str(n) # Utilize the fact that and end the moment the if statement is false. return len([i for i in digits if int(i) != 0 and n % int(i) == 0])
46
73
0.63587
36
184
3.222222
0.638889
0.068966
0.086207
0
0
0
0
0
0
0
0
0.014493
0.25
184
4
74
46
0.826087
0.36413
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
0f43e57a96b0f1231d293f6443f63c88efaa63a6
339
py
Python
opcsim/__init__.py
drewmee/opcsim
c430d359196939e219a2bdd20cd277f3c3dcc548
[ "MIT" ]
3
2020-11-07T03:24:19.000Z
2022-03-30T17:45:04.000Z
opcsim/__init__.py
drewmee/opcsim
c430d359196939e219a2bdd20cd277f3c3dcc548
[ "MIT" ]
61
2017-10-30T15:58:33.000Z
2020-11-26T12:32:10.000Z
opcsim/__init__.py
drewmee/opcsim
c430d359196939e219a2bdd20cd277f3c3dcc548
[ "MIT" ]
2
2019-09-19T14:47:49.000Z
2020-11-07T03:06:42.000Z
from pkg_resources import get_distribution import warnings import pandas as pd import numpy as np import math import os from .distributions import * from .models import * from .plots import * from .utils import * from .metrics import * from .mie import * from .rc_style import set set() __version__ = get_distribution("opcsim").version
17.842105
48
0.781711
49
339
5.244898
0.510204
0.233463
0
0
0
0
0
0
0
0
0
0
0.156342
339
19
48
17.842105
0.898601
0
0
0
0
0
0.017647
0
0
0
0
0
0
1
0
false
0
0.866667
0
0.866667
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
0f47498950dec59c4641975ceb970267fb80fede
268
py
Python
strings/reverse_string.py
ethyl2/code_challenges
3c9ccca1782f92728e60a515a7ca797f6d470e81
[ "MIT" ]
null
null
null
strings/reverse_string.py
ethyl2/code_challenges
3c9ccca1782f92728e60a515a7ca797f6d470e81
[ "MIT" ]
null
null
null
strings/reverse_string.py
ethyl2/code_challenges
3c9ccca1782f92728e60a515a7ca797f6d470e81
[ "MIT" ]
null
null
null
""" https://www.codewars.com/kata/5168bb5dfe9a00b126000018/train/python Given a string, return its reverse """ def solution(string): return ''.join(reversed([char for char in string])) def solution2(string): return string[::-1] print(solution2('world'))
16.75
67
0.708955
34
268
5.588235
0.735294
0.189474
0
0
0
0
0
0
0
0
0
0.086207
0.134328
268
15
68
17.866667
0.732759
0.380597
0
0
0
0
0.031646
0
0
0
0
0
0
1
0.4
false
0
0
0.4
0.8
0.2
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
0f4be30143a0127f44c4aa9e78c8e7a181d672cc
1,516
py
Python
tools.py
arntrk/advanced-lane-lines
c576555162a190a956edb78309046175a329fdf0
[ "MIT" ]
null
null
null
tools.py
arntrk/advanced-lane-lines
c576555162a190a956edb78309046175a329fdf0
[ "MIT" ]
null
null
null
tools.py
arntrk/advanced-lane-lines
c576555162a190a956edb78309046175a329fdf0
[ "MIT" ]
null
null
null
import os import cv2 def path_join(p1, p2): return os.path.join(p1, p2) def ensure_path_exists(file_path): directory = os.path.dirname(file_path) if not os.path.exists(directory): os.makedirs(directory) def path_append_trailing_seperator(path): return path + '/' * (1 - path.endswith('/')) def files_in_dir(path, include_path=False): path_s = path_append_trailing_seperator(path) return [path_s * include_path + f for f in os.listdir(path) if os.path.isfile(path_s + f)] def save_image_as(img, file, path='output_images'): path_s = path_append_trailing_seperator(path) ensure_path_exists(path_s) cv2.imwrite(path_s + file, img) def filename_from_path(path): return os.path.basename(path) def filename_split(filename): return os.path.splitext(filename) def bgr2rgb(img): return cv2.cvtColor(img, cv2.COLOR_BGR2RGB) def rgb2bgr(img): return cv2.cvtColor(img, cv2.COLOR_RGB2BGR) def bgr2gray(img): return cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) def rgb2gray(img): return cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) def bgr2hls(img): return cv2.cvtColor(img, cv2.COLOR_BGR2HLS) def bgr2lab(img): return cv2.cvtColor(img, cv2.COLOR_BGR2LAB) def rgb2lab(img): return cv2.cvtColor(img, cv2.COLOR_RGB2LAB) def bgr2luv(img): return cv2.cvtColor(img, cv2.COLOR_BGR2LUV) def rgb2luv(img): return cv2.cvtColor(img, cv2.COLOR_RGB2LUV) def channels(img): r = img[:,:,0] g = img[:,:,1] b = img[:,:,2] return r,g,b
23.6875
94
0.707124
233
1,516
4.424893
0.261803
0.078565
0.104753
0.174588
0.389913
0.389913
0.389913
0
0
0
0
0.036392
0.166227
1,516
63
95
24.063492
0.779272
0
0
0.045455
0
0
0.009894
0
0
0
0
0
0
1
0.386364
false
0
0.045455
0.295455
0.772727
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
3
0f63d88828a84c4ea76bfb8adfa188877673d6c1
4,459
py
Python
venv/Lib/site-packages/logging_tree/__init__.py
avim2809/CameraSiteBlocker
bfc0434e75e8f3f95c459a4adc86b7673200816e
[ "Apache-2.0" ]
null
null
null
venv/Lib/site-packages/logging_tree/__init__.py
avim2809/CameraSiteBlocker
bfc0434e75e8f3f95c459a4adc86b7673200816e
[ "Apache-2.0" ]
null
null
null
venv/Lib/site-packages/logging_tree/__init__.py
avim2809/CameraSiteBlocker
bfc0434e75e8f3f95c459a4adc86b7673200816e
[ "Apache-2.0" ]
null
null
null
"""Introspection for the ``logging`` logger tree in the Standard Library. You can install this package with the standard ``pip`` command:: $ pip install logging_tree While you can write programs that call this package's ``tree()`` function and examine the hierarchy of logger objects that it finds inside of the Standard Library ``logging`` module, the simplest use of this package for debugging is to call ``printout()`` to print the loggers, filters, and handlers that your application has configured:: >>> logging.getLogger('a') >>> logging.getLogger('a.b').setLevel(logging.DEBUG) >>> logging.getLogger('x.c') >>> from logging_tree import printout >>> printout() <--"" Level WARNING | o<--"a" | Level NOTSET so inherits level WARNING | | | o<--"a.b" | Level DEBUG | o<--[x] | o<--"x.c" Level NOTSET so inherits level WARNING The logger tree should always print successfully, no matter how complicated. A node whose ``[name]`` is in square brackets is a "place holder" that has never actually been named in a ``getLogger()`` call, but was created automatically to serve as the parent of loggers further down the tree. There are several interfaces that ``logging_tree`` supports, depending on how much detail you need. ``logging_tree.printout(node=None)`` Prints the current logger tree, or the tree based at the given `node`, to the standard output. ``logging_tree.format.build_description(node=None)`` Builds and returns the multi-line description of the current logger tree, or the tree based at the given ``node``, as a single string with newlines inside and a newline at the end. ``logging_tree.format.describe(node)`` A generator that yields a series of lines that describe the tree based at the given ``node``. Note that the lines are returned without newline terminators attached. ``logging_tree.tree()`` Fetch the current tree of loggers from the ``logging`` module. Returns a node, that is simply a tuple with three fields: | ``[0]`` the logger name (``""`` for the root logger). | ``[1]`` the ``logging.Logger`` object itself. | ``[2]`` a list of zero or more child nodes. I welcome contributions and ideas as this package matures. You can find the bug tracker at the `repository page on github <https://github.com/brandon-rhodes/logging_tree>`_. Developers can run this package's tests with:: $ python -m unittest discover logging_tree On older versions of Python you will instead have to install ``unittest2`` and use its ``unit2`` command line tool to run the tests. Changelog --------- **Version 1.8** - 2018 August 5 Improve the output to better explain what happens if a "parent" attribute has been set to None. **Version 1.7** - 2016 January 23 Detect whether each logger has the correct "parent" attribute and, if not, print where its log messages are being sent instead. **Version 1.6** - 2015 January 8 Fixed a crash that would occur if a custom logging Formatter was missing its format string attributes. **Version 1.5** - 2014 December 24 Handlers now display their logging level if one has been set, and their custom logging formatter if one has been installed. **Version 1.4** - 2014 January 8 Thanks to a contribution from Dave Brondsema, disabled loggers are now actually marked as "Disabled" to make it less of a surprise that they fail to log anything. **Version 1.3** - 2013 October 29 Be explicit and display the logger level ``NOTSET`` along with the effective level inherited from the logger's ancestors; and display the list of ``.filters`` of a custom logging handler even though it might contain custom code that ignores them. **Version 1.2** - 2013 January 19 Compatible with Python 3.3 thanks to @ralphbean. **Version 1.1** - 2012 February 17 Now compatible with 2.3 <= Python <= 3.2. **Version 1.0** - 2012 February 13 Can display the handler inside a MemoryHandler; entire public interface documented; 100% test coverage. **Version 0.6** - 2012 February 10 Added a display format for every ``logging.handlers`` class. **Version 0.5** - 2012 February 8 Initial release. """ __version__ = '1.8' __all__ = ('tree', 'printout') from logging_tree.nodes import tree from logging_tree.format import printout
34.565891
73
0.698811
662
4,459
4.675227
0.415408
0.039095
0.01454
0.01357
0.060743
0.060743
0.039418
0.031018
0.031018
0.031018
0
0.028474
0.212379
4,459
128
74
34.835938
0.85279
0.969051
0
0
0
0
0.115385
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0.5
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
1
0
3
0f6c0e4dbaa90178b2822763d3e858a939afa431
4,028
py
Python
MetCounterService/MetSide/Service/Parsing/XmlParsing.py
possibility022/CopyMachineCounterService
d40e1c1b11395d856d35e55107bc6e39e8753ce5
[ "MIT" ]
null
null
null
MetCounterService/MetSide/Service/Parsing/XmlParsing.py
possibility022/CopyMachineCounterService
d40e1c1b11395d856d35e55107bc6e39e8753ce5
[ "MIT" ]
null
null
null
MetCounterService/MetSide/Service/Parsing/XmlParsing.py
possibility022/CopyMachineCounterService
d40e1c1b11395d856d35e55107bc6e39e8753ce5
[ "MIT" ]
1
2019-11-03T01:46:01.000Z
2019-11-03T01:46:01.000Z
import xml.etree.ElementTree as ET class XMLLoader: def __init__(self, filePath): self.tags = {'signature': 'signature', 'datetime': 'datetime','print': 'regprintcounter', 'printcolor': 'regprintcountercolor', 'scan': 'regscancounter', 'serial': 'regserialnumber', 'tonerc': 'regtonerlevelc', 'tonerm': 'regtonerlevelm', 'tonery': 'regtonerlevely', 'tonerk':'regtonerlevelk'} self.tree = ET.parse(filePath) self.root = self.tree.getroot() def get_printer_counter(self, which): return self.__get_regex(which, 'print') def get_scaner_counter(self, which): return self.__get_regex(which, 'scan') def get_serialnumber(self, which): return self.__get_regex(which, 'serial') def get_printer_counter_color(self, which): return self.__get_regex(which, 'printcolor') def get_datetime(self, which): return self.__get_regex(which, 'datetime') def get_datetime_format(self, which): return self.__get_datetime_format(which, 'datetime') def get_tonerlevel_c(self, which): return self.__get_regex(which, 'tonerc') def get_tonerlevel_m(self, which): return self.__get_regex(which, 'tonerm') def get_tonerlevel_y(self, which): return self.__get_regex(which, 'tonery') def get_tonerlevel_k(self, which): return self.__get_regex(which, 'tonerk') def get_all_signature(self): signatures = [] for device in self.root: part_of_signature = [] for el in device: if el.tag == self.tags['signature']: regex = el.text part_of_signature.append(regex) signatures.append(part_of_signature) return signatures def __get_datetime_format(self, which, xml_tag): for child in self.root[which]: if child.tag == self.tags[xml_tag]: format = child.attrib['format'] return format def __get_regex(self, which, xml_tag): data_to_download_col = [] for child in self.root[which]: if child.tag == self.tags[xml_tag]: order = child.attrib['inorder'] regex = child.text group = child.attrib['group'] required = child.attrib['require'] quatro = [order, regex, group, required] data_to_download_col.append(quatro) return data_to_download_col class XMLLoaderForHTML: def __init__(self, filePath): self.tree = ET.parse(filePath) self.root = self.tree.getroot() self.xml_data_tag = {'print': 'regprintcounter', 'printcolor': 'regprintcountercolor', 'scan': 'regscancounter', 'serial': 'regserialnumber'} def get_printer_counter(self, mac): return self.__get_regex(mac, 'print') def get_scaner_counter(self, mac): return self.__get_regex(mac, 'scan') def get_serialnumber(self, mac): return self.__get_regex(mac, 'serial') def get_printer_counter_color(self, mac): return self.__get_regex(mac, 'printcolor') def __get_regex(self, mac, xml_tag): for devicegroup in self.root: for element in devicegroup: text = element.text.strip() if text == mac: return self.__collect_regex_data(element, xml_tag) for element in devicegroup: text = element.text.strip() if text == mac[:8]: return self.__collect_regex_data(element, xml_tag) return [] def __collect_regex_data(self, element, xml_tag): data_to_download_col = [] for child in element: if child.tag == self.xml_data_tag[xml_tag]: order = child.attrib['inorder'] regex = child.text group = child.attrib['group'] trio = [order, regex, group] data_to_download_col.append(trio) return data_to_download_col
35.026087
301
0.612463
464
4,028
5.017241
0.176724
0.046392
0.078179
0.100515
0.65421
0.560997
0.521478
0.37457
0.201031
0.176976
0
0.000344
0.27855
4,028
115
302
35.026087
0.800757
0
0
0.302326
0
0
0.10623
0
0
0
0
0
0
1
0.244186
false
0
0.011628
0.162791
0.523256
0.116279
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
0f746c05c26059b6c68e7c0ac2dd5ac8fab72739
3,124
py
Python
test/unit/data/test_mutable_json_column.py
rhpvorderman/galaxy
178015f8eff0b0c7a59c0d6756658f6428222837
[ "CC-BY-3.0" ]
47
2015-10-21T23:30:30.000Z
2022-03-09T06:51:32.000Z
test/unit/data/test_mutable_json_column.py
rhpvorderman/galaxy
178015f8eff0b0c7a59c0d6756658f6428222837
[ "CC-BY-3.0" ]
78
2019-01-18T08:12:49.000Z
2022-03-13T08:56:41.000Z
test/unit/data/test_mutable_json_column.py
rhpvorderman/galaxy
178015f8eff0b0c7a59c0d6756658f6428222837
[ "CC-BY-3.0" ]
35
2015-10-30T13:09:40.000Z
2021-05-03T23:17:46.000Z
import copy from .test_galaxy_mapping import BaseModelTestCase class MutableColumnTest(BaseModelTestCase): def persist_and_reload(self, item): item_id = item.id self.model.session.flush() self.model.session.expunge_all() return self.model.session.query(self.model.Workflow).get(item_id) def test_metadata_mutable_column(self): w = self.model.Workflow() self.model.session.add(w) self.model.session.flush() w.reports_config = {'x': 'z'} persisted = self.persist_and_reload(w) assert persisted.reports_config == {'x': 'z'} persisted.reports_config['x'] = '1' persisted = self.persist_and_reload(persisted) assert persisted.reports_config['x'] == '1' # test string persisted.reports_config = 'abcdefg' persisted = self.persist_and_reload(persisted) assert persisted.reports_config == 'abcdefg' # test int persisted.reports_config = 1 persisted = self.persist_and_reload(persisted) assert persisted.reports_config == 1 # test float persisted.reports_config = 1.1 persisted = self.persist_and_reload(persisted) assert persisted.reports_config == 1.1 # test bool persisted.reports_config = True persisted = self.persist_and_reload(persisted) assert persisted.reports_config is True # Test nested dict/list persisted.reports_config = {'list': [[1, 2, 3]]} persisted = self.persist_and_reload(persisted) assert persisted.reports_config == {'list': [[1, 2, 3]]} copy.deepcopy(persisted.reports_config) assert persisted.reports_config.pop('list') == [[1, 2, 3]] persisted = self.persist_and_reload(persisted) assert persisted.reports_config == {} persisted.reports_config.update({'x': 'z'}) persisted = self.persist_and_reload(persisted) assert persisted.reports_config == {'x': 'z'} del persisted.reports_config['x'] persisted = self.persist_and_reload(persisted) assert persisted.reports_config == {} persisted.reports_config = {'x': {'y': 'z'}} persisted = self.persist_and_reload(persisted) assert persisted.reports_config == {'x': {'y': 'z'}} # These tests are failing ... at least since 20.09, # but nested mutable change tracking might have # never worked # persisted.reports_config['x']['y'] = 'x' # persisted = self.persist_and_reload(persisted) # assert persisted.reports_config == {'x': {'y': 'x'}} # persisted.reports_config[0].append(2) # persisted = self.persist_and_reload(persisted) # assert persisted.reports_config[0] == [1, 2] # persisted.reports_config[0].extend([3, 4]) # persisted = self.persist_and_reload(persisted) # assert persisted.reports_config[0] == [1, 2, 3, 4] # persisted.reports_config[0].remove(4) # persisted = self.persist_and_reload(persisted) # assert persisted.reports_config[0] == [1, 2, 3]
42.794521
73
0.640525
364
3,124
5.302198
0.206044
0.208808
0.341969
0.232124
0.621762
0.590155
0.572539
0.523316
0.523316
0.523316
0
0.016807
0.238156
3,124
72
74
43.388889
0.794118
0.229513
0
0.347826
0
0
0.01886
0
0
0
0
0
0.26087
1
0.043478
false
0
0.043478
0
0.130435
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0f7682c08fc95ebb9dba3a913d6bab84d4c26791
517
py
Python
blog/utils.py
salmanwahed/flask-appengine-blog
bb09caf77aecb6ae9074214020e49a680ee4a0fe
[ "MIT" ]
null
null
null
blog/utils.py
salmanwahed/flask-appengine-blog
bb09caf77aecb6ae9074214020e49a680ee4a0fe
[ "MIT" ]
null
null
null
blog/utils.py
salmanwahed/flask-appengine-blog
bb09caf77aecb6ae9074214020e49a680ee4a0fe
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from google.appengine.ext import ndb from settings import * # We set a parent key on the 'Greetings' to ensure that they are all # in the same entity group. Queries across the single entity group # will be consistent. However, the write rate should be limited to # ~1/second. def get_parent_key(blogentry_name=DEFAULT_BLOGENTRY_NAME): """Constructs a Datastore key for a BlogEntry entity. We use blogentry_name as the key. """ return ndb.Key('BlogEntry', blogentry_name)
28.722222
68
0.733075
80
517
4.65
0.65
0.139785
0
0
0
0
0
0
0
0
0
0.004751
0.185687
517
17
69
30.411765
0.87886
0.613153
0
0
0
0
0.049724
0
0
0
0
0
0
1
0.25
false
0
0.5
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
3
0f7f47b602f916ebc4458bf284ac3291f545d822
343
py
Python
api/allennlp_demo/transformer_qa/test_api.py
alexbussan/allennlp-demo
84ec6565bd74a590d074ae838ae3e0f3fbb8722e
[ "Apache-2.0" ]
null
null
null
api/allennlp_demo/transformer_qa/test_api.py
alexbussan/allennlp-demo
84ec6565bd74a590d074ae838ae3e0f3fbb8722e
[ "Apache-2.0" ]
null
null
null
api/allennlp_demo/transformer_qa/test_api.py
alexbussan/allennlp-demo
84ec6565bd74a590d074ae838ae3e0f3fbb8722e
[ "Apache-2.0" ]
null
null
null
from allennlp_demo.common.testing import RcModelEndpointTestCase from allennlp_demo.transformer_qa.api import TransformerQaModelEndpoint class TestTransformerQaModelEndpoint(RcModelEndpointTestCase): endpoint = TransformerQaModelEndpoint() def interpreter_ids(self): return [] def attacker_ids(self): return []
26.384615
71
0.787172
30
343
8.833333
0.666667
0.090566
0.120755
0
0
0
0
0
0
0
0
0
0.154519
343
12
72
28.583333
0.913793
0
0
0.25
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
0f930dd1ef3cc95b30c7c0ace1fcf830dd7e3b8e
1,157
py
Python
modules/hplots/response_scale.py
shahrukhqasim/HGCalML
2808564b31c89d9b7eb882734f6aebc6f35e94f3
[ "BSD-3-Clause" ]
null
null
null
modules/hplots/response_scale.py
shahrukhqasim/HGCalML
2808564b31c89d9b7eb882734f6aebc6f35e94f3
[ "BSD-3-Clause" ]
null
null
null
modules/hplots/response_scale.py
shahrukhqasim/HGCalML
2808564b31c89d9b7eb882734f6aebc6f35e94f3
[ "BSD-3-Clause" ]
null
null
null
import numpy as np from matplotlib import scale as mscale import matplotlib from matplotlib.ticker import FixedLocator, FuncFormatter class ResponseScale(mscale.ScaleBase): name='response_scale' def __init__(self, axis): super().__init__(axis) def get_transform(self): return self.ResponseTransform() class ResponseTransform(matplotlib.scale.FuncTransform): def __init__(self): super().__init__(forward=self.forward, inverse=self.inverse) def forward(self, array): return np.where(np.less_equal(array,3), array, 3+np.log(array)-np.log(3)) def inverse(self, array): return np.where(np.less_equal(array,3), array, np.exp(array+np.log(3) - 3)) def set_default_locators_and_formatters(self, axis): fmt = FuncFormatter( lambda x, pos=None: str(x)) locaters = [0,0.5,1,1.5,2,2.5,3,4,5,10,50,100,1000,10000,10000,100000,1000000,10000000,10000000,10000000] axis.set(major_locator=FixedLocator(locaters), major_formatter=fmt, minor_formatter=fmt) def register(): mscale.register_scale(ResponseScale)
29.666667
113
0.678479
153
1,157
4.947712
0.424837
0.023778
0.029062
0.044914
0.116248
0.116248
0.116248
0.116248
0.116248
0.116248
0
0.08243
0.203112
1,157
38
114
30.447368
0.738612
0
0
0
0
0
0.012111
0
0
0
0
0
0
1
0.28
false
0
0.16
0.12
0.68
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
7e52da087f6106d4d4f1b3fb3d32a801a746e361
3,019
py
Python
server/views/apicache.py
rleir/MediaCloud-Web-Tools
86fd42959bec2f24c74cf63277da1931a159b218
[ "Apache-2.0" ]
null
null
null
server/views/apicache.py
rleir/MediaCloud-Web-Tools
86fd42959bec2f24c74cf63277da1931a159b218
[ "Apache-2.0" ]
null
null
null
server/views/apicache.py
rleir/MediaCloud-Web-Tools
86fd42959bec2f24c74cf63277da1931a159b218
[ "Apache-2.0" ]
null
null
null
from server import mc, TOOL_API_KEY from server.cache import cache from server.auth import user_mediacloud_client, user_mediacloud_key, is_user_logged_in, user_admin_mediacloud_client def api_key(): return user_mediacloud_key() if is_user_logged_in() else TOOL_API_KEY def mc_client(admin=False): # return the user's client handler, or a tool one if not logged in if is_user_logged_in(): client_to_use = user_mediacloud_client() if not admin else user_admin_mediacloud_client() else: client_to_use = mc return client_to_use def media(media_id): return _cached_media(api_key(), media_id) def get_media_with_key(mc_api_key, media_id): return _cached_get_media_with_key(mc_api_key, media_id) @cache.cache_on_arguments() def _cached_get_media_with_key(mc_api_key, media_id): local_client = user_mediacloud_client(mc_api_key) return local_client.media(media_id) def get_media(mc_api_key, media_id): return _cached_media(mc_api_key, media_id) @cache.cache_on_arguments() def _cached_media(mc_api_key, media_id): # api_key passed in just to make this a user-level cache local_client = mc_client() return local_client.media(media_id) def collection(tags_id): return _cached_tag(api_key(), tags_id) def tag(tags_id): return _cached_tag(api_key(), tags_id) @cache.cache_on_arguments() def _cached_tag(api_key, tags_id): # api_key passed in just to make this a user-level cache local_client = mc_client() return local_client.tag(tags_id) def story_count(api_key, q, fq, **kwargs): return _cached_story_count(api_key, q, fq, **kwargs) @cache.cache_on_arguments() def _cached_story_count(api_key, q, fq, **kwargs): # api_key passed in just to make this a user-level cache local_client = mc_client() return local_client.storyCount(solr_query=q, solr_filter=fq, **kwargs) def story_raw_1st_download(api_key, stories_id): story = _cached_story(api_key, stories_id, raw_1st_download=True) return story['raw_first_download_file'] def story_list(api_key, q, fq, **kwargs): return _cached_story_list(api_key, q, fq, **kwargs) @cache.cache_on_arguments() def _cached_story_list(api_key, q, fq, **kwargs): # api_key passed in just to make this a user-level cache local_client = mc_client() return local_client.storyList(solr_query=q, solr_filter=fq, **kwargs) def word_count(api_key, q, fq, **kwargs): return _cached_word_count(api_key, q, fq, **kwargs) @cache.cache_on_arguments() def _cached_word_count(api_key, q, fq, **kwargs): # api_key passed in just to make this a user-level cache local_client = mc_client() return local_client.wordCount(solr_query=q, solr_filter=fq, **kwargs) def story(api_key, stories_id, **kwargs): return _cached_story(api_key, stories_id, **kwargs) @cache.cache_on_arguments() def _cached_story(api_key, stories_id, **kwargs): local_client = mc_client(admin=True) return local_client.story(stories_id, **kwargs)
28.752381
116
0.752898
496
3,019
4.185484
0.133065
0.095376
0.030347
0.039017
0.69316
0.659923
0.628613
0.533237
0.442197
0.361272
0
0.000782
0.1527
3,019
104
117
29.028846
0.81079
0.112289
0
0.266667
0
0
0.008605
0.008605
0
0
0
0
0
1
0.316667
false
0
0.05
0.166667
0.683333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
7e56f9b023339b0e42a015c716df2241f3d10932
294
py
Python
Reading Data/lesson-7-load-playstore-apps-excel-file-with-multiple-sheets/tests/test_content_id_2.py
danielgarm/Data-Science-and-Machine-Learning
fa3e85cc42eb2e9f964ab5abb34d1c93e16d1cd9
[ "MIT" ]
null
null
null
Reading Data/lesson-7-load-playstore-apps-excel-file-with-multiple-sheets/tests/test_content_id_2.py
danielgarm/Data-Science-and-Machine-Learning
fa3e85cc42eb2e9f964ab5abb34d1c93e16d1cd9
[ "MIT" ]
2
2022-01-11T21:04:51.000Z
2022-01-11T21:05:05.000Z
Reading Data/lesson-7-load-playstore-apps-excel-file-with-multiple-sheets/tests/test_content_id_2.py
danielgarm/Data-Science-and-Machine-Learning
fa3e85cc42eb2e9f964ab5abb34d1c93e16d1cd9
[ "MIT" ]
null
null
null
def test_content_id_2(): content_id_head = pd.DataFrame({'Content_Rating': ['Everyone', 'Everyone', 'Everyone', 'Teen', 'Everyone']}, index=[101, 101, 101, 102, 101]) assert content_id_df.head().equals(content_id_head)
58.8
112
0.544218
32
294
4.6875
0.53125
0.24
0.173333
0
0
0
0
0
0
0
0
0.079208
0.312925
294
5
113
58.8
0.663366
0
0
0
0
0
0.169492
0
0
0
0
0
0.25
1
0.25
false
0
0
0
0.25
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
7e65a00944b5f6174f0508ac50b1afc2d56271cb
898
py
Python
9_iterator&composite/composite/menu.py
hypersport/Head-First-Design-Patterns-Python
0c8b831ae89ebbbef8b203b96508deb7e3063590
[ "MIT" ]
null
null
null
9_iterator&composite/composite/menu.py
hypersport/Head-First-Design-Patterns-Python
0c8b831ae89ebbbef8b203b96508deb7e3063590
[ "MIT" ]
null
null
null
9_iterator&composite/composite/menu.py
hypersport/Head-First-Design-Patterns-Python
0c8b831ae89ebbbef8b203b96508deb7e3063590
[ "MIT" ]
null
null
null
from menu_component import MenuComponent from has_next_iterator import HasNextIterator class Menu(MenuComponent): def __init__(self, name, description): self.name = name self.description = description self.menu_components = [] def add(self, menu_component): self.menu_components.append(menu_component) def remove(self, menu_component): self.menu_components.remove(menu_component) def get_child(self, i): return self.menu_components[i] def get_name(self): return self.name def get_description(self): return self.description def print_(self): print(f'\n{self.get_name()}, {self.get_description()}---------------------') iterator = HasNextIterator(self.menu_components) while iterator.has_next(): menu_component = next(iterator) menu_component.print_()
28.0625
84
0.659243
102
898
5.54902
0.264706
0.160777
0.159011
0.074205
0.123675
0.123675
0
0
0
0
0
0
0.228285
898
31
85
28.967742
0.816739
0
0
0
0
0
0.073497
0.050111
0
0
0
0
0
1
0.304348
false
0
0.086957
0.130435
0.565217
0.130435
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
7e86cd9d059471238c9c3dc2e39e6268999957c3
255
py
Python
Chapter02/performance_report.py
marcjour303/PytML
cd1391976167a7a671e98a1f588898c01585cee9
[ "MIT" ]
36
2019-04-05T00:58:57.000Z
2022-03-12T09:25:04.000Z
Chapter02/performance_report.py
ClauPorto/Python-Machine-Learning-Cookbook-Second-Edition
99d8b799dbfe1d9a82f0bcc3648aaeb147b7298f
[ "MIT" ]
null
null
null
Chapter02/performance_report.py
ClauPorto/Python-Machine-Learning-Cookbook-Second-Edition
99d8b799dbfe1d9a82f0bcc3648aaeb147b7298f
[ "MIT" ]
37
2019-04-16T00:50:20.000Z
2022-02-28T18:14:41.000Z
from sklearn.metrics import classification_report y_true = [1, 0, 0, 2, 1, 0, 3, 3, 3] y_pred = [1, 1, 0, 2, 1, 0, 1, 3, 3] target_names = ['Class-0', 'Class-1', 'Class-2', 'Class-3'] print(classification_report(y_true, y_pred, target_names=target_names))
51
71
0.678431
49
255
3.346939
0.346939
0.04878
0.256098
0.304878
0
0
0
0
0
0
0
0.099548
0.133333
255
5
71
51
0.642534
0
0
0
0
0
0.109375
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0.2
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
7e87eb4e49c3fe8c907a00cf7afa6e2932d9ea48
741
py
Python
001_first/sys.py
cjp1016/python-samples
ca5a7284cf4cb9fe42fa1487d4944815a00487ec
[ "Apache-2.0" ]
null
null
null
001_first/sys.py
cjp1016/python-samples
ca5a7284cf4cb9fe42fa1487d4944815a00487ec
[ "Apache-2.0" ]
null
null
null
001_first/sys.py
cjp1016/python-samples
ca5a7284cf4cb9fe42fa1487d4944815a00487ec
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- """ 第一个python程序 vscode { "python.pythonPath": "C:\\Program Files\\Python36\\python.exe", "python.linting.pylintArgs": ["--generate-members"] } VSCode——使用CodeRunner开发python输出中文出现乱码的解决方法 https://blog.csdn.net/yukinoai/article/details/81624936 Version: 0.1 Author: cjp """ import sys # import io # sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding='utf8')#改变默认输出的标准编码 # 输出python版本 # sys.version_info(major=3, minor=6, micro=7, releaselevel='final', serial=0) print(sys.version_info) # 3.6.7 (v3.6.7:6ec5cf24b7, Oct 20 2018, 13:35:33) [MSC v.1900 64 bit (AMD64)] print(sys.version) # 输出其他 print("hello,python") print('你好','世界') print('hello','world',sep=',' ,end='!') print('goodbye,workd',end='!\n')
22.454545
78
0.696356
105
741
4.914286
0.72381
0.05814
0.054264
0
0
0
0
0
0
0
0
0.073353
0.098516
741
33
79
22.454545
0.696108
0.732794
0
0
1
0
0.243094
0
0
0
0
0
0
1
0
true
0
0.142857
0
0.142857
0.857143
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
3
7e88aab71d542ce8d57805201cbd9a1b1dc15176
233
py
Python
tests/base.py
meghabhoj/NEWBAZAAR
cb1405dcb2c8b4812ddf724d5a3c07b2f77c1b34
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
tests/base.py
meghabhoj/NEWBAZAAR
cb1405dcb2c8b4812ddf724d5a3c07b2f77c1b34
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
tests/base.py
meghabhoj/NEWBAZAAR
cb1405dcb2c8b4812ddf724d5a3c07b2f77c1b34
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
from __future__ import unicode_literals from django.core.management import call_command from django.test import TestCase class BaseTestCase(TestCase): @classmethod def setUpClass(cls): call_command("update_rates")
21.181818
47
0.781116
28
233
6.214286
0.714286
0.114943
0
0
0
0
0
0
0
0
0
0
0.158798
233
10
48
23.3
0.887755
0
0
0
0
0
0.051502
0
0
0
0
0
0
1
0.142857
false
0
0.428571
0
0.714286
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
7e9e7d40d9e6aea06e39cdfaeb2c717f1c9d1dfe
104
py
Python
sendbird/http_methods.py
jpbullalayao/sendbird-python
1ce77bef2b3337196fbf08d6c03df311d76f4098
[ "MIT" ]
4
2019-05-16T00:17:23.000Z
2020-12-10T05:59:34.000Z
sendbird/http_methods.py
jpbullalayao/sendbird-python
1ce77bef2b3337196fbf08d6c03df311d76f4098
[ "MIT" ]
11
2019-05-18T05:21:31.000Z
2019-09-06T14:38:19.000Z
sendbird/http_methods.py
jpbullalayao/sendbird-python
1ce77bef2b3337196fbf08d6c03df311d76f4098
[ "MIT" ]
4
2019-09-05T15:54:57.000Z
2021-07-29T22:55:50.000Z
HTTP_METHOD_DELETE = "DELETE" HTTP_METHOD_GET = "GET" HTTP_METHOD_POST = "POST" HTTP_METHOD_PUT = "PUT"
20.8
29
0.769231
16
104
4.5
0.375
0.555556
0
0
0
0
0
0
0
0
0
0
0.115385
104
4
30
26
0.782609
0
0
0
0
0
0.153846
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0e277fbd25cd79075014d09ee00e24dd1f5a06e7
183
py
Python
repair/urls.py
wy672515431/-
582a1b452bce21584117190539ff5fe84a1cc885
[ "MIT" ]
null
null
null
repair/urls.py
wy672515431/-
582a1b452bce21584117190539ff5fe84a1cc885
[ "MIT" ]
1
2020-06-13T11:47:08.000Z
2020-06-13T11:47:08.000Z
repair/urls.py
wy672515431/-
582a1b452bce21584117190539ff5fe84a1cc885
[ "MIT" ]
null
null
null
from django.urls import path, include from . import views urlpatterns=[ path('repair/',views.repair,name='repair'), path('subscribe/',views.subscribepost,name='subscribe'), ]
26.142857
60
0.721311
22
183
6
0.545455
0
0
0
0
0
0
0
0
0
0
0
0.114754
183
7
61
26.142857
0.814815
0
0
0
0
0
0.173913
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
0e52311a777f9ad7c40383af30b5c9c53a9d8ab1
284
py
Python
packages/Demo/projects/scripts/projects/python/scripts/func_params_test.py
datagrok-ai/packages
809cbc28c4c81c707fb3b9549cb750d5f854f300
[ "MIT" ]
18
2019-12-25T13:49:35.000Z
2022-03-31T13:02:37.000Z
packages/Demo/projects/scripts/projects/python/scripts/func_params_test.py
datagrok-ai/packages
809cbc28c4c81c707fb3b9549cb750d5f854f300
[ "MIT" ]
311
2020-07-29T10:37:12.000Z
2022-03-31T23:55:02.000Z
packages/Demo/projects/scripts/projects/python/scripts/func_params_test.py
datagrok-ai/packages
809cbc28c4c81c707fb3b9549cb750d5f854f300
[ "MIT" ]
18
2020-02-12T13:42:31.000Z
2022-01-14T09:00:56.000Z
#name: Func Params Test #description: suggestions, choices and validators test #language: python #tags: test, selenium #input: string country {suggestions: jsSuggestCountryName} #input: string vegetable {choices: jsVeggies} #input: double saltiness {validators: ["jsSaltinessRange"]}
35.5
59
0.792254
30
284
7.5
0.733333
0.097778
0
0
0
0
0
0
0
0
0
0
0.105634
284
7
60
40.571429
0.885827
0.950704
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
0e6a80d090cefb6ff8b8151ca8f238f8ad4f04b0
12,922
py
Python
dragons-hook.py
pauljacobson/Dragons-Hook
f57941ffa3756c1ea8683ee98ecc993856fc9024
[ "MIT" ]
null
null
null
dragons-hook.py
pauljacobson/Dragons-Hook
f57941ffa3756c1ea8683ee98ecc993856fc9024
[ "MIT" ]
null
null
null
dragons-hook.py
pauljacobson/Dragons-Hook
f57941ffa3756c1ea8683ee98ecc993856fc9024
[ "MIT" ]
null
null
null
from sys import exit from sys import argv from os.path import exists # This enables me to use the `name` variable throughout the script # inv = open("ex36_game_txt.txt", 'w') name = raw_input("What is your name, brave adventurer? > ") print "Welcome to Dragon's Hook, %s." % name def portal(): print "The large, stone circle bursts to life and, through the ripples in the centre of the circle, you see your home. It is a doorway, will you step through it?" portal_choice = raw_input("Yes or no? > ") if portal_choice == "yes": print "You step through the rippling gate and find yourself back home. The sun is shining and the air is cool." print "You have come to the end of your journey. Congratulations %s." % name elif portal_choice == "no": print "The portal fades and closes after a few minutes and you find yourself in darkness. You step out the room into the passage outside and the door swings closed behind you." return end() def exit(): print "You step through the door and into the early morning light. The next chapter of your adventure lies ahead of you." def died(): print "Your short quest has come to an end, along with your life, %s. Perhaps you will have more success in the next life." % name def end(): print "You have reached the end of the passage and you are faced with three options: A door to your 'left', another to your 'right' and the 'exit' behind you." print "Make your choice. Do you want to take the 'left' door, the 'right' door or 'exit' the dungeon?" end_choice = raw_input("> ") if end_choice == "left": return room5() elif end_choice == "right": return room6() elif end_choice == "exit": return run_away() else: print "Surely you have learned to make a decision by now, %s?" % name return end() def room6(): print "You step into the room. There is a window with bars on the opposite wall." print "On the wall to your left, you see a heavy, reinforced door. The sunlight shines underneath it." print "There is nothing else in the room. What do you want to do now?" room6_choice = raw_input("Will you 'open' the door or 'exit' the room? > ") if room6_choice == "open": return exit() elif room6_choice == "exit": return end() else: print "You're not good at making decisions, are you %s? Why don't you just leave the room and hope that your ability to make decisions returns next time?" % name return room6() def room5(): print "As you step into this room, you notice that the door seems different. Unlike the other doors that are worn down, breaking, this door is like new." print "As you step into the room, you see an iron lever in the ground. When you step up to it, you see that you can move the lever one position." print "On the wall to your right, there is a large stone circle the height of a large human." lever_choice = raw_input("What do you want to do? 'Move' the lever or 'leave' the room?") if lever_choice == "move": return portal() elif lever_choice == "leave": print "Perhaps wisely, you ignore the temptation and step out of the room." return end() def room3(): print "You step into the room. The door slams shut behind you and locks. You look around the room and, as you do, a strange creature steps out of the shadows." print "The creature looks at you, its eyes glow and you hear a voice in your head: 'Answer my riddle, %s, and you may go free. If you fail, your pitiful mind will be mine forever ...'" % name print "You are enthralled by the strange creature. Once again, it speaks ... 'If there are 4 apples before you and and you take away 3, how many apples do you have?'" room3_choice = raw_input("What is your answer? > ") if room3_choice == "3": print "The creature withdraws back into the shadows ... 'You may leave ... never return!'" print "You step out of the room and the door slams shut and locks." return middle() else: print "Incorrect answer! If you take away 3 apples, you have 3 apples!" print "The creature's eyes burn into your soul and a terrible voice says, 'You have failed. Your fragile mind is mine forever ...'" return died() def room4(): print "As you open the door to this room, you see a small fire in the centre of the room. There are two goblins sitting around it with their backs to you." print "You also notice a short sword against the wall next to the door." print "Just as you look up, you notice that one of the goblins has seen you and is drawing his sword to attack." print "You have three choices: 1. You can `rush` them and try beat them in the confusion. 2. You can grab the `sword` and attack them, losing the element of surprise. 3. You can close the door and `leave`." room4_choice = raw_input("What do you do? > ") if room4_choice == "rush": print "It probably seemed like a good idea but you're no match for two armed goblins. They cut you down and have adventurer kebabs for dinner." elif room4_choice == "sword": print "You lift the short sword and attack. They get a few slices in but you defeat them, killing both goblins." print "Alas, it was all for naught, there is no more treasure here. You do have a sword though." elif room4_choice == "leave": print "Today is your lucky day. You close the door and they don't chase you." return middle() else: print "Once again, your indecision fails you. They cut you down and have adventurer kebabs for dinner." return died() def middle(): print "You find yourself back in the dark corridor." print "Once again, you have a door to your left and a door to your right." print "You can also move ahead or exit the dungeon and call it a day." print "What do you want to do? Will you take the 'left' door, the 'right' door, move 'ahead' or 'exit' the dungeon?" middle_choice = raw_input("> ") if middle_choice == "left": room3() elif middle_choice == "right": room4() elif middle_choice == "ahead": end() elif middle_choice == "exit": run_away() else: room1_indecision() def room2(): print "As you push this door open, it falls from its rotten hinges and crashes to the ground." print "Fortunately, there are no terrible creatures waiting to eat you here. There is only a small wooden chest in the middle of the room." print "What would you like to do? 'Open' the chest or 'leave' the room?" room2_choice = raw_input("> ") if room2_choice == "open": print "The lid of the chest creaks open and reveals half a dozen rubies. You stuff them into your pouch and leave the room." # inv = open("ex36_game_txt.txt", 'w') # line1 = raw_input("12 rubies") # inv.write(line1) # inv.write("\n") # inv.close() # Add rubies to inventory return middle() elif room2_choice == "leave": middle() else: print "You're not good at making decisions, are you %s? Why don't you just leave the room and hope that your ability to make decisions returns next time?" % name return middle() def room1_run(): print "Throwing caution to the wind, you burst into the room and sprint to the treasure chest at the far end of the room." print "You hear a roar as you run and see a ferocious feral bear with claws extended hurtling after you in the dim light of the room." print "Just as you reach the treasure chest, the bear attacks you. What do you do?" print "You don't have any weapons. Do you fight or grab some treasure and run away?" bear_attack = raw_input("Choose either to 'fight' or 'run'. > ") if bear_attack == "fight": print "You put up a valiant struggle against the feral bear ... for about 10 seconds before it mauls you to death. Someone is probably proud of you and the bear has something to eat for dinner." return died() elif bear_attack == "run": print "You manage to grab a few handfuls of gold coins before the bear stabs its claws into you and sprint for the exit." # inv = open("ex36_game_txt.txt", 'w') # line2 = raw_input("10 gold coins") # inv.write(line2) # inv.write("\n") # inv.close() # I also want to add "gold coins" to a text file inventory that the script will add to. print "You manage to slam the door closed just as the bear reaches it. It howls in frustration and hunger." return middle() else: room1_indecision() def room1_creep(): print "You slowly enter the room, and look around. In the opposite corner of the room, you see a ferocious looking bear. It doesn't seem to have seen you yet." print "You make your way to the chest at the end of the room, checking to see whether the bear has seen you yet. So far, so good." print "Just as you reach the treasure chest, you hear a roar from the bear that seems to have seen you. What do you do? Rush 'back' to the door or go for the 'treasure'?" creep_choice = raw_input("You have two choices: 'back' or 'treasure'. > ") if creep_choice == "back": print "You make a run for it. You feel the bear's hot breath on the back of your neck but you reach the door before it catches you." print "You slam the door closed behind you and you find yourself back in the passage." return entrance() elif creep_choice == "treasure": print "You manage to grab a few handfuls of gold coins before the bear stabs its claws into you and sprint for the exit." # inv = open("ex36_game_txt.txt", 'w') # line3 = raw_input("10 gold coins") # inv.write(line3) # inv.write("\n") # inv.close() # I also want to add "gold coins" to a text file inventory that the script will add to. print "You manage to slam the door closed just as the bear reaches it. It howls in frustration and hunger." return middle() else: room1_indecision() def room1_indecision(): print "Once again, you are immobilised by fear, %s. This time it doesn't serve you and a terrible, feral bear pounces on you and mauls you savagely. Perhaps you will fare better in your next life." % name return died() def room1(): print "You push open a heavy wooden door and peer into a dimly lit room. You hear a shuffling sound somewhere in the room but you can't make out what's causing it." print "You notice a wooden chest at the far end of the room. You can just make out the glint of gold on the stone floor around the chest. Treasure!" print "What do you want to do? Burst into the room and run to the treasure or creep in more cautiously?" room1_choice = raw_input("Choose 'back', 'run' to the treasure or 'creep' in. > ") if room1_choice == "back": entrance() elif room1_choice == "run": room1_run() elif room1_choice == "creep": room1_creep() else: room1_indecision() def entrance(): print "You find yourself before the entrance to an ancient dungeon. It is dark inside and there is a terrible smell of death wafting out from its depths." print "You check your equipment (or rather the lack of any real equipment) and step inside ..." print "After a few steps into the gloomy dungeon, you see a door to your left and another to your right." print "You can also continue ahead or exit the dungeon." entrance_choice = raw_input("What is your choice? Left, right, ahead or exit? > ") if entrance_choice == "left": room1() elif entrance_choice == "right": room2() elif entrance_choice == "ahead": middle() elif entrance_choice == "exit": run_away() else: print "Still can't make a decision, %s? You can stand here and wait for something to eat you or you can choose to go left, right, ahead or the exit." % name print "Let's try that again, ok?" return entrance() def run_away(): print "You turn and return to safer lands. We won't think less of you. Braver adventurers than you have tried and failed. Try again, another day ..." def start(): print "Well, %s, this is a trecherous land. Only the brave venture here. Are you such a person? Are you willing to risk your life for glory and riches?" % name challenge1 = raw_input("What do you say? Are you up for the challenge? Answer 'yes' or 'no': > ") if challenge1 == "yes": print "Very well, you may proceed ..." entrance() elif challenge1 == "no": run_away() else: print "You have not made a choice. Frozen by terror?" print "Let's try that again. Take your time ..." return start() start()
49.7
210
0.672264
2,116
12,922
4.067108
0.215974
0.030676
0.017894
0.006391
0.249593
0.209273
0.165001
0.130374
0.11643
0.11643
0
0.007329
0.250348
12,922
259
211
49.891892
0.881078
0.049837
0
0.240838
0
0.240838
0.673166
0
0
0
0
0
0
0
null
null
0.015707
0.015707
null
null
0.376963
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
1
1
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
0e73adc79151dbdc286425431ada35525ec5e76b
525
py
Python
newspaper_crawler/loaders/lemonde_loader.py
jeugregg/newspaper-crawler
773ac538f723fe00c72b2838e99fda16b8c04aa6
[ "MIT" ]
8
2019-04-09T07:52:22.000Z
2021-05-03T08:36:57.000Z
newspaper_crawler/loaders/lemonde_loader.py
jeugregg/newspaper-crawler
773ac538f723fe00c72b2838e99fda16b8c04aa6
[ "MIT" ]
null
null
null
newspaper_crawler/loaders/lemonde_loader.py
jeugregg/newspaper-crawler
773ac538f723fe00c72b2838e99fda16b8c04aa6
[ "MIT" ]
3
2020-01-01T07:29:03.000Z
2021-06-02T07:11:40.000Z
from scrapy.loader.processors import Compose from scrapy.loader.processors import Join from .base_loader import BaseLoader class LeMondeLoader(BaseLoader): def clean_date(rawdata): return rawdata[: 10] def clean_author(rawdata): return rawdata.replace(" Par ", "") def clean_description(rawdata): return rawdata[2: -1] date_in = Compose(lambda v: v[0], clean_date) author_out = Compose(Join(", "), clean_author) description_out = Compose(Join(", "), clean_description)
25
60
0.695238
64
525
5.546875
0.4375
0.067606
0.169014
0.146479
0.180282
0
0
0
0
0
0
0.011848
0.19619
525
20
61
26.25
0.829384
0
0
0
0
0
0.019048
0
0
0
0
0
0
1
0.230769
false
0
0.230769
0.230769
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
0e76bb4274f1e5f61ed8308618b585e958e37523
2,203
py
Python
main/service/register_service.py
nguyentranhoan/uit-mobile
8546312b01373d94cf00c64f7eacb769e0f4ccce
[ "BSD-3-Clause" ]
null
null
null
main/service/register_service.py
nguyentranhoan/uit-mobile
8546312b01373d94cf00c64f7eacb769e0f4ccce
[ "BSD-3-Clause" ]
null
null
null
main/service/register_service.py
nguyentranhoan/uit-mobile
8546312b01373d94cf00c64f7eacb769e0f4ccce
[ "BSD-3-Clause" ]
null
null
null
from injector import inject, singleton from component.database import MasterDatabase from request.create_user import CreateUserNormal from mail.sending_email import validate_user_mail @inject @singleton class RegisterService: def __init__(self, master_database: MasterDatabase): super().__init__() self.master_database = master_database def register_normal(self, request: CreateUserNormal): with self.master_database.session() as db: db.execute(f""" DELETE FROM authentication""") db.execute(f""" INSERT INTO authentication ( user_name, password, email) VALUES ( '{request.normal_account}', '{request.password}', '{request.email}')""") db.commit() validate_user_mail(request.email) def register_normal_successful(self): with self.master_database.session() as db: response = 'successful!' request = db.execute(f""" SELECT user_name, password, email FROM authentication""").fetchone() db.execute(f""" INSERT INTO user_account ( normal_account, password, email) VALUES ( '{request.user_name}', '{request.password}', '{request.email}')""") return response
40.796296
100
0.375851
132
2,203
6.060606
0.340909
0.0875
0.09
0.055
0.1325
0.0825
0.0825
0
0
0
0
0
0.562869
2,203
53
101
41.566038
0.830737
0
0
0.391304
0
0
0.619156
0.041307
0
0
0
0
0
1
0.065217
false
0.108696
0.086957
0
0.195652
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
0e7edaf93f8da7068dccbfb3e4fb280d71141eda
603
py
Python
build/lib.linux-x86_64-2.7/pyplusplus/code_creators/embedded_code_repository.py
ISoirar/pypp11
7f929064766a48d9cb3f3b29c93fdc938b83bac5
[ "BSL-1.0" ]
9
2016-06-07T19:14:53.000Z
2020-02-28T09:06:19.000Z
pypp11/code_creators/embedded_code_repository.py
ISoirar/pypp11
7f929064766a48d9cb3f3b29c93fdc938b83bac5
[ "BSL-1.0" ]
1
2018-08-15T11:33:40.000Z
2018-08-15T11:33:40.000Z
pypp11/code_creators/embedded_code_repository.py
ISoirar/pypp11
7f929064766a48d9cb3f3b29c93fdc938b83bac5
[ "BSL-1.0" ]
5
2016-06-23T09:37:00.000Z
2019-12-18T13:51:29.000Z
# Copyright 2004-2008 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. (See # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) import code_creator class embedded_code_repository_t(code_creator.code_creator_t): """Creates Python import directive""" def __init__( self, code_repository_module ): code_creator.code_creator_t.__init__(self) self.__code = code_repository_module.code def _create_impl(self): return self.__code def _get_system_files_impl( self ): return []
31.736842
66
0.718076
82
603
4.841463
0.536585
0.138539
0.04534
0.060453
0.115869
0
0
0
0
0
0
0.029046
0.200663
603
18
67
33.5
0.794606
0.358209
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.111111
0.222222
0.777778
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
0e94e62406f8fe85aaca7377826a248ab6697787
397
py
Python
core/api/exceptions.py
pascalopitz/microweb
b5c2c6351d814ebdee55f41505d9500404fd309a
[ "MIT" ]
11
2015-01-02T12:19:14.000Z
2019-09-25T13:31:09.000Z
core/api/exceptions.py
pascalopitz/microweb
b5c2c6351d814ebdee55f41505d9500404fd309a
[ "MIT" ]
17
2015-01-16T23:15:05.000Z
2020-06-05T16:58:49.000Z
core/api/exceptions.py
pascalopitz/microweb
b5c2c6351d814ebdee55f41505d9500404fd309a
[ "MIT" ]
7
2015-10-29T14:40:45.000Z
2021-06-03T10:44:55.000Z
class APIException(Exception): """ Encapsulates HTTP errors thrown by the microcosm API. """ def __init__(self, error_message, status_code=None, detail=None): self.status_code = status_code self.detail = detail super(APIException, self).__init__(error_message) def __str__(self): return 'HTTP status: %d: %s' % (self.status_code, self.message)
33.083333
71
0.670025
48
397
5.166667
0.520833
0.16129
0.112903
0
0
0
0
0
0
0
0
0
0.221662
397
12
71
33.083333
0.802589
0.133501
0
0
0
0
0.057751
0
0
0
0
0
0
1
0.285714
false
0
0
0.142857
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
0ea3069139d0ba6ae3b96a73bcc083bba1d482bc
1,003
py
Python
django_tgb_basics/soft_deletion/managers.py
tonybolanyo/django-tgb-basics
bd31e41399e6e2aac255f307f0e6360dad50946c
[ "MIT" ]
null
null
null
django_tgb_basics/soft_deletion/managers.py
tonybolanyo/django-tgb-basics
bd31e41399e6e2aac255f307f0e6360dad50946c
[ "MIT" ]
null
null
null
django_tgb_basics/soft_deletion/managers.py
tonybolanyo/django-tgb-basics
bd31e41399e6e2aac255f307f0e6360dad50946c
[ "MIT" ]
null
null
null
""" Managers personalizados comunes para usar a lo largo de todas las apps. """ from django.contrib.gis.db import models from .querysets import SoftDeletionQuerySet class SoftDeletionManager(models.Manager): """ Manager para gestionar el borrado `ficticio`. """ def __init__(self, *args, **kwargs): self.alive_only = kwargs.pop("alive_only", True) super(SoftDeletionManager, self).__init__(*args, **kwargs) def get_queryset(self): """ Devuelve un QuerySet con solamente los objetos marcados como borrados o todos en función del valor del atributo ``alive_only``. """ if self.alive_only: return SoftDeletionQuerySet(self.model).filter(deleted_at=None) return SoftDeletionQuerySet(self.model) def hard_delete(self): """ Realiza una eliminación `masiva` y definitiva (no `ficticia`) de los elementos del queryset. """ return self.get_queryset().hard_delete()
29.5
77
0.665005
115
1,003
5.652174
0.643478
0.055385
0.04
0.107692
0
0
0
0
0
0
0
0
0.237288
1,003
33
78
30.393939
0.849673
0.336989
0
0
0
0
0.017241
0
0
0
0
0.030303
0
1
0.25
false
0
0.166667
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
1
0
0
1
0
0
0
0
1
0
0
3
7ee67998fbab9d318ab3b80fe15016c925157b8e
2,283
py
Python
datasetsnx/bamboo/convert.py
ckxy/part-of-hitogata
76402d48a336fcd964d0e64bb01d959e8f07f296
[ "MIT" ]
null
null
null
datasetsnx/bamboo/convert.py
ckxy/part-of-hitogata
76402d48a336fcd964d0e64bb01d959e8f07f296
[ "MIT" ]
null
null
null
datasetsnx/bamboo/convert.py
ckxy/part-of-hitogata
76402d48a336fcd964d0e64bb01d959e8f07f296
[ "MIT" ]
null
null
null
import numpy as np from PIL import Image from .base_internode import BaseInternode from torchvision.transforms.functional import to_tensor, to_pil_image __all__ = ['ToTensor', 'ToPILImage', 'ToCV2Image'] class ToTensor(BaseInternode): def __call__(self, data_dict): # data_dict = super(ToTensor, self).__call__(data_dict) data_dict['image'] = to_tensor(data_dict['image']) if 'mask' in data_dict.keys(): data_dict['mask'] = (to_tensor(data_dict['mask']) * 255).long().squeeze() return data_dict def reverse(self, **kwargs): if 'image' in kwargs.keys(): kwargs['image'] = to_pil_image(kwargs['image']) if 'mask' in kwargs.keys(): kwargs['mask'] = to_pil_image(kwargs['mask'].float() / 255) return kwargs def __repr__(self): return 'ToTensor()' def rper(self): return 'ToPILImage()' class ToPILImage(BaseInternode): def __call__(self, data_dict): # data_dict = super(ToPILImage, self).__call__(data_dict) data_dict['image'] = Image.fromarray(data_dict['image']) # if 'mask' in data_dict.keys(): # data_dict['mask'] = Image.fromarray(data_dict['mask']) return data_dict def reverse(self, **kwargs): if 'image' in kwargs.keys(): kwargs['image'] = np.array(kwargs['image']) # if 'mask' in kwargs.keys(): # kwargs['mask'] = np.array(kwargs['mask']) return kwargs def __repr__(self): return 'ToPILImage()' def rper(self): return 'ToCV2Image()' class ToCV2Image(BaseInternode): def __call__(self, data_dict): # data_dict = super(ToCV2Image, self).__call__(data_dict) data_dict['image'] = np.array(data_dict['image']) # if 'mask' in data_dict.keys(): # data_dict['mask'] = np.array(data_dict['mask']) return data_dict def reverse(self, **kwargs): if 'image' in kwargs.keys(): kwargs['image'] = Image.fromarray(kwargs['image']) # if 'mask' in kwargs.keys(): # kwargs['mask'] = Image.fromarray(kwargs['mask']) return kwargs def __repr__(self): return 'ToCV2Image()' def rper(self): return 'ToPILImage()'
30.44
85
0.603154
271
2,283
4.797048
0.151292
0.166154
0.055385
0.073846
0.654615
0.613077
0.590769
0.523846
0.463846
0.27
0
0.006425
0.25011
2,283
74
86
30.851351
0.752921
0.215944
0
0.577778
0
0
0.110861
0
0
0
0
0
0
1
0.266667
false
0
0.088889
0.133333
0.688889
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
7eeb57fbf82cf9ce83ae411665b72b07eab4399d
1,094
py
Python
Rozwiazania-zadan/5_Seria-V/stack.py
bzglinicki/Programowanie-I-R
02a63a44bb9eeea2aa7dbbb0ec18c0462d692ef0
[ "MIT" ]
2
2022-03-01T14:45:01.000Z
2022-03-19T17:36:07.000Z
Rozwiazania-zadan/5_Seria-V/stack.py
bzglinicki/Programowanie-I-R
02a63a44bb9eeea2aa7dbbb0ec18c0462d692ef0
[ "MIT" ]
null
null
null
Rozwiazania-zadan/5_Seria-V/stack.py
bzglinicki/Programowanie-I-R
02a63a44bb9eeea2aa7dbbb0ec18c0462d692ef0
[ "MIT" ]
null
null
null
# Programowanie I R # Zadania - seria 4. # Zadanie 2. #*********************************************************************************** # Klasa Stack #*********************************************************************************** class Stack: def __init__(self): self._items = [] def is_empty(self): return not self._items def push(self, item): if item: self._items.append(item) return True else: return False def pop(self): if self.is_empty(): return None else: return self._items.pop() def peek(self): if self.is_empty(): return None else: return self._items[-1] def size(self): return len(self._items) #*********************************************************************************** # Główny kod programu #*********************************************************************************** s = Stack() for arg in sys.argv[1:]: s.push(arg) while not s.is_empty(): print(s.pop())
21.88
85
0.362888
97
1,094
3.948454
0.443299
0.140992
0.062663
0.062663
0.240209
0.240209
0.240209
0.240209
0.240209
0.240209
0
0.00492
0.256856
1,094
50
86
21.88
0.466175
0.375686
0
0.25
0
0
0
0
0
0
0
0
0
1
0.214286
false
0
0
0.071429
0.535714
0.035714
0
0
0
null
0
0
0
0
0
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
1
0
0
0
0
1
0
0
3
7eec8d4667b27a5478e298a752f41a011b52c8f4
3,398
py
Python
create_csv.py
umarxfhu/ECE356_Project_Stocks
b7f6f9738e0d8e84f29b776fc2116c86b8c1bff4
[ "BSD-2-Clause" ]
null
null
null
create_csv.py
umarxfhu/ECE356_Project_Stocks
b7f6f9738e0d8e84f29b776fc2116c86b8c1bff4
[ "BSD-2-Clause" ]
null
null
null
create_csv.py
umarxfhu/ECE356_Project_Stocks
b7f6f9738e0d8e84f29b776fc2116c86b8c1bff4
[ "BSD-2-Clause" ]
null
null
null
# 356 script to load csv import pandas as pd df_ipo = pd.read_csv("C:\a_UNI\3B\ECE 356\Project STONKS\daily data & company info\IPODataFull.csv") df_companyOnly = df_ipo[[ "Symbol", "Name", "Sector", "Industry", "Summary Quote", "CEOAge", "CEOName", "City", "stateCountry", "FiscalDateEnd", "employees", "YearFounded", "exactDateFound" ]] df_companyOnly.to_csv('company.csv', index=False) df_2014 = pd.read_csv("/content/drive/MyDrive/UNI/3B/ECE 356/356 Project - STONKS/2014_Financial_Data.csv", encoding='latin1') df_2015 = pd.read_csv("/content/drive/MyDrive/UNI/3B/ECE 356/356 Project - STONKS/2015_Financial_Data.csv", encoding='latin1') df_2016 = pd.read_csv("/content/drive/MyDrive/UNI/3B/ECE 356/356 Project - STONKS/2016_Financial_Data.csv", encoding='latin1') df_2017 = pd.read_csv("/content/drive/MyDrive/UNI/3B/ECE 356/356 Project - STONKS/2017_Financial_Data.csv", encoding='latin1') df_2018 = pd.read_csv("/content/drive/MyDrive/UNI/3B/ECE 356/356 Project - STONKS/2018_Financial_Data.csv", encoding='latin1') df_2014new = df_2014[[ "Symbol", "Revenue", "Revenue Growth", "Net Income", "EPS", "Free Cash Flow margin", "Net Profit Margin", "currentRatio", "returnOnEquity", "priceEarningsRatio", "Revenue per Share", "Market Cap", "PE ratio", "Dividend Yield", "ROIC", "3Y Revenue Growth (per Share)" ]] df_2015new = df_2015[[ "Symbol", "Revenue", "Revenue Growth", "Net Income", "EPS", "Free Cash Flow margin", "Net Profit Margin", "currentRatio", "returnOnEquity", "priceEarningsRatio", "Revenue per Share", "Market Cap", "PE ratio", "Dividend Yield", "ROIC", "3Y Revenue Growth (per Share)" ]] df_2016new = df_2016[[ "Symbol", "Revenue", "Revenue Growth", "Net Income", "EPS", "Free Cash Flow margin", "Net Profit Margin", "currentRatio", "returnOnEquity", "priceEarningsRatio", "Revenue per Share", "Market Cap", "PE ratio", "Dividend Yield", "ROIC", "3Y Revenue Growth (per Share)" ]] df_2017new = df_2017[[ "Symbol", "Revenue", "Revenue Growth", "Net Income", "EPS", "Free Cash Flow margin", "Net Profit Margin", "currentRatio", "returnOnEquity", "priceEarningsRatio", "Revenue per Share", "Market Cap", "PE ratio", "Dividend Yield", "ROIC", "3Y Revenue Growth (per Share)" ]] df_2018new = df_2018[[ "Symbol", "Revenue", "Revenue Growth", "Net Income", "EPS", "Free Cash Flow margin", "Net Profit Margin", "currentRatio", "returnOnEquity", "priceEarningsRatio", "Revenue per Share", "Market Cap", "PE ratio", "Dividend Yield", "ROIC", "3Y Revenue Growth (per Share)" ]] df_2014new['year'] = 2014 df_2015new['year'] = 2015 df_2016new['year'] = 2016 df_2017new['year'] = 2017 df_2018new['year'] = 2018 df_all_years = pd.concat(df_2014new, df_2015new, df_2016new, df_2017new, df_2018new) df_all_years.to_csv('yearlyData.csv', index=False)
25.548872
127
0.586816
383
3,398
5.070496
0.221932
0.066941
0.027806
0.033986
0.708033
0.708033
0.625644
0.625644
0.625644
0.625644
0
0.07767
0.272513
3,398
133
128
25.548872
0.707929
0.006474
0
0.722689
0
0.05042
0.522356
0.097132
0
0
0
0
0
1
0
false
0
0.008403
0
0.008403
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
7eedaea918caec6637a913bd5a6235e8f7b27459
120
py
Python
micropython/main.py
JamesHolland181/Mobile-Gantry
233bdcb4e92abfd0bb48269fc1e11a50547714c0
[ "MIT" ]
null
null
null
micropython/main.py
JamesHolland181/Mobile-Gantry
233bdcb4e92abfd0bb48269fc1e11a50547714c0
[ "MIT" ]
null
null
null
micropython/main.py
JamesHolland181/Mobile-Gantry
233bdcb4e92abfd0bb48269fc1e11a50547714c0
[ "MIT" ]
null
null
null
from machine import Pin from time import sleep led = Pin(2, Pin.OUT) while True: led.value(not led.value()) sleep(1)
15
27
0.716667
22
120
3.909091
0.636364
0.186047
0
0
0
0
0
0
0
0
0
0.02
0.166667
120
8
28
15
0.84
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
7d006b00faa70cbf7d4c9a424106b38343c271e2
108
py
Python
src/config.py
Jankipatel30/Flask_App
37ab579e4ddd72582be0d45fac81261e2aec510e
[ "MIT" ]
null
null
null
src/config.py
Jankipatel30/Flask_App
37ab579e4ddd72582be0d45fac81261e2aec510e
[ "MIT" ]
null
null
null
src/config.py
Jankipatel30/Flask_App
37ab579e4ddd72582be0d45fac81261e2aec510e
[ "MIT" ]
null
null
null
POSTGRES_USER=test POSTGRES_PASSWORD=password POSTGRES_HOST=localhost POSTGRES_PORT=5432 POSTGRES_DB=example
21.6
26
0.916667
15
108
6.266667
0.666667
0
0
0
0
0
0
0
0
0
0
0.038462
0.037037
108
5
27
21.6
0.865385
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.2
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
7d0fb5becc834e569e7d74e8ab7bf112d5ce597c
1,946
py
Python
IntervalDomain/testinterval.py
panpan2/AIforAI
d775cebfa02903b3285ffddef2bc23a654b68294
[ "MIT" ]
2
2021-01-03T03:15:34.000Z
2021-05-14T06:14:20.000Z
IntervalDomain/testinterval.py
panpan2/AIforAI
d775cebfa02903b3285ffddef2bc23a654b68294
[ "MIT" ]
null
null
null
IntervalDomain/testinterval.py
panpan2/AIforAI
d775cebfa02903b3285ffddef2bc23a654b68294
[ "MIT" ]
null
null
null
from interval import * import unittest class TestInterval(unittest.TestCase): def test_relu_number(self): print("\nTest relu of a single number") self.assertEqual(0, relu_number(-5)) self.assertEqual(0, relu_number(0)) self.assertEqual(3, relu_number(3)) print("PASSED") def test_relu(self): print("\nTest Interval relu") self.assertEqual((1, 1), relu((1, 1))) self.assertEqual((0, 0), relu((0, 0))) self.assertEqual((0, 0), relu((-4, -1))) self.assertEqual((0, 2), relu((-4, 2))) self.assertEqual((10, 11), relu((10, 11))) print("PASSED") def test_add(self): print("\nTest Interval addition") self.assertEqual((2, 4), add((0, 1), (2, 3))) self.assertEqual((1, 4), add((-1, 1), (2, 3))) print("PASSED") def test_sub(self): print("\nTest Interval substraction") self.assertEqual((-3, -1), sub((0, 1), (2, 3))) self.assertEqual((-4, -1), sub((-1, 1), (2, 3))) self.assertEqual((-7, -4), sub((-4, -2), (2, 3))) self.assertEqual((4, 7), sub((1, 2), (-5, -3))) self.assertEqual((2, 7), sub((-1, 2), (-5, -3))) self.assertEqual((-4, 7), sub((-1, 2), (-5, 3))) self.assertEqual((-2, 7), sub((1, 2), (-5, 3))) print("PASSED") def test_mul_constant(self): print("\nTest Interval multiplication by constant") self.assertEqual((2, 4), mul_constant((1, 2), 2)) self.assertEqual((-4, -2), mul_constant((1, 2), -2)) self.assertEqual((0, 0), mul_constant((1, 2), 0)) print("PASSED") def test_to_interval(self): print("\nTest conversion of number to Interval") self.assertEqual((2, 2), to_interval(2)) self.assertEqual((-1, -1), to_interval(-1)) self.assertEqual((0, 0), to_interval(0)) print("PASSED") if __name__ == '__main__': unittest.main()
35.381818
60
0.54779
267
1,946
3.895131
0.153558
0.331731
0.107692
0.086538
0.367308
0.185577
0.149038
0.093269
0.093269
0.093269
0
0.073519
0.245118
1,946
54
61
36.037037
0.634445
0
0
0.130435
0
0
0.11665
0
0
0
0
0
0.5
1
0.130435
false
0.130435
0.043478
0
0.195652
0.26087
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
1
0
0
0
1
0
0
0
0
0
3
7d51fed6cc96e7a26f39aba48b6cd5c9831b7f96
35,764
py
Python
fhireval/test_suite/capability_statement/test_search_params.py
ncpi-fhir/ncpi-fhir-platform-evaluation
dcc6d3824a41a23cd3be8b3f384a1fd18336a32f
[ "CC0-1.0" ]
null
null
null
fhireval/test_suite/capability_statement/test_search_params.py
ncpi-fhir/ncpi-fhir-platform-evaluation
dcc6d3824a41a23cd3be8b3f384a1fd18336a32f
[ "CC0-1.0" ]
15
2021-03-19T21:59:15.000Z
2021-05-14T23:27:17.000Z
fhireval/test_suite/capability_statement/test_search_params.py
ncpi-fhir/ncpi-fhir-platform-evaluation
dcc6d3824a41a23cd3be8b3f384a1fd18336a32f
[ "CC0-1.0" ]
null
null
null
import pytest from fhireval.test_suite.capability_statement import get_resource, get_capability_statement # Which bullet point do these tests map to test_id = f"{'2.1.4':<10} - Resource Search Params" # How much weight do we attribute to the tests in this file test_weight = 2 @pytest.mark.capability_statement # Search params @pytest.mark.parametrize("search_res, search_params", [ ('Account', [('balance', 'quantity'),('identifier', 'token'),('name', 'string'),('owner', 'reference'),('patient', 'reference'),('period', 'date'),('status', 'token'),('subject', 'reference'),('type', 'token')]), ('ActivityDefinition', [('composed-of', 'reference'),('date', 'date'),('depends-on', 'reference'),('derived-from', 'reference'),('description', 'string'),('effective', 'date'),('identifier', 'token'),('jurisdiction', 'token'),('name', 'string'),('predecessor', 'reference'),('publisher', 'string'),('status', 'token'),('successor', 'reference'),('title', 'string'),('topic', 'token'),('url', 'uri'),('version', 'token')]), ('AdverseEvent', [('category', 'token'),('date', 'date'),('location', 'reference'),('reaction', 'reference'),('recorder', 'reference'),('seriousness', 'token'),('study', 'reference'),('subject', 'reference'),('substance', 'reference'),('type', 'token')]), ('AllergyIntolerance', [('asserter', 'reference'),('category', 'token'),('clinical-status', 'token'),('code', 'token'),('criticality', 'token'),('date', 'date'),('identifier', 'token'),('last-date', 'date'),('manifestation', 'token'),('onset', 'date'),('patient', 'reference'),('recorder', 'reference'),('route', 'token'),('severity', 'token'),('type', 'token'),('verification-status', 'token')]), ('Appointment', [('actor', 'reference'),('appointment-type', 'token'),('date', 'date'),('identifier', 'token'),('incomingreferral', 'reference'),('location', 'reference'),('part-status', 'token'),('patient', 'reference'),('practitioner', 'reference'),('service-type', 'token'),('status', 'token')]), ('AppointmentResponse', [('actor', 'reference'),('appointment', 'reference'),('identifier', 'token'),('location', 'reference'),('part-status', 'token'),('patient', 'reference'),('practitioner', 'reference')]), ('AuditEvent', [('action', 'token'),('address', 'string'),('agent', 'reference'),('agent-name', 'string'),('agent-role', 'token'),('altid', 'token'),('date', 'date'),('entity', 'reference'),('entity-id', 'token'),('entity-name', 'string'),('entity-role', 'token'),('entity-type', 'token'),('outcome', 'token'),('patient', 'reference'),('policy', 'uri'),('site', 'token'),('source', 'token'),('subtype', 'token'),('type', 'token'),('user', 'token')]), ('Basic', [('author', 'reference'),('code', 'token'),('created', 'date'),('identifier', 'token'),('patient', 'reference'),('subject', 'reference')]), ('Binary', [('contenttype', 'token')]), ('BodySite', [('code', 'token'),('identifier', 'token'),('patient', 'reference')]), ('Bundle', [('composition', 'reference'),('identifier', 'token'),('message', 'reference'),('type', 'token')]), ('CapabilityStatement', [('date', 'date'),('description', 'string'),('event', 'token'),('fhirversion', 'token'),('format', 'token'),('guide', 'uri'),('jurisdiction', 'token'),('mode', 'token'),('name', 'string'),('publisher', 'string'),('resource', 'token'),('resource-profile', 'reference'),('security-service', 'token'),('software', 'string'),('status', 'token'),('supported-profile', 'reference'),('title', 'string'),('url', 'uri'),('version', 'token')]), ('CarePlan', [('activity-code', 'token'),('activity-date', 'date'),('activity-reference', 'reference'),('author-inc', 'reference'),('based-on', 'reference'),('care-team', 'reference'),('category', 'token'),('condition', 'reference'),('context', 'reference'),('date', 'date'),('definition', 'reference'),('encounter', 'reference'),('goal', 'reference'),('identifier', 'token'),('intent', 'token'),('part-of', 'reference'),('patient', 'reference'),('performer', 'reference'),('replaces', 'reference'),('status', 'token'),('subject', 'reference')]), ('CareTeam', [('category', 'token'),('context', 'reference'),('date', 'date'),('encounter', 'reference'),('identifier', 'token'),('participant', 'reference'),('patient', 'reference'),('status', 'token'),('subject', 'reference')]), ('ChargeItem', [('account', 'reference'),('code', 'token'),('context', 'reference'),('entered-date', 'date'),('enterer', 'reference'),('factor-override', 'number'),('identifier', 'token'),('occurrence', 'date'),('participant-actor', 'reference'),('participant-role', 'token'),('patient', 'reference'),('performing-organization', 'reference'),('price-override', 'quantity'),('quantity', 'quantity'),('requesting-organization', 'reference'),('service', 'reference'),('subject', 'reference')]), ('Claim', [('care-team', 'reference'),('created', 'date'),('encounter', 'reference'),('enterer', 'reference'),('facility', 'reference'),('identifier', 'token'),('insurer', 'reference'),('organization', 'reference'),('patient', 'reference'),('payee', 'reference'),('priority', 'token'),('provider', 'reference'),('use', 'token')]), ('ClaimResponse', [('created', 'date'),('disposition', 'string'),('identifier', 'token'),('insurer', 'reference'),('outcome', 'token'),('patient', 'reference'),('payment-date', 'date'),('request', 'reference'),('request-provider', 'reference')]), ('ClinicalImpression', [('action', 'reference'),('assessor', 'reference'),('context', 'reference'),('date', 'date'),('finding-code', 'token'),('finding-ref', 'reference'),('identifier', 'token'),('investigation', 'reference'),('patient', 'reference'),('previous', 'reference'),('problem', 'reference'),('status', 'token'),('subject', 'reference')]), ('CodeSystem', [('code', 'token'),('content-mode', 'token'),('date', 'date'),('description', 'string'),('identifier', 'token'),('jurisdiction', 'token'),('language', 'token'),('name', 'string'),('publisher', 'string'),('status', 'token'),('system', 'uri'),('title', 'string'),('url', 'uri'),('version', 'token')]), ('Communication', [('based-on', 'reference'),('category', 'token'),('context', 'reference'),('definition', 'reference'),('encounter', 'reference'),('identifier', 'token'),('medium', 'token'),('part-of', 'reference'),('patient', 'reference'),('received', 'date'),('recipient', 'reference'),('sender', 'reference'),('sent', 'date'),('status', 'token'),('subject', 'reference')]), ('CommunicationRequest', [('authored', 'date'),('based-on', 'reference'),('category', 'token'),('context', 'reference'),('encounter', 'reference'),('group-identifier', 'token'),('identifier', 'token'),('medium', 'token'),('occurrence', 'date'),('patient', 'reference'),('priority', 'token'),('recipient', 'reference'),('replaces', 'reference'),('requester', 'reference'),('sender', 'reference'),('status', 'token'),('subject', 'reference')]), ('CompartmentDefinition', [('code', 'token'),('date', 'date'),('description', 'string'),('jurisdiction', 'token'),('name', 'string'),('publisher', 'string'),('resource', 'token'),('status', 'token'),('title', 'string'),('url', 'uri')]), ('Composition', [('attester', 'reference'),('author', 'reference'),('class', 'token'),('confidentiality', 'token'),('context', 'token'),('date', 'date'),('encounter', 'reference'),('entry', 'reference'),('identifier', 'token'),('patient', 'reference'),('period', 'date'),('related-id', 'token'),('related-ref', 'reference'),('section', 'token'),('status', 'token'),('subject', 'reference'),('title', 'string'),('type', 'token')]), ('ConceptMap', [('date', 'date'),('dependson', 'uri'),('description', 'string'),('identifier', 'token'),('jurisdiction', 'token'),('name', 'string'),('other', 'uri'),('product', 'uri'),('publisher', 'string'),('source', 'reference'),('source-code', 'token'),('source-system', 'uri'),('source-uri', 'reference'),('status', 'token'),('target', 'reference'),('target-code', 'token'),('target-system', 'uri'),('target-uri', 'reference'),('title', 'string'),('url', 'uri'),('version', 'token')]), ('Condition', [('abatement-age', 'quantity'),('abatement-boolean', 'token'),('abatement-date', 'date'),('abatement-string', 'string'),('asserted-date', 'date'),('asserter', 'reference'),('body-site', 'token'),('category', 'token'),('clinical-status', 'token'),('code', 'token'),('context', 'reference'),('encounter', 'reference'),('evidence', 'token'),('evidence-detail', 'reference'),('identifier', 'token'),('onset-age', 'quantity'),('onset-date', 'date'),('onset-info', 'string'),('patient', 'reference'),('severity', 'token'),('stage', 'token'),('subject', 'reference'),('verification-status', 'token')]), ('Consent', [('action', 'token'),('actor', 'reference'),('category', 'token'),('consentor', 'reference'),('data', 'reference'),('date', 'date'),('identifier', 'token'),('organization', 'reference'),('patient', 'reference'),('period', 'date'),('purpose', 'token'),('securitylabel', 'token'),('source', 'reference'),('status', 'token')]), ('Contract', [('agent', 'reference'),('authority', 'reference'),('domain', 'reference'),('identifier', 'token'),('issued', 'date'),('patient', 'reference'),('signer', 'reference'),('subject', 'reference'),('term-topic', 'reference')]), ('Coverage', [('beneficiary', 'reference'),('class', 'string'),('dependent', 'string'),('group', 'string'),('identifier', 'token'),('payor', 'reference'),('plan', 'string'),('policy-holder', 'reference'),('sequence', 'string'),('subclass', 'string'),('subgroup', 'string'),('subplan', 'string'),('subscriber', 'reference'),('type', 'token')]), ('DataElement', [('code', 'token'),('date', 'date'),('description', 'string'),('identifier', 'token'),('jurisdiction', 'token'),('name', 'string'),('publisher', 'string'),('status', 'token'),('stringency', 'token'),('title', 'string'),('url', 'uri'),('version', 'token')]), ('DetectedIssue', [('author', 'reference'),('category', 'token'),('date', 'date'),('identifier', 'token'),('implicated', 'reference'),('patient', 'reference')]), ('Device', [('device-name', 'string'),('identifier', 'token'),('location', 'reference'),('manufacturer', 'string'),('model', 'string'),('organization', 'reference'),('patient', 'reference'),('status', 'token'),('type', 'token'),('udi-carrier', 'string'),('udi-di', 'string'),('url', 'uri')]), ('DeviceComponent', [('identifier', 'token'),('parent', 'reference'),('source', 'reference'),('type', 'token')]), ('DeviceMetric', [('category', 'token'),('identifier', 'token'),('parent', 'reference'),('source', 'reference'),('type', 'token')]), ('DeviceRequest', [('authored-on', 'date'),('based-on', 'reference'),('code', 'token'),('definition', 'reference'),('device', 'reference'),('encounter', 'reference'),('event-date', 'date'),('group-identifier', 'token'),('identifier', 'token'),('intent', 'token'),('patient', 'reference'),('performer', 'reference'),('priorrequest', 'reference'),('requester', 'reference'),('status', 'token'),('subject', 'reference')]), ('DeviceUseStatement', [('device', 'reference'),('identifier', 'token'),('patient', 'reference'),('subject', 'reference')]), ('DiagnosticReport', [('based-on', 'reference'),('category', 'token'),('code', 'token'),('context', 'reference'),('date', 'date'),('diagnosis', 'token'),('encounter', 'reference'),('identifier', 'token'),('image', 'reference'),('issued', 'date'),('patient', 'reference'),('performer', 'reference'),('result', 'reference'),('specimen', 'reference'),('status', 'token'),('subject', 'reference')]), ('DocumentManifest', [('author', 'reference'),('content-ref', 'reference'),('created', 'date'),('description', 'string'),('identifier', 'token'),('patient', 'reference'),('recipient', 'reference'),('related-id', 'token'),('related-ref', 'reference'),('source', 'uri'),('status', 'token'),('subject', 'reference'),('type', 'token')]), ('DocumentReference', [('authenticator', 'reference'),('author', 'reference'),('class', 'token'),('created', 'date'),('custodian', 'reference'),('description', 'string'),('encounter', 'reference'),('event', 'token'),('facility', 'token'),('format', 'token'),('identifier', 'token'),('indexed', 'date'),('language', 'token'),('location', 'uri'),('patient', 'reference'),('period', 'date'),('related-id', 'token'),('related-ref', 'reference'),('relatesto', 'reference'),('relation', 'token'),('relationship', 'composite'),('securitylabel', 'token'),('setting', 'token'),('status', 'token'),('subject', 'reference'),('type', 'token')]), ('EligibilityRequest', [('created', 'date'),('enterer', 'reference'),('facility', 'reference'),('identifier', 'token'),('organization', 'reference'),('patient', 'reference'),('provider', 'reference')]), ('EligibilityResponse', [('created', 'date'),('disposition', 'string'),('identifier', 'token'),('insurer', 'reference'),('outcome', 'token'),('request', 'reference'),('request-organization', 'reference'),('request-provider', 'reference')]), ('Encounter', [('appointment', 'reference'),('class', 'token'),('date', 'date'),('diagnosis', 'reference'),('episodeofcare', 'reference'),('identifier', 'token'),('incomingreferral', 'reference'),('length', 'quantity'),('location', 'reference'),('location-period', 'date'),('part-of', 'reference'),('participant', 'reference'),('participant-type', 'token'),('patient', 'reference'),('practitioner', 'reference'),('reason', 'token'),('service-provider', 'reference'),('special-arrangement', 'token'),('status', 'token'),('subject', 'reference'),('type', 'token')]), ('Endpoint', [('connection-type', 'token'),('identifier', 'token'),('name', 'string'),('organization', 'reference'),('payload-type', 'token'),('status', 'token')]), ('EnrollmentRequest', [('identifier', 'token'),('organization', 'reference'),('patient', 'reference'),('subject', 'reference')]), ('EnrollmentResponse', [('identifier', 'token'),('organization', 'reference'),('request', 'reference')]), ('EpisodeOfCare', [('care-manager', 'reference'),('condition', 'reference'),('date', 'date'),('identifier', 'token'),('incomingreferral', 'reference'),('organization', 'reference'),('patient', 'reference'),('status', 'token'),('type', 'token')]), ('ExpansionProfile', [('date', 'date'),('description', 'string'),('identifier', 'token'),('jurisdiction', 'token'),('name', 'string'),('publisher', 'string'),('status', 'token'),('url', 'uri'),('version', 'token')]), ('ExplanationOfBenefit', [('care-team', 'reference'),('claim', 'reference'),('coverage', 'reference'),('created', 'date'),('disposition', 'string'),('encounter', 'reference'),('enterer', 'reference'),('facility', 'reference'),('identifier', 'token'),('organization', 'reference'),('patient', 'reference'),('payee', 'reference'),('provider', 'reference')]), ('FamilyMemberHistory', [('code', 'token'),('date', 'date'),('definition', 'reference'),('gender', 'token'),('identifier', 'token'),('patient', 'reference'),('relationship', 'token'),('status', 'token')]), ('Flag', [('author', 'reference'),('date', 'date'),('encounter', 'reference'),('identifier', 'token'),('patient', 'reference'),('subject', 'reference')]), ('Goal', [('category', 'token'),('identifier', 'token'),('patient', 'reference'),('start-date', 'date'),('status', 'token'),('subject', 'reference'),('target-date', 'date')]), ('GraphDefinition', [('date', 'date'),('description', 'string'),('jurisdiction', 'token'),('name', 'string'),('publisher', 'string'),('start', 'token'),('status', 'token'),('url', 'uri'),('version', 'token')]), ('Group', [('actual', 'token'),('characteristic', 'token'),('characteristic-value', 'composite'),('code', 'token'),('exclude', 'token'),('identifier', 'token'),('member', 'reference'),('type', 'token'),('value', 'token')]), ('GuidanceResponse', [('identifier', 'token'),('patient', 'reference'),('request', 'token'),('subject', 'reference')]), ('HealthcareService', [('active', 'token'),('category', 'token'),('characteristic', 'token'),('endpoint', 'reference'),('identifier', 'token'),('location', 'reference'),('name', 'string'),('organization', 'reference'),('programname', 'string'),('type', 'token')]), ('ImagingManifest', [('author', 'reference'),('authoring-time', 'date'),('endpoint', 'reference'),('identifier', 'token'),('imaging-study', 'reference'),('patient', 'reference'),('selected-study', 'uri')]), ('ImagingStudy', [('accession', 'token'),('basedon', 'reference'),('bodysite', 'token'),('context', 'reference'),('dicom-class', 'uri'),('endpoint', 'reference'),('identifier', 'token'),('modality', 'token'),('patient', 'reference'),('performer', 'reference'),('reason', 'token'),('series', 'uri'),('started', 'date'),('study', 'uri'),('uid', 'uri')]), ('Immunization', [('date', 'date'),('dose-sequence', 'number'),('identifier', 'token'),('location', 'reference'),('lot-number', 'string'),('manufacturer', 'reference'),('notgiven', 'token'),('patient', 'reference'),('practitioner', 'reference'),('reaction', 'reference'),('reaction-date', 'date'),('reason', 'token'),('reason-not-given', 'token'),('status', 'token'),('vaccine-code', 'token')]), ('ImmunizationRecommendation', [('date', 'date'),('dose-number', 'number'),('dose-sequence', 'number'),('identifier', 'token'),('information', 'reference'),('patient', 'reference'),('status', 'token'),('support', 'reference'),('target-disease', 'token'),('vaccine-type', 'token')]), ('ImplementationGuide', [('date', 'date'),('dependency', 'uri'),('description', 'string'),('experimental', 'token'),('jurisdiction', 'token'),('name', 'string'),('publisher', 'string'),('resource', 'reference'),('status', 'token'),('url', 'uri'),('version', 'token')]), ('Library', [('composed-of', 'reference'),('date', 'date'),('depends-on', 'reference'),('derived-from', 'reference'),('description', 'string'),('effective', 'date'),('identifier', 'token'),('jurisdiction', 'token'),('name', 'string'),('predecessor', 'reference'),('publisher', 'string'),('status', 'token'),('successor', 'reference'),('title', 'string'),('topic', 'token'),('url', 'uri'),('version', 'token')]), ('Linkage', [('author', 'reference')]), ('List', [('code', 'token'),('date', 'date'),('empty-reason', 'token'),('encounter', 'reference'),('identifier', 'token'),('item', 'reference'),('notes', 'string'),('patient', 'reference'),('source', 'reference'),('status', 'token'),('subject', 'reference'),('title', 'string')]), ('Location', [('address', 'string'),('address-city', 'string'),('address-country', 'string'),('address-postalcode', 'string'),('address-state', 'string'),('address-use', 'token'),('endpoint', 'reference'),('identifier', 'token'),('name', 'string'),('near', 'token'),('near-distance', 'quantity'),('operational-status', 'token'),('organization', 'reference'),('partof', 'reference'),('status', 'token'),('type', 'token')]), ('Measure', [('composed-of', 'reference'),('date', 'date'),('depends-on', 'reference'),('derived-from', 'reference'),('description', 'string'),('effective', 'date'),('identifier', 'token'),('jurisdiction', 'token'),('name', 'string'),('predecessor', 'reference'),('publisher', 'string'),('status', 'token'),('successor', 'reference'),('title', 'string'),('topic', 'token'),('url', 'uri'),('version', 'token')]), ('MeasureReport', [('identifier', 'token'),('patient', 'reference'),('status', 'token')]), ('Media', [('based-on', 'reference'),('context', 'reference'),('created', 'date'),('date', 'date'),('device', 'reference'),('identifier', 'token'),('operator', 'reference'),('patient', 'reference'),('site', 'token'),('subject', 'reference'),('subtype', 'token'),('type', 'token'),('view', 'token')]), ('Medication', [('code', 'token'),('container', 'token'),('form', 'token'),('ingredient', 'reference'),('ingredient-code', 'token'),('manufacturer', 'reference'),('over-the-counter', 'token'),('package-item', 'reference'),('package-item-code', 'token'),('status', 'token')]), ('MedicationAdministration', [('category', 'token'),('code', 'token'),('context', 'reference'),('device', 'reference'),('effective-time', 'date'),('identifier', 'token'),('medication', 'reference'),('not-given', 'token'),('patient', 'reference'),('performer', 'reference'),('prescription', 'reference'),('reason-given', 'token'),('reason-not-given', 'token'),('status', 'token'),('subject', 'reference')]), ('MedicationDispense', [('category', 'token'),('code', 'token'),('context', 'reference'),('destination', 'reference'),('identifier', 'token'),('medication', 'reference'),('patient', 'reference'),('performer', 'reference'),('periodofuse', 'date'),('prescription', 'reference'),('receiver', 'reference'),('responsibleparty', 'reference'),('status', 'token'),('subject', 'reference'),('type', 'token'),('whenhandedover', 'date'),('whenprepared', 'date')]), ('MedicationRequest', [('authoredon', 'date'),('category', 'token'),('code', 'token'),('context', 'reference'),('date', 'date'),('identifier', 'token'),('intended-dispenser', 'reference'),('intent', 'token'),('medication', 'reference'),('patient', 'reference'),('periodofuse', 'date'),('priority', 'token'),('requester', 'reference'),('status', 'token'),('subject', 'reference')]), ('MedicationStatement', [('category', 'token'),('code', 'token'),('context', 'reference'),('effective', 'date'),('identifier', 'token'),('medication', 'reference'),('part-of', 'reference'),('patient', 'reference'),('source', 'reference'),('status', 'token'),('subject', 'reference')]), ('MessageDefinition', [('category', 'token'),('date', 'date'),('description', 'string'),('event', 'token'),('focus', 'token'),('identifier', 'token'),('jurisdiction', 'token'),('name', 'string'),('publisher', 'string'),('status', 'token'),('title', 'string'),('url', 'uri'),('version', 'token')]), ('MessageHeader', [('author', 'reference'),('code', 'token'),('destination', 'string'),('destination-uri', 'uri'),('enterer', 'reference'),('event', 'token'),('focus', 'reference'),('receiver', 'reference'),('response-id', 'token'),('responsible', 'reference'),('sender', 'reference'),('source', 'string'),('source-uri', 'uri'),('target', 'reference'),('timestamp', 'date')]), ('NamingSystem', [('contact', 'string'),('date', 'date'),('description', 'string'),('id-type', 'token'),('jurisdiction', 'token'),('kind', 'token'),('name', 'string'),('period', 'date'),('publisher', 'string'),('replaced-by', 'reference'),('responsible', 'string'),('status', 'token'),('telecom', 'token'),('type', 'token'),('value', 'string')]), ('NutritionOrder', [('additive', 'token'),('datetime', 'date'),('encounter', 'reference'),('formula', 'token'),('identifier', 'token'),('oraldiet', 'token'),('patient', 'reference'),('provider', 'reference'),('status', 'token'),('supplement', 'token')]), ('Observation', [('based-on', 'reference'),('category', 'token'),('code', 'token'),('code-value-concept', 'composite'),('code-value-date', 'composite'),('code-value-quantity', 'composite'),('code-value-string', 'composite'),('combo-code', 'token'),('combo-code-value-concept', 'composite'),('combo-code-value-quantity', 'composite'),('combo-data-absent-reason', 'token'),('combo-value-concept', 'token'),('combo-value-quantity', 'quantity'),('component-code', 'token'),('component-code-value-concept', 'composite'),('component-code-value-quantity', 'composite'),('component-data-absent-reason', 'token'),('component-value-concept', 'token'),('component-value-quantity', 'quantity'),('context', 'reference'),('data-absent-reason', 'token'),('date', 'date'),('device', 'reference'),('encounter', 'reference'),('identifier', 'token'),('method', 'token'),('patient', 'reference'),('performer', 'reference'),('related', 'composite'),('related-target', 'reference'),('related-type', 'token'),('specimen', 'reference'),('status', 'token'),('subject', 'reference'),('value-concept', 'token'),('value-date', 'date'),('value-quantity', 'quantity'),('value-string', 'string')]), ('OperationDefinition', [('base', 'reference'),('code', 'token'),('date', 'date'),('description', 'string'),('instance', 'token'),('jurisdiction', 'token'),('kind', 'token'),('name', 'string'),('param-profile', 'reference'),('publisher', 'string'),('status', 'token'),('system', 'token'),('type', 'token'),('url', 'uri'),('version', 'token')]), ('OperationOutcome', []), ('Organization', [('active', 'token'),('address', 'string'),('address-city', 'string'),('address-country', 'string'),('address-postalcode', 'string'),('address-state', 'string'),('address-use', 'token'),('endpoint', 'reference'),('identifier', 'token'),('name', 'string'),('partof', 'reference'),('phonetic', 'string'),('type', 'token')]), ('Parameters', []), ('Patient', [('active', 'token'),('address', 'string'),('address-city', 'string'),('address-country', 'string'),('address-postalcode', 'string'),('address-state', 'string'),('address-use', 'token'),('animal-breed', 'token'),('animal-species', 'token'),('birthdate', 'date'),('death-date', 'date'),('deceased', 'token'),('email', 'token'),('family', 'string'),('gender', 'token'),('general-practitioner', 'reference'),('given', 'string'),('identifier', 'token'),('language', 'token'),('link', 'reference'),('name', 'string'),('organization', 'reference'),('phone', 'token'),('phonetic', 'string'),('telecom', 'token')]), ('PaymentNotice', [('created', 'date'),('identifier', 'token'),('organization', 'reference'),('payment-status', 'token'),('provider', 'reference'),('request', 'reference'),('response', 'reference'),('statusdate', 'date')]), ('PaymentReconciliation', [('created', 'date'),('disposition', 'string'),('identifier', 'token'),('organization', 'reference'),('outcome', 'token'),('request', 'reference'),('request-organization', 'reference'),('request-provider', 'reference')]), ('Person', [('address', 'string'),('address-city', 'string'),('address-country', 'string'),('address-postalcode', 'string'),('address-state', 'string'),('address-use', 'token'),('birthdate', 'date'),('email', 'token'),('gender', 'token'),('identifier', 'token'),('link', 'reference'),('name', 'string'),('organization', 'reference'),('patient', 'reference'),('phone', 'token'),('phonetic', 'string'),('practitioner', 'reference'),('relatedperson', 'reference'),('telecom', 'token')]), ('PlanDefinition', [('composed-of', 'reference'),('date', 'date'),('depends-on', 'reference'),('derived-from', 'reference'),('description', 'string'),('effective', 'date'),('identifier', 'token'),('jurisdiction', 'token'),('name', 'string'),('predecessor', 'reference'),('publisher', 'string'),('status', 'token'),('successor', 'reference'),('title', 'string'),('topic', 'token'),('url', 'uri'),('version', 'token')]), ('Practitioner', [('active', 'token'),('address', 'string'),('address-city', 'string'),('address-country', 'string'),('address-postalcode', 'string'),('address-state', 'string'),('address-use', 'token'),('communication', 'token'),('email', 'token'),('family', 'string'),('gender', 'token'),('given', 'string'),('identifier', 'token'),('name', 'string'),('phone', 'token'),('phonetic', 'string'),('telecom', 'token')]), ('PractitionerRole', [('active', 'token'),('date', 'date'),('email', 'token'),('endpoint', 'reference'),('identifier', 'token'),('location', 'reference'),('organization', 'reference'),('phone', 'token'),('practitioner', 'reference'),('role', 'token'),('service', 'reference'),('specialty', 'token'),('telecom', 'token')]), ('Procedure', [('based-on', 'reference'),('category', 'token'),('code', 'token'),('context', 'reference'),('date', 'date'),('definition', 'reference'),('encounter', 'reference'),('identifier', 'token'),('location', 'reference'),('part-of', 'reference'),('patient', 'reference'),('performer', 'reference'),('status', 'token'),('subject', 'reference')]), ('ProcedureRequest', [('authored', 'date'),('based-on', 'reference'),('body-site', 'token'),('code', 'token'),('context', 'reference'),('definition', 'reference'),('encounter', 'reference'),('identifier', 'token'),('intent', 'token'),('occurrence', 'date'),('patient', 'reference'),('performer', 'reference'),('performer-type', 'token'),('priority', 'token'),('replaces', 'reference'),('requester', 'reference'),('requisition', 'token'),('specimen', 'reference'),('status', 'token'),('subject', 'reference')]), ('ProcessRequest', [('action', 'token'),('identifier', 'token'),('organization', 'reference'),('provider', 'reference')]), ('ProcessResponse', [('identifier', 'token'),('organization', 'reference'),('request', 'reference'),('request-organization', 'reference'),('request-provider', 'reference')]), ('Provenance', [('agent', 'reference'),('agent-role', 'token'),('end', 'date'),('entity-id', 'token'),('entity-ref', 'reference'),('location', 'reference'),('patient', 'reference'),('recorded', 'date'),('signature-type', 'token'),('start', 'date'),('target', 'reference')]), ('Questionnaire', [('code', 'token'),('date', 'date'),('description', 'string'),('effective', 'date'),('identifier', 'token'),('jurisdiction', 'token'),('name', 'string'),('publisher', 'string'),('status', 'token'),('title', 'string'),('url', 'uri'),('version', 'token')]), ('QuestionnaireResponse', [('author', 'reference'),('authored', 'date'),('based-on', 'reference'),('context', 'reference'),('identifier', 'token'),('parent', 'reference'),('patient', 'reference'),('questionnaire', 'reference'),('source', 'reference'),('status', 'token'),('subject', 'reference')]), ('ReferralRequest', [('authored-on', 'date'),('based-on', 'reference'),('context', 'reference'),('definition', 'reference'),('encounter', 'reference'),('group-identifier', 'token'),('identifier', 'token'),('intent', 'token'),('occurrence-date', 'date'),('patient', 'reference'),('priority', 'token'),('recipient', 'reference'),('replaces', 'reference'),('requester', 'reference'),('service', 'token'),('specialty', 'token'),('status', 'token'),('subject', 'reference'),('type', 'token')]), ('RelatedPerson', [('active', 'token'),('address', 'string'),('address-city', 'string'),('address-country', 'string'),('address-postalcode', 'string'),('address-state', 'string'),('address-use', 'token'),('birthdate', 'date'),('email', 'token'),('gender', 'token'),('identifier', 'token'),('name', 'string'),('patient', 'reference'),('phone', 'token'),('phonetic', 'string'),('telecom', 'token')]), ('RequestGroup', [('author', 'reference'),('authored', 'date'),('context', 'reference'),('definition', 'reference'),('encounter', 'reference'),('group-identifier', 'token'),('identifier', 'token'),('intent', 'token'),('participant', 'reference'),('patient', 'reference'),('priority', 'token'),('status', 'token'),('subject', 'reference')]), ('ResearchStudy', [('category', 'token'),('date', 'date'),('focus', 'token'),('identifier', 'token'),('jurisdiction', 'token'),('keyword', 'token'),('partof', 'reference'),('principalinvestigator', 'reference'),('protocol', 'reference'),('site', 'reference'),('sponsor', 'reference'),('status', 'token'),('title', 'string')]), ('ResearchSubject', [('date', 'date'),('identifier', 'token'),('individual', 'reference'),('patient', 'reference'),('status', 'token')]), ('RiskAssessment', [('condition', 'reference'),('date', 'date'),('encounter', 'reference'),('identifier', 'token'),('method', 'token'),('patient', 'reference'),('performer', 'reference'),('probability', 'number'),('risk', 'token'),('subject', 'reference')]), ('Schedule', [('active', 'token'),('actor', 'reference'),('date', 'date'),('identifier', 'token'),('type', 'token')]), ('SearchParameter', [('base', 'token'),('code', 'token'),('component', 'reference'),('date', 'date'),('derived-from', 'uri'),('description', 'string'),('jurisdiction', 'token'),('name', 'string'),('publisher', 'string'),('status', 'token'),('target', 'token'),('type', 'token'),('url', 'uri'),('version', 'token')]), ('Sequence', [('chromosome', 'token'),('coordinate', 'composite'),('end', 'number'),('identifier', 'token'),('patient', 'reference'),('start', 'number'),('type', 'token')]), ('ServiceDefinition', [('composed-of', 'reference'),('date', 'date'),('depends-on', 'reference'),('derived-from', 'reference'),('description', 'string'),('effective', 'date'),('identifier', 'token'),('jurisdiction', 'token'),('name', 'string'),('predecessor', 'reference'),('publisher', 'string'),('status', 'token'),('successor', 'reference'),('title', 'string'),('topic', 'token'),('url', 'uri'),('version', 'token')]), ('Slot', [('identifier', 'token'),('schedule', 'reference'),('slot-type', 'token'),('start', 'date'),('status', 'token')]), ('Specimen', [('accession', 'token'),('bodysite', 'token'),('collected', 'date'),('collector', 'reference'),('container', 'token'),('container-id', 'token'),('identifier', 'token'),('parent', 'reference'),('patient', 'reference'),('status', 'token'),('subject', 'reference'),('type', 'token')]), ('StructureDefinition', [('abstract', 'token'),('base', 'uri'),('base-path', 'token'),('context-type', 'token'),('date', 'date'),('derivation', 'token'),('description', 'string'),('experimental', 'token'),('ext-context', 'string'),('identifier', 'token'),('jurisdiction', 'token'),('keyword', 'token'),('kind', 'token'),('name', 'string'),('path', 'token'),('publisher', 'string'),('status', 'token'),('title', 'string'),('type', 'token'),('url', 'uri'),('valueset', 'reference'),('version', 'token')]), ('StructureMap', [('date', 'date'),('description', 'string'),('identifier', 'token'),('jurisdiction', 'token'),('name', 'string'),('publisher', 'string'),('status', 'token'),('title', 'string'),('url', 'uri'),('version', 'token')]), ('Subscription', [('add-tag', 'token'),('contact', 'token'),('criteria', 'string'),('payload', 'string'),('status', 'token'),('type', 'token'),('url', 'uri')]), ('Substance', [('category', 'token'),('code', 'token'),('container-identifier', 'token'),('expiry', 'date'),('identifier', 'token'),('quantity', 'quantity'),('status', 'token'),('substance-reference', 'reference')]), ('SupplyDelivery', [('identifier', 'token'),('patient', 'reference'),('receiver', 'reference'),('status', 'token'),('supplier', 'reference')]), ('SupplyRequest', [('category', 'token'),('date', 'date'),('identifier', 'token'),('requester', 'reference'),('status', 'token'),('supplier', 'reference')]), ('Task', [('authored-on', 'date'),('based-on', 'reference'),('business-status', 'token'),('code', 'token'),('context', 'reference'),('focus', 'reference'),('group-identifier', 'token'),('identifier', 'token'),('intent', 'token'),('modified', 'date'),('organization', 'reference'),('owner', 'reference'),('part-of', 'reference'),('patient', 'reference'),('performer', 'token'),('period', 'date'),('priority', 'token'),('requester', 'reference'),('status', 'token'),('subject', 'reference')]), ('TestReport', [('identifier', 'token'),('issued', 'date'),('participant', 'uri'),('result', 'token'),('tester', 'string'),('testscript', 'reference')]), ('TestScript', [('date', 'date'),('description', 'string'),('identifier', 'token'),('jurisdiction', 'token'),('name', 'string'),('publisher', 'string'),('status', 'token'),('testscript-capability', 'string'),('title', 'string'),('url', 'uri'),('version', 'token')]), ('ValueSet', [('date', 'date'),('description', 'string'),('expansion', 'uri'),('identifier', 'token'),('jurisdiction', 'token'),('name', 'string'),('publisher', 'string'),('reference', 'uri'),('status', 'token'),('title', 'string'),('url', 'uri'),('version', 'token')]), ('VisionPrescription', [('datewritten', 'date'),('encounter', 'reference'),('identifier', 'token'),('patient', 'reference'),('prescriber', 'reference')]) ]) def test_search_params(host, search_res, search_params): res = get_resource(host, search_res) params = {} for sp in res['searchParam']: params[sp['name']] = sp['type'] for (sname, stype) in search_params: assert stype == params[sname], f"searchParam {sname} is {stype}"
246.648276
1,168
0.611621
3,199
35,764
6.832448
0.147546
0.072746
0.034039
0.032118
0.509677
0.421284
0.339296
0.252093
0.207394
0.185661
0
0.000177
0.051309
35,764
144
1,169
248.361111
0.644021
0.003132
0
0
0
0
0.609858
0.01139
0
0
0
0
0.022901
1
0.007634
false
0
0.015267
0
0.022901
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
7d52bdfe41cc423e8761894db41a314f2070320c
2,122
py
Python
test.py
kalebm1/Random-Generator-Study
325991caf0917c0c24bf712963a3535d07511567
[ "MIT" ]
null
null
null
test.py
kalebm1/Random-Generator-Study
325991caf0917c0c24bf712963a3535d07511567
[ "MIT" ]
null
null
null
test.py
kalebm1/Random-Generator-Study
325991caf0917c0c24bf712963a3535d07511567
[ "MIT" ]
null
null
null
'''This File is used for testing Randomness in the algorithms and for plotting the findings of those tests.''' from Algorithms.RandomMarsenne import Random from Algorithms.RandomWells import WellsRandom from Algorithms.RandomBBS import RandomBBS from Algorithms.RandomBMAlgo import RandomBM import matplotlib.pyplot as plt from collections import Counter from PIL import Image from IPython.display import display import random # %matplotlib inline test = Random() # num_trials = 10**7 # s = [test.randint(0,1001) for n in range(num_trials)] # y = [s.count(n) for n in range(1000)] # # your code here # plt.bar(range(1000),y, width=1.0, edgecolor='black') # plt.title('My MT algorithm') # plt.ylabel("Times of show up") # plt.xlabel('Outcome') # plt.show() # num_trials = 10**7 # random.seed() # s = [random.randint(0,1000) for n in range(num_trials)] # y = [s.count(n) for n in range(1000)] # # your code here # plt.bar(range(1000),y, width=1.0, edgecolor='black') # plt.title('Python buit-in Random') # plt.ylabel("Times of show up") # plt.xlabel('Outcome') # plt.show() """THIS IS THE CODE FOR THE IMAGE""" # IMAGE_SIZE = 500 # myImg = Image.new('RGB', (IMAGE_SIZE,IMAGE_SIZE), "white") # pixels = myImg.load() # test = Random() # for i in range(50000): # x = test.randint(0,IMAGE_SIZE) # y = test.randint(0,IMAGE_SIZE) # # print(str(x)+", "+str(y)+"\n") # pixels[x,y] = (0,0,0) # myImg.save("RANDOMSEEDWITHTIME50000.png","PNG") """THIS IS THE CODE TO TEST THE WELLS ALGO""" # test = WellsRandom() # test.InitWELLRNG512a() # print(test.WELLRNG512a()) # print(test.WELLRNG512a()) # print(test.WELLRNG512a()) # rand = Random() # print(rand.randint(0,600)) # print(rand.randint(0,600)) # print(rand.randint(0,600)) """Code To Test Blum-Blum Shub""" # tester = RandomBBS(19,23,6) # print(tester.getRandBit()) # print(tester.getRandBit()) # print(tester.getRandBit()) # print(tester.getRandBit()) """Code to test the Blum-Micali""" # tester = RandomBM() # print(tester.getRandBits(256))
24.674419
62
0.656927
303
2,122
4.570957
0.343234
0.040433
0.017329
0.031769
0.387004
0.356679
0.313357
0.313357
0.313357
0.252708
0
0.049625
0.183318
2,122
85
63
24.964706
0.749567
0.668709
0
0
0
0
0
0
0
0
0
0.011765
0
1
0
false
0
0.9
0
0.9
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
1
0
1
0
0
3
ada68636164215fdbf24a55c429cd95924335884
192
py
Python
mdshop/mdshop/apps/oauth/urls.py
lichengpython/mdshop
c704d2d447501b898082f331e85181bbfdd28d06
[ "MIT" ]
null
null
null
mdshop/mdshop/apps/oauth/urls.py
lichengpython/mdshop
c704d2d447501b898082f331e85181bbfdd28d06
[ "MIT" ]
null
null
null
mdshop/mdshop/apps/oauth/urls.py
lichengpython/mdshop
c704d2d447501b898082f331e85181bbfdd28d06
[ "MIT" ]
null
null
null
from django.conf.urls import url from oauth import views urlpatterns = [ url(r'^qq/authorization/$', views.QQAuthURLView.as_view()), url(r'^qq/user/$', views.QQAuthView.as_view()), ]
24
63
0.697917
27
192
4.888889
0.62963
0.060606
0.090909
0
0
0
0
0
0
0
0
0
0.130208
192
8
64
24
0.790419
0
0
0
0
0
0.150259
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
adbbc76ec88bcaf3d7f765561c542c1185088a0c
355
py
Python
api_replay/core.py
easypairings/api-replay
a4a0321ad33196d65e32ce0445b3f5c4c06c8988
[ "MIT" ]
2
2017-05-11T08:48:19.000Z
2020-08-08T07:59:05.000Z
api_replay/core.py
easypairings/api-replay
a4a0321ad33196d65e32ce0445b3f5c4c06c8988
[ "MIT" ]
null
null
null
api_replay/core.py
easypairings/api-replay
a4a0321ad33196d65e32ce0445b3f5c4c06c8988
[ "MIT" ]
1
2017-05-11T08:48:19.000Z
2017-05-11T08:48:19.000Z
from flask import Flask from flask.ext.redis import Redis from .utils import check_required_settings app = Flask(__name__) redis_store = Redis() def setup_app(): app.config.from_object('api_replay.settings') check_required_settings(app.config) redis_store.init_app(app) from . import views # NOQA registers the routes return app
20.882353
52
0.75493
51
355
4.980392
0.490196
0.070866
0.165354
0.188976
0
0
0
0
0
0
0
0
0.169014
355
16
53
22.1875
0.861017
0.070423
0
0
0
0
0.057927
0
0
0
0
0
0
1
0.090909
false
0
0.363636
0
0.545455
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
adc4bb6c2ee9e967761b19f9542b091fec27e442
3,000
py
Python
node.py
jahanseir/NetTrees
cb621b604cf74ab52544072cdaff7b418da40963
[ "MIT" ]
null
null
null
node.py
jahanseir/NetTrees
cb621b604cf74ab52544072cdaff7b418da40963
[ "MIT" ]
null
null
null
node.py
jahanseir/NetTrees
cb621b604cf74ab52544072cdaff7b418da40963
[ "MIT" ]
1
2019-11-02T18:56:32.000Z
2019-11-02T18:56:32.000Z
""" Defines nodes that are the building blocks of net-trees. """ from point import Point class Node: """ Defines a Node associated to a point and a level which also maintains its parent, children, and relatives. Parameters ---------- point : Point Associated point. level : int Associated level. """ def __init__(self, point, level): self.point = point self.level = level self.par = None self.rel = {self} self.ch = set() def addrel(self, other): """ Makes `self` and `other` relatives. Parameters ---------- other: Node The relative node. Returns: ------- None """ self.rel.add(other) other.rel.add(self) def addch(self, other): """ Adds `other` as a child of `self`, also sets `self` as the parent of `other`. Parameters ---------- other: Node The child node. Returns: ------- None """ if other.par: other.par.ch.discard(other) self.ch.add(other) other.par = self def setpar(self, other): """ Makes `other` as the parent of `self`, also sets `self` as a child of `other`. Parameters ---------- other: Node The parent node. Returns: ------- None """ other.addch(self) def getchild(self): """ Returns an arbitrary child. Parameters ---------- None Returns: ------- Node An arbitrary child of the current node. """ return next(iter(self.ch)) def __str__(self): return str(self.point) + " at level " + str(self.level) + "\n" + "".join(str(c) for c in self.ch) def __eq__(self, other): return self.point == other.point and self.level == other.level def __hash__(self): return hash((tuple(self.point.coords), self.level)) """ Below are some static methods that allow us to treat the nodes as a metric space, and also to access the par, ch, and rel of entire sets of nodes instead of just individuals. """ def ch(nodes): return nodes.ch if isinstance(nodes, Node) else \ set.union(*(node.ch for node in nodes)) def rel(nodes): return nodes.rel if isinstance(nodes, Node) else \ set.union(*(node.rel for node in nodes)) def par(nodes): return nodes.par if isinstance(nodes, Node) else \ {node.par for node in nodes if node.par is not None} def nearest(node, others): return min(others, key=lambda n:node.point.distto(n.point)) def dist(node, other): return node.point.distto(other if isinstance(other, Point) else other.point)
24.793388
105
0.517333
355
3,000
4.326761
0.267606
0.029297
0.037109
0.042969
0.150391
0.111979
0.048177
0.048177
0
0
0
0
0.365
3,000
120
106
25
0.806299
0.279667
0
0
0
0
0.008032
0
0
0
0
0
0
1
0.342105
false
0
0.026316
0.210526
0.631579
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
adc9cec7258a70c951e4d19a436e2aedfa697458
1,857
py
Python
main.py
gecBurton/csv-manifesto
c5021dd843df2e6cabd4e95faae4928f0654e43e
[ "MIT" ]
null
null
null
main.py
gecBurton/csv-manifesto
c5021dd843df2e6cabd4e95faae4928f0654e43e
[ "MIT" ]
null
null
null
main.py
gecBurton/csv-manifesto
c5021dd843df2e6cabd4e95faae4928f0654e43e
[ "MIT" ]
null
null
null
import io import json from itertools import chain from typing import Dict, Iterator def read_csv(file: io.StringIO) -> Iterator[Dict]: """read in a CSV encoded text-stream and convert to native Python >>> txt = '''"Name", "Sex", "Age", "Height (in)", "Consent Given" ... "Alex", "M", 41, null, true ... "Bert", "F", 42, 68.5, null ... "Carl", null, 32, 70.0, false ... ''' >>> for line in read_csv(io.StringIO(txt)): ... print(line) {'Name': 'Alex', 'Sex': 'M', 'Age': 41, 'Height (in)': None, 'Consent Given': True} {'Name': 'Bert', 'Sex': 'F', 'Age': 42, 'Height (in)': 68.5, 'Consent Given': None} {'Name': 'Carl', 'Sex': None, 'Age': 32, 'Height (in)': 70.0, 'Consent Given': False} """ def f(_row): return json.loads(f"[{_row}]") header = f(next(file)) for row in file: yield dict(zip(header, f(row))) def write_csv(rows: Iterator[Dict], file: io.StringIO) -> None: """write native Python to a CSV encoded text-stream >>> data = [ ... {"Name": "Alex", "Sex": "M", "Age": 41, "Height (in)": None, "Consent Given": True}, ... {"Name": "Bert", "Sex": "F", "Age": 42, "Height (in)": 68.5, "Consent Given": None}, ... {"Name": "Carl", "Sex": None, "Age": 32, "Height (in)": 70.0, "Consent Given": False}, ... ] >>> csv_file = io.StringIO() >>> write_csv(iter(data), csv_file) >>> _ = csv_file.seek(0) >>> print(csv_file.read()) "Name", "Sex", "Age", "Height (in)", "Consent Given" "Alex", "M", 41, null, true "Bert", "F", 42, 68.5, null "Carl", null, 32, 70.0, false <BLANKLINE> """ def f(_row) -> str: return f"{json.dumps(list(_row))[1:-1]}\n" first = next(rows) file.write(f(first.keys())) for row in chain([first], rows): file.write(f(row.values()))
30.442623
98
0.532579
261
1,857
3.739464
0.272031
0.065574
0.043033
0.034836
0.481557
0.438525
0.438525
0.438525
0.438525
0.438525
0
0.035815
0.233172
1,857
60
99
30.95
0.649579
0.632202
0
0
0
0
0.070671
0.056537
0
0
0
0
0
1
0.235294
false
0
0.235294
0.117647
0.588235
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
add312a59a243f7a955c41a06f1ddc09e463ac66
159
py
Python
learn-to-code-with-python/04-Variables/intro-to-variables.py
MaciejZurek/python_practicing
0a426f2aed151573e1f8678e0239ff596d92bbde
[ "MIT" ]
null
null
null
learn-to-code-with-python/04-Variables/intro-to-variables.py
MaciejZurek/python_practicing
0a426f2aed151573e1f8678e0239ff596d92bbde
[ "MIT" ]
null
null
null
learn-to-code-with-python/04-Variables/intro-to-variables.py
MaciejZurek/python_practicing
0a426f2aed151573e1f8678e0239ff596d92bbde
[ "MIT" ]
null
null
null
name = "Maciek" age = 22 print("imie:", name, "\nwiek:", age) fovoruite_language = "Python" print(age + 4) fact_or_fiction = 3 < 5 print(fact_or_fiction)
12.230769
36
0.666667
24
159
4.208333
0.666667
0.118812
0.257426
0
0
0
0
0
0
0
0
0.037879
0.169811
159
12
37
13.25
0.727273
0
0
0
0
0
0.150943
0
0
0
0
0
0
1
0
false
0
0
0
0
0.428571
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
adef61eaf2b0788ffc05b37e470e7eb83c911333
54
py
Python
sandbox/sandbox/order/__init__.py
thelabnyc/django-oscar-api-checkout
bf66901cff4467b26e2c50260b3e1a61404b8b74
[ "0BSD" ]
14
2017-04-19T01:20:47.000Z
2021-03-31T13:19:55.000Z
sandbox/sandbox/order/__init__.py
thelabnyc/django-oscar-api-checkout
bf66901cff4467b26e2c50260b3e1a61404b8b74
[ "0BSD" ]
9
2020-02-11T22:05:54.000Z
2020-10-20T19:32:44.000Z
sandbox/sandbox/order/__init__.py
thelabnyc/django-oscar-api-checkout
bf66901cff4467b26e2c50260b3e1a61404b8b74
[ "0BSD" ]
4
2017-07-22T19:47:10.000Z
2021-10-30T14:20:54.000Z
default_app_config = "sandbox.order.apps.OrderConfig"
27
53
0.833333
7
54
6.142857
1
0
0
0
0
0
0
0
0
0
0
0
0.055556
54
1
54
54
0.843137
0
0
0
0
0
0.555556
0.555556
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
bc085fa1fd80ae6beccfdbaa6f953fe3c59d2744
723
py
Python
tests/components/daikin/test_temperature_format.py
liangleslie/core
cc807b4d597daaaadc92df4a93c6e30da4f570c6
[ "Apache-2.0" ]
30,023
2016-04-13T10:17:53.000Z
2020-03-02T12:56:31.000Z
tests/components/daikin/test_temperature_format.py
liangleslie/core
cc807b4d597daaaadc92df4a93c6e30da4f570c6
[ "Apache-2.0" ]
24,710
2016-04-13T08:27:26.000Z
2020-03-02T12:59:13.000Z
tests/components/daikin/test_temperature_format.py
liangleslie/core
cc807b4d597daaaadc92df4a93c6e30da4f570c6
[ "Apache-2.0" ]
11,956
2016-04-13T18:42:31.000Z
2020-03-02T09:32:12.000Z
"""The tests for the Daikin target temperature conversion.""" from homeassistant.components.daikin.climate import format_target_temperature def test_int_conversion(): """Check no decimal are kept when target temp is an integer.""" formatted = format_target_temperature("16") assert formatted == "16" def test_rounding(): """Check 1 decimal is kept when target temp is a decimal.""" formatted = format_target_temperature("16.1") assert formatted == "16" formatted = format_target_temperature("16.3") assert formatted == "16.5" formatted = format_target_temperature("16.65") assert formatted == "16.5" formatted = format_target_temperature("16.9") assert formatted == "17"
34.428571
77
0.715076
92
723
5.456522
0.402174
0.237052
0.2749
0.318725
0.49004
0.207171
0.207171
0.207171
0.207171
0
0
0.046823
0.172891
723
20
78
36.15
0.792642
0.232365
0
0.307692
0
0
0.061224
0
0
0
0
0
0.384615
1
0.153846
false
0
0.076923
0
0.230769
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
bc10fec4979705791b956a365c246f77396fa5e1
812
py
Python
src/starkware/python/json_rpc/client.py
starkware-libs/starkex-for-spot-trading
4ca03d12fd162b5a782c6d5a8168056158237da6
[ "Apache-2.0" ]
8
2021-09-14T13:54:24.000Z
2022-02-07T02:23:46.000Z
src/starkware/python/json_rpc/client.py
starkware-libs/starkex-for-spot-trading
4ca03d12fd162b5a782c6d5a8168056158237da6
[ "Apache-2.0" ]
null
null
null
src/starkware/python/json_rpc/client.py
starkware-libs/starkex-for-spot-trading
4ca03d12fd162b5a782c6d5a8168056158237da6
[ "Apache-2.0" ]
3
2021-12-10T15:42:19.000Z
2021-12-14T02:05:20.000Z
""" JSON-RPC client implementation. """ import json from typing import Any, Dict class JsonRpcMethod: """ Represents a JSON-RPC method that can be called to generate a JSON-RPC request. """ def __init__(self, name: str): self.name = name def call(self, *args, **kwargs) -> str: """ Returns a JSON-RPC call. """ assert len(args) == 0, 'JSON-RPC call can only contain named arguments.' call_dict: Dict[str, Any] = {'jsonrpc': '2.0', 'method': self.name, 'id': None} if len(kwargs) != 0: call_dict['params'] = kwargs return json.dumps(call_dict) class JsonRpcEncoder: """ Generates JsonRpcMethods. """ def __getattr__(self, name: str) -> JsonRpcMethod: return JsonRpcMethod(name=name)
21.945946
87
0.596059
99
812
4.777778
0.494949
0.073996
0.05074
0
0
0
0
0
0
0
0
0.00678
0.273399
812
36
88
22.555556
0.794915
0.199507
0
0
1
0
0.120543
0
0
0
0
0
0.071429
1
0.214286
false
0
0.142857
0.071429
0.642857
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
70acd5cddc2d2251b897b71d196f433956de1e5a
3,494
py
Python
qm3/actions/ipi.py
SinHouse/qm3
b2436ad813dd13c0c14bdee5d95f30436bc0a04d
[ "MIT" ]
13
2020-12-19T02:37:39.000Z
2022-02-09T11:26:38.000Z
qm3/actions/ipi.py
zhenglz/qm3
356a26baf990391597bd75b971a95952e52fb977
[ "MIT" ]
2
2021-01-07T02:53:27.000Z
2021-07-02T17:58:42.000Z
qm3/actions/ipi.py
zhenglz/qm3
356a26baf990391597bd75b971a95952e52fb977
[ "MIT" ]
3
2020-12-20T11:30:52.000Z
2021-07-12T02:51:44.000Z
# -*- coding: iso-8859-1 -*- from __future__ import print_function, division import sys if( sys.version_info[0] == 2 ): range = range import socket import struct import qm3.constants import qm3.problem class ipi_problem( qm3.problem.template ): def __init__( self ): qm3.problem.template.__init__( self ) self.sckt = None self.bead = None self.stat = b"NEEDINIT " # self.viri = b"".join( [ struct.pack( "d", 0.0 ) for i in range( 9 ) ] ) self.viri = b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" self._ce = 1. / qm3.constants.H2J self._cg = self._ce * qm3.constants.A0 def __recv( self, siz ): out = self.sckt.recv( siz ) rem = siz - len( out ) while( rem > 0 ): out += self.sckt.recv( rem ) rem = siz - len( out ) return( out ) def map_coor( self, coor ): self.coor = coor[:] def map_grad( self ): return( [ - i * self._cg for i in self.grad ] ) def connect( self, info ): # path of the unix socket if( type( info ) == str ): self.sckt = socket.socket( socket.AF_UNIX, socket.SOCK_STREAM ) self.sckt.connect( info ) # ( hostname, port_number = 31415 ) elif( ( type( info ) == tuple or type( info ) == list ) and len( info ) == 2 ): self.sckt = socket.socket( socket.AF_INET, socket.SOCK_STREAM ) self.sckt.connect( ( socket.gethostbyaddr( info[0] )[0], int( info[1] ) ) ) try: while( True ): msg = self.__recv( 12 ) if( msg == b"EXIT " ): return elif( msg == b"STATUS " ): self.sckt.sendall( self.stat ) elif( msg == b"POSDATA " ): rbox = self.__recv( 72 ) ibox = self.__recv( 72 ) size = struct.unpack( "i", self.__recv( 4 ) )[0] * 3 coor = [ i * qm3.constants.A0 for i in struct.unpack( "%dd"%( size ), self.__recv( size * 8 ) ) ] self.map_coor( coor ) self.get_grad() self.stat = b"HAVEDATA " elif( msg == b"GETFORCE " ): self.sckt.sendall( b"FORCEREADY " ) self.sckt.sendall( struct.pack( "d", self.func * self._ce ) ) grad = self.map_grad() size = len( grad ) self.sckt.sendall( struct.pack( "i", size // 3 ) ) self.sckt.sendall( b"".join( [ struct.pack( "d", grad[i] ) for i in range( size ) ] ) ) self.sckt.sendall( self.viri ) self.sckt.sendall( struct.pack( "i", 1 ) ) self.sckt.sendall( b"\x00" ) self.stat = b"READY " elif( msg == b"INIT " ): self.bead = struct.unpack( "i", self.__recv( 4 ) )[0] print( ">> assgined bead: ", self.bead ) self.__recv( struct.unpack( "i", self.__recv( 4 ) )[0] ) self.stat = b"READY " finally: self.sckt.close()
41.105882
311
0.489697
442
3,494
3.762443
0.237557
0.256164
0.378833
0.497895
0.307877
0.273602
0.171377
0.129886
0.129886
0.129886
0
0.087291
0.367201
3,494
84
312
41.595238
0.664858
0.046651
0
0.058824
0
0.014706
0.132291
0.086591
0
0
0
0
0
1
0.073529
false
0
0.088235
0.014706
0.191176
0.029412
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
70b1b75ccf2e49900fb45521b2f48a61d1864816
1,374
py
Python
xrpl/models/transactions/check_create.py
mDuo13/xrpl-py
70f927dcd2dbb8644b3e210b0a8de2a214e71e3d
[ "0BSD" ]
null
null
null
xrpl/models/transactions/check_create.py
mDuo13/xrpl-py
70f927dcd2dbb8644b3e210b0a8de2a214e71e3d
[ "0BSD" ]
null
null
null
xrpl/models/transactions/check_create.py
mDuo13/xrpl-py
70f927dcd2dbb8644b3e210b0a8de2a214e71e3d
[ "0BSD" ]
null
null
null
""" Represents a CheckCreate transaction on the XRP ledger, which creates a Check object. A Check object is a deferred payment that can be cashed by its intended destination. The sender of this transaction is the sender of the Check. `See CheckCreate <https://xrpl.org/checkcreate.html>`_ """ from dataclasses import dataclass, field from typing import Optional from xrpl.models.amounts import Amount from xrpl.models.required import REQUIRED from xrpl.models.transactions.transaction import Transaction, TransactionType from xrpl.models.utils import require_kwargs_on_init @require_kwargs_on_init @dataclass(frozen=True) class CheckCreate(Transaction): """ Represents a CheckCreate transaction on the XRP ledger, which creates a Check object. A Check object is a deferred payment that can be cashed by its intended destination. The sender of this transaction is the sender of the Check. `See CheckCreate <https://xrpl.org/checkcreate.html>`_ """ #: This field is required. destination: str = REQUIRED # type: ignore #: This field is required. send_max: Amount = REQUIRED # type: ignore destination_tag: Optional[int] = None expiration: Optional[int] = None invoice_id: Optional[str] = None transaction_type: TransactionType = field( default=TransactionType.CHECK_CREATE, init=False, )
33.512195
77
0.750364
183
1,374
5.562842
0.355191
0.023576
0.047151
0.064833
0.447937
0.447937
0.447937
0.447937
0.447937
0.447937
0
0
0.181223
1,374
40
78
34.35
0.904889
0.471616
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.722222
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
cb09e7afb8b8b8c6d7cd13f063c2718de106dd64
313
py
Python
TwitMapFeel/__init__.py
Carrie0302/TwitterSentimentAnalysisandMapping
d7bc4418595b75b26a47dae6f93dab0c65038d81
[ "Apache-2.0" ]
2
2017-02-15T17:30:00.000Z
2017-12-28T23:11:06.000Z
TwitMapFeel/__init__.py
Carrie0302/TwitterSentimentMap
d7bc4418595b75b26a47dae6f93dab0c65038d81
[ "Apache-2.0" ]
null
null
null
TwitMapFeel/__init__.py
Carrie0302/TwitterSentimentMap
d7bc4418595b75b26a47dae6f93dab0c65038d81
[ "Apache-2.0" ]
2
2016-11-27T22:08:45.000Z
2018-04-03T08:07:02.000Z
"""Module for capturing tweets, filter out spam, filter by keyword and mapping sentiment by geolocation""" __version__ = "0.0.1" from TwitMapFeel import map_by_neighborhood from TwitMapFeel.parse_json import ExportCleanData from TwitMapFeel import spamfilter_georefrence_topicfilter, twitter_streaming
34.777778
107
0.817891
39
313
6.307692
0.74359
0.182927
0.170732
0
0
0
0
0
0
0
0
0.01107
0.134185
313
8
108
39.125
0.896679
0.319489
0
0
0
0
0.025381
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
cb41a4dfc900cfe1146e6ad1b5ebb279f390645e
69
py
Python
src/brain_atlas/__init__.py
MacoskoLab/brain-atlas
6db385435ea1a6e96fd019963b4f7e23148a7b9a
[ "MIT" ]
2
2022-01-21T19:13:35.000Z
2022-03-24T07:46:57.000Z
src/brain_atlas/__init__.py
MacoskoLab/brain-atlas
6db385435ea1a6e96fd019963b4f7e23148a7b9a
[ "MIT" ]
null
null
null
src/brain_atlas/__init__.py
MacoskoLab/brain-atlas
6db385435ea1a6e96fd019963b4f7e23148a7b9a
[ "MIT" ]
null
null
null
from typing import Tuple Key = Tuple[int, ...] __version__ = "0.2"
11.5
24
0.652174
10
69
4.1
0.9
0
0
0
0
0
0
0
0
0
0
0.035714
0.188406
69
5
25
13.8
0.696429
0
0
0
0
0
0.043478
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
cb44738f603f298a1091cca45d882f232ab73eda
522
py
Python
A U L A - 0 6/ex004.py
DarthVeigan/PythonCursoEmVideo
c619b95563531a969078a5f1e041406355415363
[ "Apache-2.0" ]
null
null
null
A U L A - 0 6/ex004.py
DarthVeigan/PythonCursoEmVideo
c619b95563531a969078a5f1e041406355415363
[ "Apache-2.0" ]
null
null
null
A U L A - 0 6/ex004.py
DarthVeigan/PythonCursoEmVideo
c619b95563531a969078a5f1e041406355415363
[ "Apache-2.0" ]
null
null
null
""" CONHECENDO ALGUMAS FUNÇÕES BOOLEAN """ e = (input('Digite algo: ')) print('O tipo primtivo desse valor é {}'.format(type(e))) print('Só tem espaço?',e.isspace()) print('É um número? ',e.isnumeric()) print('É alfabético? ',e.isalpha()) print('É alfanumérico? ',e.isalnum()) print('Está em maiúsculo? ',e.isupper()) print('Está em minúsculo? ',e.islower()) print('Está capitalizada? ',e.istitle()) n = (input('Digite algo: ')) print(type(n)) b = bool(input('Digite algo: ')) print(b) #Métodos de testes para tipos
21.75
57
0.662835
76
522
4.552632
0.578947
0.095376
0.130058
0.17341
0
0
0
0
0
0
0
0
0.124521
522
24
58
21.75
0.757112
0.12069
0
0
0
0
0.411111
0
0
0
0
0.041667
0
1
0
false
0
0
0
0
0.769231
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
1
0
0
0
0
0
0
0
0
1
0
3
cb4d2176a747563bc3b2edbad61a0129663ce7de
351
py
Python
poc-hello_world_rest/flask/teste.py
Junior743/alquimia
3396d6cb5566518656787bf5ecb098ff19f74c69
[ "Apache-2.0" ]
null
null
null
poc-hello_world_rest/flask/teste.py
Junior743/alquimia
3396d6cb5566518656787bf5ecb098ff19f74c69
[ "Apache-2.0" ]
null
null
null
poc-hello_world_rest/flask/teste.py
Junior743/alquimia
3396d6cb5566518656787bf5ecb098ff19f74c69
[ "Apache-2.0" ]
null
null
null
from flask import Flask, url_for app = Flask(__name__) @app.route('/') def api_root(): return 'Welcome' @app.route('/articles') def api_articles(): return 'List of ' + url_for('api_articles') @app.route('/articles/<articleid>') def api_article(articleid): return 'You are reading ' + articleid if __name__ == '__main__': app.run()
19.5
47
0.675214
47
351
4.659574
0.510638
0.109589
0.146119
0
0
0
0
0
0
0
0
0
0.162393
351
17
48
20.647059
0.744898
0
0
0
0
0
0.233618
0.059829
0
0
0
0
0
1
0.230769
false
0
0.076923
0.230769
0.538462
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
cb964cf2db9e549b738573005742496aeb23640e
1,939
py
Python
ecs_compose/ecr.py
fernandosure/ecs-compose
71b9f5d63b8f523aec350bbe1c8e44739aa66e89
[ "MIT" ]
7
2019-03-21T19:43:41.000Z
2020-03-25T03:42:10.000Z
ecs_compose/ecr.py
fernandosure/ecs-compose
71b9f5d63b8f523aec350bbe1c8e44739aa66e89
[ "MIT" ]
2
2021-03-25T21:49:31.000Z
2021-06-01T22:14:36.000Z
ecs_compose/ecr.py
fernandosure/ecs-compose
71b9f5d63b8f523aec350bbe1c8e44739aa66e89
[ "MIT" ]
null
null
null
import boto3 class EcrClient(object): def __init__(self): self._client = boto3.client('ecr') def _list_repositories(self, repositories): rs = self._client.describe_repositories(repositoryNames=repositories) ls = [EcrRepository(item) for item in rs[u'repositories']] while rs.get(u'nextToken'): rs = self._client.describe_repositories(nextToken=rs.get(u'nextToken')) ls.extend([EcrRepository(item) for item in rs[u'repositories']]) return ls def get_all_repositories(self): return self._list_repositories() def get_single_repository(self, repository_arn): ls = self._list_repositories([repository_arn]) return ls[0] if len(ls) > 0 else None class EcrRepository(dict): def __init__(self, *args, **kwargs): super(EcrRepository, self).__init__(*args, **kwargs) self._client = boto3.client('ecr') @property def arn(self): return self.get(u'repositoryArn') @property def id(self): return self.get(u'registryId') @property def name(self): return self.get(u'repositoryName') @property def created_at(self): return self.get(u'createdAt') @property def images(self): rs = self._client.describe_images(repositoryName=self.name) ls = [EcrImage(item) for item in rs[u'imageDetails']] while rs.get(u'nextToken') is not None: rs = self._client.describe_images(nextToken=rs.get(u'nextToken')) ls.extend([EcrImage(item) for item in rs[u'imageDetails']]) return ls class EcrImage(dict): def __init__(self, *args, **kwargs): super(EcrImage, self).__init__(*args, **kwargs) self._client = boto3.client('ecr') @property def tags(self): return self.get(u'imageTags') @property def pushed_at(self): return self.get(u'imagePushedAt')
26.930556
83
0.637958
237
1,939
5.029536
0.240506
0.033557
0.082215
0.08557
0.567114
0.355705
0.322148
0.218121
0.088926
0.088926
0
0.004065
0.238783
1,939
71
84
27.309859
0.803523
0
0
0.28
0
0
0.083032
0
0
0
0
0
0
1
0.26
false
0
0.02
0.14
0.54
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
cbbf3457af8f82d9ad769c138cf3ab43bffe8df9
2,572
py
Python
usf_dime_novels/scraper/base/base_scrapers.py
thePortus/usf-dime-novels
04b21e758a29c405af54782c8b8c2c5ef397270f
[ "MIT" ]
1
2018-08-11T03:30:10.000Z
2018-08-11T03:30:10.000Z
usf_dime_novels/scraper/base/base_scrapers.py
thePortus/usf-dime-novels
04b21e758a29c405af54782c8b8c2c5ef397270f
[ "MIT" ]
4
2017-06-26T16:19:22.000Z
2021-06-01T22:17:21.000Z
usf_dime_novels/scraper/base/base_scrapers.py
thePortus/usf-dime-novels
04b21e758a29c405af54782c8b8c2c5ef397270f
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """scraper/base_scrapers.py By David J. Thomas, thePortus.com, dave.a.base@gmail.com Contains all the base scrapers to be inherited by custom scraper classes. HTML, XML, KML, JSON, and PDF scrapers all come in two flavors, a 'web' base, for making remote requests to obtain data, and a 'file' base, for scraping files on the local system. The Selenium scraper does not have a 'file' base, as it is used solely for controlling a web browser. Base scrapers are created by comining abstract base scrapers and a variety of mixin classes.""" from .abstract_mixins import ( AbstractBaseScraper, TextWebMixin, TextFileMixin, BinaryWebMixin, BinaryFileMixin, SoupMixin, JSONMixin, PDFMixin, SeleniumMixin ) class BaseHTMLWebScraper( AbstractBaseScraper, TextWebMixin, SoupMixin ): """Base class for any custom HTML scrapers making web requests.""" pass class BaseHTMLFileScraper( AbstractBaseScraper, TextFileMixin, SoupMixin ): """Base class for any custom HTML scrapers for local files.""" pass class BaseXMLWebScraper( AbstractBaseScraper, TextWebMixin, SoupMixin ): """Base class for any custom XML scrapers making web requests.""" pass class BaseXMLFileScraper( AbstractBaseScraper, TextFileMixin, SoupMixin ): """Base class for any custom XML scrapers for local files.""" pass class BaseKMLWebScraper( AbstractBaseScraper, TextWebMixin, SoupMixin ): """Base class for any custom KML scrapers making web requests.""" pass class BaseKMLFileScraper( AbstractBaseScraper, TextFileMixin, SoupMixin ): """Base class for any custom KML scrapers for local files.""" pass class BaseJSONWebScraper( AbstractBaseScraper, TextWebMixin, JSONMixin ): """Base class for any custom JSON scrapers making web requests.""" pass class BaseJSONFileScraper( AbstractBaseScraper, TextFileMixin, JSONMixin ): """Base class for any custom JSON scrapers for local files.""" pass class BasePDFWebScraper( AbstractBaseScraper, BinaryWebMixin, PDFMixin ): """Base class for any custom PDF scrapers making web requests.""" pass class BasePDFFileScraper( AbstractBaseScraper, BinaryFileMixin, PDFMixin ): """Base class for any custom PDF scrapers for local files.""" pass class BaseSeleniumScraper( AbstractBaseScraper, SoupMixin, SeleniumMixin ): """Base class for any scrapers using Selenium""" pass
21.256198
77
0.706843
283
2,572
6.416961
0.325088
0.054515
0.072687
0.090859
0.463106
0.463106
0.330947
0.330947
0
0
0
0.000499
0.22084
2,572
120
78
21.433333
0.905689
0.459176
0
0.805195
0
0
0
0
0
0
0
0
0
1
0
true
0.142857
0.012987
0
0.155844
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
3
1def5c037eb80bdcfd3a4ad01b0d07716706ac00
1,349
py
Python
SQL and Databases Intermediate/Using PostgreSQL-189.py
vipmunot/Data-Analysis-using-Python
34586d8cbbc336508c4a7a68abe14944f1096252
[ "MIT" ]
null
null
null
SQL and Databases Intermediate/Using PostgreSQL-189.py
vipmunot/Data-Analysis-using-Python
34586d8cbbc336508c4a7a68abe14944f1096252
[ "MIT" ]
null
null
null
SQL and Databases Intermediate/Using PostgreSQL-189.py
vipmunot/Data-Analysis-using-Python
34586d8cbbc336508c4a7a68abe14944f1096252
[ "MIT" ]
null
null
null
## 3. Psycopg2 ## import psycopg2 conn = psycopg2.connect("dbname=dq user=dq") cur = conn.cursor() print(cur) conn.close() ## 4. Creating a table ## conn = psycopg2.connect("dbname=dq user=dq") cur = conn.cursor() cur.execute("CREATE TABLE notes(id integer PRIMARY KEY, body text, title text)") conn.close() ## 5. SQL Transactions ## conn = psycopg2.connect("dbname=dq user=dq") cur = conn.cursor() cur.execute("CREATE TABLE notes(id integer PRIMARY KEY, body text, title text)") conn.commit() conn.close() ## 6. Autocommitting ## conn = psycopg2.connect("dbname=dq user=dq") conn.autocommit = True cur = conn.cursor() cur.execute("CREATE TABLE facts(id integer PRIMARY KEY, country text, value text)") conn.close() ## 7. Executing queries ## conn = psycopg2.connect("dbname=dq user=dq") cur = conn.cursor() cur.execute("INSERT INTO notes VALUES (1, 'Do more missions on Dataquest.', 'Dataquest reminder');") cur.execute("SELECT * from notes;") rows = cur.fetchall() print(rows) conn.close() ## 8. Creating a database ## conn = psycopg2.connect("dbname=dq user=dq") conn.autocommit = True cur = conn.cursor() cur.execute("CREATE DATABASE income OWNER dq;") conn.close() ## 9. Deleting a database ## conn = psycopg2.connect("dbname=dq user=dq") conn.autocommit = True cur = conn.cursor() cur.execute("DROP DATABASE income;") conn.close()
24.089286
100
0.708673
196
1,349
4.877551
0.311224
0.058577
0.139121
0.183054
0.609833
0.609833
0.609833
0.604603
0.604603
0.604603
0
0.01448
0.129726
1,349
56
101
24.089286
0.79983
0.105263
0
0.722222
0
0
0.403226
0
0
0
0
0
0
1
0
false
0
0.027778
0
0.027778
0.055556
0
0
0
null
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
1df63a14f6d108a772062bc9b16b225c4d553d47
280
py
Python
frozen_dir.py
hxhcreate/numerical-analysis-work
ea6712731cd899d8dc010716dd4d4a5f4f0a95d8
[ "MulanPSL-1.0" ]
null
null
null
frozen_dir.py
hxhcreate/numerical-analysis-work
ea6712731cd899d8dc010716dd4d4a5f4f0a95d8
[ "MulanPSL-1.0" ]
null
null
null
frozen_dir.py
hxhcreate/numerical-analysis-work
ea6712731cd899d8dc010716dd4d4a5f4f0a95d8
[ "MulanPSL-1.0" ]
null
null
null
import sys import os def app_path(): """Returns the base application path.""" if hasattr(sys, 'frozen'): # Handles PyInstaller return os.path.dirname(sys.executable) return os.path.dirname(__file__) if __name__ == '__main__': print(app_path())
18.666667
46
0.653571
35
280
4.828571
0.628571
0.08284
0.142012
0.224852
0
0
0
0
0
0
0
0
0.221429
280
14
47
20
0.775229
0.196429
0
0
0
0
0.063927
0
0
0
0
0
0
1
0.125
true
0
0.25
0
0.625
0.125
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
3
38035a01385be312f931978309679e6fce5cd845
443
py
Python
tracker/conf/conf.py
saberzuko/GolfBallTracking
1e9fe5d685b7d4b7b3f30d550018c42b878ee572
[ "MIT" ]
null
null
null
tracker/conf/conf.py
saberzuko/GolfBallTracking
1e9fe5d685b7d4b7b3f30d550018c42b878ee572
[ "MIT" ]
null
null
null
tracker/conf/conf.py
saberzuko/GolfBallTracking
1e9fe5d685b7d4b7b3f30d550018c42b878ee572
[ "MIT" ]
null
null
null
# import the necessary packages from json_minify import json_minify import json class Conf: def __init__(self, confPath): # load and the sotre the configuration and update the object's dictionary conf = json.loads(json_minify(open(confPath).read())) self.__dict__.update(conf) def __getitem__(self, k): # return the value associated with the supplied key return self.__dict__.get(k, None)
31.642857
81
0.697517
60
443
4.833333
0.583333
0.103448
0.110345
0.137931
0
0
0
0
0
0
0
0
0.227991
443
14
82
31.642857
0.847953
0.340858
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0.125
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
381dec3ac7d8be5a1241d06da9ff0ebf2f439dd2
3,469
py
Python
tests/benchmarks/micro_benchmarks/test_computation_communication_overlap.py
QPC-database/superbenchmark
43620c3f46701d11514901e5c238d7a571ab3ea9
[ "MIT" ]
1
2021-07-06T01:41:15.000Z
2021-07-06T01:41:15.000Z
tests/benchmarks/micro_benchmarks/test_computation_communication_overlap.py
QPC-database/superbenchmark
43620c3f46701d11514901e5c238d7a571ab3ea9
[ "MIT" ]
null
null
null
tests/benchmarks/micro_benchmarks/test_computation_communication_overlap.py
QPC-database/superbenchmark
43620c3f46701d11514901e5c238d7a571ab3ea9
[ "MIT" ]
null
null
null
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """Tests for Computation-Communication-Overlap benchmark.""" import unittest from tests.helper import decorator import tests.benchmarks.utils as utils from superbench.benchmarks import BenchmarkRegistry, Framework, BenchmarkType, ReturnCode from superbench.benchmarks.micro_benchmarks.computation_communication_overlap \ import ComputationCommunicationOverlap, ComputationKernelType # TODO - replace unittest.skip("no multiple GPUs") to decorator of skipIfNoMultiGPUS @unittest.skip('no multiple GPUs') @decorator.cuda_test @decorator.pytorch_test def test_pytorch_computation_communication_overlap_normal(): """Test pytorch-computation-communication-overlap benchmark on distributed normal case.""" context = BenchmarkRegistry.create_benchmark_context( 'computation-communication-overlap', parameters='--num_warmup 5 --num_steps 10 --ratio 5', framework=Framework.PYTORCH ) world_size = 2 assert (BenchmarkRegistry.is_benchmark_context_valid(context)) results = utils.simulated_ddp_distributed_benchmark(context, world_size) for benchmark in results: # Check basic information. assert (benchmark) assert (isinstance(benchmark, ComputationCommunicationOverlap)) assert (benchmark.name == 'pytorch-computation-communication-overlap') assert (benchmark.type == BenchmarkType.MICRO) # Check predefined parameters of sharding-matmul benchmark. assert (benchmark._args.kernel == [ComputationKernelType.MUL, ComputationKernelType.MATMUL]) # Check parameters specified in BenchmarkContext. assert (benchmark._args.num_steps == 10) # Check results and metrics. assert (benchmark.run_count == 1) assert (benchmark.return_code == ReturnCode.SUCCESS) assert (len(benchmark.raw_data) == benchmark.run_count * len(benchmark._args.kernel)) assert (len(benchmark.result) == benchmark.run_count * len(benchmark._args.kernel)) @decorator.cuda_test @decorator.pytorch_test def test_pytorch_computation_communication_overlap_fake_distributed(): """Test pytorch-computation-communication-overlap benchmark on single gpu.""" context = BenchmarkRegistry.create_benchmark_context( 'computation-communication-overlap', parameters='--num_warmup 5 --num_steps 10 --ratio 5', framework=Framework.PYTORCH ) utils.setup_simulated_ddp_distributed_env(1, 0, utils.get_free_port()) benchmark = BenchmarkRegistry.launch_benchmark(context) # Check basic information. assert (benchmark) assert (isinstance(benchmark, ComputationCommunicationOverlap)) assert (benchmark.name == 'pytorch-computation-communication-overlap') assert (benchmark.type == BenchmarkType.MICRO) # Check predefined parameters of sharding-matmul benchmark. assert (benchmark._args.kernel == [ComputationKernelType.MUL, ComputationKernelType.MATMUL]) # Check parameters specified in BenchmarkContext. assert (benchmark._args.num_steps == 10) # Check results and metrics. assert (benchmark.run_count == 1) assert (benchmark.return_code == ReturnCode.SUCCESS) assert (len(benchmark.raw_data) == benchmark.run_count * len(benchmark._args.kernel)) assert (len(benchmark.result) == benchmark.run_count * len(benchmark._args.kernel)) utils.clean_simulated_ddp_distributed_env()
42.82716
100
0.755549
365
3,469
7.00274
0.284932
0.08216
0.121283
0.089202
0.701878
0.681534
0.681534
0.640063
0.640063
0.640063
0
0.00579
0.153647
3,469
80
101
43.3625
0.864782
0.196022
0
0.64
0
0
0.087586
0.053565
0
0
0
0.0125
0.42
1
0.04
false
0
0.1
0
0.14
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
1
0
0
0
0
0
0
0
0
0
3
382ad859413058d85354e2455ab05fc7ed453a78
166
py
Python
src/run.py
thealphadollar/Key-Value-DB-Py-PG
1e98d37c1e9018b5fa81ff105b5a15b0c7cdb0ec
[ "MIT" ]
null
null
null
src/run.py
thealphadollar/Key-Value-DB-Py-PG
1e98d37c1e9018b5fa81ff105b5a15b0c7cdb0ec
[ "MIT" ]
null
null
null
src/run.py
thealphadollar/Key-Value-DB-Py-PG
1e98d37c1e9018b5fa81ff105b5a15b0c7cdb0ec
[ "MIT" ]
null
null
null
import bitcask if __name__=="__main__": storage = bitcask.BitCask("./bitcask_storage") storage.put("shivam2", "kumar2 jha") print(storage.get("shivam2"))
27.666667
50
0.692771
19
166
5.578947
0.631579
0.264151
0
0
0
0
0
0
0
0
0
0.020979
0.138554
166
6
51
27.666667
0.72028
0
0
0
0
0
0.293413
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0.2
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
38476eb7a96a95db3013a4cf28ef9c8b1792c0c4
1,766
py
Python
2-resources/_External-learning-resources/02-pyth/python-patterns-master/tests/creational/test_pool.py
eengineergz/Lambda
1fe511f7ef550aed998b75c18a432abf6ab41c5f
[ "MIT" ]
null
null
null
2-resources/_External-learning-resources/02-pyth/python-patterns-master/tests/creational/test_pool.py
eengineergz/Lambda
1fe511f7ef550aed998b75c18a432abf6ab41c5f
[ "MIT" ]
null
null
null
2-resources/_External-learning-resources/02-pyth/python-patterns-master/tests/creational/test_pool.py
eengineergz/Lambda
1fe511f7ef550aed998b75c18a432abf6ab41c5f
[ "MIT" ]
1
2021-11-05T07:48:26.000Z
2021-11-05T07:48:26.000Z
import queue import unittest from patterns.creational.pool import ObjectPool class TestPool(unittest.TestCase): def setUp(self): self.sample_queue = queue.Queue() self.sample_queue.put("first") self.sample_queue.put("second") def test_items_recoil(self): with ObjectPool(self.sample_queue, True) as pool: self.assertEqual(pool, "first") self.assertTrue(self.sample_queue.get() == "second") self.assertFalse(self.sample_queue.empty()) self.assertTrue(self.sample_queue.get() == "first") self.assertTrue(self.sample_queue.empty()) def test_frozen_pool(self): with ObjectPool(self.sample_queue) as pool: self.assertEqual(pool, "first") self.assertEqual(pool, "first") self.assertTrue(self.sample_queue.get() == "second") self.assertFalse(self.sample_queue.empty()) self.assertTrue(self.sample_queue.get() == "first") self.assertTrue(self.sample_queue.empty()) class TestNaitivePool(unittest.TestCase): """def test_object(queue): queue_object = QueueObject(queue, True) print('Inside func: {}'.format(queue_object.object))""" def test_pool_behavior_with_single_object_inside(self): sample_queue = queue.Queue() sample_queue.put("yam") with ObjectPool(sample_queue) as obj: # print('Inside with: {}'.format(obj)) self.assertEqual(obj, "yam") self.assertFalse(sample_queue.empty()) self.assertTrue(sample_queue.get() == "yam") self.assertTrue(sample_queue.empty()) # sample_queue.put('sam') # test_object(sample_queue) # print('Outside func: {}'.format(sample_queue.get())) # if not sample_queue.empty():
33.961538
60
0.657984
209
1,766
5.382775
0.215311
0.224889
0.186667
0.128
0.460444
0.389333
0.330667
0.298667
0.298667
0.298667
0
0
0.205549
1,766
51
61
34.627451
0.801853
0.161948
0
0.34375
0
0
0.038988
0
0
0
0
0
0.46875
1
0.125
false
0
0.09375
0
0.28125
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
1
0
0
0
0
0
0
0
0
0
3
69894fcced10ae7331e777e20b8a0ebc9bfa2c95
377
py
Python
src/pytorch_metric_learning/losses/weight_regularizer_mixin.py
Hummer12007/pytorch-metric-learning
93e6421addc822d7565c64d7ff166d46be757acd
[ "MIT" ]
2
2020-02-22T10:46:33.000Z
2020-09-30T00:25:29.000Z
src/pytorch_metric_learning/losses/weight_regularizer_mixin.py
Hummer12007/pytorch-metric-learning
93e6421addc822d7565c64d7ff166d46be757acd
[ "MIT" ]
null
null
null
src/pytorch_metric_learning/losses/weight_regularizer_mixin.py
Hummer12007/pytorch-metric-learning
93e6421addc822d7565c64d7ff166d46be757acd
[ "MIT" ]
2
2020-02-22T10:46:35.000Z
2020-11-06T00:51:42.000Z
class WeightRegularizerMixin: def __init__(self, regularizer=None, reg_weight=1, **kwargs): super().__init__(**kwargs) self.regularizer = regularizer self.reg_weight = reg_weight def regularization_loss(self, weights): if self.regularizer is None: return 0 return self.regularizer(weights) * self.reg_weight
37.7
66
0.657825
41
377
5.731707
0.463415
0.255319
0.110638
0
0
0
0
0
0
0
0
0.007117
0.254642
377
10
67
37.7
0.829181
0
0
0
0
0
0
0
0
0
0
0
0
1
0.222222
false
0
0
0
0.555556
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
69a50975a1167f6b5858aa46856f1ec463c4bd54
662
py
Python
cloudsync/master/rest/__init__.py
mickare/sync-e2e-cloud-demo
f96b8506d6752bf3d4ca05414d9ef9702470d88f
[ "Apache-2.0" ]
1
2019-03-27T12:58:43.000Z
2019-03-27T12:58:43.000Z
cloudsync/master/rest/__init__.py
mickare/sync-e2e-cloud-demo
f96b8506d6752bf3d4ca05414d9ef9702470d88f
[ "Apache-2.0" ]
null
null
null
cloudsync/master/rest/__init__.py
mickare/sync-e2e-cloud-demo
f96b8506d6752bf3d4ca05414d9ef9702470d88f
[ "Apache-2.0" ]
null
null
null
from uuid import UUID from quart import Blueprint storage = Blueprint('storage', __name__) @storage.route('/storage', methods=['GET']) async def list_storages(): pass @storage.route('/storage/<uuid:storage_slug>', methods=['GET']) async def get_storage(storage_slug: UUID): pass @storage.route('/storage/<uuid:storage_slug>', methods=['PATCH']) async def update_storage(storage_slug: UUID): pass @storage.route('/storage/<uuid:storage_slug>', methods=['PUT']) async def create_storage(storage_slug: UUID): pass @storage.route('/storage/<uuid:storage_slug>', methods=['DELETE']) async def delete_storage(storage_slug: UUID): pass
20.6875
66
0.720544
86
662
5.348837
0.244186
0.191304
0.206522
0.2
0.591304
0.534783
0.534783
0.534783
0.436957
0.436957
0
0
0.119335
662
31
67
21.354839
0.789022
0
0
0.277778
0
0
0.22239
0.16944
0
0
0
0
0
1
0
false
0.277778
0.111111
0
0.111111
0.111111
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
69a6f7a4abae95e41af8195c28a6b50be0d436bb
189
py
Python
examples/framebuf_rects.py
mcauser/micropython-ssd1327
cef3dd7ad7c5f3cf13d4b1a37824396e513c63d5
[ "MIT" ]
19
2018-06-12T08:58:58.000Z
2022-02-01T13:34:56.000Z
examples/framebuf_rects.py
mcauser/micropython-ssd1327
cef3dd7ad7c5f3cf13d4b1a37824396e513c63d5
[ "MIT" ]
4
2018-12-01T06:35:11.000Z
2021-09-11T16:10:26.000Z
examples/framebuf_rects.py
mcauser/micropython-ssd1327
cef3dd7ad7c5f3cf13d4b1a37824396e513c63d5
[ "MIT" ]
7
2018-09-23T00:14:00.000Z
2021-03-18T17:52:29.000Z
# rects using framebuf display.fill(0) for i in range(0, 15): j = 6 * i display.framebuf.fill_rect(j, j, 12, 12, i) display.framebuf.rect(90 - (j), j, 12, 12, i) display.show()
23.625
49
0.619048
35
189
3.314286
0.485714
0.206897
0.275862
0.103448
0.241379
0.241379
0
0
0
0
0
0.100671
0.21164
189
7
50
27
0.677852
0.10582
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
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
0
0
0
0
0
0
3
69a951a35d99dd5241ead5c311bfdd49b6dbd5f6
165
py
Python
goodtechgigs/gigs/urls.py
aschn/goodtechgigs
f2f74e28a5a21e826ded0f09a6029fe6a24d228b
[ "Apache-2.0" ]
null
null
null
goodtechgigs/gigs/urls.py
aschn/goodtechgigs
f2f74e28a5a21e826ded0f09a6029fe6a24d228b
[ "Apache-2.0" ]
null
null
null
goodtechgigs/gigs/urls.py
aschn/goodtechgigs
f2f74e28a5a21e826ded0f09a6029fe6a24d228b
[ "Apache-2.0" ]
null
null
null
from rest_framework import routers from gigs.views import GigViewSet router = routers.DefaultRouter() router.register(r'^', GigViewSet) urlpatterns = router.urls
18.333333
34
0.8
20
165
6.55
0.7
0
0
0
0
0
0
0
0
0
0
0
0.115152
165
8
35
20.625
0.89726
0
0
0
0
0
0.006061
0
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
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3