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
4f1d0ef4f45eae9b16f7e491810ae0a72016654b
156
py
Python
memorybackend/backend/firstapp/apps.py
HefeiTu/codechella2020
3e95daa46757b7a8f9b7a482f3e569cf2babc4aa
[ "MIT" ]
null
null
null
memorybackend/backend/firstapp/apps.py
HefeiTu/codechella2020
3e95daa46757b7a8f9b7a482f3e569cf2babc4aa
[ "MIT" ]
null
null
null
memorybackend/backend/firstapp/apps.py
HefeiTu/codechella2020
3e95daa46757b7a8f9b7a482f3e569cf2babc4aa
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.apps import AppConfig class FirstappConfig(AppConfig): name = 'firstapp'
17.333333
39
0.737179
18
156
6.111111
0.833333
0
0
0
0
0
0
0
0
0
0
0.007634
0.160256
156
8
40
19.5
0.832061
0.134615
0
0
0
0
0.06015
0
0
0
0
0
0
1
0
false
0
0.5
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
4f6e8ab47eb4406605562c58aa0cd61255ea03ca
4,335
gyp
Python
gyp/pdfviewer.gyp
omapzoom/platform-external-skia
50bf382c46a9d2348701cb3ce822a306bd9f3812
[ "BSD-3-Clause" ]
null
null
null
gyp/pdfviewer.gyp
omapzoom/platform-external-skia
50bf382c46a9d2348701cb3ce822a306bd9f3812
[ "BSD-3-Clause" ]
null
null
null
gyp/pdfviewer.gyp
omapzoom/platform-external-skia
50bf382c46a9d2348701cb3ce822a306bd9f3812
[ "BSD-3-Clause" ]
2
2019-02-04T02:15:39.000Z
2021-03-04T00:45:13.000Z
# GYP file to build pdfviewer. # # To build on Linux: # ./gyp_skia pdfviewer.gyp && make pdfviewer # { 'includes': [ 'apptype_console.gypi', ], 'targets': [ { 'target_name': 'libpdfviewer', 'type': 'static_library', 'sources': [ '../experimental/PdfViewer/SkPdfBasics.cpp', '../experimental/PdfViewer/SkPdfFont.cpp', '../experimental/PdfViewer/SkPdfRenderer.cpp', '../experimental/PdfViewer/SkPdfUtils.cpp', #'../experimental/PdfViewer/SkPdfNYI.cpp', '../experimental/PdfViewer/SkTrackDevice.cpp', '../experimental/PdfViewer/SkTracker.cpp', '../experimental/PdfViewer/pdfparser/native/SkPdfObject.cpp', '../experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp', '../experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp', '<(SHARED_INTERMEDIATE_DIR)/native/autogen/SkPdfMapper_autogen.cpp', '<(SHARED_INTERMEDIATE_DIR)/native/autogen/SkPdfHeaders_autogen.cpp', ], 'copies': [ { 'files': [ '../experimental/PdfViewer/datatypes.py', '../experimental/PdfViewer/generate_code.py', ], 'destination': '<(SHARED_INTERMEDIATE_DIR)', }, ], 'actions': [ { 'action_name': 'spec2def', 'inputs': [ '../experimental/PdfViewer/spec2def.py', '../experimental/PdfViewer/PdfReference-okular-1.txt', ], 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/pdfspec_autogen.py', ], 'action': ['python', '../experimental/PdfViewer/spec2def.py', '../experimental/PdfViewer/PdfReference-okular-1.txt', '<(SHARED_INTERMEDIATE_DIR)/pdfspec_autogen.py'], }, { 'action_name': 'generate_code', 'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/datatypes.py', '<(SHARED_INTERMEDIATE_DIR)/generate_code.py', '<(SHARED_INTERMEDIATE_DIR)/pdfspec_autogen.py', ], 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/native/autogen/SkPdfEnums_autogen.h', '<(SHARED_INTERMEDIATE_DIR)/native/autogen/SkPdfMapper_autogen.h', '<(SHARED_INTERMEDIATE_DIR)/native/autogen/SkPdfHeaders_autogen.h', '<(SHARED_INTERMEDIATE_DIR)/native/autogen/SkPdfMapper_autogen.cpp', '<(SHARED_INTERMEDIATE_DIR)/native/autogen/SkPdfHeaders_autogen.cpp', # TODO(edisonn): ok, there are many more files here, which we should list but since # any change in the above should trigger a change here, we should be fine normally ], 'action': ['python', '<(SHARED_INTERMEDIATE_DIR)/generate_code.py', '<(SHARED_INTERMEDIATE_DIR)'], }, ], 'include_dirs': [ '../experimental/PdfViewer', '../experimental/PdfViewer/pdfparser', '../experimental/PdfViewer/pdfparser/native', '<(SHARED_INTERMEDIATE_DIR)/native/autogen', ], 'dependencies': [ 'skia_lib.gyp:skia_lib', 'zlib.gyp:zlib', ], }, { 'target_name': 'pdfviewer', 'type': 'executable', 'cflags': ['-fexceptions'], 'cflags_cc': ['-fexceptions'], 'cflags!': [ '-fno-exceptions' ], 'cflags_cc!': [ '-fno-exceptions' ], 'sources': [ '../experimental/PdfViewer/pdf_viewer_main.cpp', ], 'include_dirs': [ '../experimental/PdfViewer', '../experimental/PdfViewer/pdfparser', '../experimental/PdfViewer/pdfparser/autogen', '../experimental/PdfViewer/pdfparser/native', '../experimental/PdfViewer/pdfparser/native/autogen', ], 'dependencies': [ 'skia_lib.gyp:skia_lib', 'flags.gyp:flags', 'libpdfviewer', 'chop_transparency', ], }, { 'target_name': 'chop_transparency', 'type': 'executable', 'sources': [ '../experimental/PdfViewer/chop_transparency_main.cpp', ], 'include_dirs': [ # For SkBitmapHasher.h '../src/utils/', ], 'dependencies': [ 'skia_lib.gyp:skia_lib', 'flags.gyp:flags', ], }, ], } # Local Variables: # tab-width:2 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=2 shiftwidth=2:
34.404762
176
0.586621
375
4,335
6.592
0.322667
0.220874
0.135922
0.087379
0.484223
0.414644
0.406958
0.353155
0.330906
0.22411
0
0.002468
0.252134
4,335
125
177
34.68
0.760025
0.095502
0
0.454545
0
0
0.637225
0.499488
0
0
0
0.008
0
1
0
true
0
0
0
0
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
4f94e0f27ba87a2eb7dd5da7fca63e1beaf7001f
17,173
py
Python
Tests/test_Align_nexus.py
lukasz-kozlowski/biopython
6b601cf09234e1e82cfc94ad5030389036cb6343
[ "BSD-3-Clause" ]
2,856
2015-01-01T07:10:06.000Z
2022-03-31T18:17:25.000Z
Tests/test_Align_nexus.py
lukasz-kozlowski/biopython
6b601cf09234e1e82cfc94ad5030389036cb6343
[ "BSD-3-Clause" ]
3,429
2015-01-05T11:11:42.000Z
2022-03-31T13:08:10.000Z
Tests/test_Align_nexus.py
lukasz-kozlowski/biopython
6b601cf09234e1e82cfc94ad5030389036cb6343
[ "BSD-3-Clause" ]
1,619
2015-01-05T13:07:11.000Z
2022-03-31T19:19:52.000Z
# Copyright 2021 by Michiel de Hoon. All rights reserved. # # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Tests for Bio.Align.nexus module.""" import unittest from io import StringIO from Bio.Align.nexus import AlignmentIterator, AlignmentWriter try: import numpy except ImportError: from Bio import MissingPythonDependencyError raise MissingPythonDependencyError( "Install numpy if you want to use Bio.Align.nexus." ) from None class TestNexusReading(unittest.TestCase): def check_reading_writing(self, path): alignments = AlignmentIterator(path) stream = StringIO() writer = AlignmentWriter(stream) n = writer.write_file(alignments) self.assertEqual(n, 1) alignments = AlignmentIterator(path) alignments = list(alignments) alignment = alignments[0] stream.seek(0) saved_alignments = AlignmentIterator(stream) saved_alignments = list(saved_alignments) self.assertEqual(len(alignments), len(saved_alignments)) saved_alignment = saved_alignments[0] for i, (sequence, saved_sequence) in enumerate( zip(alignment.sequences, saved_alignment.sequences) ): self.assertEqual(sequence.id, saved_sequence.id) self.assertEqual(sequence.seq, saved_sequence.seq) self.assertEqual(sequence.annotations, saved_sequence.annotations) self.assertEqual(alignment[i], saved_alignment[i]) self.assertTrue( numpy.array_equal(alignment.coordinates, saved_alignment.coordinates) ) def test_nexus1(self): path = "Nexus/test_Nexus_input.nex" with open(path) as stream: alignments = AlignmentIterator(stream) alignments = list(alignments) self.assertEqual(len(alignments), 1) alignment = alignments[0] self.assertEqual(len(alignment), 9) self.assertEqual(alignment.shape, (9, 46)) self.assertEqual(alignment.sequences[0].id, "t1") self.assertEqual(alignment.sequences[1].id, "t2 the name") self.assertEqual(alignment.sequences[2].id, "isn'that [a] strange name?") self.assertEqual( alignment.sequences[3].id, "one should be punished, for (that)!" ) self.assertEqual(alignment.sequences[4].id, "t5") self.assertEqual(alignment.sequences[5].id, "t6") self.assertEqual(alignment.sequences[6].id, "t7") self.assertEqual(alignment.sequences[7].id, "t8") self.assertEqual(alignment.sequences[8].id, "t9") self.assertEqual(alignment.sequences[0].annotations, {"molecule_type": "DNA"}) self.assertEqual(alignment.sequences[1].annotations, {"molecule_type": "DNA"}) self.assertEqual(alignment.sequences[2].annotations, {"molecule_type": "DNA"}) self.assertEqual(alignment.sequences[3].annotations, {"molecule_type": "DNA"}) self.assertEqual(alignment.sequences[4].annotations, {"molecule_type": "DNA"}) self.assertEqual(alignment.sequences[5].annotations, {"molecule_type": "DNA"}) self.assertEqual(alignment.sequences[6].annotations, {"molecule_type": "DNA"}) self.assertEqual(alignment.sequences[7].annotations, {"molecule_type": "DNA"}) self.assertEqual(alignment.sequences[8].annotations, {"molecule_type": "DNA"}) self.assertEqual( alignment.sequences[0].seq, "ACGTcgtgtgtgctctttacgtgtgtgctcttt" ) self.assertEqual(alignment.sequences[1].seq, "ACGcTcgtgtctttacacgtgtcttt") self.assertEqual(alignment.sequences[2].seq, "ACcGcTcgtgtgtgctacacacgtgtgtgct") self.assertEqual(alignment.sequences[3].seq, "ACGT") self.assertEqual( alignment.sequences[4].seq, "AC?GT?acgt???????????acgt????????" ) self.assertEqual( alignment.sequences[5].seq, "AcCaGtTc?aaaaaaaaaaacgactac?aaaaaaaaaa" ) self.assertEqual( alignment.sequences[6].seq, "A?CGgTgggggggggggggg???gggggggggggggggg" ) self.assertEqual( alignment.sequences[7].seq, "AtCtGtTtttttttttttt??ttttttttttttttttttt??" ) self.assertEqual( alignment.sequences[8].seq, "cccccccccccccccccccNcccccccccccccccccccccNcc" ) self.assertTrue( numpy.array_equal( alignment.coordinates, numpy.array( [ [ 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 8, 12, 13, 14, 16, 16, 17, 17, 18, 18, 18, 18, 19, 20, 21, 23, 27, 28, 29, 31, 31, 32, 32, 33, ], [ 0, 1, 1, 2, 2, 3, 4, 5, 6, 7, 9, 9, 9, 10, 12, 12, 13, 13, 14, 14, 14, 16, 17, 18, 19, 21, 21, 21, 22, 24, 24, 25, 25, 26, ], [ 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 10, 14, 15, 16, 16, 16, 16, 16, 16, 16, 18, 20, 21, 22, 23, 25, 29, 30, 31, 31, 31, 31, 31, 31, ], [ 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, ], [ 0, 1, 1, 2, 3, 4, 4, 5, 6, 6, 8, 12, 12, 13, 15, 15, 16, 17, 18, 18, 20, 20, 20, 21, 21, 23, 27, 27, 28, 30, 30, 31, 32, 33, ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 13, 14, 15, 17, 17, 18, 18, 19, 21, 23, 25, 26, 27, 28, 28, 32, 33, 34, 36, 36, 37, 37, 38, ], [ 0, 1, 2, 3, 3, 4, 5, 6, 7, 8, 10, 14, 15, 16, 18, 18, 19, 19, 20, 22, 22, 24, 25, 26, 27, 29, 33, 34, 35, 37, 37, 38, 38, 39, ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 15, 16, 17, 19, 19, 20, 20, 21, 23, 25, 27, 28, 29, 30, 32, 36, 37, 38, 40, 40, 41, 41, 42, ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 15, 16, 17, 19, 20, 21, 21, 22, 24, 26, 28, 29, 30, 31, 33, 37, 38, 39, 41, 42, 43, 43, 44, ], ] ), ) ) self.assertEqual( alignment[0], "A-C-G-Tcgtgtgtgctct-t-t------acgtgtgtgctct-t-t", ) self.assertEqual( alignment[1], "A-C-GcTcgtg-----tct-t-t----acacgtg-----tct-t-t", ) self.assertEqual(alignment[2], "A-CcGcTcgtgtgtgct--------acacacgtgtgtgct------") self.assertEqual(alignment[3], "A-C-G-T---------------------------------------") self.assertEqual(alignment[4], "A-C?G-T?-acgt??-???-???--??---?-acgt??-???-???") self.assertEqual(alignment[5], "AcCaGtTc?--aaaaaaaa-a-aacgactac?--aaaaaaaa-a-a") self.assertEqual(alignment[6], "A?C-GgTgggggggggggg-g-g??--?gggggggggggggg-g-g") self.assertEqual(alignment[7], "AtCtGtTtttttttttttt-?-?ttttttttttttttttttt-?-?") self.assertEqual(alignment[8], "cccccccccccccccccccNc-ccccccccccccccccccccNc-c") self.check_reading_writing(path) def test_nexus2(self): path = "Nexus/codonposset.nex" with open(path) as stream: alignments = AlignmentIterator(stream) alignments = list(alignments) self.assertEqual(len(alignments), 1) alignment = alignments[0] self.assertEqual(len(alignment), 2) self.assertEqual(alignment.shape, (2, 22)) self.assertEqual(alignment.sequences[0].id, "Aegotheles") self.assertEqual(alignment.sequences[1].id, "Aerodramus") self.assertEqual(alignment.sequences[0].annotations, {"molecule_type": "DNA"}) self.assertEqual(alignment.sequences[1].annotations, {"molecule_type": "DNA"}) self.assertEqual(alignment.sequences[0].seq, "AAAAAGGCATTGTGGTGGGAAT") self.assertEqual(alignment.sequences[1].seq, "?????????TTGTGGTGGGAAT") self.assertTrue( numpy.array_equal(alignment.coordinates, numpy.array([[0, 22], [0, 22]])) ) self.assertEqual(alignment[0], "AAAAAGGCATTGTGGTGGGAAT") self.assertEqual(alignment[1], "?????????TTGTGGTGGGAAT") self.check_reading_writing(path) class TestNexusBasic(unittest.TestCase): def test_empty(self): import io stream = io.StringIO() with self.assertRaisesRegex(ValueError, "Empty file."): AlignmentIterator(stream) if __name__ == "__main__": runner = unittest.TextTestRunner(verbosity=2) unittest.main(testRunner=runner)
35.554865
88
0.290922
1,009
17,173
4.904856
0.203171
0.169731
0.227925
0.220044
0.479289
0.319458
0.268539
0.258638
0.183876
0.183876
0
0.090765
0.633029
17,173
482
89
35.628631
0.694541
0.014732
0
0.743534
0
0
0.070195
0.049379
0
0
0
0
0.12931
1
0.008621
false
0
0.015086
0
0.028017
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4faa4053b956c6df44a1ae4829bc981f9d9b63b0
447
py
Python
covid/data/__init__.py
caiosba/covid-19
2a0f43f5004e7e39bd982eaa36185859cd9db88f
[ "MIT" ]
null
null
null
covid/data/__init__.py
caiosba/covid-19
2a0f43f5004e7e39bd982eaa36185859cd9db88f
[ "MIT" ]
null
null
null
covid/data/__init__.py
caiosba/covid-19
2a0f43f5004e7e39bd982eaa36185859cd9db88f
[ "MIT" ]
null
null
null
""" Import data sets from various sources. """ from .cia_factbook import cia_factbook, age_distribution, hospital_bed_density from .data import CONTACT_MATRIX_COUNTRIES, CONTACT_MATRIX_IDS, DATA_PATH from .contact_matrix import contact_matrix, symmetric_contact_matrix from .ibge import brazil_healthcare_capacity, city_id_from_name from .mortality import covid_mortality, covid_mean_mortality from .ibge_demographic import brazil_city_demography
44.7
78
0.868009
62
447
5.854839
0.5
0.179063
0.104683
0
0
0
0
0
0
0
0
0
0.087248
447
9
79
49.666667
0.889706
0.085011
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
96cac3a574b6cfbd75d40a2580a9b4882294cc07
429
py
Python
oslib/eip/summary.py
fbacchella/oscmd
7e60f7b761a14f519b971d0cc760c949adb6fa9e
[ "Apache-2.0" ]
null
null
null
oslib/eip/summary.py
fbacchella/oscmd
7e60f7b761a14f519b971d0cc760c949adb6fa9e
[ "Apache-2.0" ]
null
null
null
oslib/eip/summary.py
fbacchella/oscmd
7e60f7b761a14f519b971d0cc760c949adb6fa9e
[ "Apache-2.0" ]
null
null
null
from oslib.command import Command class Summary(Command): object = 'eip' verb = 'summary' def fill_parser(self, parser): pass def validate(self, options): return True def execute(self, *args, **kwargs): count = 0 for snap in self.ec2_object.get_all(): count = count + 1 yield count def to_str(self, value): return "%d EIP reserved\n" % value
22.578947
46
0.585082
55
429
4.490909
0.672727
0
0
0
0
0
0
0
0
0
0
0.010204
0.314685
429
19
47
22.578947
0.829932
0
0
0
0
0
0.062791
0
0
0
0
0
0
1
0.266667
false
0.066667
0.066667
0.133333
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
4
96e1c1db5e8358a8e5e4dfd16d98536c8309d25a
69
py
Python
notice/__init__.py
MichaelBoshell/RSCBot
6a77a76e7beab073bc40e8cab300b3031279298b
[ "MIT" ]
12
2018-12-19T17:00:00.000Z
2021-06-10T13:27:01.000Z
notice/__init__.py
MichaelBoshell/RSCBot
6a77a76e7beab073bc40e8cab300b3031279298b
[ "MIT" ]
37
2020-03-10T18:42:29.000Z
2021-09-29T19:36:42.000Z
notice/__init__.py
MichaelBoshell/RSCBot
6a77a76e7beab073bc40e8cab300b3031279298b
[ "MIT" ]
14
2018-12-31T02:12:18.000Z
2021-11-13T01:49:53.000Z
from .notice import Notice def setup(bot): bot.add_cog(Notice())
17.25
26
0.710145
11
69
4.363636
0.727273
0
0
0
0
0
0
0
0
0
0
0
0.15942
69
4
27
17.25
0.827586
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
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
1
0
0
1
0
0
0
0
4
96e941e5f58270fb13dd6247c500d00b6f12b3fa
61
py
Python
dayliopy/__init__.py
MichaelCurrin/daylio-analysis-tool
65c3d26b172d7cc3c4ddb91f855a48d1934aa25c
[ "MIT" ]
7
2019-04-25T10:16:29.000Z
2022-03-25T02:27:39.000Z
dayliopy/__init__.py
MichaelCurrin/daylio-analysis-tool
65c3d26b172d7cc3c4ddb91f855a48d1934aa25c
[ "MIT" ]
19
2020-01-06T06:37:08.000Z
2022-02-26T08:54:15.000Z
dayliopy/__init__.py
MichaelCurrin/daylio-analysis-tool
65c3d26b172d7cc3c4ddb91f855a48d1934aa25c
[ "MIT" ]
2
2021-09-28T10:20:03.000Z
2021-10-09T04:46:46.000Z
""" Dayliopy module. This exists to let the linter run. """
10.166667
34
0.672131
9
61
4.555556
1
0
0
0
0
0
0
0
0
0
0
0
0.196721
61
5
35
12.2
0.836735
0.852459
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
96f61df6b0ea2229c326312a783d862f73d567c9
1,267
py
Python
guillotina/tests/test_oid.py
diefenbach/guillotina
a8c7247fca8294752901f643b35c5ed1c5dee76d
[ "BSD-2-Clause" ]
null
null
null
guillotina/tests/test_oid.py
diefenbach/guillotina
a8c7247fca8294752901f643b35c5ed1c5dee76d
[ "BSD-2-Clause" ]
null
null
null
guillotina/tests/test_oid.py
diefenbach/guillotina
a8c7247fca8294752901f643b35c5ed1c5dee76d
[ "BSD-2-Clause" ]
null
null
null
from guillotina.db import oid from guillotina.tests import utils def test_generate_oid(): ob = utils.create_content() assert len(oid.generate_oid(ob)) == oid.UUID_LENGTH # should just be UUID here def test_generate_oid_with_parent(): ob = utils.create_content() parent = ob.__parent__ = utils.create_content() parent.__parent__ = utils.create_content() zoid = oid.generate_oid(ob) assert len(zoid) == (oid.UUID_LENGTH + len(oid.OID_DELIMITER) + oid.OID_SPLIT_LENGTH) assert zoid.startswith(parent._p_oid[:oid.OID_SPLIT_LENGTH] + oid.OID_DELIMITER) def test_generate_oid_with_parents(): parent = utils.create_content( parent=utils.create_content( parent=utils.create_content( parent=utils.create_content( parent=utils.create_content( parent=utils.create_content( parent=utils.create_content( parent=utils.create_content( parent=utils.create_content( parent=utils.create_content()))))))))) ob = utils.create_content(parent=parent) zoid = oid.generate_oid(ob) assert len(zoid) == oid.MAX_OID_LENGTH
38.393939
89
0.632202
149
1,267
5.053691
0.201342
0.219124
0.358566
0.38247
0.59761
0.414343
0.414343
0.414343
0.414343
0.318725
0
0
0.273086
1,267
32
90
39.59375
0.81759
0.018942
0
0.5
1
0
0
0
0
0
0
0
0.153846
1
0.115385
false
0
0.076923
0
0.192308
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
96f7acaf539335e696f2052f57cf6c7da070c0e0
7,148
py
Python
legacy-redirects.py
mk-fg/blog
0a7089b49504e6f7ece4e22948d6038a04246a1b
[ "WTFPL" ]
1
2016-07-22T21:12:03.000Z
2016-07-22T21:12:03.000Z
legacy-redirects.py
mk-fg/blog
0a7089b49504e6f7ece4e22948d6038a04246a1b
[ "WTFPL" ]
1
2017-12-01T05:29:08.000Z
2017-12-01T06:06:07.000Z
legacy-redirects.py
mk-fg/blog
0a7089b49504e6f7ece4e22948d6038a04246a1b
[ "WTFPL" ]
null
null
null
# Script to redirect from long-obsolete URLs to current static-blog ones redirects = { "2010/11/From-Baselayout-to-Systemd-setup-on-Exherbo": "2010/11/05/from-baselayout-to-systemd-setup-on-exherbo.html", "2010/11/Moar-free-time": "2010/11/12/moar-free-time.html", "2010/12/Commandline-pulseaudio-mixer-tool": "2010/12/25/commandline-pulseaudio-mixer-tool.html", "2010/12/Further-improvements-on-notification-daemon": "2010/12/09/further-improvements-for-notification-daemon.html", "2010/12/MooseFS-usage-experiences": "2010/12/07/moosefs-usage-experiences.html", "2010/12/oslistdir-and-oswalk-in-python-without-lists-by-the-grace-of-c-api-generator-and-recursion-custom-stack": "2010/12/15/oslistdir-and-oswalk-in-python-without-lists-by-the-grace-of-c-api-generator-and-recursion-custom-stack.html", "2010/12/Sane-playback-for-online-streaming-video-and-via-stream-dumping": "2010/12/29/sane-playback-for-online-streaming-video-via-stream-dumping.html", "2010/12/zcat-bzcat-lzcat-xzcat-Arrrgh-Autodetection-rocks": "2010/12/11/zcat-bzcat-lzcat-xzcat-arrrgh-autodetection-rocks.html", "2010/1/Wheee-Ive-got-a-blog-": "2010/01/30/wheee-ive-got-a-blog.html", "2010/2/libnotify-notification-daemon-shortcomings-and-my-solution": "2010/02/26/libnotify-notification-daemon-shortcomings-and-my-solution.html", "2010/2/Listening-to-music-over-the-net-with-authentication-and-cache": "2010/02/17/listening-to-music-over-the-net-with-authentication-and-cache.html", "2010/2/My-simple-ok-not-quite-backup-system": "2010/02/11/my-simple-ok-not-quite-backup-system.html", "2010/2/My-simple-ok-not-quite-backup-system-implementation-backed-up-side": "2010/02/13/my-simple-ok-not-quite-backup-system-implementation-backed-up-side.html", "2010/2/My-simple-ok-not-quite-backup-system-implementation-backup-host": "2010/02/14/my-simple-ok-not-quite-backup-system-implementation-backup-host.html", "2010/2/POSIX-capabilities-for-python": "2010/02/01/posix-capabilities-for-python.html", "2010/2/snmpd-pyagentx-or-re-discovery-of-sfnet": "2010/02/28/snmpd-pyagentx-or-re-discovery-of-sfnet.html", "2010/3/Single-instance-daemon-or-invisible-dock": "2010/03/10/single-instance-daemon-or-invisible-dock.html", "2010/4/Auto-away-for-pidgin": "2010/04/10/auto-away-for-pidgin.html", "2010/4/Availability-stats-and-history-log-with-relational-database-postgresql": "2010/04/10/availability-stats-and-history-log-with-relational-database-postgresql.html", "2010/4/Exherbo-paludis-fossil-syncer": "2010/04/25/exherbo-paludis-fossil-syncer.html", "2010/4/LUKS-dm-crypt-rootfs-without-password-via-smartcard": "2010/04/25/luks-dm-crypt-rootfs-without-password-via-smartcard.html", "2010/4/Thoughts-on-VCS-supporting-documentation-and-Fossil": "2010/04/17/thoughts-on-vcs-supporting-documentation-and-fossil.html", "2010/5/Music-collection-updates-feed-via-musicbrainz-and-lastfm": "2010/05/08/music-collection-updates-feed-via-musicbrainz-and-lastfm.html", "2010/6/Drop-in-ccrypt-replacement-for-bournal": "2010/06/13/drop-in-ccrypt-replacement-for-bournal.html", "2010/6/Getting-rid-of-dead-bittorrent-trackers-for-rtorrent-by-scrubbing-torrent-files": "2010/06/05/getting-rid-of-dead-bittorrent-trackers-for-rtorrent-by-scrubbing-torrent-files.html", "2010/6/No-IPSec-on-a-stick-for-me-": "2010/06/14/no-ipsec-on-a-stick-for-me.html", "2010/8/Home-brewed-NAS-gluster-with-sensible-replication": "2010/08/15/home-brewed-nas-gluster-with-sensible-replication.html", "2010/9/Distributed-fault-tolerant-fs-take-2-MooseFS": "2010/09/09/distributed-fault-tolerant-fs-take-2-moosefs.html", "2010/9/Info-feeds": "2010/09/12/info-feeds.html", "2011/10/dm-crypt-password-caching-between-dracut-and-systemd-systemd-password-agent": "2011/10/23/dm-crypt-password-caching-between-dracut-and-systemd-systemd-password-agent.html", "2011/11/Running-stuff-like-firefox-flash-and-skype-with-apparmor": "2011/11/12/running-stuff-like-firefox-flash-and-skype-with-apparmor.html", "2011/2/cgroups-initialization-libcgroup-and-my-ad-hoc-replacement-for-it": "2011/02/26/cgroups-initialization-libcgroup-and-my-ad-hoc-replacement-for-it.html", "2011/2/Dashboard-for-enabled-services-in-systemd": "2011/02/27/dashboard-for-enabled-services-in-systemd.html", "2011/3/Auto-updating-desktop-background-with-scaling-via-LQR-and-some-other-tricks": "2011/03/05/auto-updating-desktop-background-with-scaling-via-lqr-and-some-other-tricks.html", "2011/3/Parallel-port-LED-notification-for-extra-high-system-load": "2011/03/14/parallel-port-led-notification-for-extra-high-system-load.html", "2011/3/Selective-IPv6-AAAA-DNS-resolution": "2011/03/19/selective-ipv6-aaaa-dns-resolution.html", "2011/4/Key-Value-storage-with-historyversioning-on-top-of-scm": "2011/04/18/key-value-storage-with-historyversioning-on-top-of-scm.html", "2011/4/xdiskusage-like-visualization-for-any-remote-machine": "2011/04/19/xdiskusage-like-visualization-for-any-remote-machine.html", "2011/5/Backup-of-5-million-tiny-files-and-paths": "2011/05/08/backup-of-5-million-tiny-files-and-paths.html", "2011/5/Fossil-to-Git-export-and-mirroring": "2011/05/02/fossil-to-git-export-and-mirroring.html", "2011/6/Using-csync2-for-security-sensitive-paths": "2011/06/12/using-csync2-for-security-sensitive-paths.html", "2011/8/Notification-daemon-in-python": "2011/08/14/notification-daemon-in-python.html", "2011/9/Detailed-process-memory-accounting-including-shared-and-swapped-one": "2011/09/16/detailed-process-memory-accounting-including-shared-and-swapped-one.html", "2012/2/Late-adventures-with-time-series-data-collection-and-representation": "2012/02/28/late-adventures-with-time-series-data-collection-and-representation.html", "2012/2/On-github-as-well-now": "2012/02/03/on-github-as-well-now.html", "2012/2/Phasing-out-fossil-completely": "2012/02/07/phasing-out-fossil-completely.html", "2012/6/Proper-ish-way-to-start-long-running-systemd-service-on-udev-event-device-hotplug": "2012/06/16/proper-ish-way-to-start-long-running-systemd-service-on-udev-event-device-hotplug.html", "2012/8/A-new-toy-to-play-with-TI-Launchpad-with-MSP430-MCU": "2012/08/16/a-new-toy-to-play-with-ti-launchpad-with-msp430-mcu.html", "2012/8/Unhosted-remoteStorage-idea": "2012/08/09/unhosted-remotestorage-idea.html", "2012/9/Terms-of-Service-Didnt-Read": "2012/09/16/terms-of-service-didnt-read.html", "2013/1/Migrating-configuration-settings-to-E17-enlightenment-0170-from-older-E-versions": "2013/01/16/migrating-configuration-settings-to-e17-enlightenment-0170-from-older-e-versions.html", "2013/1/PyParsing-vs-Yapps": "2013/01/21/pyparsing-vs-yapps.html", } def application(env, start_response): url = env['REQUEST_URI'].strip('/') url_redirect = redirects.get(url) if not url_redirect: start_response('404 Not Found', [('Content-Type', 'text/html')]) err = f'404: Requested URL was not found: {url}' return [f'<img alt="{err}" title="{err}" src="/misc/ie404.png">'.encode()] url_redirect = f'/{url_redirect}' start_response( '301 Moved Permanently', [('Location', url_redirect), ('Content-Type', 'text/plain')] ) return [f'Redirecting to: {url_redirect}\n'.encode()]
100.676056
238
0.771684
1,160
7,148
4.746552
0.300862
0.040683
0.011442
0.014166
0.660915
0.629677
0.555576
0.42045
0.374682
0.257356
0
0.104745
0.033016
7,148
70
239
102.114286
0.69184
0.009793
0
0
0
0.753846
0.890192
0.857547
0
0
0
0
0
1
0.015385
false
0.030769
0
0
0.046154
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
8c01d4f64c40ebcb958cd6dc6cc678674036bee8
1,501
py
Python
website/mixins.py
unl-pal/paclab-www
9cf59bf6292da1f7bd2c2a4536def7d1323abab0
[ "Apache-2.0" ]
1
2018-10-15T14:55:59.000Z
2018-10-15T14:55:59.000Z
website/mixins.py
unl-pal/paclab-www
9cf59bf6292da1f7bd2c2a4536def7d1323abab0
[ "Apache-2.0" ]
74
2018-10-11T16:00:01.000Z
2020-09-20T10:54:03.000Z
website/mixins.py
unl-pal/paclab-www
9cf59bf6292da1f7bd2c2a4536def7d1323abab0
[ "Apache-2.0" ]
1
2018-10-11T14:17:37.000Z
2018-10-11T14:17:37.000Z
from django.contrib.auth.mixins import LoginRequiredMixin from .decorators import email_verify_warning class EmailRequiredMixin(LoginRequiredMixin): """Verify that the current user has a verified email.""" permission_denied_message = '' def dispatch(self, request, *args, **kwargs): if not request.user.is_authenticated: return self.handle_no_permission() if not request.user.profile.active_email: self.permission_denied_message = 'You must have a verified email address to view this page.' return email_verify_warning(request) return super().dispatch(request, *args, **kwargs) def get_permission_denied_message(self): return self.permission_denied_message class DeletableReadOnlyAdminMixin(object): """Makes a ModelAdmin read only and disables adds/edits but allows for deletes.""" def has_add_permission(self, request): return False def has_delete_permission(self, request, obj=None): return True def has_change_permission(self, request, obj=None): return False def save_model(self, request, obj, form, change): pass def save_related(self, request, form, formsets, change): pass class ReadOnlyAdminMixin(DeletableReadOnlyAdminMixin): """Makes a ModelAdmin read only and disables adds/edits/deletes.""" def has_delete_permission(self, request, obj=None): return False def delete_model(self, request, obj): pass
32.630435
104
0.710859
181
1,501
5.740331
0.41989
0.084697
0.067372
0.069297
0.221367
0.221367
0.221367
0.221367
0.173244
0
0
0
0.208528
1,501
45
105
33.355556
0.874579
0.125916
0
0.275862
0
0
0.043981
0
0
0
0
0
0
1
0.310345
false
0.103448
0.068966
0.172414
0.793103
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
4
8c0d33b63a72c651145006b16711e900e12c3528
8,756
py
Python
config/m600/rotors.py
leozz37/makani
c94d5c2b600b98002f932e80a313a06b9285cc1b
[ "Apache-2.0" ]
1,178
2020-09-10T17:15:42.000Z
2022-03-31T14:59:35.000Z
config/m600/rotors.py
leozz37/makani
c94d5c2b600b98002f932e80a313a06b9285cc1b
[ "Apache-2.0" ]
1
2020-05-22T05:22:35.000Z
2020-05-22T05:22:35.000Z
config/m600/rotors.py
leozz37/makani
c94d5c2b600b98002f932e80a313a06b9285cc1b
[ "Apache-2.0" ]
107
2020-09-10T17:29:30.000Z
2022-03-18T09:00:14.000Z
# Copyright 2020 Makani Technologies LLC # # 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. """Rotor parameters.""" from makani.config import mconfig from makani.control import system_types as m import numpy as np @mconfig.Config(deps={ 'flight_plan': 'common.flight_plan', 'propellers': 'prop.propellers', 'wing_serial': 'common.wing_serial', }) def MakeParams(params): # Motor rotor moment-of-inertia [kg-m^2]. yasa_rotor_moment_of_inertia = 0.33 bottom_row = [m.kMotorSbo, m.kMotorSbi, m.kMotorPbi, m.kMotorPbo] # Assign propeller versions. propeller_versions = [None for _ in range(m.kNumMotors)] if params['wing_serial'] == m.kWingSerial01: propeller_versions[m.kMotorSbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorPto] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPti] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSti] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSto] = m.kPropVersionRev4PositiveX elif params['wing_serial'] in [m.kWingSerial04Crosswind]: propeller_versions[m.kMotorSbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorPto] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPti] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSti] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSto] = m.kPropVersionRev4PositiveX elif params['wing_serial'] == m.kWingSerial04Hover: propeller_versions[m.kMotorSbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorPto] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPti] = m.kPropVersionRev1Trimmed propeller_versions[m.kMotorSti] = m.kPropVersionRev1Trimmed propeller_versions[m.kMotorSto] = m.kPropVersionRev4PositiveX elif params['wing_serial'] in [m.kWingSerial05Crosswind]: propeller_versions[m.kMotorSbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorPto] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPti] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSti] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSto] = m.kPropVersionRev4PositiveX elif params['wing_serial'] == m.kWingSerial05Hover: propeller_versions[m.kMotorSbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorPto] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPti] = m.kPropVersionRev1Trimmed propeller_versions[m.kMotorSti] = m.kPropVersionRev1Trimmed propeller_versions[m.kMotorSto] = m.kPropVersionRev4PositiveX elif params['wing_serial'] in [m.kWingSerial06Crosswind]: propeller_versions[m.kMotorSbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorPto] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPti] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSti] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSto] = m.kPropVersionRev4PositiveX elif params['wing_serial'] == m.kWingSerial06Hover: propeller_versions[m.kMotorSbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorPto] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPti] = m.kPropVersionRev1Trimmed propeller_versions[m.kMotorSti] = m.kPropVersionRev1Trimmed propeller_versions[m.kMotorSto] = m.kPropVersionRev4PositiveX elif params['wing_serial'] in [m.kWingSerial07Crosswind]: propeller_versions[m.kMotorSbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorPto] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPti] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSti] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSto] = m.kPropVersionRev4PositiveX elif params['wing_serial'] == m.kWingSerial07Hover: propeller_versions[m.kMotorSbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorSbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbi] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPbo] = m.kPropVersionRev4NegativeX propeller_versions[m.kMotorPto] = m.kPropVersionRev4PositiveX propeller_versions[m.kMotorPti] = m.kPropVersionRev1Trimmed propeller_versions[m.kMotorSti] = m.kPropVersionRev1Trimmed propeller_versions[m.kMotorSto] = m.kPropVersionRev4PositiveX else: assert False, 'Unknown wing serial.' rotors = [None for _ in range(m.kNumMotors)] for r in range(m.kNumMotors): rotors[r] = { # Normal vector to the propeller plane. 'axis': [np.cos(np.deg2rad(3.0)), 0.0, np.sin(np.deg2rad(3.0))], # Direction cosine matrix from body to rotor frame. 'dcm_b2r': {'d': [[np.cos(np.deg2rad(-3.0)), 0.0, np.sin(np.deg2rad(-3.0))], [0.0, 1.0, 0.0], [-np.sin(np.deg2rad(-3.0)), 0.0, np.cos(np.deg2rad(-3.0))]]}, # Local pressure coefficient [#] at the rotor position. The # pressure coefficient, C_P, is related to local airspeed # through the equation: # # C_P = 1 - (v / v_freestream)^2 # # There is a significant difference in airspeeds between the top # and bottom propellers caused by the lift of the wing. These # pressure coefficients are derived from CFD with the slatted # kite at 4 deg alpha (https://goo.gl/yfkJJS) 'local_pressure_coeff': 0.1448 if r in bottom_row else -0.1501, # The rotor direction, diameter [m] and moment of inertia [kg # m^2] are set from the corresponding propeller's information. 'version': propeller_versions[r], 'dir': params['propellers'][propeller_versions[r]]['dir'], 'D': params['propellers'][propeller_versions[r]]['D'], 'I': (yasa_rotor_moment_of_inertia + params['propellers'][propeller_versions[r]]['I']), } # We check that the rotor axis is normalized. because it is used # to determine the force-moment conversion matrix in # rotor_control.py. assert abs(np.linalg.norm(rotors[r]['axis']) - 1.0) < 1e-9 # Rotor positions [m]. # # Updated on 2015-01-22 based on the COM positions given by the Mass # and Balance spreadsheet. rotors[m.kMotorSbo]['pos'] = [1.613, 3.639, 1.597] rotors[m.kMotorSbi]['pos'] = [1.613, 1.213, 1.597] rotors[m.kMotorPbi]['pos'] = [1.613, -1.213, 1.597] rotors[m.kMotorPbo]['pos'] = [1.613, -3.639, 1.597] rotors[m.kMotorPto]['pos'] = [1.960, -3.639, -1.216] rotors[m.kMotorPti]['pos'] = [1.960, -1.213, -1.216] rotors[m.kMotorSti]['pos'] = [1.960, 1.213, -1.216] rotors[m.kMotorSto]['pos'] = [1.960, 3.639, -1.216] return rotors
51.204678
74
0.74132
1,008
8,756
6.330357
0.223214
0.207804
0.203103
0.188685
0.702554
0.679047
0.663062
0.658047
0.658047
0.637361
0
0.034441
0.154408
8,756
170
75
51.505882
0.827391
0.171083
0
0.595041
0
0
0.042822
0
0
0
0
0
0.016529
1
0.008264
false
0
0.024793
0
0.041322
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
8c0f2c1edf73dec86391d85813a3e91c6cb69781
169
py
Python
tests/data/expected/parser/openapi/openapi_parser_parse_any/output.py
languitar/datamodel-code-generator
ddd909746a66df5c8268d782f3ae24bee636be92
[ "MIT" ]
891
2019-07-23T04:23:32.000Z
2022-03-31T13:36:33.000Z
tests/data/expected/parser/openapi/openapi_parser_parse_any/output.py
languitar/datamodel-code-generator
ddd909746a66df5c8268d782f3ae24bee636be92
[ "MIT" ]
663
2019-07-23T09:50:26.000Z
2022-03-29T01:56:55.000Z
tests/data/expected/parser/openapi/openapi_parser_parse_any/output.py
languitar/datamodel-code-generator
ddd909746a66df5c8268d782f3ae24bee636be92
[ "MIT" ]
108
2019-07-23T08:50:37.000Z
2022-03-09T10:50:22.000Z
from __future__ import annotations from typing import Any, Optional from pydantic import BaseModel class Item(BaseModel): bar: Optional[Any] = None foo: str
15.363636
34
0.751479
22
169
5.590909
0.681818
0
0
0
0
0
0
0
0
0
0
0
0.195266
169
10
35
16.9
0.904412
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
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
8c49dda045adfaa3cfc4dcde686ceb9a3803cf6a
172
py
Python
configs/ocrnet/ocrnet_hr18_bs2x_512x1024_40k_cityscapes.py
openseg-group/mmsegmentation
23939f09d2b0bd30fc26eb7f8af974f1f5441210
[ "Apache-2.0" ]
2
2020-07-10T12:13:56.000Z
2020-11-09T07:09:29.000Z
configs/ocrnet/ocrnet_hr18_bs2x_512x1024_40k_cityscapes.py
openseg-group/mmsegmentation
23939f09d2b0bd30fc26eb7f8af974f1f5441210
[ "Apache-2.0" ]
null
null
null
configs/ocrnet/ocrnet_hr18_bs2x_512x1024_40k_cityscapes.py
openseg-group/mmsegmentation
23939f09d2b0bd30fc26eb7f8af974f1f5441210
[ "Apache-2.0" ]
2
2020-07-28T09:12:55.000Z
2021-01-04T07:49:59.000Z
_base_ = [ '../_base_/models/ocrnet_hr18.py', '../_base_/datasets/cityscapes_bs2x.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_40k_lr2x.py' ]
34.4
79
0.69186
21
172
4.952381
0.666667
0.173077
0
0
0
0
0
0
0
0
0
0.038462
0.093023
172
4
80
43
0.628205
0
0
0
0
0
0.790698
0.790698
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
8c641d6a49a4e008488e0cb59668fa1eab08b58e
51
py
Python
Chapter 01/ch1_23.py
bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE
f6a4194684515495d00aa38347a725dd08f39a0c
[ "MIT" ]
null
null
null
Chapter 01/ch1_23.py
bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE
f6a4194684515495d00aa38347a725dd08f39a0c
[ "MIT" ]
null
null
null
Chapter 01/ch1_23.py
bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE
f6a4194684515495d00aa38347a725dd08f39a0c
[ "MIT" ]
null
null
null
print ("Overall Average: {0:.0f}%".format(75.2876))
51
51
0.666667
8
51
4.25
1
0
0
0
0
0
0
0
0
0
0
0.166667
0.058824
51
1
51
51
0.541667
0
0
0
0
0
0.480769
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
4fbbd6b64c6af7055d55d0827a37dee887ed7b4b
172
py
Python
validate.py
parlar/SampleSheetCreator
2ee43584d1922a5f97037fea91c0ddfabd7b569d
[ "MIT" ]
null
null
null
validate.py
parlar/SampleSheetCreator
2ee43584d1922a5f97037fea91c0ddfabd7b569d
[ "MIT" ]
null
null
null
validate.py
parlar/SampleSheetCreator
2ee43584d1922a5f97037fea91c0ddfabd7b569d
[ "MIT" ]
null
null
null
#! python # -*- coding: utf-8 -*- # # validate functions for all data inputs for SampleSheetCreator # import sys import os import cerberus from ruamel.yaml import YAML
12.285714
63
0.726744
23
172
5.434783
0.782609
0
0
0
0
0
0
0
0
0
0
0.007143
0.186047
172
13
64
13.230769
0.885714
0.534884
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
8b438313718b1725f5f1268c87e5e0d3aaf1c286
60
py
Python
allauth_facebook/urls.py
fluenty/datamanager
97ba9d58d4527b7d61b730ea4896f09a56e6ae60
[ "MIT" ]
3
2019-08-31T03:08:22.000Z
2020-04-03T13:09:20.000Z
allauth_facebook/urls.py
fluenty/datamanager
97ba9d58d4527b7d61b730ea4896f09a56e6ae60
[ "MIT" ]
97
2019-04-16T07:54:38.000Z
2022-02-10T07:25:48.000Z
allauth_facebook/urls.py
fluenty/datamanager
97ba9d58d4527b7d61b730ea4896f09a56e6ae60
[ "MIT" ]
14
2019-04-23T09:48:17.000Z
2021-04-13T17:48:40.000Z
from allauth.socialaccount.providers.facebook.urls import *
30
59
0.85
7
60
7.285714
1
0
0
0
0
0
0
0
0
0
0
0
0.066667
60
1
60
60
0.910714
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
8c80d940772732d55b2154ba0096591e14d5bb07
41
py
Python
constructor/__init__.py
schrodinger/constructor
829f3bea6c99c0e30105b23449c8c6d0790ede8e
[ "BSD-3-Clause" ]
null
null
null
constructor/__init__.py
schrodinger/constructor
829f3bea6c99c0e30105b23449c8c6d0790ede8e
[ "BSD-3-Clause" ]
null
null
null
constructor/__init__.py
schrodinger/constructor
829f3bea6c99c0e30105b23449c8c6d0790ede8e
[ "BSD-3-Clause" ]
null
null
null
__version__ = '2.1.1' __version__ += 's'
13.666667
21
0.634146
6
41
3
0.666667
0
0
0
0
0
0
0
0
0
0
0.085714
0.146341
41
2
22
20.5
0.428571
0
0
0
0
0
0.146341
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
8c8d3e5dbb2234bd14e14b91c1a6b664adf7af19
714
py
Python
armstrong/hatband/__init__.py
armstrong/armstrong.hatband
b34027c85a8ccfe2ee37aa9348d98e143d300082
[ "Apache-2.0" ]
null
null
null
armstrong/hatband/__init__.py
armstrong/armstrong.hatband
b34027c85a8ccfe2ee37aa9348d98e143d300082
[ "Apache-2.0" ]
3
2015-05-29T05:07:09.000Z
2018-07-18T13:53:36.000Z
armstrong/hatband/__init__.py
armstrong/armstrong.hatband
b34027c85a8ccfe2ee37aa9348d98e143d300082
[ "Apache-2.0" ]
2
2015-07-29T20:58:29.000Z
2015-08-07T02:59:37.000Z
# Make this a drop-in replacement for Django's built-in Admin from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME from django.contrib.admin.options import HORIZONTAL, VERTICAL # Below are overrides that we provide that are Hatband specific from .options import ModelAdmin, StackedInline, TabularInline from armstrong.hatband.sites import AdminSite, site def autodiscover(): """ TODO: document """ from django.contrib.admin import autodiscover as django_autodiscover django_autodiscover() from copy import copy from django.contrib.admin import site as django_site registry = copy(django_site._registry) registry.update(site._registry) site._registry = registry
32.454545
72
0.777311
92
714
5.934783
0.478261
0.07326
0.124542
0.161172
0.102564
0
0
0
0
0
0
0
0.161064
714
21
73
34
0.911519
0.191877
0
0
0
0
0
0
0
0
0
0.047619
0
1
0.083333
false
0
0.583333
0
0.666667
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
1
0
1
0
0
4
8c99b478e032407ebf484a1cf41d3615b1240e17
88
py
Python
nbcollection/__init__.py
eteq/nbcollection
156cce71e954583886912dcc630c463084ab58dd
[ "BSD-3-Clause" ]
6
2021-04-13T23:08:14.000Z
2021-11-14T03:23:20.000Z
nbcollection/__init__.py
eteq/nbcollection
156cce71e954583886912dcc630c463084ab58dd
[ "BSD-3-Clause" ]
11
2020-07-08T14:10:47.000Z
2022-01-18T16:04:34.000Z
nbcollection/__init__.py
adrn/nbstatic
a1101efbf140d872a8220a6bbb3d95f29a9887f0
[ "BSD-3-Clause" ]
3
2020-07-21T19:55:24.000Z
2021-09-21T15:44:26.000Z
from .converter import nbcollectionConverter from .notebook import nbcollectionNotebook
29.333333
44
0.886364
8
88
9.75
0.75
0
0
0
0
0
0
0
0
0
0
0
0.090909
88
2
45
44
0.975
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
8cb25b40149299f7dbb106cb5527368bfae802ed
164
py
Python
src/yellowdog_client/model/authentication_provider.py
yellowdog/yellowdog-sdk-python-public
da69a7d6e45c92933e34fefcaef8b5d98dcd6036
[ "Apache-2.0" ]
null
null
null
src/yellowdog_client/model/authentication_provider.py
yellowdog/yellowdog-sdk-python-public
da69a7d6e45c92933e34fefcaef8b5d98dcd6036
[ "Apache-2.0" ]
null
null
null
src/yellowdog_client/model/authentication_provider.py
yellowdog/yellowdog-sdk-python-public
da69a7d6e45c92933e34fefcaef8b5d98dcd6036
[ "Apache-2.0" ]
null
null
null
from enum import Enum class AuthenticationProvider(Enum): YELLOWDOG = "YELLOWDOG" AZURE = "AZURE" def __str__(self) -> str: return self.name
16.4
35
0.658537
18
164
5.777778
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.25
164
9
36
18.222222
0.845528
0
0
0
0
0
0.085366
0
0
0
0
0
0
1
0.166667
false
0
0.166667
0.166667
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
4
8cf34a6caa5948acdc1a9774abee55e83fafe98e
10,805
py
Python
CONTOH_CONTOH/aoc2021/hari5.ms.py
jiaminglimjm/JawiPython
affbb34c7876498a7cc3eef2ef87d59f7cccd8b1
[ "0BSD" ]
null
null
null
CONTOH_CONTOH/aoc2021/hari5.ms.py
jiaminglimjm/JawiPython
affbb34c7876498a7cc3eef2ef87d59f7cccd8b1
[ "0BSD" ]
null
null
null
CONTOH_CONTOH/aoc2021/hari5.ms.py
jiaminglimjm/JawiPython
affbb34c7876498a7cc3eef2ef87d59f7cccd8b1
[ "0BSD" ]
null
null
null
اينڤوت = '''599,531 -> 599,32 435,904 -> 435,489 768,714 -> 768,187 845,552 -> 596,801 167,680 -> 167,445 45,887 -> 45,346 780,295 -> 179,896 310,539 -> 602,831 535,556 -> 349,556 797,180 -> 797,62 771,406 -> 120,406 383,296 -> 383,918 689,815 -> 73,199 658,642 -> 658,333 931,104 -> 708,104 406,278 -> 406,29 315,532 -> 773,74 439,953 -> 289,953 555,162 -> 695,302 444,522 -> 444,828 460,844 -> 460,972 838,18 -> 143,713 335,785 -> 335,485 757,886 -> 757,327 266,205 -> 273,205 934,42 -> 19,957 671,622 -> 263,214 739,781 -> 739,332 848,507 -> 848,394 577,58 -> 461,174 49,905 -> 921,33 627,455 -> 205,455 106,523 -> 974,523 707,335 -> 707,313 65,214 -> 712,214 610,267 -> 610,403 47,699 -> 565,181 288,833 -> 709,833 452,59 -> 452,632 629,209 -> 125,209 535,232 -> 535,342 542,942 -> 542,753 618,905 -> 552,905 598,314 -> 976,314 350,824 -> 17,824 753,570 -> 753,617 544,302 -> 259,302 628,271 -> 628,379 856,265 -> 856,792 77,317 -> 77,122 905,420 -> 905,687 812,512 -> 812,411 844,486 -> 771,559 798,778 -> 798,215 571,160 -> 278,453 242,352 -> 227,352 958,118 -> 167,909 201,915 -> 201,564 163,583 -> 163,279 23,111 -> 23,883 248,281 -> 331,281 381,768 -> 900,768 78,988 -> 78,326 914,659 -> 247,659 532,531 -> 520,531 65,309 -> 734,978 170,923 -> 399,694 740,496 -> 196,496 832,452 -> 816,452 675,463 -> 878,463 659,852 -> 560,852 143,655 -> 227,655 334,795 -> 334,978 217,913 -> 368,913 675,33 -> 503,33 42,981 -> 811,981 458,162 -> 722,162 92,613 -> 92,542 393,584 -> 393,252 276,256 -> 725,705 752,442 -> 752,789 63,281 -> 744,281 596,845 -> 35,284 594,534 -> 964,164 337,380 -> 337,511 158,142 -> 75,225 606,47 -> 606,111 987,30 -> 62,955 192,196 -> 428,196 449,672 -> 449,77 804,151 -> 804,255 783,581 -> 287,581 860,891 -> 69,100 966,187 -> 761,392 400,742 -> 278,742 661,656 -> 592,587 787,415 -> 787,771 866,228 -> 417,228 915,385 -> 505,385 715,620 -> 715,633 615,31 -> 615,940 691,885 -> 527,885 426,705 -> 351,705 258,215 -> 258,949 480,449 -> 480,710 788,710 -> 788,67 850,90 -> 597,90 398,379 -> 18,759 248,107 -> 665,524 901,933 -> 208,240 433,424 -> 110,424 214,447 -> 389,272 468,330 -> 468,928 950,759 -> 332,759 447,541 -> 420,541 659,138 -> 604,83 821,264 -> 95,264 914,132 -> 46,132 821,604 -> 821,57 805,734 -> 85,14 806,274 -> 164,916 205,780 -> 205,133 798,472 -> 361,472 817,57 -> 127,747 172,119 -> 922,869 118,167 -> 55,167 56,548 -> 344,836 117,108 -> 940,931 530,46 -> 530,785 528,507 -> 729,708 11,986 -> 987,10 979,932 -> 76,29 863,250 -> 210,903 879,215 -> 891,215 592,219 -> 592,528 211,760 -> 211,347 21,842 -> 633,230 110,356 -> 110,254 925,606 -> 444,125 757,566 -> 757,498 702,622 -> 637,622 51,379 -> 365,379 273,906 -> 273,494 170,795 -> 929,36 159,56 -> 435,56 724,953 -> 724,735 536,748 -> 901,748 937,148 -> 937,510 963,507 -> 863,507 840,290 -> 840,221 864,154 -> 55,963 977,487 -> 685,487 863,617 -> 210,617 862,308 -> 291,879 286,477 -> 286,276 550,805 -> 550,489 964,508 -> 821,651 475,290 -> 789,290 25,882 -> 25,349 570,374 -> 604,374 354,442 -> 514,282 457,700 -> 360,700 548,889 -> 548,502 11,393 -> 11,829 60,714 -> 781,714 943,953 -> 972,924 757,386 -> 465,386 230,463 -> 27,463 815,385 -> 326,385 32,630 -> 378,976 298,853 -> 298,644 532,146 -> 23,146 958,685 -> 737,464 853,847 -> 79,73 815,590 -> 815,961 49,87 -> 751,789 55,513 -> 55,378 163,907 -> 574,907 355,168 -> 355,836 453,742 -> 674,742 273,458 -> 685,458 981,961 -> 958,984 120,59 -> 401,59 735,964 -> 395,964 277,377 -> 277,646 633,694 -> 633,707 224,376 -> 976,376 201,790 -> 293,790 950,952 -> 12,14 389,48 -> 356,48 337,424 -> 166,424 591,915 -> 591,456 205,162 -> 942,162 404,421 -> 404,748 319,983 -> 608,694 94,677 -> 94,853 873,388 -> 873,617 858,82 -> 858,890 64,503 -> 64,787 372,224 -> 50,546 531,241 -> 960,670 47,33 -> 975,961 853,52 -> 271,634 668,437 -> 668,719 162,290 -> 843,290 421,299 -> 944,822 103,983 -> 103,324 290,71 -> 290,686 209,38 -> 546,38 740,878 -> 378,878 741,795 -> 741,916 27,431 -> 445,431 795,289 -> 795,759 345,772 -> 775,772 977,480 -> 512,15 49,863 -> 49,659 223,590 -> 779,590 503,771 -> 917,771 499,289 -> 935,725 246,459 -> 246,395 860,257 -> 656,257 425,87 -> 425,603 355,378 -> 355,23 462,286 -> 462,358 181,571 -> 181,732 17,649 -> 476,649 394,321 -> 394,293 812,660 -> 515,957 21,150 -> 799,928 437,593 -> 437,372 125,495 -> 373,743 482,404 -> 482,420 283,580 -> 283,234 667,966 -> 827,806 959,961 -> 959,931 461,845 -> 206,845 299,888 -> 299,836 680,828 -> 680,855 958,977 -> 26,45 847,419 -> 290,976 892,920 -> 892,180 487,945 -> 487,445 329,570 -> 583,570 110,940 -> 989,61 475,351 -> 882,351 953,229 -> 429,229 119,125 -> 749,125 834,103 -> 212,725 978,412 -> 978,343 916,310 -> 758,310 825,761 -> 720,761 353,954 -> 353,795 422,464 -> 422,356 662,964 -> 836,790 242,873 -> 242,570 742,972 -> 797,972 698,364 -> 360,26 258,633 -> 19,872 406,649 -> 406,685 386,710 -> 925,710 347,657 -> 524,480 812,905 -> 554,647 420,505 -> 420,231 908,693 -> 908,724 130,772 -> 130,898 560,23 -> 560,987 941,831 -> 941,544 817,940 -> 132,255 515,280 -> 515,811 544,102 -> 568,102 115,612 -> 67,660 743,762 -> 743,152 246,14 -> 691,459 766,492 -> 673,492 467,179 -> 351,63 655,779 -> 655,524 314,171 -> 314,108 414,64 -> 502,64 564,239 -> 894,239 984,974 -> 56,46 201,963 -> 201,223 238,194 -> 238,832 30,652 -> 477,652 818,735 -> 582,971 225,566 -> 673,566 172,865 -> 74,865 264,101 -> 264,812 487,916 -> 979,916 879,30 -> 10,899 797,657 -> 797,136 750,642 -> 593,799 550,244 -> 418,376 158,816 -> 668,816 505,648 -> 303,648 411,688 -> 263,688 544,35 -> 771,35 545,846 -> 286,846 284,760 -> 284,929 835,401 -> 708,401 533,591 -> 545,591 866,757 -> 475,757 202,62 -> 907,767 456,655 -> 456,123 367,714 -> 225,714 359,679 -> 926,679 623,853 -> 623,865 170,120 -> 213,120 481,741 -> 481,435 928,73 -> 41,960 551,282 -> 551,265 988,986 -> 12,10 351,172 -> 791,172 49,65 -> 952,968 725,617 -> 691,617 509,159 -> 697,159 83,985 -> 83,968 206,617 -> 334,489 880,682 -> 966,768 60,896 -> 60,617 501,686 -> 49,234 801,708 -> 738,771 548,883 -> 548,33 753,162 -> 29,162 102,478 -> 102,295 115,656 -> 637,134 924,970 -> 924,963 191,340 -> 191,515 764,481 -> 523,481 97,619 -> 97,890 228,183 -> 228,624 171,867 -> 68,867 797,685 -> 167,685 510,955 -> 464,955 930,955 -> 233,258 934,572 -> 934,900 217,822 -> 797,242 868,939 -> 369,440 861,811 -> 861,36 346,617 -> 346,153 754,526 -> 754,426 482,724 -> 482,21 328,984 -> 976,984 933,895 -> 325,287 965,973 -> 232,240 502,707 -> 767,972 353,680 -> 815,218 311,210 -> 311,157 156,944 -> 928,172 615,395 -> 101,909 107,500 -> 528,921 375,42 -> 375,796 13,292 -> 818,292 613,144 -> 613,541 340,677 -> 340,406 631,655 -> 744,655 22,242 -> 723,943 705,596 -> 980,321 316,955 -> 316,515 760,279 -> 44,279 391,328 -> 391,724 917,476 -> 917,668 66,907 -> 913,60 597,260 -> 362,25 568,584 -> 568,297 375,506 -> 375,300 988,31 -> 72,947 425,342 -> 154,342 196,395 -> 899,395 904,17 -> 94,17 546,159 -> 751,159 284,557 -> 175,448 69,201 -> 697,201 130,421 -> 224,421 646,462 -> 637,453 187,638 -> 621,638 832,212 -> 416,212 614,582 -> 348,582 677,404 -> 677,709 178,122 -> 915,859 81,849 -> 223,849 717,18 -> 646,18 723,666 -> 974,666 703,234 -> 130,234 317,107 -> 106,107 207,397 -> 207,375 688,465 -> 982,171 749,201 -> 610,201 280,313 -> 827,860 773,873 -> 917,873 337,908 -> 337,155 541,427 -> 385,583 611,314 -> 131,794 966,909 -> 104,47 785,556 -> 346,556 914,645 -> 914,718 683,941 -> 657,915 919,665 -> 310,56 743,978 -> 779,978 953,925 -> 953,854 899,347 -> 705,347 46,597 -> 46,255 332,364 -> 922,954 38,987 -> 832,193 77,585 -> 77,262 155,61 -> 734,640 953,136 -> 655,136 939,730 -> 158,730 903,458 -> 393,458 50,227 -> 50,249 536,814 -> 536,242 906,694 -> 259,47 317,237 -> 853,773 828,55 -> 509,55 40,664 -> 341,965 414,820 -> 53,459 244,344 -> 272,344 191,606 -> 308,606 329,409 -> 329,960 166,863 -> 938,91 655,396 -> 291,760 634,666 -> 625,666 360,622 -> 360,550 568,473 -> 840,201 534,162 -> 534,823 583,563 -> 583,521 124,447 -> 124,79 207,559 -> 207,649 688,238 -> 26,900 173,33 -> 117,33 665,800 -> 665,86 121,515 -> 121,132 32,472 -> 32,960 513,28 -> 513,299 881,612 -> 881,415 72,71 -> 977,976 169,821 -> 111,821 603,756 -> 254,756 182,129 -> 182,824 746,670 -> 942,670 143,15 -> 72,86 108,134 -> 963,989 860,388 -> 834,362 252,811 -> 473,811 575,306 -> 575,368 686,471 -> 686,38 673,59 -> 673,861 461,949 -> 491,949 915,373 -> 330,958 933,699 -> 588,699 254,798 -> 254,498 329,865 -> 329,926 569,243 -> 659,243 762,808 -> 921,967 722,460 -> 68,460 136,470 -> 355,470 133,919 -> 56,842 87,868 -> 853,102 622,102 -> 446,102 798,494 -> 135,494 281,858 -> 281,172 141,172 -> 765,796 794,194 -> 102,886 539,983 -> 539,895 841,755 -> 841,365 695,429 -> 166,958 965,933 -> 899,933 603,699 -> 603,708 598,635 -> 844,635 288,190 -> 288,946 559,383 -> 423,383 795,332 -> 409,718 600,645 -> 478,645 831,24 -> 905,24 13,817 -> 606,224 828,878 -> 96,146 32,197 -> 32,891 84,832 -> 84,756 404,281 -> 404,781 394,441 -> 489,536 845,876 -> 589,876 833,114 -> 833,834 979,130 -> 979,238 907,189 -> 396,700 448,740 -> 714,474 145,837 -> 100,837 982,983 -> 38,39 962,506 -> 962,764 773,922 -> 975,922 892,666 -> 904,654 754,201 -> 459,496 108,829 -> 108,894 122,381 -> 122,484 683,301 -> 630,354 47,103 -> 897,953 549,880 -> 942,487 944,15 -> 44,915 713,456 -> 713,402 83,865 -> 239,865 814,585 -> 814,105 980,439 -> 685,439''' ڤيسه = str.split ݢاريس٢ = [] اونتوق باريس دالم ڤيسه(اينڤوت,'\n'): مولا ,اخير = ڤيسه(باريس ,' -> ') ݢاريس٢.append([[اينتيݢر(ک) اونتوق ک دالم ڤيسه(مولا,',')], [اينتيݢر(ک) اونتوق ک دالم ڤيسه(اخير,',')]]) ڤاڤن = [[0 اونتوق _ دالم جولت(1000)] اونتوق __ دالم جولت(1000)] اونتوق مولا,اخير دالم ݢاريس٢: جک مولا[0] == اخير[0]: اونتوق شي دالم جولت(مينيموم(مولا[1],اخير[1]) ,مکسيموم(مولا[1],اخير[1])+1): ڤاڤن[مولا[0]][شي] += 1 جکاءين مولا[1] == اخير[1]: اونتوق شي دالم جولت(مينيموم(مولا[0],اخير[0]) ,مکسيموم(مولا[0],اخير[0])+1): ڤاڤن[شي][مولا[1]] += 1 جکاءين mutlak(مولا[0] - اخير[0]) == mutlak(مولا[1] - اخير[1]): جک مولا[0] < اخير[0] دان مولا[1] < اخير[1]: اونتوق شي دالم جولت(اخير[0] - مولا[0] + 1): ڤاڤن[مولا[0]+شي][مولا[1]+شي] += 1 جک مولا[0] < اخير[0] دان مولا[1] > اخير[1]: اونتوق شي دالم جولت(اخير[0] - مولا[0] + 1): ڤاڤن [مولا[0]+شي][مولا[1]-شي] += 1 جک مولا[0] > اخير[0] دان مولا[1] < اخير[1]: اونتوق شي دالم جولت(مولا[0] - اخير[0] + 1): ڤاڤن[مولا[0]-شي][مولا[1]+شي] += 1 جک مولا[0] > اخير[0] دان مولا[1] > اخير[1]: اونتوق شي دالم جولت(مولا[1] - اخير[1] + 1): ڤاڤن[مولا[0]-شي][مولا[1]-شي] += 1 جومله = 0 اونتوق د دالم ڤاڤن: اونتوق ن دالم د: جک ن >= 2: جومله += 1 چيتق(جومله) # ans1: 7644 # ans2: 18627 # 13:46 solved :) 46 mins #
19.329159
82
0.606941
2,241
10,805
2.925033
0.368585
0.012204
0.012357
0.01373
0.074142
0.065904
0.050038
0.050038
0.046072
0.038749
0
0.665161
0.180472
10,805
558
83
19.363799
0.075099
0.004257
0
0.003752
0
0
0.865073
0
0
0
0
0
0
0
null
null
0
0
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
5092d728c7480a12da1a2fda1036ffb01fc1da99
163
py
Python
watoee/conf/global_settings.py
snower/watoee
a64e1c3c9fefed2d3e780f6d8a2915b1bc4a7f58
[ "MIT" ]
1
2016-12-16T04:31:29.000Z
2016-12-16T04:31:29.000Z
watoee/conf/global_settings.py
snower/watoee
a64e1c3c9fefed2d3e780f6d8a2915b1bc4a7f58
[ "MIT" ]
1
2016-12-16T04:34:29.000Z
2016-12-16T04:34:29.000Z
watoee/conf/global_settings.py
snower/watoee
a64e1c3c9fefed2d3e780f6d8a2915b1bc4a7f58
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # 16/12/15 # create by: snower FORMATER = "watoee.formaters.formater.Formater" SERIALIZE = "watoee.serializes.jsonserialize.JsonSerialize"
27.166667
59
0.736196
19
163
6.315789
0.789474
0
0
0
0
0
0
0
0
0
0
0.047945
0.104294
163
6
59
27.166667
0.773973
0.294479
0
0
0
0
0.705357
0.705357
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
50c5cac1c95fbc3385e5615fb2447d83854040fa
17,034
py
Python
src/uarch/gpu/amd_gpu.py
ThatCopy/OCSysInfo
f23bd8520a1b6bc298e538dbeb29d7bd60398416
[ "MIT" ]
6
2021-10-16T14:06:11.000Z
2022-02-12T15:12:51.000Z
src/uarch/gpu/amd_gpu.py
ThatCopy/OCSysInfo
f23bd8520a1b6bc298e538dbeb29d7bd60398416
[ "MIT" ]
11
2021-10-17T22:44:12.000Z
2022-02-13T09:13:40.000Z
src/uarch/gpu/amd_gpu.py
ThatCopy/OCSysInfo
f23bd8520a1b6bc298e538dbeb29d7bd60398416
[ "MIT" ]
9
2021-10-18T05:11:56.000Z
2021-11-21T03:26:02.000Z
amd = [ { "Codename": "Tahiti", "IDs": [ { "Vendor": "0x1002", "Device": "0x6780" }, { "Vendor": "0x1002", "Device": "0x6784" }, { "Vendor": "0x1002", "Device": "0x6788" }, { "Vendor": "0x1002", "Device": "0x678a" }, { "Vendor": "0x1002", "Device": "0x6790" }, { "Vendor": "0x1002", "Device": "0x6791" }, { "Vendor": "0x1002", "Device": "0x6792" }, { "Vendor": "0x1002", "Device": "0x6798" }, { "Vendor": "0x1002", "Device": "0x6799" }, { "Vendor": "0x1002", "Device": "0x679a" }, { "Vendor": "0x1002", "Device": "0x679b" }, { "Vendor": "0x1002", "Device": "0x679e" }, { "Vendor": "0x1002", "Device": "0x679f" } ] }, { "Codename": "Pitcairn", "IDs": [ { "Vendor": "0x1002", "Device": "0x6800" }, { "Vendor": "0x1002", "Device": "0x6801" }, { "Vendor": "0x1002", "Device": "0x6802" }, { "Vendor": "0x1002", "Device": "0x6806" }, { "Vendor": "0x1002", "Device": "0x6808" }, { "Vendor": "0x1002", "Device": "0x6809" }, { "Vendor": "0x1002", "Device": "0x6810" }, { "Vendor": "0x1002", "Device": "0x6811" }, { "Vendor": "0x1002", "Device": "0x6816" }, { "Vendor": "0x1002", "Device": "0x6817" }, { "Vendor": "0x1002", "Device": "0x6818" }, { "Vendor": "0x1002", "Device": "0x6819" } ] }, { "Codename": "Oland", "IDs": [ { "Vendor": "0x1002", "Device": "0x6600" }, { "Vendor": "0x1002", "Device": "0x6601" }, { "Vendor": "0x1002", "Device": "0x6602" }, { "Vendor": "0x1002", "Device": "0x6603" }, { "Vendor": "0x1002", "Device": "0x6604" }, { "Vendor": "0x1002", "Device": "0x6605" }, { "Vendor": "0x1002", "Device": "0x6606" }, { "Vendor": "0x1002", "Device": "0x6607" }, { "Vendor": "0x1002", "Device": "0x6608" }, { "Vendor": "0x1002", "Device": "0x6610" }, { "Vendor": "0x1002", "Device": "0x6611" }, { "Vendor": "0x1002", "Device": "0x6613" }, { "Vendor": "0x1002", "Device": "0x6617" }, { "Vendor": "0x1002", "Device": "0x6620" }, { "Vendor": "0x1002", "Device": "0x6621" }, { "Vendor": "0x1002", "Device": "0x6623" }, { "Vendor": "0x1002", "Device": "0x6631" } ] }, { "Codename": "Verde", "IDs": [ { "Vendor": "0x1002", "Device": "0x6820" }, { "Vendor": "0x1002", "Device": "0x6821" }, { "Vendor": "0x1002", "Device": "0x6822" }, { "Vendor": "0x1002", "Device": "0x6823" }, { "Vendor": "0x1002", "Device": "0x6824" }, { "Vendor": "0x1002", "Device": "0x6825" }, { "Vendor": "0x1002", "Device": "0x6826" }, { "Vendor": "0x1002", "Device": "0x6827" }, { "Vendor": "0x1002", "Device": "0x6828" }, { "Vendor": "0x1002", "Device": "0x6829" }, { "Vendor": "0x1002", "Device": "0x682a" }, { "Vendor": "0x1002", "Device": "0x682b" }, { "Vendor": "0x1002", "Device": "0x682c" }, { "Vendor": "0x1002", "Device": "0x682d" }, { "Vendor": "0x1002", "Device": "0x682f" }, { "Vendor": "0x1002", "Device": "0x6830" }, { "Vendor": "0x1002", "Device": "0x6831" }, { "Vendor": "0x1002", "Device": "0x6835" }, { "Vendor": "0x1002", "Device": "0x6837" }, { "Vendor": "0x1002", "Device": "0x6838" }, { "Vendor": "0x1002", "Device": "0x6839" }, { "Vendor": "0x1002", "Device": "0x683b" }, { "Vendor": "0x1002", "Device": "0x683d" }, { "Vendor": "0x1002", "Device": "0x683f" } ] }, { "Codename": "Hainan", "IDs": [ { "Vendor": "0x1002", "Device": "0x6660" }, { "Vendor": "0x1002", "Device": "0x6663" }, { "Vendor": "0x1002", "Device": "0x6664" }, { "Vendor": "0x1002", "Device": "0x6665" }, { "Vendor": "0x1002", "Device": "0x6667" }, { "Vendor": "0x1002", "Device": "0x666f" } ] }, { "Codename": "Kaveri", "IDs": [ { "Vendor": "0x1002", "Device": "0x1304" }, { "Vendor": "0x1002", "Device": "0x1305" }, { "Vendor": "0x1002", "Device": "0x1306" }, { "Vendor": "0x1002", "Device": "0x1307" }, { "Vendor": "0x1002", "Device": "0x1309" }, { "Vendor": "0x1002", "Device": "0x130a" }, { "Vendor": "0x1002", "Device": "0x130b" }, { "Vendor": "0x1002", "Device": "0x130c" }, { "Vendor": "0x1002", "Device": "0x130d" }, { "Vendor": "0x1002", "Device": "0x130e" }, { "Vendor": "0x1002", "Device": "0x130f" }, { "Vendor": "0x1002", "Device": "0x1310" }, { "Vendor": "0x1002", "Device": "0x1311" }, { "Vendor": "0x1002", "Device": "0x1312" }, { "Vendor": "0x1002", "Device": "0x1313" }, { "Vendor": "0x1002", "Device": "0x1315" }, { "Vendor": "0x1002", "Device": "0x1316" }, { "Vendor": "0x1002", "Device": "0x1317" }, { "Vendor": "0x1002", "Device": "0x1318" }, { "Vendor": "0x1002", "Device": "0x131b" }, { "Vendor": "0x1002", "Device": "0x131c" }, { "Vendor": "0x1002", "Device": "0x131d" } ] }, { "Codename": "Bonaire", "IDs": [ { "Vendor": "0x1002", "Device": "0x6640" }, { "Vendor": "0x1002", "Device": "0x6641" }, { "Vendor": "0x1002", "Device": "0x6646" }, { "Vendor": "0x1002", "Device": "0x6647" }, { "Vendor": "0x1002", "Device": "0x6649" }, { "Vendor": "0x1002", "Device": "0x6650" }, { "Vendor": "0x1002", "Device": "0x6651" }, { "Vendor": "0x1002", "Device": "0x6658" }, { "Vendor": "0x1002", "Device": "0x665c" }, { "Vendor": "0x1002", "Device": "0x665d" }, { "Vendor": "0x1002", "Device": "0x665f" } ] }, { "Codename": "Hawaii", "IDs": [ { "Vendor": "0x1002", "Device": "0x67a0" }, { "Vendor": "0x1002", "Device": "0x67a1" }, { "Vendor": "0x1002", "Device": "0x67a2" }, { "Vendor": "0x1002", "Device": "0x67a8" }, { "Vendor": "0x1002", "Device": "0x67a9" }, { "Vendor": "0x1002", "Device": "0x67aa" }, { "Vendor": "0x1002", "Device": "0x67b0" }, { "Vendor": "0x1002", "Device": "0x67b1" }, { "Vendor": "0x1002", "Device": "0x67b8" }, { "Vendor": "0x1002", "Device": "0x67b9" }, { "Vendor": "0x1002", "Device": "0x67ba" }, { "Vendor": "0x1002", "Device": "0x67be" } ] }, { "Codename": "Kabini", "IDs": [ { "Vendor": "0x1002", "Device": "0x9830" }, { "Vendor": "0x1002", "Device": "0x9831" }, { "Vendor": "0x1002", "Device": "0x9832" }, { "Vendor": "0x1002", "Device": "0x9833" }, { "Vendor": "0x1002", "Device": "0x9834" }, { "Vendor": "0x1002", "Device": "0x9835" }, { "Vendor": "0x1002", "Device": "0x9836" }, { "Vendor": "0x1002", "Device": "0x9837" }, { "Vendor": "0x1002", "Device": "0x9838" }, { "Vendor": "0x1002", "Device": "0x9839" }, { "Vendor": "0x1002", "Device": "0x983a" }, { "Vendor": "0x1002", "Device": "0x983b" }, { "Vendor": "0x1002", "Device": "0x983c" }, { "Vendor": "0x1002", "Device": "0x983d" }, { "Vendor": "0x1002", "Device": "0x983e" }, { "Vendor": "0x1002", "Device": "0x983f" } ] }, { "Codename": "Mullins", "IDs": [ { "Vendor": "0x1002", "Device": "0x9850" }, { "Vendor": "0x1002", "Device": "0x9851" }, { "Vendor": "0x1002", "Device": "0x9852" }, { "Vendor": "0x1002", "Device": "0x9853" }, { "Vendor": "0x1002", "Device": "0x9854" }, { "Vendor": "0x1002", "Device": "0x9855" }, { "Vendor": "0x1002", "Device": "0x9856" }, { "Vendor": "0x1002", "Device": "0x9857" }, { "Vendor": "0x1002", "Device": "0x9858" }, { "Vendor": "0x1002", "Device": "0x9859" }, { "Vendor": "0x1002", "Device": "0x985a" }, { "Vendor": "0x1002", "Device": "0x985b" }, { "Vendor": "0x1002", "Device": "0x985c" }, { "Vendor": "0x1002", "Device": "0x985d" }, { "Vendor": "0x1002", "Device": "0x985e" }, { "Vendor": "0x1002", "Device": "0x985f" } ] }, { "Codename": "Topaz", "IDs": [ { "Vendor": "0x1002", "Device": "0x6900" }, { "Vendor": "0x1002", "Device": "0x6901" }, { "Vendor": "0x1002", "Device": "0x6902" }, { "Vendor": "0x1002", "Device": "0x6903" }, { "Vendor": "0x1002", "Device": "0x6907" } ] }, { "Codename": "Tonga", "IDs": [ { "Vendor": "0x1002", "Device": "0x6920" }, { "Vendor": "0x1002", "Device": "0x6921" }, { "Vendor": "0x1002", "Device": "0x6928" }, { "Vendor": "0x1002", "Device": "0x6929" }, { "Vendor": "0x1002", "Device": "0x692b" }, { "Vendor": "0x1002", "Device": "0x692f" }, { "Vendor": "0x1002", "Device": "0x6930" }, { "Vendor": "0x1002", "Device": "0x6938" }, { "Vendor": "0x1002", "Device": "0x6939" } ] }, { "Codename": "Fiji", "IDs": [ { "Vendor": "0x1002", "Device": "0x7300" }, { "Vendor": "0x1002", "Device": "0x730f" } ] }, { "Codename": "Carrizo", "IDs": [ { "Vendor": "0x1002", "Device": "0x9870" }, { "Vendor": "0x1002", "Device": "0x9874" }, { "Vendor": "0x1002", "Device": "0x9875" }, { "Vendor": "0x1002", "Device": "0x9876" }, { "Vendor": "0x1002", "Device": "0x9877" } ] }, { "Codename": "Stoney", "IDs": [{ "Vendor": "0x1002", "Device": "0x98e4" }] }, { "Codename": "Polaris 11", "IDs": [ { "Vendor": "0x1002", "Device": "0x67e0" }, { "Vendor": "0x1002", "Device": "0x67e3" }, { "Vendor": "0x1002", "Device": "0x67e8" }, { "Vendor": "0x1002", "Device": "0x67eb" }, { "Vendor": "0x1002", "Device": "0x67ef" }, { "Vendor": "0x1002", "Device": "0x67ff" }, { "Vendor": "0x1002", "Device": "0x67e1" }, { "Vendor": "0x1002", "Device": "0x67e7" }, { "Vendor": "0x1002", "Device": "0x67e9" } ] }, { "Codename": "Polaris 10", "IDs": [ { "Vendor": "0x1002", "Device": "0x67c0" }, { "Vendor": "0x1002", "Device": "0x67c1" }, { "Vendor": "0x1002", "Device": "0x67c2" }, { "Vendor": "0x1002", "Device": "0x67c4" }, { "Vendor": "0x1002", "Device": "0x67c7" }, { "Vendor": "0x1002", "Device": "0x67d0" }, { "Vendor": "0x1002", "Device": "0x67df" }, { "Vendor": "0x1002", "Device": "0x67c8" }, { "Vendor": "0x1002", "Device": "0x67c9" }, { "Vendor": "0x1002", "Device": "0x67ca" }, { "Vendor": "0x1002", "Device": "0x67cc" }, { "Vendor": "0x1002", "Device": "0x67cf" }, { "Vendor": "0x1002", "Device": "0x6fdf" } ] }, { "Codename": "Polaris 12", "IDs": [ { "Vendor": "0x1002", "Device": "0x6980" }, { "Vendor": "0x1002", "Device": "0x6981" }, { "Vendor": "0x1002", "Device": "0x6985" }, { "Vendor": "0x1002", "Device": "0x6986" }, { "Vendor": "0x1002", "Device": "0x6987" }, { "Vendor": "0x1002", "Device": "0x6995" }, { "Vendor": "0x1002", "Device": "0x6997" }, { "Vendor": "0x1002", "Device": "0x699f" } ] }, { "Codename": "Vegam", "IDs": [ { "Vendor": "0x1002", "Device": "0x694c" }, { "Vendor": "0x1002", "Device": "0x694e" }, { "Vendor": "0x1002", "Device": "0x694f" } ] }, { "Codename": "Vega 10", "IDs": [ { "Vendor": "0x1002", "Device": "0x6860" }, { "Vendor": "0x1002", "Device": "0x6861" }, { "Vendor": "0x1002", "Device": "0x6862" }, { "Vendor": "0x1002", "Device": "0x6863" }, { "Vendor": "0x1002", "Device": "0x6864" }, { "Vendor": "0x1002", "Device": "0x6867" }, { "Vendor": "0x1002", "Device": "0x6868" }, { "Vendor": "0x1002", "Device": "0x6869" }, { "Vendor": "0x1002", "Device": "0x686a" }, { "Vendor": "0x1002", "Device": "0x686b" }, { "Vendor": "0x1002", "Device": "0x686c" }, { "Vendor": "0x1002", "Device": "0x686d" }, { "Vendor": "0x1002", "Device": "0x686e" }, { "Vendor": "0x1002", "Device": "0x686f" }, { "Vendor": "0x1002", "Device": "0x687f" } ] }, { "Codename": "Vega 12", "IDs": [ { "Vendor": "0x1002", "Device": "0x69a0" }, { "Vendor": "0x1002", "Device": "0x69a1" }, { "Vendor": "0x1002", "Device": "0x69a2" }, { "Vendor": "0x1002", "Device": "0x69a3" }, { "Vendor": "0x1002", "Device": "0x69af" } ] }, { "Codename": "Vega 20", "IDs": [ { "Vendor": "0x1002", "Device": "0x66a0" }, { "Vendor": "0x1002", "Device": "0x66a1" }, { "Vendor": "0x1002", "Device": "0x66a2" }, { "Vendor": "0x1002", "Device": "0x66a3" }, { "Vendor": "0x1002", "Device": "0x66a4" }, { "Vendor": "0x1002", "Device": "0x66a7" }, { "Vendor": "0x1002", "Device": "0x66af" } ] }, { "Codename": "Raven", "IDs": [ { "Vendor": "0x1002", "Device": "0x15dd" }, { "Vendor": "0x1002", "Device": "0x15d8" } ] }, { "Codename": "Arcturus", "IDs": [ { "Vendor": "0x1002", "Device": "0x738c" }, { "Vendor": "0x1002", "Device": "0x7388" }, { "Vendor": "0x1002", "Device": "0x738e" }, { "Vendor": "0x1002", "Device": "0x7390" } ] }, { "Codename": "Navi 10", "IDs": [ { "Vendor": "0x1002", "Device": "0x7310" }, { "Vendor": "0x1002", "Device": "0x7312" }, { "Vendor": "0x1002", "Device": "0x7318" }, { "Vendor": "0x1002", "Device": "0x7319" }, { "Vendor": "0x1002", "Device": "0x731a" }, { "Vendor": "0x1002", "Device": "0x731b" }, { "Vendor": "0x1002", "Device": "0x731e" }, { "Vendor": "0x1002", "Device": "0x731f" } ] }, { "Codename": "Navi 14", "IDs": [ { "Vendor": "0x1002", "Device": "0x7340" }, { "Vendor": "0x1002", "Device": "0x7341" }, { "Vendor": "0x1002", "Device": "0x7347" }, { "Vendor": "0x1002", "Device": "0x734f" } ] }, { "Codename": "Renoir", "IDs": [ { "Vendor": "0x1002", "Device": "0x15e7" }, { "Vendor": "0x1002", "Device": "0x1636" }, { "Vendor": "0x1002", "Device": "0x1638" }, { "Vendor": "0x1002", "Device": "0x164c" } ] }, { "Codename": "Navi 12", "IDs": [ { "Vendor": "0x1002", "Device": "0x7360" }, { "Vendor": "0x1002", "Device": "0x7362" } ] }, { "Codename": "Sienna Cichlid", "IDs": [ { "Vendor": "0x1002", "Device": "0x73a0" }, { "Vendor": "0x1002", "Device": "0x73a1" }, { "Vendor": "0x1002", "Device": "0x73a2" }, { "Vendor": "0x1002", "Device": "0x73a3" }, { "Vendor": "0x1002", "Device": "0x73a5" }, { "Vendor": "0x1002", "Device": "0x73a8" }, { "Vendor": "0x1002", "Device": "0x73a9" }, { "Vendor": "0x1002", "Device": "0x73ab" }, { "Vendor": "0x1002", "Device": "0x73ac" }, { "Vendor": "0x1002", "Device": "0x73ad" }, { "Vendor": "0x1002", "Device": "0x73ae" }, { "Vendor": "0x1002", "Device": "0x73af" }, { "Vendor": "0x1002", "Device": "0x73bf" } ] }, { "Codename": "Vangogh", "IDs": [{ "Vendor": "0x1002", "Device": "0x163f" }] }, { "Codename": "Yellow Carp", "IDs": [ { "Vendor": "0x1002", "Device": "0x164d" }, { "Vendor": "0x1002", "Device": "0x1681" } ] }, { "Codename": "Navy Flounder", "IDs": [ { "Vendor": "0x1002", "Device": "0x73c0" }, { "Vendor": "0x1002", "Device": "0x73c1" }, { "Vendor": "0x1002", "Device": "0x73c3" }, { "Vendor": "0x1002", "Device": "0x73da" }, { "Vendor": "0x1002", "Device": "0x73db" }, { "Vendor": "0x1002", "Device": "0x73dc" }, { "Vendor": "0x1002", "Device": "0x73dd" }, { "Vendor": "0x1002", "Device": "0x73de" }, { "Vendor": "0x1002", "Device": "0x73df" } ] }, { "Codename": "Dimgrey Cavefish", "IDs": [ { "Vendor": "0x1002", "Device": "0x73e0" }, { "Vendor": "0x1002", "Device": "0x73e1" }, { "Vendor": "0x1002", "Device": "0x73e2" }, { "Vendor": "0x1002", "Device": "0x73e3" }, { "Vendor": "0x1002", "Device": "0x73e8" }, { "Vendor": "0x1002", "Device": "0x73e9" }, { "Vendor": "0x1002", "Device": "0x73ea" }, { "Vendor": "0x1002", "Device": "0x73eb" }, { "Vendor": "0x1002", "Device": "0x73ec" }, { "Vendor": "0x1002", "Device": "0x73ed" }, { "Vendor": "0x1002", "Device": "0x73ef" }, { "Vendor": "0x1002", "Device": "0x73ff" } ] }, { "Codename": "Aldebaran", "IDs": [ { "Vendor": "0x1002", "Device": "0x7408" }, { "Vendor": "0x1002", "Device": "0x740c" }, { "Vendor": "0x1002", "Device": "0x740f" }, { "Vendor": "0x1002", "Device": "0x7410" } ] }, { "Codename": "Cyan Skillfish", "IDs": [{ "Vendor": "0x1002", "Device": "0x13fe" }] }, { "Codename": "Beige Goby", "IDs": [ { "Vendor": "0x1002", "Device": "0x7420" }, { "Vendor": "0x1002", "Device": "0x7421" }, { "Vendor": "0x1002", "Device": "0x7422" }, { "Vendor": "0x1002", "Device": "0x7423" }, { "Vendor": "0x1002", "Device": "0x743f" } ] } ]
35.785714
80
0.464424
1,332
17,034
5.939189
0.262012
0.458096
0.687144
0.095563
0.017444
0
0
0
0
0
0
0.226346
0.259775
17,034
475
81
35.861053
0.401063
0
0
0.069474
0
0
0.465129
0
0
0
0.212751
0
0
1
0
false
0
0
0
0
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
50cd249da987fda060ca3038006586cdd72cce4f
231
py
Python
scapy_funcs/scapypayload_joinall.py
SecTraversl/Toolbox_Python_3.8
0ad1d92d3a12225ea60e4eef3f263aecfffd1b65
[ "MIT" ]
null
null
null
scapy_funcs/scapypayload_joinall.py
SecTraversl/Toolbox_Python_3.8
0ad1d92d3a12225ea60e4eef3f263aecfffd1b65
[ "MIT" ]
null
null
null
scapy_funcs/scapypayload_joinall.py
SecTraversl/Toolbox_Python_3.8
0ad1d92d3a12225ea60e4eef3f263aecfffd1b65
[ "MIT" ]
null
null
null
# %% ####################################### def scapypayload_joinall(packet_list: scapy.plist.PacketList): allpayloads_onestring = b''.join([ p.load for p in packet_list if p.haslayer(Raw) ]) return allpayloads_onestring
33
88
0.619048
26
231
5.307692
0.769231
0.144928
0
0
0
0
0
0
0
0
0
0
0.121212
231
6
89
38.5
0.679803
0.008658
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
0fc1397f744ddcb10bd44fbf2ea052714a5c2d2c
598
py
Python
core/solver.py
ldacosta/shopping-optimization
469d41db064d93b80e5fdc15ffea12565f994a12
[ "MIT" ]
null
null
null
core/solver.py
ldacosta/shopping-optimization
469d41db064d93b80e5fdc15ffea12565f994a12
[ "MIT" ]
null
null
null
core/solver.py
ldacosta/shopping-optimization
469d41db064d93b80e5fdc15ffea12565f994a12
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """Template for Solver. Example: Attributes: Todo: * Nothing for now. .. _Google Python Style Guide: http://google.github.io/styleguide/pyguide.html """ import abc import collections from typing import Set from core.constraint import Constraint Solution = collections.namedtuple('Solution', 'place items') class Solver(abc.ABC): def __init__(self): pass def recommend(self, constraints: Set[Constraint]) -> Set[Solution]: """Issues recommendations given constraints.""" raise RuntimeError("Abstract class, not callable.")
17.588235
71
0.692308
68
598
6.014706
0.705882
0
0
0
0
0
0
0
0
0
0
0.002053
0.185619
598
33
72
18.121212
0.837782
0.369565
0
0
0
0
0.132597
0
0
0
0
0.030303
0
1
0.2
false
0.1
0.4
0
0.7
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
1
1
0
1
0
0
4
0fc2a12423dfb22b35a565c8c76a933549fa244d
129
py
Python
igcommit/__init__.py
hasegeli/igcommit
7328c185b83c6d92f75accad339c6feab4850ea5
[ "MIT" ]
null
null
null
igcommit/__init__.py
hasegeli/igcommit
7328c185b83c6d92f75accad339c6feab4850ea5
[ "MIT" ]
null
null
null
igcommit/__init__.py
hasegeli/igcommit
7328c185b83c6d92f75accad339c6feab4850ea5
[ "MIT" ]
null
null
null
"""igcommit - The main module Copyright (c) 2021 InnoGames GmbH Portions Copyright (c) 2021 Emre Hasegeli """ VERSION = (3, 1)
16.125
41
0.705426
18
129
5.055556
0.833333
0.21978
0.307692
0
0
0
0
0
0
0
0
0.09434
0.178295
129
7
42
18.428571
0.764151
0.79845
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
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
0fc82f0b7955a25fb8de9c6bdf4834f0f9925394
276
py
Python
server/books/models.py
zubeir68/my-library
a24b8daa12b7a0bc682460709606c732dc35d1aa
[ "MIT" ]
null
null
null
server/books/models.py
zubeir68/my-library
a24b8daa12b7a0bc682460709606c732dc35d1aa
[ "MIT" ]
null
null
null
server/books/models.py
zubeir68/my-library
a24b8daa12b7a0bc682460709606c732dc35d1aa
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models # Create your models here. class Book(models.Model): title = models.CharField(max_length=500) author = models.CharField(max_length=100) description = models.TextField()
25.090909
45
0.735507
36
276
5.444444
0.722222
0.153061
0.183673
0.244898
0
0
0
0
0
0
0
0.030043
0.155797
276
11
46
25.090909
0.811159
0.166667
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
0ffdeabf459a4ffa597743af03248c15963b58ba
342
py
Python
poke/poke_model.py
Rozkipz/pokemonian
769f5ebe5c3d27aa7a608852d32c9a35e16e61aa
[ "MIT" ]
null
null
null
poke/poke_model.py
Rozkipz/pokemonian
769f5ebe5c3d27aa7a608852d32c9a35e16e61aa
[ "MIT" ]
null
null
null
poke/poke_model.py
Rozkipz/pokemonian
769f5ebe5c3d27aa7a608852d32c9a35e16e61aa
[ "MIT" ]
null
null
null
from typing import Optional from sqlmodel import SQLModel, Field class pokemon(SQLModel, table=True): id: int = Field(primary_key=True, nullable=False) name: str = Field(nullable=False) url: str = Field(nullable=False) weight: Optional[int] = Field() height: Optional[int] = Field() speed: Optional[int] = Field()
24.428571
53
0.690058
44
342
5.340909
0.5
0.13617
0.204255
0.178723
0
0
0
0
0
0
0
0
0.190058
342
13
54
26.307692
0.848375
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.222222
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
4
ba260b6fb9fe82e326326b9aba40c9b846308e34
396
py
Python
topnav_capo2/scripts/camera/interface_camera.py
kasptom/topnav_ros_kasptom
9e7cd97ac0f5f22544880d71bcc91c9db4de528a
[ "Apache-2.0" ]
null
null
null
topnav_capo2/scripts/camera/interface_camera.py
kasptom/topnav_ros_kasptom
9e7cd97ac0f5f22544880d71bcc91c9db4de528a
[ "Apache-2.0" ]
null
null
null
topnav_capo2/scripts/camera/interface_camera.py
kasptom/topnav_ros_kasptom
9e7cd97ac0f5f22544880d71bcc91c9db4de528a
[ "Apache-2.0" ]
null
null
null
from abc import ABCMeta, abstractmethod class ICamera: __metaclass__ = ABCMeta @abstractmethod def open(self): raise NotImplementedError @abstractmethod def is_opened(self): raise NotImplementedError @abstractmethod def close(self): raise NotImplementedError @abstractmethod def get_frame(self): raise NotImplementedError
18
39
0.689394
35
396
7.628571
0.514286
0.254682
0.419476
0.47191
0.505618
0
0
0
0
0
0
0
0.262626
396
21
40
18.857143
0.914384
0
0
0.533333
0
0
0
0
0
0
0
0
0
1
0.266667
false
0
0.066667
0
0.466667
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
1
0
0
0
0
0
0
0
4
e84887c34be71f8d85217c64522cc20bb63cc1f4
139
py
Python
tools/registry.py
pancetta/python-hpc-performance
fc4c0fcd87d5a0fde78a0d6f284d1c89a31fbb03
[ "BSD-2-Clause" ]
1
2020-10-29T06:04:43.000Z
2020-10-29T06:04:43.000Z
tools/registry.py
pancetta/python-performance
fc4c0fcd87d5a0fde78a0d6f284d1c89a31fbb03
[ "BSD-2-Clause" ]
null
null
null
tools/registry.py
pancetta/python-performance
fc4c0fcd87d5a0fde78a0d6f284d1c89a31fbb03
[ "BSD-2-Clause" ]
null
null
null
registry = [] def register(cls, bench_type=None, bench_params=None): registry.append((cls, bench_type, bench_params)) return cls
19.857143
54
0.719424
19
139
5.052632
0.526316
0.166667
0.25
0
0
0
0
0
0
0
0
0
0.158273
139
6
55
23.166667
0.820513
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0
0
0.5
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
e86610a8c7e7e487aad3efa9b7c6c0b388eab94d
213
py
Python
aerofs/api/creds.py
mpillar/aerofs-python-sdk
c6c23869db82d5065d956b53bf26e0de8c2caff6
[ "MIT" ]
1
2018-04-27T09:16:41.000Z
2018-04-27T09:16:41.000Z
aerofs/api/creds.py
mpillar/aerofs-sdk-python
c6c23869db82d5065d956b53bf26e0de8c2caff6
[ "MIT" ]
null
null
null
aerofs/api/creds.py
mpillar/aerofs-sdk-python
c6c23869db82d5065d956b53bf26e0de8c2caff6
[ "MIT" ]
null
null
null
class AppCredentials(object): def __init__(self, client_id, client_secret, redirect_uri): self.client_id = client_id self.client_secret = client_secret self.redirect_uri = redirect_uri
35.5
63
0.723005
27
213
5.222222
0.407407
0.212766
0.170213
0.255319
0
0
0
0
0
0
0
0
0.206573
213
5
64
42.6
0.83432
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0
0.4
0
1
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
e882e682e9a2b404fb695eea79d709fc7d7ab497
103
py
Python
wsgi.py
KMoszczyc/Sentiment-Predictor-Deep-L
86535a66d03197f61ce128b8cd10645efbc74b70
[ "MIT" ]
1
2021-07-23T02:26:16.000Z
2021-07-23T02:26:16.000Z
wsgi.py
KMoszczyc/Sentiment-Predictor-Deep-L
86535a66d03197f61ce128b8cd10645efbc74b70
[ "MIT" ]
null
null
null
wsgi.py
KMoszczyc/Sentiment-Predictor-Deep-L
86535a66d03197f61ce128b8cd10645efbc74b70
[ "MIT" ]
null
null
null
from api import app from content import train if __name__ == "__main__": app.run() # train()
12.875
26
0.650485
14
103
4.214286
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.242718
103
7
27
14.714286
0.75641
0.067961
0
0
0
0
0.085106
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
e88ad244ddb3d77cb605fbd8bc535f158cd0d69e
99
py
Python
tests/basic/test_basic.py
Darless/GLockManager
efac37a7ef87e48a19d6aa89f1e48dd836ce6761
[ "Apache-2.0" ]
2
2017-03-02T08:50:43.000Z
2017-10-30T15:38:58.000Z
tests/basic/test_basic.py
Darless/GLockManager
efac37a7ef87e48a19d6aa89f1e48dd836ce6761
[ "Apache-2.0" ]
3
2017-01-03T14:36:30.000Z
2017-10-13T13:57:45.000Z
tests/basic/test_basic.py
Darless/GLockManager
efac37a7ef87e48a19d6aa89f1e48dd836ce6761
[ "Apache-2.0" ]
null
null
null
import os import subprocess import shlex def test_basic(utils): utils.compile_and_run(__file__)
14.142857
33
0.818182
15
99
4.933333
0.8
0
0
0
0
0
0
0
0
0
0
0
0.121212
99
6
34
16.5
0.850575
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.6
0
0.8
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
e8b7e753755801e59634ec61fa0e7b1476b67876
265
py
Python
examples/mixins.py
jeromelebleu/django-cruditor
da3c9be402ff87014d82ecc9c5abdf68693da4db
[ "MIT" ]
10
2016-04-19T11:12:27.000Z
2020-10-09T04:12:02.000Z
examples/mixins.py
jeromelebleu/django-cruditor
da3c9be402ff87014d82ecc9c5abdf68693da4db
[ "MIT" ]
26
2018-04-25T12:02:13.000Z
2022-02-10T15:26:07.000Z
examples/mixins.py
jeromelebleu/django-cruditor
da3c9be402ff87014d82ecc9c5abdf68693da4db
[ "MIT" ]
3
2019-02-28T14:32:26.000Z
2020-06-08T11:06:25.000Z
from django.urls import reverse_lazy class ExamplesMixin: menu_title = 'Examples Demo' menu_template_name = 'menu.html' index_url = reverse_lazy('home') logout_url = reverse_lazy('logout') change_password_url = reverse_lazy('change-password')
26.5
57
0.739623
34
265
5.441176
0.617647
0.237838
0.227027
0
0
0
0
0
0
0
0
0
0.166038
265
9
58
29.444444
0.837104
0
0
0
0
0
0.177358
0
0
0
0
0
0
1
0
false
0.142857
0.142857
0
1
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
e8ba9a99ca69c1d3b8747e38686e40c6697547ba
429
py
Python
lang/py/cookbook/v2/source/cb2_6_5_exm_1.py
ch1huizong/learning
632267634a9fd84a5f5116de09ff1e2681a6cc85
[ "MIT" ]
null
null
null
lang/py/cookbook/v2/source/cb2_6_5_exm_1.py
ch1huizong/learning
632267634a9fd84a5f5116de09ff1e2681a6cc85
[ "MIT" ]
null
null
null
lang/py/cookbook/v2/source/cb2_6_5_exm_1.py
ch1huizong/learning
632267634a9fd84a5f5116de09ff1e2681a6cc85
[ "MIT" ]
null
null
null
class Pricing(object): def __init__(self, location, event): self.location = location self.event = event def setlocation(self, location): self.location = location def getprice(self): return self.location.getprice() def getquantity(self): return self.location.getquantity() def getdiscount(self): return self.event.getdiscount() ## and many more such methods
30.642857
42
0.652681
47
429
5.87234
0.382979
0.26087
0.152174
0.15942
0
0
0
0
0
0
0
0
0.251748
429
13
43
33
0.859813
0.060606
0
0.166667
0
0
0
0
0
0
0
0
0
1
0.416667
false
0
0
0.25
0.75
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
2cf9c69a58b2d8f839242403e7b68a76edb34ebd
25
py
Python
slack_token.py
cpieri/api_slack
130c88268c255fbae9feeb3f4300cb305b6dfe6c
[ "MIT" ]
null
null
null
slack_token.py
cpieri/api_slack
130c88268c255fbae9feeb3f4300cb305b6dfe6c
[ "MIT" ]
null
null
null
slack_token.py
cpieri/api_slack
130c88268c255fbae9feeb3f4300cb305b6dfe6c
[ "MIT" ]
null
null
null
token='Your Token Slack'
12.5
24
0.76
4
25
4.75
0.75
0
0
0
0
0
0
0
0
0
0
0
0.12
25
1
25
25
0.863636
0
0
0
0
0
0.64
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
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
2cfb8a9e6c36a1c557b03fb7463c8e214fbe1449
92
py
Python
2014/09/table-state-debt-protections/graphic_config.py
nprapps/graphics-archive
97b0ef326b46a959df930f5522d325e537f7a655
[ "FSFAP" ]
14
2015-05-08T13:41:51.000Z
2021-02-24T12:34:55.000Z
2014/09/table-state-debt-protections/graphic_config.py
nprapps/graphics-archive
97b0ef326b46a959df930f5522d325e537f7a655
[ "FSFAP" ]
null
null
null
2014/09/table-state-debt-protections/graphic_config.py
nprapps/graphics-archive
97b0ef326b46a959df930f5522d325e537f7a655
[ "FSFAP" ]
7
2015-04-04T04:45:54.000Z
2021-02-18T11:12:48.000Z
#!/usr/bin/env python COPY_GOOGLE_DOC_KEY = '1UfWWQPek40kyjAu13zIbNkvUjUxsyDHw-xvFAZZjsLA'
23
68
0.836957
10
92
7.4
1
0
0
0
0
0
0
0
0
0
0
0.05814
0.065217
92
3
69
30.666667
0.802326
0.217391
0
0
0
0
0.619718
0.619718
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
fa110332a9944ff799cafcb65060e1eecf9c1f97
798
py
Python
__init__.py
brando90/predicting_performance
a6b13cb869c04fc5415893bcf7a3fb2c6179f953
[ "MIT" ]
null
null
null
__init__.py
brando90/predicting_performance
a6b13cb869c04fc5415893bcf7a3fb2c6179f953
[ "MIT" ]
1
2021-12-09T21:46:06.000Z
2021-12-09T21:46:06.000Z
__init__.py
brando90/predicting_performance
a6b13cb869c04fc5415893bcf7a3fb2c6179f953
[ "MIT" ]
null
null
null
# helps users of project/pkg from knowning the internal structure of modules # easier to use funcs in all modules # following line imports (i.e. similar to copying the code) from the declared packages # https://github.com/brando90/hbf_tensorflow_code/tree/master/my_tf_proj # from predicting_performance.data_processor import * # from predicting_performance.model_data_gen import * # # from predicting_performance.metrics import * # # from predicting_performance.stats_collector import * # from predicting_performance.trainer import * # from predicting_performance.data_loader_cifar import * #having the package name declared #from pkg_1.module2 import * #from pkg_1.module1 import f1 as superduperf1 # 2 options to import # (1) from pkg_1.module1 import f1 # (2) from pkg_1 import superduperf1
36.272727
86
0.805764
116
798
5.37069
0.534483
0.134831
0.24077
0.248796
0.073836
0.073836
0
0
0
0
0
0.023022
0.129073
798
21
87
38
0.873381
0.949875
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
fa2160f2037b4b8135b97b69e5ef6c88c088f987
43
py
Python
pywork/py4.py
infinityman8/pythonwork-uni
8ba7f341573f3031710d1bf4d91849508aa81bf8
[ "MIT" ]
null
null
null
pywork/py4.py
infinityman8/pythonwork-uni
8ba7f341573f3031710d1bf4d91849508aa81bf8
[ "MIT" ]
null
null
null
pywork/py4.py
infinityman8/pythonwork-uni
8ba7f341573f3031710d1bf4d91849508aa81bf8
[ "MIT" ]
null
null
null
x=2 print(x"squared is x*x) Xcubed=x**3
10.75
24
0.627907
11
43
2.454545
0.636364
0
0
0
0
0
0
0
0
0
0
0.057143
0.186047
43
3
25
14.333333
0.714286
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
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
1
0
0
0
0
0
0
0
0
4
fa32551092c62e6397340262551c19ec6352f623
584
py
Python
ch03/ch03_02/ch03_02.py
z2x3c4v5bz/pybook_yehnan
3c7f8124ac49f4abe2682f2a01835af3c3759132
[ "MIT" ]
null
null
null
ch03/ch03_02/ch03_02.py
z2x3c4v5bz/pybook_yehnan
3c7f8124ac49f4abe2682f2a01835af3c3759132
[ "MIT" ]
null
null
null
ch03/ch03_02/ch03_02.py
z2x3c4v5bz/pybook_yehnan
3c7f8124ac49f4abe2682f2a01835af3c3759132
[ "MIT" ]
null
null
null
def change_data(x): if x < 0 or x >255: return None elif 200 <= x <=255: return int(round((x - 200) * 3 / 11.0 + 85, 0)) elif 0 <= x <=130: return int(round(x * 6 / 13.0, 0)) else: return int(round((x - 131) * 23 / 68.0 + 61, 0)) if __name__ == '__main__': print('-1 => ' + str(change_data(-1))) print('0 => ' + str(change_data(0))) print('55 => ' + str(change_data(55))) print('131 => ' + str(change_data(131))) print('255 => ' + str(change_data(255))) ''' -1 => None 0 => 0 55 => 25 131 => 61 255 => 100 '''
20.137931
56
0.488014
92
584
2.945652
0.358696
0.221402
0.239852
0.166052
0
0
0
0
0
0
0
0.188862
0.292808
584
28
57
20.857143
0.467312
0
0
0
0
0
0.074004
0
0
0
0
0
0
1
0.066667
false
0
0
0
0.333333
0.333333
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
fa40aa95de1c4f3b0c843d5644804c9f9f1af8d0
284
py
Python
src/fwinterconnect-gen/interconnect_templ.py
Featherweight-IP/fwinterconnect-gen
8626202cb8e0681de8796d4d8c2445487e028825
[ "Apache-2.0" ]
3
2019-03-02T08:55:09.000Z
2022-03-01T07:20:45.000Z
src/fwinterconnect-gen/interconnect_templ.py
Featherweight-IP/fwinterconnect-gen
8626202cb8e0681de8796d4d8c2445487e028825
[ "Apache-2.0" ]
null
null
null
src/fwinterconnect-gen/interconnect_templ.py
Featherweight-IP/fwinterconnect-gen
8626202cb8e0681de8796d4d8c2445487e028825
[ "Apache-2.0" ]
null
null
null
template = """ /**************************************************************************** * ${name}.sv ****************************************************************************/ module ${name}( ${ports} ); ${wires} ${port_wire_assignments} ${interconnects} endmodule """
15.777778
78
0.271127
12
284
6.25
0.916667
0
0
0
0
0
0
0
0
0
0
0
0.080986
284
17
79
16.705882
0.287356
0
0
0
0
0
0.936396
0.628975
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
0
0
0
1
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
fa4aca0cde876a0937fc8b346cf174d92ebfd1e6
224
py
Python
main/admin.py
Tony-MK/Healthy
bec2a1f917bc3d79e9315d30073ea62bdab34f3b
[ "Apache-2.0" ]
null
null
null
main/admin.py
Tony-MK/Healthy
bec2a1f917bc3d79e9315d30073ea62bdab34f3b
[ "Apache-2.0" ]
null
null
null
main/admin.py
Tony-MK/Healthy
bec2a1f917bc3d79e9315d30073ea62bdab34f3b
[ "Apache-2.0" ]
null
null
null
from django.contrib import admin # Register your models here. from .models import * # User Types admin.site.register(Parent); admin.site.register(CareTaker); #admin.site.register(Child); admin.site.register(Gig);
11.2
32
0.741071
30
224
5.533333
0.533333
0.216867
0.409639
0
0
0
0
0
0
0
0
0
0.138393
224
19
33
11.789474
0.860104
0.285714
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.4
0
0.4
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
fa676c224f0392b319109e12f9d35a147cc02333
115
py
Python
imdb/__init__.py
iterait/cxflow-examples
e1c8e5a5e0cfe3abe92971748ac7f2c2a3673823
[ "MIT" ]
null
null
null
imdb/__init__.py
iterait/cxflow-examples
e1c8e5a5e0cfe3abe92971748ac7f2c2a3673823
[ "MIT" ]
3
2019-09-06T11:37:18.000Z
2019-09-10T11:01:07.000Z
imdb/__init__.py
iterait/emloop-examples
e1c8e5a5e0cfe3abe92971748ac7f2c2a3673823
[ "MIT" ]
null
null
null
from .gru_net import SimpleGRU from .imdb_prediction_hook import IMDBPredict from .imdb_dataset import IMDBDataset
28.75
45
0.869565
16
115
6
0.6875
0.166667
0
0
0
0
0
0
0
0
0
0
0.104348
115
3
46
38.333333
0.932039
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
fa6dc1b30628cefd6ac995e622fe17afb9fcf10b
80
py
Python
us_holidays.py
hibatt/toggl_month
6cbf30aa2c76d09a21f582d30ca3947701f0c4f5
[ "MIT" ]
null
null
null
us_holidays.py
hibatt/toggl_month
6cbf30aa2c76d09a21f582d30ca3947701f0c4f5
[ "MIT" ]
null
null
null
us_holidays.py
hibatt/toggl_month
6cbf30aa2c76d09a21f582d30ca3947701f0c4f5
[ "MIT" ]
null
null
null
from datetime import date import holidays us_holidays = holidays.UnitedStates()
20
37
0.8375
10
80
6.6
0.7
0
0
0
0
0
0
0
0
0
0
0
0.1125
80
4
37
20
0.929577
0
0
0
0
0
0
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
d7036bd14a694411d0ca1932e1f6d0c35b0d35d6
151
py
Python
tests/conftest.py
wuuuduu/django-getpaid
d864de53bc947e2d1ab4f2d3879a803cab1216d3
[ "MIT" ]
6
2020-05-26T08:49:10.000Z
2022-01-03T17:44:19.000Z
tests/conftest.py
wuuuduu/django-getpaid
d864de53bc947e2d1ab4f2d3879a803cab1216d3
[ "MIT" ]
null
null
null
tests/conftest.py
wuuuduu/django-getpaid
d864de53bc947e2d1ab4f2d3879a803cab1216d3
[ "MIT" ]
1
2021-08-23T06:59:05.000Z
2021-08-23T06:59:05.000Z
from pytest_factoryboy import register from .factories import OrderFactory, PaywallEntryFactory register(OrderFactory) register(PaywallEntryFactory)
21.571429
56
0.874172
14
151
9.357143
0.571429
0
0
0
0
0
0
0
0
0
0
0
0.086093
151
6
57
25.166667
0.949275
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
d71b9a48043614e39283821a4c7ca11f90155c9a
276
py
Python
resources/routes.py
juliosarango/fastapi_app
6515d5a149a845175e6c679a26fdf72a87266e2e
[ "MIT" ]
null
null
null
resources/routes.py
juliosarango/fastapi_app
6515d5a149a845175e6c679a26fdf72a87266e2e
[ "MIT" ]
null
null
null
resources/routes.py
juliosarango/fastapi_app
6515d5a149a845175e6c679a26fdf72a87266e2e
[ "MIT" ]
null
null
null
import imp from fastapi import APIRouter from resources import auth from resources import complaint from resources import user api_router = APIRouter() api_router.include_router(auth.router) api_router.include_router(complaint.router) api_router.include_router(user.router)
23
43
0.851449
39
276
5.846154
0.307692
0.157895
0.25
0.289474
0.245614
0
0
0
0
0
0
0
0.094203
276
11
44
25.090909
0.912
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.555556
0
0.555556
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
d7207064a41a2108346d799b2fc78f965c0b9196
143
py
Python
search/resources.py
nexuszix/propm
8640c88d6c97a69c41e489e98c479c5eb0f81a18
[ "BSD-2-Clause" ]
null
null
null
search/resources.py
nexuszix/propm
8640c88d6c97a69c41e489e98c479c5eb0f81a18
[ "BSD-2-Clause" ]
null
null
null
search/resources.py
nexuszix/propm
8640c88d6c97a69c41e489e98c479c5eb0f81a18
[ "BSD-2-Clause" ]
null
null
null
from import_export import resources from .models import Land class LandResource(resources.ModelResource): class Meta: model = Land
23.833333
44
0.762238
17
143
6.352941
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.188811
143
6
45
23.833333
0.931034
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
0
0.8
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
d7358f86666025f45ee48a935fdd9175a20a6ecc
169
py
Python
falkon/models/__init__.py
mohamad-amin/falkon
581c761b4a4cb7bf6a299613700db8414c419a52
[ "MIT" ]
130
2020-06-18T08:30:30.000Z
2022-03-21T15:43:17.000Z
falkon/models/__init__.py
mohamad-amin/falkon
581c761b4a4cb7bf6a299613700db8414c419a52
[ "MIT" ]
32
2020-06-26T09:24:45.000Z
2022-03-20T10:37:36.000Z
falkon/models/__init__.py
mohamad-amin/falkon
581c761b4a4cb7bf6a299613700db8414c419a52
[ "MIT" ]
17
2020-07-13T17:28:02.000Z
2022-02-15T19:55:40.000Z
from .falkon import Falkon from .logistic_falkon import LogisticFalkon from .incore_falkon import InCoreFalkon __all__ = ("Falkon", "LogisticFalkon", "InCoreFalkon", )
28.166667
56
0.798817
18
169
7.166667
0.444444
0.27907
0
0
0
0
0
0
0
0
0
0
0.112426
169
5
57
33.8
0.86
0
0
0
0
0
0.189349
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
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
d74956cb14d6e8d24325d90a4bfe9feb24a08089
446
py
Python
icbd/type_analyzer/tests/imports2.py
kmod/icbd
9636564eb3993afa07c6220d589bbd1991923d74
[ "MIT" ]
7
2015-04-06T15:17:13.000Z
2020-10-21T04:57:00.000Z
icbd/type_analyzer/tests/imports2.py
kmod/icbd
9636564eb3993afa07c6220d589bbd1991923d74
[ "MIT" ]
null
null
null
icbd/type_analyzer/tests/imports2.py
kmod/icbd
9636564eb3993afa07c6220d589bbd1991923d74
[ "MIT" ]
4
2016-05-16T17:53:08.000Z
2020-11-28T17:18:50.000Z
from import_test import dup dup # 0 <int|module 'dup'> from import_test import g # packages hide modules with the same name: g.xg # 0 module 'g' # 2 str from import_test.f import dup1, dup2, e1, e2, xg dup1 # 0 <int|module 'dup'> dup2 # 0 module 'dup' e1 # 0 module 'e' e2 # 0 module 'e' xg # 0 str from import_test import a a # 0 module 'a' import import_test import_test.a # 12 module 'a' from . import sys # e 0 from .os import path # e 0
20.272727
48
0.686099
88
446
3.409091
0.329545
0.2
0.186667
0.2
0
0
0
0
0
0
0
0.059829
0.213004
446
21
49
21.238095
0.794872
0.414798
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
d75dd43cfdd3ba6022c32c843d75037567f01b99
184
py
Python
oshot/utils.py
daonb/okqa
3babf225911294dec1249472a9a3f6141fa7d6a7
[ "BSD-3-Clause" ]
null
null
null
oshot/utils.py
daonb/okqa
3babf225911294dec1249472a9a3f6141fa7d6a7
[ "BSD-3-Clause" ]
null
null
null
oshot/utils.py
daonb/okqa
3babf225911294dec1249472a9a3f6141fa7d6a7
[ "BSD-3-Clause" ]
null
null
null
from django.conf import settings from django.contrib.sites.models import Site def get_root_url(): site = Site.objects.get(pk=settings.SITE_ID) return 'http://' + site.domain
23
48
0.73913
28
184
4.75
0.678571
0.150376
0
0
0
0
0
0
0
0
0
0
0.146739
184
7
49
26.285714
0.847134
0
0
0
0
0
0.038251
0
0
0
0
0
0
1
0.2
false
0
0.4
0
0.8
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
d76d7b32bc4e9e1540d71de2c91346160a6548f8
167
py
Python
Deploying your ML Model/WebProject1/make_request.py
ChadderboxS/Tutorials
e5ff1c7cdd6c86c3253128f3c79bb9a606b1fffa
[ "MIT" ]
null
null
null
Deploying your ML Model/WebProject1/make_request.py
ChadderboxS/Tutorials
e5ff1c7cdd6c86c3253128f3c79bb9a606b1fffa
[ "MIT" ]
null
null
null
Deploying your ML Model/WebProject1/make_request.py
ChadderboxS/Tutorials
e5ff1c7cdd6c86c3253128f3c79bb9a606b1fffa
[ "MIT" ]
null
null
null
import requests url = 'http://localhost:3000/predict' r = requests.post(url,json={'text': '-475 60 8 6221.92 6178.23 0.530438 0.336245 2238.601188'}) print(r.json())
27.833333
95
0.700599
29
167
4.034483
0.827586
0
0
0
0
0
0
0
0
0
0
0.308725
0.107784
167
6
96
27.833333
0.47651
0
0
0
0
0
0.52381
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
1
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
ad0cea5696707c7ebd4394361a9d552d9fa606fc
90
py
Python
experimental/test2.py
solkwonstat/stat_hami
9aff8d5ade5e955ba21d3e5489fe916f0444fdbb
[ "MIT" ]
null
null
null
experimental/test2.py
solkwonstat/stat_hami
9aff8d5ade5e955ba21d3e5489fe916f0444fdbb
[ "MIT" ]
1
2022-02-14T07:21:29.000Z
2022-02-14T07:21:29.000Z
experimental/test2.py
solkwonstat/stat_hami
9aff8d5ade5e955ba21d3e5489fe916f0444fdbb
[ "MIT" ]
null
null
null
import time if __name__ == "__main__": print("Current time is %s", int(time.time()))
18
49
0.644444
13
90
3.846154
0.769231
0
0
0
0
0
0
0
0
0
0
0
0.177778
90
4
50
22.5
0.675676
0
0
0
0
0
0.288889
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
ad2771767de0784ed9c62d263ecb822b8c939946
77
py
Python
modules/auth/exceptions/auth_status_error.py
stevekineeve88/doubloon
4c7c9163e96877ad23663c3dd9a73ef6ccde3e22
[ "MIT" ]
null
null
null
modules/auth/exceptions/auth_status_error.py
stevekineeve88/doubloon
4c7c9163e96877ad23663c3dd9a73ef6ccde3e22
[ "MIT" ]
8
2021-01-29T15:49:17.000Z
2021-10-14T01:03:27.000Z
modules/auth/exceptions/auth_status_error.py
stevekineeve88/doubloon
4c7c9163e96877ad23663c3dd9a73ef6ccde3e22
[ "MIT" ]
null
null
null
class AuthStatusError(Exception): """ Auth status error """ pass
15.4
33
0.623377
7
77
6.857143
1
0
0
0
0
0
0
0
0
0
0
0
0.25974
77
4
34
19.25
0.842105
0.220779
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
d13e1718e5682bf0899c40df2a52ed5761f6de06
209
py
Python
parflow/subset/data/__init__.py
arezaii/subsetter
482e90fdaeaa8fa5de7e325bdbe2f41206744524
[ "MIT" ]
1
2020-06-16T15:57:37.000Z
2020-06-16T15:57:37.000Z
parflow/subset/data/__init__.py
arezaii/subsetter
482e90fdaeaa8fa5de7e325bdbe2f41206744524
[ "MIT" ]
13
2020-08-21T02:24:39.000Z
2020-09-19T18:15:13.000Z
parflow/subset/data/__init__.py
arezaii/subsetter
482e90fdaeaa8fa5de7e325bdbe2f41206744524
[ "MIT" ]
null
null
null
"""Data files, templates, domain definitions""" from pathlib import Path conus_manifest = Path(__file__).parent / 'conus_manifest.yaml' parkinglot_template = Path(__file__).parent / 'parking_lot_template.tcl'
41.8
72
0.794258
26
209
5.884615
0.730769
0.169935
0.183007
0
0
0
0
0
0
0
0
0
0.090909
209
5
72
41.8
0.805263
0.196172
0
0
0
0
0.263804
0.147239
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
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
d146a0f435227dfa0ab6a02b9c243edc8e816a61
209
py
Python
dashboard/core/admin.py
Aditya-0912/recon
6e310cdd56caf678af54c27f2c3c97f56fb08119
[ "MIT" ]
9
2019-11-13T18:05:51.000Z
2021-05-05T16:04:35.000Z
dashboard/core/admin.py
Aditya-0912/recon
6e310cdd56caf678af54c27f2c3c97f56fb08119
[ "MIT" ]
9
2019-12-04T23:50:52.000Z
2022-02-10T12:02:50.000Z
dashboard/core/admin.py
Aditya-0912/recon
6e310cdd56caf678af54c27f2c3c97f56fb08119
[ "MIT" ]
7
2020-04-19T17:34:58.000Z
2021-12-25T22:09:33.000Z
from django.contrib import admin from .models import Employee class EmployeeAdmin(admin.ModelAdmin): list_display = [f.name for f in Employee._meta.fields] admin.site.register(Employee, EmployeeAdmin)
20.9
58
0.789474
28
209
5.821429
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.129187
209
9
59
23.222222
0.895604
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
0
0.8
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
d14cab78b654642c622e7b3761cb2e6c7712db18
651
py
Python
txpipe/utils/__init__.py
Lhior/TXPipe
58fd7612326779d4c1b0e499157dddc9e3b524c0
[ "BSD-3-Clause" ]
9
2018-03-17T02:07:52.000Z
2022-02-23T20:25:48.000Z
txpipe/utils/__init__.py
Lhior/TXPipe
58fd7612326779d4c1b0e499157dddc9e3b524c0
[ "BSD-3-Clause" ]
162
2018-03-06T16:18:23.000Z
2022-03-21T18:11:37.000Z
txpipe/utils/__init__.py
Lhior/TXPipe
58fd7612326779d4c1b0e499157dddc9e3b524c0
[ "BSD-3-Clause" ]
7
2018-07-26T11:49:46.000Z
2022-02-23T22:14:48.000Z
from .pixel_schemes import choose_pixelization, HealpixScheme, GnomonicPixelScheme from .number_density_stats import SourceNumberDensityStats, LensNumberDensityStats from .misc import array_hash, unique_list, hex_escape, rename_iterated from .healpix import dilated_healpix_map from .splitters import Splitter, DynamicSplitter from .calibrators import Calibrator, NullCalibrator, MetaCalibrator, LensfitCalibrator, HSCCalibrator from .splitters import Splitter, DynamicSplitter from .calibration_tools import read_shear_catalog_type, band_variants, metacal_variants from .calibration_tools import MetacalCalculator, LensfitCalculator, MeanShearInBins
65.1
101
0.88172
69
651
8.072464
0.666667
0.046679
0.068223
0.096948
0.165171
0.165171
0
0
0
0
0
0
0.079877
651
9
102
72.333333
0.929883
0
0
0.222222
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
0f1d2b109ca06b249871040946a328fd531dac6a
182
py
Python
proyectos/2/RomeroVicente/VpostHorde/core/console.py
EnriqueGuerreroL/sistop-2019-2
b02fa557bb8869457fadd7961532834f265f0400
[ "CC-BY-4.0" ]
null
null
null
proyectos/2/RomeroVicente/VpostHorde/core/console.py
EnriqueGuerreroL/sistop-2019-2
b02fa557bb8869457fadd7961532834f265f0400
[ "CC-BY-4.0" ]
null
null
null
proyectos/2/RomeroVicente/VpostHorde/core/console.py
EnriqueGuerreroL/sistop-2019-2
b02fa557bb8869457fadd7961532834f265f0400
[ "CC-BY-4.0" ]
null
null
null
import argparse class Console: def __init__(self): self.parser = argparse.ArgumentParser() def evaluar_argumentos(self): print("evaluando argumentos")
20.222222
48
0.67033
18
182
6.5
0.722222
0
0
0
0
0
0
0
0
0
0
0
0.241758
182
8
49
22.75
0.847826
0
0
0
0
0
0.10989
0
0
0
0
0
0
1
0.333333
false
0
0.166667
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
1
0
0
0
0
1
0
0
4
0f68fee73eac52f83f099bd7ca1c279107cf2d2c
555
py
Python
fideslog/api/models/manifest_file_counts.py
ethyca/fideseye
c74bb0245724c2db77db37317226db153780860b
[ "Apache-2.0" ]
1
2022-01-13T16:56:37.000Z
2022-01-13T16:56:37.000Z
fideslog/api/models/manifest_file_counts.py
ethyca/fideseye
c74bb0245724c2db77db37317226db153780860b
[ "Apache-2.0" ]
1
2022-01-21T22:09:06.000Z
2022-01-21T22:09:06.000Z
fideslog/api/models/manifest_file_counts.py
ethyca/fideslog
c74bb0245724c2db77db37317226db153780860b
[ "Apache-2.0" ]
null
null
null
from pydantic import BaseModel, Field class ManifestFileCounts(BaseModel): """ A JSON object structure containing the counts of dataset, policy, and system manifests currently in use. """ datasets: int = Field( 0, description="The number of dataset manifests currently in use.", ) policies: int = Field( 0, description="The number of policy manifests currently in use.", ) systems: int = Field( 0, description="The number of system manifests currently in use.", )
25.227273
72
0.637838
63
555
5.619048
0.47619
0.20339
0.225989
0.259887
0.426554
0.262712
0.262712
0
0
0
0
0.007557
0.284685
555
21
73
26.428571
0.884131
0.187387
0
0.214286
0
0
0.336427
0
0
0
0
0
0
1
0
true
0
0.071429
0
0.357143
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
0f7a1b3381e871051676752b578a1a5bbfd991aa
245
py
Python
python/test_assertAndException.py
anbansal/TDD
51e26245dbe5fea9c7cb073c38eb69b49b0ff019
[ "MIT" ]
null
null
null
python/test_assertAndException.py
anbansal/TDD
51e26245dbe5fea9c7cb073c38eb69b49b0ff019
[ "MIT" ]
2
2019-09-26T13:13:36.000Z
2019-09-26T16:40:19.000Z
python/test_assertAndException.py
anbansal/TDD
51e26245dbe5fea9c7cb073c38eb69b49b0ff019
[ "MIT" ]
null
null
null
from pytest import approx from pytest import raises def test_float(): assert (0.1 + 0.2) == approx(0.3) def raisesValueException(): raise ValueError def test_exception(): with raises(ValueError): raisesValueException()
15.3125
37
0.693878
30
245
5.6
0.6
0.119048
0.190476
0
0
0
0
0
0
0
0
0.030928
0.208163
245
15
38
16.333333
0.835052
0
0
0
0
0
0
0
0
0
0
0
0.111111
1
0.333333
true
0
0.222222
0
0.555556
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
1
0
0
0
1
0
0
4
0f8164785e6804637d491652223cadff7776d7b3
91
py
Python
tests/examples-bad/5.py
JohannesBuchner/pystrict3
f442a89ac6a23f4323daed8ef829d8e9e1197f90
[ "BSD-2-Clause" ]
1
2020-06-05T08:53:26.000Z
2020-06-05T08:53:26.000Z
tests/examples-bad/5.py
JohannesBuchner/pystrict3
f442a89ac6a23f4323daed8ef829d8e9e1197f90
[ "BSD-2-Clause" ]
1
2020-06-04T13:47:19.000Z
2020-06-04T13:47:57.000Z
tests/examples-bad/5.py
JohannesBuchner/pystrict3
f442a89ac6a23f4323daed8ef829d8e9e1197f90
[ "BSD-2-Clause" ]
1
2020-11-07T17:02:46.000Z
2020-11-07T17:02:46.000Z
def foo(a, b): return a * b foo(1, 2) ## OK foo(1) ## error: wrong number of arguments
15.166667
43
0.593407
18
91
3
0.722222
0.074074
0
0
0
0
0
0
0
0
0
0.043478
0.241758
91
5
44
18.2
0.73913
0.384615
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0
0.25
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
0f936cd5ecbce4695bcb63c09ba45b118260984b
284
py
Python
python/testData/inspections/PyDataclassInspection/fieldDefaultAndDefaultFactory.py
dmeybohm/intellij-community
7fcc441fd5902ec3d237c34ee93f5ed1faf23629
[ "Apache-2.0" ]
2
2018-12-29T09:53:39.000Z
2018-12-29T09:53:42.000Z
python/testData/inspections/PyDataclassInspection/fieldDefaultAndDefaultFactory.py
tnorbye/intellij-community
f01cf262fc196bf4dbb99e20cd937dee3705a7b6
[ "Apache-2.0" ]
null
null
null
python/testData/inspections/PyDataclassInspection/fieldDefaultAndDefaultFactory.py
tnorbye/intellij-community
f01cf262fc196bf4dbb99e20cd937dee3705a7b6
[ "Apache-2.0" ]
1
2019-07-18T16:50:52.000Z
2019-07-18T16:50:52.000Z
import dataclasses @dataclasses.dataclass class E1: a: int = dataclasses.field(default=1) b: int = dataclasses.field(default_factory=int) c: int = dataclasses.field<error descr="Cannot specify both 'default' and 'default_factory'">(default=1, default_factory=int)</error>
40.571429
137
0.75
38
284
5.526316
0.5
0.2
0.271429
0.247619
0
0
0
0
0
0
0
0.012097
0.126761
284
7
137
40.571429
0.834677
0
0
0
0
0
0.178947
0
0
0
0
0
0
0
null
null
0
0.166667
null
null
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
1
0
0
0
0
0
0
0
0
4
7e171e2a34f34c3de6c6379aee135a8c80b309ee
402
py
Python
cretan/__init__.py
AmateurECE/Cretan
30528c57a062b9a817852118dec2049106f7ffcf
[ "MIT" ]
null
null
null
cretan/__init__.py
AmateurECE/Cretan
30528c57a062b9a817852118dec2049106f7ffcf
[ "MIT" ]
null
null
null
cretan/__init__.py
AmateurECE/Cretan
30528c57a062b9a817852118dec2049106f7ffcf
[ "MIT" ]
null
null
null
############################################################################### # NAME: __init__.py # # AUTHOR: Ethan D. Twardy <edtwardy@mtu.edu> # # DESCRIPTION: Module init script # # CREATED: 05/30/2020 # # LAST EDITED: 05/30/2020 ### from .Cretan import getService, Message ###############################################################################
25.125
79
0.345771
28
402
4.821429
0.857143
0.059259
0.118519
0
0
0
0
0
0
0
0
0.04908
0.189055
402
15
80
26.8
0.365031
0.440299
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
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
7e234f0ffd1d2e37f5883481f8d041c010acdc1c
104
py
Python
accounting_tech/apps.py
Tim-Ilin/asup_corp_site
02a9573f2490ef8f31b3ba95bc351c2458d049e5
[ "MIT" ]
null
null
null
accounting_tech/apps.py
Tim-Ilin/asup_corp_site
02a9573f2490ef8f31b3ba95bc351c2458d049e5
[ "MIT" ]
8
2021-03-19T11:12:07.000Z
2022-03-12T00:32:27.000Z
accounting_tech/apps.py
Tim-Ilin/asup_corp_site
02a9573f2490ef8f31b3ba95bc351c2458d049e5
[ "MIT" ]
null
null
null
from django.apps import AppConfig class AccountingTechConfig(AppConfig): name = 'accounting_tech'
17.333333
38
0.788462
11
104
7.363636
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.144231
104
5
39
20.8
0.910112
0
0
0
0
0
0.144231
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
7e2c7cd619cbd3c5cf8f8b444ff107229ceb0f89
4,135
py
Python
graphy2/flow2.py
samuelbaker93/graphy
79117d8052e126a6cb2e5c5b281c00af28ba74ab
[ "MIT" ]
1
2020-05-20T07:48:09.000Z
2020-05-20T07:48:09.000Z
graphy2/flow2.py
samuelbaker93/graphy
79117d8052e126a6cb2e5c5b281c00af28ba74ab
[ "MIT" ]
5
2020-05-22T08:50:52.000Z
2020-05-31T16:33:42.000Z
graphy2/flow2.py
samuelbaker93/graphy
79117d8052e126a6cb2e5c5b281c00af28ba74ab
[ "MIT" ]
null
null
null
from imageObjects.ImageMaker import ImageMaker import cv2 from graphy2.Flow import Flow from graphy2 import default_style_sheet # class Flow: # def __init__(self): # self.prisma = {} # # def add_to_flow(self, text, x_position, y_position): # self.prisma[len(self.prisma.keys())] = {"x": x_position, "y": y_position, "text": text} # # def create_text_box(self, text): # current_box = ImageMaker().create_text_box(text, cv2.FONT_HERSHEY_SIMPLEX, 35) # current_box.inset_rounded_border((255, 0, 0), 5, 25, 0.1) # # current_box.show() # return current_box # # # def _construct_flow_columns(self): # # # Create columns of x's # columns = sorted(list(set([values["x"] for values in self.prisma.values()]))) # # column_images = {} # for col in columns: # # Sort on Y position within a given x # column_values = {value["y"]: value["text"] for value in self.prisma.values() if value["x"] == col} # # # Create a text box for each row in a given column # column_images[col] = {key: self.create_text_box(text) # for key, text in zip(column_values.keys(), column_values.values())} # return column_images # # @staticmethod # def flow_bound(bound, columns, spacing=None): # """ # We need to set the image bounds to be equal to the largest or widest column # # :param bound: The bound, height or width # :param spacing: The amount of spacing of y or x # :param columns: The dict of columns # :return: The max bound of x or y given spacing # """ # # if spacing: # return max([sum([getattr(image, bound) for image in v]) + (spacing * (len(v) - 1)) # for v in columns.values()]) # else: # return max([max([getattr(image, bound) for image in v]) # for v in columns.values()]) # # def _get_bounds(self, columns, key): # return [getattr(row, key) for col in columns.values() for row in col.values()] # # def construct_flow(self, canvas_colour, x_spacing=1.5): # # columns = self._construct_flow_columns() # widths = {key: max(self._get_bounds(columns, "width")) for key in columns.keys()} # height = max([sum(self._get_bounds(columns, "height")) for _ in columns.keys()]) # # # Define the canvas # canvas = ImageMaker().create_blank(int(sum(v for v in widths.values()) * x_spacing), height) # canvas.colour_covert() # canvas.change_a_colour((0, 0, 0), canvas_colour) # # for index, image_list in zip(columns.keys(), columns.values()): # for i, (y_placer, image) in enumerate(zip(image_list.keys(), image_list.values())): # canvas.overlay_image(image, int(y_placer * image.height), 0 + int((index * widths[index]) * x_spacing)) # # canvas.show() # # flow_obj = Flow() # # flow_obj.add_to_flow("UK Biobank Population: 502,507", 0, 0) # flow_obj.add_to_flow("Born in scotland: 50,000", 1, 1) # flow_obj.add_to_flow("Uk Biobank Population not in scotland: 450,000", 0, 1) # flow_obj.construct_flow((255, 255, 255)) # custom_style = default_style_sheet() # custom_style["figure_x"] = 8 # custom_style["figure_y"] = 12 # # # obj = Flow(r"I:\Work\Figures_and_tables\Scarlet_Long_Term\Figures", "Flow Plot Re", 20, custom_style # ) # # # Add a bunch of sample information # obj.add_to_flow("UK Biobank Population", 502507) # obj.add_to_flow("Born in Scotland", 502507, add=False) # obj.add_to_flow("UK Biobank Population not in scotland", 502507) # obj.add_to_flow("No Birth Coordinate", 502507, add=False) # obj.add_to_flow("UK Biobank Population that can be geolocated", 502507) # obj.add_to_flow("Born Before 1941", 502507, add=False) # obj.add_to_flow("UK Biobank Population within year sample range", 502507) # obj.add_to_flow("Missing Data", 502507, add=False) # obj.add_to_flow("UK Biobank sample Population", 502507) # # # Write out the plot # obj.construct_flow_plot(column_mod=1.05)
38.64486
121
0.632164
588
4,135
4.263605
0.255102
0.025927
0.046669
0.057439
0.203829
0.172716
0.161548
0.106103
0.090546
0.076586
0
0.038146
0.23289
4,135
107
122
38.64486
0.752207
0.91971
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
7e3eac1aa0c6ae82283ba2721123deb33f6c9b18
11,061
py
Python
backend/django/test/core_utils/test_core_utils_annotate.py
rubentea16/SMART
b851bef46b038d80389adcca00caadb4ec88eac2
[ "MIT" ]
1
2021-11-14T12:08:26.000Z
2021-11-14T12:08:26.000Z
backend/django/test/core_utils/test_core_utils_annotate.py
rubentea16/SMART
b851bef46b038d80389adcca00caadb4ec88eac2
[ "MIT" ]
4
2021-03-09T17:00:12.000Z
2021-09-29T17:31:07.000Z
backend/django/test/core_utils/test_core_utils_annotate.py
rubentea16/SMART
b851bef46b038d80389adcca00caadb4ec88eac2
[ "MIT" ]
null
null
null
from core.models import Data, AssignedData, Label, DataLabel, DataQueue from core.utils.utils_annotate import (assign_datum, label_data, move_skipped_to_admin_queue, get_assignments, unassign_datum) from core.utils.utils_queue import fill_queue from test.util import assert_obj_exists from test.conftest import TEST_QUEUE_LEN def test_assign_datum_project_queue_returns_datum(db, test_queue, test_profile, test_redis): ''' Assign a datum from a project-wide queue (null profile ID). ''' fill_queue(test_queue, orderby='random') datum = assign_datum(test_profile, test_queue.project) # Make sure we got the datum assert isinstance(datum, Data) def test_assign_datum_project_queue_correct_assignment(db, test_queue, test_profile, test_redis): fill_queue(test_queue, orderby='random') datum = assign_datum(test_profile, test_queue.project) # Make sure the assignment is correct assignment = AssignedData.objects.filter(data=datum) assert len(assignment) == 1 assert assignment[0].profile == test_profile assert assignment[0].queue == test_queue assert assignment[0].assigned_timestamp is not None def test_assign_datum_project_queue_pops_queues(db, test_queue, test_profile, test_redis): fill_queue(test_queue, orderby='random') datum = assign_datum(test_profile, test_queue.project) # Make sure the datum was removed from queues but not set assert test_redis.llen('queue:' + str(test_queue.pk)) == test_queue.length - 1 assert test_redis.scard('set:' + str(test_queue.pk)) == test_queue.length # but not from the db queue assert test_queue.data.count() == test_queue.length assert datum in test_queue.data.all() def test_assign_datum_profile_queue_returns_correct_datum(db, test_profile_queue, test_profile, test_profile_queue2, test_profile2, test_redis): fill_queue(test_profile_queue, orderby='random') fill_queue(test_profile_queue2, orderby='random') datum = assign_datum(test_profile, test_profile_queue.project) assert isinstance(datum, Data) def test_assign_datum_profile_queue_correct_assignment(db, test_profile_queue, test_profile, test_profile_queue2, test_profile2, test_redis): fill_queue(test_profile_queue, orderby='random') fill_queue(test_profile_queue2, orderby='random') datum = assign_datum(test_profile, test_profile_queue.project) assignment = AssignedData.objects.filter(data=datum) assert len(assignment) == 1 assert assignment[0].profile == test_profile assert assignment[0].queue == test_profile_queue assert assignment[0].assigned_timestamp is not None def test_assign_datum_profile_queue_pops_queues(db, test_profile_queue, test_profile, test_profile_queue2, test_profile2, test_redis): fill_queue(test_profile_queue, orderby='random') fill_queue(test_profile_queue2, orderby='random') datum = assign_datum(test_profile, test_profile_queue.project) # Make sure the datum was removed from the correct queues but not sets assert test_redis.llen('queue:' + str(test_profile_queue.pk)) == test_profile_queue.length - 1 assert test_redis.scard('set:' + str(test_profile_queue.pk)) == test_profile_queue.length # ...but not the other queues assert test_profile_queue.data.count() == test_profile_queue.length assert datum in test_profile_queue.data.all() assert test_redis.llen('queue:' + str(test_profile_queue2.pk)) == test_profile_queue2.length assert test_redis.scard('set:' + str(test_profile_queue2.pk)) == test_profile_queue2.length assert test_profile_queue2.data.count() == test_profile_queue2.length def test_label_data(db, test_profile, test_queue, test_redis): fill_queue(test_queue, orderby='random') datum = assign_datum(test_profile, test_queue.project) test_label = Label.objects.create(name='test', project=test_queue.project) label_data(test_label, datum, test_profile, 3) # Make sure the label was properly recorded assert datum in test_profile.labeled_data.all() assert_obj_exists(DataLabel, { 'data': datum, 'profile': test_profile, 'label': test_label, 'time_to_label': 3 }) # Make sure the assignment was removed assert not AssignedData.objects.filter(profile=test_profile, data=datum, queue=test_queue).exists() def test_get_assignments_no_existing_assignment_one_assignment(db, test_profile, test_project_data, test_queue, test_redis): fill_queue(test_queue, orderby='random') assert AssignedData.objects.count() == 0 data = get_assignments(test_profile, test_project_data, 1) assert len(data) == 1 assert isinstance(data[0], Data) assert_obj_exists(AssignedData, { 'data': data[0], 'profile': test_profile }) def test_get_assignments_no_existing_assignment_half_max_queue_length(db, test_profile, test_project_data, test_queue, test_redis): fill_queue(test_queue, orderby='random') assert AssignedData.objects.count() == 0 data = get_assignments(test_profile, test_project_data, TEST_QUEUE_LEN // 2) assert len(data) == TEST_QUEUE_LEN // 2 for datum in data: assert isinstance(datum, Data) assert_obj_exists(AssignedData, { 'data': datum, 'profile': test_profile }) def test_get_assignments_no_existing_assignment_max_queue_length(db, test_profile, test_project_data, test_queue, test_redis): fill_queue(test_queue, orderby='random') assert AssignedData.objects.count() == 0 data = get_assignments(test_profile, test_project_data, TEST_QUEUE_LEN) assert len(data) == TEST_QUEUE_LEN for datum in data: assert isinstance(datum, Data) assert_obj_exists(AssignedData, { 'data': datum, 'profile': test_profile }) def test_get_assignments_no_existing_assignment_over_max_queue_length(db, test_profile, test_project_data, test_queue, test_redis): fill_queue(test_queue, orderby='random') assert AssignedData.objects.count() == 0 data = get_assignments(test_profile, test_project_data, TEST_QUEUE_LEN + 10) assert len(data) == TEST_QUEUE_LEN for datum in data: assert isinstance(datum, Data) assert_obj_exists(AssignedData, { 'data': datum, 'profile': test_profile }) def test_get_assignments_one_existing_assignment(db, test_profile, test_project_data, test_queue, test_redis): fill_queue(test_queue, orderby='random') assigned_datum = assign_datum(test_profile, test_project_data) data = get_assignments(test_profile, test_project_data, 1) assert isinstance(data[0], Data) # We should just get the datum that was already assigned assert data[0] == assigned_datum def test_get_assignments_multiple_existing_assignments(db, test_profile, test_project_data, test_queue, test_redis): fill_queue(test_queue, orderby='random') assigned_data = [] for i in range(5): assigned_data.append(assign_datum(test_profile, test_project_data)) data = get_assignments(test_profile, test_project_data, 5) assert len(data) == 5 assert len(data) == len(assigned_data) for datum, assigned_datum in zip(data, assigned_data): assert isinstance(datum, Data) # We should just get the data that was already assigned assert len(data) == len(assigned_data) def test_unassign(db, test_profile, test_project_data, test_queue, test_redis): fill_queue(test_queue, orderby='random') assert test_redis.llen('queue:' + str(test_queue.pk)) == test_queue.length assert test_redis.scard('set:' + str(test_queue.pk)) == test_queue.length datum = get_assignments(test_profile, test_project_data, 1)[0] assert test_redis.llen('queue:' + str(test_queue.pk)) == (test_queue.length - 1) assert test_redis.scard('set:' + str(test_queue.pk)) == test_queue.length assert AssignedData.objects.filter( data=datum, profile=test_profile).exists() unassign_datum(datum, test_profile) assert test_redis.llen('queue:' + str(test_queue.pk)) == test_queue.length assert test_redis.scard('set:' + str(test_queue.pk)) == test_queue.length assert not AssignedData.objects.filter( data=datum, profile=test_profile).exists() # The unassigned datum should be the next to be assigned reassigned_datum = get_assignments(test_profile, test_project_data, 1)[0] assert reassigned_datum == datum def test_unassign_after_fillqueue(db, test_profile, test_project_data, test_queue, test_labels, test_redis): fill_queue(test_queue, 'random') assert test_redis.llen('queue:' + str(test_queue.pk)) == test_queue.length assert test_redis.scard('set:' + str(test_queue.pk)) == test_queue.length data = get_assignments(test_profile, test_project_data, 10) assert test_redis.llen('queue:' + str(test_queue.pk)) == (test_queue.length - 10) assert test_redis.scard('set:' + str(test_queue.pk)) == test_queue.length test_label = test_labels[0] for i in range(5): label_data(test_label, data[i], test_profile, 3) assert test_redis.llen('queue:' + str(test_queue.pk)) == (test_queue.length - 10) assert test_redis.scard('set:' + str(test_queue.pk)) == (test_queue.length - 5) fill_queue(test_queue, 'random') assert test_redis.llen('queue:' + str(test_queue.pk)) == test_queue.length - 5 assert test_redis.scard('set:' + str(test_queue.pk)) == test_queue.length def test_skip_data(db, test_profile, test_queue, test_admin_queue, test_redis): fill_queue(test_queue, orderby='random') project = test_queue.project datum = assign_datum(test_profile, project) move_skipped_to_admin_queue(datum, test_profile, project) # Make sure the assignment was removed assert not AssignedData.objects.filter(profile=test_profile, data=datum, queue=test_queue).exists() # make sure the item was re-assigned to the admin queue assert DataQueue.objects.filter(data=datum, queue=test_admin_queue).exists() # make sure not in normal queue assert not DataQueue.objects.filter(data=datum, queue=test_queue).exists()
39.645161
118
0.683483
1,430
11,061
4.968531
0.079021
0.123856
0.07178
0.058832
0.815482
0.770303
0.722308
0.687403
0.660239
0.615341
0
0.00712
0.225386
11,061
278
119
39.78777
0.822129
0.060212
0
0.597765
0
0
0.028651
0
0
0
0
0
0.374302
1
0.089385
false
0
0.027933
0
0.117318
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
7e48aa8b6d759429a6b22d9ef0a7643e06f5e7f0
255
py
Python
mediaaritmeticaexercicio.py
EBERTONSCHIPPNIK/Pequenos-codigospy
b9cc49a1cce372df2ef5217cb93766fafd9e405a
[ "MIT" ]
null
null
null
mediaaritmeticaexercicio.py
EBERTONSCHIPPNIK/Pequenos-codigospy
b9cc49a1cce372df2ef5217cb93766fafd9e405a
[ "MIT" ]
null
null
null
mediaaritmeticaexercicio.py
EBERTONSCHIPPNIK/Pequenos-codigospy
b9cc49a1cce372df2ef5217cb93766fafd9e405a
[ "MIT" ]
null
null
null
nota1 = float(input("Digite a 1º nota: ")) nota2 = float(input("Digite a 2º nota: ")) nota3 = float(input("Digite a 3º nota: ")) nota4 = float(input("Digite a 4º nota: ")) media =(nota1+nota2+nota3+nota4)/4 print("A média aritmética é ", media)
28.333333
43
0.647059
40
255
4.125
0.475
0.242424
0.387879
0.412121
0
0
0
0
0
0
0
0.062201
0.180392
255
8
44
31.875
0.727273
0
0
0
0
0
0.376518
0
0
0
0
0
0
1
0
false
0
0
0
0
0.166667
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
7e4aad374bfcda8a9206fdbb3025dddd08be1e83
109
py
Python
gunicorn_config.py
EmilStenstrom/json-tagger
a8816e6c4339c6b834c6e014d7bd6ea7b02e760b
[ "MIT" ]
13
2015-12-07T23:05:47.000Z
2021-07-01T23:41:14.000Z
gunicorn_config.py
EmilStenstrom/json-tagger
a8816e6c4339c6b834c6e014d7bd6ea7b02e760b
[ "MIT" ]
3
2018-10-08T10:44:54.000Z
2020-08-01T13:03:51.000Z
gunicorn_config.py
EmilStenstrom/json-tagger
a8816e6c4339c6b834c6e014d7bd6ea7b02e760b
[ "MIT" ]
2
2020-01-26T08:17:20.000Z
2020-02-01T18:42:33.000Z
accesslog = '-' access_log_format = \ "%(h)s %(l)s %(u)s %(t)s %(r)s %(s)s %(b)s %(f)s %(a)s [%(D)s μs]"
27.25
70
0.440367
25
109
1.84
0.6
0.086957
0
0
0
0
0
0
0
0
0
0
0.192661
109
3
71
36.333333
0.522727
0
0
0
0
0.333333
0.59633
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
7e6b1013df6677568f1575f6a7f09d0ac10c7ab5
2,928
py
Python
users/forms.py
RafaCucurull/Bookiernes
efe220a2501e20cca4e40bc4e582a4316e8718f6
[ "MIT" ]
null
null
null
users/forms.py
RafaCucurull/Bookiernes
efe220a2501e20cca4e40bc4e582a4316e8718f6
[ "MIT" ]
101
2021-03-29T16:20:09.000Z
2021-06-12T08:53:20.000Z
users/forms.py
RafaCucurull/Bookiernes
efe220a2501e20cca4e40bc4e582a4316e8718f6
[ "MIT" ]
null
null
null
from django.contrib.auth.forms import UserCreationForm, UserChangeForm from django.forms import TextInput from .models import CustomUser from django import forms class CustomUserCreationForm(UserCreationForm): nom = forms.CharField(help_text="Introdueix el seu nom i cognoms (p.ex. Carlos Ruíz Zafon)") email = forms.CharField(help_text="Introdueix un format correcte de correu electrònic (p.ex. example@gmail.com)") password1 = forms.CharField( help_text=["La teva contrassenya no pot ser similar a l'altra informació personal teva.", "La teva contrassenya ha de tenir almenys 8 caràcters.", "La teva contrassenya no pot ser una comunment usada.", "La teva contrassenya no pot ser completament numèrica."]) password2 = forms.CharField(help_text="Introdueix la mateixa contrassenya que anteriorment, per verificació.") class Meta(UserCreationForm): model = CustomUser fields = ('nom', 'email', 'is_Editor', 'is_Escriptor', 'is_Maquetacio', 'is_IT', 'password1', 'password2') class CustomLectorCreationForm(UserCreationForm): nom = forms.CharField(help_text="Introdueix el seu nom i cognoms (p.ex. Carlos Ruíz Zafon)") email = forms.CharField(help_text="Introdueix un format correcte de correu electrònic (p.ex. cruizz@escriptors.cat)") password1 = forms.CharField( help_text=["La teva contrassenya no pot ser similar a l'altra informació personal teva.", "La teva contrassenya ha de tenir almenys 8 caràcters.", "La teva contrassenya no pot ser una comunment usada.", "La teva contrassenya no pot ser completament numèrica."]) password2 = forms.CharField(help_text="Introdueix la mateixa contrassenya que anteriorment, per verificació.") class Meta(UserCreationForm): model = CustomUser fields = ('nom', 'email', 'password1', 'password2') class CustomUserChangeForm(UserChangeForm): class Meta: model = CustomUser fields = ('email',) class ConfiguracioForm(UserChangeForm): class Meta: model = CustomUser fields = ('nom', 'edat', 'sexe') widgets = { 'nom': TextInput(attrs={ 'class': "form-control", 'style': 'width: 100%;background-color: linen;font-size: 30px; margin: auto', 'placeholder': 'El seu nom...' }), 'edat': TextInput(attrs={ 'class': "form-control", 'style': 'width: 35%;background-color: linen;font-size: 30px; margin: auto', 'placeholder': 'La seva edat...' }), 'sexe': TextInput(attrs={ 'class': "form-control", 'style': 'width: 50%;background-color: linen;font-size: 30px; margin: auto', 'placeholder': 'El seu sexe...' }), }
45.75
121
0.632855
319
2,928
5.77116
0.316614
0.060837
0.078218
0.0956
0.780554
0.780554
0.732754
0.667572
0.667572
0.638783
0
0.010575
0.257172
2,928
63
122
46.47619
0.835862
0
0
0.528302
0
0
0.453707
0.029382
0
0
0
0
0
1
0
false
0.113208
0.075472
0
0.377358
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
0e2d407936177a6d538ec5ba1f7e9312bd975fa5
2,922
py
Python
backend/api/models/__init__.py
ActionAnalytics/tfrs
83e1805312d3f13c6a7235e99840b44f399c8fde
[ "Apache-2.0" ]
null
null
null
backend/api/models/__init__.py
ActionAnalytics/tfrs
83e1805312d3f13c6a7235e99840b44f399c8fde
[ "Apache-2.0" ]
null
null
null
backend/api/models/__init__.py
ActionAnalytics/tfrs
83e1805312d3f13c6a7235e99840b44f399c8fde
[ "Apache-2.0" ]
null
null
null
# coding: utf-8 """ REST API Documentation for the NRS TFRS Credit Trading Application The Transportation Fuels Reporting System is being designed to streamline compliance reporting for transportation fuel suppliers in accordance with the Renewable & Low Carbon Fuel Requirements Regulation. OpenAPI spec version: v1 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ # from __future__ import absolute_import # import models into model package #try: # from . import CreditTrade #except: # import CreditTrade #try: # from . import CreditTradeHistory #except: # import CreditTradeHistory #try: # from . import CreditTradeStatus #except: # import CreditTradeStatus #try: # from . import CreditTradeType #except: # import CreditTradeType #try: # from . import CreditTradeZeroReason #except: # import CreditTradeZeroReason #try: # from . import CurrentUserViewModel #except: # import CurrentUserViewModel #try: # from . import Organization #except: # import Organization #try: # from . import OrganizationActionsType #except: # import OrganizationActionsType #try: # from . import OrganizationAttachment #except: # import OrganizationAttachment #try: # from . import OrganizationBalance #except: # import OrganizationBalance #try: # from . import OrganizationHistory #except: # import OrganizationHistory #try: # from . import OrganizationStatus #except: # import OrganizationStatus #try: # from . import Permission #except: # import Permission #try: # from . import PermissionViewModel #except: # import PermissionViewModel #try: # from . import Role #except: # import Role #try: # from . import RolePermission #except: # import RolePermission #try: # from . import RolePermissionViewModel #except: # import RolePermissionViewModel #try: # from . import RoleViewModel #except: # import RoleViewModel #try: # from . import User #except: # import User #try: # from . import UserDetailsViewModel #except: # import UserDetailsViewModel #try: # from . import UserRole #except: # import UserRole #try: # from . import UserRoleViewModel #except: # import UserRoleViewModel #try: # from . import UserViewModel #except: # import UserViewModel # from . import User
23.95082
208
0.701916
303
2,922
6.752475
0.39604
0.117302
0.146139
0.01564
0
0
0
0
0
0
0
0.002664
0.229295
2,922
121
209
24.14876
0.905861
0.905886
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
0e2eaf91132dce1c850bc64279a88013387718f9
150
py
Python
automon/integrations/swift/__init__.py
TheShellLand/automonisaur
b5f304a44449b8664c93d8a8a3c3cf2d73aa0ce9
[ "MIT" ]
2
2021-09-15T18:35:44.000Z
2022-01-18T05:36:54.000Z
automon/integrations/swift/__init__.py
TheShellLand/automonisaur
b5f304a44449b8664c93d8a8a3c3cf2d73aa0ce9
[ "MIT" ]
16
2021-08-29T22:51:53.000Z
2022-03-09T16:08:19.000Z
automon/integrations/swift/__init__.py
TheShellLand/automonisaur
b5f304a44449b8664c93d8a8a3c3cf2d73aa0ce9
[ "MIT" ]
null
null
null
from .client import SwiftClient from .config import SwiftConfig from .error import SwiftError_ from .iterables import SwiftItem, SwiftPage, SwiftList
30
54
0.84
18
150
6.944444
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.12
150
4
55
37.5
0.94697
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
0e3123f09813fb204abbf574124671c9d6a1bf04
2,060
py
Python
phanterpwa/tests/test_cli.py
PhanterJR/phanterpwa
6daff40845b3a853cd08d319c4ce148f8deebed7
[ "MIT" ]
2
2019-06-06T10:37:01.000Z
2021-10-16T03:36:28.000Z
phanterpwa/tests/test_cli.py
PhanterJR/phanterpwa
6daff40845b3a853cd08d319c4ce148f8deebed7
[ "MIT" ]
null
null
null
phanterpwa/tests/test_cli.py
PhanterJR/phanterpwa
6daff40845b3a853cd08d319c4ce148f8deebed7
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- import unittest import os # from phanterpwa.interface import ( # cli # ) # CURRENT_PATH = os.path.dirname(__file__) # class TestCli(unittest.TestCase): # def test_Projects(self): # projects = cli.Projects(os.path.join(CURRENT_PATH, "test_cli_projects")) # html_to_xmlconstructor_instance = HtmlToXmlConstructor("<html><head><meta charset=\"UTF-8\"></head><body><nav class=\"navbar\"><buttom>start</buttom></nav><main id=\"my_content\"><div class=\"row\"><div>my content</div></div></main></body></html>") # self.assertEqual( # html_to_xmlconstructor_instance.xmlconstructor_code(), # sample_example_1 # ) # html_to_xmlconstructor_instance = HtmlToXmlConstructor("<div data-dict=\"i am in dict\" class=\"my_class\">content1</div><div class=\"my_class\">content2</div>") # self.assertEqual( # html_to_xmlconstructor_instance.xmlconstructor_code(), # sample_example_2 # ) # html_to_xmlconstructor_instance = HtmlToXmlConstructor(sample) # self.assertEqual( # html_to_xmlconstructor_instance.xml(), # sample # ) # self.assertEqual( # force_minify_string_content(html_to_xmlconstructor_instance).xml(), # sample2 # ) # self.assertEqual( # force_minify_string_content(html_to_xmlconstructor_instance).xmlconstructor_code(), # sample3 # ) # def test1_html_to_xmlconstructor(self): # invert = HtmlToXmlConstructor(sample_html_to_xmlconstructor) # self.assertEqual(invert.xml(), sample_html_to_xmlconstructor) # invert.src_attr_dict = False # self.assertRaises(ValueError, lambda: invert.source_code()) # invert.src_attr_dict = None # self.assertTrue(isinstance(invert.source_code(), str)) # invert.src_attr_dict = True # self.assertTrue(isinstance(invert.source_code(), str)) if __name__ == '__main__': unittest.main()
35.517241
258
0.647573
217
2,060
5.801843
0.35023
0.052423
0.174742
0.177919
0.459889
0.340747
0.292295
0.223987
0.223987
0.223987
0
0.005618
0.22233
2,060
57
259
36.140351
0.780275
0.856796
0
0
0
0
0.031496
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
0e51b0e6d96a232b4e811166b9b0296c32ea7a0d
8,730
py
Python
test/test_logging.py
wilhaddenIBM/qpylib
6ec1c041b5e3a8d185a38f9d2d10e3e635ed285d
[ "Apache-2.0" ]
null
null
null
test/test_logging.py
wilhaddenIBM/qpylib
6ec1c041b5e3a8d185a38f9d2d10e3e635ed285d
[ "Apache-2.0" ]
null
null
null
test/test_logging.py
wilhaddenIBM/qpylib
6ec1c041b5e3a8d185a38f9d2d10e3e635ed285d
[ "Apache-2.0" ]
1
2020-07-30T09:56:07.000Z
2020-07-30T09:56:07.000Z
# Copyright 2019 IBM Corporation All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 # # pylint: disable=redefined-outer-name, unused-argument, invalid-name from unittest.mock import patch import logging import os import pytest from qpylib import qpylib, log_qpylib APP_FILE_LOG_FORMAT = '[{0}] - [APP_ID/1001][NOT:{1}] {2}' GET_MANIFEST_JSON = 'qpylib.app_qpylib.get_root_path' def manifest_path(manifest_file): return os.path.join(os.path.dirname(__file__), 'manifests', manifest_file) # This fixture avoids reading app id from the manifest. # Setting default log level threshold is handled by separate fixtures. @pytest.fixture(scope='module', autouse=True) def bypass_manifest_lookup(): with patch('qpylib.app_qpylib.get_app_id') as mock_get_app_id: mock_get_app_id.return_value = 1001 yield @pytest.fixture(scope='function') def info_threshold(): with patch('qpylib.log_qpylib.default_log_level') as mock_default_log_level: mock_default_log_level.return_value = logging.INFO yield @pytest.fixture(scope='function') def debug_threshold(): with patch('qpylib.log_qpylib.default_log_level') as mock_default_log_level: mock_default_log_level.return_value = logging.DEBUG yield @pytest.fixture(scope='function') def set_console_ip(): os.environ['QRADAR_CONSOLE_IP'] = '9.123.234.101' yield del os.environ['QRADAR_CONSOLE_IP'] @pytest.fixture(scope='function', autouse=True) def reset_globals(): with patch('qpylib.log_qpylib.QLOGGER', 0): with patch('qpylib.app_qpylib.Q_CACHED_MANIFEST', None): yield # pylint: disable=protected-access def verify_log_file_content(log_path, expected_lines, not_expected_lines=[]): # pylint: disable=dangerous-default-value with open(log_path) as log_file: content = log_file.read() for line in expected_lines: assert APP_FILE_LOG_FORMAT.format( line['level'], log_qpylib._map_notification_code(line['level']), line['text']) in content for line in not_expected_lines: assert APP_FILE_LOG_FORMAT.format( line['level'], log_qpylib._map_notification_code(line['level']), line['text']) not in content def test_log_without_create_raises_error(): with pytest.raises(RuntimeError, match='You cannot use log before logging has been initialised'): qpylib.log('hello') def test_create_without_console_ip_env_var_raises_error(info_threshold, tmpdir): log_path = os.path.join(tmpdir.strpath, 'app.log') with patch('qpylib.log_qpylib._log_file_location') as mock_log_location: mock_log_location.return_value = log_path with pytest.raises(KeyError, match='Environment variable QRADAR_CONSOLE_IP is not set'): qpylib.create_log() @patch(GET_MANIFEST_JSON, return_value=manifest_path('installed.json')) def test_default_log_level_no_level_in_manifest(mock_manifest, set_console_ip): assert log_qpylib.default_log_level() == logging.INFO @patch(GET_MANIFEST_JSON, return_value=manifest_path('loglevel.json')) def test_default_log_level_read_from_manifest(mock_manifest, set_console_ip): assert log_qpylib.default_log_level() == logging.DEBUG def test_all_log_levels_with_manifest_info_threshold(set_console_ip, info_threshold, tmpdir): log_path = os.path.join(tmpdir.strpath, 'app.log') with patch('qpylib.log_qpylib._log_file_location') as mock_log_location: mock_log_location.return_value = log_path qpylib.create_log() qpylib.log('hello debug', 'DEBUG') qpylib.log('hello default info') qpylib.log('hello info', 'INFO') qpylib.log('hello warning', 'WARNING') qpylib.log('hello error', 'ERROR') qpylib.log('hello critical', 'CRITICAL') verify_log_file_content(log_path, [ {'level': 'INFO', 'text': 'hello default info'}, {'level': 'INFO', 'text': 'hello info'}, {'level': 'WARNING', 'text': 'hello warning'}, {'level': 'ERROR', 'text': 'hello error'}, {'level': 'CRITICAL', 'text': 'hello critical'}], not_expected_lines=[{'level': 'DEBUG', 'text': 'hello debug'}]) def test_all_log_levels_with_manifest_debug_threshold(set_console_ip, debug_threshold, tmpdir): log_path = os.path.join(tmpdir.strpath, 'app.log') with patch('qpylib.log_qpylib._log_file_location') as mock_log_location: mock_log_location.return_value = log_path qpylib.create_log() qpylib.log('hello debug', 'DEBUG') qpylib.log('hello default info') qpylib.log('hello info', 'INFO') qpylib.log('hello warning', 'WARNING') qpylib.log('hello error', 'ERROR') qpylib.log('hello critical', 'CRITICAL') verify_log_file_content(log_path, [ {'level': 'DEBUG', 'text': 'hello debug'}, {'level': 'INFO', 'text': 'hello default info'}, {'level': 'INFO', 'text': 'hello info'}, {'level': 'WARNING', 'text': 'hello warning'}, {'level': 'ERROR', 'text': 'hello error'}, {'level': 'CRITICAL', 'text': 'hello critical'}]) def test_all_log_levels_with_set_debug_threshold(set_console_ip, info_threshold, tmpdir): log_path = os.path.join(tmpdir.strpath, 'app.log') with patch('qpylib.log_qpylib._log_file_location') as mock_log_location: mock_log_location.return_value = log_path qpylib.create_log() qpylib.set_log_level('DEBUG') qpylib.log('hello debug', 'DEBUG') qpylib.log('hello default info') qpylib.log('hello info', 'INFO') qpylib.log('hello warning', 'WARNING') qpylib.log('hello error', 'ERROR') qpylib.log('hello critical', 'CRITICAL') verify_log_file_content(log_path, [ {'level': 'DEBUG', 'text': 'hello debug'}, {'level': 'INFO', 'text': 'hello default info'}, {'level': 'INFO', 'text': 'hello info'}, {'level': 'WARNING', 'text': 'hello warning'}, {'level': 'ERROR', 'text': 'hello error'}, {'level': 'CRITICAL', 'text': 'hello critical'}]) def test_all_log_levels_with_set_warning_threshold(set_console_ip, info_threshold, tmpdir): log_path = os.path.join(tmpdir.strpath, 'app.log') with patch('qpylib.log_qpylib._log_file_location') as mock_log_location: mock_log_location.return_value = log_path qpylib.create_log() qpylib.set_log_level('WARNING') qpylib.log('hello debug', 'DEBUG') qpylib.log('hello default info') qpylib.log('hello info', 'INFO') qpylib.log('hello warning', 'WARNING') qpylib.log('hello error', 'ERROR') qpylib.log('hello critical', 'CRITICAL') verify_log_file_content(log_path, [ {'level': 'WARNING', 'text': 'hello warning'}, {'level': 'ERROR', 'text': 'hello error'}, {'level': 'CRITICAL', 'text': 'hello critical'}], not_expected_lines=[ {'level': 'DEBUG', 'text': 'hello debug'}, {'level': 'INFO', 'text': 'hello default info'}, {'level': 'INFO', 'text': 'hello info'}]) def test_log_with_bad_level_uses_info(set_console_ip, info_threshold, tmpdir): log_path = os.path.join(tmpdir.strpath, 'app.log') with patch('qpylib.log_qpylib._log_file_location') as mock_log_location: mock_log_location.return_value = log_path qpylib.create_log() qpylib.log('hello', 'BAD') verify_log_file_content(log_path, [{'level': 'INFO', 'text': 'hello'}]) def test_set_log_level_with_bad_level_uses_info(set_console_ip, debug_threshold, tmpdir): log_path = os.path.join(tmpdir.strpath, 'app.log') with patch('qpylib.log_qpylib._log_file_location') as mock_log_location: mock_log_location.return_value = log_path qpylib.create_log() qpylib.set_log_level('BAD') qpylib.log('hello debug', 'DEBUG') qpylib.log('hello default info') qpylib.log('hello info', 'INFO') qpylib.log('hello warning', 'WARNING') qpylib.log('hello error', 'ERROR') qpylib.log('hello critical', 'CRITICAL') verify_log_file_content(log_path, [ {'level': 'INFO', 'text': 'hello default info'}, {'level': 'INFO', 'text': 'hello info'}, {'level': 'WARNING', 'text': 'hello warning'}, {'level': 'ERROR', 'text': 'hello error'}, {'level': 'CRITICAL', 'text': 'hello critical'}], not_expected_lines=[{'level': 'DEBUG', 'text': 'hello debug'}])
46.43617
119
0.654181
1,108
8,730
4.867329
0.125451
0.083442
0.083071
0.036714
0.76896
0.743186
0.709624
0.709624
0.673836
0.673836
0
0.004045
0.207102
8,730
187
120
46.684492
0.775065
0.040206
0
0.654088
0
0
0.259529
0.055323
0
0
0
0
0.025157
1
0.106918
false
0.006289
0.031447
0.006289
0.144654
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
0e6aeb7d0a5f7d11105a3c9a6ca8aeb09de451ce
115
py
Python
KF/test.py
ZhouYzzz/CTT
385b6c7ac2e6633f72b49df7e8a599f40c50188b
[ "MIT" ]
3
2016-12-19T12:54:38.000Z
2019-02-15T05:42:32.000Z
KF/test.py
ZhouYzzz/CTT
385b6c7ac2e6633f72b49df7e8a599f40c50188b
[ "MIT" ]
null
null
null
KF/test.py
ZhouYzzz/CTT
385b6c7ac2e6633f72b49df7e8a599f40c50188b
[ "MIT" ]
2
2018-02-07T18:30:15.000Z
2019-02-15T05:42:34.000Z
class A(): def __init__(self, ID): self.ID = ID self.sth = self.load() def load(self): print self.ID A(5)
12.777778
24
0.608696
21
115
3.142857
0.47619
0.272727
0
0
0
0
0
0
0
0
0
0.011111
0.217391
115
9
25
12.777778
0.722222
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0.142857
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
1
0
0
0
0
0
0
0
0
4
0e81831046470fc42a6ffa4687eeb0eb442856d6
23,447
py
Python
src/isanlp_rst/rst_tree_predictor.py
tchewik/isanlp_rst
459864b3daeeb702acf5e65543181068439ce12c
[ "MIT" ]
6
2020-05-09T01:13:10.000Z
2021-02-05T01:02:40.000Z
src/isanlp_rst/rst_tree_predictor.py
tchewik/isanlp_rst
459864b3daeeb702acf5e65543181068439ce12c
[ "MIT" ]
2
2019-09-26T11:32:46.000Z
2020-07-24T13:44:46.000Z
src/isanlp_rst/rst_tree_predictor.py
tchewik/isanlp_rst
459864b3daeeb702acf5e65543181068439ce12c
[ "MIT" ]
3
2019-09-26T13:39:26.000Z
2021-04-12T14:34:50.000Z
import pandas as pd from isanlp.annotation_rst import DiscourseUnit from symbol_map import SYMBOL_MAP class RSTTreePredictor: """ Contains classifiers and processors needed for tree building. """ def __init__(self, features_processor, relation_predictor_sentence, relation_predictor_text, label_predictor, nuclearity_predictor): self.features_processor = features_processor self.relation_predictor_sentence = relation_predictor_sentence self.relation_predictor_text = relation_predictor_text self.label_predictor = label_predictor self.nuclearity_predictor = nuclearity_predictor if self.nuclearity_predictor: self.nuclearities = self.nuclearity_predictor.classes_ self.genre = None self.DEFAULT_RELATION = 'joint_NN' self._penalty_words = ['новость :', 'культура :', 'http'] def _find_penalty_words(self, span, _penalty=0.5): if len(span.split()) > 100: return _penalty for word in self._penalty_words: if word in span.lower(): return _penalty for word in ['.', '?', '!']: return _penalty / 2. return 0 class GoldTreePredictor(RSTTreePredictor): """ Contains classifiers and processors needed for gold tree building from corpus. """ def __init__(self, corpus): """ :param pandas.DataFrame corpus: columns=['snippet_x', 'snippet_y', 'category_id'] rows=[all the relations pairs from corpus] """ RSTTreePredictor.__init__(self, None, None, None, None, None) self.corpus = corpus self._symbol_map = SYMBOL_MAP for key, value in self._symbol_map.items(): self.corpus.snippet_x = self.corpus.snippet_x.replace(key, value, regex=True) self.corpus.snippet_y = self.corpus.snippet_y.replace(key, value, regex=True) def extract_features(self, *args): features = pd.DataFrame({ 'snippet_x': [args[0].text, ], 'snippet_y': [args[1].text, ] }) for key, value in self._symbol_map.items(): features.snippet_x = features.snippet_x.replace(key, value, regex=True) features.snippet_y = features.snippet_y.replace(key, value, regex=True) return features def initialize_features(self, *args): features = pd.DataFrame({ 'snippet_x': [args[0][i].text for i in range(len(args[0]) - 1)], 'snippet_y': [args[0][i].text for i in range(1, len(args[0]))] }) for key, value in self._symbol_map.items(): features.snippet_x = features.snippet_x.replace(key, value, regex=True) features.snippet_y = features.snippet_y.replace(key, value, regex=True) return features def predict_pair_proba(self, features, _same_sentence_bonus=0.): def _check_snippet_pair_in_dataset(left_snippet, right_snippet): proba = float(((self.corpus.snippet_x == left_snippet) & (self.corpus.snippet_y == right_snippet)).sum( axis=0) != 0) return min(1., proba) result = features.apply(lambda row: _check_snippet_pair_in_dataset(row.snippet_x, row.snippet_y), axis=1) return result.values.tolist() def predict_label(self, features): def _get_label(left_snippet, right_snippet): joint = self.corpus[ ((self.corpus.snippet_x == left_snippet) & (self.corpus.snippet_y == right_snippet))] label = joint.category_id.map(lambda row: row.split('_')[0]) + '_' + joint.order label = label.values if label.size == 0: return self.DEFAULT_RELATION return label[0] if type(features) == pd.Series: result = _get_label(features.loc['snippet_x'], features.loc['snippet_y']) return result else: result = features.apply(lambda row: _get_label(row.snippet_x, row.snippet_y), axis=1) return result.values.tolist() def predict_nuclearity(self, features): def _get_nuclearity(left_snippet, right_snippet): nuclearity = self.corpus[ ((self.corpus.snippet_x == left_snippet) & (self.corpus.snippet_y == right_snippet))].order.values if nuclearity.size == 0: return '_' if type(features) == pd.Series: result = _get_nuclearity(features.loc['snippet_x'], features.loc['snippet_y']) return result else: result = features.apply(lambda row: _get_nuclearity(row.snippet_x, row.snippet_y), axis=1) return result.values.tolist() class CustomTreePredictor(RSTTreePredictor): """ Contains trained classifiers and feature processors needed for tree prediction. """ def __init__(self, features_processor, relation_predictor_sentence, relation_predictor_text, label_predictor=None, nuclearity_predictor=None): RSTTreePredictor.__init__(self, features_processor, relation_predictor_sentence, relation_predictor_text, label_predictor, nuclearity_predictor) def extract_features(self, left_node: DiscourseUnit, right_node: DiscourseUnit, annot_text, annot_tokens, annot_sentences, annot_lemma, annot_morph, annot_postag, annot_syntax_dep_tree): pair = pd.DataFrame({ 'snippet_x': [left_node.text.strip()], 'snippet_y': [right_node.text.strip()], }) try: features = self.features_processor(pair, annot_text=annot_text, annot_tokens=annot_tokens, annot_sentences=annot_sentences, annot_postag=annot_postag, annot_morph=annot_morph, annot_lemma=annot_lemma, annot_syntax_dep_tree=annot_syntax_dep_tree) return features except: with open('errors.log', 'w+') as f: f.write(str(pair.values)) f.write(annot_text) return -1 def initialize_features(self, nodes, annot_text, annot_tokens, annot_sentences, annot_lemma, annot_morph, annot_postag, annot_syntax_dep_tree): pairs = pd.DataFrame({ 'snippet_x': [node.text.strip() for node in nodes[:-1]], 'snippet_y': [node.text.strip() for node in nodes[1:]] }) try: features = self.features_processor(pairs, annot_text=annot_text, annot_tokens=annot_tokens, annot_sentences=annot_sentences, annot_postag=annot_postag, annot_morph=annot_morph, annot_lemma=annot_lemma, annot_syntax_dep_tree=annot_syntax_dep_tree) return features except IndexError: with open('feature_extractor_errors.log', 'w+') as f: f.write(str(pairs.values)) f.write(annot_text) return -1 def predict_pair_proba(self, features, _same_sentence_bonus=0.5): if type(features) == pd.DataFrame: feat_same_sent = features[:] feat_same_sent.snippet_x = feat_same_sent.apply(lambda row: (row.same_sentence == 1) * row.snippet_x + '', axis=1) feat_same_sent.snippet_y = feat_same_sent.apply(lambda row: (row.same_sentence == 1) * row.snippet_y + '', axis=1) probas_sentence_level = self.relation_predictor_sentence.predict_proba(feat_same_sent) feat_not_same_sent = features[:] feat_not_same_sent.snippet_x = feat_not_same_sent.apply( lambda row: (row.same_sentence == 0) * row.snippet_x + '', axis=1) feat_not_same_sent.snippet_y = feat_not_same_sent.apply( lambda row: (row.same_sentence == 0) * row.snippet_y + '', axis=1) probas_text_level = self.relation_predictor_text.predict_proba(feat_not_same_sent) same_sentence_bonus = list(map(lambda value: float(value) * _same_sentence_bonus, list(features['same_sentence'] == 1))) return [probas_sentence_level[i][1] + same_sentence_bonus[i] + probas_text_level[i][1] for i in range(len(probas_sentence_level))] if type(features) == pd.Series: if features.loc['same_sentence'] == 1: return self.relation_predictor_sentence.predict_proba(features)[0][1] + _same_sentence_bonus return self.relation_predictor_text.predict_proba(features)[0][1] if type(features) == list: return self.relation_predictor_text.predict_proba([features])[0][1] def predict_label(self, features): if not self.label_predictor: return 'relation' if type(features) == pd.DataFrame: return self.label_predictor.predict(features) if type(features) == pd.Series: return self.label_predictor.predict(features.to_frame().T)[0] def predict_nuclearity(self, features): if not self.nuclearity_predictor: return 'unavail' if type(features) == pd.DataFrame: return self.nuclearity_predictor.predict(features) if type(features) == pd.Series: return self.nuclearity_predictor.predict(features.to_frame().T)[0] class NNTreePredictor(CustomTreePredictor): """ Contains trained classifiers and feature processors needed for tree prediction. """ def extract_features(self, left_node: DiscourseUnit, right_node: DiscourseUnit, annot_text, annot_tokens, annot_sentences, annot_lemma, annot_morph, annot_postag, annot_syntax_dep_tree): pair = pd.DataFrame({ 'snippet_x': [left_node.text.strip()], 'snippet_y': [right_node.text.strip()], }) features = self.features_processor(pair, annot_text=annot_text, annot_tokens=annot_tokens, annot_sentences=annot_sentences, annot_postag=annot_postag, annot_morph=annot_morph, annot_lemma=annot_lemma, annot_syntax_dep_tree=annot_syntax_dep_tree) features['snippet_x'] = features['tokens_x'].map(lambda row: ' '.join(row)).values features['snippet_y'] = features['tokens_y'].map(lambda row: ' '.join(row)).values return features def initialize_features(self, nodes, annot_text, annot_tokens, annot_sentences, annot_lemma, annot_morph, annot_postag, annot_syntax_dep_tree): features = super().initialize_features(nodes, annot_text, annot_tokens, annot_sentences, annot_lemma, annot_morph, annot_postag, annot_syntax_dep_tree) features['snippet_x'] = features['tokens_x'].map(lambda row: ' '.join(row)).values features['snippet_y'] = features['tokens_y'].map(lambda row: ' '.join(row)).values return features def predict_pair_proba(self, features, _same_sentence_bonus=0.1): if type(features) == pd.DataFrame: probas_text_level = self.relation_predictor_text.predict_proba_batch( features['snippet_x'].values.tolist(), features['snippet_y'].values.tolist()) sentence_level_map = list(map(float, list(features['same_sentence'] == 1))) return [probas_text_level[i][1] + _same_sentence_bonus * sentence_level_map[i] for i in range(len(probas_text_level))] if type(features) == pd.Series: return self.relation_predictor_text.predict_proba(features.loc['snippet_x'], features.loc['snippet_y'])[0][1] + ( features.loc['same_sentence'] == 1) * _same_sentence_bonus if type(features) == list: snippet_x = [feature['snippet_x'] for feature in features] snippet_y = [feature['snippet_y'] for feature in features] probas = self.relation_predictor_text.predict_proba_batch(snippet_x, snippet_y) return [proba[1] for proba in probas] def predict_label(self, features): result = self.DEFAULT_RELATION if not self.label_predictor: return result if type(features) == pd.DataFrame: result = self.label_predictor.predict_batch(features['snippet_x'].values.tolist(), features['snippet_y'].values.tolist()) if type(features) == pd.Series: result = self.label_predictor.predict(features.loc['snippet_x'], features.loc['snippet_y']) if type(result) == list: return [_class_mapper.get(value) if _class_mapper.get(value) else value for value in result] if _class_mapper.get(result): return _class_mapper.get(result) return result class LargeNNTreePredictor(NNTreePredictor): """ Contains trained classifiers and feature processors needed for tree prediction. """ def predict_pair_proba(self, features, _same_sentence_bonus=1.): if type(features) == pd.DataFrame: probas_text_level = self.relation_predictor_text.predict_proba_batch( features['snippet_x'].values.tolist(), features['snippet_y'].values.tolist(), features['same_sentence'].map(str).values.tolist(), features['same_paragraph'].map(str).values.tolist()) sentence_level_map = list(map(float, list(features['same_sentence'] == 1))) return [probas_text_level[i][1] + _same_sentence_bonus * sentence_level_map[i] for i in range(len(probas_text_level))] if type(features) == pd.Series: return self.relation_predictor_text.predict_proba(features.loc['snippet_x'], features.loc['snippet_y'], str(features.loc['same_sentence'], str(features.loc['same_paragraph'])))[0][1] + ( features.loc['same_sentence'] == 1) * _same_sentence_bonus if type(features) == list: snippet_x = [feature['snippet_x'] for feature in features] snippet_y = [feature['snippet_y'] for feature in features] same_sentence = [feature['same_sentence'].map(str) for feature in features] same_paragraph = [feature['same_paragraph'].map(str) for feature in features] probas = self.relation_predictor_text.predict_proba_batch(snippet_x, snippet_y, same_sentence, same_paragraph) sentence_level_map = list(map(float, [feature['same_sentence'] == 1 for feature in features])) return [probas[i][1] + sentence_level_map[i] for i in range(len(probas))] def predict_label(self, features): result = self.DEFAULT_RELATION if not self.label_predictor: return result if type(features) == pd.DataFrame: result = self.label_predictor.predict_batch(features['snippet_x'].values.tolist(), features['snippet_y'].values.tolist()) if type(features) == pd.Series: result = self.label_predictor.predict(features.loc['snippet_x'], features.loc['snippet_y']) return result class ContextualNNTreePredictor(NNTreePredictor): """ Contains trained classifiers and feature processors needed for tree prediction. """ def predict_pair_proba(self, features, _same_sentence_bonus=.5): if type(features) == pd.DataFrame: probas_text_level = self.relation_predictor_text.predict_proba_batch( features['snippet_x'].values.tolist(), features['snippet_y'].values.tolist(), features['same_sentence'].map(str).values.tolist(), features['left_context'].values.tolist(), features['right_context'].values.tolist()) sentence_level_map = list(map(float, list(features['same_sentence'] == 1))) return [probas_text_level[i][1] + _same_sentence_bonus * sentence_level_map[i] for i in range(len(probas_text_level))] if type(features) == pd.Series: return self.relation_predictor_text.predict_proba(features.loc['snippet_x'], features.loc['snippet_y'], str(features.loc['same_sentence'], features.loc['left_context'], features.loc['right_context']))[0][1] + ( features.loc['same_sentence'] == 1) * _same_sentence_bonus if type(features) == list: snippet_x = [feature['snippet_x'] for feature in features] snippet_y = [feature['snippet_y'] for feature in features] same_sentence = [feature['same_sentence'].map(str) for feature in features] probas = self.relation_predictor_text.predict_proba_batch(snippet_x, snippet_y, same_sentence, left_context, right_context) sentence_level_map = list(map(float, [feature['same_sentence'] == 1 for feature in features])) return [probas[i][1] + sentence_level_map[i] for i in range(len(probas))] def predict_label(self, features): result = self.DEFAULT_RELATION if not self.label_predictor: return result if type(features) == pd.DataFrame: result = self.label_predictor.predict_batch(features['snippet_x'].values.tolist(), features['snippet_y'].values.tolist()) if type(features) == pd.Series: result = self.label_predictor.predict(features.loc['snippet_x'], features.loc['snippet_y']) return result class EnsembleNNTreePredictor(LargeNNTreePredictor): """ Contains trained classifiers and feature processors needed for tree prediction. Instead of pure allennlp classification model, as is in LargeNNTreePredictor, predicts labels from an ensemble of allennlp and sklearn models. """ def predict_label(self, features): result = self.DEFAULT_RELATION if not self.label_predictor: return result if type(features) == pd.DataFrame: result = self.label_predictor.predict_batch(snippet_x=features['snippet_x'].values.tolist(), snippet_y=features['snippet_y'].values.tolist(), features=features) if type(features) == pd.Series: result = self.label_predictor.predict(snippet_x=features.loc['snippet_x'], snippet_y=features.loc['snippet_y'], features=features.to_frame().T) return result class DoubleEnsembleNNTreePredictor(EnsembleNNTreePredictor): """ Contains trained classifiers and feature processors needed for tree prediction. Instead of pure allennlp classification model, as is in LargeNNTreePredictor, predicts labels from an ensemble of allennlp and sklearn models. Instead of pure sklearn classification model, as is in LargeNNTreePredictor, predicts structure from an ensemble of allennlp and sklearn models. """ def predict_pair_proba(self, features, _same_sentence_bonus=1.): if type(features) == pd.DataFrame: probas_text_level = self.relation_predictor_text.predict_proba_batch( snippet_x=features['snippet_x'].values.tolist(), snippet_y=features['snippet_y'].values.tolist(), same_sentence=features['same_sentence'].map(str).values.tolist(), same_paragraph=features['same_paragraph'].map(str).values.tolist(), features=features) # plus bonus for the presense in the same sentence sentence_level_map = list(map(float, list(features['same_sentence'] == 1))) # minus penalty for the depricated words keywords_penalty = list( map(float, list(features['snippet_x'].map(lambda row: self._find_penalty_words(row))))) return [probas_text_level[i][1] + _same_sentence_bonus * sentence_level_map[i] - keywords_penalty[i] for i in range(len(probas_text_level))] if type(features) == pd.Series: return self.relation_predictor_text.predict_proba(snippet_x=features.loc['snippet_x'], snippet_y=features.loc['snippet_y'], same_sentence=str(features.loc['same_sentence'], same_paragraph=str( features.loc['same_paragraph'], features=features)))[0][1] + ( features.loc['same_sentence'] == 1) * _same_sentence_bonus if type(features) == list: snippet_x = [feature['snippet_x'] for feature in features] snippet_y = [feature['snippet_y'] for feature in features] same_sentence = [feature['same_sentence'].map(str) for feature in features] same_paragraph = [feature['same_paragraph'].map(str) for feature in features] probas = self.relation_predictor_text.predict_proba_batch( snippet_x=snippet_x, snippet_y=snippet_y, same_sentence=same_sentence, same_paragraph=same_paragraph, features=features) sentence_level_map = list(map(float, [feature['same_sentence'] == 1 for feature in features])) return [probas[i][1] + sentence_level_map[i] for i in range(len(probas))] class TopDownRSTPredictor: def __init__(self, features_processor, label_predictor): self.features_processor = features_processor self.label_predictor = label_predictor
45.264479
118
0.588945
2,528
23,447
5.187104
0.070807
0.036605
0.030962
0.029284
0.82117
0.768398
0.74163
0.69168
0.674598
0.670632
0
0.00523
0.314966
23,447
517
119
45.352031
0.811169
0.054549
0
0.582857
0
0
0.049177
0.001274
0
0
0
0
0
1
0.08
false
0
0.008571
0
0.265714
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
0e941c73b1c42c191a08bb0f246c2463d67e13b7
113
py
Python
tests/test_get.py
northernSage/pytest-flask-issue-101
52040ba2d43c4a7b2092adcd4e07f16822da4bdf
[ "MIT" ]
null
null
null
tests/test_get.py
northernSage/pytest-flask-issue-101
52040ba2d43c4a7b2092adcd4e07f16822da4bdf
[ "MIT" ]
null
null
null
tests/test_get.py
northernSage/pytest-flask-issue-101
52040ba2d43c4a7b2092adcd4e07f16822da4bdf
[ "MIT" ]
null
null
null
from flask import url_for def test_get_index(client): assert client.get(url_for('index')).status_code == 200
28.25
58
0.761062
19
113
4.263158
0.736842
0.148148
0
0
0
0
0
0
0
0
0
0.030303
0.123894
113
4
58
28.25
0.787879
0
0
0
0
0
0.04386
0
0
0
0
0
0.333333
1
0.333333
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
1
0
0
1
0
0
0
0
4
0e986f125d43edd8032d7caed9c17dbdf23c29e1
74,015
py
Python
test/python/test_onnx_backend.py
perfmjs/singa
7d220f72f15e10ff9b61bb5596e389c52ba0160c
[ "Apache-2.0" ]
1
2020-01-03T22:35:36.000Z
2020-01-03T22:35:36.000Z
test/python/test_onnx_backend.py
perfmjs/singa
7d220f72f15e10ff9b61bb5596e389c52ba0160c
[ "Apache-2.0" ]
null
null
null
test/python/test_onnx_backend.py
perfmjs/singa
7d220f72f15e10ff9b61bb5596e389c52ba0160c
[ "Apache-2.0" ]
null
null
null
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================= import unittest from builtins import str from singa import tensor from singa import singa_wrap as singa from singa import autograd from singa import sonnx from singa import opt import onnx from onnx import (defs, checker, helper, numpy_helper, mapping, ModelProto, GraphProto, NodeProto, AttributeProto, TensorProto, OperatorSetIdProto) from onnx.helper import make_tensor, make_tensor_value_info, make_node, make_graph from cuda_helper import gpu_dev, cpu_dev import numpy as np import itertools autograd.training = True _default_opset_version = 10 def expect(node, inputs, outputs, name, opset_version=_default_opset_version): onnx_node = sonnx.OnnxNode(node) input_tensors = {} input_labels = [x for x in onnx_node.inputs if x != ""] # prepare input tensors for key, val in zip(input_labels, inputs): # very important! must be float if not isinstance(val, np.ndarray) or len(val.shape) == 0: val = np.array([val]) x = tensor.from_numpy(val.astype(np.float32)) x.to_device(gpu_dev) input_tensors[key] = x outputs_dict = sonnx.run_node(onnx_node, input_tensors, opset_version) for out1, out2 in zip(outputs, outputs_dict.values()): np.testing.assert_array_almost_equal( out1, tensor.to_numpy(out2), decimal=5) class TestPythonOnnxBackend(unittest.TestCase): """ This class aims to test the backend functionality of sonnx, The most of the code is borrowed from onnx. """ def test_conv2d(self): x = np.array([[[[0., 1., 2., 3., 4.], # (1, 1, 5, 5) input tensor [5., 6., 7., 8., 9.], [10., 11., 12., 13., 14.], [15., 16., 17., 18., 19.], [20., 21., 22., 23., 24.]]]]).astype(np.float32) W = np.array([[[[1., 1., 1.], # (1, 1, 3, 3) tensor for convolution weights [1., 1., 1.], [1., 1., 1.]]]]).astype(np.float32) # Convolution with padding node_with_padding = onnx.helper.make_node( 'Conv', inputs=['x', 'W'], outputs=['y'], kernel_shape=[3, 3], # Default values for other attributes: strides=[1, 1], dilations=[1, 1], groups=1 pads=[1, 1, 1, 1], ) y_with_padding = np.array([[[[12., 21., 27., 33., 24.], # (1, 1, 5, 5) output tensor [33., 54., 63., 72., 51.], [63., 99., 108., 117., 81.], [93., 144., 153., 162., 111.], [72., 111., 117., 123., 84.]]]]).astype(np.float32) expect(node_with_padding, inputs=[x, W], outputs=[y_with_padding], name='test_basic_conv_with_padding') # Convolution without padding node_without_padding = onnx.helper.make_node( 'Conv', inputs=['x', 'W'], outputs=['y'], kernel_shape=[3, 3], # Default values for other attributes: strides=[1, 1], dilations=[1, 1], groups=1 pads=[0, 0, 0, 0], ) y_without_padding = np.array([[[[54., 63., 72.], # (1, 1, 3, 3) output tensor [99., 108., 117.], [144., 153., 162.]]]]).astype(np.float32) expect(node_without_padding, inputs=[x, W], outputs=[y_without_padding], name='test_basic_conv_without_padding') def test_conv2d_with_strides(self): # type: () -> None x = np.array([[[[0., 1., 2., 3., 4.], # (1, 1, 7, 5) input tensor [5., 6., 7., 8., 9.], [10., 11., 12., 13., 14.], [15., 16., 17., 18., 19.], [20., 21., 22., 23., 24.], [25., 26., 27., 28., 29.], [30., 31., 32., 33., 34.]]]]).astype(np.float32) W = np.array([[[[1., 1., 1.], # (1, 1, 3, 3) tensor for convolution weights [1., 1., 1.], [1., 1., 1.]]]]).astype(np.float32) # Convolution with strides=2 and padding node_with_padding = onnx.helper.make_node( 'Conv', inputs=['x', 'W'], outputs=['y'], kernel_shape=[3, 3], pads=[1, 1, 1, 1], # Default values for other attributes: dilations=[1, 1], groups=1 strides=[2, 2], ) y_with_padding = np.array([[[[12., 27., 24.], # (1, 1, 4, 3) output tensor [63., 108., 81.], [123., 198., 141.], [112., 177., 124.]]]]).astype(np.float32) expect(node_with_padding, inputs=[x, W], outputs=[y_with_padding], name='test_conv_with_strides_padding') # Convolution with strides=2 and no padding node_without_padding = onnx.helper.make_node( 'Conv', inputs=['x', 'W'], outputs=['y'], kernel_shape=[3, 3], pads=[0, 0, 0, 0], # Default values for other attributes: dilations=[1, 1], groups=1 strides=[2, 2], ) y_without_padding = np.array([[[[54., 72.], # (1, 1, 3, 2) output tensor [144., 162.], [234., 252.]]]]).astype(np.float32) expect(node_without_padding, inputs=[x, W], outputs=[y_without_padding], name='test_conv_with_strides_no_padding') # Convolution with strides=2 and padding only along one dimension (the H dimension in NxCxHxW tensor) node_with_asymmetric_padding = onnx.helper.make_node( 'Conv', inputs=['x', 'W'], outputs=['y'], kernel_shape=[3, 3], pads=[1, 0, 1, 0], # Default values for other attributes: dilations=[1, 1], groups=1 strides=[2, 2], ) y_with_asymmetric_padding = np.array([[[[21., 33.], # (1, 1, 4, 2) output tensor [99., 117.], [189., 207.], [171., 183.]]]]).astype(np.float32) expect(node_with_asymmetric_padding, inputs=[x, W], outputs=[y_with_asymmetric_padding], name='test_conv_with_strides_and_asymmetric_padding') def test_averagepool_2d_precomputed_pads(self): # type: () -> None """ input_shape: [1, 1, 5, 5] output_shape: [1, 1, 5, 5] pad_shape: [4, 4] -> [2, 2, 2, 2] by axis """ node = onnx.helper.make_node( 'AveragePool', inputs=['x'], outputs=['y'], kernel_shape=[5, 5], pads=[2, 2, 2, 2] ) x = np.array([[[ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25], ]]]).astype(np.float32) y = np.array([[[[7, 7.5, 8, 8.5, 9], [9.5, 10, 10.5, 11, 11.5], [12, 12.5, 13, 13.5, 14], [14.5, 15, 15.5, 16, 16.5], [17, 17.5, 18, 18.5, 19]]]]).astype(np.float32) expect(node, inputs=[x], outputs=[y], name='test_averagepool_2d_precomputed_pads') def test_averagepool_2d_precomputed_strides(self): # type: () -> None """ input_shape: [1, 1, 5, 5] output_shape: [1, 1, 2, 2] """ node = onnx.helper.make_node( 'AveragePool', inputs=['x'], outputs=['y'], kernel_shape=[2, 2], strides=[2, 2] ) x = np.array([[[ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25], ]]]).astype(np.float32) y = np.array([[[[4, 6], [14, 16]]]]).astype(np.float32) expect(node, inputs=[x], outputs=[y], name='test_averagepool_2d_precomputed_strides') def test_averagepool_2d_precomputed_same_upper(self): # type: () -> None """ input_shape: [1, 1, 5, 5] output_shape: [1, 1, 3, 3] pad_shape: [2, 2] -> [1, 1, 1, 1] by axis """ node = onnx.helper.make_node( 'AveragePool', inputs=['x'], outputs=['y'], kernel_shape=[3, 3], strides=[2, 2], auto_pad='SAME_UPPER' ) x = np.array([[[ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25], ]]]).astype(np.float32) y = np.array([[[[4, 5.5, 7], [11.5, 13, 14.5], [19, 20.5, 22]]]]).astype(np.float32) expect(node, inputs=[x], outputs=[y], name='test_averagepool_2d_precomputed_same_upper') def test_averagepool_2d_default(self): # type: () -> None """ input_shape: [1, 3, 32, 32] output_shape: [1, 3, 31, 31] """ node = onnx.helper.make_node( 'AveragePool', inputs=['x'], outputs=['y'], kernel_shape=[2, 2], ) x = np.random.randn(1, 3, 32, 32).astype(np.float32) x_shape = np.shape(x) kernel_shape = (2, 2) strides = (1, 1) out_shape = get_output_shape( 'VALID', x_shape[2:], kernel_shape, strides) padded = x y = pool(padded, x_shape, kernel_shape, strides, out_shape, (0, 0), 'AVG') expect(node, inputs=[x], outputs=[y], name='test_averagepool_2d_default') def test_averagepool_2d_pads(self): # type: () -> None """ input_shape: [1, 3, 28, 28] output_shape: [1, 3, 30, 30] pad_shape: [4, 4] -> [2, 2, 2, 2] by axis """ node = onnx.helper.make_node( 'AveragePool', inputs=['x'], outputs=['y'], kernel_shape=[3, 3], pads=[2, 2, 2, 2] ) x = np.random.randn(1, 3, 28, 28).astype(np.float32) x_shape = np.shape(x) kernel_shape = (3, 3) strides = (1, 1) pad_bottom = 2 pad_top = 2 pad_right = 2 pad_left = 2 pad_shape = [pad_top + pad_bottom, pad_left + pad_right] out_shape = get_output_shape('VALID', np.add( x_shape[2:], pad_shape), kernel_shape, strides) padded = np.pad(x, ((0, 0), (0, 0), (pad_top, pad_bottom), (pad_left, pad_right)), mode='constant', constant_values=np.nan) y = pool(padded, x_shape, kernel_shape, strides, out_shape, pad_shape, 'AVG') expect(node, inputs=[x], outputs=[y], name='test_averagepool_2d_pads') def test_averagepool_2d_strides(self): # type: () -> None """ input_shape: [1, 3, 32, 32] output_shape: [1, 3, 10, 10] """ node = onnx.helper.make_node( 'AveragePool', inputs=['x'], outputs=['y'], kernel_shape=[5, 5], strides=[3, 3] ) x = np.random.randn(1, 3, 32, 32).astype(np.float32) x_shape = np.shape(x) kernel_shape = (5, 5) strides = (3, 3) out_shape = get_output_shape( 'VALID', x_shape[2:], kernel_shape, strides) padded = x y = pool(padded, x_shape, kernel_shape, strides, out_shape, (0, 0), 'AVG') expect(node, inputs=[x], outputs=[y], name='test_averagepool_2d_strides') def test_maxpool_2d_precomputed_pads(self): # type: () -> None """ input_shape: [1, 1, 5, 5] output_shape: [1, 1, 5, 5] pad_shape: [4, 4] -> [2, 2, 2, 2] by axis """ node = onnx.helper.make_node( 'MaxPool', inputs=['x'], outputs=['y'], kernel_shape=[5, 5], pads=[2, 2, 2, 2] ) x = np.array([[[ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25], ]]]).astype(np.float32) y = np.array([[[ [13, 14, 15, 15, 15], [18, 19, 20, 20, 20], [23, 24, 25, 25, 25], [23, 24, 25, 25, 25], [23, 24, 25, 25, 25]]]]).astype(np.float32) expect(node, inputs=[x], outputs=[y], name='test_maxpool_2d_precomputed_pads') def test_maxpool_with_argmax_2d_precomputed_pads(self): # type: () -> None """ input_shape: [1, 1, 5, 5] output_shape: [1, 1, 5, 5] pad_shape: [4, 4] -> [2, 2, 2, 2] by axis """ node = onnx.helper.make_node( 'MaxPool', inputs=['x'], outputs=['y', 'z'], kernel_shape=[5, 5], pads=[2, 2, 2, 2] ) x = np.array([[[ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25], ]]]).astype(np.float32) y = np.array([[[ [13, 14, 15, 15, 15], [18, 19, 20, 20, 20], [23, 24, 25, 25, 25], [23, 24, 25, 25, 25], [23, 24, 25, 25, 25]]]]).astype(np.float32) z = np.array([[[ [12, 13, 14, 14, 14], [17, 18, 19, 19, 19], [22, 23, 24, 24, 24], [22, 23, 24, 24, 24], [22, 23, 24, 24, 24]]]]).astype(np.int64) expect(node, inputs=[x], outputs=[y, z], name='test_maxpool_with_argmax_2d_precomputed_pads') def test_maxpool_2d_precomputed_strides(self): # type: () -> None """ input_shape: [1, 1, 5, 5] output_shape: [1, 1, 2, 2] """ node = onnx.helper.make_node( 'MaxPool', inputs=['x'], outputs=['y'], kernel_shape=[2, 2], strides=[2, 2] ) x = np.array([[[ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25], ]]]).astype(np.float32) y = np.array([[[[7, 9], [17, 19]]]]).astype(np.float32) expect(node, inputs=[x], outputs=[y], name='test_maxpool_2d_precomputed_strides') # type: () -> None def test_maxpool_with_argmax_2d_precomputed_strides(self): """ input_shape: [1, 1, 5, 5] output_shape: [1, 1, 2, 2] """ node = onnx.helper.make_node( 'MaxPool', inputs=['x'], outputs=['y', 'z'], kernel_shape=[2, 2], strides=[2, 2], storage_order=1 ) x = np.array([[[ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25], ]]]).astype(np.float32) y = np.array([[[[7, 9], [17, 19]]]]).astype(np.float32) z = np.array([[[[6, 16], [8, 18]]]]).astype(np.int64) expect(node, inputs=[x], outputs=[ y, z], name='test_maxpool_with_argmax_2d_precomputed_strides') def test_maxpool_2d_precomputed_same_upper(self): # type: () -> None """ input_shape: [1, 1, 5, 5] output_shape: [1, 1, 3, 3] pad_shape: [2, 2] -> [1, 1, 1, 1] by axis """ node = onnx.helper.make_node( 'MaxPool', inputs=['x'], outputs=['y'], kernel_shape=[3, 3], strides=[2, 2], auto_pad='SAME_UPPER' ) x = np.array([[[ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25], ]]]).astype(np.float32) y = np.array([[[[7, 9, 10], [17, 19, 20], [22, 24, 25]]]]).astype(np.float32) expect(node, inputs=[x], outputs=[y], name='test_maxpool_2d_precomputed_same_upper') def test_maxpool_2d_default(self): # type: () -> None """ input_shape: [1, 3, 32, 32] output_shape: [1, 3, 31, 31] """ node = onnx.helper.make_node( 'MaxPool', inputs=['x'], outputs=['y'], kernel_shape=[2, 2], ) x = np.random.randn(1, 3, 32, 32).astype(np.float32) x_shape = np.shape(x) kernel_shape = (2, 2) strides = (1, 1) out_shape = get_output_shape( 'VALID', x_shape[2:], kernel_shape, strides) padded = x y = pool(padded, x_shape, kernel_shape, strides, out_shape, (0, 0), 'MAX') expect(node, inputs=[x], outputs=[y], name='test_maxpool_2d_default') def test_maxpool_2d_pads(self): # type: () -> None """ input_shape: [1, 3, 28, 28] output_shape: [1, 3, 30, 30] pad_shape: [4, 4] -> [2, 2, 2, 2] by axis """ node = onnx.helper.make_node( 'MaxPool', inputs=['x'], outputs=['y'], kernel_shape=[3, 3], pads=[2, 2, 2, 2] ) x = np.random.randn(1, 3, 28, 28).astype(np.float32) x_shape = np.shape(x) kernel_shape = (3, 3) strides = (1, 1) pad_bottom = pad_top = pad_right = pad_left = 2 pad_shape = [pad_top + pad_bottom, pad_left + pad_right] out_shape = get_output_shape('VALID', np.add( x_shape[2:], pad_shape), kernel_shape, strides) padded = np.pad(x, ((0, 0), (0, 0), (pad_top, pad_bottom), (pad_left, pad_right)), mode='constant', constant_values=np.nan) y = pool(padded, x_shape, kernel_shape, strides, out_shape, pad_shape, 'MAX') expect(node, inputs=[x], outputs=[y], name='test_maxpool_2d_pads') def test_maxpool_2d_strides(self): # type: () -> None """ input_shape: [1, 3, 32, 32] output_shape: [1, 3, 10, 10] """ node = onnx.helper.make_node( 'MaxPool', inputs=['x'], outputs=['y'], kernel_shape=[5, 5], strides=[3, 3] ) x = np.random.randn(1, 3, 32, 32).astype(np.float32) x_shape = np.shape(x) kernel_shape = (5, 5) strides = (3, 3) out_shape = get_output_shape( 'VALID', x_shape[2:], kernel_shape, strides) padded = x y = pool(padded, x_shape, kernel_shape, strides, out_shape, (0, 0), 'MAX') expect(node, inputs=[x], outputs=[y], name='test_maxpool_2d_strides') def test_reshape(self): # type: () -> None def reshape_reference_implementation(data, shape): # type: (np.ndarray, np.ndarray) -> np.ndarray # replace zeros with corresponding dim size # we need to do this because np.reshape doesn't support 0 new_shape = np.copy(shape) zeros_index = np.where(shape == 0) new_shape[zeros_index] = np.array(data.shape)[zeros_index] reshaped = np.reshape(data, new_shape) return reshaped original_shape = [2, 3, 4] test_cases = { 'reordered_all_dims': np.array([4, 2, 3], dtype=np.int64), 'reordered_last_dims': np.array([2, 4, 3], dtype=np.int64), 'reduced_dims': np.array([2, 12], dtype=np.int64), 'extended_dims': np.array([2, 3, 2, 2], dtype=np.int64), 'one_dim': np.array([24], dtype=np.int64), 'negative_dim': np.array([2, -1, 2], dtype=np.int64), 'negative_extended_dims': np.array([-1, 2, 3, 4], dtype=np.int64), 'zero_dim': np.array([2, 0, 4, 1], dtype=np.int64), 'zero_and_negative_dim': np.array([2, 0, 1, -1], dtype=np.int64), } data = np.random.random_sample(original_shape).astype(np.float32) for test_name, shape in test_cases.items(): node = onnx.helper.make_node( 'Reshape', inputs=['data', 'shape'], outputs=['reshaped'], ) reshaped = reshape_reference_implementation(data, shape) expect(node, inputs=[data, shape], outputs=[reshaped], name='test_reshape_' + test_name) def test_concat(self): # type: () -> None test_cases = { # '1d': ([1, 2], not support 1d # [3, 4]), '2d': ([[1, 2], [3, 4]], [[5, 6], [7, 8]]), '3d': ([[[1, 2], [3, 4]], [[5, 6], [7, 8]]], [[[9, 10], [11, 12]], [[13, 14], [15, 16]]]) } # type: Dict[Text, Sequence[Any]] for test_case, values_ in test_cases.items(): values = [np.asarray(v, dtype=np.float32) for v in values_] for i in range(len(values[0].shape)): in_args = ['value' + str(k) for k in range(len(values))] node = onnx.helper.make_node( 'Concat', inputs=[s for s in in_args], outputs=['output'], axis=i ) output = np.concatenate(values, i) expect(node, inputs=[v for v in values], outputs=[output], name='test_concat_' + test_case + '_axis_' + str(i)) for i in range(-len(values[0].shape), 0): in_args = ['value' + str(k) for k in range(len(values))] node = onnx.helper.make_node( 'Concat', inputs=[s for s in in_args], outputs=['output'], axis=i ) output = np.concatenate(values, i) expect(node, inputs=[v for v in values], outputs=[output], name='test_concat_' + test_case + '_axis_negative_' + str(abs(i))) def test_flatten(self): # type: () -> None shape = (2, 3, 4, 5) a = np.random.random_sample(shape).astype(np.float32) for i in range(len(shape)): node = onnx.helper.make_node( 'Flatten', inputs=['a'], outputs=['b'], axis=i, ) new_shape = ( 1, -1) if i == 0 else (np.prod(shape[0:i]).astype(int), -1) b = np.reshape(a, new_shape) expect(node, inputs=[a], outputs=[b], name='test_flatten_axis' + str(i)) def test_flatten_with_default_axis(self): # type: () -> None node = onnx.helper.make_node( 'Flatten', inputs=['a'], outputs=['b'], # Default value for axis: axis=1 ) shape = (5, 4, 3, 2) a = np.random.random_sample(shape).astype(np.float32) new_shape = (5, 24) b = np.reshape(a, new_shape) expect(node, inputs=[a], outputs=[b], name='test_flatten_default_axis') def test_flatten_negative_axis(self): # type: () -> None shape = (2, 3, 4, 5) a = np.random.random_sample(shape).astype(np.float32) for i in range(-len(shape), 0): node = onnx.helper.make_node( 'Flatten', inputs=['a'], outputs=['b'], axis=i, ) new_shape = (np.prod(shape[0:i]).astype(int), -1) b = np.reshape(a, new_shape) expect(node, inputs=[a], outputs=[b], name='test_flatten_negative_axis' + str(abs(i))) def test_add(self): # type: () -> None node = onnx.helper.make_node( 'Add', inputs=['x', 'y'], outputs=['sum'], ) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.random.randn(3, 4, 5).astype(np.float32) expect(node, inputs=[x, y], outputs=[x + y], name='test_add') def test_add_broadcast(self): # type: () -> None node = onnx.helper.make_node( 'Add', inputs=['x', 'y'], outputs=['sum'], ) # todo, we don't support 3d here x = np.random.randn(3, 4, 5).astype(np.float32) y = np.random.randn(5).astype(np.float32) expect(node, inputs=[x, y], outputs=[x + y], name='test_add_bcast') def test_sum(self): # type: () -> None data_0 = np.array([3, 0, 2]).astype(np.float32) data_1 = np.array([1, 3, 4]).astype(np.float32) data_2 = np.array([2, 6, 6]).astype(np.float32) result = np.array([6, 9, 12]).astype(np.float32) node = onnx.helper.make_node( 'Sum', inputs=['data_0', 'data_1', 'data_2'], outputs=['result'], ) expect(node, inputs=[data_0, data_1, data_2], outputs=[result], name='test_sum_example') node = onnx.helper.make_node( 'Sum', inputs=['data_0'], outputs=['result'], ) expect(node, inputs=[data_0], outputs=[data_0], name='test_sum_one_input') result = np.add(data_0, data_1) node = onnx.helper.make_node( 'Sum', inputs=['data_0', 'data_1'], outputs=['result'], ) expect(node, inputs=[data_0, data_1], outputs=[result], name='test_sum_two_inputs') def test_relu(self): # type: () -> None node = onnx.helper.make_node( 'Relu', inputs=['x'], outputs=['y'], ) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.clip(x, 0, np.inf) expect(node, inputs=[x], outputs=[y], name='test_relu') def test_sigmoid(self): # type: () -> None node = onnx.helper.make_node( 'Sigmoid', inputs=['x'], outputs=['y'], ) x = np.array([-1, 0, 1]).astype(np.float32) # expected output [0.26894143, 0.5, 0.7310586] y = 1.0 / (1.0 + np.exp(np.negative(x))) expect(node, inputs=[x], outputs=[y], name='test_sigmoid_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = 1.0 / (1.0 + np.exp(np.negative(x))) expect(node, inputs=[x], outputs=[y], name='test_sigmoid') def test_matmul(self): # type: () -> None node = onnx.helper.make_node( 'MatMul', inputs=['a', 'b'], outputs=['c'], ) # 2d a = np.random.randn(3, 4).astype(np.float32) b = np.random.randn(4, 3).astype(np.float32) c = np.matmul(a, b) expect(node, inputs=[a, b], outputs=[c], name='test_matmul_2d') # todo, # 3d not support 3d # a = np.random.randn(2, 3, 4).astype(np.float32) # b = np.random.randn(2, 4, 3).astype(np.float32) # c = np.matmul(a, b) # expect(node, inputs=[a, b], outputs=[c], # name='test_matmul_3d') # todo, # 4d not support 4d # a = np.random.randn(1, 2, 3, 4).astype(np.float32) # b = np.random.randn(1, 2, 4, 3).astype(np.float32) # c = np.matmul(a, b) # expect(node, inputs=[a, b], outputs=[c], # name='test_matmul_4d') def test_cos(self): # type: () -> None node = onnx.helper.make_node( 'Cos', inputs=['x'], outputs=['y'], ) x = np.array([-1, 0, 1]).astype(np.float32) y = np.cos(x) expect(node, inputs=[x], outputs=[y], name='test_cos_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.cos(x) expect(node, inputs=[x], outputs=[y], name='test_cos') def test_cosh(self): # type: () -> None node = onnx.helper.make_node( 'Cosh', inputs=['x'], outputs=['y'], ) x = np.array([-1, 0, 1]).astype(np.float32) y = np.cosh(x) # expected output [1.54308069, 1., 1.54308069] expect(node, inputs=[x], outputs=[y], name='test_cosh_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.cosh(x) expect(node, inputs=[x], outputs=[y], name='test_cosh') def test_Sin(self): # type: () -> None node = onnx.helper.make_node( 'Sin', inputs=['x'], outputs=['y'], ) x = np.array([-1, 0, 1]).astype(np.float32) y = np.sin(x) expect(node, inputs=[x], outputs=[y], name='test_sin_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.sin(x) expect(node, inputs=[x], outputs=[y], name='test_sin') def test_Sinh(self): # type: () -> None node = onnx.helper.make_node( 'Sinh', inputs=['x'], outputs=['y'], ) x = np.array([-1, 0, 1]).astype(np.float32) y = np.sinh(x) # expected output [-1.17520118, 0., 1.17520118] expect(node, inputs=[x], outputs=[y], name='test_sinh_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.sinh(x) expect(node, inputs=[x], outputs=[y], name='test_sinh') def test_Tan(self): # type: () -> None node = onnx.helper.make_node( 'Tan', inputs=['x'], outputs=['y'], ) x = np.array([-1, 0, 1]).astype(np.float32) y = np.tan(x) expect(node, inputs=[x], outputs=[y], name='test_tan_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.tan(x) expect(node, inputs=[x], outputs=[y], name='test_tan') def test_Tanh(self): # type: () -> None node = onnx.helper.make_node( 'Tanh', inputs=['x'], outputs=['y'], ) x = np.array([-1, 0, 1]).astype(np.float32) y = np.tanh(x) # expected output [-0.76159418, 0., 0.76159418] expect(node, inputs=[x], outputs=[y], name='test_tanh_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.tanh(x) expect(node, inputs=[x], outputs=[y], name='test_tanh') def test_Acos(self): # type: () -> None node = onnx.helper.make_node( 'Acos', inputs=['x'], outputs=['y'], ) x = np.array([-0.5, 0, 0.5]).astype(np.float32) y = np.arccos(x) expect(node, inputs=[x], outputs=[y], name='test_acos_example') x = np.random.rand(3, 4, 5).astype(np.float32) y = np.arccos(x) expect(node, inputs=[x], outputs=[y], name='test_acos') def test_Acosh(self): # type: () -> None node = onnx.helper.make_node( 'Acosh', inputs=['x'], outputs=['y'], ) x = np.array([10, np.e, 1]).astype(np.float32) y = np.arccosh(x) # expected output [2.99322295, 1.65745449, 0.] expect(node, inputs=[x], outputs=[y], name='test_acosh_example') x = np.random.uniform(1.0, 10.0, (3, 4, 5)).astype(np.float32) y = np.arccosh(x) expect(node, inputs=[x], outputs=[y], name='test_acosh') def test_Asin(self): # type: () -> None node = onnx.helper.make_node( 'Asin', inputs=['x'], outputs=['y'], ) x = np.array([-0.5, 0, 0.5]).astype(np.float32) y = np.arcsin(x) expect(node, inputs=[x], outputs=[y], name='test_asin_example') x = np.random.rand(3, 4, 5).astype(np.float32) y = np.arcsin(x) expect(node, inputs=[x], outputs=[y], name='test_asin') def test_Asinh(self): # type: () -> None node = onnx.helper.make_node( 'Asinh', inputs=['x'], outputs=['y'], ) x = np.array([-1, 0, 1]).astype(np.float32) y = np.arcsinh(x) # expected output [-0.88137358, 0., 0.88137358] expect(node, inputs=[x], outputs=[y], name='test_asinh_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.arcsinh(x) expect(node, inputs=[x], outputs=[y], name='test_asinh') def test_Atan(self): # type: () -> None node = onnx.helper.make_node( 'Atan', inputs=['x'], outputs=['y'], ) x = np.array([-1, 0, 1]).astype(np.float32) y = np.arctan(x) expect(node, inputs=[x], outputs=[y], name='test_atan_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.arctan(x) expect(node, inputs=[x], outputs=[y], name='test_atan') def test_Atanh(self): # type: () -> None node = onnx.helper.make_node( 'Atanh', inputs=['x'], outputs=['y'], ) x = np.array([-0.5, 0, 0.5]).astype(np.float32) y = np.arctanh(x) # expected output [-0.54930615, 0., 0.54930615] expect(node, inputs=[x], outputs=[y], name='test_atanh_example') x = np.random.uniform(0.0, 1.0, (3, 4, 5)).astype(np.float32) y = np.arctanh(x) expect(node, inputs=[x], outputs=[y], name='test_atanh') def test_selu(self): # type: () -> None node = onnx.helper.make_node( 'Selu', inputs=['x'], outputs=['y'], alpha=2.0, gamma=3.0 ) x = np.array([-1, 0, 1]).astype(np.float32) # expected output [-3.79272318, 0., 3.] y = np.clip(x, 0, np.inf) * 3.0 + \ (np.exp(np.clip(x, -np.inf, 0)) - 1) * 2.0 * 3.0 expect(node, inputs=[x], outputs=[y], name='test_selu_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.clip(x, 0, np.inf) * 3.0 + \ (np.exp(np.clip(x, -np.inf, 0)) - 1) * 2.0 * 3.0 expect(node, inputs=[x], outputs=[y], name='test_selu') def test_selu_default(self): # type: () -> None default_alpha = 1.67326319217681884765625 default_gamma = 1.05070102214813232421875 node = onnx.helper.make_node( 'Selu', inputs=['x'], outputs=['y'], ) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.clip(x, 0, np.inf) * default_gamma + \ (np.exp(np.clip(x, -np.inf, 0)) - 1) * default_alpha * default_gamma expect(node, inputs=[x], outputs=[y], name='test_selu_default') def test_elu(self): # type: () -> None node = onnx.helper.make_node( 'Elu', inputs=['x'], outputs=['y'], alpha=2.0 ) x = np.array([-1, 0, 1]).astype(np.float32) # expected output [-1.2642411, 0., 1.] y = np.clip(x, 0, np.inf) + (np.exp(np.clip(x, -np.inf, 0)) - 1) * 2.0 expect(node, inputs=[x], outputs=[y], name='test_elu_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.clip(x, 0, np.inf) + (np.exp(np.clip(x, -np.inf, 0)) - 1) * 2.0 expect(node, inputs=[x], outputs=[y], name='test_elu') def test_elu_default(self): # type: () -> None default_alpha = 1.0 node = onnx.helper.make_node( 'Elu', inputs=['x'], outputs=['y'], ) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.clip(x, 0, np.inf) + \ (np.exp(np.clip(x, -np.inf, 0)) - 1) * default_alpha expect(node, inputs=[x], outputs=[y], name='test_elu_default') def test_equal(self): # type: () -> None node = onnx.helper.make_node( 'Equal', inputs=['x', 'y'], outputs=['z'], ) x = (np.random.randn(3, 4, 5) * 10).astype(np.int32) y = (np.random.randn(3, 4, 5) * 10).astype(np.int32) z = np.equal(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_equal') def test_equal_broadcast(self): # type: () -> None node = onnx.helper.make_node( 'Equal', inputs=['x', 'y'], outputs=['z'], ) x = (np.random.randn(3, 4, 5) * 10).astype(np.int32) y = (np.random.randn(5) * 10).astype(np.int32) z = np.equal(x, y).astype(np.int32) # need to convert to int type expect(node, inputs=[x, y], outputs=[z], name='test_equal_bcast') def test_less(self): # type: () -> None node = onnx.helper.make_node( 'Less', inputs=['x', 'y'], outputs=['less'], ) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.random.randn(3, 4, 5).astype(np.float32) z = np.less(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_less') def test_less_broadcast(self): # type: () -> None node = onnx.helper.make_node( 'Less', inputs=['x', 'y'], outputs=['less'], ) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.random.randn(5).astype(np.float32) z = np.less(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_less_bcast') def test_sign(self): # type: () -> None node = onnx.helper.make_node( 'Sign', inputs=['x'], outputs=['y'], ) x = np.array(range(-5, 6)).astype(np.float32) y = np.sign(x) expect(node, inputs=[x], outputs=[y], name='test_sign') def test_sub(self): # type: () -> None node = onnx.helper.make_node( 'Sub', inputs=['x', 'y'], outputs=['z'], ) x = np.array([1, 2, 3]).astype(np.float32) y = np.array([3, 2, 1]).astype(np.float32) z = x - y # expected output [-2., 0., 2.] expect(node, inputs=[x, y], outputs=[z], name='test_sub_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.random.randn(3, 4, 5).astype(np.float32) z = x - y expect(node, inputs=[x, y], outputs=[z], name='test_sub') def test_sub_broadcast(self): # type: () -> None node = onnx.helper.make_node( 'Sub', inputs=['x', 'y'], outputs=['z'], ) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.random.randn(5).astype(np.float32) z = x - y expect(node, inputs=[x, y], outputs=[z], name='test_sub_bcast') def test_sqrt(self): # type: () -> None node = onnx.helper.make_node( 'Sqrt', inputs=['x'], outputs=['y'], ) x = np.array([1, 4, 9]).astype(np.float32) y = np.sqrt(x) # expected output [1., 2., 3.] expect(node, inputs=[x], outputs=[y], name='test_sqrt_example') x = np.abs(np.random.randn(3, 4, 5).astype(np.float32)) y = np.sqrt(x) expect(node, inputs=[x], outputs=[y], name='test_sqrt') def test_log(self): # type: () -> None node = onnx.helper.make_node( 'Log', inputs=['x'], outputs=['y'], ) x = np.array([1, 10]).astype(np.float32) y = np.log(x) # expected output [0., 2.30258512] expect(node, inputs=[x], outputs=[y], name='test_log_example') x = np.exp(np.random.randn(3, 4, 5).astype(np.float32)) y = np.log(x) expect(node, inputs=[x], outputs=[y], name='test_log') def test_greater(self): # type: () -> None node = onnx.helper.make_node( 'Greater', inputs=['x', 'y'], outputs=['greater'], ) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.random.randn(3, 4, 5).astype(np.float32) z = np.greater(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_greater') def test_greater_broadcast(self): # type: () -> None node = onnx.helper.make_node( 'Greater', inputs=['x', 'y'], outputs=['greater'], ) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.random.randn(5).astype(np.float32) z = np.greater(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_greater_bcast') def test_hardsigmoid(self): # type: () -> None node = onnx.helper.make_node( 'HardSigmoid', inputs=['x'], outputs=['y'], alpha=0.5, beta=0.6 ) x = np.array([-1, 0, 1]).astype(np.float32) y = np.clip(x * 0.5 + 0.6, 0, 1) # expected output [0.1, 0.6, 1.] expect(node, inputs=[x], outputs=[y], name='test_hardsigmoid_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.clip(x * 0.5 + 0.6, 0, 1) expect(node, inputs=[x], outputs=[y], name='test_hardsigmoid') def test_hardsigmoid_default(self): # type: () -> None default_alpha = 0.2 default_beta = 0.5 node = onnx.helper.make_node( 'HardSigmoid', inputs=['x'], outputs=['y'], ) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.clip(x * default_alpha + default_beta, 0, 1) expect(node, inputs=[x], outputs=[y], name='test_hardsigmoid_default') def test_identity(self): node = onnx.helper.make_node( 'Identity', inputs=['x'], outputs=['y'], ) data = np.array([[[ [1, 2], [3, 4], ]]], dtype=np.float32) expect(node, inputs=[data], outputs=[data], name='test_identity') def test_softplus(self): node = onnx.helper.make_node( 'Softplus', inputs=['x'], outputs=['y'], ) x = np.array([-1, 0, 1]).astype(np.float32) # expected output [0.31326166, 0.69314718, 1.31326163] y = np.log(np.exp(x) + 1) expect(node, inputs=[x], outputs=[y], name='test_softplus_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.log(np.exp(x) + 1) expect(node, inputs=[x], outputs=[y], name='test_softplus') def test_softsign(self): node = onnx.helper.make_node( 'Softsign', inputs=['x'], outputs=['y'], ) x = np.array([-1, 0, 1]).astype(np.float32) y = np.array([-0.5, 0, 0.5]).astype(np.float32) expect(node, inputs=[x], outputs=[y], name='test_softsign_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = x / (1 + np.abs(x)) expect(node, inputs=[x], outputs=[y], name='test_softsign') def test_mean(self): data_0 = np.array([3, 0, 2]).astype(np.float32) data_1 = np.array([1, 3, 4]).astype(np.float32) data_2 = np.array([2, 6, 6]).astype(np.float32) result = np.array([2, 3, 4]).astype(np.float32) node = onnx.helper.make_node( 'Mean', inputs=['data_0', 'data_1', 'data_2'], outputs=['result'], ) expect(node, inputs=[data_0, data_1, data_2], outputs=[result], name='test_mean_example') node = onnx.helper.make_node( 'Mean', inputs=['data_0'], outputs=['result'], ) expect(node, inputs=[data_0], outputs=[data_0], name='test_mean_one_input') result = np.divide(np.add(data_0, data_1), 2.) node = onnx.helper.make_node( 'Mean', inputs=['data_0', 'data_1'], outputs=['result'], ) expect(node, inputs=[data_0, data_1], outputs=[result], name='test_mean_two_inputs') def test_transpose_default(self): # type: () -> None shape = (2, 3, 4) data = np.random.random_sample(shape).astype(np.float32) node = onnx.helper.make_node( 'Transpose', inputs=['data'], outputs=['transposed'] ) transposed = np.transpose(data) expect(node, inputs=[data], outputs=[transposed], name='test_transpose_default') def test_transpose_all_permutations(self): # type: () -> None shape = (2, 3, 4) data = np.random.random_sample(shape).astype(np.float32) permutations = list(itertools.permutations(np.arange(len(shape)))) for i in range(len(permutations)): node = onnx.helper.make_node( 'Transpose', inputs=['data'], outputs=['transposed'], perm=permutations[i] ) transposed = np.transpose(data, permutations[i]) expect(node, inputs=[data], outputs=[transposed], name='test_transpose_all_permutations_' + str(i)) def test_max(self): data_0 = np.array([3, 2, 1]).astype(np.float32) data_1 = np.array([1, 4, 4]).astype(np.float32) data_2 = np.array([2, 5, 3]).astype(np.float32) result = np.array([3, 5, 4]).astype(np.float32) # todo, not support 3 inputs node = onnx.helper.make_node( 'Max', inputs=['data_0', 'data_1', 'data_2'], outputs=['result'], ) expect(node, inputs=[data_0, data_1, data_2], outputs=[result], name='test_max_example') # todo, not support 1 inputs node = onnx.helper.make_node( 'Max', inputs=['data_0'], outputs=['result'], ) expect(node, inputs=[data_0], outputs=[data_0], name='test_max_one_input') result = np.maximum(data_0, data_1) node = onnx.helper.make_node( 'Max', inputs=['data_0', 'data_1'], outputs=['result'], ) expect(node, inputs=[data_0, data_1], outputs=[result], name='test_max_two_inputs') def test_min(self): data_0 = np.array([3, 2, 1]).astype(np.float32) data_1 = np.array([1, 4, 4]).astype(np.float32) data_2 = np.array([2, 5, 0]).astype(np.float32) result = np.array([1, 2, 0]).astype(np.float32) node = onnx.helper.make_node( 'Min', inputs=['data_0', 'data_1', 'data_2'], outputs=['result'], ) expect(node, inputs=[data_0, data_1, data_2], outputs=[result], name='test_min_example') node = onnx.helper.make_node( 'Min', inputs=['data_0'], outputs=['result'], ) expect(node, inputs=[data_0], outputs=[data_0], name='test_min_one_input') result = np.minimum(data_0, data_1) node = onnx.helper.make_node( 'Min', inputs=['data_0', 'data_1'], outputs=['result'], ) expect(node, inputs=[data_0, data_1], outputs=[result], name='test_min_two_inputs') def test_shape(self): node = onnx.helper.make_node( 'Shape', inputs=['x'], outputs=['y'], ) x = np.array([ [1, 2, 3], [4, 5, 6], ]).astype(np.float32) y = np.array([ 2, 3, ]).astype(np.int64) expect(node, inputs=[x], outputs=[y], name='test_shape_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.array(x.shape).astype(np.int64) expect(node, inputs=[x], outputs=[y], name='test_shape') def test_and(self): # type: () -> None node = onnx.helper.make_node( 'And', inputs=['x', 'y'], outputs=['and'], ) # 2d x = (np.random.randn(3, 4) > 0).astype(np.bool) y = (np.random.randn(3, 4) > 0).astype(np.bool) z = np.logical_and(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_and2d') # 3d x = (np.random.randn(3, 4, 5) > 0).astype(np.bool) y = (np.random.randn(3, 4, 5) > 0).astype(np.bool) z = np.logical_and(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_and3d') # 4d x = (np.random.randn(3, 4, 5, 6) > 0).astype(np.bool) y = (np.random.randn(3, 4, 5, 6) > 0).astype(np.bool) z = np.logical_and(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_and4d') def test_and_broadcast(self): # type: () -> None node = onnx.helper.make_node( 'And', inputs=['x', 'y'], outputs=['and'], ) # 3d vs 1d x = (np.random.randn(3, 4, 5) > 0).astype(np.bool) y = (np.random.randn(5) > 0).astype(np.bool) z = np.logical_and(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_and_bcast3v1d') # 3d vs 2d x = (np.random.randn(3, 4, 5) > 0).astype(np.bool) y = (np.random.randn(4, 5) > 0).astype(np.bool) z = np.logical_and(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_and_bcast3v2d') # 4d vs 2d x = (np.random.randn(3, 4, 5, 6) > 0).astype(np.bool) y = (np.random.randn(5, 6) > 0).astype(np.bool) z = np.logical_and(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_and_bcast4v2d') # 4d vs 3d x = (np.random.randn(3, 4, 5, 6) > 0).astype(np.bool) y = (np.random.randn(4, 5, 6) > 0).astype(np.bool) z = np.logical_and(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_and_bcast4v3d') # 4d vs 4d x = (np.random.randn(1, 4, 1, 6) > 0).astype(np.bool) y = (np.random.randn(3, 1, 5, 6) > 0).astype(np.bool) z = np.logical_and(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_and_bcast4v4d') def test_or(self): node = onnx.helper.make_node( 'Or', inputs=['x', 'y'], outputs=['or'], ) # 2d x = (np.random.randn(3, 4) > 0).astype(np.bool) y = (np.random.randn(3, 4) > 0).astype(np.bool) z = np.logical_or(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_or2d') # 3d x = (np.random.randn(3, 4, 5) > 0).astype(np.bool) y = (np.random.randn(3, 4, 5) > 0).astype(np.bool) z = np.logical_or(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_or3d') # 4d x = (np.random.randn(3, 4, 5, 6) > 0).astype(np.bool) y = (np.random.randn(3, 4, 5, 6) > 0).astype(np.bool) z = np.logical_or(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_or4d') def test_or_broadcast(self): # type: () -> None node = onnx.helper.make_node( 'Or', inputs=['x', 'y'], outputs=['or'], ) # 3d vs 1d x = (np.random.randn(3, 4, 5) > 0).astype(np.bool) y = (np.random.randn(5) > 0).astype(np.bool) z = np.logical_or(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_or_bcast3v1d') # 3d vs 2d x = (np.random.randn(3, 4, 5) > 0).astype(np.bool) y = (np.random.randn(4, 5) > 0).astype(np.bool) z = np.logical_or(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_or_bcast3v2d') # 4d vs 2d x = (np.random.randn(3, 4, 5, 6) > 0).astype(np.bool) y = (np.random.randn(5, 6) > 0).astype(np.bool) z = np.logical_or(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_or_bcast4v2d') # 4d vs 3d x = (np.random.randn(3, 4, 5, 6) > 0).astype(np.bool) y = (np.random.randn(4, 5, 6) > 0).astype(np.bool) z = np.logical_or(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_or_bcast4v3d') # 4d vs 4d x = (np.random.randn(1, 4, 1, 6) > 0).astype(np.bool) y = (np.random.randn(3, 1, 5, 6) > 0).astype(np.bool) z = np.logical_or(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_or_bcast4v4d') def test_xor(self): # type: () -> None node = onnx.helper.make_node( 'Xor', inputs=['x', 'y'], outputs=['xor'], ) # 2d x = (np.random.randn(3, 4) > 0).astype(np.bool) y = (np.random.randn(3, 4) > 0).astype(np.bool) z = np.logical_xor(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_xor2d') # 3d x = (np.random.randn(3, 4, 5) > 0).astype(np.bool) y = (np.random.randn(3, 4, 5) > 0).astype(np.bool) z = np.logical_xor(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_xor3d') # 4d x = (np.random.randn(3, 4, 5, 6) > 0).astype(np.bool) y = (np.random.randn(3, 4, 5, 6) > 0).astype(np.bool) z = np.logical_xor(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_xor4d') def test_xor_broadcast(self): # type: () -> None node = onnx.helper.make_node( 'Xor', inputs=['x', 'y'], outputs=['xor'], ) # 3d vs 1d x = (np.random.randn(3, 4, 5) > 0).astype(np.bool) y = (np.random.randn(5) > 0).astype(np.bool) z = np.logical_xor(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_xor_bcast3v1d') # 3d vs 2d x = (np.random.randn(3, 4, 5) > 0).astype(np.bool) y = (np.random.randn(4, 5) > 0).astype(np.bool) z = np.logical_xor(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_xor_bcast3v2d') # 4d vs 2d x = (np.random.randn(3, 4, 5, 6) > 0).astype(np.bool) y = (np.random.randn(5, 6) > 0).astype(np.bool) z = np.logical_xor(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_xor_bcast4v2d') # 4d vs 3d x = (np.random.randn(3, 4, 5, 6) > 0).astype(np.bool) y = (np.random.randn(4, 5, 6) > 0).astype(np.bool) z = np.logical_xor(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_xor_bcast4v3d') # 4d vs 4d x = (np.random.randn(1, 4, 1, 6) > 0).astype(np.bool) y = (np.random.randn(3, 1, 5, 6) > 0).astype(np.bool) z = np.logical_xor(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_xor_bcast4v4d') def test_not(self): node = onnx.helper.make_node( 'Not', inputs=['x'], outputs=['not'], ) # 2d x = (np.random.randn(3, 4) > 0).astype(np.bool) expect(node, inputs=[x], outputs=[np.logical_not(x)], name='test_not_2d') # 3d x = (np.random.randn(3, 4, 5) > 0).astype(np.bool) expect(node, inputs=[x], outputs=[np.logical_not(x)], name='test_not_3d') # 4d x = (np.random.randn(3, 4, 5, 6) > 0).astype(np.bool) expect(node, inputs=[x], outputs=[np.logical_not(x)], name='test_not_4d') def test_neg(self): node = onnx.helper.make_node( 'Neg', inputs=['x'], outputs=['y'], ) x = np.array([-4, 2]).astype(np.float32) y = np.negative(x) # expected output [4., -2.], expect(node, inputs=[x], outputs=[y], name='test_neg_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.negative(x) expect(node, inputs=[x], outputs=[y], name='test_neg') def test_reciprocal(self): node = onnx.helper.make_node( 'Reciprocal', inputs=['x'], outputs=['y'], ) x = np.array([-4, 2]).astype(np.float32) y = np.reciprocal(x) # expected output [-0.25, 0.5], expect(node, inputs=[x], outputs=[y], name='test_reciprocal_example') x = np.random.rand(3, 4, 5).astype(np.float32) + 0.5 y = np.reciprocal(x) expect(node, inputs=[x], outputs=[y], name='test_reciprocal') def test_batchnorm(self): # type: () -> None # we changed this test cases # according to the paper https://arxiv.org/pdf/1502.03167.pdf def _batchnorm_test_mode(x, s, bias, mean, var, momentum=0.9, epsilon=1e-5): # type: ignore dims_x = len(x.shape) dim_ones = (1,) * (dims_x - 2) s = s.reshape(-1, *dim_ones) bias = bias.reshape(-1, *dim_ones) mean = mean.reshape(-1, *dim_ones) var = var.reshape(-1, *dim_ones) batch_m = x.mean(axis=(0, 2, 3), keepdims=True) batch_v = x.var(axis=(0, 2, 3), keepdims=True) return s * (x - batch_m) / np.sqrt(batch_v + epsilon) + bias # input size: (1, 2, 1, 3) x = np.array([[[[-1, 0, 1]], [[2, 3, 4]]]]).astype(np.float32) s = np.array([1.0, 1.5]).astype(np.float32) bias = np.array([0, 1]).astype(np.float32) mean = np.array([0, 3]).astype(np.float32) var = np.array([1, 1.5]).astype(np.float32) y = _batchnorm_test_mode(x, s, bias, mean, var).astype(np.float32) node = onnx.helper.make_node( 'BatchNormalization', inputs=['x', 's', 'bias', 'mean', 'var'], outputs=['y'], ) # output size: (1, 2, 1, 3) expect(node, inputs=[x, s, bias, mean, var], outputs=[y], name='test_batchnorm_example') # input size: (2, 3, 4, 5) x = np.random.randn(2, 3, 4, 5).astype(np.float32) s = np.random.randn(3).astype(np.float32) bias = np.random.randn(3).astype(np.float32) mean = np.random.randn(3).astype(np.float32) var = np.random.rand(3).astype(np.float32) epsilon = 1e-2 y = _batchnorm_test_mode( x, s, bias, mean, var, epsilon).astype(np.float32) node = onnx.helper.make_node( 'BatchNormalization', inputs=['x', 's', 'bias', 'mean', 'var'], outputs=['y'], epsilon=epsilon, ) # output size: (2, 3, 4, 5) expect(node, inputs=[x, s, bias, mean, var], outputs=[y], name='test_batchnorm_epsilon') def test_softmax(self): # type: () -> None node = onnx.helper.make_node( 'Softmax', inputs=['x'], outputs=['y'], ) x = np.array([[-1, 0, 1]]).astype(np.float32) # expected output [[0.09003058, 0.24472848, 0.66524094]] y = np.exp(x) / np.sum(np.exp(x), axis=1) expect(node, inputs=[x], outputs=[y], name='test_softmax_example') def test_softmax_axis(self): # type: () -> None def softmax_2d(x): # type: (np.ndarray) -> np.ndarray max_x = np.max(x, axis=1).reshape((-1, 1)) exp_x = np.exp(x - max_x) return exp_x / np.sum(exp_x, axis=1).reshape((-1, 1)) x = np.array([[0, 1, 2, 3], [10000, 10001, 10002, 10003]]).astype(np.float32) # expected output [[0.0320586, 0.08714432, 0.23688284, 0.64391428], # [0.0320586, 0.08714432, 0.23688284, 0.64391428]] y = softmax_2d(x) node = onnx.helper.make_node( 'Softmax', inputs=['x'], outputs=['y'], ) expect(node, inputs=[x], outputs=[y], name='test_softmax_large_number') x = np.abs(np.random.randn(3, 4, 5).astype(np.float32)) node = onnx.helper.make_node( 'Softmax', inputs=['x'], outputs=['y'], axis=0, ) y = softmax_2d(x.reshape(1, 60)).reshape(3, 4, 5) expect(node, inputs=[x], outputs=[y], name='test_softmax_axis_0') node = onnx.helper.make_node( 'Softmax', inputs=['x'], outputs=['y'], axis=1, ) y = softmax_2d(x.reshape(3, 20)).reshape(3, 4, 5) expect(node, inputs=[x], outputs=[y], name='test_softmax_axis_1') # default axis is 1 node = onnx.helper.make_node( 'Softmax', inputs=['x'], outputs=['y'], ) expect(node, inputs=[x], outputs=[y], name='test_softmax_default_axis') node = onnx.helper.make_node( 'Softmax', inputs=['x'], outputs=['y'], axis=2, ) y = softmax_2d(x.reshape(12, 5)).reshape(3, 4, 5) expect(node, inputs=[x], outputs=[y], name='test_softmax_axis_2') node = onnx.helper.make_node( 'Softmax', inputs=['x'], outputs=['y'], axis=-1, ) y = softmax_2d(x.reshape(12, 5)).reshape(3, 4, 5) expect(node, inputs=[x], outputs=[y], name='test_softmax_negative_axis') def test_div(self): # type: () -> None node = onnx.helper.make_node( 'Div', inputs=['x', 'y'], outputs=['z'], ) x = np.array([3, 4]).astype(np.float32) y = np.array([1, 2]).astype(np.float32) z = x / y # expected output [3., 2.] expect(node, inputs=[x, y], outputs=[z], name='test_div_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.random.rand(3, 4, 5).astype(np.float32) + 1.0 z = x / y expect(node, inputs=[x, y], outputs=[z], name='test_div') def test_div_broadcast(self): # type: () -> None node = onnx.helper.make_node( 'Div', inputs=['x', 'y'], outputs=['z'], ) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.random.rand(5).astype(np.float32) + 1.0 z = x / y expect(node, inputs=[x, y], outputs=[z], name='test_div_bcast') def test_pow(self): node = onnx.helper.make_node( 'Pow', inputs=['x', 'y'], outputs=['z'], ) x = np.array([1, 2, 3]).astype(np.float32) y = np.array([4, 5, 6]).astype(np.float32) # todo, not exactly same z = np.power(x, y) # expected output [1., 32., 729.] expect(node, inputs=[x, y], outputs=[z], name='test_pow_example') x = np.arange(24).reshape(2, 3, 4).astype( np.float32) # todo, cannot too big here y = np.random.randn(2, 3, 4).astype(np.float32) z = np.power(x, y) expect(node, inputs=[x, y], outputs=[z], name='test_pow') def test_pow_broadcast(self): # type: () -> None node = onnx.helper.make_node( 'Pow', inputs=['x', 'y'], outputs=['z'], ) x = np.array([1, 2, 3]).astype(np.float32) y = np.array(2).astype(np.float32) z = np.power(x, y) # expected output [1., 4., 9.] expect(node, inputs=[x, y], outputs=[z], name='test_pow_bcast_scalar') node = onnx.helper.make_node( 'Pow', inputs=['x', 'y'], outputs=['z'], ) x = np.array([[1, 2, 3], [4, 5, 6]]).astype(np.float32) y = np.array([1, 2, 3]).astype(np.float32) # expected output [[1, 4, 27], [4, 25, 216]] z = np.power(x, y).astype(np.float32) expect(node, inputs=[x, y], outputs=[z], name='test_pow_bcast_array') def test_clip(self): node = onnx.helper.make_node( 'Clip', inputs=['x', 'min', 'max'], outputs=['y'], ) x = np.array([-2, 0, 2]).astype(np.float32) min_val = np.float32(-1) max_val = np.float32(1) y = np.clip(x, min_val, max_val) # expected output [-1., 0., 1.] expect(node, inputs=[x, min_val, max_val], outputs=[y], name='test_clip_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.clip(x, min_val, max_val) expect(node, inputs=[x, min_val, max_val], outputs=[y], name='test_clip') node = onnx.helper.make_node( 'Clip', inputs=['x', 'min', 'max'], outputs=['y'], ) min_val = np.float32(-5) max_val = np.float32(5) x = np.array([-1, 0, 1]).astype(np.float32) y = np.array([-1, 0, 1]).astype(np.float32) expect(node, inputs=[x, min_val, max_val], outputs=[y], name='test_clip_inbounds') x = np.array([-6, 0, 6]).astype(np.float32) y = np.array([-5, 0, 5]).astype(np.float32) expect(node, inputs=[x, min_val, max_val], outputs=[y], name='test_clip_outbounds') x = np.array([-1, 0, 6]).astype(np.float32) y = np.array([-1, 0, 5]).astype(np.float32) expect(node, inputs=[x, min_val, max_val], outputs=[y], name='test_clip_splitbounds') def test_clip_default(self): # type: () -> None node = onnx.helper.make_node( 'Clip', inputs=['x', 'min'], outputs=['y'], ) min_val = np.float32(0) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.clip(x, min_val, np.inf) expect(node, inputs=[x, min_val], outputs=[y], name='test_clip_default_min') no_min = "" # optional input, not supplied node = onnx.helper.make_node( 'Clip', inputs=['x', no_min, 'max'], outputs=['y'], ) max_val = np.float32(0) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.clip(x, -np.inf, max_val) expect(node, inputs=[x, max_val], outputs=[y], name='test_clip_default_max') no_max = "" # optional input, not supplied node = onnx.helper.make_node( 'Clip', inputs=['x', no_min, no_max], outputs=['y'], ) x = np.array([-1, 0, 1]).astype(np.float32) y = np.array([-1, 0, 1]).astype(np.float32) expect(node, inputs=[x], outputs=[y], name='test_clip_default_inbounds') def test_prelu(self): node = onnx.helper.make_node( 'PRelu', inputs=['x', 'slope'], outputs=['y'], ) x = np.random.randn(3, 4, 5).astype(np.float32) slope = np.random.randn(3, 4, 5).astype(np.float32) y = np.clip(x, 0, np.inf) + np.clip(x, -np.inf, 0) * slope expect(node, inputs=[x, slope], outputs=[y], name='test_prelu_example') #todo, not support prelu broadcast def test_prelu_broadcast(self): # type: () -> None node = onnx.helper.make_node( 'PRelu', inputs=['x', 'slope'], outputs=['y'], ) x = np.random.randn(3, 4, 5).astype(np.float32) slope = np.random.randn(5).astype(np.float32) y = np.clip(x, 0, np.inf) + np.clip(x, -np.inf, 0) * slope expect(node, inputs=[x, slope], outputs=[y], name='test_prelu_broadcast') def test_mul(self): node = onnx.helper.make_node( 'Mul', inputs=['x', 'y'], outputs=['z'], ) x = np.array([1, 2, 3]).astype(np.float32) y = np.array([4, 5, 6]).astype(np.float32) z = x * y # expected output [4., 10., 18.] expect(node, inputs=[x, y], outputs=[z], name='test_mul_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.random.randn(3, 4, 5).astype(np.float32) z = x * y expect(node, inputs=[x, y], outputs=[z], name='test_mul') def test_mul_broadcast(self): # type: () -> None node = onnx.helper.make_node( 'Mul', inputs=['x', 'y'], outputs=['z'], ) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.random.randn(5).astype(np.float32) z = x * y expect(node, inputs=[x, y], outputs=[z], name='test_mul_bcast') # return padding shape of conv2d or pooling def get_pad_shape(auto_pad, # type: Text input_spatial_shape, # type: Sequence[int] kernel_spatial_shape, # type: Sequence[int] strides_spatial, # type: Sequence[int] output_spatial_shape # type: Sequence[int] ): # type: (...) -> Sequence[int] pad_shape = [0] * len(input_spatial_shape) if auto_pad in ('SAME_UPPER', 'SAME_LOWER'): for i in range(len(input_spatial_shape)): pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial[i] + \ kernel_spatial_shape[i] - input_spatial_shape[i] elif auto_pad == 'VALID': pass return pad_shape # return output shape of conv2d or pooling def get_output_shape(auto_pad, # type: Text input_spatial_shape, # type: Sequence[int] kernel_spatial_shape, # type: Sequence[int] strides_spatial # type: Sequence[int] ): # type: (...) -> Sequence[int] out_shape = [0] * len(input_spatial_shape) if auto_pad in ('SAME_UPPER', 'SAME_LOWER'): for i in range(len(input_spatial_shape)): out_shape[i] = int( np.ceil( float( input_spatial_shape[i]) / float( strides_spatial[i]))) elif auto_pad == 'VALID': for i in range(len(input_spatial_shape)): out_shape[i] = int(np.ceil(float( input_spatial_shape[i] - (kernel_spatial_shape[i] - 1)) / float(strides_spatial[i]))) return out_shape def pool(padded, # type: np.ndarray x_shape, # type: Sequence[int] kernel_shape, # type: Sequence[int] strides_shape, # type: Sequence[int] out_shape, # type: Sequence[int] pad_shape, # type: Sequence[int] pooling_type, # type: Text count_include_pad=0 # type: int ): # type: (...) -> np.ndarray spatial_size = len(x_shape) - 2 y = np.zeros([x_shape[0], x_shape[1]] + list(out_shape)) for shape in itertools.product(range(x_shape[0]), range(x_shape[1]), *[range(int( (x_shape[i + 2] + pad_shape[i] - kernel_shape[i]) / strides_shape[i] + 1)) for i in range(spatial_size)]): window = padded[shape[0], shape[1]] window_vals = np.array([window[i] for i in list( itertools.product( *[range(strides_shape[i] * shape[i + 2], strides_shape[i] * shape[i + 2] + kernel_shape[i]) for i in range(spatial_size)]) )]) if pooling_type == 'AVG': f = np.average elif pooling_type == 'MAX': f = np.max else: raise NotImplementedError( 'Pooling type {} does not support. Should be AVG, MAX'.format(pooling_type)) if count_include_pad == 1 and pooling_type == 'AVG': y[shape] = f(window_vals) else: y[shape] = f(window_vals[np.where(~np.isnan(window_vals))]) return y.astype(np.float32) if __name__ == '__main__': unittest.main()
34.473684
118
0.482389
9,646
74,015
3.580448
0.052353
0.056287
0.07948
0.064974
0.795582
0.764456
0.7311
0.712685
0.674494
0.628891
0
0.067725
0.347254
74,015
2,146
119
34.489748
0.647134
0.093927
0
0.589517
0
0
0.065293
0.016508
0
0
0
0.000466
0.000589
1
0.055359
false
0.000589
0.007656
0
0.067138
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
7ec5a880c33141d23f12626836a070f9e6fb3272
1,072
py
Python
articulos.py
feedesa/MyPythonScripts
66f06f9d44ea6c76cfadb1a620bb468176beefe0
[ "MIT" ]
null
null
null
articulos.py
feedesa/MyPythonScripts
66f06f9d44ea6c76cfadb1a620bb468176beefe0
[ "MIT" ]
null
null
null
articulos.py
feedesa/MyPythonScripts
66f06f9d44ea6c76cfadb1a620bb468176beefe0
[ "MIT" ]
null
null
null
import pymysql print ( dir( pymysql) ) ''' class Articulos(): def abrir(self): conexion=mysql.connector.connect(host="localhost", user="root", passwd="", database="ejemplo1") return conexion def alta(self, datos): cone=self.abrir() cursor=cone.cursor() sql="insert into articulos(descripcion, precio) values (%s,%s)" cursor.execute(sql, datos) cone.commit() cone.close() def consulta(self, datos): cone=self.abrir() cursor=cone.cursor() sql="select descripcion, precio from articulos where codigo=%s" cursor.execute(sql, datos) cone.close() return cursor.fetchall() def recuperar_todos(self): cone=self.abrir() cursor=cone.cursor() sql="select codigo, descripcion, precio from articulos" cursor.execute(sql) cone.close() return cursor.fetchall() '''
28.210526
71
0.525187
103
1,072
5.456311
0.417476
0.064057
0.069395
0.101423
0.412811
0.316726
0.224199
0.224199
0.145907
0
0
0.00146
0.361007
1,072
38
72
28.210526
0.818978
0
0
0
0
0
0
0
0
0
0
0.026316
0
1
0
true
0
0.5
0
0.5
0.5
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
1
0
1
0
0
1
0
4
7ee409c98b43e14356dab6c38af28273d01280ec
342
py
Python
tests/test_utils_ipython.py
rahulraj80/ipyexperiments
08a91ef6d7480dae90951e55754a2712de9c335b
[ "Apache-2.0" ]
null
null
null
tests/test_utils_ipython.py
rahulraj80/ipyexperiments
08a91ef6d7480dae90951e55754a2712de9c335b
[ "Apache-2.0" ]
null
null
null
tests/test_utils_ipython.py
rahulraj80/ipyexperiments
08a91ef6d7480dae90951e55754a2712de9c335b
[ "Apache-2.0" ]
null
null
null
import pytest from ipyexperiments.utils.ipython import * # at the moment just a syntax check, the test would be useless w/o ipython env @ipython_tb_clear_frames def do_something(): return True def test_decorator(): assert do_something() is True, "decorator test" def test_ctx(): with ipython_tb_clear_frames_ctx(): x = 10
22.8
78
0.745614
53
342
4.603774
0.660377
0.07377
0.114754
0.163934
0
0
0
0
0
0
0
0.007143
0.181287
342
14
79
24.428571
0.864286
0.222222
0
0
0
0
0.05303
0
0
0
0
0
0.111111
1
0.333333
false
0
0.222222
0.111111
0.555556
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
7ef8d13c454038d170cd25f7de91dc4e8f8b9261
308
py
Python
src/Cell.py
Konstantysz/ultimate-sudoku
fe69a2fbf662868af666641dc3bd4494fb6b9189
[ "MIT" ]
null
null
null
src/Cell.py
Konstantysz/ultimate-sudoku
fe69a2fbf662868af666641dc3bd4494fb6b9189
[ "MIT" ]
1
2021-10-12T17:35:17.000Z
2021-10-12T17:35:17.000Z
src/Cell.py
Konstantysz/ultimate-sudoku
fe69a2fbf662868af666641dc3bd4494fb6b9189
[ "MIT" ]
null
null
null
class Cell: # default constructor def __init__(self, value): self._clicked = False self._value = value def get_value(self): return self._value def get_clicked(self): return self._clicked def set_clicked(self, clicked): self._clicked = clicked
19.25
35
0.62013
36
308
4.972222
0.361111
0.24581
0.122905
0
0
0
0
0
0
0
0
0
0.301948
308
15
36
20.533333
0.832558
0.061688
0
0
0
0
0
0
0
0
0
0
0
1
0.4
false
0
0
0.2
0.7
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
7d1559e66dfebcd4eb4c543636ce0bf243f51586
138
py
Python
taggit_helpers/apps.py
moas/django-taggit-helpers
963de3ab91f381343c4d3cb51e15ad09c52df22d
[ "BSD-3-Clause" ]
43
2015-06-11T18:29:21.000Z
2021-11-14T06:55:14.000Z
taggit_helpers/apps.py
moas/django-taggit-helpers
963de3ab91f381343c4d3cb51e15ad09c52df22d
[ "BSD-3-Clause" ]
4
2015-11-30T19:00:40.000Z
2020-06-27T05:25:58.000Z
taggit_helpers/apps.py
moas/django-taggit-helpers
963de3ab91f381343c4d3cb51e15ad09c52df22d
[ "BSD-3-Clause" ]
9
2015-11-12T11:09:56.000Z
2020-12-30T14:35:40.000Z
from django.apps import AppConfig class TaggitHelpersConfig(AppConfig): name = 'taggit_helpers' verbose_name = 'Taggit Helpers'
19.714286
37
0.76087
15
138
6.866667
0.733333
0.194175
0.330097
0
0
0
0
0
0
0
0
0
0.166667
138
6
38
23
0.895652
0
0
0
0
0
0.202899
0
0
0
0
0
0
1
0
false
0
0.25
0
1
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
7d1c433fdb231b2a1208809068d1060aff90a89c
636
py
Python
src/insert.py
pointThink/PyText
f036706cbb5d22d0c9f3d4a978ced7b2878d164a
[ "Unlicense" ]
null
null
null
src/insert.py
pointThink/PyText
f036706cbb5d22d0c9f3d4a978ced7b2878d164a
[ "Unlicense" ]
null
null
null
src/insert.py
pointThink/PyText
f036706cbb5d22d0c9f3d4a978ced7b2878d164a
[ "Unlicense" ]
null
null
null
from tkinter import * class Insert: text: Text def __init__(self, text_box): self.text = text_box def insert(self, symbol): index = self.text.index('insert') self.text.insert(INSERT, symbol) self.text.mark_set(INSERT, index) # Braces def round_brace(self, event): self.insert(')') def square_brace(self, event): self.insert(']') def curly_brace(self, event): self.insert(']') # Quotes def quote_double(self, event): self.insert('\"') def quote_single(self, event): self.insert('\'')
19.875
42
0.551887
73
636
4.643836
0.328767
0.117994
0.19174
0.280236
0.294985
0.159292
0
0
0
0
0
0
0.316038
636
31
43
20.516129
0.77931
0.02044
0
0.105263
0
0
0.020374
0
0
0
0
0
0
1
0.368421
false
0
0.052632
0
0.526316
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
7d2fe2bc3e38fef89fae2ff50cd91cee70c2206d
33
py
Python
deepmars/data/__init__.py
utplanets/deepmars
ba306aa9b25b654636b61cf952af2791b7ed0e56
[ "MIT" ]
2
2021-08-08T03:06:58.000Z
2021-11-25T04:06:00.000Z
deepmars/data/__init__.py
utplanets/deepmars
ba306aa9b25b654636b61cf952af2791b7ed0e56
[ "MIT" ]
null
null
null
deepmars/data/__init__.py
utplanets/deepmars
ba306aa9b25b654636b61cf952af2791b7ed0e56
[ "MIT" ]
2
2020-11-23T09:38:26.000Z
2021-02-26T01:14:28.000Z
'''DeepMars data manipulation'''
16.5
32
0.727273
3
33
8
1
0
0
0
0
0
0
0
0
0
0
0
0.090909
33
1
33
33
0.8
0.787879
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
adac63f0d7bc76868063472d6d20d6aae380bcf7
33
py
Python
thermo-env/lib/python3.5/linecache.py
ndebuhr/thermoModelingAlpha
9e1a0f9ac4caabf386c1e3103ec69f269131a6b9
[ "MIT" ]
4
2017-09-24T21:30:46.000Z
2019-06-01T13:37:44.000Z
thermo-env/lib/python3.5/linecache.py
ndebuhr/thermo-state-solver
9e1a0f9ac4caabf386c1e3103ec69f269131a6b9
[ "MIT" ]
19
2020-01-28T21:41:50.000Z
2022-03-11T23:17:39.000Z
thermo-env/lib/python3.5/linecache.py
ndebuhr/thermo-state-solver
9e1a0f9ac4caabf386c1e3103ec69f269131a6b9
[ "MIT" ]
null
null
null
/usr/lib64/python3.5/linecache.py
33
33
0.818182
6
33
4.5
1
0
0
0
0
0
0
0
0
0
0
0.121212
0
33
1
33
33
0.69697
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
adc09d5e8a4e021e2bc507bdbd2b93c498b90a1e
2,116
py
Python
tests/test_es2json_basicfunctions.py
slub/es2json
be22a193c615043693d580ff73f89adf4c0fe8f1
[ "Apache-2.0" ]
null
null
null
tests/test_es2json_basicfunctions.py
slub/es2json
be22a193c615043693d580ff73f89adf4c0fe8f1
[ "Apache-2.0" ]
1
2020-12-08T09:51:42.000Z
2020-12-08T09:51:42.000Z
tests/test_es2json_basicfunctions.py
slub/es2json
be22a193c615043693d580ff73f89adf4c0fe8f1
[ "Apache-2.0" ]
null
null
null
import es2json import uuid def test_litter(): assert es2json.litter("foo", "bar") == ["foo", "bar"] assert es2json.litter(["foo", "bar"], "baz") == ["foo", "bar", "baz"] assert es2json.litter("baz", ["foo", "bar"]) == ["baz", "foo", "bar"] assert es2json.litter(None, ["foo", "bar", "baz"]) == ["foo", "bar", "baz"] assert es2json.litter(["foo", "foobar"], ["bar", "baz"]) == ["foo", "foobar", "bar", "baz"] assert es2json.litter(["foo", "foobar", "bar"], ["bar", "baz"]) == ["foo", "foobar", "bar", "baz"] def test_isint(): assert es2json.isint("2") assert es2json.isint("2.5") is False assert es2json.isint(2) assert es2json.isint({"This is": "a dict"}) is False assert es2json.isint(["this", "is", "a", "list"]) is False def test_isfloat(): assert es2json.isfloat("2") assert es2json.isfloat("2.5") assert es2json.isfloat(2) assert es2json.isfloat({"This is": "a dict"}) is False assert es2json.isfloat(["this", "is", "a", "list"]) is False def test_isiter(): assert es2json.isiter("2") assert es2json.isiter("2.5") assert es2json.isiter(2) is False assert es2json.isiter({"This is": "a dict"}) assert es2json.isiter(["this", "is", "a", "list"]) def test_isfile(): assert es2json.isfile("tests/test_es2json_basicfunctions.py") assert es2json.isfile("es2json/es2json.py") assert es2json.isfile("tests/test_es2json.py_basicfunctions"+str(uuid.uuid4())) is False def test_ArrayOrSingleValue(): assert es2json.ArrayOrSingleValue(2) == 2 assert es2json.ArrayOrSingleValue([2]) == 2 assert es2json.ArrayOrSingleValue([1, 2]) == [1, 2] assert es2json.ArrayOrSingleValue("abc") == "abc" assert es2json.ArrayOrSingleValue(["abc"]) == "abc" assert es2json.ArrayOrSingleValue(["abc", "def"]) == ["abc", "def"] assert es2json.ArrayOrSingleValue([{"foo": "bar"}]) == {"foo": "bar"} assert es2json.ArrayOrSingleValue([{"foo": "bar"}, {"bar": "foo"}]) == [{"foo": "bar"}, {"bar": "foo"}] assert es2json.ArrayOrSingleValue({}) is None assert es2json.ArrayOrSingleValue([]) is None
38.472727
107
0.624291
262
2,116
5.003817
0.122137
0.337147
0.236461
0.067124
0.768879
0.620137
0.454615
0.335622
0.138825
0
0
0.033708
0.15879
2,116
54
108
39.185185
0.702809
0
0
0
0
0
0.17155
0.034026
0
0
0
0
0.809524
1
0.142857
true
0
0.047619
0
0.190476
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
1
0
0
0
0
0
0
4
adcb24e52f7c636d16eeb1b31ddd7ed71357ee16
1,502
py
Python
algortimoGA/helper.py
lsbloo/GeradorHorariosUfpb
599db5ca382424dfc05fad039880b4717612ac44
[ "MIT" ]
6
2020-08-04T13:12:42.000Z
2020-08-16T13:26:19.000Z
algortimoGA/helper.py
lsbloo/GeradorHorariosUfpb
599db5ca382424dfc05fad039880b4717612ac44
[ "MIT" ]
null
null
null
algortimoGA/helper.py
lsbloo/GeradorHorariosUfpb
599db5ca382424dfc05fad039880b4717612ac44
[ "MIT" ]
null
null
null
def helpy(): print('Olá.') print() print('Aqui segue as informações detalhadas sobre cada comando da ferramenta.') print('OBS: No primeiro uso da ferramenta é necessario executar o comando 0 e 1. Uma vez importado os arquivos não sera necessário executar novamente o comando 1, lembre-se de sempre deixar o servidor rodando. ;] ') print() print('Comando 0: python3 initserver.py ') print(" -> Inicia o servidor da aplicação em modo escuta, aconselhavel rodar em um bash diferente, o servidor é necessario para importação dos arquivos e execução do algoritmo genético.") print() print('Comando 1: python3 main.py import disciplines.csv horarios.csv salas.csv') print(" -> Realiza a importação dos arquivos listados acima, defina a variavel de ambiente SERVER_SAVE_DIRECTORY de diretorio padrão e coloque seus arquivos lá, de acordo com os seus respectivos nomes e sequência") print() print('Comando 2: python3 main.py -i 100 -g 500 -m 0.10 -c 2') print(" -> Executa o algoritmo genético, é necessario importar os arquivos e carregar as configurações") print(" -> Configurações: (i = Número de individuos,g = Número de gerações,m = taxa de mutação,c = cruzamento)") print(" -> Ao final da execução será exportado o melhor quadro gerado, como também o gráfico de acompanhamento de valores e um arquivo .txt com informações do tempo de execução dada as configurações.") print() print()
75.1
228
0.708389
214
1,502
4.962617
0.565421
0.047081
0.048023
0
0
0
0
0
0
0
0
0.01617
0.21771
1,502
19
229
79.052632
0.88766
0
0
0.333333
0
0.333333
0.840773
0.013991
0
0
0
0
0
1
0.055556
true
0
0.277778
0
0.333333
0.944444
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
4
adcc52421e60daf127b774cd1f1e2238a6434957
110
py
Python
hubcare/metrics/pull_request_metrics/acceptance_quality/apps.py
aleronupe/2019.1-hubcare-api
3f031eac9559a10fdcf70a88ee4c548cf93e4ac2
[ "MIT" ]
7
2019-03-31T17:58:45.000Z
2020-02-29T22:44:27.000Z
hubcare/metrics/pull_request_metrics/acceptance_quality/apps.py
aleronupe/2019.1-hubcare-api
3f031eac9559a10fdcf70a88ee4c548cf93e4ac2
[ "MIT" ]
90
2019-03-26T01:14:54.000Z
2021-06-10T21:30:25.000Z
hubcare/metrics/pull_request_metrics/acceptance_quality/apps.py
aleronupe/2019.1-hubcare-api
3f031eac9559a10fdcf70a88ee4c548cf93e4ac2
[ "MIT" ]
null
null
null
from django.apps import AppConfig class AcceptanceQualityConfig(AppConfig): name = 'acceptance_quality'
18.333333
41
0.8
11
110
7.909091
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.136364
110
5
42
22
0.915789
0
0
0
0
0
0.163636
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
bc0d3000d3e0ee117d4e0320b341bfa418cc7212
722
py
Python
gym/rock_base.py
nisarkhanatwork/rocksample_deeprl
ef51b0234601ccb450aaf4b9ccfc6fbdc0c4cf20
[ "MIT" ]
null
null
null
gym/rock_base.py
nisarkhanatwork/rocksample_deeprl
ef51b0234601ccb450aaf4b9ccfc6fbdc0c4cf20
[ "MIT" ]
null
null
null
gym/rock_base.py
nisarkhanatwork/rocksample_deeprl
ef51b0234601ccb450aaf4b9ccfc6fbdc0c4cf20
[ "MIT" ]
null
null
null
from copy import deepcopy class BaseSimulator: def __init__(self): self.state = None def step(self, action): self.state, r, t, rtup, etup = self.simulate(self.state, action) return deepcopy(self.state), r, t, rtup, etup def reset(self): raise NotImplementedError def render(self): raise NotImplementedError @staticmethod def simulate(state, action): raise NotImplementedError @staticmethod def rollout(state, action, use_heuristics=True): raise NotImplementedError @staticmethod def tensor_shape(): raise NotImplementedError @staticmethod def state_to_tensor(state): raise NotImplementedError
21.878788
72
0.66482
76
722
6.210526
0.407895
0.305085
0.305085
0.330508
0.080508
0.080508
0
0
0
0
0
0
0.260388
722
32
73
22.5625
0.883895
0
0
0.434783
0
0
0
0
0
0
0
0
0
1
0.347826
false
0
0.043478
0
0.478261
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
1
0
0
0
0
0
0
0
4
bc136d19625a098c7d94519c6e76aa459462e53a
259
py
Python
MontySlackBot/models.py
nelliesnoodles/my-first-blog
e552ea38891ebe005316487ae32a324659ad6367
[ "MIT" ]
null
null
null
MontySlackBot/models.py
nelliesnoodles/my-first-blog
e552ea38891ebe005316487ae32a324659ad6367
[ "MIT" ]
5
2019-12-13T17:37:55.000Z
2021-06-10T20:59:32.000Z
MontySlackBot/models.py
nelliesnoodles/My-Website
e552ea38891ebe005316487ae32a324659ad6367
[ "MIT" ]
null
null
null
from django.db import models class Team(models.Model): name = models.CharField(max_length=200) team_id = models.CharField(max_length=20) bot_user_id = models.CharField(max_length=20) bot_access_token = models.CharField(max_length=100)
32.375
55
0.741313
38
259
4.815789
0.526316
0.327869
0.393443
0.52459
0.338798
0.338798
0.338798
0
0
0
0
0.046083
0.162162
259
8
55
32.375
0.797235
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.166667
0
1
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
bc202bfd6fc190caaa7e2020d7d39466d85bb1a8
69
py
Python
TODO.py
avplugarev/NB
8b63c2a24fd19dab6870257dfb4095fa0d828f18
[ "MIT" ]
null
null
null
TODO.py
avplugarev/NB
8b63c2a24fd19dab6870257dfb4095fa0d828f18
[ "MIT" ]
null
null
null
TODO.py
avplugarev/NB
8b63c2a24fd19dab6870257dfb4095fa0d828f18
[ "MIT" ]
null
null
null
""" 12 добавить в проект файл с описанием проекта и зависимостей """
17.25
60
0.73913
10
69
5.1
1
0
0
0
0
0
0
0
0
0
0
0.035088
0.173913
69
4
61
17.25
0.859649
0.869565
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
bc283eefb95db1a01cc3d9543941527a9d8b124f
392
py
Python
tests/test_leylab_pipelines.py
leylabmpi/leylab_pipelines
1c94b2ba55d877c489143a105c72c963e1e9ce51
[ "MIT" ]
null
null
null
tests/test_leylab_pipelines.py
leylabmpi/leylab_pipelines
1c94b2ba55d877c489143a105c72c963e1e9ce51
[ "MIT" ]
null
null
null
tests/test_leylab_pipelines.py
leylabmpi/leylab_pipelines
1c94b2ba55d877c489143a105c72c963e1e9ce51
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_leylab_pipelines ---------------------------------- Tests for `leylab_pipelines` module. """ import sys import unittest from leylab_pipelines import leylab_pipelines class TestLeylab_pipelines(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_someting(self): pass
13.517241
46
0.614796
43
392
5.44186
0.604651
0.25641
0.094017
0
0
0
0
0
0
0
0
0.003215
0.206633
392
28
47
14
0.749196
0.34949
0
0.3
0
0
0
0
0
0
0
0
0
1
0.3
false
0.3
0.3
0
0.7
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
4
bc28dba8b267a1c38a202668f47a7b57c5a05fd4
3,355
py
Python
config/about/migrations/0004_auto_20210627_0451.py
Gregory124124/ignatovich-main
f9bc93a40ae954eaf785880e0aae133561d4e1cd
[ "MIT" ]
null
null
null
config/about/migrations/0004_auto_20210627_0451.py
Gregory124124/ignatovich-main
f9bc93a40ae954eaf785880e0aae133561d4e1cd
[ "MIT" ]
null
null
null
config/about/migrations/0004_auto_20210627_0451.py
Gregory124124/ignatovich-main
f9bc93a40ae954eaf785880e0aae133561d4e1cd
[ "MIT" ]
null
null
null
# Generated by Django 3.1.7 on 2021-06-27 01:51 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('about', '0003_auto_20210626_1346'), ] operations = [ migrations.AlterModelOptions( name='about', options={'verbose_name': 'О нас', 'verbose_name_plural': 'О нас'}, ), migrations.AlterModelOptions( name='galeryphoto', options={'verbose_name': 'Фотография из галереи', 'verbose_name_plural': 'Фотографии из галереи'}, ), migrations.AlterField( model_name='about', name='about_image', field=models.ImageField(upload_to='about/', verbose_name='Изображение библиотеки'), ), migrations.AlterField( model_name='about', name='image_1', field=models.ImageField(upload_to='about/', verbose_name='Изображение 1'), ), migrations.AlterField( model_name='about', name='image_2', field=models.ImageField(upload_to='about/', verbose_name='Изображение 2'), ), migrations.AlterField( model_name='about', name='image_3', field=models.ImageField(upload_to='about', verbose_name='Изображение 3'), ), migrations.AlterField( model_name='about', name='image_4', field=models.ImageField(upload_to='about/', verbose_name='Изображение 4'), ), migrations.AlterField( model_name='about', name='image_5', field=models.ImageField(upload_to='about/', verbose_name='Изображение 5'), ), migrations.AlterField( model_name='about', name='image_6', field=models.ImageField(upload_to='about/', verbose_name='Изображение 6'), ), migrations.AlterField( model_name='about', name='image_7', field=models.ImageField(upload_to='about/', verbose_name='Изображение 7'), ), migrations.AlterField( model_name='about', name='image_8', field=models.ImageField(upload_to='about/', verbose_name='Изображение 8'), ), migrations.AlterField( model_name='about', name='text_1', field=models.TextField(verbose_name='История библиотеки 1'), ), migrations.AlterField( model_name='about', name='text_2', field=models.TextField(verbose_name='История библиотеки 2'), ), migrations.AlterField( model_name='about', name='text_3', field=models.TextField(verbose_name='История библиотеки 3'), ), migrations.AlterField( model_name='about', name='text_about', field=models.TextField(verbose_name='Дополнительный текст'), ), migrations.AlterField( model_name='about', name='title_about', field=models.TextField(verbose_name='Основной текст'), ), migrations.AlterField( model_name='galeryphoto', name='image', field=models.ImageField(upload_to='galery/', verbose_name='Изображение'), ), ]
34.587629
110
0.565723
315
3,355
5.825397
0.190476
0.113896
0.20436
0.237057
0.758583
0.73733
0.635422
0.274659
0.274659
0
0
0.022855
0.308793
3,355
96
111
34.947917
0.768435
0.013413
0
0.533333
1
0
0.193773
0.006953
0
0
0
0
0
1
0
false
0
0.011111
0
0.044444
0
0
0
0
null
0
1
1
0
1
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
70c9c133059af102ad2e00e01eeb06c6bcf1782f
231
py
Python
demo_norm.py
Monster880/pytorch_py
9c5ac5974f48edb5ea3d897a1100a63d488c61d9
[ "MIT" ]
null
null
null
demo_norm.py
Monster880/pytorch_py
9c5ac5974f48edb5ea3d897a1100a63d488c61d9
[ "MIT" ]
null
null
null
demo_norm.py
Monster880/pytorch_py
9c5ac5974f48edb5ea3d897a1100a63d488c61d9
[ "MIT" ]
null
null
null
import torch a = torch.rand(2,3) b = torch.rand(2,3) print(a) print(b) print(torch.dist(a,b,p=1)) print(torch.dist(a,b,p=2)) print(torch.dist(a,b,p=3)) print(torch.norm(a)) print(torch.norm(a, p=2)) print(torch.norm(a, p='fro'))
16.5
29
0.658009
53
231
2.867925
0.245283
0.394737
0.276316
0.296053
0.546053
0.335526
0
0
0
0
0
0.037915
0.08658
231
14
29
16.5
0.682464
0
0
0
0
0
0.012931
0
0
0
0
0
0
1
0
false
0
0.090909
0
0.090909
0.727273
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
70cb18aa5b8b2321740dd2f1ef7fd56f3579e98a
125
py
Python
shrike-examples/components/count_rows/run.py
lynochka/azure-ml-problem-sets
e7e69de763444c5603e4455e35e69e917081a4cc
[ "MIT" ]
3
2021-07-27T16:28:51.000Z
2021-11-15T18:29:02.000Z
shrike-examples/components/count_rows/run.py
lynochka/azure-ml-problem-sets
e7e69de763444c5603e4455e35e69e917081a4cc
[ "MIT" ]
null
null
null
shrike-examples/components/count_rows/run.py
lynochka/azure-ml-problem-sets
e7e69de763444c5603e4455e35e69e917081a4cc
[ "MIT" ]
7
2021-08-09T15:04:03.000Z
2022-03-09T05:48:56.000Z
"""run.py for demo component""" import os from contoso.count_rows_script import main if __name__ == "__main__": main()
15.625
42
0.712
18
125
4.388889
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.168
125
7
43
17.857143
0.759615
0.2
0
0
0
0
0.085106
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
70d0d0bed3789ea025e1dd34d2d36423b788e40b
25
py
Python
sti/sti/sti/__init__.py
TheE77/chat
138ba2c9495cba9d72887736ad033603ddeb87ac
[ "MIT" ]
1
2016-05-23T12:27:12.000Z
2016-05-23T12:27:12.000Z
sti/sti/sti/__init__.py
TheE77/chat
138ba2c9495cba9d72887736ad033603ddeb87ac
[ "MIT" ]
null
null
null
sti/sti/sti/__init__.py
TheE77/chat
138ba2c9495cba9d72887736ad033603ddeb87ac
[ "MIT" ]
null
null
null
""" Package for sti. """
6.25
16
0.52
3
25
4.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.2
25
3
17
8.333333
0.65
0.64
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
70dab034ff20b0cf9225f2472c4f72d5d288417f
22
py
Python
eventsourcing/__init__.py
HanhThong/eventsourcing
99c560cca7c6e9d59855bcd82c371794e1a8bfb9
[ "BSD-3-Clause" ]
39
2019-05-21T11:03:23.000Z
2022-03-22T11:40:17.000Z
eventsourcing/__init__.py
HanhThong/eventsourcing
99c560cca7c6e9d59855bcd82c371794e1a8bfb9
[ "BSD-3-Clause" ]
749
2019-05-16T19:18:03.000Z
2022-03-31T09:03:44.000Z
eventsourcing/__init__.py
HanhThong/eventsourcing
99c560cca7c6e9d59855bcd82c371794e1a8bfb9
[ "BSD-3-Clause" ]
19
2019-06-25T08:45:27.000Z
2022-03-08T17:35:51.000Z
__version__ = "8.1.0"
11
21
0.636364
4
22
2.5
1
0
0
0
0
0
0
0
0
0
0
0.157895
0.136364
22
1
22
22
0.368421
0
0
0
0
0
0.227273
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
cb17a5a8d4a3e990e200192461d9e5ceeea58b5e
135
py
Python
zopeskel/templates/plone2_theme/Extensions/__init__.py
jean/ZopeSkel
c9084f30aa03c2b36411bce5c75b9b85ccbabb2f
[ "MIT" ]
1
2021-05-31T13:51:43.000Z
2021-05-31T13:51:43.000Z
zopeskel/templates/plone2_theme/Extensions/__init__.py
jean/ZopeSkel
c9084f30aa03c2b36411bce5c75b9b85ccbabb2f
[ "MIT" ]
null
null
null
zopeskel/templates/plone2_theme/Extensions/__init__.py
jean/ZopeSkel
c9084f30aa03c2b36411bce5c75b9b85ccbabb2f
[ "MIT" ]
null
null
null
# this file is here to make Install.py and utils.py importable. # keep these lines to make it non-zero size and have winzip cooperate.
45
70
0.77037
25
135
4.16
0.84
0.115385
0
0
0
0
0
0
0
0
0
0
0.177778
135
2
71
67.5
0.936937
0.962963
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
cb1e05ded26565683d926ea596347a8b95ff657f
582
py
Python
code_all/day08/exercise01.py
testcg/python
4db4bd5d0e44af807d2df80cf8c8980b40cc03c4
[ "MIT" ]
null
null
null
code_all/day08/exercise01.py
testcg/python
4db4bd5d0e44af807d2df80cf8c8980b40cc03c4
[ "MIT" ]
null
null
null
code_all/day08/exercise01.py
testcg/python
4db4bd5d0e44af807d2df80cf8c8980b40cc03c4
[ "MIT" ]
null
null
null
""" 练习1:请排列出2个色子可以组成的所有可能(列表) 色子(1~6) range(1,7) 色子(1~6) 练习2:请排列出3个色子可以组成的所有可能(列表) """ # result = [] # for x in range(1, 7): # for y in range(1, 7): # result.append((x , y)) result = [(x, y) for x in range(1, 7) for y in range(1, 7)] print(result) # result = [] # for x in range(1, 7): # 1 2 # for y in range(1, 7): # 1 2 ... # for z in range(1, 7): # 123456 123456 ... # result.append((x, y, z)) result = [(x, y, z) for x in range(1, 7) for y in range(1, 7) for z in range(1, 7)] print(result)
26.454545
83
0.489691
103
582
2.76699
0.194175
0.231579
0.270175
0.315789
0.589474
0.589474
0.42807
0.273684
0.273684
0.273684
0
0.116456
0.321306
582
21
84
27.714286
0.605063
0.623711
0
0.5
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
cb4501a9cc9e26ecee82a818287a97584d0d1df8
31
py
Python
src/common/__init__.py
sUeharaE4/gitlab-dashboard
4f86cfe21e625badb82086e5ba10f4b532ebb2d1
[ "MIT" ]
null
null
null
src/common/__init__.py
sUeharaE4/gitlab-dashboard
4f86cfe21e625badb82086e5ba10f4b532ebb2d1
[ "MIT" ]
1
2022-01-02T01:31:06.000Z
2022-01-02T01:31:06.000Z
src/common/__init__.py
sUeharaE4/gitlab-dashboard
4f86cfe21e625badb82086e5ba10f4b532ebb2d1
[ "MIT" ]
null
null
null
"""Provide common features."""
15.5
30
0.677419
3
31
7
1
0
0
0
0
0
0
0
0
0
0
0
0.096774
31
1
31
31
0.75
0.774194
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
cb6ce9a384609086ccc921f8109d76e60391ad41
171
py
Python
virtual/bin/django-admin.py
AhmadSAshraf/Photo-Gallery
1724affa92c057792a2c8b7e69b7ad0374254b12
[ "MIT" ]
null
null
null
virtual/bin/django-admin.py
AhmadSAshraf/Photo-Gallery
1724affa92c057792a2c8b7e69b7ad0374254b12
[ "MIT" ]
4
2020-06-06T00:47:45.000Z
2021-09-08T01:43:36.000Z
virtual/bin/django-admin.py
AhmadSAshraf/Photo-Gallery
1724affa92c057792a2c8b7e69b7ad0374254b12
[ "MIT" ]
null
null
null
#!/media/mj/Local Disk/tutoring/ahmed/perg/virtual/bin/python3.6 from django.core import management if __name__ == "__main__": management.execute_from_command_line()
28.5
64
0.783626
24
171
5.125
0.916667
0
0
0
0
0
0
0
0
0
0
0.012903
0.093567
171
5
65
34.2
0.780645
0.368421
0
0
0
0
0.074766
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
cb7900a7907762eedfec031d231478ca5738e787
937
gyp
Python
test/base/base.gyp
junmin-zhu/crosswalk
6c2ab70dcdbdda99da85fa6c8f79b5371aafbb1d
[ "BSD-3-Clause" ]
3
2018-05-13T07:02:56.000Z
2019-10-29T19:34:10.000Z
test/base/base.gyp
junmin-zhu/crosswalk
6c2ab70dcdbdda99da85fa6c8f79b5371aafbb1d
[ "BSD-3-Clause" ]
1
2015-07-14T21:11:28.000Z
2015-07-14T21:11:28.000Z
test/base/base.gyp
junmin-zhu/crosswalk
6c2ab70dcdbdda99da85fa6c8f79b5371aafbb1d
[ "BSD-3-Clause" ]
8
2015-06-02T21:13:45.000Z
2022-01-20T10:36:43.000Z
{ 'targets': [ { 'target_name': 'xwalk_test_base', 'type': 'static_library', 'dependencies': [ # FIXME(tmpsantos): we should depend on runtime # here but it is not really a module yet. '../../../base/base.gyp:base', '../../../base/base.gyp:test_support_base', '../../../content/content.gyp:content_browser', '../../../content/content_shell_and_tests.gyp:test_support_content' '../../../net/net.gyp:net', '../../../skia/skia.gyp:skia', '../../../testing/gtest.gyp:gtest', '../../../ui/base/ui_base.gyp:ui_base', '../../../url/url.gyp:url_lib', ], 'sources': [ 'in_process_browser_test.cc', 'in_process_browser_test.h', 'xwalk_test_launcher.cc', 'xwalk_test_suite.cc', 'xwalk_test_suite.h', 'xwalk_test_utils.cc', 'xwalk_test_utils.h', ], }, ], }
30.225806
75
0.524013
105
937
4.380952
0.457143
0.117391
0.071739
0.086957
0
0
0
0
0
0
0
0
0.258271
937
30
76
31.233333
0.661871
0.090715
0
0.107143
0
0
0.636042
0.466431
0
0
0
0.033333
0
1
0
true
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
1
0
0
0
1
0
0
0
0
0
0
4