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
a15901021bef63519868ece29c7bae6a1baf0f1a
143
py
Python
app/models/__init__.py
lik33v3n/Tower-of-God
1e6c86939f053739f9e73d56fd1c04d7fb444e8b
[ "MIT" ]
3
2020-06-28T18:04:12.000Z
2022-02-15T19:46:47.000Z
app/models/__init__.py
lik33v3n/Tower-of-God
1e6c86939f053739f9e73d56fd1c04d7fb444e8b
[ "MIT" ]
null
null
null
app/models/__init__.py
lik33v3n/Tower-of-God
1e6c86939f053739f9e73d56fd1c04d7fb444e8b
[ "MIT" ]
null
null
null
from .examinators import exams from .enemies import Enemy from .abilities import AbilityMethods __all__ = ('exams', 'Enemy', 'AbilityMethods')
28.6
46
0.783217
16
143
6.75
0.5625
0
0
0
0
0
0
0
0
0
0
0
0.118881
143
5
46
28.6
0.857143
0
0
0
0
0
0.166667
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
a178ee72b1a30262485042f4a9a8f4032058775a
8,340
py
Python
test/schema_eetf.py
StefanBruens/pybeam
5b7e79e2cc48265c71cb77e3ec0eae97676509fa
[ "MIT" ]
15
2015-03-22T05:27:04.000Z
2020-05-10T23:17:50.000Z
test/schema_eetf.py
StefanBruens/pybeam
5b7e79e2cc48265c71cb77e3ec0eae97676509fa
[ "MIT" ]
9
2018-03-16T15:20:37.000Z
2020-11-06T14:05:55.000Z
test/schema_eetf.py
StefanBruens/pybeam
5b7e79e2cc48265c71cb77e3ec0eae97676509fa
[ "MIT" ]
8
2015-03-03T16:34:46.000Z
2022-02-26T03:53:13.000Z
# Copyright (c) 2013 Matwey V. Kornilov <matwey.kornilov@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. # import pybeam.schema.eetf as eetf from pybeam import erlang_types from six import int2byte import unittest class EETFConstructTest(unittest.TestCase): def setUp(self): pass def test_atom_cache_ref(self): c = eetf.atom_cache_ref self.assertEqual(c.parse(b'\x23'), erlang_types.AtomCacheReference(0x23)) self.assertEqual(c.parse(c.build(erlang_types.AtomCacheReference(0x23))),erlang_types.AtomCacheReference(0x23)) def test_small_integer(self): c = eetf.small_integer self.assertEqual(c.parse(b'\x23'), 0x23) self.assertEqual(c.parse(c.build(123)),123) def test_integer(self): c = eetf.integer self.assertEqual(c.parse(b'\00\xff\00\x11'), 0xff0011) self.assertEqual(c.parse(b'\xff\xff\xff\xff'), -1) self.assertEqual(c.parse(c.build(0xff0011)),0xff0011) def test_float(self): c = eetf.float_ self.assertEqual(c.parse(b' 1.12344300000000002910e+04'), 11234.43) self.assertEqual(c.parse(b'1.00000000000000000000e+00\00\00\00\00\00'), 1.0) self.assertEqual(c.parse(c.build(-3.1415926)),-3.1415926) def test_new_float(self): c = eetf.new_float self.assertEqual(c.parse(b'\x40\x00\x00\x00\x00\x00\x00\x00'), 2.0 ) self.assertEqual(c.parse(b'\xc0\x00\x00\x00\x00\x00\x00\x00'), -2.0 ) self.assertEqual(c.parse(c.build(-3.1415926)),-3.1415926) def test_atom_utf8(self): c = eetf.atom_utf8 self.assertEqual(c.parse(b'\x00\x08\xd0\xb0\xd1\x82\xd0\xbe\xd0\xbc'), u"\u0430\u0442\u043e\u043c") self.assertEqual(c.parse(c.build(u"\u0430\u0442\u043e\u043c")),u"\u0430\u0442\u043e\u043c") def test_small_atom_utf8(self): c = eetf.small_atom_utf8 self.assertEqual(c.parse(b'\x08\xd0\xb0\xd1\x82\xd0\xbe\xd0\xbc'), u"\u0430\u0442\u043e\u043c") self.assertEqual(c.parse(c.build(u"\u0430\u0442\u043e\u043c")),u"\u0430\u0442\u043e\u043c") def test_atom1(self): c = eetf.atom self.assertEqual(c.parse(b'\x00\x06myatom'), u"myatom") self.assertEqual(c.parse(c.build(u"robots")),u"robots") def test_atom2(self): raw = b'\x00\x06r\xf2b\xf3ts' c = eetf.atom self.assertEqual(c.parse(raw), u"r\u00f2b\u00f3ts") def test_small_atom1(self): c = eetf.small_atom self.assertEqual(c.parse(b'\x06myatom'), u"myatom") self.assertEqual(c.parse(c.build(u"robots")),u"robots") def test_small_atom2(self): raw = b'\x06r\xf2b\xf3ts' c = eetf.small_atom self.assertEqual(c.parse(raw), u"r\u00f2b\u00f3ts") def test_reference(self): c = eetf.reference r = erlang_types.Reference(u"myatom",0x12,0x48) self.assertEqual(c.parse(b'\x64\x00\x06myatom\x00\x00\x00\x12\x48'), r) self.assertEqual(c.parse(c.build(r)),r) self.assertEqual(c.build(r),b'\x76\x00\x06myatom\x00\x00\x00\x12\x48') def test_new_reference(self): c = eetf.new_reference r = erlang_types.Reference(u"myatom",[0x12,0x13],0x48) self.assertEqual(c.parse(b'\x00\x02\x76\x00\x06myatom\x48\x00\x00\x00\x12\x00\x00\x00\x13'), r) self.assertEqual(c.parse(c.build(r)),r) def test_port(self): c = eetf.port self.assertEqual(c.parse(b'\x64\x00\x06myatom\x00\x00\x00\x12\x48'), erlang_types.Port("myatom",0x12,0x48)) def test_pid(self): c = eetf.pid self.assertEqual(c.parse(b'\x64\x00\x06myatom\x00\x00\x00\x12\x00\x00\x00\x32\x48'), erlang_types.Pid("myatom",0x12,0x32,0x48)) def test_small_tuple(self): c = eetf.small_tuple self.assertEqual(c.parse(b"\x02\x64\x00\x06myatom\x64\x00\x06robert"), ("myatom","robert")) self.assertEqual(c.parse(c.build((1,2,u"myatom"))),(1,2,u"myatom")) def test_large_tuple(self): c = eetf.large_tuple self.assertEqual(c.parse(b"\x00\x00\x00\x02\x64\x00\x06myatom\x64\x00\x06robert"), ("myatom","robert")) self.assertEqual(c.parse(c.build((1,2,u"myatom"))),(1,2,u"myatom")) def test_list(self): c = eetf.list_ self.assertEqual(c.parse(b'\x00\x00\x00\x02\x64\x00\x08YegorSaf\x64\x00\x0aRoBurToVoY\x6a'), ["YegorSaf","RoBurToVoY"]) self.assertEqual(c.parse(c.build([1,2,3,u"OO"])),[1,2,3,u"OO"]) self.assertEqual(c.parse(c.build([u"Nu",u"poskoku"])),[u"Nu",u"poskoku"]) attrs0 = b'\x00\x00\x00\x02h\x02d\x00\x03vsnl\x00\x00\x00\x01n\x10\x00\xb3\xf2\xab&|\xd3\xdeHL\xa0\x0fV\xdf\xc1\x05\x96jh\x02d\x00\tbehaviourl\x00\x00\x00\x01d\x00\ngen_serverjj' self.assertEqual(c.parse(attrs0), [("vsn", [199414093051598402244823387542347575987]), ("behaviour", ["gen_server"])]) t1 = b'\x00\x00\x00\x01d\x00\x05alignm\x00\x00\x00\x02\x01\x00' self.assertEqual(c.parse(t1), ["align", erlang_types.Binary(b'\x01\x00')]) def test_nil(self): c = eetf.nil self.assertEqual(c.parse(b'\x6a'), []) self.assertEqual(c.parse(c.build([])),[]) def test_bitbinary(self): c = eetf.bit_binary self.assertEqual(c.parse(b'\00\00\00\x0a\x03RoBurToVoY'), erlang_types.BitBinary(b'RoBurToVoY',3)) s = erlang_types.BitBinary(b'RoBurToVoY',1) self.assertEqual(c.parse(c.build(s)),s) def test_string(self): c = eetf.string self.assertEqual(c.parse(b'\x00\x0aRoBurToVoY'), erlang_types.String(b'RoBurToVoY')) s = erlang_types.String(b'RoBurToVoY') self.assertEqual(c.parse(c.build(s)),s) n = b"\x01\x00" + b"".join(map(int2byte, range(0,256))) self.assertListEqual(list(c.parse(n)), list(range(0,256))) self.assertEqual(c.build(erlang_types.String(b"".join(map(int2byte, range(0,256))))), n) def test_binary(self): c = eetf.binary self.assertEqual(c.parse(b'\x00\x00\x00\x0aRoBurToVoY'), erlang_types.Binary(b'RoBurToVoY')) s = erlang_types.Binary(b'RoBurToVoY') self.assertEqual(c.parse(c.build(s)),s) def test_small_big(self): c = eetf.small_big self.assertEqual(c.parse(b'\x02\x00\x02\x01'), 258) self.assertEqual(c.parse(b'\x02\x01\x02\x01'), -258) self.assertEqual(c.parse(c.build(123456789123456789)),123456789123456789) def test_large_big(self): c = eetf.large_big self.assertEqual(c.parse(b'\x00\x00\x00\x02\x00\x02\x01'), 258) self.assertEqual(c.parse(c.build(123456789123456789)),123456789123456789) def test_fun(self): c = eetf.fun self.assertEqual(c.parse(b'\00\00\00\x02\x64\x00\x06myatom\x64\x00\x06myatom\x61\x13\x64\x00\x06myatom\x64\x00\x06myatom\x64\x00\x06myatom'), erlang_types.Fun(None,None,None,"myatom",0x13,"myatom","myatom",["myatom","myatom"])) def test_export(self): c = eetf.export mfa = erlang_types.MFA(u"myatom",u"myat0m",0x13) self.assertEqual(c.parse(b'\x64\x00\x06myatom\x64\x00\x06myat0m\x61\x13'),mfa) self.assertEqual(c.parse(c.build(mfa)),mfa) def test_term(self): c = eetf.term self.assertEqual(c.parse(b'\x6f\x00\x00\x00\x02\x00\x02\x01'), 258) self.assertEqual(c.parse(c.build(258)), 258) self.assertEqual(c.parse(c.build([3,2,1])), [3,2,1]) self.assertEqual(c.build(u"BurToVoY"), b'\x76\x00\x08BurToVoY') def test_external(self): c = eetf.external_term self.assertEqual(c.parse(b'\x83\x6f\x00\x00\x00\x02\x00\x02\x01'), 258) self.assertEqual(c.parse(c.build(258)), 258) self.assertEqual(c.parse(c.build([3,2,1])), [3,2,1]) self.assertEqual(c.build(u"BurToVoY"), b'\x83\x76\x00\x08BurToVoY') def test_key_value(self): c = eetf.key_value self.assertEqual(c.parse(b'a\x01a\x02'), (1,2)) self.assertEqual(c.parse(c.build((1,2))), (1,2)) def test_map(self): c = eetf.map_ self.assertEqual(c.parse(b'\x00\x00\x00\x02a\x01a\x02a\x03a\x04'), {1:2,3:4}) self.assertEqual(c.parse(c.build({1:2,3:4})), {1:2,3:4})
49.058824
229
0.72446
1,414
8,340
4.212871
0.188119
0.171227
0.182642
0.225617
0.556488
0.489844
0.407252
0.351687
0.29948
0.269599
0
0.128371
0.093046
8,340
169
230
49.349112
0.659175
0.130336
0
0.170068
0
0.040816
0.255531
0.182522
0
0
0.012168
0
0.469388
1
0.210884
false
0.006803
0.027211
0
0.244898
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
1
0
0
0
0
0
0
0
4
a185331b846166fe755f1e7b81e19608430fde4a
15,948
py
Python
tests/backend/test_register.py
andjoe-axis/etos-environment-provider
e95f3e67a22ee08382265ea55070f9cd98b544e4
[ "Apache-2.0" ]
null
null
null
tests/backend/test_register.py
andjoe-axis/etos-environment-provider
e95f3e67a22ee08382265ea55070f9cd98b544e4
[ "Apache-2.0" ]
null
null
null
tests/backend/test_register.py
andjoe-axis/etos-environment-provider
e95f3e67a22ee08382265ea55070f9cd98b544e4
[ "Apache-2.0" ]
null
null
null
# Copyright 2021 Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Tests for the register backend system.""" import logging import unittest import json from etos_lib import ETOS from jsontas.jsontas import JsonTas from environment_provider.lib.registry import ProviderRegistry from environment_provider.backend.register import ( register, get_iut_provider, get_execution_space_provider, get_log_area_provider, json_to_dict, ) from tests.library.fake_request import FakeRequest from tests.library.fake_database import FakeDatabase class TestRegisterBackend(unittest.TestCase): """Test the register backend.""" logger = logging.getLogger(__name__) def test_iut_provider(self): """Test that the register backend can return IUT provider. Approval criteria: - The register backend shall be able to get the IUT provider from request parameters. Test steps: 1. Get IUT provider from request via the register backend. 2. Verify that the backend returns the correct iut provider. """ request = FakeRequest() test_iut_provider = {"iut": {"id": "providertest"}} request.fake_params["iut_provider"] = test_iut_provider self.logger.info( "STEP: Get IUT provider from request via the register backend." ) response_iut_provider = get_iut_provider(request) self.logger.info( "STEP: Verify that the backend returns the correct iut provider." ) self.assertDictEqual(test_iut_provider, response_iut_provider) def test_iut_provider_none(self): """Test that the register backend returns None if IUT provider is not set. Approval criteria: - The register backend shall return None if IUT provider is not in request. Test steps: 1. Get IUT provider from request via the register backend. 2. Verify that the backend returns None. """ request = FakeRequest() self.logger.info( "STEP: Get IUT provider from request via the register backend." ) response_iut_provider = get_iut_provider(request) self.logger.info("STEP: Verify that the backend returns None.") self.assertIsNone(response_iut_provider) def test_execution_space_provider(self): """Test that the register backend can return execution space provider. Approval criteria: - The register backend shall be able to get the execution space provider from request parameters. Test steps: 1. Get execution space provider from request via the register backend. 2. Verify that the backend returns the correct execution space provider. """ request = FakeRequest() test_execution_space_provider = {"execution_space": {"id": "providertest"}} request.fake_params["execution_space_provider"] = test_execution_space_provider self.logger.info( "STEP: Get execution space provider from request via the register backend." ) response_execution_space_provider = get_execution_space_provider(request) self.logger.info( "STEP: Verify that the backend returns the correct execution space provider." ) self.assertDictEqual( test_execution_space_provider, response_execution_space_provider ) def test_execution_space_provider_none(self): """Test that the register backend returns None if execution space provider is not set. Approval criteria: - The register backend shall return None if execution space provider is not in request. Test steps: 1. Get execution space provider from request via the register backend. 2. Verify that the backend returns None. """ request = FakeRequest() self.logger.info( "STEP: Get execution space provider from request via the register backend." ) response_execution_space_provider = get_execution_space_provider(request) self.logger.info("STEP: Verify that the backend returns None.") self.assertIsNone(response_execution_space_provider) def test_log_area_provider(self): """Test that the register backend can return log area provider. Approval criteria: - The register backend shall be able to get the log area provider from request parameters. Test steps: 1. Get log area provider from request via the register backend. 2. Verify that the backend returns the correct log area provider. """ request = FakeRequest() test_log_area_provider = {"log": {"id": "providertest"}} request.fake_params["log_area_provider"] = test_log_area_provider self.logger.info( "STEP: Get log area provider from request via the register backend." ) response_log_area_provider = get_log_area_provider(request) self.logger.info( "STEP: Verify that the backend returns the correct log area provider." ) self.assertDictEqual(test_log_area_provider, response_log_area_provider) def test_log_area_provider_none(self): """Test that the register backend returns None if log area provider is not set. Approval criteria: - The register backend shall return None if log area provider is not in request. Test steps: 1. Get log area provider from request via the register backend. 2. Verify that the backend returns None. """ request = FakeRequest() self.logger.info( "STEP: Get log area provider from request via the register backend." ) response_log_area_provider = get_log_area_provider(request) self.logger.info("STEP: Verify that the backend returns None.") self.assertIsNone(response_log_area_provider) def test_json_to_dict(self): """Test that the json to dict function returns a dictionary. Approval criteria: - The json_to_dict function shall convert strings to dictionary. Test steps: 1. Verify that the json_to_dict converts JSON strings to dictionary. """ json_string = '{"data": "testing"}' self.logger.info( "STEP: Verify that the json_to_dict converts JSON strings to dictionary." ) json_dict = json_to_dict(json_string) self.assertDictEqual(json_dict, json.loads(json_string)) def test_json_to_dict_none(self): """Test that the json to dict function returns None. Approval criteria: - The json_to_dict function shall return None if json_str is None. Test steps: 1. Verify that the json_to_dict returns None when json_str is None. """ self.logger.info( "Verify that the json_to_dict returns None when json_str is None." ) self.assertIsNone(json_to_dict(None)) def test_json_to_dict_already_dict(self): """Test that the json to dict function does not do anything if input is already a dict. Approval criteria: - The json_to_dict function shall return dictionary as it is. Test steps: 1. Verify that the json_to_dict returns the same dictionary when provided with one. """ json_dict = {"data": "testing"} self.logger.info( "STEP: Verify that the json_to_dict returns the same dictionary when provided with one." ) json_dict_response = json_to_dict(json_dict) self.assertDictEqual(json_dict, json_dict_response) def test_register_iut_provider(self): """Test that the register backend can register iut providers. Approval criteria: - The register backend shall be able to register an IUT provider. Test steps: 1. Register an IUT provider with the register backend. 2. Verify that the IUT provider was stored in the database. """ fake_database = FakeDatabase() etos = ETOS("testing_etos", "testing_etos", "testing_etos") jsontas = JsonTas() provider = { "iut": { "id": "iut_provider_test", "list": {"possible": [], "available": []}, } } provider_registry = ProviderRegistry(etos, jsontas, fake_database) self.logger.info("STEP: Register an IUT provider with the register backend.") response = register(provider_registry, iut_provider=provider) self.logger.info( "STEP: Verify that the IUT provider was stored in the database." ) stored_provider = json.loads( fake_database.reader.hget( "EnvironmentProvider:IUTProviders", "iut_provider_test" ) ) self.assertDictEqual(stored_provider, provider) self.assertTrue(response) def test_register_log_area_provider(self): """Test that the register backend can register log area providers. Approval criteria: - The register backend shall be able to register a log area provider. Test steps: 1. Register a log area provider with the register backend. 2. Verify that the log area provider was stored in the database. """ fake_database = FakeDatabase() etos = ETOS("testing_etos", "testing_etos", "testing_etos") jsontas = JsonTas() provider = { "log": { "id": "log_area_provider_test", "list": {"available": [], "possible": []}, } } provider_registry = ProviderRegistry(etos, jsontas, fake_database) self.logger.info( "STEP: Register a log area provider with the register backend." ) response = register(provider_registry, log_area_provider=provider) self.logger.info( "STEP: Verify that the log area provider was stored in the database." ) stored_provider = json.loads( fake_database.reader.hget( "EnvironmentProvider:LogAreaProviders", "log_area_provider_test" ) ) self.assertDictEqual(stored_provider, provider) self.assertTrue(response) def test_register_execution_space_provider(self): """Test that the register backend can register execution space providers. Approval criteria: - The register backend shall be able to register an execution space provider. Test steps: 1. Register an execution space provider with the register backend. 2. Verify that the execution space provider was stored in the database. """ fake_database = FakeDatabase() etos = ETOS("testing_etos", "testing_etos", "testing_etos") jsontas = JsonTas() provider = { "execution_space": { "id": "execution_space_provider_test", "list": {"available": [{"identifier": "123"}], "possible": []}, } } provider_registry = ProviderRegistry(etos, jsontas, fake_database) self.logger.info( "STEP: Register an execution space provider with the register backend." ) response = register(provider_registry, execution_space_provider=provider) self.logger.info( "STEP: Verify that the execution space provider was stored in the database." ) stored_provider = json.loads( fake_database.reader.hget( "EnvironmentProvider:ExecutionSpaceProviders", "execution_space_provider_test", ) ) self.assertDictEqual(stored_provider, provider) self.assertTrue(response) def test_register_all_providers(self): """Test that the register backend can register all providers. Approval criteria: - The register backend shall be able to register all providers. Test steps: 1. Register one of each provider with the register backend. 2. Verify that the providers were stored in the database. """ fake_database = FakeDatabase() etos = ETOS("testing_etos", "testing_etos", "testing_etos") jsontas = JsonTas() test_iut_provider = { "iut": { "id": "iut_provider_test", "list": {"available": [], "possible": []}, } } test_execution_space_provider = { "execution_space": { "id": "execution_space_provider_test", "list": {"available": [{"identifier": "123"}], "possible": []}, } } test_log_area_provider = { "log": { "id": "log_area_provider_test", "list": {"available": [], "possible": []}, } } provider_registry = ProviderRegistry(etos, jsontas, fake_database) self.logger.info( "STEP: Register one of each provider with the register backend." ) response = register( provider_registry, iut_provider=test_iut_provider, log_area_provider=test_log_area_provider, execution_space_provider=test_execution_space_provider, ) self.logger.info("STEP: Verify that the providers were stored in the database.") stored_execution_space_provider = json.loads( fake_database.reader.hget( "EnvironmentProvider:ExecutionSpaceProviders", "execution_space_provider_test", ) ) self.assertDictEqual( stored_execution_space_provider, test_execution_space_provider, ) stored_log_area_provider = json.loads( fake_database.reader.hget( "EnvironmentProvider:LogAreaProviders", "log_area_provider_test" ) ) self.assertDictEqual(stored_log_area_provider, test_log_area_provider) stored_iut_provider = json.loads( fake_database.reader.hget( "EnvironmentProvider:IUTProviders", "iut_provider_test" ) ) self.assertDictEqual(stored_iut_provider, test_iut_provider) self.assertTrue(response) def test_register_provider_none(self): """Test that the register backend return false if no provider is supplied. Approval criteria: - The register backend shall return False if no provider is supplied. Test steps: 1. Register no provider with the register backend. 2. Verify that the register backend return False. """ fake_database = FakeDatabase() etos = ETOS("testing_etos", "testing_etos", "testing_etos") jsontas = JsonTas() provider_registry = ProviderRegistry(etos, jsontas, fake_database) self.logger.info("STEP: Register no provider with the register backend.") response = register(provider_registry) self.logger.info("STEP: Verify that the register backend return False.") self.assertFalse(response)
38.708738
100
0.641397
1,813
15,948
5.46663
0.097077
0.053274
0.087176
0.043588
0.841893
0.801635
0.773888
0.718091
0.695086
0.588942
0
0.003429
0.286933
15,948
411
101
38.80292
0.868097
0.304678
0
0.443038
0
0
0.251939
0.043622
0
0
0
0
0.084388
1
0.059072
false
0
0.037975
0
0.105485
0
0
0
0
null
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
a1930c7ea0f07fae2a2135e00aec46db4cbd6ef8
110
py
Python
solutions/pybasic_ex1_1_1.py
mfernandes61/python-basic
fc105db0e2e3af1830d833eef368fd011b4fcf5e
[ "Unlicense" ]
40
2017-02-22T05:35:16.000Z
2022-01-10T09:28:35.000Z
solutions/pybasic_ex1_1_1.py
mfernandes61/python-basic
fc105db0e2e3af1830d833eef368fd011b4fcf5e
[ "Unlicense" ]
10
2016-12-12T17:06:50.000Z
2019-06-14T13:34:22.000Z
solutions/pybasic_ex1_1_1.py
mfernandes61/python-basic
fc105db0e2e3af1830d833eef368fd011b4fcf5e
[ "Unlicense" ]
47
2017-03-24T19:48:50.000Z
2022-02-27T15:53:09.000Z
# This exercise should be done in Jupyter and in the interpreter # Print your name print('My name is Anne.')
22
64
0.745455
19
110
4.315789
0.842105
0
0
0
0
0
0
0
0
0
0
0
0.190909
110
4
65
27.5
0.921348
0.709091
0
0
0
0
0.551724
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
4
a1984bbf81db56138c06d255dcbf7a8f485f2c7f
122
py
Python
Python/Hello-World.py
EamonnCurran/Simple-Programs
2d5aa639d5746472ef8b9c23c4b37eb054eb3e6b
[ "BSD-3-Clause" ]
null
null
null
Python/Hello-World.py
EamonnCurran/Simple-Programs
2d5aa639d5746472ef8b9c23c4b37eb054eb3e6b
[ "BSD-3-Clause" ]
null
null
null
Python/Hello-World.py
EamonnCurran/Simple-Programs
2d5aa639d5746472ef8b9c23c4b37eb054eb3e6b
[ "BSD-3-Clause" ]
null
null
null
""" PigLatinTranslator.py Simple Programs Copyright (C) 2018 Ethan Dye. All rights reserved. """ print("Hello, World!")
13.555556
50
0.721311
15
122
5.866667
1
0
0
0
0
0
0
0
0
0
0
0.038095
0.139344
122
8
51
15.25
0.8
0.729508
0
0
0
0
0.52
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
4
a1a413f8ad473654ca58f15d31edc9923c700f18
1,106
py
Python
demo/collection/counter_demo.py
firstprojectfor/FPF_python
2321aff0d5b56f787befec55917d731c8c776558
[ "MIT" ]
1
2019-05-04T01:32:06.000Z
2019-05-04T01:32:06.000Z
demo/collection/counter_demo.py
firstprojectfor/FPF_python
2321aff0d5b56f787befec55917d731c8c776558
[ "MIT" ]
null
null
null
demo/collection/counter_demo.py
firstprojectfor/FPF_python
2321aff0d5b56f787befec55917d731c8c776558
[ "MIT" ]
null
null
null
import collections """ 继承自 dict,值代表出现次数,可以用来表示优先级 """ age_counter_arr = collections.Counter([1, 2, 3, 3]) print(age_counter_arr) age_counter_tuple = collections.Counter(('1', '2', '3', '3')) print(age_counter_tuple) age_counter_dict = collections.Counter({'3': 2, '1': 1, '2': 1}) print(age_counter_dict) age_counter_key_value = collections.Counter(a=2, b=3, c=4, e=1) print('before change: ') for e, number in age_counter_key_value.items(): print(e, number) # delete min counter elements age_counter_key_value.pop('e') # add element age_counter_key_value['f'] = 3 # 增加统计次数,不是替换 age_counter_key_value.update(a=100) age_counter_key_value.update(age_counter_arr) age_counter_key_value.update({'c': 100, 'd': 200}) age_counter_key_value.update({'g': -100}) age_counter_key_value.elements() print('after change: ') for e, number in age_counter_key_value.items(): print(e, number) # 分数最高的前几个元素 print(age_counter_key_value.most_common(10)) # 按添加顺序显示元素 print(list(age_counter_key_value.elements())) a = collections.Counter(a=3) b = collections.Counter(a=2) # & 取最大 | 取最小 print(a | b) print(b & a)
24.577778
64
0.738698
182
1,106
4.208791
0.274725
0.248042
0.203655
0.281984
0.469974
0.234987
0.234987
0.234987
0.234987
0.138381
0
0.035389
0.105787
1,106
44
65
25.136364
0.73913
0.075949
0
0.148148
0
0
0.041794
0
0
0
0
0
0
1
0
false
0
0.037037
0
0.037037
0.407407
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
1
0
4
a1edd696c86ba86ef1bd4354ed9f11fe29ed9ccb
411
py
Python
config.py
brfriedr/Cisco-DNA-Center-Webex-Bot
c7b0407441723c78ce9cd386013582729914bcd9
[ "BSD-Source-Code" ]
null
null
null
config.py
brfriedr/Cisco-DNA-Center-Webex-Bot
c7b0407441723c78ce9cd386013582729914bcd9
[ "BSD-Source-Code" ]
null
null
null
config.py
brfriedr/Cisco-DNA-Center-Webex-Bot
c7b0407441723c78ce9cd386013582729914bcd9
[ "BSD-Source-Code" ]
null
null
null
import os DNAC=os.environ.get('DNAC','sandboxdnac.cisco.com') DNAC_PORT=os.environ.get('DNAC_PORT',443) DNAC_USER=os.environ.get('DNAC_USER','devnetuser') DNAC_PASSWORD=os.environ.get('DNAC_PASSWORD','Cisco123!') WEBEX_BOT_ACCESS_TOKEN=os.environ.get('WEBEX_BOT_ACCESS_TOKEN','Enter your webex toekn from the preq step 6') TEAMS_BOT_URL=os.environ.get('TEAMS_BOT_URL','http://this.is.the.url.you.net.ngrok.io')
51.375
109
0.788321
72
411
4.277778
0.486111
0.175325
0.233766
0.207792
0
0
0
0
0
0
0
0.017722
0.038929
411
7
110
58.714286
0.762025
0
0
0
0
0
0.467153
0.104623
0
0
0
0
0
1
0
false
0.142857
0.142857
0
0.142857
0
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
1
0
0
0
0
0
4
a1fd165214543dda4c56bd2f19e6c124ff01b866
89
py
Python
enthought/chaco/default_colors.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
3
2016-12-09T06:05:18.000Z
2018-03-01T13:00:29.000Z
enthought/chaco/default_colors.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
1
2020-12-02T00:51:32.000Z
2020-12-02T08:48:55.000Z
enthought/chaco/default_colors.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
null
null
null
# proxy module from __future__ import absolute_import from chaco.default_colors import *
22.25
38
0.842697
12
89
5.75
0.75
0
0
0
0
0
0
0
0
0
0
0
0.123596
89
3
39
29.666667
0.884615
0.134831
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
b80a1038cebe2c4201c451996f5c26e02ed13653
51
py
Python
externalapis/__init__.py
rafael-carvalho/investigo-meraki
3c75ebc54e38b822e5ae452f4faf12d527d95f4d
[ "Apache-2.0" ]
2
2018-04-05T08:52:54.000Z
2020-05-16T15:43:44.000Z
web/externalapis/__init__.py
rafael-carvalho/cmx-investigo
0bd3b9905ecd9ddd4398b12a7cb8553e79e35648
[ "Apache-2.0" ]
null
null
null
web/externalapis/__init__.py
rafael-carvalho/cmx-investigo
0bd3b9905ecd9ddd4398b12a7cb8553e79e35648
[ "Apache-2.0" ]
2
2018-04-18T08:35:59.000Z
2020-03-12T22:13:19.000Z
''' Created on Aug 14, 2016 @author: rafacarv '''
8.5
23
0.627451
7
51
4.571429
1
0
0
0
0
0
0
0
0
0
0
0.146341
0.196078
51
5
24
10.2
0.634146
0.823529
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
62b56d4d0690eab3731e8729d52ada5a66e397ef
769
py
Python
setup.py
Jack-Kingdom/portalutils
6f6f3bc2d710398e9c96cd245b80fab08588cada
[ "MIT" ]
1
2018-06-06T03:50:02.000Z
2018-06-06T03:50:02.000Z
setup.py
Jack-Kingdom/portalutils
6f6f3bc2d710398e9c96cd245b80fab08588cada
[ "MIT" ]
null
null
null
setup.py
Jack-Kingdom/portalutils
6f6f3bc2d710398e9c96cd245b80fab08588cada
[ "MIT" ]
null
null
null
from setuptools import setup setup( name='portalutils', packages=['portalutils'], version='0.0.3', url='https://github.com/Jack-Kingdom/portalutils.git', description='Portal access utility.', long_description=open('README.md').read(), author='Jack King', author_email='email@qiaohong.org', license='MIT', classifiers=[ 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Natural Language :: English', ], install_requires=['requests'] )
29.576923
58
0.615085
78
769
6.025641
0.641026
0.202128
0.265957
0.221277
0
0
0
0
0
0
0
0.016835
0.227568
769
25
59
30.76
0.774411
0
0
0
0
0
0.539662
0
0
0
0
0
0
1
0
true
0
0.045455
0
0.045455
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
1
0
0
0
0
0
0
4
62c41e8811c3898b7afd3e511463078efeeee96b
835
py
Python
tick/base_model/__init__.py
sumau/tick
1b56924a35463e12f7775bc0aec182364f26f2c6
[ "BSD-3-Clause" ]
411
2017-03-30T15:22:05.000Z
2022-03-27T01:58:34.000Z
tick/base_model/__init__.py
saurabhdash/tick
bbc561804eb1fdcb4c71b9e3e2d83a66e7b13a48
[ "BSD-3-Clause" ]
345
2017-04-13T14:53:20.000Z
2022-03-26T00:46:22.000Z
tick/base_model/__init__.py
saurabhdash/tick
bbc561804eb1fdcb4c71b9e3e2d83a66e7b13a48
[ "BSD-3-Clause" ]
102
2017-04-25T11:47:53.000Z
2022-02-15T11:45:49.000Z
# License: BSD 3 clause from .model import Model from .model_first_order import ModelFirstOrder from .model_labels_features import ModelLabelsFeatures from .model_second_order import ModelSecondOrder from .model_self_concordant import ModelSelfConcordant from .model_lipschitz import ModelLipschitz from .model_generalized_linear import ModelGeneralizedLinear from .model import LOSS from .model import GRAD from .model import LOSS_AND_GRAD from .model import HESSIAN_NORM from .model import N_CALLS_LOSS from .model import N_CALLS_GRAD from .model import N_CALLS_LOSS_AND_GRAD from .model import N_CALLS_HESSIAN_NORM from .model import PASS_OVER_DATA __all__ = [ "Model", "ModelFirstOrder", "ModelSecondOrder", "ModelLabelsFeatures", "ModelSelfConcordant", "ModelGeneralizedLinear", "ModelLipschitz", ]
27.833333
60
0.816766
103
835
6.320388
0.330097
0.221198
0.230415
0.116743
0.254992
0.165899
0
0
0
0
0
0.001381
0.132934
835
29
61
28.793103
0.89779
0.02515
0
0
0
0
0.135468
0.027094
0
0
0
0
0
1
0
false
0.04
0.64
0
0.64
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
1
0
1
0
0
4
62c6ef81640b5a86bb88fee301b860da53f37aed
118
py
Python
seedrecover/__main__.py
HeptaSean/PySeedRecover
0a5c22088c2512dcd9d7a18690ca3fc01793c6eb
[ "MIT" ]
null
null
null
seedrecover/__main__.py
HeptaSean/PySeedRecover
0a5c22088c2512dcd9d7a18690ca3fc01793c6eb
[ "MIT" ]
null
null
null
seedrecover/__main__.py
HeptaSean/PySeedRecover
0a5c22088c2512dcd9d7a18690ca3fc01793c6eb
[ "MIT" ]
null
null
null
"""Execute the command-line interface as __main__.""" from seedrecover.cli import main main("python -m seedrecover")
23.6
53
0.762712
16
118
5.375
0.8125
0
0
0
0
0
0
0
0
0
0
0
0.118644
118
4
54
29.5
0.826923
0.398305
0
0
0
0
0.323077
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
62cbd0b034b8096510c884e68971c06860c40b88
1,189
py
Python
bitmovin/services/encodings/fmp4_drm_service.py
camberbridge/bitmovin-python
3af4c6e79b0291fda05fd1ceeb5bed1bba9f3c95
[ "Unlicense" ]
44
2016-12-12T17:37:23.000Z
2021-03-03T09:48:48.000Z
bitmovin/services/encodings/fmp4_drm_service.py
camberbridge/bitmovin-python
3af4c6e79b0291fda05fd1ceeb5bed1bba9f3c95
[ "Unlicense" ]
38
2017-01-09T14:45:45.000Z
2022-02-27T18:04:33.000Z
bitmovin/services/encodings/fmp4_drm_service.py
camberbridge/bitmovin-python
3af4c6e79b0291fda05fd1ceeb5bed1bba9f3c95
[ "Unlicense" ]
27
2017-02-02T22:49:31.000Z
2019-11-21T07:04:57.000Z
from .drm_service import DRMService from .fairplay_drm_service import FairPlayDRM from .widevine_drm_service import WidevineDRM from .playready_drm_service import PlayReadyDRM from .primetime_drm_service import PrimeTimeDRM from .marlin_drm_service import MarlinDRM from .clearkey_drm_service import ClearKeyDRM from .cenc_drm_service import CENCDRM class FMP4DRMService(DRMService): MUXING_TYPE_URL = 'fmp4' def __init__(self, http_client): super().__init__(http_client=http_client) self.FairPlay = FairPlayDRM(http_client=http_client, muxing_type_url=self.MUXING_TYPE_URL) self.Widevine = WidevineDRM(http_client=http_client, muxing_type_url=self.MUXING_TYPE_URL) self.PlayReady = PlayReadyDRM(http_client=http_client, muxing_type_url=self.MUXING_TYPE_URL) self.PrimeTime = PrimeTimeDRM(http_client=http_client, muxing_type_url=self.MUXING_TYPE_URL) self.Marlin = MarlinDRM(http_client=http_client, muxing_type_url=self.MUXING_TYPE_URL) self.ClearKey = ClearKeyDRM(http_client=http_client, muxing_type_url=self.MUXING_TYPE_URL) self.CENC = CENCDRM(http_client=http_client, muxing_type_url=self.MUXING_TYPE_URL)
49.541667
100
0.810765
163
1,189
5.484663
0.190184
0.190157
0.218121
0.247204
0.418345
0.418345
0.418345
0.418345
0.418345
0.418345
0
0.001916
0.121951
1,189
23
101
51.695652
0.854406
0
0
0
0
0
0.003364
0
0
0
0
0
0
1
0.052632
false
0
0.421053
0
0.578947
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
62cf285e52a27e2a2d00c99acc71fde7ca4bbf22
279
py
Python
BackendBaggie/reviewproduct/serializers.py
Baggie-App/Updateapi
80f200d7ffd4695e6348ce6bb9a7a31a6b821e77
[ "MIT" ]
null
null
null
BackendBaggie/reviewproduct/serializers.py
Baggie-App/Updateapi
80f200d7ffd4695e6348ce6bb9a7a31a6b821e77
[ "MIT" ]
null
null
null
BackendBaggie/reviewproduct/serializers.py
Baggie-App/Updateapi
80f200d7ffd4695e6348ce6bb9a7a31a6b821e77
[ "MIT" ]
null
null
null
from rest_framework import serializers from reviewproduct.models import ProductReview class ProductReviewSerializer(serializers.ModelSerializer): class Meta: model = ProductReview fields = ('id','productID', 'customerID', 'review_at','review','starreview')
31
84
0.752688
26
279
8
0.769231
0
0
0
0
0
0
0
0
0
0
0
0.150538
279
8
85
34.875
0.877637
0
0
0
0
0
0.164875
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
62d20bd42bd3e366f695fac0dd8e8445bc8622e4
25,998
py
Python
sdk/tables/azure-data-tables/tests/test_table_batch.py
iamvishnuks/azure-sdk-for-python
4df435651ab32f57b1e9f33fc65fd46632055704
[ "MIT" ]
2
2021-01-15T18:30:53.000Z
2021-09-07T18:31:31.000Z
sdk/tables/azure-data-tables/tests/test_table_batch.py
iamvishnuks/azure-sdk-for-python
4df435651ab32f57b1e9f33fc65fd46632055704
[ "MIT" ]
null
null
null
sdk/tables/azure-data-tables/tests/test_table_batch.py
iamvishnuks/azure-sdk-for-python
4df435651ab32f57b1e9f33fc65fd46632055704
[ "MIT" ]
1
2020-07-31T16:33:51.000Z
2020-07-31T16:33:51.000Z
# coding: utf-8 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import unittest import pytest import uuid from datetime import datetime from dateutil.tz import tzutc from azure.core import MatchConditions from azure.core.exceptions import ( ResourceExistsError) from _shared.testcase import GlobalStorageAccountPreparer, TableTestCase, LogCaptured #------------------------------------------------------------------------------ TEST_TABLE_PREFIX = 'table' #------------------------------------------------------------------------------ class StorageTableBatchTest(TableTestCase): def _set_up(self, storage_account, storage_account_key): self.ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) self.table_name = self.get_resource_name('uttable') self.table = self.ts.get_table_client(self.table_name) if self.is_live: try: self.ts.create_table(self.table_name) except ResourceExistsError: pass self.test_tables = [] def _tear_down(self): if self.is_live: try: self.ts.delete_table(self.table_name) except: pass for table_name in self.test_tables: try: self.ts.delete_table(table_name) except: pass #--Helpers----------------------------------------------------------------- def _get_table_reference(self, prefix=TEST_TABLE_PREFIX): table_name = self.get_resource_name(prefix) self.test_tables.append(table_name) return self.ts.get_table_client(table_name) def _create_random_entity_dict(self, pk=None, rk=None): ''' Creates a dictionary-based entity with fixed values, using all of the supported data types. ''' partition = pk if pk is not None else self.get_resource_name('pk') row = rk if rk is not None else self.get_resource_name('rk') properties = { 'PartitionKey': partition, 'RowKey': row, 'age': 39, 'sex': 'male', 'married': True, 'deceased': False, 'optional': None, 'ratio': 3.1, 'evenratio': 3.0, 'large': 933311100, 'Birthday': datetime(1973, 10, 4, tzinfo=tzutc()), 'birthday': datetime(1970, 10, 4, tzinfo=tzutc()), 'binary': b'binary', 'other': EntityProperty(EdmType.INT32, 20), 'clsid': uuid.UUID('c9da6455-213d-42c9-9a79-3e9149a57833') } return Entity(**properties) def _create_updated_entity_dict(self, partition, row): ''' Creates a dictionary-based entity with fixed values, with a different set of values than the default entity. It adds fields, changes field values, changes field types, and removes fields when compared to the default entity. ''' return { 'PartitionKey': partition, 'RowKey': row, 'age': 'abc', 'sex': 'female', 'sign': 'aquarius', 'birthday': datetime(1991, 10, 4, tzinfo=tzutc()) } def _assert_default_entity(self, entity, headers=None): ''' Asserts that the entity passed in matches the default entity. ''' self.assertEqual(entity['age'], 39) self.assertEqual(entity['sex'], 'male') self.assertEqual(entity['married'], True) self.assertEqual(entity['deceased'], False) self.assertFalse("optional" in entity) self.assertFalse("aquarius" in entity) self.assertEqual(entity['ratio'], 3.1) self.assertEqual(entity['evenratio'], 3.0) self.assertEqual(entity['large'], 933311100) self.assertEqual(entity['Birthday'], datetime(1973, 10, 4, tzinfo=tzutc())) self.assertEqual(entity['birthday'], datetime(1970, 10, 4, tzinfo=tzutc())) self.assertEqual(entity['binary'], b'binary') self.assertIsInstance(entity['other'], EntityProperty) self.assertEqual(entity['other'].type, EdmType.INT32) self.assertEqual(entity['other'].value, 20) self.assertEqual(entity['clsid'], uuid.UUID('c9da6455-213d-42c9-9a79-3e9149a57833')) self.assertTrue('metadata' in entity.odata) self.assertIsNotNone(entity.timestamp) self.assertIsInstance(entity.timestamp, datetime) if headers: self.assertTrue("etag" in headers) self.assertIsNotNone(headers['etag']) def _assert_updated_entity(self, entity): ''' Asserts that the entity passed in matches the updated entity. ''' self.assertEqual(entity.age, 'abc') self.assertEqual(entity.sex, 'female') self.assertFalse(hasattr(entity, "married")) self.assertFalse(hasattr(entity, "deceased")) self.assertEqual(entity.sign, 'aquarius') self.assertFalse(hasattr(entity, "optional")) self.assertFalse(hasattr(entity, "ratio")) self.assertFalse(hasattr(entity, "evenratio")) self.assertFalse(hasattr(entity, "large")) self.assertFalse(hasattr(entity, "Birthday")) self.assertEqual(entity.birthday, datetime(1991, 10, 4, tzinfo=tzutc())) self.assertFalse(hasattr(entity, "other")) self.assertFalse(hasattr(entity, "clsid")) self.assertIsNotNone(entity.odata['etag']) self.assertIsNotNone(entity.timestamp) self.assertIsInstance(entity.timestamp, datetime) #--Test cases for batch --------------------------------------------- @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_insert(self, resource_group, location, storage_account, storage_account_key): # Arrange self._set_up(storage_account, storage_account_key) try: # Act entity = Entity() entity.PartitionKey = '001' entity.RowKey = 'batch_insert' entity.test = EntityProperty(EdmType.BOOLEAN, 'true') entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(EdmType.INT64, '1234567890') entity.test5 = datetime.utcnow() batch = self.table.create_batch() batch.create_item(entity) resp = self.table.commit_batch(batch) # Assert self.assertIsNotNone(resp) result, headers = self.table.read_item('001', 'batch_insert', response_hook=lambda e, h: (e, h)) self.assertEqual(list(resp)[0].headers['Etag'], headers['etag']) finally: self._tear_down() @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_update(self, resource_group, location, storage_account, storage_account_key): # Arrange self._set_up(storage_account, storage_account_key) try: # Act entity = Entity() entity.PartitionKey = '001' entity.RowKey = 'batch_update' entity.test = EntityProperty(EdmType.BOOLEAN, 'true') entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(EdmType.INT64, '1234567890') entity.test5 = datetime.utcnow() self.table.create_item(entity) entity = self.table.read_item('001', 'batch_update') self.assertEqual(3, entity.test3) entity.test2 = 'value1' batch = self.table.create_batch() batch.update_item(entity) resp = self.table.commit_batch(batch) # Assert self.assertIsNotNone(resp) result, headers = self.table.read_item('001', 'batch_update', response_hook=lambda e, h: (e, h)) self.assertEqual('value1', result.test2) self.assertEqual(list(resp)[0].headers['Etag'], headers['etag']) finally: self._tear_down() @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_merge(self, resource_group, location, storage_account, storage_account_key): # Arrange self._set_up(storage_account, storage_account_key) try: # Act entity = Entity() entity.PartitionKey = '001' entity.RowKey = 'batch_merge' entity.test = EntityProperty(EdmType.BOOLEAN, 'true') entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(EdmType.INT64, '1234567890') entity.test5 = datetime.utcnow() self.table.create_item(entity) entity = self.table.read_item('001', 'batch_merge') self.assertEqual(3, entity.test3) entity = Entity() entity.PartitionKey = '001' entity.RowKey = 'batch_merge' entity.test2 = 'value1' batch = self.table.create_batch() batch.update_item(entity, mode='MERGE') resp = self.table.commit_batch(batch) # Assert self.assertIsNotNone(resp) entity, headers = self.table.read_item('001', 'batch_merge', response_hook=lambda e, h: (e, h)) self.assertEqual('value1', entity.test2) self.assertEqual(1234567890, entity.test4) self.assertEqual(list(resp)[0].headers['Etag'], headers['etag']) finally: self._tear_down() @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_update_if_match(self, resource_group, location, storage_account, storage_account_key): # Arrange self._set_up(storage_account, storage_account_key) try: entity = self._create_random_entity_dict() etag = self.table.create_item(entity, response_hook=lambda e, h: h['etag']) # Act sent_entity = self._create_updated_entity_dict(entity['PartitionKey'], entity['RowKey']) batch = self.table.create_batch() batch.update_item(sent_entity, etag=etag, match_condition=MatchConditions.IfNotModified) resp = self.table.commit_batch(batch) # Assert self.assertIsNotNone(resp) entity, headers = self.table.read_item(entity['PartitionKey'], entity['RowKey'], response_hook=lambda e, h: (e, h)) self._assert_updated_entity(entity) self.assertEqual(list(resp)[0].headers['Etag'], headers['etag']) finally: self._tear_down() @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_update_if_doesnt_match(self, resource_group, location, storage_account, storage_account_key): # Arrange self._set_up(storage_account, storage_account_key) try: entity = self._create_random_entity_dict() self.table.create_item(entity) # Act sent_entity1 = self._create_updated_entity_dict(entity['PartitionKey'], entity['RowKey']) batch = self.table.create_batch() batch.update_item( sent_entity1, etag=u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"', match_condition=MatchConditions.IfNotModified) try: self.table.commit_batch(batch) except PartialBatchErrorException as error: pass # TODO #self.assertEqual(error.code, 'UpdateConditionNotSatisfied') #self.assertTrue('The update condition specified in the request was not satisfied.' in str(error)) else: self.fail('AzureBatchOperationError was expected') # Assert received_entity = self.table.read_item(entity['PartitionKey'], entity['RowKey']) self._assert_default_entity(received_entity) finally: self._tear_down() @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_insert_replace(self, resource_group, location, storage_account, storage_account_key): # Arrange self._set_up(storage_account, storage_account_key) try: # Act entity = Entity() entity.PartitionKey = '001' entity.RowKey = 'batch_insert_replace' entity.test = True entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(EdmType.INT64, '1234567890') entity.test5 = datetime.utcnow() batch = self.table.create_batch() batch.upsert_item(entity) resp = self.table.commit_batch(batch) # Assert self.assertIsNotNone(resp) entity, headers = self.table.read_item('001', 'batch_insert_replace', response_hook=lambda e, h: (e, h)) self.assertIsNotNone(entity) self.assertEqual('value', entity.test2) self.assertEqual(1234567890, entity.test4) self.assertEqual(list(resp)[0].headers['Etag'], headers['etag']) finally: self._tear_down() @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_insert_merge(self, resource_group, location, storage_account, storage_account_key): # Arrange self._set_up(storage_account, storage_account_key) try: # Act entity = Entity() entity.PartitionKey = '001' entity.RowKey = 'batch_insert_merge' entity.test = True entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(EdmType.INT64, '1234567890') entity.test5 = datetime.utcnow() batch = self.table.create_batch() batch.upsert_item(entity, mode='MERGE') resp = self.table.commit_batch(batch) # Assert self.assertIsNotNone(resp) entity, headers = self.table.read_item('001', 'batch_insert_merge', response_hook=lambda e, h: (e, h)) self.assertIsNotNone(entity) self.assertEqual('value', entity.test2) self.assertEqual(1234567890, entity.test4) self.assertEqual(list(resp)[0].headers['Etag'], headers['etag']) finally: self._tear_down() @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_delete(self, resource_group, location, storage_account, storage_account_key): # Arrange self._set_up(storage_account, storage_account_key) try: # Act entity = Entity() entity.PartitionKey = '001' entity.RowKey = 'batch_delete' entity.test = EntityProperty(EdmType.BOOLEAN, 'true') entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(EdmType.INT64, '1234567890') entity.test5 = datetime.utcnow() self.table.create_item(entity) entity = self.table.read_item('001', 'batch_delete') self.assertEqual(3, entity.test3) batch = self.table.create_batch() batch.delete_item('001', 'batch_delete') resp = self.table.commit_batch(batch) # Assert self.assertIsNotNone(resp) self.assertEqual(list(resp)[0].status_code, 204) finally: self._tear_down() @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_inserts(self, resource_group, location, storage_account, storage_account_key): # Arrange self._set_up(storage_account, storage_account_key) try: # Act entity = Entity() entity.PartitionKey = 'batch_inserts' entity.test = EntityProperty(EdmType.BOOLEAN, 'true') entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(EdmType.INT64, '1234567890') batch = self.table.create_batch() for i in range(100): entity.RowKey = str(i) batch.create_item(entity) self.table.commit_batch(batch) entities = list(self.table.query_items("PartitionKey eq 'batch_inserts'")) # Assert self.assertIsNotNone(entities) self.assertEqual(100, len(entities)) finally: self._tear_down() @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_all_operations_together(self, resource_group, location, storage_account, storage_account_key): # Arrange self._set_up(storage_account, storage_account_key) try: # Act entity = Entity() entity.PartitionKey = '003' entity.RowKey = 'batch_all_operations_together-1' entity.test = EntityProperty(EdmType.BOOLEAN, 'true') entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(EdmType.INT64, '1234567890') entity.test5 = datetime.utcnow() self.table.create_item(entity) entity.RowKey = 'batch_all_operations_together-2' self.table.create_item(entity) entity.RowKey = 'batch_all_operations_together-3' self.table.create_item(entity) entity.RowKey = 'batch_all_operations_together-4' self.table.create_item(entity) batch = self.table.create_batch() entity.RowKey = 'batch_all_operations_together' batch.create_item(entity) entity.RowKey = 'batch_all_operations_together-1' batch.delete_item(entity.PartitionKey, entity.RowKey) entity.RowKey = 'batch_all_operations_together-2' entity.test3 = 10 batch.update_item(entity) entity.RowKey = 'batch_all_operations_together-3' entity.test3 = 100 batch.update_item(entity, mode='MERGE') entity.RowKey = 'batch_all_operations_together-4' entity.test3 = 10 batch.upsert_item(entity) entity.RowKey = 'batch_all_operations_together-5' batch.upsert_item(entity, mode='MERGE') resp = self.table.commit_batch(batch) # Assert self.assertEqual(6, len(list(resp))) entities = list(self.table.query_items("PartitionKey eq '003'")) self.assertEqual(5, len(entities)) finally: self._tear_down() @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_all_operations_together_context_manager(self, resource_group, location, storage_account, storage_account_key): # Arrange self._set_up(storage_account, storage_account_key) try: # Act entity = Entity() entity.PartitionKey = '003' entity.RowKey = 'batch_all_operations_together-1' entity.test = EntityProperty(EdmType.BOOLEAN, 'true') entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(EdmType.INT64, '1234567890') entity.test5 = datetime.utcnow() self.table.create_item(entity) entity.RowKey = 'batch_all_operations_together-2' self.table.create_item(entity) entity.RowKey = 'batch_all_operations_together-3' self.table.create_item(entity) entity.RowKey = 'batch_all_operations_together-4' self.table.create_item(entity) with self.table.create_batch() as batch: entity.RowKey = 'batch_all_operations_together' batch.create_item(entity) entity.RowKey = 'batch_all_operations_together-1' batch.delete_item(entity.PartitionKey, entity.RowKey) entity.RowKey = 'batch_all_operations_together-2' entity.test3 = 10 batch.update_item(entity) entity.RowKey = 'batch_all_operations_together-3' entity.test3 = 100 batch.update_item(entity, mode='MERGE') entity.RowKey = 'batch_all_operations_together-4' entity.test3 = 10 batch.upsert_item(entity) entity.RowKey = 'batch_all_operations_together-5' batch.upsert_item(entity, mode='MERGE') # Assert entities = list(self.table.query_items("PartitionKey eq '003'")) self.assertEqual(5, len(entities)) finally: self._tear_down() @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_reuse(self, resource_group, location, storage_account, storage_account_key): # Arrange self._set_up(storage_account, storage_account_key) try: table2 = self._get_table_reference('table2') table2.create_table() # Act entity = Entity() entity.PartitionKey = '003' entity.RowKey = 'batch_all_operations_together-1' entity.test = EntityProperty(EdmType.BOOLEAN, 'true') entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(EdmType.INT64, '1234567890') entity.test5 = datetime.utcnow() batch = TableBatchClient() batch.create_item(entity) entity.RowKey = 'batch_all_operations_together-2' batch.create_item(entity) entity.RowKey = 'batch_all_operations_together-3' batch.create_item(entity) entity.RowKey = 'batch_all_operations_together-4' batch.create_item(entity) self.table.commit_batch(batch) table2.commit_batch(batch) batch = TableBatchClient() entity.RowKey = 'batch_all_operations_together' batch.create_item(entity) entity.RowKey = 'batch_all_operations_together-1' batch.delete_item(entity.PartitionKey, entity.RowKey) entity.RowKey = 'batch_all_operations_together-2' entity.test3 = 10 batch.update_item(entity) entity.RowKey = 'batch_all_operations_together-3' entity.test3 = 100 batch.update_item(entity, mode='MERGE') entity.RowKey = 'batch_all_operations_together-4' entity.test3 = 10 batch.upsert_item(entity) entity.RowKey = 'batch_all_operations_together-5' batch.upsert_item(entity, mode='MERGE') self.table.commit_batch(batch) resp = table2.commit_batch(batch) # Assert self.assertEqual(6, len(list(resp))) entities = list(self.table.query_items("PartitionKey eq '003'")) self.assertEqual(5, len(entities)) finally: self._tear_down() @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_same_row_operations_fail(self, resource_group, location, storage_account, storage_account_key): # Arrange self._set_up(storage_account, storage_account_key) try: entity = self._create_random_entity_dict('001', 'batch_negative_1') self.table.create_item(entity) # Act batch = self.table.create_batch() entity = self._create_updated_entity_dict( '001', 'batch_negative_1') batch.update_item(entity) entity = self._create_random_entity_dict( '001', 'batch_negative_1') # Assert with self.assertRaises(ValueError): batch.update_item(entity, mode='MERGE') finally: self._tear_down() @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_different_partition_operations_fail(self, resource_group, location, storage_account, storage_account_key): # Arrange self._set_up(storage_account, storage_account_key) try: entity = self._create_random_entity_dict('001', 'batch_negative_1') self.table.create_item(entity) # Act batch = self.table.create_batch() entity = self._create_updated_entity_dict( '001', 'batch_negative_1') batch.update_item(entity) entity = self._create_random_entity_dict( '002', 'batch_negative_1') # Assert with self.assertRaises(ValueError): batch.create_item(entity) finally: self._tear_down() @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_too_many_ops(self, resource_group, location, storage_account, storage_account_key): # Arrange self._set_up(storage_account, storage_account_key) try: entity = self._create_random_entity_dict('001', 'batch_negative_1') self.table.create_item(entity) # Act with self.assertRaises(ValueError): batch = self.table.create_batch() for i in range(0, 101): entity = Entity() entity.PartitionKey = 'large' entity.RowKey = 'item{0}'.format(i) batch.create_item(entity) # Assert finally: self._tear_down() #------------------------------------------------------------------------------ if __name__ == '__main__': unittest.main()
40.18238
129
0.595969
2,653
25,998
5.623068
0.102525
0.060062
0.044443
0.055772
0.783215
0.746481
0.731801
0.711355
0.679716
0.645328
0
0.029777
0.284368
25,998
646
130
40.244582
0.772051
0.06062
0
0.694165
0
0
0.101572
0.042081
0
0
0
0.001548
0.15493
1
0.044266
false
0.008048
0.016097
0
0.06841
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
62f767ceb0eb34f3d2bb6f8d01554f5aaa5e609e
151
py
Python
test.py
RubanSeven/MirrorMirror
47c7a1f458f87c536d068fcf249625f426920cc3
[ "Apache-2.0" ]
2
2021-07-07T13:21:11.000Z
2021-09-24T06:57:16.000Z
test.py
RubanSeven/MirrorMirror
47c7a1f458f87c536d068fcf249625f426920cc3
[ "Apache-2.0" ]
null
null
null
test.py
RubanSeven/MirrorMirror
47c7a1f458f87c536d068fcf249625f426920cc3
[ "Apache-2.0" ]
null
null
null
# -*- coding:utf-8 -*- """ @author: RubanSeven @project: MirrorMirror """ from MirrorMirror import MirrorMirror mm = MirrorMirror() mm.run()
15.1
38
0.649007
15
151
6.533333
0.733333
0.285714
0
0
0
0
0
0
0
0
0
0.00813
0.18543
151
9
39
16.777778
0.788618
0.423841
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
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
1a2417f2707a39935493e4de60cb93e1c0e8583d
524
py
Python
lab7/chooser_statistician.py
PogrebenkoBS81/course3TPR
4f04d04f6a27a75da5769348dd8bfd1bcb2c9855
[ "MIT" ]
null
null
null
lab7/chooser_statistician.py
PogrebenkoBS81/course3TPR
4f04d04f6a27a75da5769348dd8bfd1bcb2c9855
[ "MIT" ]
null
null
null
lab7/chooser_statistician.py
PogrebenkoBS81/course3TPR
4f04d04f6a27a75da5769348dd8bfd1bcb2c9855
[ "MIT" ]
null
null
null
class ChooserStatistician: def __init__(self, m_iterations): self.m_iterations = m_iterations @property def m_iterations(self): return self._m_iterations @m_iterations.setter def m_iterations(self, m_iterations): if not m_iterations > 1: raise ValueError("Number of iterations should be > 1") self._m_iterations = m_iterations def get_chooser_p(self, chooser): return sum(chooser.is_win() for _ in range(self.m_iterations)) / self.m_iterations
29.111111
90
0.685115
68
524
4.941176
0.411765
0.425595
0.3125
0.142857
0.443452
0.178571
0
0
0
0
0
0.005
0.236641
524
17
91
30.823529
0.835
0
0
0
0
0
0.064886
0
0
0
0
0
0
1
0.307692
false
0
0
0.153846
0.538462
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
1a2738721c6a820e142cb2e8ddd1c52a7c3a5210
97
py
Python
FDApy/visualization/__init__.py
vishalbelsare/FDApy
50feb99e34f265b1c17a6f234a9d2f942ceb8f6d
[ "MIT" ]
19
2019-02-11T08:35:29.000Z
2022-01-27T16:51:10.000Z
FDApy/visualization/__init__.py
vishalbelsare/FDApy
50feb99e34f265b1c17a6f234a9d2f942ceb8f6d
[ "MIT" ]
4
2020-04-07T07:10:26.000Z
2022-02-09T16:33:19.000Z
FDApy/visualization/__init__.py
vishalbelsare/FDApy
50feb99e34f265b1c17a6f234a9d2f942ceb8f6d
[ "MIT" ]
7
2020-04-24T13:24:02.000Z
2022-02-18T17:28:30.000Z
""" Visualization module. This module contains visualization functions for functional data. """
16.166667
65
0.783505
10
97
7.6
0.8
0
0
0
0
0
0
0
0
0
0
0
0.134021
97
5
66
19.4
0.904762
0.907216
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
c51c7d52386a2d3bba95e00f0579820f27ec2ac9
57
py
Python
Bronze/Bronze_V/8871.py
masterTyper/baekjoon_solved_ac
b9ce14d9bdaa5b5b06735ad075fb827de9f44b9c
[ "MIT" ]
null
null
null
Bronze/Bronze_V/8871.py
masterTyper/baekjoon_solved_ac
b9ce14d9bdaa5b5b06735ad075fb827de9f44b9c
[ "MIT" ]
null
null
null
Bronze/Bronze_V/8871.py
masterTyper/baekjoon_solved_ac
b9ce14d9bdaa5b5b06735ad075fb827de9f44b9c
[ "MIT" ]
null
null
null
SKI10 = int(input()) print(SKI10 * 2 + 2, SKI10 * 3 + 3)
19
35
0.561404
10
57
3.2
0.6
0
0
0
0
0
0
0
0
0
0
0.227273
0.22807
57
3
35
19
0.5
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
c51f2b7188a2243acbdaebda33c0bece852ed7de
95
py
Python
examples/tutorial/workerpy.py
photoszzt/scanner
712796dffed7411791499b9226a57410b4ce216c
[ "Apache-2.0" ]
1
2021-06-27T08:00:04.000Z
2021-06-27T08:00:04.000Z
examples/tutorial/workerpy.py
photoszzt/scanner
712796dffed7411791499b9226a57410b4ce216c
[ "Apache-2.0" ]
1
2017-10-26T03:22:56.000Z
2017-10-26T03:22:56.000Z
examples/tutorial/workerpy.py
qinglan233/scanner
61ce0d35e49c92cab265b746bd55ae75ab57fb42
[ "Apache-2.0" ]
1
2019-05-10T19:44:44.000Z
2019-05-10T19:44:44.000Z
from scannerpy import Database db = Database() db.start_worker() import time time.sleep(1000)
13.571429
30
0.778947
14
95
5.214286
0.714286
0.273973
0
0
0
0
0
0
0
0
0
0.048193
0.126316
95
7
31
13.571429
0.831325
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
c54a337a0fe1595d349bfad5701b622f54924570
6,856
py
Python
src/game/level06.py
btdevel/bt
23abdf0860484a4adcfbe2bcbe94eebca7f820fd
[ "MIT" ]
1
2017-06-30T00:35:05.000Z
2017-06-30T00:35:05.000Z
src/game/level06.py
btdevel/bt
23abdf0860484a4adcfbe2bcbe94eebca7f820fd
[ "MIT" ]
null
null
null
src/game/level06.py
btdevel/bt
23abdf0860484a4adcfbe2bcbe94eebca7f820fd
[ "MIT" ]
null
null
null
################################################################################ level_number = 6 dungeon_name = 'Catacombs' wall_style = 'Catacombs' monster_difficulty = 3 goes_down = True entry_position = (0, 0) phase_door = False level_teleport = [ (4, True), (5, True), (6, False), ] stairs_previous = [(13, 11)] stairs_next = [] portal_down = [] portal_up = [] teleports = [ ((0, 21), (10, 7)), ((21, 15), (13, 17)), ((20, 19), (8, 11)), ((16, 21), (14, 21)), ] encounters = [ ((1, 0), (60, 7)), ((3, 9), (51, 36)), ((4, 13), (30, 69)), ((7, 17), (10, 99)), ((8, 5), (10, 99)), ((16, 13), (20, 66)), ((18, 14), (20, 53)), ((21, 0), (60, 8)), ] messages = [ ((20, 16), "A message is scrawled on the wall in blood:\nSeek the Mad One's stoney self in Harkyn's domain."), ] specials = [((19, 20), (22, 255))] smoke_zones = [] darkness = [(3, 17), (3, 18), (4, 17), (4, 18), (5, 17), (5, 18), (6, 17), (6, 18)] antimagic_zones = [(13, 18), (13, 19), (13, 20), (14, 17), (14, 18), (14, 19), (14, 20), (18, 20)] spinners = [(9, 9), (12, 13), (18, 6)] traps = [(3, 19), (4, 19), (4, 20), (7, 14), (9, 2), (10, 15), (11, 4), (11, 12), (12, 16), (15, 6), (16, 3), (17, 6)] hitpoint_damage = [] spellpoint_restore = [] stasis_chambers = [] random_encounter = [(0, 4), (0, 8), (1, 16), (2, 5), (2, 7), (3, 0), (3, 13), (4, 5), (4, 11), (5, 1), (6, 8), (6, 11), (7, 1), (7, 2), (7, 3), (7, 4), (9, 3), (9, 4), (9, 8), (10, 1), (11, 3), (11, 4), (11, 7), (12, 21), (13, 0), (13, 3), (13, 14), (14, 0), (14, 12), (14, 21), (16, 0), (16, 17), (16, 19), (17, 21), (19, 2), (19, 9), (19, 13), (19, 17), (19, 19), (19, 21), (21, 5), (21, 9)] specials_other = [(0, 0), (0, 15), (1, 16), (1, 19), (2, 20), (3, 6), (3, 14), (3, 20), (5, 13), (5, 21), (7, 17), (7, 18), (7, 19), (7, 20), (8, 18), (8, 19), (8, 20), (9, 13), (12, 9), (13, 5), (14, 17), (17, 13), (18, 9), (20, 0), (21, 21)] map = [ '+-++-------++-++---D---++-++----------++----++-++----++----------+', '| DD DD || DD || || || || || |', '+-++-----. |+-++--. .--++-+| .------. || .. || || .. || .------. |', '+--------. |+----+| |+----+| .-----+| || || .. || .. || |+----+| |', '| || || || || || || || || || || || |', '+D---------+| .. || || .. |+-----. || || |+----++D---+| || .. || |', '+D---++----+| .. || || .. |+----+| || .. |+----++D----. || .. || |', '| || || DD DD || || || || || || || |', '| .. || .. |+---D+| |+D---+| .. || |+---D+| .. || .-----++---D+| |', '| .. || .. .----D-. .-D----. .. || .--++D+| .. || |+----++---D+| |', '| DD DD || || || || || || |', '+D---+| .. .----D-. .-D----. .. |+--. |+D++D---+| || .. || .--+| |', '+D---+| .. |+---D+| |+D---+| .. |+-+| |+D++D----. || || || .--+| |', '| || || DD DD || || DD || || || || || || |', '| .. |+----+| .. || || .. |+----++-+| |+D+| .. .. || || |+---D+| |', '| .. |+----+| .. || || .. |+--------. |+D+| .. .. || || |+---D+| |', '| DD || || || || || || || || || || |', '+----+| .. |+----+| |+----+| .----D---++-+| .. .. || || || .. || |', '+-----. .. |+-++--. .--++-+| |+---D++-----. .. .. || || .. .. || |', '| DD || DD || || || || || || |', '| .--------++-++---D---++-+| || .. || .. .. .. .. || |+-------+| |', '| |+-++-++-++-++-++----++--. || .. || .. .. .. .. || .--------+| |', '| || || || || || || || || || || || |', '+D++D++D++D++D++D++--. |+D---++----+| .. .. .. .. |+--------. || |', '+D++D++D++D++D++D++-+| |+D---++-----. .. .. .. .. |+--------. || |', '| DD DD || DD || DD || || || || || |', '+-++D++-++-++D+| |+-+| || .. || .. .. .-D-. .. .. |+----------+| |', '+-++D++-++-++D+| |+-+| || .. || .. .. |+D+| .. .. .------------. |', '| DD DD DD || DD DD || DD || DD DD |', '+D++-++-++D++-++D++-++D++----+| .. .. |+D+| .. .. .. .. .. .-D---+', '+D++-++-++D++-++D++-++D++-----. .. .. .-D-. .. .. .. .. .. |+D---+', '| || || DD DD DD DD || || || |', '+D++D++D++-++-++-++-++D+| .. .. .. .. .. .. .. .. .. .-D---+| .. |', '+D--D--D++-++-++-++-++D+| .. .. .. .. .. .. .. .. .. |+D---+| .. |', '| DD || DD DD || || || || |', '+D----. |+-++-++D++-++-+| .-D-. .. .. .. .. .. .-D---+| .. || .-D+', '+D++-+| |+-++-++D++-----. |+D+| .. .. .. .. .. |+D---+| .. || |+D+', '| || || DD || DD DD DD DD || || || DD |', '+-++D+| |+-++D++-+| .. .. |+D+| .. .. .. .-D---+| .. || .-D+| |+-+', '+-++D+| |+-++D++-+| .. .. .-D-. .. .. .. |+D---+| .. || |+D+| |+-+', '| DD || DD DD || DD || || || DD || DD |', '+-++D++D+| |+-++-+| .. .. .. .. .. .-D---+| .. || .-D+| |+-+| |+-+', '+-++D--D+| |+-----. .. .. .. .. .. |+D---+| .. || |+D+| |+-+| |+-+', '| DD DD || || || || DD || DD || DD |', '+-+| .. |+-+| .. .. .. .. .. .-D---+| .. || .-D+| |+-+| |+-+| |+-+', '+-+| .. |+-+| .. .. .. .. .. |+D---+| .. || |+D+| |+-+| |+-+| |+-+', '| DD DD || || || || DD || DD || DD || DD |', '+-++D---++D+| .. .. .. .-D---+| .. || .-D+| |+-+| |+-+| |+-+| |+-+', '+-++D++---D-. .. .. .. |+D---+| .. || |+D+| |+-+| |+-+| |+-+| |+-+', '| DD || || || || DD || DD || DD || DD || DD |', '+-+| || .. .. .. .-D---+| .. || .-D+| |+-+| |+-+| |+-+| |+-+| |+-+', '+-+| || .. .. .. |+D---+| .. || |+D+| |+-+| |+-+| |+-+| |+-+| |+-+', '| DD || || || || DD || DD || DD || DD || DD || DD |', '+-++D+| .. .-D---+| .. || .-D+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+', '+---D-. .. |+D---+| .. || |+D+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+', '| || || || DD || DD || DD || DD || DD || DD || DD |', '| .. .-D---+| .. || .-D+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+', '| .. |+D---+| .. || |+D+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+', '| || || || DD || DD || DD || DD || DD || DD || DD || DD |', '+D---+| .. || .-D+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+', '+D---+| .. || |+D+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+', '| || || DD || DD || DD || DD || DD || DD || DD || DD || DD |', '| .. || .-D+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+', '| .. || |+D+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+| |+-+', '| || DD || DD || DD || DD || DD || DD || DD || DD || DD || DD |', '+----++-++-++-++-++-++-++-++-++-++-++-++-++-++-++-++-++-++-++-++-+', ]
56.196721
393
0.169924
566
6,856
2.024735
0.164311
0.195462
0.243456
0.265271
0.293194
0.293194
0.293194
0.293194
0.293194
0.283595
0
0.085956
0.309364
6,856
121
394
56.661157
0.156072
0
0
0.017544
0
0.166667
0.659631
0.050185
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
c56b8840f1f8049c394b6206c20123aaf3f5c1b6
517
py
Python
tests/platform/mellanox/test_hw_management_service.py
jerry-chang3300/sonic-mgmt
9814959583e491997678f8ad7dc763e408340b77
[ "Apache-2.0" ]
1
2021-09-15T17:09:13.000Z
2021-09-15T17:09:13.000Z
tests/platform/mellanox/test_hw_management_service.py
jerry-chang3300/sonic-mgmt
9814959583e491997678f8ad7dc763e408340b77
[ "Apache-2.0" ]
null
null
null
tests/platform/mellanox/test_hw_management_service.py
jerry-chang3300/sonic-mgmt
9814959583e491997678f8ad7dc763e408340b77
[ "Apache-2.0" ]
null
null
null
""" Verify that the hw-management service is running properly This script covers test case 'Ensure that the hw-management service is running properly' in the SONiC platform test plan: https://github.com/Azure/SONiC/blob/master/doc/pmon/sonic_platform_test_plan.md """ from check_hw_mgmt_service import check_hw_management_service def test_hw_management_service_status(duthost): """This test case is to verify that the hw-management service is running properly """ check_hw_management_service(duthost)
34.466667
115
0.802708
79
517
5.050633
0.455696
0.180451
0.285714
0.142857
0.353383
0.353383
0.353383
0.353383
0.245614
0
0
0
0.129594
517
14
116
36.928571
0.886667
0.665377
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0
0.666667
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
4
3d6f2703e549da2bc46c94cf204784cea73f5c67
143
py
Python
applitools/selenium/capture/__init__.py
applitools/eyes.selenium.python
3a09a3372a3a8915b3c97ee54fc223580c45c0a3
[ "Apache-2.0" ]
11
2016-04-20T21:21:37.000Z
2020-04-27T19:46:56.000Z
applitools/selenium/capture/__init__.py
applitools/eyes.selenium.python
3a09a3372a3a8915b3c97ee54fc223580c45c0a3
[ "Apache-2.0" ]
15
2017-01-11T04:58:31.000Z
2019-09-13T18:00:35.000Z
applitools/selenium/capture/__init__.py
applitools/eyes.selenium.python
3a09a3372a3a8915b3c97ee54fc223580c45c0a3
[ "Apache-2.0" ]
15
2016-03-23T22:06:39.000Z
2020-06-14T09:11:58.000Z
from . import dom_capture from .eyes_webdriver_screenshot import EyesWebDriverScreenshot __all__ = ('dom_capture', 'EyesWebDriverScreenshot')
28.6
62
0.839161
14
143
8
0.642857
0.178571
0
0
0
0
0
0
0
0
0
0
0.090909
143
4
63
35.75
0.861538
0
0
0
0
0
0.237762
0.160839
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
3d810b6b1a72ac5871b27f1afe2df836c21e7add
9,596
py
Python
services/http/server.py
rongyj/geometry_state_services
dfc82a3ededae2d041b2922b1c5f789f189db851
[ "MIT" ]
null
null
null
services/http/server.py
rongyj/geometry_state_services
dfc82a3ededae2d041b2922b1c5f789f189db851
[ "MIT" ]
null
null
null
services/http/server.py
rongyj/geometry_state_services
dfc82a3ededae2d041b2922b1c5f789f189db851
[ "MIT" ]
null
null
null
#!/usr/bin/env python3.7 import sys,json, socket from http.server import BaseHTTPRequestHandler, HTTPServer import services.model.states class StatesHTTPRequestHandler(BaseHTTPRequestHandler): states=None GET_STATES_PATH = "/states" def _set_headers(self, response_code=200, content_type='application/json'): ''' set headers :param response_code: http response code, default to 200 :param content_type: http response content type. default to applicaiton/json :return: None ''' self.send_response(response_code) self.send_header('Content-type', content_type) self.end_headers() def do_GET(self): ''' GET: "/states" @return: {'Washington': [[-122.402015, 48.225216], [-117.032049, 48.999931], [-116.919132, 45.995175], [-124.079107, 46.267259], [-124.717175, 48.377557], [-122.92315, 47.047963], [-122.402015, 48.225216]], 'Montana': [[-111.475425, 44.702162], [-114.560924, 45.54874], [-116.063531, 48.99995], [-104.062991, 49.000026], [-104.043072, 44.997805], [-111.475425, 44.702162]], 'Maine': [[-69.777276, 44.074148], [-70.818668, 43.121871], [-71.087509, 45.301469], [-68.230807, 47.352148], [-66.969271, 44.828655], [-69.777276, 44.074148]], 'North Dakota': [[-98.730437, 45.938271], [-104.048906, 45.942993], [-104.062991, 49.000026], [-97.229436, 48.999987], [-96.566921, 45.93411], [-98.730437, 45.938271]], 'South Dakota': [[-102.788384, 42.995303], [-104.056199, 43.003062], [-104.048906, 45.942993], [-96.566921, 45.93411], [-96.439394, 42.48924], [-102.788384, 42.995303]], 'Wyoming': [[-104.053615, 41.698218], [-111.051022, 40.996583], [-111.053428, 44.995695], [-104.059842, 44.997336], [-104.053615, 41.698218]], 'Wisconsin': [[-87.748555, 44.961616], [-87.797382, 42.489152], [-90.638456, 42.509363], [-92.885397, 45.644955], [-90.86173, 46.952479], [-87.748555, 44.961616]], 'Idaho': [[-117.026295, 43.679031], [-116.063531, 48.99995], [-114.560924, 45.54874], [-111.05156, 44.473323], [-111.048697, 41.996203], [-117.018864, 41.994794], [-117.026295, 43.679031]], 'Vermont': [[-73.25806, 42.746058], [-73.344723, 45.006138], [-71.505372, 45.013351], [-73.25806, 42.746058]], 'Minnesota': [[-91.730366, 43.499571], [-96.460454, 43.499718], [-97.229436, 48.999987], [-89.530673, 48.001656], [-92.860019, 45.710562], [-91.730366, 43.499571]], 'Oregon': [[-121.441509, 41.994334], [-124.352246, 42.098677], [-123.97734, 46.202706], [-116.528275, 45.710728], [-117.018864, 41.994794], [-121.441509, 41.994334]], 'New Hampshire': [[-72.279917, 42.720467], [-71.087509, 45.301469], [-70.81388, 42.867065], [-72.279917, 42.720467]], 'Iowa': [[-91.120132, 40.705443], [-95.767479, 40.589048], [-96.598315, 43.499849], [-91.223566, 43.500808], [-90.142796, 41.983989], [-91.120132, 40.705443]], 'Massachusetts': [[-71.319328, 41.772195], [-73.49884, 42.07746], [-70.898111, 42.886877], [-69.91778, 41.767653], [-71.319328, 41.772195]], 'Nebraska': [[-101.407393, 40.001003], [-104.051705, 41.003211], [-104.056199, 43.003062], [-96.81014, 42.704084], [-95.308697, 39.999407], [-101.407393, 40.001003]], 'New York': [[-79.763235, 42.267327], [-73.344723, 45.006138], [-74.006183, 40.704002], [-79.763235, 42.267327]], 'Pennsylvania': [[-77.475793, 39.719623], [-80.524269, 39.721209], [-80.520592, 41.986872], [-74.705273, 41.375059], [-75.142901, 39.881602], [-77.475793, 39.719623]], 'Indiana': [[-86.341606, 38.177288], [-88.086062, 37.817657], [-87.529906, 41.723626], [-84.788478, 41.760959], [-84.81878, 38.79341], [-86.341606, 38.177288]], 'Nevada': [[-119.15245, 38.411801], [-119.993459, 41.989205], [-114.039072, 41.995391], [-114.621068, 34.998914], [-119.15245, 38.411801]], 'Utah': [[-114.047273, 38.137652], [-114.039072, 41.995391], [-109.048314, 40.998433], [-109.04848, 36.996641], [-114.043939, 36.996538], [-114.047273, 38.137652]], 'California': [[-121.66522, 38.169285], [-123.721901, 38.924771], [-124.206444, 41.997648], [-119.993459, 41.989205], [-119.995254, 38.994106], [-114.621068, 34.998914], [-114.461436, 32.845422], [-117.128098, 32.535781], [-120.641293, 34.572337], [-121.66522, 38.169285]], 'Ohio': [[-83.272755, 38.609257], [-84.81148, 39.102585], [-84.790377, 41.697494], [-80.520592, 41.986872], [-80.88111, 39.624081], [-83.272755, 38.609257]], 'Illinois': [[-88.071591, 37.511038], [-89.383028, 37.049263], [-91.44934, 39.863094], [-90.638456, 42.509363], [-87.797382, 42.489152], [-88.071591, 37.511038]], 'West Virginia': [[-79.231663, 38.480496], [-81.556654, 37.206352], [-82.646128, 38.14633], [-80.521999, 40.637203], [-77.771551, 39.498115], [-79.231663, 38.480496]], 'Maryland': [[-75.710712, 38.649665], [-79.480971, 39.720274], [-75.791094, 39.723866], [-75.710712, 38.649665]], 'Colorado': [[-102.044456, 37.641474], [-109.04848, 36.996641], [-109.048314, 40.998433], [-102.047739, 40.998071], [-102.044456, 37.641474]], 'Kentucky': [[-86.510668, 36.655074], [-89.41821, 36.510625], [-84.742875, 39.142063], [-81.959575, 37.531172], [-86.510668, 36.655074]], 'Kansas': [[-95.071931, 37.001478], [-102.037207, 36.988994], [-102.051535, 39.998918], [-94.938243, 39.896081], [-95.071931, 37.001478]], 'Virginia': [[-79.144063, 36.546198], [-83.675177, 36.598704], [-78.347546, 39.456998], [-75.877811, 36.556028], [-79.144063, 36.546198]], 'Missouri': [[-89.105034, 36.953922], [-94.617257, 36.489414], [-95.767479, 40.589048], [-91.741711, 40.609784], [-89.105034, 36.953922]], 'Arizona': [[-114.520627, 33.027707], [-114.043939, 36.996538], [-109.04848, 36.996641], [-109.045615, 31.343453], [-114.520627, 33.027707]], 'Oklahoma': [[-94.439322, 34.929151], [-94.500816, 33.623162], [-97.870062, 33.855214], [-99.996475, 34.562384], [-100.00155, 36.492554], [-102.997709, 36.998523], [-94.620379, 36.997046], [-94.439322, 34.929151]], 'North Carolina': [[-83.988454, 34.989151], [-81.669835, 36.589767], [-75.728989, 35.665346], [-78.034518, 33.914465], [-83.988454, 34.989151]], 'Tennessee': [[-83.954608, 35.455544], [-90.305448, 35.000788], [-89.533272, 36.49817], [-81.652272, 36.607673], [-83.954608, 35.455544]], 'Texas': [[-105.998886, 31.39394], [-103.058413, 32.002022], [-103.027286, 36.491591], [-100.007273, 36.493912], [-99.685277, 34.37752], [-94.036116, 33.556034], [-93.507389, 31.039099], [-97.521969, 27.863927], [-97.434607, 25.845557], [-101.401663, 29.770111], [-103.2808, 28.986582], [-105.998886, 31.39394]], 'New Mexico': [[-109.049495, 32.442044], [-109.04848, 36.996641], [-102.997709, 36.998523], [-103.058413, 32.002022], [-109.045615, 31.343453], [-109.049495, 32.442044]], 'Alabama': [[-85.070067, 31.980703], [-88.401415, 30.393551], [-88.194962, 35.013544], [-85.60896, 34.990164], [-85.070067, 31.980703]], 'Mississippi': [[-88.450803, 31.435617], [-88.464237, 30.326076], [-91.632297, 31.001365], [-90.305448, 35.000788], [-88.090468, 34.895629], [-88.450803, 31.435617]], 'Georgia': [[-85.130165, 31.778853], [-85.60896, 34.990164], [-83.106157, 35.000366], [-80.894753, 32.005994], [-82.052767, 30.363794], [-85.130165, 31.778853]], 'South Carolina': [[-81.759593, 33.195381], [-83.106157, 35.000366], [-78.579453, 33.882164], [-80.892914, 32.068173], [-81.759593, 33.195381]], 'Arkansas': [[-94.461691, 34.196765], [-94.617257, 36.489414], [-89.645479, 35.913873], [-91.162241, 33.013162], [-94.461691, 34.196765]], 'Louisiana': [[-93.707524, 30.239578], [-94.038931, 33.023422], [-91.162241, 33.013162], [-91.632297, 31.001365], [-89.723623, 31.001524], [-89.021803, 29.147118], [-93.707524, 30.239578]], 'Florida': [[-80.785662, 28.785194], [-81.119016, 25.134188], [-82.802157, 29.155132], [-87.59858, 31.00263], [-81.528595, 30.721452], [-80.785662, 28.785194]]} ''' try: if(self.path==self.GET_STATES_PATH): json_response = self.get_states_response() else: json_response=json.dumps({}) self._set_headers(200, 'application/json') self.wfile.write(json_response) except (KeyError, ValueError) as kvErr: self._set_headers(500, 'text/html') self.wfile.write("Key or Value Error: Please validate the query string") print("Error message:", kvErr) except TypeError as typeErr: self._set_headers(500, 'text/html') self.wfile.write("Type Error happened in the server side.") print("Type error:", typeErr) except: self._set_headers(500, 'text/html') self.wfile.write("Unexpected Error happened in the server side") print("Unexpected error:", sys.exc_info()[0]) raise def get_states_response(self): ''' load the states from file :return: json object for states ''' #Load the States from the json data file if it is not loaded if StatesHTTPRequestHandler.states is None: StatesHTTPRequestHandler.states=services.model.states.States().to_json().encode() return StatesHTTPRequestHandler.states def run(server_class=HTTPServer, handler_class=StatesHTTPRequestHandler, port=9595): ''' Starts the HTTPServer with StatesHTTPRequestHandler at the given port (default: 8080) ''' server_address = ("0.0.0.0", port) http_server = server_class(server_address, handler_class) print('Starting State HTTP server...') http_server.serve_forever() if __name__ == '__main__': ''' Run this python script ''' if len(sys.argv) > 1 and type(sys.argv[1]) == type(int): run(port=int(sys.argv[1])) else: run()
105.450549
6,956
0.632659
1,363
9,596
4.417461
0.426266
0.009965
0.006643
0.010629
0.036705
0.030394
0.030394
0.019432
0.019432
0
0
0.492369
0.132868
9,596
90
6,957
106.622222
0.231222
0.766153
0
0.111111
0
0
0.14375
0
0
0
0
0
0
1
0.088889
false
0
0.066667
0
0.244444
0.088889
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
1
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
3dcf40c6fbef729e784d4b6a62be37e1236fbc27
177
py
Python
django_project/apps/dashboard/models.py
robabram/Quickstart-Secure-Django-Template
22f304e864f8f6ce972f44bce6fe9b885341201a
[ "MIT" ]
9
2018-10-03T00:30:57.000Z
2021-12-29T07:48:08.000Z
django_project/apps/dashboard/models.py
robabram/Quickstart-Secure-Django-Template
22f304e864f8f6ce972f44bce6fe9b885341201a
[ "MIT" ]
9
2020-02-10T17:08:01.000Z
2021-11-19T17:21:18.000Z
django_project/apps/dashboard/models.py
robabram/Quickstart-Secure-Django-Template
22f304e864f8f6ce972f44bce6fe9b885341201a
[ "MIT" ]
null
null
null
# # Author: Robert Abram <rabram991@gmail.com> # # This file is subject to the terms and conditions defined in the # file 'LICENSE', which is part of this source code package. #
29.5
65
0.740113
28
177
4.678571
0.857143
0
0
0
0
0
0
0
0
0
0
0.020548
0.175141
177
6
66
29.5
0.876712
0.932203
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
3dd121dcb3d0b2c95feffd40d6d2f89c06ae439b
1,072
py
Python
otp/distributed/OTPInternalRepository.py
TopDeveloper-333/opentoontownsrc
b2d956d1a40f5e3d40fa33a9f01862137e018347
[ "BSD-3-Clause" ]
null
null
null
otp/distributed/OTPInternalRepository.py
TopDeveloper-333/opentoontownsrc
b2d956d1a40f5e3d40fa33a9f01862137e018347
[ "BSD-3-Clause" ]
null
null
null
otp/distributed/OTPInternalRepository.py
TopDeveloper-333/opentoontownsrc
b2d956d1a40f5e3d40fa33a9f01862137e018347
[ "BSD-3-Clause" ]
null
null
null
from direct.directnotify import DirectNotifyGlobal from direct.distributed.AstronInternalRepository import AstronInternalRepository # TODO: Remove Astron dependence. class OTPInternalRepository(AstronInternalRepository): notify = DirectNotifyGlobal.directNotify.newCategory('OTPInternalRepository') dbId = 4003 def __init__(self, baseChannel, serverId, dcFileNames, dcSuffix, connectMethod, threadedNet): AstronInternalRepository.__init__(self, baseChannel, serverId=serverId, dcFileNames=dcFileNames, dcSuffix=dcSuffix, connectMethod=connectMethod, threadedNet=threadedNet) def handleConnected(self): AstronInternalRepository.handleConnected(self) def getAccountIdFromSender(self): return (self.getMsgSender() >> 32) & 0xFFFFFFFF def getAvatarIdFromSender(self): return self.getMsgSender() & 0xFFFFFFFF def sendSetZone(self, distObj, zoneId): distObj.setLocation(distObj.parentId, zoneId) self.sendSetLocation(distObj, distObj.parentId, zoneId)
39.703704
114
0.75
85
1,072
9.364706
0.458824
0.025126
0.047739
0.067839
0
0
0
0
0
0
0
0.00905
0.175373
1,072
26
115
41.230769
0.891403
0.028918
0
0
0
0
0.020212
0.020212
0
0
0.019249
0.038462
0
1
0.294118
false
0
0.117647
0.117647
0.705882
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
1
1
0
0
4
9a72a12201271ada369d693811d19268f5000cbb
213
py
Python
commissioning/printversion.py
dobos/pysynphot
5d2e0b52ceda78890940ac9239c2d88e149e0bed
[ "BSD-3-Clause" ]
24
2015-01-04T23:38:21.000Z
2022-02-01T00:11:07.000Z
commissioning/printversion.py
dobos/pysynphot
5d2e0b52ceda78890940ac9239c2d88e149e0bed
[ "BSD-3-Clause" ]
126
2015-01-29T14:50:37.000Z
2022-02-15T01:58:13.000Z
commissioning/printversion.py
dobos/pysynphot
5d2e0b52ceda78890940ac9239c2d88e149e0bed
[ "BSD-3-Clause" ]
25
2015-02-09T12:12:02.000Z
2021-09-09T13:06:54.000Z
from __future__ import print_function import pysynphot as S from pysynphot import observationmode as O print("S.__svn_revision__: %s"%S.__svn_revision__) print(O.GRAPHTABLE) print(O.COMPTABLE) print(O.THERMTABLE)
26.625
50
0.826291
32
213
5.03125
0.46875
0.111801
0.149068
0
0
0
0
0
0
0
0
0
0.089202
213
7
51
30.428571
0.829897
0
0
0
0
0
0.103286
0
0
0
0
0
0
1
0
true
0
0.428571
0
0.428571
0.714286
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
1
0
1
0
0
1
0
4
9ab52eed67bf17cf57c969080b4b70f9f2774c69
54
py
Python
examples/comprehension_with_function.py
doboy/Underscore
d98273db3144cda79191d2c90f45d81b6d700b1f
[ "MIT" ]
7
2016-09-23T00:44:05.000Z
2021-10-04T21:19:12.000Z
examples/comprehension_with_function.py
jameswu1991/Underscore
d98273db3144cda79191d2c90f45d81b6d700b1f
[ "MIT" ]
1
2016-09-23T00:45:05.000Z
2019-02-16T19:05:37.000Z
examples/comprehension_with_function.py
jameswu1991/Underscore
d98273db3144cda79191d2c90f45d81b6d700b1f
[ "MIT" ]
3
2016-09-23T01:13:15.000Z
2018-07-20T21:22:17.000Z
def foo(x): print(x) foo([x for x in range(10)])
10.8
27
0.555556
12
54
2.5
0.666667
0.266667
0
0
0
0
0
0
0
0
0
0.04878
0.240741
54
4
28
13.5
0.682927
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.333333
0.333333
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
9acd6844279716ba7f5078fed6240c8ac171e3d2
494
py
Python
src/feedinlib/__init__.py
fwitte/feedinlib
d60d139dc3f7881cabc0b2f0efde5daf60cc64e4
[ "MIT" ]
67
2015-09-21T09:37:47.000Z
2022-02-23T19:32:36.000Z
src/feedinlib/__init__.py
fwitte/feedinlib
d60d139dc3f7881cabc0b2f0efde5daf60cc64e4
[ "MIT" ]
61
2015-10-09T18:52:42.000Z
2022-02-28T16:02:46.000Z
src/feedinlib/__init__.py
fwitte/feedinlib
d60d139dc3f7881cabc0b2f0efde5daf60cc64e4
[ "MIT" ]
31
2015-10-14T16:00:49.000Z
2022-03-23T00:39:23.000Z
__copyright__ = "Copyright oemof developer group" __license__ = "MIT" __version__ = '0.1.0rc4' from . import era5 # noqa: F401 from .models import GeometricSolar # noqa: F401 from .models import Pvlib # noqa: F401 from .models import WindpowerlibTurbine # noqa: F401 from .models import WindpowerlibTurbineCluster # noqa: F401 from .models import get_power_plant_data # noqa: F401 from .powerplants import Photovoltaic # noqa: F401 from .powerplants import WindPowerPlant # noqa: F401
38
60
0.773279
61
494
6.016393
0.442623
0.174387
0.228883
0.245232
0.485014
0
0
0
0
0
0
0.069544
0.15587
494
12
61
41.166667
0.810552
0.176113
0
0
0
0
0.105528
0
0
0
0
0
0
1
0
false
0
0.727273
0
0.727273
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
9af3bfa23ebf0337d65942896f3cc89f9cde729a
989
py
Python
utils/restful.py
Mhh123/django
d5c607102bbfa5274895766a134388f379ea0da4
[ "Apache-2.0" ]
null
null
null
utils/restful.py
Mhh123/django
d5c607102bbfa5274895766a134388f379ea0da4
[ "Apache-2.0" ]
null
null
null
utils/restful.py
Mhh123/django
d5c607102bbfa5274895766a134388f379ea0da4
[ "Apache-2.0" ]
null
null
null
#encoding: utf-8 from django.http import JsonResponse, HttpResponse class HttpCode(object): ok = 200 paramserror = 400 unauth = 401 methoderror = 405 servererror = 500 # {"code":400,"message":"","data":{}} def result(code=HttpCode.ok,message="",data=None,kwargs=None): json_dict = {"code":code,"message":message,"data":data} if kwargs and isinstance(kwargs,dict) and kwargs.keys(): json_dict.update(kwargs) return JsonResponse(json_dict) def ok(): return result() def params_error(message="",data=None): return result(code=HttpCode.paramserror,message=message,data=data) def unauth(message="",data=None): return result(code=HttpCode.unauth,message=message,data=data) def method_error(message='',data=None): return result(code=HttpCode.methoderror,message=message,data=data) def server_error(message='',data=None): return result(code=HttpCode.servererror,message=message,data=data)
26.72973
71
0.689585
124
989
5.451613
0.330645
0.178994
0.133136
0.162722
0.363905
0.252959
0.252959
0.195266
0
0
0
0.023143
0.169869
989
36
72
27.472222
0.800244
0.051567
0
0
0
0
0.016685
0
0
0
0
0
0
1
0.272727
false
0
0.045455
0.227273
0.863636
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
9af6f1943a84501280234a90db950530fcf9f59e
175
py
Python
instance/config.py
northwestwitch/cgbeacon_UI
c7a70a784e667ed9790d3b5336d7cb3c7d6992ce
[ "MIT" ]
null
null
null
instance/config.py
northwestwitch/cgbeacon_UI
c7a70a784e667ed9790d3b5336d7cb3c7d6992ce
[ "MIT" ]
null
null
null
instance/config.py
northwestwitch/cgbeacon_UI
c7a70a784e667ed9790d3b5336d7cb3c7d6992ce
[ "MIT" ]
null
null
null
# instance/config.cfg SQLALCHEMY_DATABASE_URI= \ "mysql://microaccounts_dev:r783qjkldDsiu@localhost:3306/elixir_beacon_testing" SECRET_KEY= \ "nsady679d8+eiqåowm´´`msdjjwi"
21.875
78
0.817143
22
175
6.318182
0.954545
0
0
0
0
0
0
0
0
0
0
0.066667
0.057143
175
7
79
25
0.763636
0.108571
0
0
0
0
0.675325
0.675325
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
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
b10c716029cb215f18ef34ac345fb3da23372a56
168
py
Python
pyzhmh/__init__.py
zhmhbest/python-zhmh
2b2e381b972d02915f328ed1791c8ceea9d8d21f
[ "MIT" ]
3
2020-09-10T05:12:31.000Z
2020-09-24T10:44:49.000Z
pyzhmh/__init__.py
zhmhbest/python-zhmh
2b2e381b972d02915f328ed1791c8ceea9d8d21f
[ "MIT" ]
null
null
null
pyzhmh/__init__.py
zhmhbest/python-zhmh
2b2e381b972d02915f328ed1791c8ceea9d8d21f
[ "MIT" ]
1
2021-04-15T09:03:23.000Z
2021-04-15T09:03:23.000Z
from .rich import RichPrint from .magic import __dirname__, __line__, __fun__, __assert__ from .download import download_one_file, unpack_one_file __VERSION = '0.0.10'
33.6
61
0.815476
24
168
4.791667
0.666667
0.121739
0
0
0
0
0
0
0
0
0
0.026846
0.113095
168
4
62
42
0.744966
0
0
0
0
0
0.035714
0
0
0
0
0
0.25
1
0
false
0
0.75
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
b1152966380ea0d445301d0187c28e0c767d2a3c
483
py
Python
zolo/exceptions.py
firefirer1983/zolo
889409b491363eb54c2997e01333b77bc81e0c89
[ "MIT" ]
2
2021-05-06T12:10:02.000Z
2021-08-15T09:25:31.000Z
zolo/exceptions.py
firefirer1983/zolo
889409b491363eb54c2997e01333b77bc81e0c89
[ "MIT" ]
null
null
null
zolo/exceptions.py
firefirer1983/zolo
889409b491363eb54c2997e01333b77bc81e0c89
[ "MIT" ]
null
null
null
class MarginGetError(Exception): pass class PositionGetError(Exception): pass class TickGetError(Exception): pass class TradeGetError(Exception): pass class BarGetError(Exception): pass class FillGetError(Exception): pass class OrderPostError(Exception): pass class OrderGetError(Exception): pass class OrderBookGetError(Exception): pass class BalanceGetError(Exception): pass class AssetTransferError(Exception): pass
11.232558
36
0.730849
44
483
8.022727
0.318182
0.405099
0.509915
0
0
0
0
0
0
0
0
0
0.200828
483
42
37
11.5
0.914508
0
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
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
1
0
0
0
0
0
4
b1308f04493e4162eb0a4d896a64fd749aea891e
209
py
Python
TelegramSheduleBot/config.py
VladislavYU/SheduleUGRASUBot
335047bb7f29e0a696a2f8f91709752a8c5c7e23
[ "Apache-2.0" ]
null
null
null
TelegramSheduleBot/config.py
VladislavYU/SheduleUGRASUBot
335047bb7f29e0a696a2f8f91709752a8c5c7e23
[ "Apache-2.0" ]
null
null
null
TelegramSheduleBot/config.py
VladislavYU/SheduleUGRASUBot
335047bb7f29e0a696a2f8f91709752a8c5c7e23
[ "Apache-2.0" ]
null
null
null
TOKEN = '668308467:AAETX4hdMRnVvYVBP4bK5WDgvL8zIXoHq5g' main_url = 'https://schedule.vekclub.com/api/v1/' list_group = 'handbook/groups-by-institution?institutionId=4' shedule_group ='schedule/group?groupId='
41.8
61
0.808612
24
209
6.916667
0.875
0
0
0
0
0
0
0
0
0
0
0.080808
0.052632
209
5
62
41.8
0.757576
0
0
0
0
0
0.714286
0.542857
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
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
b13fa83db2ab1579f29922a8084979ce855a36a5
185
py
Python
anima/exc.py
MehmetErer/anima
f92ae599b5a4c181fc8e131a9ccdde537e635303
[ "MIT" ]
101
2015-02-08T22:20:11.000Z
2022-03-21T18:56:42.000Z
anima/exc.py
Khosiyat/anima
f631c08400547f49ac5f1feeb730f22c255eb771
[ "MIT" ]
23
2016-11-30T08:33:21.000Z
2021-01-26T12:11:12.000Z
anima/exc.py
Khosiyat/anima
f631c08400547f49ac5f1feeb730f22c255eb771
[ "MIT" ]
27
2015-01-03T06:49:45.000Z
2021-12-28T03:30:54.000Z
# -*- coding: utf-8 -*- """This module contains exceptions """ class PublishError(RuntimeError): """Raised when the published version is not matching the quality """ pass
18.5
68
0.664865
21
185
5.857143
0.952381
0
0
0
0
0
0
0
0
0
0
0.006803
0.205405
185
9
69
20.555556
0.829932
0.654054
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
4
b1689cad0c9124f502eb0ab2f5fb119c5bf7bbd1
27
py
Python
django_api_forms/version.py
Sibyx/django_request_formatter
bd7aac04121fa14b68a9e33ebf70da2a0dde2b75
[ "MIT" ]
1
2019-12-11T14:05:46.000Z
2019-12-11T14:05:46.000Z
django_api_forms/version.py
Sibyx/django_request_formatter
bd7aac04121fa14b68a9e33ebf70da2a0dde2b75
[ "MIT" ]
5
2019-10-22T11:49:55.000Z
2020-02-25T18:53:08.000Z
django_api_forms/version.py
Sibyx/django_request_formatter
bd7aac04121fa14b68a9e33ebf70da2a0dde2b75
[ "MIT" ]
null
null
null
__version__ = '1.0.0-rc.2'
13.5
26
0.62963
6
27
2.166667
0.833333
0
0
0
0
0
0
0
0
0
0
0.166667
0.111111
27
1
27
27
0.375
0
0
0
0
0
0.37037
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
b1741e4ee58a21909bcd86bb3d83f717a7b4aaae
29
py
Python
api/apps/api/models.py
hartliddell/api
73d44d2271c01fe7540fedeee9174c4032cbbbc0
[ "MIT" ]
null
null
null
api/apps/api/models.py
hartliddell/api
73d44d2271c01fe7540fedeee9174c4032cbbbc0
[ "MIT" ]
null
null
null
api/apps/api/models.py
hartliddell/api
73d44d2271c01fe7540fedeee9174c4032cbbbc0
[ "MIT" ]
null
null
null
"""Define the API models."""
14.5
28
0.62069
4
29
4.5
1
0
0
0
0
0
0
0
0
0
0
0
0.137931
29
1
29
29
0.72
0.758621
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
b17e9d75714cb9fd937d584a1e33cdda61aa4680
372
py
Python
Exercicios-CursoemVideo/ex008.py
Aleandro1220/Linguagem-Python
75754e054bc1033e4a1930355928b4dba3621e14
[ "MIT" ]
null
null
null
Exercicios-CursoemVideo/ex008.py
Aleandro1220/Linguagem-Python
75754e054bc1033e4a1930355928b4dba3621e14
[ "MIT" ]
null
null
null
Exercicios-CursoemVideo/ex008.py
Aleandro1220/Linguagem-Python
75754e054bc1033e4a1930355928b4dba3621e14
[ "MIT" ]
null
null
null
# Programa que converte metros em medidas print('Conversor de metros\n') medida = float(input('Insira uma medida em metros: ')) print('Essa medida correponde a\nQuilômetros: {:.2f}\nHectômetros: {:.2f}\nDecâmetros: {:.2f}\nDecímetros: {:.2f}\nCentímetros: {:.2f}\nMilímetros: {:.2f}'.format(medida/1000, medida/100, medida/10, medida*10, medida*100, medida*1000))
62
235
0.706989
49
372
5.367347
0.591837
0.076046
0.114068
0
0
0
0
0
0
0
0
0.072508
0.110215
372
5
236
74.4
0.722054
0.104839
0
0
0
0.333333
0.608025
0
0
0
0
0
0
1
0
false
0
0
0
0
0.666667
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
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
b1826106329891d53f27e2c23738b886cdd877d8
108
py
Python
restaurant_picker/restaurants/admin.py
maciejKusy/restaurant_picker
9fe60c5abe3507bb8233bb4a1982b20a5634def4
[ "MIT" ]
null
null
null
restaurant_picker/restaurants/admin.py
maciejKusy/restaurant_picker
9fe60c5abe3507bb8233bb4a1982b20a5634def4
[ "MIT" ]
null
null
null
restaurant_picker/restaurants/admin.py
maciejKusy/restaurant_picker
9fe60c5abe3507bb8233bb4a1982b20a5634def4
[ "MIT" ]
null
null
null
from django.contrib import admin from restaurants.models import Restaurant admin.site.register(Restaurant)
21.6
41
0.851852
14
108
6.571429
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.092593
108
4
42
27
0.938776
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
b1a0814140f55eb08408f0fdf30131f04958ddcc
141
py
Python
mmpm/wsgi.py
herostrat/mmpm
36652af44379b489dd51b3f1985cd8de54502481
[ "MIT" ]
null
null
null
mmpm/wsgi.py
herostrat/mmpm
36652af44379b489dd51b3f1985cd8de54502481
[ "MIT" ]
null
null
null
mmpm/wsgi.py
herostrat/mmpm
36652af44379b489dd51b3f1985cd8de54502481
[ "MIT" ]
null
null
null
#!/usr/bin python3 # pylint: disable=unused-import from mmpm.api import socketio, app if __name__ == '__main__': socketio.run(socketio)
20.142857
34
0.730496
19
141
5
0.842105
0
0
0
0
0
0
0
0
0
0
0.008264
0.141844
141
6
35
23.5
0.77686
0.333333
0
0
0
0
0.086957
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
b1a672bed42ce30641c949c9e344153ccace5675
9,166
py
Python
lib/evn/test/test_repo_admins.py
tpn/enversion
6990541c3021a7f9d0c1cd64e1cb58bc9aac135e
[ "Apache-2.0" ]
2
2016-10-13T15:36:38.000Z
2019-04-13T22:54:32.000Z
lib/evn/test/test_repo_admins.py
tpn/enversion
6990541c3021a7f9d0c1cd64e1cb58bc9aac135e
[ "Apache-2.0" ]
null
null
null
lib/evn/test/test_repo_admins.py
tpn/enversion
6990541c3021a7f9d0c1cd64e1cb58bc9aac135e
[ "Apache-2.0" ]
2
2018-06-04T09:19:28.000Z
2021-11-01T14:54:35.000Z
#=============================================================================== # Imports #=============================================================================== import sys import unittest from evn.test import ( ensure_fails, ensure_blocked, expected_roots, TestRepo, EnversionTest, ) from evn.path import ( join_path, format_dir, ) from evn.util import ( chdir, bulk_chargen, ) from evn.config import ( get_or_create_config, ) from evn.test.dot import ( dot, ) from evn.constants import ( e, # Errors EVN_ERROR_CONFIRMATIONS, ) #=============================================================================== # Globals #=============================================================================== conf = get_or_create_config() #=============================================================================== # Helpers #=============================================================================== def suite(): module = sys.modules[__name__] return unittest.defaultTestLoader.loadTestsFromModule(module) #=============================================================================== # Test Classes #=============================================================================== class TestRepoAdmins(EnversionTest, unittest.TestCase): def test_01(self): repo = self.create_repo() svn = repo.svn evnadmin = repo.evnadmin # Disable so we can mkdir ^/other dot() evnadmin.disable(repo.path) svn.mkdir(repo.ra('/other/'), m='Creating other directory') dot() evnadmin.enable(repo.path) svn.cp(repo.ra('/trunk/'), repo.ra('/branches/1.x/'), m='Branching') svn.cp(repo.ra('/branches/1.x/'), repo.ra('/tags/1.0/'), m='Tagging') svn.cp(repo.ra('/branches/1.x/'), repo.ra('/tags/1.1/'), m='Tagging') svn.cp(repo.ra('/branches/1.x/'), repo.ra('/tags/1.2/'), m='Tagging') # Lazy (quick) test of roots. dot() expected_roots = set(( '/trunk/', '/branches/1.x/', '/tags/1.0/', '/tags/1.1/', '/tags/1.2/', )) actual_roots = set(repo.roots.keys()) self.assertEqual(expected_roots, actual_roots) is_repo_admin = lambda u: evnadmin.is_repo_admin(repo.name, u=u) add_repo_admin = lambda u: evnadmin.add_repo_admin(repo.name, u=u) show_repo_admins = lambda: evnadmin.show_repo_admins(repo.name) remove_repo_admin = lambda u: evnadmin.remove_repo_admin(repo.name, u=u) dot() username = svn.username self.assertEqual(is_repo_admin(username), 'no') self.assertEqual(is_repo_admin('laskdjflsdkjf'), 'no') dot() error = e.TagCopied with ensure_blocked(self, error): svn.cp(repo.ra('/tags/1.0/'), repo.ra('/other/1.0/'), m='Tagging') dot() error = 'commits with errors can only be forced through by' with ensure_blocked(self, error): svn.cp(repo.ra('/tags/1.0/'), repo.ra('/other/1.0/'), m='IGNORE ERRORS') #dot() #error = e.TagCopied #with ensure_blocked(self, error): # svn.cp(repo.ra('/tags/1.0/'), repo.ra('/other/1.0/'), # m=EVN_ERROR_CONFIRMATIONS[e.TagCopied]) dot() add_repo_admin(username) self.assertEqual(is_repo_admin(username), 'yes') # Make sure we're still blocked if we're an admin but we haven't # explicitly included IGNORE ERRORS. dot() error = e.TagCopied with ensure_blocked(self, error): svn.cp(repo.ra('/tags/1.0/'), repo.ra('/other/1.0/'), m='Tagging') dot() error = e.TagCopied svn.cp(repo.ra('/tags/1.0/'), repo.ra('/other/1.0/'), m='IGNORE ERRORS') #dot() #error = e.TagRemoved #svn.rm(repo.ra('/tags/1.1/'), m=EVN_ERROR_CONFIRMATIONS[error]) with chdir(repo.wc): svn.up() svn.cp('tags/1.2', 'other/1.2') svn.cp('trunk', 'other/foobar') svn.cp('branches/1.x', 'other/1.x') svn.ci(m='IGNORE ERRORS') class TestRepoAdminConf(EnversionTest, unittest.TestCase): def test_01(self): repo = self.create_repo() svn = repo.svn evnadmin = repo.evnadmin user1 = svn.username user2 = 'foobar' assert user1 != user2 both = ','.join(sorted((user2, user1))) is_repo_admin = lambda u: evnadmin.is_repo_admin(repo.name, u=u) add_repo_admin = lambda u: evnadmin.add_repo_admin(repo.name, u=u) show_repo_admins = lambda: evnadmin.show_repo_admins(repo.name) remove_repo_admin = lambda u: evnadmin.remove_repo_admin(repo.name, u=u) dot() self.assertEqual(is_repo_admin(user1), 'no') self.assertEqual(is_repo_admin(user2), 'no') self.assertEqual(show_repo_admins(), '<none>') dot() add_repo_admin(user1) self.assertEqual(is_repo_admin(user1), 'yes') self.assertEqual(is_repo_admin(user2), 'no') self.assertEqual(show_repo_admins(), user1) # Trying to re-add will be ignored. dot() add_repo_admin(user1) self.assertEqual(is_repo_admin(user1), 'yes') self.assertEqual(is_repo_admin(user2), 'no') self.assertEqual(show_repo_admins(), user1) # Try to remove non-existent. dot() remove_repo_admin(user2) self.assertEqual(is_repo_admin(user1), 'yes') self.assertEqual(is_repo_admin(user2), 'no') self.assertEqual(show_repo_admins(), user1) # Remove first. dot() remove_repo_admin(user1) self.assertEqual(is_repo_admin(user1), 'no') self.assertEqual(is_repo_admin(user2), 'no') self.assertEqual(show_repo_admins(), '<none>') # Add one back. dot() add_repo_admin(user1) self.assertEqual(is_repo_admin(user1), 'yes') self.assertEqual(is_repo_admin(user2), 'no') self.assertEqual(show_repo_admins(), user1) # Add second. add_repo_admin(user2) self.assertEqual(is_repo_admin(user1), 'yes') self.assertEqual(is_repo_admin(user2), 'yes') self.assertEqual(show_repo_admins(), both) # Add second again (no-op). dot() add_repo_admin(user2) self.assertEqual(is_repo_admin(user1), 'yes') self.assertEqual(is_repo_admin(user2), 'yes') self.assertEqual(show_repo_admins(), both) # Remove second. dot() remove_repo_admin(user2) self.assertEqual(is_repo_admin(user1), 'yes') self.assertEqual(is_repo_admin(user2), 'no') self.assertEqual(show_repo_admins(), user1) # Remove second again. dot() remove_repo_admin(user2) self.assertEqual(is_repo_admin(user1), 'yes') self.assertEqual(is_repo_admin(user2), 'no') self.assertEqual(show_repo_admins(), user1) # Remove first. dot() remove_repo_admin(user1) self.assertEqual(is_repo_admin(user1), 'no') self.assertEqual(is_repo_admin(user2), 'no') self.assertEqual(show_repo_admins(), '<none>') # Re-start: add first, then second, then remove first. dot() add_repo_admin(user1) self.assertEqual(is_repo_admin(user1), 'yes') self.assertEqual(is_repo_admin(user2), 'no') self.assertEqual(show_repo_admins(), user1) # Add second. dot() add_repo_admin(user2) self.assertEqual(is_repo_admin(user1), 'yes') self.assertEqual(is_repo_admin(user2), 'yes') self.assertEqual(show_repo_admins(), both) # Remove first. dot() remove_repo_admin(user1) self.assertEqual(is_repo_admin(user1), 'no') self.assertEqual(is_repo_admin(user2), 'yes') self.assertEqual(show_repo_admins(), user2) # Remove first again. dot() remove_repo_admin(user1) self.assertEqual(is_repo_admin(user1), 'no') self.assertEqual(is_repo_admin(user2), 'yes') self.assertEqual(show_repo_admins(), user2) # Remove second. dot() remove_repo_admin(user2) self.assertEqual(is_repo_admin(user1), 'no') self.assertEqual(is_repo_admin(user2), 'no') self.assertEqual(show_repo_admins(), '<none>') # Add second then first, verify order is still as expected. dot() add_repo_admin(user2) self.assertEqual(is_repo_admin(user1), 'no') self.assertEqual(is_repo_admin(user2), 'yes') self.assertEqual(show_repo_admins(), user2) dot() add_repo_admin(user1) self.assertEqual(is_repo_admin(user1), 'yes') self.assertEqual(is_repo_admin(user2), 'yes') self.assertEqual(show_repo_admins(), both) def main(): runner = unittest.TextTestRunner(verbosity=2) runner.run(suite()) if __name__ == '__main__': main() # vim:set ts=8 sw=4 sts=4 tw=78 et:
32.274648
80
0.559895
1,086
9,166
4.519337
0.144567
0.126528
0.096373
0.16687
0.71414
0.708639
0.700082
0.682967
0.682967
0.682967
0
0.017844
0.241872
9,166
283
81
32.388693
0.688444
0.160375
0
0.641026
0
0
0.077727
0
0
0
0
0
0.302564
1
0.020513
false
0
0.041026
0
0.076923
0
0
0
0
null
0
0
1
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
4
493a7758fd7f5f54f70e97341ae6bb94bc7664ff
92
py
Python
ciclo1_python/udea/MisionTIC_UdeA_Ciclo1/Material/Semana_7/Semana 7/RutaCompleta.py
felipeescallon/mision_tic_2022
20496fc40b18d2e98114d6362928f34fde41aaae
[ "CC0-1.0" ]
7
2021-07-05T21:25:50.000Z
2021-11-09T11:09:41.000Z
ciclo1_python/udea/MisionTIC_UdeA_Ciclo1/Material/Semana_7/Semana 7/RutaCompleta.py
felipeescallon/mision_tic_2022
20496fc40b18d2e98114d6362928f34fde41aaae
[ "CC0-1.0" ]
null
null
null
ciclo1_python/udea/MisionTIC_UdeA_Ciclo1/Material/Semana_7/Semana 7/RutaCompleta.py
felipeescallon/mision_tic_2022
20496fc40b18d2e98114d6362928f34fde41aaae
[ "CC0-1.0" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Tue Jun 29 10:24:19 2021 @author: USUARIO """
13.142857
36
0.543478
14
92
3.571429
1
0
0
0
0
0
0
0
0
0
0
0.188406
0.25
92
6
37
15.333333
0.536232
0.826087
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
4951e7bed3ffcb8ab3f09841b60ea1cb1906f540
83
py
Python
api/apps.py
omegaorchid/EVE_API
d3579ee55aa9b7609696a49ff6ec2948105bd80d
[ "MIT" ]
null
null
null
api/apps.py
omegaorchid/EVE_API
d3579ee55aa9b7609696a49ff6ec2948105bd80d
[ "MIT" ]
null
null
null
api/apps.py
omegaorchid/EVE_API
d3579ee55aa9b7609696a49ff6ec2948105bd80d
[ "MIT" ]
null
null
null
from django.apps import AppConfig class SetupConfig(AppConfig): name = 'api'
13.833333
33
0.73494
10
83
6.1
0.9
0
0
0
0
0
0
0
0
0
0
0
0.180723
83
5
34
16.6
0.897059
0
0
0
0
0
0.036145
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
497677f7499c4fa515eb4b64b1516b0f4ca1218d
232
py
Python
yuzu/__init__.py
andymitch/yuzu
34c67d7a19a9d51a7478050ada6286d97ffa9910
[ "Apache-2.0" ]
null
null
null
yuzu/__init__.py
andymitch/yuzu
34c67d7a19a9d51a7478050ada6286d97ffa9910
[ "Apache-2.0" ]
10
2021-06-01T04:13:15.000Z
2021-07-07T03:45:20.000Z
yuzu/__init__.py
andymitch/yuzu
34c67d7a19a9d51a7478050ada6286d97ffa9910
[ "Apache-2.0" ]
null
null
null
from .api import api from .exchanges import binance, binanceus, coinbasepro, kraken from .backtest import backtest from .optimize import optimize from .Trader import Trader from .plot import plot from .PaperWallet import PaperWallet
33.142857
62
0.827586
31
232
6.193548
0.419355
0
0
0
0
0
0
0
0
0
0
0
0.12931
232
7
63
33.142857
0.950495
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
497df80d8d4006aeb36891cc74dcac53c2184e50
676
py
Python
pixy/helpers.py
kiancross/pixys
c671ef19394f5b87b04cf74814a9900ffbf0ab6f
[ "MIT" ]
1
2021-12-06T09:48:05.000Z
2021-12-06T09:48:05.000Z
pixy/helpers.py
kiancross/pixys
c671ef19394f5b87b04cf74814a9900ffbf0ab6f
[ "MIT" ]
5
2020-12-22T22:17:35.000Z
2022-03-29T17:14:55.000Z
pixy/helpers.py
kiancross/pixys
c671ef19394f5b87b04cf74814a9900ffbf0ab6f
[ "MIT" ]
null
null
null
# # Copyright (c) 2020 Kian Cross # from pixy.pring import pring from pixy.colours import foreground def black(text: str) -> str: return pring(text, foreground.black) def red(text: str) -> str: return pring(text, foreground.red) def green(text: str) -> str: return pring(text, foreground.green) def yellow(text: str) -> str: return pring(text, foreground.yellow) def blue(text: str) -> str: return pring(text, foreground.blue) def magenta(text: str) -> str: return pring(text, foreground.magenta) def cyan(text: str) -> str: return pring(text, foreground.cyan) def white(text: str) -> str: return pring(text, foreground.white)
17.333333
42
0.680473
95
676
4.842105
0.242105
0.121739
0.173913
0.278261
0.608696
0.608696
0.608696
0
0
0
0
0.007313
0.190828
676
38
43
17.789474
0.833638
0.042899
0
0
0
0
0
0
0
0
0
0
0
1
0.444444
false
0
0.111111
0.444444
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
b8fb1ee9d9d81306ff31748ca367c4c058839bea
76
py
Python
AOJ/ITP1_2_B.py
sireline/PyCode
8578467710c3c1faa89499f5d732507f5d9a584c
[ "MIT" ]
null
null
null
AOJ/ITP1_2_B.py
sireline/PyCode
8578467710c3c1faa89499f5d732507f5d9a584c
[ "MIT" ]
null
null
null
AOJ/ITP1_2_B.py
sireline/PyCode
8578467710c3c1faa89499f5d732507f5d9a584c
[ "MIT" ]
null
null
null
a, b, c = [int(n) for n in input().split()] print('Yes' if a<b<c else 'No')
25.333333
43
0.552632
18
76
2.333333
0.777778
0.095238
0.142857
0
0
0
0
0
0
0
0
0
0.184211
76
2
44
38
0.677419
0
0
0
0
0
0.065789
0
0
0
0
0
0
1
0
true
0
0
0
0
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
4
773a940c435b851a9fc0ce6e72ca93dde5a9006e
430
py
Python
lego/apps/companies/notifications.py
ollfkaih/lego
b15aacaf09efe90e7f984d25b0e7bddbe12647e8
[ "MIT" ]
45
2017-10-24T12:09:06.000Z
2021-11-03T21:21:03.000Z
lego/apps/companies/notifications.py
ollfkaih/lego
b15aacaf09efe90e7f984d25b0e7bddbe12647e8
[ "MIT" ]
980
2017-10-24T12:29:07.000Z
2022-03-31T04:04:31.000Z
lego/apps/companies/notifications.py
wahello/lego
a0b02f3abc997fe96326e9c9c05b49847170041b
[ "MIT" ]
23
2018-04-11T16:34:22.000Z
2021-11-23T12:28:30.000Z
from lego.apps.notifications.constants import COMPANY_INTEREST_CREATED from lego.apps.notifications.notification import Notification class CompanyInterestNotification(Notification): name = COMPANY_INTEREST_CREATED def generate_mail(self): """ The email for this notication is sent in the handler. This allows us to send it to a mailing list, instead of specific users. """ pass
28.666667
79
0.730233
52
430
5.942308
0.75
0.05178
0.07767
0.161812
0
0
0
0
0
0
0
0
0.218605
430
14
80
30.714286
0.919643
0.290698
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0.166667
0.333333
0
0.833333
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
4
6227febecbe65e57e08a5e01962605a8c39ad70e
190
py
Python
PythonLearning/v0004.py
JoaoG10110/Python
495044d61bb8d6ec3542433a3f54dd1f8177cb08
[ "MIT" ]
null
null
null
PythonLearning/v0004.py
JoaoG10110/Python
495044d61bb8d6ec3542433a3f54dd1f8177cb08
[ "MIT" ]
null
null
null
PythonLearning/v0004.py
JoaoG10110/Python
495044d61bb8d6ec3542433a3f54dd1f8177cb08
[ "MIT" ]
null
null
null
n = int(input('Digite um número: ')) print(f'O seu antecessor é {n-1} e o seu sucessor é {n+1}') print(f'O dobro do número é {n*2}, o triplo é {n*3}, e a sua raiz quadrada é {n**(1/2):.2f}')
63.333333
93
0.621053
45
190
2.622222
0.555556
0.084746
0.076271
0
0
0
0
0
0
0
0
0.044586
0.173684
190
3
93
63.333333
0.707006
0
0
0
0
0.333333
0.78534
0
0
0
0
0
0
1
0
false
0
0
0
0
0.666667
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
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
623a8041e941f5545b7e8cce3bc2291e351fcbf0
66
py
Python
kube_cli/__init__.py
deniskrumko/kube-cli
6cf29725e08a9386a1c53b82a9f9567a811582d5
[ "MIT" ]
1
2020-07-31T21:27:48.000Z
2020-07-31T21:27:48.000Z
kube_cli/__init__.py
deniskrumko/kube-cli
6cf29725e08a9386a1c53b82a9f9567a811582d5
[ "MIT" ]
2
2020-03-13T13:56:22.000Z
2020-03-30T08:58:59.000Z
kube_cli/__init__.py
deniskrumko/kube-cli
6cf29725e08a9386a1c53b82a9f9567a811582d5
[ "MIT" ]
1
2020-03-27T20:00:01.000Z
2020-03-27T20:00:01.000Z
__version__ = '0.0.7' def get_version(): return __version__
11
22
0.681818
9
66
4
0.666667
0
0
0
0
0
0
0
0
0
0
0.056604
0.19697
66
5
23
13.2
0.622642
0
0
0
0
0
0.075758
0
0
0
0
0
0
1
0.333333
false
0
0
0.333333
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
6249e33803d11cfb62cfe7dee84c72d25b8d8cbc
498
py
Python
Models/User.py
pedromneto97/crossbar-heroku
7bedb40aeb4c7db483113a8579637b1007bba595
[ "MIT" ]
null
null
null
Models/User.py
pedromneto97/crossbar-heroku
7bedb40aeb4c7db483113a8579637b1007bba595
[ "MIT" ]
null
null
null
Models/User.py
pedromneto97/crossbar-heroku
7bedb40aeb4c7db483113a8579637b1007bba595
[ "MIT" ]
null
null
null
from autobahn.wamp.auth import derive_key from mongoengine import * class User(Document): username = StringField(required=True, unique=True) name = StringField(required=True) password = StringField(required=True) cpf = StringField(required=True, unique=True) email = EmailField(required=True, unique=True) default_residence = ObjectIdField(null=True) @staticmethod def encrypt(password: str, salt: str = None) -> bytes: return derive_key(password, salt)
29.294118
58
0.7249
58
498
6.172414
0.568966
0.167598
0.256983
0.184358
0.184358
0
0
0
0
0
0
0
0.176707
498
16
59
31.125
0.873171
0
0
0
0
0
0
0
0
0
0
0
0
1
0.083333
false
0.25
0.166667
0.083333
0.916667
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
4
624a54c617d32483ed2571a70c72a1316accfb2b
105
py
Python
puskesmas_app/apps.py
kurniantoska/medicalwebapp_project
a2e36a44b598ad2989c207f950a89c02d987e00d
[ "BSD-3-Clause" ]
1
2019-10-22T02:12:49.000Z
2019-10-22T02:12:49.000Z
puskesmas_app/apps.py
kurniantoska/medicalwebapp_project
a2e36a44b598ad2989c207f950a89c02d987e00d
[ "BSD-3-Clause" ]
3
2020-06-05T18:30:35.000Z
2021-06-10T20:31:09.000Z
puskesmas_app/apps.py
kurniantoska/medicalwebapp_project
a2e36a44b598ad2989c207f950a89c02d987e00d
[ "BSD-3-Clause" ]
null
null
null
from django.apps import AppConfig class PuskesmasAppConfig(AppConfig): name = 'puskesmas_app'
17.5
37
0.742857
11
105
7
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.190476
105
5
38
21
0.905882
0
0
0
0
0
0.13
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
6278473bf35118efa7e77ac1976effba4254ddea
86
py
Python
story/environment.py
jayvdb/cli
6e03af2b2d1e6d6f0188d405617a95dca86072c8
[ "Apache-2.0" ]
null
null
null
story/environment.py
jayvdb/cli
6e03af2b2d1e6d6f0188d405617a95dca86072c8
[ "Apache-2.0" ]
null
null
null
story/environment.py
jayvdb/cli
6e03af2b2d1e6d6f0188d405617a95dca86072c8
[ "Apache-2.0" ]
null
null
null
import os SS_GRAPHQL = os.getenv('SS_GRAPHQL', 'https://api.storyscript.io/graphql')
21.5
74
0.744186
13
86
4.769231
0.692308
0.290323
0
0
0
0
0
0
0
0
0
0
0.081395
86
3
75
28.666667
0.78481
0
0
0
0
0
0.511628
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
6573067f18b1130152fafe0dce7bbbf01026e34c
248
py
Python
change_til/antes.py
parzibyte/ejemplos_vim
1329616bb2344d43e6e90c2a8c0f90ae1e3c52da
[ "MIT" ]
null
null
null
change_til/antes.py
parzibyte/ejemplos_vim
1329616bb2344d43e6e90c2a8c0f90ae1e3c52da
[ "MIT" ]
null
null
null
change_til/antes.py
parzibyte/ejemplos_vim
1329616bb2344d43e6e90c2a8c0f90ae1e3c52da
[ "MIT" ]
null
null
null
""" https://parzibyte.me/blog """ print("Hola. Elimina esto y haz que diga 'Mi nombre es Luis'") print("Hola. Me llamo cambia esto para que diga tu nombre, sin borrar el final. Tengo 23 años") # Eleva el 2 a la potencia 3, no a la 50 pow(2, 50)
35.428571
95
0.685484
48
248
3.541667
0.75
0.105882
0
0
0
0
0
0
0
0
0
0.045
0.193548
248
7
96
35.428571
0.805
0.262097
0
0
0
0
0.80814
0
0
0
0
0
0
1
0
true
0
0
0
0
0.666667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
4
6590b8772cf11cdac46a42fc2a5ab069ce28f4c0
93
py
Python
model/prediction/wsgi.py
RedHatGov/serverless-workshop-code
a24a23e00093f8bd372f2578257fede2c4882547
[ "Apache-2.0" ]
1
2020-09-04T01:52:31.000Z
2020-09-04T01:52:31.000Z
model/prediction/wsgi.py
RedHatGov/serverless-workshop-code
a24a23e00093f8bd372f2578257fede2c4882547
[ "Apache-2.0" ]
11
2020-12-04T16:25:14.000Z
2021-11-18T04:17:43.000Z
model/prediction/wsgi.py
RedHatGov/serverless-workshop-code
a24a23e00093f8bd372f2578257fede2c4882547
[ "Apache-2.0" ]
null
null
null
from prediction import application if __name__ == "__main__": application.run(port=8080)
23.25
34
0.763441
11
93
5.727273
0.909091
0
0
0
0
0
0
0
0
0
0
0.05
0.139785
93
4
35
23.25
0.7375
0
0
0
0
0
0.085106
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
65c4ec79c757e515373ce5cd42abbfaa8910ee4d
251
py
Python
hdf5handler.py
Brow71189/NanoDiffAnalysis
e0ce959cbac0985cec06767d1dbeb5518d463520
[ "MIT" ]
2
2018-10-04T18:36:15.000Z
2018-11-13T04:41:37.000Z
hdf5handler.py
Brow71189/NanoDiffAnalysis
e0ce959cbac0985cec06767d1dbeb5518d463520
[ "MIT" ]
null
null
null
hdf5handler.py
Brow71189/NanoDiffAnalysis
e0ce959cbac0985cec06767d1dbeb5518d463520
[ "MIT" ]
null
null
null
import h5py def openhdf5file(hdf5filename): hdf5filelink=h5py.File(hdf5filename, 'r') return hdf5filelink def gethdf5slice(slicenumber,hdf5filelink): hdf5slice = hdf5filelink['data/science_data/data'][slicenumber,:] return hdf5slice
25.1
69
0.768924
25
251
7.68
0.56
0
0
0
0
0
0
0
0
0
0
0.055046
0.131474
251
9
70
27.888889
0.825688
0
0
0
0
0
0.091633
0.087649
0
0
0
0
0
1
0.285714
false
0
0.142857
0
0.714286
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
02bd9ba986e32d60058292c5adcb8204dc1d337c
512
py
Python
tinysou/engines.py
tinysou/tinysou-python
d5f38e9261220543b9879d710f28908da1efb65e
[ "MIT" ]
2
2015-01-13T09:29:57.000Z
2017-03-16T05:03:03.000Z
tinysou/engines.py
tinysou/tinysou-python
d5f38e9261220543b9879d710f28908da1efb65e
[ "MIT" ]
null
null
null
tinysou/engines.py
tinysou/tinysou-python
d5f38e9261220543b9879d710f28908da1efb65e
[ "MIT" ]
null
null
null
class Engine(object): """Engine""" def __init__(self, rest): self.rest = rest def list(self, params=None): return self.rest.get('engines', params) def create(self, data=None): return self.rest.post('engines', data) def get(self, name): return self.rest.get('engines/' + name) def update(self, name, data=None): return self.rest.put('engines/' + name, data=data) def delete(self, name): return self.rest.delete('engines/' + name)
23.272727
58
0.597656
67
512
4.507463
0.298507
0.18543
0.231788
0.178808
0.403974
0
0
0
0
0
0
0
0.248047
512
21
59
24.380952
0.784416
0.011719
0
0
0
0
0.076
0
0
0
0
0
0
1
0.461538
false
0
0
0.384615
0.923077
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
1
0
0
0
4
02c098119d3409e3958b4e06de450d4247ab5449
79
py
Python
sql_app/__init__.py
karais89/morning_fast_api
29b2f945e400a95a306292eb6d1139b5a6afc586
[ "MIT" ]
null
null
null
sql_app/__init__.py
karais89/morning_fast_api
29b2f945e400a95a306292eb6d1139b5a6afc586
[ "MIT" ]
null
null
null
sql_app/__init__.py
karais89/morning_fast_api
29b2f945e400a95a306292eb6d1139b5a6afc586
[ "MIT" ]
null
null
null
# __init_.py 파일은 빈 파일일 뿐이지만 모든 모듈을 포함하는 sql_app(Python files)이 패키지임을 파이썬에 알려준다.
79
79
0.772152
17
79
3.352941
1
0
0
0
0
0
0
0
0
0
0
0
0.164557
79
1
79
79
0.863636
0.974684
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
02c967831890b6595006e8a7e9d0ef54b3c0476c
1,718
py
Python
crawler/core/outputer.py
EasonAndLily/SimpleCrawler
3680ce958697c788ee5349451b8d9f277aa19807
[ "MIT" ]
1
2020-10-30T04:59:07.000Z
2020-10-30T04:59:07.000Z
crawler/core/outputer.py
EasonAndLily/SimpleCrawler
3680ce958697c788ee5349451b8d9f277aa19807
[ "MIT" ]
null
null
null
crawler/core/outputer.py
EasonAndLily/SimpleCrawler
3680ce958697c788ee5349451b8d9f277aa19807
[ "MIT" ]
null
null
null
import os class Outputer(object): def __init__(self): self.__data = [] def collect_data(self, data): if data is None: return self.__data.append(data) def outputer_html(self, path, file_name): output_file = open(os.path.join(path, file_name), 'w') output_file.write("<html>") output_file.write("<meta charset='utf-8'>") output_file.write("<body>") for data in self.__data: output_file.write("<div>") output_file.write("<div>") output_file.write("<span>") output_file.write("Craw keywords: ") output_file.write("</span>") output_file.write("<span>") output_file.write(u''.join(data.get('title')).encode('utf-8').strip()) output_file.write("</span>") output_file.write("</div>") output_file.write("<div>") output_file.write("<span>") output_file.write("From URL: ") output_file.write("</span>") output_file.write("<span>") output_file.write(data["url"]) output_file.write("</span>") output_file.write("</div>") output_file.write("<span>") output_file.write("Craw Content: ") output_file.write("</span>") output_file.write("<span>") output_file.write(u''.join(data["summary"]).encode('utf-8').strip()) output_file.write("</span>") output_file.write("<div>") output_file.write("</div>") output_file.write("</div>") output_file.write("</body>") output_file.write("</html>") output_file.close()
34.36
82
0.534924
195
1,718
4.471795
0.230769
0.37844
0.533257
0.261468
0.684633
0.684633
0.618119
0.618119
0.611239
0.611239
0
0.002463
0.291036
1,718
49
83
35.061224
0.713465
0
0
0.465116
0
0
0.136787
0
0
0
0
0
0
1
0.069767
false
0
0.023256
0
0.139535
0
0
0
0
null
1
1
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
02c98359814283f83e19fb884f937b3f20c38a51
198
py
Python
delete_jira.py
saifulaffendy21/DockerFile
0878b660129e1c1b7186b71a17df5dded85b16d1
[ "MIT" ]
null
null
null
delete_jira.py
saifulaffendy21/DockerFile
0878b660129e1c1b7186b71a17df5dded85b16d1
[ "MIT" ]
null
null
null
delete_jira.py
saifulaffendy21/DockerFile
0878b660129e1c1b7186b71a17df5dded85b16d1
[ "MIT" ]
null
null
null
import os import time print "Deleting JIRA Software folder directory!" os.system('rm -rf /var/atlassian') os.system('rm -rf /opt/atlassian') print "Done!\nDeleting JIRA Software from your system!"
24.75
55
0.757576
30
198
5
0.633333
0.16
0.133333
0.16
0
0
0
0
0
0
0
0
0.121212
198
7
56
28.285714
0.862069
0
0
0
0
0
0.651515
0
0
0
0
0
0
0
null
null
0
0.333333
null
null
0.333333
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
4
f309f94cd96164df06e613391ea6cd50e8b7c0f6
718
py
Python
modules/dataUtils.py
tinnguyen96/partition-coupling
1078171465e61bee5bca3d2c2f1bf0fc86c0d865
[ "MIT" ]
null
null
null
modules/dataUtils.py
tinnguyen96/partition-coupling
1078171465e61bee5bca3d2c2f1bf0fc86c0d865
[ "MIT" ]
null
null
null
modules/dataUtils.py
tinnguyen96/partition-coupling
1078171465e61bee5bca3d2c2f1bf0fc86c0d865
[ "MIT" ]
null
null
null
# Todos # Incorporate the processing functions from the relevant notebooks import pandas as pd import numpy as np import igraph import pickle def loadMixtureData(rDir, dataName): """ Inputs: rDir: str dataName: str Output: X: (N,D) """ name = rDir + dataName df = pd.read_csv(name) X = df.to_numpy() print("nObs, nCov =", X.shape) return X def loadGraphData(rDir, dataName): path = rDir + dataName graph = igraph.Graph.Read_Pickle(open(path, "rb")) return graph def processSeedData(rDir, dataName): return def makeSyntheticMixtureData(rDir): return def makeGraphData(rDir): return if __name__ == "__main__": sys.exit(0)
17.95
66
0.649025
89
718
5.11236
0.550562
0.131868
0
0
0
0
0
0
0
0
0
0.001859
0.250696
718
40
67
17.95
0.843866
0.185237
0
0.136364
0
0
0.039783
0
0
0
0
0.025
0
1
0.227273
false
0
0.181818
0.136364
0.636364
0.045455
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
1
1
0
0
4
f3145d75b3090b050d5c744695484925a7c3c432
88
py
Python
search/tests/unit/proxy/__init__.py
defendercrypt/amundsen
83c728b646020f60cf2270c12e766fe4af8c9948
[ "Apache-2.0" ]
2,072
2020-08-11T20:16:48.000Z
2022-03-31T07:04:05.000Z
search/tests/unit/proxy/__init__.py
defendercrypt/amundsen
83c728b646020f60cf2270c12e766fe4af8c9948
[ "Apache-2.0" ]
795
2020-08-11T15:24:39.000Z
2022-03-31T18:56:13.000Z
search/tests/unit/proxy/__init__.py
defendercrypt/amundsen
83c728b646020f60cf2270c12e766fe4af8c9948
[ "Apache-2.0" ]
671
2020-08-11T20:39:56.000Z
2022-03-31T08:39:07.000Z
# Copyright Contributors to the Amundsen project. # SPDX-License-Identifier: Apache-2.0
29.333333
49
0.795455
12
88
5.833333
1
0
0
0
0
0
0
0
0
0
0
0.025641
0.113636
88
2
50
44
0.871795
0.943182
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
f31a0902259836cb795f5090ae2fa9ebd3e39562
259
py
Python
setup.py
MoShrank/aedat
7c8248039e28c05bb44878f8ab26b12fadb1f4b0
[ "MIT" ]
7
2020-08-27T12:45:51.000Z
2021-10-01T09:58:50.000Z
setup.py
MoShrank/aedat
7c8248039e28c05bb44878f8ab26b12fadb1f4b0
[ "MIT" ]
6
2020-08-11T13:39:10.000Z
2021-10-16T21:04:18.000Z
setup.py
MoShrank/aedat
7c8248039e28c05bb44878f8ab26b12fadb1f4b0
[ "MIT" ]
2
2021-04-21T13:10:53.000Z
2021-09-18T21:26:58.000Z
from setuptools import setup import glob from torch.utils.cpp_extension import BuildExtension, CppExtension setup( name="aedat", ext_modules=[CppExtension("aedat", ["convert.cpp",], libraries=["lz4"]),], cmdclass={"build_ext": BuildExtension}, )
25.9
78
0.72973
29
259
6.413793
0.689655
0
0
0
0
0
0
0
0
0
0
0.004405
0.123552
259
9
79
28.777778
0.814978
0
0
0
0
0
0.127413
0
0
0
0
0
0
1
0
true
0
0.375
0
0.375
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
f321068faa2d6a70c336a94a9bbbcc8a28a5e924
141
py
Python
coding/alien_dictionary/starter.py
skumaravelan/tech-interview-questions
637dfbf131123c77a8e2e4e45ba420355dcb381f
[ "MIT" ]
14
2022-02-08T17:29:29.000Z
2022-03-27T17:22:14.000Z
coding/alien_dictionary/starter.py
skumaravelan/tech-interview-questions
637dfbf131123c77a8e2e4e45ba420355dcb381f
[ "MIT" ]
18
2022-01-27T17:37:26.000Z
2022-03-29T15:16:18.000Z
coding/alien_dictionary/starter.py
skumaravelan/tech-interview-questions
637dfbf131123c77a8e2e4e45ba420355dcb381f
[ "MIT" ]
9
2022-02-08T16:03:10.000Z
2022-03-19T03:26:30.000Z
class Solution(object): def alienOrder(self, words): """ :type words: List[str] :rtype: str """
17.625
32
0.460993
13
141
5
0.846154
0
0
0
0
0
0
0
0
0
0
0
0.404255
141
7
33
20.142857
0.77381
0.241135
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
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
1
0
0
0
0
1
0
0
4
f3251b37577836fb087730e85942ad8dad43bbe3
259
py
Python
src/utils/Testing_Folder/Chicken.py
jonoddram/CodetagCrawler
6b6eaed738aef91fead3d2aaf3ab96e1cecd0cdf
[ "MIT" ]
null
null
null
src/utils/Testing_Folder/Chicken.py
jonoddram/CodetagCrawler
6b6eaed738aef91fead3d2aaf3ab96e1cecd0cdf
[ "MIT" ]
null
null
null
src/utils/Testing_Folder/Chicken.py
jonoddram/CodetagCrawler
6b6eaed738aef91fead3d2aaf3ab96e1cecd0cdf
[ "MIT" ]
null
null
null
# BUG Can live for several minutes after decapitation # Either change death-time or remove need for head entirely """ TODO BAK-AAAW # BUG If you read me as a seperate code-tag you are a dumb, dumb, dumb crawler. ''' TODO Include me with bak-aaaw too! ''' """
32.375
79
0.725869
45
259
4.177778
0.777778
0.074468
0
0
0
0
0
0
0
0
0
0
0.185328
259
8
80
32.375
0.890995
0.953668
0
null
0
null
0
0
null
0
0
0.25
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
1
0
0
0
1
0
0
0
0
0
0
4
b826161bcc0043610ac86db58f378123ec7340c7
48
py
Python
code/abc157_a_04.py
KoyanagiHitoshi/AtCoder
731892543769b5df15254e1f32b756190378d292
[ "MIT" ]
3
2019-08-16T16:55:48.000Z
2021-04-11T10:21:40.000Z
code/abc157_a_04.py
KoyanagiHitoshi/AtCoder
731892543769b5df15254e1f32b756190378d292
[ "MIT" ]
null
null
null
code/abc157_a_04.py
KoyanagiHitoshi/AtCoder
731892543769b5df15254e1f32b756190378d292
[ "MIT" ]
null
null
null
import math N=int(input()) print(math.ceil(N/2))
16
21
0.708333
10
48
3.4
0.8
0
0
0
0
0
0
0
0
0
0
0.022222
0.0625
48
3
21
16
0.733333
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.333333
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
b827020e1f6bd2ec46833ac76e6c92b9fb578315
747
py
Python
multiplex/migrations/0032_auto_20211231_0814.py
salemgu1/Coffe_Shop
301f4588af726d1b902ec2f9f5d60b1e12fae8ca
[ "MIT" ]
null
null
null
multiplex/migrations/0032_auto_20211231_0814.py
salemgu1/Coffe_Shop
301f4588af726d1b902ec2f9f5d60b1e12fae8ca
[ "MIT" ]
null
null
null
multiplex/migrations/0032_auto_20211231_0814.py
salemgu1/Coffe_Shop
301f4588af726d1b902ec2f9f5d60b1e12fae8ca
[ "MIT" ]
null
null
null
# Generated by Django 3.1.7 on 2021-12-31 08:14 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('multiplex', '0031_remove_movie_is_active'), ] operations = [ migrations.RemoveField( model_name='movie', name='actor', ), migrations.RemoveField( model_name='movie', name='category', ), migrations.RemoveField( model_name='movie', name='director', ), migrations.RemoveField( model_name='movie', name='popularity', ), migrations.RemoveField( model_name='movie', name='video', ), ]
21.970588
53
0.52075
64
747
5.9375
0.53125
0.276316
0.342105
0.394737
0.513158
0.513158
0
0
0
0
0
0.040084
0.365462
747
33
54
22.636364
0.761603
0.060241
0
0.555556
1
0
0.138571
0.038571
0
0
0
0
0
1
0
false
0
0.037037
0
0.148148
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
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
b833295f3936c3030bf4e0a411b244e28cb565b9
2,889
py
Python
tools/Polygraphy/tests/tools/common.py
spradius/TensorRT
eb5de99b523c76c2f3ae997855ad86d3a1e86a31
[ "Apache-2.0" ]
1
2021-08-23T01:15:16.000Z
2021-08-23T01:15:16.000Z
tools/Polygraphy/tests/tools/common.py
spradius/TensorRT
eb5de99b523c76c2f3ae997855ad86d3a1e86a31
[ "Apache-2.0" ]
null
null
null
tools/Polygraphy/tests/tools/common.py
spradius/TensorRT
eb5de99b523c76c2f3ae997855ad86d3a1e86a31
[ "Apache-2.0" ]
1
2022-03-29T12:39:29.000Z
2022-03-29T12:39:29.000Z
# # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import subprocess as sp import sys import os from polygraphy.logger import G_LOGGER ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir)) BIN_DIR = os.path.join(ROOT_DIR, "bin") polygraphy = os.path.join(BIN_DIR, "polygraphy") def check_subprocess(status): if status.returncode: G_LOGGER.critical(status.stdout + status.stderr) def run_polygraphy(additional_opts=[], *args, **kwargs): cmd = [sys.executable, polygraphy] + additional_opts print("Running command: {:}".format(" ".join(cmd))) status = sp.run(cmd, stdout=sp.PIPE, stderr=sp.PIPE, *args, **kwargs) status.stdout = status.stdout.decode() status.stderr = status.stderr.decode() print(status.stdout) print(status.stderr) check_subprocess(status) return status def run_subtool(subtool, additional_opts, disable_verbose=False, *args, **kwargs): opts = [subtool] opts += additional_opts if not disable_verbose: opts += ["-vvvvv"] return run_polygraphy(opts, *args, **kwargs) def run_polygraphy_run(additional_opts=[], disable_verbose=False, *args, **kwargs): return run_subtool("run", additional_opts, disable_verbose, *args, **kwargs) def run_polygraphy_convert(additional_opts=[], disable_verbose=False, *args, **kwargs): return run_subtool("convert", additional_opts, disable_verbose, *args, **kwargs) def run_polygraphy_inspect(additional_opts=[], disable_verbose=False, *args, **kwargs): return run_subtool("inspect", additional_opts, disable_verbose, *args, **kwargs) def run_polygraphy_precision(additional_opts=[], disable_verbose=False, *args, **kwargs): return run_subtool("precision", additional_opts, disable_verbose, *args, **kwargs) def run_polygraphy_surgeon(additional_opts=[], disable_verbose=False, *args, **kwargs): return run_subtool("surgeon", additional_opts, disable_verbose, *args, **kwargs) def run_polygraphy_template(additional_opts=[], disable_verbose=False, *args, **kwargs): return run_subtool("template", additional_opts, disable_verbose, *args, **kwargs) def run_polygraphy_debug(additional_opts=[], disable_verbose=False, *args, **kwargs): return run_subtool("debug", additional_opts, disable_verbose, *args, **kwargs)
37.038462
99
0.741087
382
2,889
5.421466
0.306283
0.12168
0.1521
0.202801
0.451956
0.394978
0.37663
0.355867
0.355867
0.199421
0
0.003201
0.134995
2,889
77
100
37.519481
0.82553
0.201454
0
0
0
0
0.037538
0
0
0
0
0
0
1
0.25
false
0
0.1
0.175
0.575
0.075
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
b846cfabb75cb326b694c8c918f24cb0359480b8
270
py
Python
python/igsdk/modbus/baseparser.py
berezovskyi-oleksandr/igsdk
f0a770f4562fd821cd2f5d6ed00fb6fab65c80b9
[ "MIT" ]
null
null
null
python/igsdk/modbus/baseparser.py
berezovskyi-oleksandr/igsdk
f0a770f4562fd821cd2f5d6ed00fb6fab65c80b9
[ "MIT" ]
2
2019-07-11T20:05:10.000Z
2020-04-14T17:22:02.000Z
python/igsdk/modbus/baseparser.py
berezovskyi-oleksandr/igsdk
f0a770f4562fd821cd2f5d6ed00fb6fab65c80b9
[ "MIT" ]
8
2020-04-06T11:07:10.000Z
2022-03-12T11:04:58.000Z
# # baseparser.py # # Base class for Modbus message parser # class ModbusBaseParser: """Base class for Modbus message parsing. """ def __init__(self): pass def msgs_from_bytes(self, b): """Parse messages from a byte string """
16.875
45
0.614815
32
270
5
0.71875
0.1125
0.15
0.225
0.3125
0
0
0
0
0
0
0
0.285185
270
15
46
18
0.829016
0.511111
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0.25
0
0
0.75
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
4
b850face66c7a923515f0e2c7288535080d91740
81
py
Python
airbyte-integrations/connectors/source-salesforce-singer/source_salesforce_singer/__init__.py
rajatariya21/airbyte
11e70a7a96e2682b479afbe6f709b9a5fe9c4a8d
[ "MIT" ]
2
2021-03-02T09:17:41.000Z
2021-03-02T11:02:23.000Z
airbyte-integrations/connectors/source-salesforce-singer/source_salesforce_singer/__init__.py
rajatariya21/airbyte
11e70a7a96e2682b479afbe6f709b9a5fe9c4a8d
[ "MIT" ]
52
2021-06-11T12:39:05.000Z
2022-03-30T04:59:35.000Z
airbyte-integrations/connectors/source-salesforce-singer/source_salesforce_singer/__init__.py
rajatariya21/airbyte
11e70a7a96e2682b479afbe6f709b9a5fe9c4a8d
[ "MIT" ]
2
2021-12-14T17:15:40.000Z
2021-12-14T17:18:03.000Z
from .source import SourceSalesforceSinger __all__ = ["SourceSalesforceSinger"]
20.25
42
0.82716
6
81
10.5
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.098765
81
3
43
27
0.863014
0
0
0
0
0
0.271605
0.271605
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
b863f14ea925d5e22e680d317091643a7b9147b0
48
py
Python
secrets.py
odajemal6/Instagram_unfollow
33629068cee3d8f330ef53ffa60437aa28ccae4c
[ "MIT" ]
1
2020-11-18T15:58:40.000Z
2020-11-18T15:58:40.000Z
secrets.py
odajemal6/Instagram_unfollow
33629068cee3d8f330ef53ffa60437aa28ccae4c
[ "MIT" ]
null
null
null
secrets.py
odajemal6/Instagram_unfollow
33629068cee3d8f330ef53ffa60437aa28ccae4c
[ "MIT" ]
null
null
null
username = "Your username" pw = "Your password"
16
26
0.708333
6
48
5.666667
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.166667
48
2
27
24
0.85
0
0
0
0
0
0.541667
0
0
0
0
0
0
1
0
false
0.5
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
b887c8864f0b9005d55348357021ab642dc80193
84,169
py
Python
mainManager.py
keldkemp/ShikiMoriBot
c971206bda80e678f7306fcf5fe2430ea72f0690
[ "MIT" ]
null
null
null
mainManager.py
keldkemp/ShikiMoriBot
c971206bda80e678f7306fcf5fe2430ea72f0690
[ "MIT" ]
5
2021-09-14T15:18:14.000Z
2021-11-01T17:08:18.000Z
mainManager.py
keldkemp/ShikiMoriBot
c971206bda80e678f7306fcf5fe2430ea72f0690
[ "MIT" ]
null
null
null
from Caches.main_cache import MainCache from DataBase.dbmanager import DataBaseManager from Shikimori.shikimori import Shikimori from Telegram.telegram import Telegram from Models.dataModels import * from time import sleep from Utils.utils import Utils import threading import datetime import json import re class MainManager: MAIN_KEYBOARD_TG = json.dumps({'keyboard': [[{'text': 'Мой список Аниме'}], [{'text': 'Аниме по сезонам'}], [{'text': 'Мой список Манги'}], [{'text': 'Настройки'}]], 'resize_keyboard': True, 'one_time_keyboard': True}) SETTIGNS_KEYBOARD_TG = json.dumps( {'inline_keyboard': [[{'text': 'Отображение списка', 'callback_data': 'ChangeListSettings//'}], [{'text': ':is_notify_text', 'callback_data': 'ChangeNotify// :is_notify_param'}], [{'text': 'Удалить аккаунт', 'callback_data': 'DeleteAccount//'}]]}) MY_ANIME_LIST_KEYBOARD_TG = json.dumps( {'inline_keyboard': [[{'text': 'Обновить список', 'callback_data': 'UpdateListAnime//'}], [{'text': 'Запланированные', 'callback_data': 'ListAnimePlaned//'}], [{'text': 'Смотрю', 'callback_data': 'ListAnimeWatching//'}], [{'text': 'Просмотренные', 'callback_data': 'ListAnimeCompleted//'}], [{'text': 'Все', 'callback_data': 'ListAnimeAll//'}], [{'text': 'Поиск Аниме', 'callback_data': 'SearchAnime//'}]]}) MY_MANGA_LIST_KEYBOARD_TG = json.dumps( {'inline_keyboard': [[{'text': 'Обновить список', 'callback_data': 'UpdateListAnime//'}], [{'text': 'Запланированные', 'callback_data': 'ListMangaPlaned//'}], [{'text': 'Читаю', 'callback_data': 'ListMangaWatching//'}], [{'text': 'Прочитанные', 'callback_data': 'ListMangaCompleted//'}], [{'text': 'Все', 'callback_data': 'ListMangaAll//'}], [{'text': 'Поиск Манги', 'callback_data': 'SearchManga//'}]]} ) def __convert_json_to_anime(self, list_anime: list) -> list: ls = [] for anime in list_anime: url = anime.get('url') if url is None or url == 'None': url = None else: url = self.__shiki.BASE_URL_SHIKI + url aried_on = anime.get('aired_on') if aried_on is None or aried_on == 'None': aried_on = None else: aried_on = datetime.datetime.strptime(anime.get('aired_on'), '%Y-%m-%d') released_on = anime.get('released_on') if released_on is None or released_on == 'None': released_on = None else: released_on = datetime.datetime.strptime(anime.get('released_on'), '%Y-%m-%d') next_episode_at = anime.get('next_episode_at') if next_episode_at is None or next_episode_at == 'None': next_episode_at = None else: next_episode_at = datetime.datetime.strptime(anime.get('next_episode_at')[:-10], '%Y-%m-%dT%H:%M:%S') updated_at = anime.get('updated_at') if updated_at is None or updated_at == 'None': updated_at = None else: updated_at = datetime.datetime.strptime(updated_at[:-10], '%Y-%m-%dT%H:%M:%S') description: str = anime.get('description') if description is not None and description != 'None': description = re.sub('\[.+?\]', ' ', description) description = description.replace("'", ' ') name_jp = anime.get('japanese') if name_jp is None or name_jp == 'None': name_jp = None else: name_jp = name_jp[0].replace("'", '') rating = anime.get('rating') if rating is None or rating == 'None': rating = None if anime.get('name').find("'") != -1: name = anime.get('name').replace("'", '') else: name = anime.get('name') if anime.get('russian').find("'") != -1: name_ru = anime.get('russian').replace("'", '') else: name_ru = anime.get('russian') if anime.get('franchise') is None or anime.get('franchise') == 'None': franchise = None else: franchise = anime.get('franchise') ls.append(Anime(id=anime.get('id'), name=name, name_ru=name_ru, name_jp=name_jp, kind=anime.get('kind'), score=anime.get('score'), status=anime.get('status'), episodes=anime.get('episodes'), episodes_aired=anime.get('episodes_aired'), rating=rating, description=description, updated_at=updated_at, aired_on=aried_on, released_on=released_on, next_episode_at=next_episode_at, url=url, franchise=franchise)) return ls def __convert_json_to_manga(self, list_manga: list) -> list: ls = [] for manga in list_manga: url = manga.get('url') if url is None or url == 'None': url = None else: url = self.__shiki.BASE_URL_SHIKI + url aried_on = manga.get('aired_on') if aried_on is None or aried_on == 'None': aried_on = None else: aried_on = datetime.datetime.strptime(manga.get('aired_on'), '%Y-%m-%d') released_on = manga.get('released_on') if released_on is None or released_on == 'None': released_on = None else: released_on = datetime.datetime.strptime(manga.get('released_on'), '%Y-%m-%d') description: str = manga.get('description') if description is not None and description != 'None': description = re.sub('\[.+?\]', ' ', description) description = description.replace("'", ' ') name_jp = manga.get('japanese') if name_jp is None or name_jp == 'None': name_jp = None else: name_jp = name_jp[0] if manga.get('name').find("'") != -1: name = manga.get('name').replace("'", '') else: name = manga.get('name') status = manga.get('status') if status is None or status == 'None': status = None else: status = status ls.append(Manga(id=manga.get('id'), name=name, name_ru=manga.get('russian'), name_jp=name_jp, kind=manga.get('kind'), score=manga.get('score'), status=status, volumes=manga.get('volumes'), chapters=manga.get('chapters'), description=description, aired_on=aried_on, released_on=released_on, url=url ) ) return ls def __convert_json_to_userrates(self, list_user_rates: list) -> list: user_rates = [] for anime in list_user_rates: target_type = self.__db.get_type(anime.get('target_type')) status = self.__db.get_status(anime.get('status')) created_at = datetime.datetime.strptime(anime.get('created_at')[:-10], '%Y-%m-%dT%H:%M:%S') updated_at = datetime.datetime.strptime(anime.get('updated_at')[:-10], '%Y-%m-%dT%H:%M:%S') user_rates.append(UserRates(id=anime.get('id'), user_id=anime.get('user_id'), target_id=anime.get('target_id'), target_type=target_type.id, score=anime.get('score'), status=status.id, rewatches=anime.get('rewatches'), episodes=anime.get('episodes'), volumes=anime.get('volumes'), chapters=anime.get('chapters'), text=anime.get('text'), created_at=created_at, updated_at=updated_at)) return user_rates def __auth_in_shiki(self, user: Users): s = self.__shiki.auth(token=user.token, refresh_token=user.refresh_token) if s.get('access_token') is not None: self.__db.add_user(tg_id=user.tg_id, token=s['access_token'], refresh_token=s['refresh_token'], user_id=user.id) res = True elif s.get('id') is not None: res = True else: res = False return res def __not_auth_in_shiki(self, user: Users): self.__tg.send_msg(chat_id=user.tg_id, msg='Авторизация больше не действительна. ' 'Необходимо авторизоваться заново!') self.__db.delete_token_user(id=user.id) def __generate_set_score_keyboard(self, user_rate_id: int, command: str) -> str: user_rate_id = str(user_rate_id) keyboard = '{"inline_keyboard": [[{"text": "0", "callback_data": "SetScrore/// %s 0 %s"}, ' % ( user_rate_id, command) keyboard += '{"text": "1", "callback_data": "SetScrore/// %s 1 %s"}, ' % (user_rate_id, command) keyboard += '{"text": "2", "callback_data": "SetScrore/// %s 2 %s"}],' % (user_rate_id, command) keyboard += '[{"text": "3", "callback_data": "SetScrore/// %s 3 %s"},' % (user_rate_id, command) keyboard += '{"text": "4", "callback_data": "SetScrore/// %s 4 %s"},' % (user_rate_id, command) keyboard += '{"text": "5", "callback_data": "SetScrore/// %s 5 %s"}],' % (user_rate_id, command) keyboard += '[{"text": "6", "callback_data": "SetScrore/// %s 6 %s"},' % (user_rate_id, command) keyboard += '{"text": "7", "callback_data": "SetScrore/// %s 7 %s"},' % (user_rate_id, command) keyboard += '{"text": "8", "callback_data": "SetScrore/// %s 8 %s"}],' % (user_rate_id, command) keyboard += '[{"text": "9", "callback_data": "SetScrore/// %s 9 %s"},' % (user_rate_id, command) keyboard += '{"text": "10", "callback_data": "SetScrore/// %s 10 %s"}]]}' % (user_rate_id, command) return keyboard def __generate_3_keyboard(self, array: list[dict], param: str, all: int, is_planned: bool = False) -> str: keyboard = '{"inline_keyboard": [[' i = 1 count = 0 for arr in array: if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 if param.lower().find('anime') != -1: keyboard += '{"text": %i, "callback_data": "anime_detail %i %s"},' % ( arr.get('text'), arr.get('id'), param) else: keyboard += '{"text": %i, "callback_data": "manga_detail %i %s"},' % ( arr.get('text'), arr.get('id'), param) i += 1 count += 1 if i == 10: break if all < 10: keyboard = keyboard[:-1] + ']]}' else: keyboard = keyboard[:-1] + '],[{"text": "Далее", "callback_data": "Next%s 9"}]]}' % param if is_planned: keyboard = keyboard[:-2] + ', [{"text": "Фильтр", "callback_data": "Filter//"}]]}' if param.lower().find('anime') != -1: keyboard = keyboard[:-2] + ',[{"text": "Main", "callback_data": "%s"}]]}' % 'Main//' else: keyboard = keyboard[:-2] + ',[{"text": "Main", "callback_data": "%s"}]]}' % 'MainManga//' return keyboard def __get_notify_message(self, users: list[Users], anime_list: list[Anime], manga_list: list[Manga]) -> dict: dc = {} for user in users: msg = '' for anime in anime_list: if self.__db.is_anime_added_user_rate(anime_id=anime.id, id_user=user.id): msg += f'\n--{anime.name_ru}' if msg != '' else f'Вышли все эпизоды по Аниме:\n\n--{anime.name_ru}' for manga in manga_list: if self.__db.is_manga_added_user_rate(manga_id=manga.id, id_user=user.id): if msg.find('Вышли все эпизоды по Манге') == -1: msg += '\n\nВышли все эпизоды по Манге:\n' msg += f'\n--{manga.name_ru}' dc[user.tg_id] = msg return dc def get_settings(self, tg_id: int): msg = 'Настройки\n' user = self.__db.get_user(tg_id=tg_id) setting_list = self.__db.get_settings_list(user.list_settings) msg += f'tg_id: {user.tg_id}\nuser_shiki_id: {user.id}\nОтображение списка: {setting_list[0].name}' \ f'\nУведомлять о выходе всех серий: {True if user.is_notify == 1 else False}' if user.is_notify == 1: user_keyboard = self.SETTIGNS_KEYBOARD_TG.replace(':is_notify_text', 'Отключить уведомления')\ .replace(':is_notify_param', '0') else: user_keyboard = self.SETTIGNS_KEYBOARD_TG.replace(':is_notify_text', 'Включить уведомления') \ .replace(':is_notify_param', '1') self.__tg.send_msg(chat_id=user.tg_id, msg=msg, reply_markup=user_keyboard) def set_settings_list(self, tg_id: int, msg: str, msg_id: int): settings_list = self.__db.get_settings_list() if msg == 'ChangeListSettings//': message = 'Настройка отображения:\n' keyboard = '{"inline_keyboard": [[' count = 0 for l in settings_list: message += f'{l.id}) {l.name}\n' if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 keyboard += '{"text": %i, "callback_data": "ChangeListSettings// %i"},' % (l.id, l.id) count += 1 keyboard = keyboard[:-1] + '],[{"text": "Main", "callback_data": "ListAnimeWatching//"}]]}' message = message[:-2] else: msg = msg.split(' ') self.__db.set_settings_list(tg_id=tg_id, list_settings=int(msg[1])) message = 'Вы успешно имзенили настройки отображения!' keyboard = '{"inline_keyboard": [[{"text": "Main", "callback_data": "ListAnimeWatching//"}]]}' self.__tg.edit_msg(chat_id=tg_id, message_id=msg_id, msg=message, reply_markup=keyboard) def change_notify_user(self, tg_id: int, msg_id: int, is_notify: bool): self.__db.update_user(tg_id=tg_id, is_notify=1 if is_notify else 0) message = 'Вы успешно имзенили настройки уведомления!' keyboard = '{"inline_keyboard": [[{"text": "Main", "callback_data": "ListAnimeWatching//"}]]}' self.__tg.edit_msg(chat_id=tg_id, message_id=msg_id, msg=message, reply_markup=keyboard) def get_info_about_anime_in_shiki(self, anime_list: list, tg_id: int = None): ls = [] if tg_id is not None: user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) for anime_id in anime_list: while True: try: anime: dict = self.__shiki.get_anime_info(id_anime=anime_id, token=user.token) break except Exception as e: sleep(1) ls.append(anime) else: for anime_id in anime_list: while True: try: anime: dict = self.__shiki.get_anime_info_not_auth(id_anime=anime_id) break except Exception as e: sleep(1) ls.append(anime) animes = self.__convert_json_to_anime(list_anime=ls) self.__db.insert_or_update_anime_detail(list_anime=animes) def get_info_about_manga_in_shiki(self, manga_list: list, tg_id: int = None): ls = [] if tg_id is not None: user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) for manga_id in manga_list: while True: try: manga: dict = self.__shiki.get_manga_info(id_manga=manga_id, token=user.token) break except Exception as e: sleep(1) ls.append(manga) else: for manga_id in manga_list: while True: try: manga: dict = self.__shiki.get_manga_info_not_auth(id_manga=manga_id) break except Exception as e: sleep(1) ls.append(manga) mangas = self.__convert_json_to_manga(list_manga=ls) self.__db.insert_or_update_manga_detail(list_manga=mangas) def get_info_anime_similar_in_shiki(self, tg_id: int, id_anime: int): user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) anime_similar = self.__shiki.get_anime_similar(id_anime=id_anime, token=user.token) anime_similar = self.__convert_json_to_anime(list_anime=anime_similar) return anime_similar def get_info_manga_similar_in_shiki(self, tg_id: int, id_manga: int): user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) manga_similar = self.__shiki.get_manga_similar(id_manga=id_manga, token=user.token) manga_similar = self.__convert_json_to_manga(list_manga=manga_similar) return manga_similar def get_anime_similar(self, tg_id: int, msg: str, msg_id: int): arr = msg.split(' ') id = int(arr[1]) page = int(arr[2]) anime_list = self.get_info_anime_similar_in_shiki(tg_id=tg_id, id_anime=id) anime_list = anime_list[0:9] msg = f'Что нашел:\n' keyboard = '{"inline_keyboard": [[' i = 1 count = 0 for anime in anime_list: msg += f'{i}) {anime.name}/{anime.name_ru}\n' if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 keyboard += '{"text": %i, "callback_data": "anime_search %i %i"},' % (i, anime.id, 1) key = 'similar_anime_' + str(tg_id) + '_' + str(anime.id) #self.__context.add(key=key, value=anime.name) i += 1 count += 1 keyboard = keyboard[:-1] + '],[{"text": "Назад", "callback_data": "anime_search %i %i"},' % (id, page) keyboard = keyboard[:-1] + ']]}' self.__tg.edit_msg(chat_id=tg_id, msg=msg, message_id=msg_id, reply_markup=keyboard) def get_manga_similar(self, tg_id: int, msg: str, msg_id: int): arr = msg.split(' ') id = int(arr[1]) page = int(arr[2]) manga_list = self.get_info_manga_similar_in_shiki(tg_id=tg_id, id_manga=id) manga_list = manga_list[0:9] msg = f'Что нашел:\n' keyboard = '{"inline_keyboard": [[' i = 1 count = 0 for manga in manga_list: msg += f'{i}) {manga.name}/{manga.name_ru}\n' if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 keyboard += '{"text": %i, "callback_data": "manga_search %i %i"},' % (i, manga.id, 1) i += 1 count += 1 keyboard = keyboard[:-1] + '],[{"text": "Назад", "callback_data": "manga_search %i %i"},' % (id, page) keyboard = keyboard[:-1] + ']]}' self.__tg.edit_msg(chat_id=tg_id, msg=msg, message_id=msg_id, reply_markup=keyboard) def get_min_info_about_anime_is_shiki(self, id_list: list, tg_id: int): user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) if len(id_list) > 50: chunks = Utils.chunkify(items=id_list, chunk_size=50) animes = [] for chunk in chunks: animes += self.__shiki.get_anime_list(list_ids=chunk, token=user.token) else: animes = self.__shiki.get_anime_list(list_ids=id_list, token=user.token) animes = self.__convert_json_to_anime(list_anime=animes) self.__db.insert_or_update_anime_detail(list_anime=animes) def get_min_info_about_manga_is_shiki(self, id_list: list, tg_id: int): user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) if len(id_list) > 50: chunks = Utils.chunkify(items=id_list, chunk_size=50) mangas = [] for chunk in chunks: mangas += self.__shiki.get_manga_list(list_ids=chunk, token=user.token) else: mangas = self.__shiki.get_manga_list(list_ids=id_list, token=user.token) mangas = self.__convert_json_to_manga(list_manga=mangas) self.__db.insert_or_update_manga_detail(list_manga=mangas) def get_info_my_list_in_shiki(self, tg_id: int): user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) list_user_rate = self.__shiki.get_anime_and_manga_list(user_id=user.id, token=user.token) list_user_rate = self.__convert_json_to_userrates(list_user_rates=list_user_rate) ls = [] ls2 = [] for anime in list_user_rate: if not self.__db.is_anime_in_bd(anime.target_id) and anime.target_type == 1: ls.append(anime.target_id) if not self.__db.is_manga_in_bd(anime.target_id) and anime.target_type == 2: ls2.append(anime.target_id) if len(ls) != 0: self.get_min_info_about_anime_is_shiki(id_list=ls, tg_id=tg_id) threading.Thread(target=self.get_info_about_anime_in_shiki, args=(ls, tg_id)).start() if len(ls2) != 0: self.get_min_info_about_manga_is_shiki(id_list=ls2, tg_id=tg_id) threading.Thread(target=self.get_info_about_manga_in_shiki, args=(ls2, tg_id)).start() self.__db.insert_or_update_anime_list(list_anime=list_user_rate, user_id=user.id) def delete_anime_list(self, tg_id: int, msg: str, msg_id: int): user_rate_id = msg.split(' ')[1] user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) code = self.__shiki.delete_user_rates(id_user_rates=int(user_rate_id), token=user.token) if code == 204: self.__db.delete_anime_in_user_rates(user_rates_id=int(user_rate_id)) self.get_my_list_anime(tg_id=tg_id, flag='ListAnimePlaned//', msg_id=msg_id) def delete_manga_list(self, tg_id: int, msg: str, msg_id: int): user_rate_id = msg.split(' ')[1] user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) code = self.__shiki.delete_user_rates(id_user_rates=int(user_rate_id), token=user.token) if code == 204: self.__db.delete_anime_in_user_rates(user_rates_id=int(user_rate_id)) self.get_my_list_manga(tg_id=tg_id, flag='ListMangaPlaned//', msg_id=msg_id) def edit_user_rates(self, tg_id: int, message_id: int, command: str): commands = command.split(' ') user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) if commands[0] == 'SetScrore//' and (len(commands) == 3 or len(commands) == 4): user_rate_id = commands[1] type = self.__db.get_type(id=self.__db.get_info_user_rate(id=int(user_rate_id)).target_type) user_rate = self.__db.get_info_user_rate(int(user_rate_id)) if type.name == 'Anime': anime = self.__db.get_info_anime(user_rate.target_id) else: anime = self.__db.get_info_manga(user_rate.target_id) try: keyboard = self.__generate_set_score_keyboard(user_rate_id=int(user_rate_id), command=commands[2] + ' ' + commands[3]) except Exception: keyboard = self.__generate_set_score_keyboard(user_rate_id=int(user_rate_id), command=commands[2]) self.__tg.edit_msg(chat_id=tg_id, message_id=message_id, msg=f'Какую оценку поставите?\n{anime.name}\n{anime.name_ru}\n' f'Текущая оценка: {user_rate.score}', reply_markup=keyboard) elif commands[0] == 'SetScrore///' and len(commands) > 3: user_rate_id = int(commands[1]) type = self.__db.get_type(id=self.__db.get_info_user_rate(id=user_rate_id).target_type) score = int(commands[2]) other = ['1', ' 2 '] other.append(commands[3]) try: other.append(' ' + commands[4]) except: pass other = ''.join(other) anime = self.__shiki.set_rates(id_user_rates=user_rate_id, score=score, token=user.token) list_anime_data = self.__convert_json_to_userrates(list_user_rates=[anime]) self.__db.insert_or_update_anime_list(list_anime=list_anime_data, user_id=user.id, flag='NO DELETE') if type.name == 'Anime': self.get_info_about_anime(tg_id=tg_id, msg_id=message_id, user_rate_id=user_rate_id, msg=other) else: self.get_info_about_manga(tg_id=tg_id, msg_id=message_id, user_rate_id=user_rate_id, msg=other) elif commands[0] == 'addVolumes//' or commands[0] == 'removeVolumes//': volumes = int(commands[1]) user_rate_id = int(commands[2]) other = ['1', ' 2 '] other.append(commands[3]) try: other.append(' ' + commands[4]) except: pass other = ''.join(other) manga = self.__shiki.set_rates(id_user_rates=user_rate_id, volumes=volumes, status='watching', token=user.token) list_manga_data = self.__convert_json_to_userrates(list_user_rates=[manga]) self.__db.insert_or_update_anime_list(list_anime=list_manga_data, user_id=user.id, flag='NO DELETE') self.get_info_about_manga(tg_id=tg_id, msg_id=message_id, user_rate_id=user_rate_id, msg=other) else: episodes = int(commands[1]) user_rate_id = int(commands[2]) type = self.__db.get_type(id=self.__db.get_info_user_rate(id=user_rate_id).target_type) other = ['1', ' 2 '] other.append(commands[3]) try: other.append(' ' + commands[4]) except: pass other = ''.join(other) if type.name == 'Anime': kind = self.__db.get_info_anime(id=self.__db.get_info_user_rate(id=user_rate_id).target_id).kind if kind == 'movie': anime = self.__shiki.set_rates(id_user_rates=user_rate_id, episodes=episodes, status='completed', token=user.token) else: anime = self.__shiki.set_rates(id_user_rates=user_rate_id, episodes=episodes, status='watching', token=user.token) else: anime = self.__shiki.set_rates(id_user_rates=user_rate_id, chapters=episodes, status='watching', token=user.token) list_anime_data = self.__convert_json_to_userrates(list_user_rates=[anime]) self.__db.insert_or_update_anime_list(list_anime=list_anime_data, user_id=user.id, flag='NO DELETE') if type.name == 'Anime': self.get_info_about_anime(tg_id=tg_id, msg_id=message_id, user_rate_id=user_rate_id, msg=other) else: self.get_info_about_manga(tg_id=tg_id, msg_id=message_id, user_rate_id=user_rate_id, msg=other) def update_anime_and_manga(self): animes = self.__db.get_anime_id_list_for_update() self.get_info_about_anime_in_shiki(anime_list=animes) animes_after_update = self.__db.get_anime_id_list_for_update() animes_list = [] users = self.__db.get_all_user_notify() for anime_id in animes: if str(animes_after_update).find(str(anime_id)) == -1: anime = self.__db.get_info_anime(id=anime_id) animes_list.append(anime) mangas = self.__db.get_manga_id_list_for_update() self.get_info_about_manga_in_shiki(manga_list=mangas) mangas_after_update = self.__db.get_manga_id_list_for_update() mangas_list = [] for manga_id in mangas: if str(mangas_after_update).find(str(manga_id)) == -1: manga = self.__db.get_info_manga(id=manga_id) mangas_list.append(manga) notify_dict = self.__get_notify_message(users, animes_list, mangas_list) for chat_id, msg in notify_dict.items(): self.__tg.send_msg(chat_id=chat_id, msg=msg) self.update_anime_franchise() def update_anime_franchise(self): animes = self.__db.get_anime_id_list_for_update_franchise() self.get_info_about_anime_in_shiki(anime_list=animes) def all_update_anime(self): animes = self.__db.get_all_anime_id() self.get_info_about_anime_in_shiki(anime_list=animes) def add_anime_in_my_list(self, tg_id: int, msg_id: int, msg: str): anime = self.__db.get_info_anime(id=int(msg.replace('add_user_rate ', ''))) user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) user_rate = self.__shiki.create_user_rates(user_id=user.id, target_id=anime.id, token=user.token, target_type='Anime') user_rate = self.__convert_json_to_userrates([user_rate]) self.__db.insert_or_update_anime_list(list_anime=user_rate, user_id=user.id, flag='NO DELETE') self.__tg.edit_msg(chat_id=tg_id, msg='Аниме добавлено в список!', message_id=msg_id, reply_markup=self.MY_ANIME_LIST_KEYBOARD_TG) def add_manga_in_my_list(self, tg_id: int, msg_id: int, msg: str): manga = self.__db.get_info_manga(id=int(msg.replace('add_user_rate_manga ', ''))) user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) user_rate = self.__shiki.create_user_rates(user_id=user.id, target_id=manga.id, token=user.token, target_type='Manga') user_rate = self.__convert_json_to_userrates([user_rate]) self.__db.insert_or_update_anime_list(list_anime=user_rate, user_id=user.id, flag='NO DELETE') self.__tg.edit_msg(chat_id=tg_id, msg='Манга добавлено в список!', message_id=msg_id, reply_markup=self.MY_MANGA_LIST_KEYBOARD_TG) def get_anime_franchise(self, tg_id: int, msg_id: int, msg: str): msg = msg.split(' ') user_rate_id = int(msg[1]) page = int(msg[2]) try: flag = msg[3] + ' ' + msg[4] except: flag = msg[3] user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) user_rate = self.__db.get_info_user_rate(id=user_rate_id) anime_id = user_rate.target_id anime = self.__db.get_info_anime(id=anime_id) anime_franchise = self.__shiki.get_anime_search(token=user.token, franchise=anime.franchise, limit=9, page=page, order='aired_on') anime_franchise = self.__convert_json_to_anime(list_anime=anime_franchise) msg = '' keyboard = '{"inline_keyboard": [[' i = 1 + (page - 1) * 9 k = i count = 0 for anime in anime_franchise: msg += f'{i}) {anime.name}/{anime.name_ru}\n' if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 keyboard += '{"text": %i, "callback_data": "anime_franchise_d %i %i %i %s"},' % (i, anime.id, user_rate_id, page, flag) i += 1 count += 1 if len(anime_franchise) == 0 and page != 1: msg = 'Дальше аниме нет!' keyboard = keyboard[ :-1] + '[{"text": "Назад", "callback_data": "anime_franchise %i %i %s"}]]}' % (user_rate_id, page - 1, flag) elif len(anime_franchise) < 9 and page != 1: keyboard = keyboard[ :-1] + '],[{"text": "Назад", "callback_data": "anime_franchise %i %i %s"}]]}' % ( user_rate_id, page - 1, flag) elif k == 1 and len(anime_franchise) >= 9: keyboard = keyboard[ :-1] + '],[{"text": "Далее", "callback_data": "anime_franchise %i %i %s"}]]}' % (user_rate_id, page + 1, flag) elif len(anime_franchise) < 9: keyboard = keyboard[:-1] + ']]}' else: keyboard = keyboard[:-1] + '],[{"text": "Назад", "callback_data": "anime_franchise %i %i %s"},' \ '{"text": "Далее", "callback_data": "anime_franchise %i %i %s"}]]}' % ( user_rate_id, page - 1, flag, user_rate_id, page + 1, flag) keyboard = keyboard[:-2] + ',[{"text": "Назад к Аниме", "callback_data": "anime_detail %i %s"}]]}' % ( user_rate_id, flag) keyboard = keyboard[:-2] + ',[{"text": "Main", "callback_data": "%s"}]]}' % 'Main//' if msg_id is None: self.__tg.send_msg(chat_id=tg_id, msg=msg, reply_markup=keyboard) else: self.__tg.edit_msg(chat_id=tg_id, msg=msg, reply_markup=keyboard, message_id=msg_id) def search_main_anime_or_manga(self, tg_id: int, flag: str) -> None: if flag == 'SearchAnime//': msg = 'Введите название Аниме' self.__db.update_user(tg_id=tg_id, search='anime_search///') else: msg = 'Введите название Манги' self.__db.update_user(tg_id=tg_id, search='manga_search///') self.__tg.send_msg(chat_id=tg_id, msg=msg) def get_anime_seasons(self, tg_id: int, year: int = None, msg_id: int = None): if msg_id is None: msg = 'Введите год:' self.__tg.send_msg(chat_id=tg_id, msg=msg) else: if year < 1900: self.__tg.send_msg(chat_id=tg_id, msg='Введите год больше 1900!') else: msg = 'Выберите сезон:\n\n' keyboard = '{"inline_keyboard": [[{"text": "Зимний сезон", "callback_data": "seasons// winter %i"}], ' \ '[{"text": "Весенний сезон", "callback_data": "seasons// spring %i"}],' \ '[{"text": "Летний сезон", "callback_data": "seasons// summer %i"}],' \ '[{"text": "Осенний сезон", "callback_data": "seasons// fall %i"}],' \ '[{"text": "За весь год", "callback_data": "seasons// None %i"}]]}' % (year, year, year, year, year) self.__tg.send_msg(chat_id=tg_id, msg=msg, reply_markup=keyboard) def get_anime_seasons_result(self, tg_id: int, msg: str, msg_id: int): split = msg.split(' ') anime_id = int(split[1]) page = int(split[4]) seasons = split[2] year = split[3] user = self.__db.get_user(tg_id=tg_id) is_anime_added = self.__db.is_anime_added_user_rate(anime_id=anime_id, id_user=user.id) if is_anime_added: keyboard = '{"inline_keyboard": [[{"text": "Похожие", "callback_data": "anime_similar %i %i"}],' \ '[{"text": "Назад", "callback_data": "seasons// %s %s %i"}]]}' % (anime_id, page, seasons, year, page) else: keyboard = '{"inline_keyboard": [[{"text": "Добавить в список", "callback_data": "add_user_rate %i"}], ' \ '[{"text": "Похожие", "callback_data": "anime_similar %i %i"}],' \ '[{"text": "Назад", "callback_data": "seasons// %s %s %i"}]]}' % (anime_id, anime_id, page, seasons, year, page) keyboard = keyboard[:-2] + ',[{"text": "Main", "callback_data": "%s"}]]}' % 'Main//' if not self.__db.is_anime_in_bd(anime_id=anime_id): self.get_info_about_anime_in_shiki(anime_list=[anime_id], tg_id=tg_id) anime = self.__db.get_info_anime(anime_id) status = anime.status message = f'Название: {anime.name}\nНазвание_ru: {anime.name_ru}\nСтатус: {anime.status}\n' \ f'Рейтинг: {anime.rating}\nТип: {anime.kind}\n' if status == 'ongoing': if anime.next_episode_at is not None: message += f'Дата выхода эпизода: {datetime.datetime.strftime(anime.next_episode_at, "%Y-%m-%d")}\n' message += f'Ко-во вышедших эпизодов: {anime.episodes_aired}\n' message += f'Всего эпизодов: {anime.episodes}\n' if status != 'anons': message += f'Дата выхода: {datetime.datetime.strftime(anime.aired_on, "%Y-%m-%d")}\n' message += f'Оценка: {anime.score}\nUrl: {anime.url}\n\nОписание:\n{anime.description}' self.__tg.edit_msg(chat_id=tg_id, msg=message, message_id=msg_id, reply_markup=keyboard) def get_anime_seasons_in_shiki(self, tg_id: int, msg: str, msg_id: int = None): split = msg.split(' ') if split[1] == 'None': season = None else: season = split[1] year = split[2] if len(split) == 3: page = 1 else: page = int(split[3]) user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) if season is not None: anime_list = self.__shiki.get_anime_search(token=user.token, limit=9, page=page, season=season + '_' + year) else: anime_list = self.__shiki.get_anime_search(token=user.token, limit=9, page=page, season=year) anime_list = self.__convert_json_to_anime(list_anime=anime_list) msg = f'Сезон: {season}, Год: {year}\n\nЧто нашел:\n' keyboard = '{"inline_keyboard": [[' if msg_id is not None: i = 1 + (page - 1) * 9 else: i = 1 k = i count = 0 for anime in anime_list: msg += f'{i}) {anime.name}/{anime.name_ru}\n' if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 keyboard += '{"text": %i, "callback_data": "anime_seasons %i %s %s %i"},' % (i, anime.id, season, year, page) i += 1 count += 1 if len(anime_list) == 0: msg = 'Дальше аниме нет' keyboard = keyboard[ :-1] + '[{"text": "Назад", "callback_data": "seasons// %s %s %i"}]]}' % (season, year, page - 1) elif k == 1: keyboard = keyboard[ :-1] + '],[{"text": "Далее", "callback_data": "seasons// %s %s %i"}]]}' % (season, year, page + 1) else: keyboard = keyboard[:-1] + '],[{"text": "Назад", "callback_data": "seasons// %s %s %i"},' \ '{"text": "Далее", "callback_data": "seasons// %s %s %i"}]]}' % ( season, year, page - 1, season, year, page + 1) keyboard = keyboard[:-2] + ',[{"text": "Main", "callback_data": "%s"}]]}' % 'Main//' if msg_id is None: self.__tg.send_msg(chat_id=tg_id, msg=msg, reply_markup=keyboard) else: self.__tg.edit_msg(chat_id=tg_id, msg=msg, reply_markup=keyboard, message_id=msg_id) def search_anime_in_shiki(self, tg_id: int, msg: str, msg_id: int = None): key = 'search_anime_' + str(tg_id) if msg_id is not None: st = msg.index('search//+') page = int(msg[0:st - 1]) anime_name = self.__context.get(key=key) else: page = 1 counter = 1 anime_name = msg self.__context.add(key=key, value=msg) self.__db.update_user(tg_id=tg_id) user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) if anime_name is None: msg = 'Воспользуйтесь поиском аниме заново' if msg_id is None: self.__tg.send_msg(chat_id=tg_id, msg=msg, reply_markup=self.MY_ANIME_LIST_KEYBOARD_TG) else: self.__tg.edit_msg(chat_id=tg_id, msg=msg, reply_markup=self.MY_ANIME_LIST_KEYBOARD_TG, message_id=msg_id) return 0 anime_list = self.__shiki.get_anime_search(token=user.token, search=anime_name, limit=9, page=page) anime_list = self.__convert_json_to_anime(list_anime=anime_list) msg = f'Поиск: {anime_name}\n\nЧто нашел:\n' keyboard = '{"inline_keyboard": [[' if msg_id is not None: i = 1 + (page - 1) * 9 else: i = 1 k = i count = 0 for anime in anime_list: msg += f'{i}) {anime.name}/{anime.name_ru}\n' if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 keyboard += '{"text": %i, "callback_data": "anime_search %i %i"},' % (i, anime.id, page) i += 1 count += 1 if len(anime_list) == 0: msg = 'Дальше аниме нет' keyboard = keyboard[ :-1] + '[{"text": "Назад", "callback_data": "%i search//+"}]]}' % (page - 1) elif k == 1: keyboard = keyboard[ :-1] + '],[{"text": "Далее", "callback_data": "%i search//+"}]]}' % (page + 1) else: keyboard = keyboard[:-1] + '],[{"text": "Назад", "callback_data": "%i search//+"},' \ '{"text": "Далее", "callback_data": "%i search//+"}]]}' % ( page - 1, page + 1) keyboard = keyboard[:-2] + ',[{"text": "Main", "callback_data": "%s"}]]}' % 'Main//' if msg_id is None: self.__tg.send_msg(chat_id=tg_id, msg=msg, reply_markup=keyboard) else: self.__tg.edit_msg(chat_id=tg_id, msg=msg, reply_markup=keyboard, message_id=msg_id) def search_manga_in_shiki(self, tg_id: int, msg: str, msg_id: int = None): key = 'search_manga_' + str(tg_id) if msg_id is not None: st = msg.index('search//_') page = int(msg[0:st - 1]) manga_name = self.__context.get(key=key) else: page = 1 manga_name = msg self.__context.add(key=key, value=manga_name) self.__db.update_user(tg_id=tg_id) user = self.__db.get_user(tg_id=tg_id) if not self.__auth_in_shiki(user=user): self.__not_auth_in_shiki(user=user) return 0 user = self.__db.get_user(tg_id=tg_id) manga_list = self.__shiki.get_manga_search(token=user.token, search=manga_name, limit=9, page=page) manga_list = self.__convert_json_to_manga(list_manga=manga_list) msg = f'Поиск: {manga_name}\n\nЧто нашел:\n' keyboard = '{"inline_keyboard": [[' if msg_id is not None: i = 1 + (page - 1) * 9 else: i = 1 k = i count = 0 for manga in manga_list: msg += f'{i}) {manga.name}/{manga.name_ru}\n' if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 keyboard += '{"text": %i, "callback_data": "manga_search %i %i"},' % (i, manga.id, page) i += 1 count += 1 if len(manga_list) == 0: msg = 'Дальше манги нет' keyboard = keyboard[ :-1] + '[{"text": "Назад", "callback_data": "%i search//_"}]]}' % (page - 1) elif k == 1: keyboard = keyboard[ :-1] + '],[{"text": "Далее", "callback_data": "%i search//_"}]]}' % (page + 1) else: keyboard = keyboard[:-1] + '],[{"text": "Назад", "callback_data": "%i search//_"},' \ '{"text": "Далее", "callback_data": "%i search//_"}]]}' % ( page - 1, page + 1) keyboard = keyboard[:-2] + ',[{"text": "Main", "callback_data": "%s"}]]}' % 'MainManga//' if msg_id is None: self.__tg.send_msg(chat_id=tg_id, msg=msg, reply_markup=keyboard) else: self.__tg.edit_msg(chat_id=tg_id, msg=msg, reply_markup=keyboard, message_id=msg_id) def search_anime_result(self, tg_id: int, msg_id: int, msg: str): arr = msg.split(' ') id = int(arr[1]) page = int(arr[2]) key = 'search_anime_' + str(tg_id) key_similar = 'similar_anime_' + str(tg_id) + '_' + str(id) user = self.__db.get_user(tg_id=tg_id) is_anime_added = self.__db.is_anime_added_user_rate(anime_id=id, id_user=user.id) if is_anime_added: keyboard = '{"inline_keyboard": [[{"text": "Похожие", "callback_data": "anime_similar %i %i"}],' \ '[{"text": "Назад", "callback_data": "%i search//+"}]]}' % (id, page, page) else: keyboard = '{"inline_keyboard": [[{"text": "Добавить в список", "callback_data": "add_user_rate %i"}], ' \ '[{"text": "Похожие", "callback_data": "anime_similar %i %i"}],' \ '[{"text": "Назад", "callback_data": "%i search//+"}]]}' % (id, id, page, page) keyboard = keyboard[:-2] + ',[{"text": "Main", "callback_data": "%s"}]]}' % 'Main//' if not self.__db.is_anime_in_bd(anime_id=id): self.get_info_about_anime_in_shiki(anime_list=[id], tg_id=tg_id) anime = self.__db.get_info_anime(id) status = anime.status #self.__context.add(key=key, value=anime.name) message = f'Название: {anime.name}\nНазвание_ru: {anime.name_ru}\nСтатус: {anime.status}\n' \ f'Рейтинг: {anime.rating}\nТип: {anime.kind}\n' if status == 'ongoing': message += f'Дата выхода эпизода: {datetime.datetime.strftime(anime.next_episode_at, "%Y-%m-%d")}\n' message += f'Ко-во вышедших эпизодов: {anime.episodes_aired}\n' message += f'Всего эпизодов: {anime.episodes}\n' if status != 'anons': message += f'Дата выхода: {datetime.datetime.strftime(anime.aired_on, "%Y-%m-%d")}\n' message += f'Оценка: {anime.score}\nUrl: {anime.url}\n\nОписание:\n{anime.description}' self.__tg.edit_msg(chat_id=tg_id, msg=message, message_id=msg_id, reply_markup=keyboard) def search_manga_result(self, tg_id: int, msg_id: int, msg: str): arr = msg.split(' ') id = int(arr[1]) page = int(arr[2]) key = 'search_manga_' + str(tg_id) key_similar = 'similar_manga_' + str(tg_id) + '_' + str(id) user = self.__db.get_user(tg_id=tg_id) is_manga_added = self.__db.is_anime_added_user_rate(anime_id=id, id_user=user.id) if is_manga_added: keyboard = '{"inline_keyboard": [[{"text": "Похожие", "callback_data": "manga_similar %i %i"}],' \ '[{"text": "Назад", "callback_data": "%i search//_"}]]}' % (id, page, page) else: keyboard = '{"inline_keyboard": [[{"text": "Добавить в список", "callback_data": "add_user_rate_manga %i"}], ' \ '[{"text": "Похожие", "callback_data": "manga_similar %i %i"}],' \ '[{"text": "Назад", "callback_data": "%i search//_"}]]}' % (id, id, page, page) keyboard = keyboard[:-2] + ',[{"text": "Main", "callback_data": "%s"}]]}' % 'MainManga//' if not self.__db.is_manga_in_bd(manga_id=id): self.get_info_about_manga_in_shiki(manga_list=[id], tg_id=tg_id) manga = self.__db.get_info_manga(id) status = manga.status message = f'Название: {manga.name}\nНазвание_ru: {manga.name_ru}\nСтатус: {manga.status}\n' \ f'Рейтинг: {manga.score}\nТип: {manga.kind}\n' message += f'Ко-во вышедших глав: {manga.chapters}\n' if status != 'anons': message += f'Дата выхода: {datetime.datetime.strftime(manga.aired_on, "%Y-%m-%d")}\n' message += f'Url: {manga.url}\n\nОписание:\n{manga.description}' self.__tg.edit_msg(chat_id=tg_id, msg=message, message_id=msg_id, reply_markup=keyboard) def get_info_about_anime_franchise(self, tg_id: int, msg_id: int, msg: str): msg = msg.split(' ') anime_id = int(msg[1]) user_rate_id = int(msg[2]) page = int(msg[3]) try: flag = msg[4] + ' ' + msg[5] except: flag = msg[4] user = self.__db.get_user(tg_id=tg_id) self.get_info_about_anime_in_shiki(anime_list=[anime_id], tg_id=tg_id) anime = self.__db.get_info_anime(id=anime_id) is_my_list = self.__db.is_anime_added_user_rate(anime_id=anime_id, id_user=user.id) status = anime.status message = f'Название: {anime.name}\nНазвание_ru: {anime.name_ru}\nСтатус: {anime.status}\n' \ f'Рейтинг: {anime.rating}\nТип: {anime.kind}\n' if status == 'ongoing': message += f'Дата выхода эпизода: {datetime.datetime.strftime(anime.next_episode_at, "%Y-%m-%d")}\n' message += f'Ко-во вышедших эпизодов: {anime.episodes_aired}\n' message += f'Всего эпизодов: {anime.episodes}\n' if status != 'anons': message += f'Дата выхода: {datetime.datetime.strftime(anime.aired_on, "%Y-%m-%d")}\n' message += f'Оценка: {anime.score}\nUrl: {anime.url}\n\nОписание:\n{anime.description}' if not is_my_list: keyboard = '{"inline_keyboard": [[{"text": "Добавить в список", "callback_data": "add_user_rate %i"}],' % \ anime_id else: keyboard = '{"inline_keyboard": [' keyboard = keyboard + '[{"text": "Назад", "callback_data": "anime_franchise %i %i %s"}]]}' % (user_rate_id, page, flag) self.__tg.edit_msg(chat_id=user.tg_id, msg=message, message_id=msg_id, reply_markup=keyboard) def get_info_about_anime(self, tg_id: int, msg_id: int, user_rate_id: int, msg: str): msg = msg.split(' ') user = self.__db.get_user(tg_id=tg_id) user_rate = self.__db.get_info_user_rate(id=user_rate_id) anime = self.__db.get_info_anime(id=user_rate.target_id) anime_franchise = self.__shiki.get_anime_search(token=user.token, franchise=anime.franchise, limit=9, page=1, order='aired_on', timeout=3) status = anime.status message = f'Название: {anime.name}\nНазвание_ru: {anime.name_ru}\nСтатус: {anime.status}\n' \ f'Рейтинг: {anime.rating}\nТип: {anime.kind}\n' if status == 'ongoing': message += f'Дата выхода эпизода: {datetime.datetime.strftime(anime.next_episode_at, "%Y-%m-%d")}\n' message += f'Ко-во вышедших эпизодов: {anime.episodes_aired}\n' message += f'Просмотренно эпизодов: {user_rate.episodes}\n' \ f'Всего эпизодов: {anime.episodes}\n' if status != 'anons': message += f'Дата выхода: {datetime.datetime.strftime(anime.aired_on, "%Y-%m-%d")}\n' message += f'Оценка Ваша: {user_rate.score}\n' \ f'Оценка: {anime.score}\nUrl: {anime.url}\n\nОписание:\n{anime.description}' if status != 'anons': try: p = 'addEpisodes// ' + str(user_rate.episodes + 1) + ' ' + str(user_rate.id) + ' ' + msg[2] + ' ' + msg[ 3] m = 'removeEpisodes// ' + str(user_rate.episodes - 1) + ' ' + str(user_rate.id) + ' ' + msg[2] + ' ' + \ msg[3] except: p = 'addEpisodes// ' + str(user_rate.episodes + 1) + ' ' + str(user_rate.id) + ' ' + msg[2] m = 'removeEpisodes// ' + str(user_rate.episodes - 1) + ' ' + str(user_rate.id) + ' ' + msg[2] if user_rate.episodes == anime.episodes: keyboard = '{"inline_keyboard": [[{"text": "-", "callback_data": "%s"}],yy' % (m) elif user_rate.episodes != 0: keyboard = '{"inline_keyboard": [[{"text": "-", "callback_data": "%s"},' \ '{"text": "+", "callback_data": "%s"}],yy' % (m, p) else: keyboard = '{"inline_keyboard": [[{"text": "+", "callback_data": "%s"}],yy' % (p) if user_rate.status == 3: keyboard = keyboard[ :-2] + '[{"text": "Удалить из списка", "callback_data": "DeleteUserRates// %s"}],yy' % user_rate.id else: try: set_score = 'SetScrore// %s %s' % (user_rate.id, msg[2] + ' ' + msg[3]) except Exception: set_score = 'SetScrore// %s %s' % (user_rate.id, msg[2]) keyboard = keyboard[ :-2] + '[{"text": "Поставить оценку", "callback_data": "%s"}],yy' % set_score else: keyboard = '{"inline_keyboard": [[[' if len(anime_franchise) > 0: try: keyboard = keyboard[:-2] + '[{"text": "Франшиза", "callback_data": "anime_franchise %s %i %s"}], yy' % ( user_rate_id, 1, msg[2] + ' ' + msg[3]) except: keyboard = keyboard[:-2] + '[{"text": "Франшиза", "callback_data": "anime_franchise %s %i %s"}], yy' % ( user_rate_id, 1, msg[2]) #keyboard = keyboard[:-2] + '[{"text": "Похожие", "callback_data": "anime_similar %i"}], yy' % anime.id try: keyboard = keyboard[:-2] + '[{"text": "Назад", "callback_data": "%s"}]]}' % (msg[2] + ' ' + msg[3]) except: keyboard = keyboard[:-2] + '[{"text": "Назад", "callback_data": "%s"}]]}' % (msg[2]) self.__tg.edit_msg(chat_id=user.tg_id, msg=message, message_id=msg_id, reply_markup=keyboard) def get_info_about_manga(self, tg_id: int, msg_id: int, user_rate_id: int, msg: str): msg = msg.split(' ') user = self.__db.get_user(tg_id=tg_id) user_rate = self.__db.get_info_user_rate(id=user_rate_id) manga = self.__db.get_info_manga(id=user_rate.target_id) status = manga.status message = f'Название: {manga.name}\nНазвание_ru: {manga.name_ru}\nСтатус: {manga.status}\n' \ f'Тип: {manga.kind}\n' if status == 'ongoing': message += f'Ко-во вышедших томов: {manga.volumes}\n' message += f'Ко-во вышедших глав: {manga.chapters}\n' message += f'Прочитано томов: {user_rate.volumes}\n' \ f'Всего томов: {manga.volumes}\n' \ f'Прочитано глав: {user_rate.chapters}\n' \ f'Всего глав: {manga.chapters}\n' if status != 'anons': message += f'Дата выхода: {datetime.datetime.strftime(manga.aired_on, "%Y-%m-%d")}\n' message += f'Оценка Ваша: {user_rate.score}\n' \ f'Оценка: {manga.score}\nUrl: {manga.url}\n\nОписание:\n{manga.description}' if status != 'anons': try: p = 'addEpisodes// ' + str(user_rate.chapters + 1) + ' ' + str(user_rate.id) + ' ' + msg[2] + ' ' + msg[ 3] m = 'removeEpisodes// ' + str(user_rate.chapters - 1) + ' ' + str(user_rate.id) + ' ' + msg[2] + ' ' + \ msg[3] t = 'addVolumes// ' + str(user_rate.volumes + 1) + ' ' + str(user_rate.id) + ' ' + msg[2] + ' ' + \ msg[3] k = 'removeVolumes// ' + str(user_rate.volumes - 1) + ' ' + str(user_rate.id) + ' ' + msg[2] + ' ' + \ msg[3] except: p = 'addEpisodes// ' + str(user_rate.chapters + 1) + ' ' + str(user_rate.id) + ' ' + msg[2] m = 'removeEpisodes// ' + str(user_rate.chapters - 1) + ' ' + str(user_rate.id) + ' ' + msg[2] t = 'addVolumes// ' + str(user_rate.volumes + 1) + ' ' + str(user_rate.id) + ' ' + msg[2] k = 'removeVolumes// ' + str(user_rate.volumes - 1) + ' ' + str(user_rate.id) + ' ' + msg[2] if user_rate.volumes == manga.volumes: keyboard = '{"inline_keyboard": [[{"text": "Том -", "callback_data": "%s"}],yy' % (k) elif user_rate.volumes != 0: keyboard = '{"inline_keyboard": [[{"text": "Том -", "callback_data": "%s"},' \ '{"text": "Том +", "callback_data": "%s"}],yy' % (k, t) else: keyboard = '{"inline_keyboard": [[{"text": "Том +", "callback_data": "%s"}],yy' % (t) if user_rate.chapters == manga.chapters: keyboard = keyboard[:-2] + '[{"text": "Глава -", "callback_data": "%s"}],yy' % (m) elif user_rate.chapters != 0: keyboard = keyboard[:-2] + '[{"text": "Глава -", "callback_data": "%s"},' \ '{"text": "Глава +", "callback_data": "%s"}],yy' % (m, p) else: keyboard = keyboard[:-2] + '[{"text": "Глава +", "callback_data": "%s"}],yy' % (p) if user_rate.status == 3: keyboard = keyboard[ :-2] + '[{"text": "Удалить из списка", "callback_data": "DeleteUserRatesManga// %s"}],yy' % user_rate.id else: try: set_score = 'SetScrore// %s %s' % (user_rate.id, msg[2] + ' ' + msg[3]) except Exception: set_score = 'SetScrore// %s %s' % (user_rate.id, msg[2]) keyboard = keyboard[ :-2] + '[{"text": "Поставить оценку", "callback_data": "%s"}],yy' % set_score else: keyboard = '{"inline_keyboard": [[[' try: keyboard = keyboard[:-2] + '[{"text": "Назад", "callback_data": "%s"}]]}' % (msg[2] + ' ' + msg[3]) except: keyboard = keyboard[:-2] + '[{"text": "Назад", "callback_data": "%s"}]]}' % (msg[2]) self.__tg.edit_msg(chat_id=user.tg_id, msg=message, message_id=msg_id, reply_markup=keyboard) def get_next_list_anime(self, tg_id: int, flag: str, msg_id: int): user = self.__db.get_user(tg_id=tg_id) message = '' keyboard = '' flag = flag.split(' ') if flag[0] == 'NextListAnimeCompleted//': spisok = self.__db.get_my_list_anime(status='completed', user_id=user.id) len_spisok = len(spisok) message = f'Аниме просмотренно {len_spisok}:\nНазвание\n\n' i = int(flag[1]) j = i if i < 0: i = 0 spisok = self.__db.get_my_list_anime_9_rows(status='completed', user_id=user.id, index=i) keyboard = '{"inline_keyboard": [[' count = 0 for anime in spisok: message += str(i + 1) + ') ' + anime[0] + '/' + anime[1] + '\n' if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 keyboard += '{"text": %i, "callback_data": "anime_detail %i NextListAnimeCompleted// %s"},' % ( i + 1, anime[3], flag[1]) i += 1 count += 1 if len(spisok) < 9: k = j + 9 - 18 else: k = i - 18 if i == len_spisok: keyboard = keyboard[ :-1] + '],[{"text": "Назад", "callback_data": "NextListAnimeCompleted// %i"}]]}' % (k) elif k < 0: keyboard = keyboard[ :-1] + '],[{"text": "Далее", "callback_data": "NextListAnimeCompleted// %i"}]]}' % (i) else: keyboard = keyboard[:-1] + '],[{"text": "Назад", "callback_data": "NextListAnimeCompleted// %i"},' \ '{"text": "Далее", "callback_data": "NextListAnimeCompleted// %i"}]]}' % ( k, i) elif flag[0] == 'NextListAnimeAll//': spisok = self.__db.get_my_list_anime(status='all', user_id=user.id) len_spisok = len(spisok) message = f'Все аниме {len_spisok}:\nНазвание\n\n' i = int(flag[1]) j = i if i < 0: i = 0 spisok = self.__db.get_my_list_anime_9_rows(status='all', user_id=user.id, index=i) keyboard = '{"inline_keyboard": [[' count = 0 for anime in spisok: message += str(i + 1) + ') ' + anime[0] + '/' + anime[1] + '\n' if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 keyboard += '{"text": %i, "callback_data": "anime_detail %i NextListAnimeAll// %s"},' % ( i + 1, anime[4], flag[1]) i += 1 count += 1 if len(spisok) < 9: k = j + 9 - 18 else: k = i - 18 if i == len_spisok: keyboard = keyboard[ :-1] + '],[{"text": "Назад", "callback_data": "NextListAnimeAll// %i"}]]}' % (k) elif k < 0: keyboard = keyboard[ :-1] + '],[{"text": "Далее", "callback_data": "NextListAnimeAll// %i"}]]}' % (i) else: keyboard = keyboard[:-1] + '],[{"text": "Назад", "callback_data": "NextListAnimeAll// %i"},' \ '{"text": "Далее", "callback_data": "NextListAnimeAll// %i"}]]}' % ( k, i) elif flag[0] == 'NextListAnimeWatching//': spisok = self.__db.get_my_list_anime(status='watching', user_id=user.id) len_spisok = len(spisok) message = f'Аниме смотрю {len(spisok)}:\nНазвание - Кол-во просмотренных эпизодов\n\n' i = int(flag[1]) j = i if i < 0: i = 0 spisok = self.__db.get_my_list_anime_9_rows(status='watching', user_id=user.id, index=i) keyboard = '{"inline_keyboard": [[' count = 0 for anime in spisok: message += str(i + 1) + ') ' + anime[0] + '/' + anime[1] + ' - ' + str(anime[2]) + '\n' if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 keyboard += '{"text": %i, "callback_data": "anime_detail %i NextListAnimeWatching// %s"},' % ( i + 1, anime[3], flag[1]) i += 1 count += 1 if len(spisok) < 9: k = j + 9 - 18 else: k = i - 18 if i == len_spisok: keyboard = keyboard[ :-1] + '],[{"text": "Назад", "callback_data": "NextListAnimeWatching// %i"}]]}' % (k) elif k < 0: keyboard = keyboard[ :-1] + '],[{"text": "Далее", "callback_data": "NextListAnimeWatching// %i"}]]}' % (i) else: keyboard = keyboard[:-1] + '],[{"text": "Назад", "callback_data": "NextListAnimeWatching// %i"},' \ '{"text": "Далее", "callback_data": "NextListAnimeWatching// %i"}]]}' % ( k, i) elif flag[0] == 'NextListAnimePlaned//': spisok = self.__db.get_my_list_anime(status='planned', user_id=user.id) len_spisok = len(spisok) message = f'Аниме запланировано {len(spisok)}:\nНазвание - Кол-во всего эпизодов\n\n' i = int(flag[1]) j = i if i < 0: i = 0 spisok = self.__db.get_my_list_anime_9_rows(status='planned', user_id=user.id, index=i) keyboard = '{"inline_keyboard": [[' count = 0 for anime in spisok: message += str(i + 1) + ') <b>' + anime[4] + '</b>: ' + anime[0] + '\n\b' + anime[1] + ' - ' + str( anime[2]) + '\n' if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 keyboard += '{"text": %i, "callback_data": "anime_detail %i NextListAnimePlaned// %s"},' % ( i + 1, anime[3], flag[1]) i += 1 count += 1 if len(spisok) < 9: k = j + 9 - 18 else: k = i - 18 if i == len_spisok: keyboard = keyboard[ :-1] + '],[{"text": "Назад", "callback_data": "NextListAnimePlaned// %i"}]]}' % (k) elif k < 0: keyboard = keyboard[ :-1] + '],[{"text": "Далее", "callback_data": "NextListAnimePlaned// %i"}]]}' % (i) else: keyboard = keyboard[:-1] + '],[{"text": "Назад", "callback_data": "NextListAnimePlaned// %i"},' \ '{"text": "Далее", "callback_data": "NextListAnimePlaned// %i"}]]}' % ( k, i) keyboard = keyboard[:-2] + ', [{"text": "Фильтр", "callback_data": "Filter//"}]]}' keyboard = keyboard[:-2] + ',[{"text": "Main", "callback_data": "%s"}]]}' % 'Main//' self.__tg.edit_msg(chat_id=user.tg_id, msg=message, reply_markup=keyboard, message_id=msg_id) def get_next_list_manga(self, tg_id: int, flag: str, msg_id: int): user = self.__db.get_user(tg_id=tg_id) message = '' keyboard = '' flag = flag.split(' ') if flag[0] == 'NextListMangaCompleted//': spisok = self.__db.get_my_list_manga(status='completed', user_id=user.id) len_spisok = len(spisok) message = f'Манги прочитано {len_spisok}:\nНазвание\n\n' i = int(flag[1]) j = i if i < 0: i = 0 spisok = self.__db.get_my_list_manga_9_rows(status='completed', user_id=user.id, index=i) keyboard = '{"inline_keyboard": [[' count = 0 for anime in spisok: message += str(i + 1) + ') ' + anime[0] + '/' + anime[1] + '\n' if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 keyboard += '{"text": %i, "callback_data": "manga_detail %i NextListMangaCompleted// %s"},' % ( i + 1, anime[3], flag[1]) i += 1 count += 1 if len(spisok) < 9: k = j + 9 - 18 else: k = i - 18 if i == len_spisok: keyboard = keyboard[ :-1] + '],[{"text": "Назад", "callback_data": "NextListMangaCompleted// %i"}]]}' % (k) elif k < 0: keyboard = keyboard[ :-1] + '],[{"text": "Далее", "callback_data": "NextListMangaCompleted// %i"}]]}' % (i) else: keyboard = keyboard[:-1] + '],[{"text": "Назад", "callback_data": "NextListMangaCompleted// %i"},' \ '{"text": "Далее", "callback_data": "NextListMangaCompleted// %i"}]]}' % ( k, i) elif flag[0] == 'NextListMangaAll//': spisok = self.__db.get_my_list_anime(status='all', user_id=user.id) len_spisok = len(spisok) message = f'Вся манга {len_spisok}:\nНазвание\n\n' i = int(flag[1]) j = i if i < 0: i = 0 spisok = self.__db.get_my_list_manga_9_rows(status='all', user_id=user.id, index=i) keyboard = '{"inline_keyboard": [[' count = 0 for anime in spisok: message += str(i + 1) + ') ' + anime[0] + '/' + anime[1] + '\n' if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 keyboard += '{"text": %i, "callback_data": "manga_detail %i NextListMangaAll// %s"},' % ( i + 1, anime[4], flag[1]) i += 1 count += 1 if len(spisok) < 9: k = j + 9 - 18 else: k = i - 18 if i == len_spisok: keyboard = keyboard[ :-1] + '],[{"text": "Назад", "callback_data": "NextListMangaAll// %i"}]]}' % (k) elif k < 0: keyboard = keyboard[ :-1] + '],[{"text": "Далее", "callback_data": "NextListMangaAll// %i"}]]}' % (i) else: keyboard = keyboard[:-1] + '],[{"text": "Назад", "callback_data": "NextListMangaAll// %i"},' \ '{"text": "Далее", "callback_data": "NextListMangaAll// %i"}]]}' % ( k, i) elif flag[0] == 'NextListMangaWatching//': spisok = self.__db.get_my_list_anime(status='watching', user_id=user.id) len_spisok = len(spisok) message = f'Манги читаю {len(spisok)}:\nНазвание - Кол-во просмотренных эпизодов\n\n' i = int(flag[1]) j = i if i < 0: i = 0 spisok = self.__db.get_my_list_manga_9_rows(status='watching', user_id=user.id, index=i) keyboard = '{"inline_keyboard": [[' count = 0 for anime in spisok: message += str(i + 1) + ') ' + anime[0] + '/' + anime[1] + ' - ' + str(anime[2]) + '\n' if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 keyboard += '{"text": %i, "callback_data": "manga_detail %i NextListMangaWatching// %s"},' % ( i + 1, anime[3], flag[1]) i += 1 count += 1 if len(spisok) < 9: k = j + 9 - 18 else: k = i - 18 if i == len_spisok: keyboard = keyboard[ :-1] + '],[{"text": "Назад", "callback_data": "NextListMangaWatching// %i"}]]}' % (k) elif k < 0: keyboard = keyboard[ :-1] + '],[{"text": "Далее", "callback_data": "NextListMangaWatching// %i"}]]}' % (i) else: keyboard = keyboard[:-1] + '],[{"text": "Назад", "callback_data": "NextListMangaWatching// %i"},' \ '{"text": "Далее", "callback_data": "NextListMangaWatching// %i"}]]}' % ( k, i) elif flag[0] == 'NextListMangaPlaned//': spisok = self.__db.get_my_list_anime(status='planned', user_id=user.id) len_spisok = len(spisok) message = f'Манги запланировано {len(spisok)}:\nНазвание - Кол-во всего эпизодов\n\n' i = int(flag[1]) j = i if i < 0: i = 0 spisok = self.__db.get_my_list_anime_9_rows(status='planned', user_id=user.id, index=i) keyboard = '{"inline_keyboard": [[' count = 0 for anime in spisok: message += str(i + 1) + ') ' + anime[0] + '/' + anime[1] + ' - ' + str(anime[2]) + '\n' if count == 3: keyboard = keyboard[:-1] + '],[' count = 0 keyboard += '{"text": %i, "callback_data": "manga_detail %i NextListMangaPlaned// %s"},' % ( i + 1, anime[3], flag[1]) i += 1 count += 1 if len(spisok) < 9: k = j + 9 - 18 else: k = i - 18 if i == len_spisok: keyboard = keyboard[ :-1] + '],[{"text": "Назад", "callback_data": "NextListMangaPlaned// %i"}]]}' % (k) elif k < 0: keyboard = keyboard[ :-1] + '],[{"text": "Далее", "callback_data": "NextListMangaPlaned// %i"}]]}' % (i) else: keyboard = keyboard[:-1] + '],[{"text": "Назад", "callback_data": "NextListMangaPlaned// %i"},' \ '{"text": "Далее", "callback_data": "NextListMangaPlaned// %i"}]]}' % ( k, i) keyboard = keyboard[:-2] + ',[{"text": "Main", "callback_data": "%s"}]]}' % 'MainManga//' self.__tg.edit_msg(chat_id=user.tg_id, msg=message, reply_markup=keyboard, message_id=msg_id) def get_my_list_anime(self, tg_id: int, flag: str = None, msg_id: int = None): user = self.__db.get_user(tg_id=tg_id) message = '' arr = [] if flag is None or flag == 'ListAnimeWatching//' or flag == 'Main': spisok = self.__db.get_my_list_anime(status='watching', user_id=user.id) message = f'Аниме смотрю {len(spisok)}:\nНазвание - Кол-во просмотренных эпизодов\n\n' i = 1 for anime in spisok: message += str(i) + ') ' + anime[0] + '/' + anime[1] + ' - ' + str(anime[2]) + '\n' arr.append({'text': i, 'id': anime[3]}) i += 1 if i == 10: break keyboard = self.__generate_3_keyboard(array=arr, param='ListAnimeWatching//', all=len(spisok)) elif flag == 'ListAnimePlaned//': spisok = self.__db.get_my_list_anime(status='planned', user_id=user.id) message = f'Аниме запланировано {len(spisok)}:\nНазвание - Кол-во всего эпизодов\n\n' i = 1 for anime in spisok: message += str(i) + ') <b>' + anime[4] + '</b>: ' + anime[0] + '\n\b' + anime[1] + ' - ' + str( anime[2]) + '\n' arr.append({'text': i, 'id': anime[3]}) i += 1 if i == 10: break keyboard = self.__generate_3_keyboard(array=arr, param='ListAnimePlaned//', all=len(spisok), is_planned=True) elif flag == 'ListAnimeCompleted//': spisok = self.__db.get_my_list_anime(status='completed', user_id=user.id) message = f'Аниме просмотренно {len(spisok)}:\nНазвание\n\n' i = 1 for anime in spisok: message += str(i) + ') ' + anime[0] + '/' + anime[1] + '\n' arr.append({'text': i, 'id': anime[3]}) i += 1 if i == 10: break keyboard = self.__generate_3_keyboard(array=arr, param='ListAnimeCompleted//', all=len(spisok)) elif flag == 'ListAnimeAll//': spisok = self.__db.get_my_list_anime(user_id=user.id, status='all') message = f'Все аниме {len(spisok)}:\nНазвание\n\n' i = 1 for anime in spisok: message += str(i) + ') ' + anime[0] + '/' + anime[1] + '\n' arr.append({'text': i, 'id': anime[4]}) i += 1 if i == 10: break keyboard = self.__generate_3_keyboard(array=arr, param='ListAnimeAll//', all=len(spisok)) if msg_id is None: self.__tg.send_msg(chat_id=user.tg_id, msg=message, reply_markup=self.MY_ANIME_LIST_KEYBOARD_TG) elif flag == 'Main': self.__tg.edit_msg(chat_id=user.tg_id, msg=message, reply_markup=self.MY_ANIME_LIST_KEYBOARD_TG, message_id=msg_id) elif len(spisok) == 0: self.__tg.edit_msg(chat_id=user.tg_id, msg=message, reply_markup=self.MY_ANIME_LIST_KEYBOARD_TG, message_id=msg_id) else: self.__tg.edit_msg(chat_id=user.tg_id, msg=message, reply_markup=keyboard, message_id=msg_id) def filter_planned_anime(self, tg_id: int, msg_id: int, param: str): if len(param.split()) == 1: message = 'Фильтр Аниме:\n1) Сначала Anons\n2) Сначала Ongoing\n3) Сначала Released\n4) Убрать фильтр' keyboard = json.dumps({'inline_keyboard': [[{'text': '1', 'callback_data': 'Filter// 1'}], [{'text': '2', 'callback_data': 'Filter// 2'}], [{'text': '3', 'callback_data': 'Filter// 3'}], [{'text': '4', 'callback_data': 'Filter// 4'}]]}) self.__tg.edit_msg(chat_id=tg_id, msg=message, reply_markup=keyboard, message_id=msg_id) else: param = int(param.split()[1]) if param == 4: self.__db.update_user(tg_id=tg_id) else: self.__db.update_user(tg_id=tg_id, filter_anime=param) self.get_my_list_anime(tg_id=tg_id, flag='ListAnimePlaned//', msg_id=msg_id) def get_my_list_manga(self, tg_id: int, flag: str = None, msg_id: int = None): user = self.__db.get_user(tg_id=tg_id) message = '' arr = [] if flag is None or flag == 'ListMangaWatching//' or flag == 'Main': spisok = self.__db.get_my_list_manga(status='watching', user_id=user.id) message = f'Манга читаю {len(spisok)}:\nНазвание - Кол-во прочитанных глав\n\n' i = 1 for anime in spisok: message += str(i) + ') ' + anime[0] + '/' + anime[1] + ' - ' + str(anime[2]) + '\n' arr.append({'text': i, 'id': anime[3]}) i += 1 if i == 10: break keyboard = self.__generate_3_keyboard(array=arr, param='ListMangaWatching//', all=len(spisok)) elif flag == 'ListMangaPlaned//': spisok = self.__db.get_my_list_manga(status='planned', user_id=user.id) message = f'Манга запланировано {len(spisok)}:\nНазвание - Кол-во всего эпизодов\n\n' i = 1 for anime in spisok: message += str(i) + ') ' + anime[0] + '/' + anime[1] + ' - ' + str(anime[2]) + '\n' arr.append({'text': i, 'id': anime[3]}) i += 1 if i == 10: break keyboard = self.__generate_3_keyboard(array=arr, param='ListMangaPlaned//', all=len(spisok)) elif flag == 'ListMangaCompleted//': spisok = self.__db.get_my_list_manga(status='completed', user_id=user.id) message = f'Манга прочитано {len(spisok)}:\nНазвание\n\n' i = 1 for anime in spisok: message += str(i) + ') ' + anime[0] + '/' + anime[1] + '\n' arr.append({'text': i, 'id': anime[3]}) i += 1 if i == 10: break keyboard = self.__generate_3_keyboard(array=arr, param='ListMangaCompleted//', all=len(spisok)) elif flag == 'ListMangaAll//': spisok = self.__db.get_my_list_manga(user_id=user.id, status='all') message = f'Вся Манга {len(spisok)}:\nНазвание\n\n' i = 1 for anime in spisok: message += str(i) + ') ' + anime[0] + '/' + anime[1] + '\n' arr.append({'text': i, 'id': anime[4]}) i += 1 if i == 10: break keyboard = self.__generate_3_keyboard(array=arr, param='ListMangaAll//', all=len(spisok)) if msg_id is None: self.__tg.send_msg(chat_id=user.tg_id, msg=message, reply_markup=self.MY_MANGA_LIST_KEYBOARD_TG) elif flag == 'Main': self.__tg.edit_msg(chat_id=user.tg_id, msg=message, reply_markup=self.MY_MANGA_LIST_KEYBOARD_TG, message_id=msg_id) elif len(spisok) == 0: self.__tg.edit_msg(chat_id=user.tg_id, msg=message, reply_markup=self.MY_MANGA_LIST_KEYBOARD_TG, message_id=msg_id) else: self.__tg.edit_msg(chat_id=user.tg_id, msg=message, reply_markup=keyboard, message_id=msg_id) def add_users(self, tg_id: int, auth_code: str): js: dict = self.__shiki.auth(auth_code=auth_code) if not js.get('access_token'): self.__tg.send_msg(chat_id=tg_id, msg='Введен неверный Код!') else: user = self.__shiki.get_info_about_users(js['access_token']) self.__db.add_user(tg_id=tg_id, token=js['access_token'], refresh_token=js['refresh_token'], user_id=user['id']) self.get_info_my_list_in_shiki(tg_id=tg_id) self.__tg.send_msg(chat_id=tg_id, msg='Пользователь добавлен\nВаш список Аниме обновлен!', reply_markup=self.MAIN_KEYBOARD_TG) def __init__(self, db: DataBaseManager, tg: Telegram, shiki: Shikimori, context: MainCache): self.__db = db self.__tg = tg self.__shiki = shiki self.__context = context
49.745272
135
0.519823
10,196
84,169
4.008925
0.037171
0.022606
0.022679
0.013505
0.802006
0.767657
0.727657
0.699939
0.649199
0.618006
0
0.012313
0.330383
84,169
1,691
136
49.77469
0.712922
0.002281
0
0.601578
0
0.015779
0.209422
0.03432
0.000657
0
0
0
0
1
0.030901
false
0.001972
0.007232
0
0.058514
0
0
0
0
null
0
0
0
1
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
4
b88e346a01632b3fb0e04b51fd365732dcca5052
52
py
Python
spikewidgets/widgets/featurewidgets/__init__.py
Shawn-Guo-CN/spikewidgets
225b4e3e0dc1c38f6c6bf08f285c230b8a2ae2f2
[ "MIT" ]
null
null
null
spikewidgets/widgets/featurewidgets/__init__.py
Shawn-Guo-CN/spikewidgets
225b4e3e0dc1c38f6c6bf08f285c230b8a2ae2f2
[ "MIT" ]
null
null
null
spikewidgets/widgets/featurewidgets/__init__.py
Shawn-Guo-CN/spikewidgets
225b4e3e0dc1c38f6c6bf08f285c230b8a2ae2f2
[ "MIT" ]
null
null
null
from .pcawidget import PCAWidget, plot_pca_features
26
51
0.865385
7
52
6.142857
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.096154
52
1
52
52
0.914894
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
b89255000b93f3874ae6e44ff944b1182b154d2a
58
py
Python
takePhoto.py
armins88/IoT_Roomba
5c4b79e70650503e49bbdd3614c5e92223a7e1ce
[ "MIT" ]
null
null
null
takePhoto.py
armins88/IoT_Roomba
5c4b79e70650503e49bbdd3614c5e92223a7e1ce
[ "MIT" ]
null
null
null
takePhoto.py
armins88/IoT_Roomba
5c4b79e70650503e49bbdd3614c5e92223a7e1ce
[ "MIT" ]
null
null
null
from subprocess import call call(['bash','takePhoto.sh'])
19.333333
29
0.741379
8
58
5.375
0.875
0
0
0
0
0
0
0
0
0
0
0
0.086207
58
2
30
29
0.811321
0
0
0
0
0
0.275862
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
b89ae68f802d82d30d456309f32bca5113a51569
210
py
Python
test_pkg.py
rtmigo/vtcff_py
e26a5e55ea455b10995932dccd319c1f7fc28385
[ "MIT" ]
null
null
null
test_pkg.py
rtmigo/vtcff_py
e26a5e55ea455b10995932dccd319c1f7fc28385
[ "MIT" ]
null
null
null
test_pkg.py
rtmigo/vtcff_py
e26a5e55ea455b10995932dccd319c1f7fc28385
[ "MIT" ]
null
null
null
from chkpkg import Package if __name__ == "__main__": with Package() as pkg: # running console_scripts defined in setup.py pkg.run_python_code('import vtcff') print("\nPackage is OK!")
26.25
53
0.671429
28
210
4.642857
0.892857
0
0
0
0
0
0
0
0
0
0
0
0.228571
210
7
54
30
0.802469
0.204762
0
0
0
0
0.218182
0
0
0
0
0
0
1
0
true
0
0.4
0
0.4
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
b8a5815facbbbf3316a43cb584013cb41362a8cd
117
py
Python
models/consep/test.py
YangjiaqiDig/Instance_seg_topo
29d3b735ca13d7ff01edf180723775cbfe95740a
[ "MIT" ]
null
null
null
models/consep/test.py
YangjiaqiDig/Instance_seg_topo
29d3b735ca13d7ff01edf180723775cbfe95740a
[ "MIT" ]
null
null
null
models/consep/test.py
YangjiaqiDig/Instance_seg_topo
29d3b735ca13d7ff01edf180723775cbfe95740a
[ "MIT" ]
null
null
null
import os import skimage.io import numpy as np import scipy.io ROOT_DIR = os.path.abspath("../../") print(ROOT_DIR)
14.625
36
0.726496
20
117
4.15
0.65
0.168675
0
0
0
0
0
0
0
0
0
0
0.128205
117
7
37
16.714286
0.813725
0
0
0
0
0
0.051282
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
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
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
b8c387a6089559b70f85632c6133a274f0de38e1
198
py
Python
widelanguagedemo/index/__init__.py
larsyencken/wide-language-demo
da9ba6edcec53d03c8ffdd1cb73eca0507c48542
[ "BSD-3-Clause" ]
null
null
null
widelanguagedemo/index/__init__.py
larsyencken/wide-language-demo
da9ba6edcec53d03c8ffdd1cb73eca0507c48542
[ "BSD-3-Clause" ]
null
null
null
widelanguagedemo/index/__init__.py
larsyencken/wide-language-demo
da9ba6edcec53d03c8ffdd1cb73eca0507c48542
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- # # __init__.py # wide-language-index-demo # """ The actual JSON records of the index dataset, loaded lazily. """ from . import views # noqa from . import util # noqa
15.230769
60
0.641414
27
198
4.555556
0.814815
0.162602
0
0
0
0
0
0
0
0
0
0.00641
0.212121
198
12
61
16.5
0.782051
0.666667
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
b26af743c151bb997f0049ca5c9b0330a292b55a
11
py
Python
django_dictiterators/views.py
Aalto-LeTech/django-dictiterators
23a0b80795b607b8197232632a25de10263a9925
[ "MIT" ]
null
null
null
django_dictiterators/views.py
Aalto-LeTech/django-dictiterators
23a0b80795b607b8197232632a25de10263a9925
[ "MIT" ]
null
null
null
django_dictiterators/views.py
Aalto-LeTech/django-dictiterators
23a0b80795b607b8197232632a25de10263a9925
[ "MIT" ]
null
null
null
# No views
5.5
10
0.636364
2
11
3.5
1
0
0
0
0
0
0
0
0
0
0
0
0.272727
11
1
11
11
0.875
0.727273
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
b29f895f39408425ffc5704ed5c8cffb387f9db1
925
py
Python
083.py
zlsun/ProjectEuler
813ec545484924a052f1bd7fd90a4c676eea3bba
[ "MIT" ]
null
null
null
083.py
zlsun/ProjectEuler
813ec545484924a052f1bd7fd90a4c676eea3bba
[ "MIT" ]
null
null
null
083.py
zlsun/ProjectEuler
813ec545484924a052f1bd7fd90a4c676eea3bba
[ "MIT" ]
null
null
null
#-*- encoding: utf-8 -*- """ Path sum: four ways NOTE: This problem is a significantly more challenging version of Problem 81. In the 5 by 5 matrix below, the minimal path sum from the top left to the bottom right, by moving left, right, up, and down, is indicated in bold red and is equal to 2297. $$ \begin{pmatrix} \color{red}{131} & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\ \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & \color{red}{150}\\ 630 & 803 & 746 & \color{red}{422} & \color{red}{111}\\ 537 & 699 & 497 & \color{red}{121} & 956\\ 805 & 732 & 524 & \color{red}{37} & \color{red}{331} \end{pmatrix} $$ Find the minimal path sum, in matrix.txt (right click and "Save Link/Target As..."), a 31K text file containing a 80 by 80 matrix, from the top left to the bottom right by moving left, right, up, and down. """ from utils import * #
35.576923
172
0.632432
153
925
3.823529
0.542484
0.177778
0.047863
0.05812
0.191453
0.191453
0.191453
0.191453
0.191453
0.191453
0
0.119015
0.20973
925
25
173
37
0.681259
0.928649
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
a2310b803dc62c52e2433bc4f93c748ae74656b4
71
py
Python
tests/resources/module0.py
launchableinc/nose-launchable
8125d48becbe48b4e6aeb2d0bac6cdda46e0b03b
[ "Apache-2.0" ]
3
2021-01-13T02:59:43.000Z
2022-01-06T00:52:27.000Z
tests/resources/module0.py
launchableinc/nose-launchable
8125d48becbe48b4e6aeb2d0bac6cdda46e0b03b
[ "Apache-2.0" ]
31
2020-10-08T08:22:49.000Z
2022-03-01T23:56:52.000Z
tests/resources/module0.py
launchableinc/nose-launchable
8125d48becbe48b4e6aeb2d0bac6cdda46e0b03b
[ "Apache-2.0" ]
null
null
null
class MockTestClass0: def __init__(self): self.mock = True
17.75
24
0.647887
8
71
5.25
0.875
0
0
0
0
0
0
0
0
0
0
0.019231
0.267606
71
3
25
23.666667
0.788462
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
a23b74bc626b7795dbf6c03b2c67d07b9107b2f5
18,868
py
Python
thermalprinter/tools.py
h4us/thermalprinter
ef12d1511c4a3200378cf9039b24275e110a7f38
[ "MIT" ]
null
null
null
thermalprinter/tools.py
h4us/thermalprinter
ef12d1511c4a3200378cf9039b24275e110a7f38
[ "MIT" ]
null
null
null
thermalprinter/tools.py
h4us/thermalprinter
ef12d1511c4a3200378cf9039b24275e110a7f38
[ "MIT" ]
null
null
null
# coding: utf-8 """ This is part of the Python's module to manage the DP-EH600 thermal printer. Source: https://github.com/BoboTiG/thermalprinter """ from .constants import (BarCode, BarCodePosition, CharSet, Chinese, CodePage, CodePageConverted) from .exceptions import ThermalPrinterError from .thermalprinter import ThermalPrinter # gnu.png TESTING_IMG_DATA = """\ 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 gg==""" def ls(*constants): """ Print constants values. >>> ls() # all constants printer >>> ls(Chinese) # print Chinese constants >>> ls(Chinese, CharSet) # print Chinese and CharSet constants """ # pylint: disable=invalid-name if not constants: constants = [BarCode, BarCodePosition, CharSet, Chinese, CodePage, CodePageConverted] for constant in constants: try: print('---CONST', constant.__name__) print(constant.__doc__.strip()) for value in constant: print(value) print() except AttributeError: print('Unknown constant "{}".'.format(constant)) def test_char(char, printer=None): """ Test one character with all possible code page. """ if not printer: printer = ThermalPrinter() with printer: for codepage in list(CodePage): printer.out('{}: {}'.format(codepage.name, char), codepage=codepage) def testing(printer=None, raise_on_error=True): """ Print all possibilities. >>> from thermalprinter.tools import testing >>> testing() >>> printer = ThermalPrinter(port='/dev/ttyS0', heat_time=120) >>> testing(printer=printer) """ try: if not printer: printer = ThermalPrinter() with printer: try: import base64 import io import PIL.Image with io.BytesIO() as f: f.write(base64.b64decode(TESTING_IMG_DATA)) f.seek(0) printer.feed() printer.image(PIL.Image.open(f)) printer.feed() except ImportError: if raise_on_error: raise print('Pillow module not installed, skip picture printing.') printer.barcode_height(80) printer.barcode_position(BarCodePosition.BELOW) printer.barcode_width(3) printer.barcode('012345678901', BarCode.EAN13) printer.out('Bold', bold=True) printer.out('现代汉语通用字表', chinese=True, chinese_format=Chinese.UTF_8) printer.out('Στην υγειά μας!', codepage=CodePage.CP737) printer.out('Double height', double_height=True) printer.out('Double width', double_width=True) printer.out('Inverse', inverse=True) printer.out('Rotate 90°', rotate=True, codepage=CodePage.ISO_8859_1) printer.out('Strike', strike=True) printer.out('Underline', underline=1) printer.out('Upside down', upside_down=True) printer.out('Voilà !', justify='C', strike=True, underline=2, codepage=CodePage.ISO_8859_1) printer.feed(2) except ThermalPrinterError as ex: if raise_on_error: raise print(ex)
59.708861
79
0.89029
890
18,868
18.839326
0.757303
0.007157
0.00501
0.004294
0.019085
0.019085
0.005248
0
0
0
0
0.133158
0.071815
18,868
315
80
59.898413
0.824188
0.030104
0
0.05597
0
0
0.85862
0.836176
0
1
0
0
0
1
0.011194
false
0
0.026119
0
0.037313
0.134328
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
1
0
0
0
0
0
0
0
0
0
0
0
0
4
a28619ec2eb6d22ac44572017a4a1c19853da125
64
py
Python
src/main.py
codewithlennylen/Pong-AI-in-Python
553c436a17c527c700f21d76dfbf8f004f5b2a1c
[ "MIT" ]
null
null
null
src/main.py
codewithlennylen/Pong-AI-in-Python
553c436a17c527c700f21d76dfbf8f004f5b2a1c
[ "MIT" ]
null
null
null
src/main.py
codewithlennylen/Pong-AI-in-Python
553c436a17c527c700f21d76dfbf8f004f5b2a1c
[ "MIT" ]
null
null
null
# https://neat-python.readthedocs.io/en/latest/xor_example.html
32
63
0.796875
10
64
5
1
0
0
0
0
0
0
0
0
0
0
0
0.03125
64
1
64
64
0.806452
0.953125
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
a2b573230a9f2e0b954bd4b7951de52506e77212
227
py
Python
test_queries.py
kcsquared/RangeMinimumQueries
66560b3fa8ca1c94ecada9949b601a8c96174f05
[ "MIT" ]
null
null
null
test_queries.py
kcsquared/RangeMinimumQueries
66560b3fa8ca1c94ecada9949b601a8c96174f05
[ "MIT" ]
null
null
null
test_queries.py
kcsquared/RangeMinimumQueries
66560b3fa8ca1c94ecada9949b601a8c96174f05
[ "MIT" ]
null
null
null
from time import perf_counter from typing import List from RangeQueries import AlternateMinMax, BruteForceMinMax from testing_utils import get_random_arr, get_random_query, get_separated_random_arr from hypothesis import given
37.833333
84
0.885463
32
227
6
0.59375
0.09375
0
0
0
0
0
0
0
0
0
0
0.101322
227
5
85
45.4
0.941176
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
0c0643af5cc2c1dbbc56b7c78982d425fac75d4b
32,767
py
Python
tests/handlers/api_tokens_test.py
slaclab/gafaelfawr
7a64b0f159003d4745531c89d5b0f7d9777f7bce
[ "MIT" ]
null
null
null
tests/handlers/api_tokens_test.py
slaclab/gafaelfawr
7a64b0f159003d4745531c89d5b0f7d9777f7bce
[ "MIT" ]
null
null
null
tests/handlers/api_tokens_test.py
slaclab/gafaelfawr
7a64b0f159003d4745531c89d5b0f7d9777f7bce
[ "MIT" ]
null
null
null
"""Tests for the ``/auth/api/v1/users/*/tokens`` and related routes.""" from __future__ import annotations import time from datetime import datetime, timedelta, timezone from unittest.mock import ANY import pytest from _pytest.logging import LogCaptureFixture from httpx import AsyncClient from gafaelfawr.config import Config from gafaelfawr.constants import COOKIE_NAME from gafaelfawr.factory import ComponentFactory from gafaelfawr.models.state import State from gafaelfawr.models.token import Token, TokenGroup, TokenUserInfo from gafaelfawr.util import current_datetime from ..support.constants import TEST_HOSTNAME from ..support.cookies import clear_session_cookie, set_session_cookie from ..support.logging import parse_log from ..support.tokens import create_session_token @pytest.mark.asyncio async def test_create_delete_modify( client: AsyncClient, factory: ComponentFactory, caplog: LogCaptureFixture ) -> None: user_info = TokenUserInfo( username="example", name="Example Person", email="example@example.com", uid=45613, groups=[TokenGroup(name="foo", id=12313)], ) token_service = factory.create_token_service() async with factory.session.begin(): session_token = await token_service.create_session_token( user_info, scopes=["read:all", "exec:admin", "user:token"], ip_address="127.0.0.1", ) csrf = await set_session_cookie(client, session_token) expires = current_datetime() + timedelta(days=100) r = await client.post( "/auth/api/v1/users/example/tokens", headers={"X-CSRF-Token": csrf}, json={ "token_name": "some token", "scopes": ["read:all"], "expires": int(expires.timestamp()), }, ) assert r.status_code == 201 assert r.json() == {"token": ANY} user_token = Token.from_str(r.json()["token"]) token_url = r.headers["Location"] assert token_url == f"/auth/api/v1/users/example/tokens/{user_token.key}" r = await client.get(token_url) assert r.status_code == 200 info = r.json() assert info == { "token": user_token.key, "username": "example", "token_name": "some token", "token_type": "user", "scopes": ["read:all"], "created": ANY, "expires": int(expires.timestamp()), } # Check that this is the same information as is returned by the token-info # route. This is a bit tricky to do since the cookie will take precedence # over the Authorization header, but we can't just delete the cookie since # we'll lose the CSRF token. Save the cookie and delete it, and then # later restore it. cookie = client.cookies.pop(COOKIE_NAME) r = await client.get( "/auth/api/v1/token-info", headers={"Authorization": f"bearer {user_token}"}, ) assert r.status_code == 200 assert r.json() == info client.cookies.set(COOKIE_NAME, cookie, domain=TEST_HOSTNAME) # Listing all tokens for this user should return the user token and a # session token. r = await client.get("/auth/api/v1/users/example/tokens") assert r.status_code == 200 data = r.json() # Adjust for sorting, which will be by creation date and then token. assert len(data) == 2 if data[0] == info: session_info = data[1] else: assert data[1] == info session_info = data[0] assert session_info == { "token": session_token.key, "username": "example", "token_type": "session", "scopes": ["exec:admin", "read:all", "user:token"], "created": ANY, "expires": ANY, } # Change the name, scope, and expiration of the token. caplog.clear() new_expires = current_datetime() + timedelta(days=200) r = await client.patch( token_url, headers={"X-CSRF-Token": csrf}, json={ "token_name": "happy token", "scopes": ["exec:admin"], "expires": int(new_expires.timestamp()), }, ) assert r.status_code == 201 assert r.json() == { "token": user_token.key, "username": "example", "token_name": "happy token", "token_type": "user", "scopes": ["exec:admin"], "created": ANY, "expires": int(new_expires.timestamp()), } # Check the logging. Regression test for a bug where new expirations # would be logged as raw datetime objects instead of timestamps. assert parse_log(caplog) == [ { "expires": int(new_expires.timestamp()), "event": "Modified token", "httpRequest": { "requestMethod": "PATCH", "requestUrl": f"https://{TEST_HOSTNAME}{token_url}", "remoteIp": "127.0.0.1", }, "key": user_token.key, "scope": "exec:admin read:all user:token", "severity": "info", "token": session_token.key, "token_name": "happy token", "token_scope": "exec:admin", "token_source": "cookie", "user": "example", } ] # Delete the token. r = await client.delete(token_url, headers={"X-CSRF-Token": csrf}) assert r.status_code == 204 r = await client.get(token_url) assert r.status_code == 404 # Deleting again should return 404. r = await client.delete(token_url, headers={"X-CSRF-Token": csrf}) assert r.status_code == 404 # This user should now have only one token. r = await client.get("/auth/api/v1/users/example/tokens") assert r.status_code == 200 assert len(r.json()) == 1 # We should be able to see the change history for the token. r = await client.get(token_url + "/change-history") assert r.status_code == 200 assert r.json() == [ { "token": user_token.key, "username": "example", "token_type": "user", "token_name": "happy token", "scopes": ["exec:admin"], "expires": int(new_expires.timestamp()), "actor": "example", "action": "revoke", "ip_address": "127.0.0.1", "event_time": ANY, }, { "token": user_token.key, "username": "example", "token_type": "user", "token_name": "happy token", "scopes": ["exec:admin"], "expires": int(new_expires.timestamp()), "actor": "example", "action": "edit", "old_token_name": "some token", "old_scopes": ["read:all"], "old_expires": int(expires.timestamp()), "ip_address": "127.0.0.1", "event_time": ANY, }, { "token": user_token.key, "username": "example", "token_type": "user", "token_name": "some token", "scopes": ["read:all"], "expires": int(expires.timestamp()), "actor": "example", "action": "create", "ip_address": "127.0.0.1", "event_time": ANY, }, ] @pytest.mark.asyncio async def test_token_info( client: AsyncClient, config: Config, factory: ComponentFactory ) -> None: user_info = TokenUserInfo( username="example", name="Example Person", email="example@example.com", uid=45613, groups=[TokenGroup(name="foo", id=12313)], ) token_service = factory.create_token_service() async with factory.session.begin(): session_token = await token_service.create_session_token( user_info, scopes=["exec:admin", "user:token"], ip_address="127.0.0.1", ) r = await client.get( "/auth/api/v1/token-info", headers={"Authorization": f"bearer {session_token}"}, ) assert r.status_code == 200 data = r.json() assert data == { "token": session_token.key, "username": "example", "token_type": "session", "scopes": ["exec:admin", "user:token"], "created": ANY, "expires": ANY, } now = datetime.now(tz=timezone.utc) created = datetime.fromtimestamp(data["created"], tz=timezone.utc) assert now - timedelta(seconds=2) <= created <= now expires = created + timedelta(minutes=config.issuer.exp_minutes) assert datetime.fromtimestamp(data["expires"], tz=timezone.utc) == expires r = await client.get( "/auth/api/v1/user-info", headers={"Authorization": f"bearer {session_token}"}, ) assert r.status_code == 200 session_user_info = r.json() assert session_user_info == { "username": "example", "name": "Example Person", "email": "example@example.com", "uid": 45613, "groups": [ { "name": "foo", "id": 12313, } ], } # Check the same with a user token, which has some additional associated # data. expires = now + timedelta(days=100) data = await token_service.get_data(session_token) async with factory.session.begin(): user_token = await token_service.create_user_token( data, data.username, token_name="some-token", scopes=["exec:admin"], expires=expires, ip_address="127.0.0.1", ) r = await client.get( "/auth/api/v1/token-info", headers={"Authorization": f"bearer {user_token}"}, ) assert r.status_code == 200 data = r.json() assert data == { "token": user_token.key, "username": "example", "token_type": "user", "token_name": "some-token", "scopes": ["exec:admin"], "created": ANY, "expires": int(expires.timestamp()), } r = await client.get( "/auth/api/v1/user-info", headers={"Authorization": f"bearer {user_token}"}, ) assert r.status_code == 200 assert r.json() == session_user_info # Test getting a list of tokens for a user. state = State(token=session_token) r = await client.get( "/auth/api/v1/users/example/tokens", cookies={COOKIE_NAME: await state.as_cookie()}, ) @pytest.mark.asyncio async def test_auth_required( client: AsyncClient, factory: ComponentFactory ) -> None: token_data = await create_session_token(factory) token = token_data.token csrf = await set_session_cookie(client, token) # Replace the cookie with one containing the CSRF token but not the # authentication token. clear_session_cookie(client) client.cookies[COOKIE_NAME] = await State(csrf=csrf).as_cookie() r = await client.post( "/auth/api/v1/tokens", headers={"X-CSRF-Token": csrf}, json={"username": "foo", "token_type": "service"}, ) assert r.status_code == 401 r = await client.get("/auth/api/v1/users/example/tokens") assert r.status_code == 401 r = await client.post( "/auth/api/v1/users/example/tokens", headers={"X-CSRF-Token": csrf}, json={"token_name": "some token"}, ) assert r.status_code == 401 r = await client.get(f"/auth/api/v1/users/example/tokens/{token.key}") assert r.status_code == 401 r = await client.get( f"/auth/api/v1/users/example/tokens/{token.key}/change-history" ) assert r.status_code == 401 r = await client.delete( f"/auth/api/v1/users/example/tokens/{token.key}", headers={"X-CSRF-Token": csrf}, ) assert r.status_code == 401 r = await client.patch( f"/auth/api/v1/users/example/tokens/{token.key}", headers={"X-CSRF-Token": csrf}, json={"token_name": "some token"}, ) assert r.status_code == 401 @pytest.mark.asyncio async def test_csrf_required( client: AsyncClient, factory: ComponentFactory ) -> None: token_data = await create_session_token(factory, scopes=["admin:token"]) csrf = await set_session_cookie(client, token_data.token) token_service = factory.create_token_service() async with factory.session.begin(): user_token = await token_service.create_user_token( token_data, token_data.username, token_name="foo", scopes=[], ip_address="127.0.0.1", ) r = await client.post( "/auth/api/v1/tokens", json={"username": "foo", "token_type": "service"}, ) assert r.status_code == 403 r = await client.post( "/auth/api/v1/tokens", headers={"X-CSRF-Token": f"XXX{csrf}"}, json={"username": "foo", "token_type": "service"}, ) assert r.status_code == 403 r = await client.post( "/auth/api/v1/users/example/tokens", json={"token_name": "some token"} ) assert r.status_code == 403 r = await client.post( "/auth/api/v1/users/example/tokens", headers={"X-CSRF-Token": f"XXX{csrf}"}, json={"token_name": "some token"}, ) assert r.status_code == 403 r = await client.delete( f"/auth/api/v1/users/example/tokens/{user_token.key}" ) assert r.status_code == 403 r = await client.delete( f"/auth/api/v1/users/example/tokens/{user_token.key}", headers={"X-CSRF-Token": f"XXX{csrf}"}, ) assert r.status_code == 403 r = await client.patch( f"/auth/api/v1/users/example/tokens/{user_token.key}", json={"token_name": "some token"}, ) assert r.status_code == 403 r = await client.patch( f"/auth/api/v1/users/example/tokens/{user_token.key}", headers={"X-CSRF-Token": f"XXX{csrf}"}, json={"token_name": "some token"}, ) assert r.status_code == 403 @pytest.mark.asyncio async def test_no_bootstrap( client: AsyncClient, config: Config, factory: ComponentFactory ) -> None: token_data = await create_session_token(factory) token = token_data.token bootstrap_token = str(config.bootstrap_token) r = await client.get( "/auth/api/v1/users/example/tokens", headers={"Authorization": f"bearer {bootstrap_token}"}, ) assert r.status_code == 401 r = await client.post( "/auth/api/v1/users/example/tokens", headers={"Authorization": f"bearer {bootstrap_token}"}, json={"token_name": "some token"}, ) assert r.status_code == 401 r = await client.get( f"/auth/api/v1/users/example/tokens/{token.key}", headers={"Authorization": f"bearer {bootstrap_token}"}, ) assert r.status_code == 401 r = await client.delete( f"/auth/api/v1/users/example/tokens/{token.key}", headers={"Authorization": f"bearer {bootstrap_token}"}, ) assert r.status_code == 401 r = await client.patch( f"/auth/api/v1/users/example/tokens/{token.key}", headers={"Authorization": f"bearer {bootstrap_token}"}, json={"token_name": "some token"}, ) assert r.status_code == 401 @pytest.mark.asyncio async def test_no_scope( client: AsyncClient, factory: ComponentFactory ) -> None: token_data = await create_session_token(factory) token_service = factory.create_token_service() async with factory.session.begin(): token = await token_service.create_user_token( token_data, token_data.username, token_name="user", scopes=[], ip_address="127.0.0.1", ) r = await client.get( f"/auth/api/v1/users/{token_data.username}/tokens", headers={"Authorization": f"bearer {token}"}, ) assert r.status_code == 403 r = await client.post( f"/auth/api/v1/users/{token_data.username}/tokens", headers={"Authorization": f"bearer {token}"}, json={"token_name": "some token"}, ) assert r.status_code == 403 r = await client.get( f"/auth/api/v1/users/{token_data.username}/tokens/{token.key}", headers={"Authorization": f"bearer {token}"}, ) assert r.status_code == 403 r = await client.delete( f"/auth/api/v1/users/{token_data.username}/tokens/{token.key}", headers={"Authorization": f"bearer {token}"}, ) assert r.status_code == 403 r = await client.patch( f"/auth/api/v1/users/{token_data.username}/tokens/{token.key}", headers={"Authorization": f"bearer {token}"}, json={"token_name": "some token"}, ) assert r.status_code == 403 @pytest.mark.asyncio async def test_modify_nonuser( client: AsyncClient, factory: ComponentFactory ) -> None: token_data = await create_session_token(factory) token = token_data.token csrf = await set_session_cookie(client, token) r = await client.patch( f"/auth/api/v1/users/{token_data.username}/tokens/{token.key}", headers={"X-CSRF-Token": csrf}, json={"token_name": "happy token"}, ) assert r.status_code == 403 assert r.json()["detail"][0]["type"] == "permission_denied" @pytest.mark.asyncio async def test_wrong_user( client: AsyncClient, factory: ComponentFactory ) -> None: token_data = await create_session_token(factory) csrf = await set_session_cookie(client, token_data.token) token_service = factory.create_token_service() user_info = TokenUserInfo( username="other-person", name="Some Other Person", uid=137123 ) async with factory.session.begin(): other_session_token = await token_service.create_session_token( user_info, scopes=["user:token"], ip_address="127.0.0.1" ) other_session_data = await token_service.get_data(other_session_token) assert other_session_data async with factory.session.begin(): other_token = await token_service.create_user_token( other_session_data, "other-person", token_name="foo", scopes=[], ip_address="127.0.0.1", ) # Get a token list. r = await client.get("/auth/api/v1/users/other-person/tokens") assert r.status_code == 403 assert r.json()["detail"][0]["type"] == "permission_denied" # Create a new user token. r = await client.post( "/auth/api/v1/users/other-person/tokens", headers={"X-CSRF-Token": csrf}, json={"token_name": "happy token"}, ) assert r.status_code == 403 assert r.json()["detail"][0]["type"] == "permission_denied" # Get an individual token. r = await client.get( f"/auth/api/v1/users/other-person/tokens/{other_token.key}" ) assert r.status_code == 403 assert r.json()["detail"][0]["type"] == "permission_denied" # Get the history of an individual token. r = await client.get( f"/auth/api/v1/users/other-person/tokens/{other_token.key}" "/change-history" ) assert r.status_code == 403 assert r.json()["detail"][0]["type"] == "permission_denied" # Ensure you can't see someone else's token under your username either. r = await client.get( f"/auth/api/v1/users/{token_data.username}/tokens/{other_token.key}" ) assert r.status_code == 404 # Or their history. r = await client.get( f"/auth/api/v1/users/{token_data.username}/tokens/{other_token.key}" "/change-history" ) assert r.status_code == 404 # Delete a token. r = await client.delete( f"/auth/api/v1/users/other-person/tokens/{other_token.key}", headers={"X-CSRF-Token": csrf}, ) assert r.status_code == 403 assert r.json()["detail"][0]["type"] == "permission_denied" r = await client.delete( f"/auth/api/v1/users/{token_data.username}/tokens/{other_token.key}", headers={"X-CSRF-Token": csrf}, ) assert r.status_code == 404 # Modify a token. r = await client.patch( f"/auth/api/v1/users/other-person/tokens/{other_token.key}", json={"token_name": "happy token"}, headers={"X-CSRF-Token": csrf}, ) assert r.status_code == 403 assert r.json()["detail"][0]["type"] == "permission_denied" r = await client.patch( f"/auth/api/v1/users/{token_data.username}/tokens/{other_token.key}", json={"token_name": "happy token"}, headers={"X-CSRF-Token": csrf}, ) assert r.status_code == 404 @pytest.mark.asyncio async def test_no_expires( client: AsyncClient, factory: ComponentFactory ) -> None: """Test creating a user token that doesn't expire.""" token_data = await create_session_token(factory) csrf = await set_session_cookie(client, token_data.token) r = await client.post( f"/auth/api/v1/users/{token_data.username}/tokens", headers={"X-CSRF-Token": csrf}, json={"token_name": "some token"}, ) assert r.status_code == 201 token_url = r.headers["Location"] r = await client.get(token_url) assert "expires" not in r.json() # Create a user token with an expiration and then adjust it to not expire. now = datetime.now(tz=timezone.utc).replace(microsecond=0) expires = now + timedelta(days=2) r = await client.post( f"/auth/api/v1/users/{token_data.username}/tokens", headers={"X-CSRF-Token": csrf}, json={ "token_name": "another token", "expires": int(expires.timestamp()), }, ) assert r.status_code == 201 user_token = Token.from_str(r.json()["token"]) token_service = factory.create_token_service() user_token_data = await token_service.get_data(user_token) assert user_token_data and user_token_data.expires == expires token_url = r.headers["Location"] r = await client.get(token_url) assert r.json()["expires"] == int(expires.timestamp()) r = await client.patch( token_url, headers={"X-CSRF-Token": csrf}, json={"expires": None}, ) assert r.status_code == 201 assert "expires" not in r.json() # Check that the expiration was also changed in Redis. user_token_data = await token_service.get_data(user_token) assert user_token_data and user_token_data.expires is None @pytest.mark.asyncio async def test_duplicate_token_name( client: AsyncClient, factory: ComponentFactory ) -> None: """Test duplicate token names.""" token_data = await create_session_token(factory) csrf = await set_session_cookie(client, token_data.token) r = await client.post( f"/auth/api/v1/users/{token_data.username}/tokens", headers={"X-CSRF-Token": csrf}, json={"token_name": "some token"}, ) assert r.status_code == 201 r = await client.post( f"/auth/api/v1/users/{token_data.username}/tokens", headers={"X-CSRF-Token": csrf}, json={"token_name": "some token"}, ) assert r.status_code == 422 assert r.json()["detail"][0]["type"] == "duplicate_token_name" # Create a token with a different name and then try to modify the name to # conflict. r = await client.post( f"/auth/api/v1/users/{token_data.username}/tokens", headers={"X-CSRF-Token": csrf}, json={"token_name": "another token"}, ) assert r.status_code == 201 token_url = r.headers["Location"] r = await client.patch( token_url, headers={"X-CSRF-Token": csrf}, json={"token_name": "some token"}, ) assert r.status_code == 422 assert r.json()["detail"][0]["type"] == "duplicate_token_name" @pytest.mark.asyncio async def test_bad_expires( client: AsyncClient, factory: ComponentFactory ) -> None: """Test creating or modifying a token with bogus expirations.""" token_data = await create_session_token(factory) csrf = await set_session_cookie(client, token_data.token) now = int(time.time()) bad_expires = [-now, -1, 0, now, now + (5 * 60) - 1] for bad_expire in bad_expires: r = await client.post( f"/auth/api/v1/users/{token_data.username}/tokens", headers={"X-CSRF-Token": csrf}, json={"token_name": "some token", "expires": bad_expire}, ) assert r.status_code == 422 data = r.json() assert data["detail"][0]["loc"] == ["body", "expires"] assert data["detail"][0]["type"] == "invalid_expires" # Create a valid token. r = await client.post( f"/auth/api/v1/users/{token_data.username}/tokens", headers={"X-CSRF-Token": csrf}, json={"token_name": "some token"}, ) assert r.status_code == 201 token_url = r.headers["Location"] # Now try modifying the expiration time to the same bogus values. for bad_expire in bad_expires: r = await client.patch( token_url, headers={"X-CSRF-Token": csrf}, json={"expires": bad_expire}, ) assert r.status_code == 422 data = r.json() assert data["detail"][0]["loc"] == ["body", "expires"] assert data["detail"][0]["type"] == "invalid_expires" @pytest.mark.asyncio async def test_bad_scopes( client: AsyncClient, config: Config, factory: ComponentFactory ) -> None: """Test creating or modifying a token with bogus scopes.""" known_scopes = list(config.known_scopes.keys()) assert len(known_scopes) > 4 token_data = await create_session_token( factory, scopes=known_scopes[1:3] + ["other:scope", "user:token"] ) csrf = await set_session_cookie(client, token_data.token) # Check that we reject both an unknown scope and a scope that's present on # the session but isn't valid in the configuration. for bad_scope in (known_scopes[3], "other:scope"): r = await client.post( f"/auth/api/v1/users/{token_data.username}/tokens", headers={"X-CSRF-Token": csrf}, json={"token_name": "some token", "scopes": [bad_scope]}, ) assert r.status_code == 422 data = r.json() assert data["detail"][0]["loc"] == ["body", "scopes"] assert data["detail"][0]["type"] == "invalid_scopes" # Create a valid token with all of the scopes as the session. r = await client.post( f"/auth/api/v1/users/{token_data.username}/tokens", headers={"X-CSRF-Token": csrf}, json={"token_name": "some token", "scopes": known_scopes[1:3]}, ) assert r.status_code == 201 token_url = r.headers["Location"] # Now try modifying it with the invalid scope. for bad_scope in (known_scopes[3], "other:scope"): r = await client.patch( token_url, headers={"X-CSRF-Token": csrf}, json={"scopes": [known_scopes[1], bad_scope]}, ) assert r.status_code == 422 data = r.json() assert data["detail"][0]["loc"] == ["body", "scopes"] assert data["detail"][0]["type"] == "invalid_scopes" @pytest.mark.asyncio async def test_create_admin( client: AsyncClient, config: Config, factory: ComponentFactory ) -> None: """Test creating a token through the admin interface.""" token_data = await create_session_token(factory, scopes=["exec:admin"]) csrf = await set_session_cookie(client, token_data.token) r = await client.post( "/auth/api/v1/tokens", headers={"X-CSRF-Token": csrf}, json={"username": "a-service", "token_type": "service"}, ) assert r.status_code == 403 token_data = await create_session_token(factory, scopes=["admin:token"]) csrf = await set_session_cookie(client, token_data.token) now = datetime.now(tz=timezone.utc) expires = int((now + timedelta(days=2)).timestamp()) r = await client.post( "/auth/api/v1/tokens", headers={"X-CSRF-Token": csrf}, json={ "username": "a-service", "token_type": "service", "scopes": ["admin:token"], "expires": expires, "name": "A Service", "uid": 1234, "email": "service@example.com", "groups": [{"name": "some-group", "id": 12381}], }, ) assert r.status_code == 201 assert r.json() == {"token": ANY} service_token = Token.from_str(r.json()["token"]) token_url = f"/auth/api/v1/users/a-service/tokens/{service_token.key}" assert r.headers["Location"] == token_url clear_session_cookie(client) r = await client.get( "/auth/api/v1/token-info", headers={"Authorization": f"bearer {str(service_token)}"}, ) assert r.status_code == 200 assert r.json() == { "token": service_token.key, "username": "a-service", "token_type": "service", "scopes": ["admin:token"], "created": ANY, "expires": expires, } r = await client.get( "/auth/api/v1/user-info", headers={"Authorization": f"bearer {str(service_token)}"}, ) assert r.status_code == 200 assert r.json() == { "username": "a-service", "name": "A Service", "email": "service@example.com", "uid": 1234, "email": "service@example.com", "groups": [{"name": "some-group", "id": 12381}], } r = await client.post( "/auth/api/v1/tokens", headers={"Authorization": f"bearer {str(service_token)}"}, json={"username": "a-user", "token_type": "session"}, ) assert r.status_code == 422 r = await client.post( "/auth/api/v1/tokens", headers={"Authorization": f"bearer {str(service_token)}"}, json={"username": "a-user", "token_type": "user"}, ) assert r.status_code == 422 r = await client.post( "/auth/api/v1/tokens", headers={"Authorization": f"bearer {str(service_token)}"}, json={ "username": "a-user", "token_type": "user", "token_name": "some token", "expires": int(datetime.now(tz=timezone.utc).timestamp()), }, ) assert r.status_code == 422 assert r.json()["detail"][0]["type"] == "invalid_expires" r = await client.post( "/auth/api/v1/tokens", headers={"Authorization": f"bearer {str(service_token)}"}, json={ "username": "a-user", "token_type": "user", "token_name": "some token", "scopes": ["bogus:scope"], }, ) assert r.status_code == 422 assert r.json()["detail"][0]["type"] == "invalid_scopes" r = await client.post( "/auth/api/v1/tokens", headers={"Authorization": f"bearer {str(service_token)}"}, json={ "username": "a-user", "token_type": "user", "token_name": "some token", }, ) assert r.status_code == 201 assert r.json() == {"token": ANY} user_token = Token.from_str(r.json()["token"]) token_url = f"/auth/api/v1/users/a-user/tokens/{user_token.key}" assert r.headers["Location"] == token_url # Successfully create a user token. r = await client.get( "/auth/api/v1/token-info", headers={"Authorization": f"bearer {str(user_token)}"}, ) assert r.status_code == 200 assert r.json() == { "token": user_token.key, "username": "a-user", "token_type": "user", "token_name": "some token", "scopes": [], "created": ANY, } r = await client.get( "/auth/api/v1/user-info", headers={"Authorization": f"bearer {str(user_token)}"}, ) assert r.status_code == 200 assert r.json() == {"username": "a-user"} # Check handling of duplicate token name errors. r = await client.post( "/auth/api/v1/tokens", headers={"Authorization": f"bearer {str(service_token)}"}, json={ "username": "a-user", "token_type": "user", "token_name": "some token", }, ) assert r.status_code == 422 assert r.json()["detail"][0]["type"] == "duplicate_token_name" # Check handling of an invalid username. r = await client.post( "/auth/api/v1/tokens", headers={"Authorization": f"bearer {str(service_token)}"}, json={ "username": "invalid(user)", "token_type": "user", "token_name": "some token", }, ) assert r.status_code == 422 # Check that the bootstrap token also works. r = await client.post( "/auth/api/v1/tokens", headers={"Authorization": f"bearer {str(config.bootstrap_token)}"}, json={"username": "other-service", "token_type": "service"}, ) assert r.status_code == 201
32.931658
78
0.597247
4,065
32,767
4.682903
0.071587
0.037876
0.050431
0.068764
0.798224
0.775268
0.741647
0.717378
0.688695
0.670361
0
0.019568
0.252937
32,767
994
79
32.964789
0.758078
0.060366
0
0.686905
0
0
0.258063
0.083965
0
0
0
0
0.153571
1
0
false
0
0.020238
0
0.020238
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0c0839c0a9dbb08b11f217ec5924c1dee21d183f
141
py
Python
sbemoored/__init__.py
gunnarvoet/sbemoored
193e1d4cfb94acdabd85b1d50fd078085dd69f44
[ "MIT" ]
null
null
null
sbemoored/__init__.py
gunnarvoet/sbemoored
193e1d4cfb94acdabd85b1d50fd078085dd69f44
[ "MIT" ]
null
null
null
sbemoored/__init__.py
gunnarvoet/sbemoored
193e1d4cfb94acdabd85b1d50fd078085dd69f44
[ "MIT" ]
null
null
null
""" Library for SBE moored instruments data processing. """ __all__ = ["sbe56", "sbe37"] __version__ = "0.1.0" from . import sbe56, sbe37
15.666667
51
0.673759
18
141
4.833333
0.833333
0.229885
0
0
0
0
0
0
0
0
0
0.094017
0.170213
141
8
52
17.625
0.649573
0.361702
0
0
0
0
0.182927
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
0c0a6ba10bb8ca9260e033efe64ce317eb91f234
90
py
Python
4_src/3_other/1_surasura-python/q4-3/q4-3.py
hirobel/todoapp
834e6dcdd3e6c227a79004c89430c6853935b23c
[ "Apache-2.0" ]
null
null
null
4_src/3_other/1_surasura-python/q4-3/q4-3.py
hirobel/todoapp
834e6dcdd3e6c227a79004c89430c6853935b23c
[ "Apache-2.0" ]
null
null
null
4_src/3_other/1_surasura-python/q4-3/q4-3.py
hirobel/todoapp
834e6dcdd3e6c227a79004c89430c6853935b23c
[ "Apache-2.0" ]
null
null
null
num_list = [] num_list.append(1) num_list.append(2) num_list.append(3) print(num_list[1])
15
18
0.744444
18
90
3.444444
0.388889
0.564516
0.629032
0
0
0
0
0
0
0
0
0.048193
0.077778
90
6
19
15
0.698795
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.2
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0c1531899e03cc418b842a88c8292bb6774104dd
2,713
py
Python
python/blazingdb/messages/blazingdb/protocol/io/S3.py
HubBucket-Team/blazingdb-protocol
bf3cdc83b60d30cecb6b906f11d8a194e73119c1
[ "Apache-2.0" ]
1
2019-08-13T17:17:54.000Z
2019-08-13T17:17:54.000Z
python/blazingdb/messages/blazingdb/protocol/io/S3.py
VonRosenchild/blazingdb-protocol
bf3cdc83b60d30cecb6b906f11d8a194e73119c1
[ "Apache-2.0" ]
null
null
null
python/blazingdb/messages/blazingdb/protocol/io/S3.py
VonRosenchild/blazingdb-protocol
bf3cdc83b60d30cecb6b906f11d8a194e73119c1
[ "Apache-2.0" ]
1
2019-08-13T17:17:59.000Z
2019-08-13T17:17:59.000Z
# automatically generated by the FlatBuffers compiler, do not modify # namespace: io import flatbuffers class S3(object): __slots__ = ['_tab'] @classmethod def GetRootAsS3(cls, buf, offset): n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) x = S3() x.Init(buf, n + offset) return x # S3 def Init(self, buf, pos): self._tab = flatbuffers.table.Table(buf, pos) # S3 def BucketName(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) if o != 0: return self._tab.String(o + self._tab.Pos) return None # S3 def EncryptionType(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) if o != 0: return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) return 0 # S3 def KmsKeyAmazonResourceName(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) if o != 0: return self._tab.String(o + self._tab.Pos) return None # S3 def AccessKeyId(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) if o != 0: return self._tab.String(o + self._tab.Pos) return None # S3 def SecretKey(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) if o != 0: return self._tab.String(o + self._tab.Pos) return None # S3 def SessionToken(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) if o != 0: return self._tab.String(o + self._tab.Pos) return None def S3Start(builder): builder.StartObject(6) def S3AddBucketName(builder, bucketName): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(bucketName), 0) def S3AddEncryptionType(builder, encryptionType): builder.PrependInt8Slot(1, encryptionType, 0) def S3AddKmsKeyAmazonResourceName(builder, kmsKeyAmazonResourceName): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(kmsKeyAmazonResourceName), 0) def S3AddAccessKeyId(builder, accessKeyId): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(accessKeyId), 0) def S3AddSecretKey(builder, secretKey): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(secretKey), 0) def S3AddSessionToken(builder, sessionToken): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(sessionToken), 0) def S3End(builder): return builder.EndObject()
38.211268
185
0.698857
323
2,713
5.724458
0.229102
0.071931
0.14278
0.208221
0.450514
0.44132
0.321255
0.321255
0.321255
0.321255
0
0.022456
0.195724
2,713
70
186
38.757143
0.824931
0.037228
0
0.326531
1
0
0.001537
0
0
0
0
0
0
1
0.326531
false
0
0.020408
0.020408
0.653061
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
0c157f57d7bf6fc9800057f4da5579db0db22e9c
485
py
Python
main.py
clean-code-craft-tcq-2/well-named-in-py-Yashaswini-Devananda
37cf8937fdf5f1f7e9b40694b204a0ca062beabd
[ "MIT" ]
null
null
null
main.py
clean-code-craft-tcq-2/well-named-in-py-Yashaswini-Devananda
37cf8937fdf5f1f7e9b40694b204a0ca062beabd
[ "MIT" ]
1
2022-01-12T18:23:00.000Z
2022-01-12T18:23:00.000Z
main.py
clean-code-craft-tcq-2/well-named-in-py-Yashaswini-Devananda
37cf8937fdf5f1f7e9b40694b204a0ca062beabd
[ "MIT" ]
null
null
null
import colorCodeConversionTest import referenceManual if __name__ == '__main__': colorCodeConversionTest.test_number_to_pair(4, 'White', 'Brown') colorCodeConversionTest.test_number_to_pair(5, 'White', 'Slate') colorCodeConversionTest.test_pair_to_number('Black', 'Orange', 12) colorCodeConversionTest.test_pair_to_number('Violet', 'Slate', 25) colorCodeConversionTest.test_pair_to_number('Red', 'Orange', 7) print('Done :)') referenceManual.display_reference_manual()
34.642857
68
0.791753
53
485
6.773585
0.509434
0.376045
0.259053
0.275766
0.543175
0
0
0
0
0
0
0.015801
0.086598
485
13
69
37.307692
0.794582
0
0
0
0
0
0.136082
0
0
0
0
0
0
1
0
true
0
0.2
0
0.2
0.1
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
1
0
0
0
0
0
0
4
0c189ce557cea3e4735182ce6aa41812adbb9f57
115
py
Python
ex021_music.py
elisamariacampos/MundoPhyton
f5d0308bd8af059eb36f18acf81b8b729cb8e401
[ "MIT" ]
null
null
null
ex021_music.py
elisamariacampos/MundoPhyton
f5d0308bd8af059eb36f18acf81b8b729cb8e401
[ "MIT" ]
null
null
null
ex021_music.py
elisamariacampos/MundoPhyton
f5d0308bd8af059eb36f18acf81b8b729cb8e401
[ "MIT" ]
null
null
null
from pygame import mixer mixer.init() mixer.music.load("ex021.mp3") mixer.music.play() input('CURTE O SOM PIVETE!')
23
29
0.747826
19
115
4.526316
0.789474
0.232558
0
0
0
0
0
0
0
0
0
0.038095
0.086957
115
5
30
23
0.780952
0
0
0
0
0
0.241379
0
0
0
0
0
0
1
0
true
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
1
0
0
0
0
0
0
4
0c332c7be9c5b461820bd7bec3843719cab77b82
102
py
Python
hackcollab_app/apps.py
calixo888/hackcollab
e3250b658420e84b6c106bde3f84523e4347e4df
[ "MIT" ]
null
null
null
hackcollab_app/apps.py
calixo888/hackcollab
e3250b658420e84b6c106bde3f84523e4347e4df
[ "MIT" ]
7
2020-02-12T02:29:34.000Z
2022-02-10T09:12:06.000Z
hackcollab_app/apps.py
calixo888/hackcollab
e3250b658420e84b6c106bde3f84523e4347e4df
[ "MIT" ]
null
null
null
from django.apps import AppConfig class HackcollabAppConfig(AppConfig): name = 'hackcollab_app'
17
37
0.784314
11
102
7.181818
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.147059
102
5
38
20.4
0.908046
0
0
0
0
0
0.137255
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
0c45053b0dbb1d9156d76f3c1ea5f085d52b62ad
3,596
py
Python
sims/s142/plot-vortex-waltz-cmp.py
ammarhakim/ammar-simjournal
85b64ddc9556f01a4fab37977864a7d878eac637
[ "MIT", "Unlicense" ]
1
2019-12-19T16:21:13.000Z
2019-12-19T16:21:13.000Z
sims/s142/plot-vortex-waltz-cmp.py
ammarhakim/ammar-simjournal
85b64ddc9556f01a4fab37977864a7d878eac637
[ "MIT", "Unlicense" ]
null
null
null
sims/s142/plot-vortex-waltz-cmp.py
ammarhakim/ammar-simjournal
85b64ddc9556f01a4fab37977864a7d878eac637
[ "MIT", "Unlicense" ]
2
2020-01-08T06:23:33.000Z
2020-01-08T07:06:50.000Z
import pylab import tables import math import numpy def projectOnFinerGrid(Xc, Yc, q): dx = Xc[1]-Xc[0] dy = Yc[1]-Yc[0] nx = Xc.shape[0] ny = Yc.shape[0] # mesh coordinates Xn = pylab.zeros((2*Xc.shape[0],), float) Xn[0:nx] = Xc-0.25*dx Xn[nx:] = Xc+0.25*dx Xn.sort() Yn = pylab.zeros((2*Yc.shape[0],), float) Yn[0:nx] = Yc-0.25*dx Yn[nx: ] = Yc+0.25*dx Yn.sort() qn = pylab.zeros((2*Xc.shape[0],2*Yc.shape[0]), float) # node 0 for i in range(nx): for j in range(ny): qn[2*i,2*j] = 1/16.0*(9*q[i,j,0]+3*q[i,j,1]+3*q[i,j,3]+q[i,j,2]) # node 1 for i in range(nx): for j in range(ny): qn[2*i+1,2*j] = 1/16.0*(9*q[i,j,1]+3*q[i,j,2]+3*q[i,j,0]+q[i,j,3]) # node 2 for i in range(nx): for j in range(ny): qn[2*i+1,2*j+1] = 1/16.0*(9*q[i,j,2]+3*q[i,j,1]+3*q[i,j,3]+q[i,j,0]) # node 3 for i in range(nx): for j in range(ny): qn[2*i,2*j+1] = 1/16.0*(9*q[i,j,3]+3*q[i,j,2]+3*q[i,j,0]+q[i,j,1]) return Xn, Yn, qn def projectOnFinerGrid_f(Xc, Yc, q): dx = Xc[1]-Xc[0] dy = Yc[1]-Yc[0] nx = Xc.shape[0] ny = Yc.shape[0] # mesh coordinates Xn = pylab.zeros((2*Xc.shape[0],), float) Xn[0:nx] = Xc-0.25*dx Xn[nx:] = Xc+0.25*dx Xn.sort() Yn = pylab.zeros((2*Yc.shape[0],), float) Yn[0:nx] = Yc-0.25*dx Yn[nx: ] = Yc+0.25*dx Yn.sort() qn = pylab.zeros((2*Xc.shape[0],2*Yc.shape[0]), float) # node 0 qn[0:2*nx:2, 0:2*ny:2] = 1/16.0*(9*q[:,:,0]+3*q[:,:,1]+3*q[:,:,3]+q[:,:,2]) # node 1 qn[1:2*nx:2, 0:2*ny:2] = 1/16.0*(9*q[:,:,1]+3*q[:,:,2]+3*q[:,:,0]+q[:,:,3]) # node 2 qn[1:2*nx:2, 1:2*ny:2] = 1/16.0*(9*q[:,:,2]+3*q[:,:,1]+3*q[:,:,3]+q[:,:,0]) # node 3 qn[0:2*nx:2, 1:2*ny:2] = 1/16.0*(9*q[:,:,3]+3*q[:,:,2]+3*q[:,:,0]+q[:,:,1]) return Xn, Yn, qn fig = pylab.figure(2) fig.subplots_adjust(hspace=0.4) fig.subplots_adjust(wspace=0.4) pylab.subplot(2,1,1) tr_140 = pylab.loadtxt('../s140/s140-vortex-waltz_totalEnergy') tr_141 = pylab.loadtxt('../s141/s141-vortex-waltz_totalEnergy') tr_142 = pylab.loadtxt('../s142/s142-vortex-waltz_totalEnergy') refTe = tr_140[0,1] pylab.plot(tr_140[:,0], abs(tr_140[:,1]-tr_140[0,1])/tr_140[0,1], label='CFL 0.2') pylab.plot(tr_141[:,0], abs(tr_141[:,1]-tr_141[0,1])/tr_141[0,1], label='CFL 0.1') pylab.plot(tr_142[:,0], abs(tr_142[:,1]-tr_142[0,1])/tr_142[0,1], label='CFL 0.05') pylab.legend(loc='upper left') pylab.title('Energy Error History') pylab.xlabel('Time [s]') pylab.ylabel('Total Energy') print "64x64", abs(tr_140[-1,1]-tr_140[0,1]) print "128x128", abs(tr_141[-1,1]-tr_141[0,1]) print "256x256", abs(tr_142[-1,1]-tr_142[0,1]) pylab.subplot(2,1,2) tr_140 = pylab.loadtxt('../s140/s140-vortex-waltz_totalEnstrophy') tr_141 = pylab.loadtxt('../s141/s141-vortex-waltz_totalEnstrophy') tr_142 = pylab.loadtxt('../s142/s142-vortex-waltz_totalEnstrophy') pylab.plot(tr_140[:,0], abs(tr_140[:,1]-tr_140[0,1])/tr_140[0,1], label='CFL 0.2') pylab.plot(tr_141[:,0], abs(tr_141[:,1]-tr_141[0,1])/tr_141[0,1], label='CFL 0.1') pylab.plot(tr_142[:,0], abs(tr_142[:,1]-tr_142[0,1])/tr_142[0,1], label='CFL 0.05') print "64x64", abs(tr_140[-1,1]-tr_140[0,1]) print "128x128", abs(tr_141[-1,1]-tr_141[0,1]) print "256x256", abs(tr_142[-1,1]-tr_142[0,1]) refTe = tr_140[0,1] pylab.legend(loc='upper left') pylab.title('Enstrophy Error History') pylab.xlabel('Time [s]') pylab.ylabel('Enstrophy Error') pylab.savefig('s140s141s142-vortex-waltz-totalEnergyEnstrophy_cmp.png') pylab.close()
28.768
83
0.573971
771
3,596
2.607004
0.114137
0.021891
0.023881
0.019901
0.797015
0.777114
0.765174
0.718408
0.571144
0.564179
0
0.161034
0.160734
3,596
124
84
29
0.50497
0.02475
0
0.635294
0
0
0.135336
0.081545
0
0
0
0
0
0
null
null
0
0.047059
null
null
0.070588
0
0
0
null
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
0c659a77773af4b12c8af7553c241909eb47742c
87
py
Python
backend/commit/apps.py
Tim6FTN/UKS
3cf19f014cdc7845bf0b808b97c4e05dc49b062e
[ "MIT" ]
1
2021-01-10T12:34:59.000Z
2021-01-10T12:34:59.000Z
backend/commit/apps.py
Tim6FTN/UKS
3cf19f014cdc7845bf0b808b97c4e05dc49b062e
[ "MIT" ]
37
2021-01-07T22:31:25.000Z
2021-02-20T10:59:46.000Z
backend/commit/apps.py
Tim6FTN/UKS
3cf19f014cdc7845bf0b808b97c4e05dc49b062e
[ "MIT" ]
null
null
null
from django.apps import AppConfig class CommitConfig(AppConfig): name = 'commit'
14.5
33
0.747126
10
87
6.5
0.9
0
0
0
0
0
0
0
0
0
0
0
0.172414
87
5
34
17.4
0.902778
0
0
0
0
0
0.068966
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
a766eaf8f566ea36ee5748fa00830f74428657eb
111
py
Python
scraping/theguardian/__init__.py
patrickdeyoreo/GoodNews
7abbe6ab8426700d3b66742ebe861b2f3aa32db9
[ "MIT" ]
null
null
null
scraping/theguardian/__init__.py
patrickdeyoreo/GoodNews
7abbe6ab8426700d3b66742ebe861b2f3aa32db9
[ "MIT" ]
11
2020-03-09T05:00:31.000Z
2022-01-13T02:22:09.000Z
scraping/theguardian/__init__.py
patrickdeyoreo/GoodNews
7abbe6ab8426700d3b66742ebe861b2f3aa32db9
[ "MIT" ]
1
2020-03-26T06:57:01.000Z
2020-03-26T06:57:01.000Z
#!/usr/bin/env python3 """ Provides a module to collect news from The Guardian """ from . client import Client
18.5
51
0.72973
17
111
4.764706
0.882353
0
0
0
0
0
0
0
0
0
0
0.010753
0.162162
111
5
52
22.2
0.860215
0.657658
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
a795058724844006b402664d7fed69f9235e16d2
206
py
Python
src/utils/tester.py
cyrusneary/multiscaleLockdownCovid19
d04a644a10d381475f6e421e6a0aa068601b757c
[ "MIT" ]
null
null
null
src/utils/tester.py
cyrusneary/multiscaleLockdownCovid19
d04a644a10d381475f6e421e6a0aa068601b757c
[ "MIT" ]
null
null
null
src/utils/tester.py
cyrusneary/multiscaleLockdownCovid19
d04a644a10d381475f6e421e6a0aa068601b757c
[ "MIT" ]
null
null
null
class Tester(object): def __init__(self): self.results = dict() self.params = dict() self.problem_data = dict() def set_params(self, params): self.params = params
18.727273
34
0.582524
24
206
4.75
0.5
0.263158
0.280702
0
0
0
0
0
0
0
0
0
0.300971
206
11
35
18.727273
0.791667
0
0
0
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0
0
0.428571
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
a79561296d7b7e25cfd8684ba43f3f438771df4c
96
py
Python
pinion/common.py
dzarda/Pinion
fc5cc3bd6df0e7b434b41f0754a6861c52f87ae8
[ "MIT" ]
233
2021-05-28T06:52:13.000Z
2022-03-17T13:05:30.000Z
pinion/common.py
dzarda/Pinion
fc5cc3bd6df0e7b434b41f0754a6861c52f87ae8
[ "MIT" ]
22
2021-05-29T13:33:51.000Z
2022-03-09T15:08:22.000Z
pinion/common.py
dzarda/Pinion
fc5cc3bd6df0e7b434b41f0754a6861c52f87ae8
[ "MIT" ]
12
2021-05-29T04:51:48.000Z
2022-03-07T06:50:05.000Z
import os PKG_BASE = os.path.dirname(__file__) RESOURCES = os.path.join(PKG_BASE, "resources")
19.2
47
0.760417
15
96
4.466667
0.6
0.208955
0
0
0
0
0
0
0
0
0
0
0.104167
96
4
48
24
0.77907
0
0
0
0
0
0.09375
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
38f3d556af2cd7e8bc111e19ab8e5f3ee106c130
214
py
Python
Models/Tag.py
Hack4Impact-Boston-University/agriworks
8b712e1c128dd20e1a4ddaf4990e901989636b83
[ "BSD-3-Clause" ]
1
2021-05-12T18:30:58.000Z
2021-05-12T18:30:58.000Z
Models/Tag.py
Hack4Impact-Boston-University/agriworks
8b712e1c128dd20e1a4ddaf4990e901989636b83
[ "BSD-3-Clause" ]
1
2021-06-02T00:48:13.000Z
2021-06-02T00:48:13.000Z
Models/Tag.py
Hack4Impact-Boston-University/agriworks
8b712e1c128dd20e1a4ddaf4990e901989636b83
[ "BSD-3-Clause" ]
2
2021-02-18T05:55:55.000Z
2021-02-18T14:38:13.000Z
from mongoengine import Document, StringField, IntField class Tag(Document): name = StringField(required=True) datasetType = StringField(required=True) noOfEntries = IntField(required=True, default=1)
30.571429
55
0.766355
23
214
7.130435
0.652174
0.219512
0.280488
0
0
0
0
0
0
0
0
0.005464
0.14486
214
6
56
35.666667
0.89071
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.2
0
1
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
38f63025ffde652176cb7f7c717ffa592db53fcc
96
py
Python
problem_6/problem_6.py
CaioTeixeira95/Euler
90e98f4110b7e6dc7d36f53eea0b22cf455ac005
[ "MIT" ]
null
null
null
problem_6/problem_6.py
CaioTeixeira95/Euler
90e98f4110b7e6dc7d36f53eea0b22cf455ac005
[ "MIT" ]
null
null
null
problem_6/problem_6.py
CaioTeixeira95/Euler
90e98f4110b7e6dc7d36f53eea0b22cf455ac005
[ "MIT" ]
null
null
null
s = sum(range(1, 101)) ** 2 ss = sum(list(map(lambda x: x ** 2, range(1, 101)))) print(s - ss)
19.2
52
0.541667
20
96
2.6
0.6
0.230769
0.346154
0
0
0
0
0
0
0
0
0.12987
0.197917
96
4
53
24
0.545455
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
38fdf9513dbddd1d27e0619322c10fdcfa50f200
574
py
Python
examples/basic/math_example.py
SummerLife/micropython
de8072bc9eae02538f789b93a1711fed95dc77f1
[ "MIT" ]
null
null
null
examples/basic/math_example.py
SummerLife/micropython
de8072bc9eae02538f789b93a1711fed95dc77f1
[ "MIT" ]
null
null
null
examples/basic/math_example.py
SummerLife/micropython
de8072bc9eae02538f789b93a1711fed95dc77f1
[ "MIT" ]
1
2019-01-17T13:47:08.000Z
2019-01-17T13:47:08.000Z
import math print(math.e) print(math.pi) print(math.sqrt(9)) print(math.pow(2, 3)) print(math.exp(2)) print(math.log(10)) print(math.log2(8)) print(math.log10(10)) print(math.radians(60)) print(math.radians(60)) print(math.sin(math.radians(90))) print(math.cos(math.radians(60))) print(math.tan(math.radians(60))) print(math.asin(0.5)) print(math.ceil(5.6454)) print(math.floor(2.99)) print(math.floor(-2.34)) print(math.fabs(-5)) print(math.fabs(5.0)) print(math.fmod(4, 5)) print(math.trunc(5.12)) print(math.trunc(-6.8)) print(math.gamma(5.21)) print(math.lgamma(5.21))
21.259259
33
0.707317
113
574
3.59292
0.345133
0.53202
0.128079
0.17734
0.219212
0.110837
0
0
0
0
0
0.093578
0.050523
574
26
34
22.076923
0.651376
0
0
0.08
0
0
0
0
0
0
0
0
0
1
0
true
0
0.04
0
0.04
0.96
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
4
ac0bc57a243d8e39ef416d08fffc0997cba83025
34
py
Python
examples/conditionally_existing_else.py
doboy/Underscore
d98273db3144cda79191d2c90f45d81b6d700b1f
[ "MIT" ]
7
2016-09-23T00:44:05.000Z
2021-10-04T21:19:12.000Z
examples/conditionally_existing_else.py
jameswu1991/Underscore
d98273db3144cda79191d2c90f45d81b6d700b1f
[ "MIT" ]
1
2016-09-23T00:45:05.000Z
2019-02-16T19:05:37.000Z
examples/conditionally_existing_else.py
jameswu1991/Underscore
d98273db3144cda79191d2c90f45d81b6d700b1f
[ "MIT" ]
3
2016-09-23T01:13:15.000Z
2018-07-20T21:22:17.000Z
if True: pass else: x = 3
6.8
9
0.470588
6
34
2.666667
1
0
0
0
0
0
0
0
0
0
0
0.052632
0.441176
34
4
10
8.5
0.789474
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.25
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
ac0dfaf8b0e57701178fe4acee23c637171ccf21
201
py
Python
Day 1/Day 1 Project Band Name Generator.py
hamzaoda/100-Days-of-Code---The-Complete-Python-Pro-Bootcamp-for-2021
5340007d8405df2e29643b47d3ff9fa4f7af9e10
[ "Unlicense" ]
null
null
null
Day 1/Day 1 Project Band Name Generator.py
hamzaoda/100-Days-of-Code---The-Complete-Python-Pro-Bootcamp-for-2021
5340007d8405df2e29643b47d3ff9fa4f7af9e10
[ "Unlicense" ]
null
null
null
Day 1/Day 1 Project Band Name Generator.py
hamzaoda/100-Days-of-Code---The-Complete-Python-Pro-Bootcamp-for-2021
5340007d8405df2e29643b47d3ff9fa4f7af9e10
[ "Unlicense" ]
null
null
null
print("Welcome to the Band Name Generator.") city_name =input("What's name of the city you grew up in?\n") pet_name =input("What's your pet's name?\n") print("Your band name could be Bristole Rabbit")
40.2
61
0.731343
39
201
3.717949
0.589744
0.110345
0.17931
0.193103
0
0
0
0
0
0
0
0
0.139303
201
4
62
50.25
0.83815
0
0
0
0
0
0.696517
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
ac4a859d39688560c56a7c9768e6ca273a7dbd57
173
py
Python
runners/__init__.py
ShenYujun/genforce
2ad04974cfaeba20b93c806531f987f06cc5c328
[ "MIT" ]
827
2020-09-25T04:10:30.000Z
2022-03-23T20:20:35.000Z
runners/__init__.py
ShenYujun/genforce
2ad04974cfaeba20b93c806531f987f06cc5c328
[ "MIT" ]
31
2020-10-11T04:56:24.000Z
2022-02-23T15:51:30.000Z
runners/__init__.py
ShenYujun/genforce
2ad04974cfaeba20b93c806531f987f06cc5c328
[ "MIT" ]
68
2020-09-30T08:23:33.000Z
2022-03-12T06:33:38.000Z
# python3.7 """Collects all runners.""" from .stylegan_runner import StyleGANRunner from .encoder_runner import EncoderRunner __all__ = ['StyleGANRunner', 'EncoderRunner']
24.714286
45
0.786127
18
173
7.222222
0.666667
0.184615
0
0
0
0
0
0
0
0
0
0.012903
0.104046
173
6
46
28.833333
0.825806
0.184971
0
0
0
0
0.2
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4