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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
94261967db9edfe5675b854bde2e11711d168a10
| 2,083
|
py
|
Python
|
src/sardana/macroserver/macros/test/test_ct.py
|
marc2332/sardana
|
48dc9191baaa63f6c714d8c025e8f3f96548ad26
|
[
"CC-BY-3.0"
] | 43
|
2016-11-25T15:21:23.000Z
|
2021-08-20T06:09:40.000Z
|
src/sardana/macroserver/macros/test/test_ct.py
|
marc2332/sardana
|
48dc9191baaa63f6c714d8c025e8f3f96548ad26
|
[
"CC-BY-3.0"
] | 1,263
|
2016-11-25T15:58:37.000Z
|
2021-11-02T22:23:47.000Z
|
src/sardana/macroserver/macros/test/test_ct.py
|
marc2332/sardana
|
48dc9191baaa63f6c714d8c025e8f3f96548ad26
|
[
"CC-BY-3.0"
] | 58
|
2016-11-21T11:33:55.000Z
|
2021-09-01T06:21:21.000Z
|
#!/usr/bin/env python
##############################################################################
##
# This file is part of Sardana
##
# http://www.sardana-controls.org/
##
# Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
# Sardana is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
##
# Sardana is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
##
# You should have received a copy of the GNU Lesser General Public License
# along with Sardana. If not, see <http://www.gnu.org/licenses/>.
##
##############################################################################
"""Tests for ct macros"""
import unittest
from sardana.macroserver.macros.test import RunStopMacroTestCase
from sardana.macroserver.macros.test import testRun
from sardana.macroserver.macros.test import testStop
@testRun(macro_name="ct", macro_params=['.1'], wait_timeout=2.5)
@testRun(macro_name="ct", macro_params=['.3'], wait_timeout=2.5)
@testStop(macro_name="ct", macro_params=['1'], stop_delay=.1, wait_timeout=3.5)
# TODO: uncomment these test when bug-474 is fixed:
# https://sourceforge.net/p/sardana/tickets/474/
#@testRun(macro_name="uct", macro_params=['.1'], wait_timeout=2)
#@testRun(macro_name="uct", macro_params=['.3'], wait_timeout=2)
#@testStop(macro_name="uct", macro_params=['1'], stop_delay=.1, wait_timeout=3)
class CtTest(RunStopMacroTestCase, unittest.TestCase):
"""Test of ct macro. It verifies that macro ct can be executed.
It inherits from RunStopMacroTestCase and from unittest.TestCase.
It tests two executions of the ct macro with two different input
parameters.
Then it does another execution and it tests if the execution can be
aborted.
"""
pass
| 40.057692
| 79
| 0.69035
| 291
| 2,083
| 4.872852
| 0.450172
| 0.038082
| 0.045134
| 0.040197
| 0.334979
| 0.334979
| 0.09591
| 0.047955
| 0.047955
| 0
| 0
| 0.015512
| 0.133461
| 2,083
| 51
| 80
| 40.843137
| 0.770083
| 0.652424
| 0
| 0
| 0
| 0
| 0.022
| 0
| 0
| 0
| 0
| 0.019608
| 0
| 1
| 0
| true
| 0.111111
| 0.444444
| 0
| 0.555556
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
|
0
| 5
|
945fa107829f3e7dbf766b2f02ff1bbd9b624170
| 153
|
py
|
Python
|
adapters/__init__.py
|
zinan/gitmass
|
5d7693b7d320562c7e6d5cf31193e78b44d7610f
|
[
"MIT"
] | 3
|
2020-12-11T21:49:28.000Z
|
2020-12-11T22:44:16.000Z
|
adapters/__init__.py
|
zinan/gitmass
|
5d7693b7d320562c7e6d5cf31193e78b44d7610f
|
[
"MIT"
] | null | null | null |
adapters/__init__.py
|
zinan/gitmass
|
5d7693b7d320562c7e6d5cf31193e78b44d7610f
|
[
"MIT"
] | null | null | null |
from adapters.GithubAdapter import GithubAdapter
from adapters.GitlabAdapter import GitlabAdapter
from adapters.BitbucketAdapter import BitbucketAdapter
| 38.25
| 54
| 0.901961
| 15
| 153
| 9.2
| 0.4
| 0.26087
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.078431
| 153
| 3
| 55
| 51
| 0.978723
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
948345c6129d4c12e82d554999f1a5a355ef46c5
| 87
|
py
|
Python
|
transmute_core/frameworks/flask/__init__.py
|
toumorokoshi/web-transmute
|
ff118e01e42bc224cdf2d7523c3b287aae40d669
|
[
"MIT"
] | null | null | null |
transmute_core/frameworks/flask/__init__.py
|
toumorokoshi/web-transmute
|
ff118e01e42bc224cdf2d7523c3b287aae40d669
|
[
"MIT"
] | null | null | null |
transmute_core/frameworks/flask/__init__.py
|
toumorokoshi/web-transmute
|
ff118e01e42bc224cdf2d7523c3b287aae40d669
|
[
"MIT"
] | null | null | null |
from transmute_core import *
from .route import route
from .swagger import add_swagger
| 21.75
| 32
| 0.827586
| 13
| 87
| 5.384615
| 0.538462
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.137931
| 87
| 3
| 33
| 29
| 0.933333
| 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
| 1
| 0
|
0
| 5
|
948c44b5620761776424574432278c1027ba651d
| 53
|
py
|
Python
|
workshop_starter.py
|
CarlFK/cpx
|
47b1b4aab4e1f16f3b2e82e27f728238528d3a48
|
[
"MIT"
] | null | null | null |
workshop_starter.py
|
CarlFK/cpx
|
47b1b4aab4e1f16f3b2e82e27f728238528d3a48
|
[
"MIT"
] | null | null | null |
workshop_starter.py
|
CarlFK/cpx
|
47b1b4aab4e1f16f3b2e82e27f728238528d3a48
|
[
"MIT"
] | 1
|
2019-04-27T01:46:17.000Z
|
2019-04-27T01:46:17.000Z
|
from adafruit_circuitplayground.express import cpx
| 13.25
| 50
| 0.867925
| 6
| 53
| 7.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.113208
| 53
| 3
| 51
| 17.666667
| 0.957447
| 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
| 1
| 0
|
0
| 5
|
846bab3412e9a373fb26bed96303ec27de3ca448
| 204
|
py
|
Python
|
lib/draw_rectangles/setup.py
|
nikhilp9000/KERN
|
0ee3f7866fc3e3271ce4db0e316ab01a7e2bf21d
|
[
"MIT"
] | null | null | null |
lib/draw_rectangles/setup.py
|
nikhilp9000/KERN
|
0ee3f7866fc3e3271ce4db0e316ab01a7e2bf21d
|
[
"MIT"
] | null | null | null |
lib/draw_rectangles/setup.py
|
nikhilp9000/KERN
|
0ee3f7866fc3e3271ce4db0e316ab01a7e2bf21d
|
[
"MIT"
] | null | null | null |
from distutils.core import setup
from Cython.Build import cythonize
import numpy
setup(name="draw_rectangles_cython", ext_modules=cythonize('draw_rectangles.pyx'), include_dirs=[numpy.get_include()])
| 40.8
| 118
| 0.813725
| 28
| 204
| 5.714286
| 0.642857
| 0.175
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.083333
| 204
| 5
| 118
| 40.8
| 0.855615
| 0
| 0
| 0
| 0
| 0
| 0.20398
| 0.109453
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.75
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
846dda084af96b5d92af747c0b5dd86117dd496a
| 222
|
py
|
Python
|
src/ui/widgets/__init__.py
|
moevm/nosql1h19-text-graph
|
410f156ad4f232f8aa060d43692ab020610ddfd4
|
[
"MIT"
] | null | null | null |
src/ui/widgets/__init__.py
|
moevm/nosql1h19-text-graph
|
410f156ad4f232f8aa060d43692ab020610ddfd4
|
[
"MIT"
] | null | null | null |
src/ui/widgets/__init__.py
|
moevm/nosql1h19-text-graph
|
410f156ad4f232f8aa060d43692ab020610ddfd4
|
[
"MIT"
] | null | null | null |
from .fragments_list import FragmentsList
from .matrix import MatrixWidget
from .algorithm_result import AlgorithmResults
from .settings_list import SettingsListDialog
from .text_widget import TextBrowser, CollapsibleHtml
| 37
| 53
| 0.878378
| 25
| 222
| 7.64
| 0.64
| 0.104712
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.094595
| 222
| 5
| 54
| 44.4
| 0.950249
| 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
| 1
| 0
|
0
| 5
|
84a4960218c34c6403c0b6c430b22be63e8fad94
| 182
|
py
|
Python
|
src/pbi/api/__init__.py
|
redkitedata/pbi-tools
|
9712ae7751fbaf4036d4adb491849d57972c66be
|
[
"MIT"
] | null | null | null |
src/pbi/api/__init__.py
|
redkitedata/pbi-tools
|
9712ae7751fbaf4036d4adb491849d57972c66be
|
[
"MIT"
] | 6
|
2021-12-01T11:12:29.000Z
|
2022-01-07T10:20:09.000Z
|
src/pbi/api/__init__.py
|
redkitedata/pbi-tools
|
9712ae7751fbaf4036d4adb491849d57972c66be
|
[
"MIT"
] | 2
|
2021-11-04T16:37:50.000Z
|
2021-11-08T21:53:43.000Z
|
from .capacity import Capacity
from .dataset import Dataset
from .datasource import Datasource
from .report import Report
from .workspace import Workspace
from .tenant import Tenant
| 26
| 34
| 0.835165
| 24
| 182
| 6.333333
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.131868
| 182
| 6
| 35
| 30.333333
| 0.962025
| 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
| 1
| 0
|
0
| 5
|
84b598a4c98003994bcdbefbd1d58d15355038f3
| 282
|
py
|
Python
|
python/packages/ibm_application_gateway/system/__init__.py
|
IBM-Security/ibm-application-gateway-resources
|
7263a48bbd158d1857a44a99449661b1a0c86793
|
[
"Apache-2.0"
] | null | null | null |
python/packages/ibm_application_gateway/system/__init__.py
|
IBM-Security/ibm-application-gateway-resources
|
7263a48bbd158d1857a44a99449661b1a0c86793
|
[
"Apache-2.0"
] | null | null | null |
python/packages/ibm_application_gateway/system/__init__.py
|
IBM-Security/ibm-application-gateway-resources
|
7263a48bbd158d1857a44a99449661b1a0c86793
|
[
"Apache-2.0"
] | 1
|
2020-10-20T08:30:27.000Z
|
2020-10-20T08:30:27.000Z
|
"""
Copyright contributors to the Application Gateway project
"""
from __future__ import absolute_import
from ibm_application_gateway.system.configurator import *
from ibm_application_gateway.system.container import *
from ibm_application_gateway.system.environment import *
| 25.636364
| 57
| 0.833333
| 33
| 282
| 6.787879
| 0.484848
| 0.321429
| 0.174107
| 0.321429
| 0.495536
| 0.495536
| 0
| 0
| 0
| 0
| 0
| 0
| 0.113475
| 282
| 10
| 58
| 28.2
| 0.896
| 0.202128
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
84e39952f0c0980f04b28c3307777642b1118017
| 101
|
py
|
Python
|
landing/admin.py
|
cactus-computing/product-recommendation
|
b5d9bb27205a4fb032fd19934ecab56a5a8c6d81
|
[
"MIT"
] | null | null | null |
landing/admin.py
|
cactus-computing/product-recommendation
|
b5d9bb27205a4fb032fd19934ecab56a5a8c6d81
|
[
"MIT"
] | null | null | null |
landing/admin.py
|
cactus-computing/product-recommendation
|
b5d9bb27205a4fb032fd19934ecab56a5a8c6d81
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Suscription
admin.site.register(Suscription)
| 14.428571
| 32
| 0.821782
| 13
| 101
| 6.384615
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.118812
| 101
| 6
| 33
| 16.833333
| 0.932584
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
ca3ef8639a19c4ecc09c94f1a2c2a95da2e3080b
| 123
|
py
|
Python
|
cyder/cydhcp/build/utils.py
|
ngokevin/chili
|
36c354ac567471d5e36dccf9eea5096c6b02d4b9
|
[
"BSD-3-Clause"
] | 2
|
2019-03-16T00:47:09.000Z
|
2022-03-04T14:39:08.000Z
|
cyder/cydhcp/build/utils.py
|
ngokevin/chili
|
36c354ac567471d5e36dccf9eea5096c6b02d4b9
|
[
"BSD-3-Clause"
] | 1
|
2020-04-24T08:24:55.000Z
|
2020-04-24T08:24:55.000Z
|
cyder/cydhcp/build/utils.py
|
ngokevin/chili
|
36c354ac567471d5e36dccf9eea5096c6b02d4b9
|
[
"BSD-3-Clause"
] | null | null | null |
def join_args(args, depth=2):
return "\n".join(
map(lambda y: "{0}{1};".format("\t" * depth, y), args)) + '\n'
| 30.75
| 70
| 0.512195
| 20
| 123
| 3.1
| 0.7
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.030928
| 0.211382
| 123
| 3
| 71
| 41
| 0.608247
| 0
| 0
| 0
| 0
| 0
| 0.105691
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0.333333
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
ca52c4ceec29a443f4a2df9459830535e55202ee
| 109
|
py
|
Python
|
enthought/block_canvas/function_tools/function_info.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | 3
|
2016-12-09T06:05:18.000Z
|
2018-03-01T13:00:29.000Z
|
enthought/block_canvas/function_tools/function_info.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | 1
|
2020-12-02T00:51:32.000Z
|
2020-12-02T08:48:55.000Z
|
enthought/block_canvas/function_tools/function_info.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | null | null | null |
# proxy module
from __future__ import absolute_import
from blockcanvas.function_tools.function_info import *
| 27.25
| 54
| 0.862385
| 14
| 109
| 6.214286
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.100917
| 109
| 3
| 55
| 36.333333
| 0.887755
| 0.110092
| 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
| 1
| 0
|
0
| 5
|
ca57403cd99357022c5be20b842832e284152b62
| 332
|
py
|
Python
|
src/Tax/ServiceTax.py
|
joaolevi/Projeto_de_software_2020.1
|
3b9b5a048c55638f2e6d31de55720098e3be649c
|
[
"MIT"
] | null | null | null |
src/Tax/ServiceTax.py
|
joaolevi/Projeto_de_software_2020.1
|
3b9b5a048c55638f2e6d31de55720098e3be649c
|
[
"MIT"
] | null | null | null |
src/Tax/ServiceTax.py
|
joaolevi/Projeto_de_software_2020.1
|
3b9b5a048c55638f2e6d31de55720098e3be649c
|
[
"MIT"
] | null | null | null |
from Tax import Tax
class ServiceTax(Tax):
def __init__(self, value, service_name):
super().__init__(value)
self.__service_name = service_name
def get_service_name(self):
return self.__service_name
def set_service_name(self, new_service_name):
self.__service_name = new_service_name
| 30.181818
| 49
| 0.704819
| 44
| 332
| 4.704545
| 0.363636
| 0.478261
| 0.217391
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.21988
| 332
| 11
| 50
| 30.181818
| 0.799228
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.111111
| 0.111111
| 0.666667
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
ca6880840a9a7cc5608afc75b2ff9ecfdf100416
| 1,445
|
py
|
Python
|
coub_api/api.py
|
Lebedevsd/coub_api
|
b420465a85eb13d21ef1677f26fab34c5bd03d72
|
[
"MIT"
] | 5
|
2018-12-26T22:38:31.000Z
|
2020-01-16T13:31:40.000Z
|
coub_api/api.py
|
Lebedevsd/coub_api
|
b420465a85eb13d21ef1677f26fab34c5bd03d72
|
[
"MIT"
] | 113
|
2018-12-25T19:11:54.000Z
|
2021-06-28T03:37:48.000Z
|
coub_api/api.py
|
Lebedevsd/coub_api
|
b420465a85eb13d21ef1677f26fab34c5bd03d72
|
[
"MIT"
] | 3
|
2020-01-06T18:48:07.000Z
|
2022-02-22T12:11:05.000Z
|
from typing import Optional
from .modules.user import User
from .modules.coubs import Coubs
from .modules.likes import Likes
from .modules.recoub import Recoub
from .modules.search import Search
from .modules.channel import Channel
from .modules.follows import Follow
from .modules.friends import Friends
from .modules.metadata import MetaData
from .modules.timelines import Timeline
from .modules.notifications import Notifications
__all__ = ("CoubApi",)
class CoubApi:
__slots__ = ("token",)
def __init__(self):
self.token: Optional[str] = None
def authenticate(self, token: str):
self.token = token
@property
def timeline(self):
return Timeline(self.token)
@property
def coubs(self):
return Coubs(self.token)
@property
def recoubs(self):
return Recoub(self.token)
@property
def channels(self):
return Channel(self.token)
@property
def likes(self):
return Likes(self.token)
@property
def following(self):
return Follow(self.token)
@property
def coub_metadata(self):
return MetaData(self.token)
@property
def users(self):
return User(self.token)
@property
def friends(self):
return Friends(self.token)
@property
def notification(self):
return Notifications(self.token)
@property
def search(self):
return Search(self.token)
| 20.642857
| 48
| 0.673356
| 170
| 1,445
| 5.647059
| 0.217647
| 0.13125
| 0.183333
| 0.208333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.238754
| 1,445
| 69
| 49
| 20.942029
| 0.872727
| 0
| 0
| 0.211538
| 0
| 0
| 0.008305
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.230769
| 0.211538
| 0.730769
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
04c1c35d061af40293ac296b7cff1ae85cafbeb1
| 61
|
py
|
Python
|
webui/modules/cleanup/__init__.py
|
BogdanKandra/image-tinkering
|
18c71033cb8bf496c43e38c0a98e1e658ce7ee65
|
[
"MIT"
] | null | null | null |
webui/modules/cleanup/__init__.py
|
BogdanKandra/image-tinkering
|
18c71033cb8bf496c43e38c0a98e1e658ce7ee65
|
[
"MIT"
] | null | null | null |
webui/modules/cleanup/__init__.py
|
BogdanKandra/image-tinkering
|
18c71033cb8bf496c43e38c0a98e1e658ce7ee65
|
[
"MIT"
] | null | null | null |
"""
Created on Fri May 17 13:10:07 2019
@author: Bogdan
"""
| 10.166667
| 35
| 0.639344
| 11
| 61
| 3.545455
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.244898
| 0.196721
| 61
| 5
| 36
| 12.2
| 0.55102
| 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
| 1
| 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
| 5
|
b6fc13b3a0c53c0f6b3868fc004571acf17721b1
| 203
|
py
|
Python
|
pasedelista/index/admin.py
|
ElForaneo/Pase-de-lsita
|
91b3329aedfd85be9f9c28491a5638a698ee4f5e
|
[
"Apache-2.0"
] | null | null | null |
pasedelista/index/admin.py
|
ElForaneo/Pase-de-lsita
|
91b3329aedfd85be9f9c28491a5638a698ee4f5e
|
[
"Apache-2.0"
] | null | null | null |
pasedelista/index/admin.py
|
ElForaneo/Pase-de-lsita
|
91b3329aedfd85be9f9c28491a5638a698ee4f5e
|
[
"Apache-2.0"
] | null | null | null |
from django.contrib import admin
from .models import Alumno, Asistencia, Profesore
# Register your models here.
admin.site.register(Alumno)
admin.site.register(Asistencia)
admin.site.register(Profesore)
| 29
| 49
| 0.82266
| 27
| 203
| 6.185185
| 0.481481
| 0.161677
| 0.305389
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.08867
| 203
| 7
| 50
| 29
| 0.902703
| 0.128079
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.4
| 0
| 0.4
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
8e1e7ec5e630420d5723f3350fd30dc44e247d95
| 7,058
|
py
|
Python
|
tests/test_usecases.py
|
Mario-Kart-Felix/mal-scrap
|
bc396a15ea5b144eb1c0f05759d1f9419d6671df
|
[
"BSD-3-Clause"
] | 2
|
2015-12-17T20:25:09.000Z
|
2017-10-08T19:14:57.000Z
|
tests/test_usecases.py
|
Mario-Kart-Felix/mal-scrap
|
bc396a15ea5b144eb1c0f05759d1f9419d6671df
|
[
"BSD-3-Clause"
] | 1
|
2015-01-05T18:07:13.000Z
|
2015-01-07T21:43:57.000Z
|
tests/test_usecases.py
|
Mario-Kart-Felix/mal-scrap
|
bc396a15ea5b144eb1c0f05759d1f9419d6671df
|
[
"BSD-3-Clause"
] | 3
|
2017-10-18T00:56:53.000Z
|
2020-05-24T09:38:54.000Z
|
# -*- coding: utf-8 -*-
# This file is part of Viper - https://github.com/viper-framework/viper
# See the file 'LICENSE' for copying permission.
from __future__ import unicode_literals
import os
import re
import sys
from shutil import copyfile
from hashlib import sha256
import pytest
from tests.conftest import FIXTURE_DIR
from viper.core.session import __sessions__
from viper.core.ui import commands
from viper.common.exceptions import Python2UnsupportedUnicode
try:
from unittest import mock
except ImportError:
# Python2
import mock
class TestUseCases:
def teardown_method(self):
__sessions__.close()
@pytest.mark.usefixtures("cleandir")
@pytest.mark.parametrize("filename, name", [
("chromeinstall-8u31.exe", "chromeinstall-8u31.exe"),
("string_handling/with blank.txt", "with blank.txt"),
])
def test_store(self, capsys, filename, name):
# use cleandir fixture operate on clean ./ local dir
copyfile(os.path.join(FIXTURE_DIR, filename), os.path.join(".", os.path.basename(filename)))
commands.Open().run('-f', os.path.join(".", os.path.basename(filename)))
commands.Store().run()
if sys.version_info <= (3, 0):
in_fct = 'viper.core.ui.commands.input'
else:
in_fct = 'builtins.input'
with mock.patch(in_fct, return_value='y'):
commands.Delete().run()
out, err = capsys.readouterr()
lines = out.split("\n")
assert re.search(r".*Session opened on.*", lines[0])
assert not re.search(r".*Unable to store file.*", out)
assert re.search(r".*{}.*".format(name), lines[1])
assert re.search(r".*Running command.*", lines[5])
assert re.search(r".*Deleted opened file.*", lines[7])
@pytest.mark.skipif(sys.version_info >= (3, 0), reason="requires python2")
@pytest.mark.xfail(raises=Python2UnsupportedUnicode)
@pytest.mark.usefixtures("cleandir")
@pytest.mark.parametrize("filename, name", [
("string_handling/dümmy.txt", "dümmy.txt")
])
def test_store_unicode_py2(self, capsys, filename, name):
# use cleandir fixture operate on clean ./ local dir
copyfile(os.path.join(FIXTURE_DIR, filename), os.path.join(".", os.path.basename(filename)))
commands.Open().run('-f', os.path.join(".", os.path.basename(filename)))
commands.Store().run()
if sys.version_info <= (3, 0):
in_fct = 'viper.core.ui.commands.input'
else:
in_fct = 'builtins.input'
with mock.patch(in_fct, return_value='y'):
commands.Delete().run()
out, err = capsys.readouterr()
lines = out.split("\n")
assert re.search(r".*Session opened on.*", lines[0])
assert not re.search(r".*Unable to store file.*", out)
assert re.search(r".*{}.*".format(name), lines[1])
assert re.search(r".*Running command.*", lines[5])
assert re.search(r".*Deleted opened file.*", lines[7])
@pytest.mark.skipif(sys.version_info < (3, 3), reason="requires at least python3.3")
@pytest.mark.usefixtures("cleandir")
@pytest.mark.parametrize("filename, name", [
("string_handling/dümmy.txt", "dümmy.txt")
])
def test_store_unicode_py3(self, capsys, filename, name):
# use cleandir fixture operate on clean ./ local dir
copyfile(os.path.join(FIXTURE_DIR, filename), os.path.join(".", os.path.basename(filename)))
commands.Open().run('-f', os.path.join(".", os.path.basename(filename)))
commands.Store().run()
if sys.version_info <= (3, 0):
in_fct = 'viper.core.ui.commands.input'
else:
in_fct = 'builtins.input'
with mock.patch(in_fct, return_value='y'):
commands.Delete().run()
out, err = capsys.readouterr()
lines = out.split("\n")
assert re.search(r".*Session opened on.*", lines[0])
assert not re.search(r".*Unable to store file.*", out)
assert re.search(r".*{}.*".format(name), lines[1])
assert re.search(r".*Running command.*", lines[5])
assert re.search(r".*Deleted opened file.*", lines[7])
@pytest.mark.skipif(sys.version_info >= (3, 0), reason="requires python2")
@pytest.mark.xfail(raises=Python2UnsupportedUnicode)
@pytest.mark.parametrize("filename", ["chromeinstall-8u31.exe"])
def test_store_all_py2(self, capsys, filename):
commands.Open().run('-f', os.path.join(FIXTURE_DIR, filename))
commands.Store().run()
commands.Store().run('-f', FIXTURE_DIR)
out, err = capsys.readouterr()
lines = out.split("\n")
assert re.search(r".*Session opened on.*", lines[0])
assert re.search(r".*appears to be already stored.*", out)
assert re.search(r".*Skip, file \"chromeinstall-8u31.exe\" appears to be already stored.*", out)
@pytest.mark.skipif(sys.version_info < (3, 3), reason="requires at least python3.3")
@pytest.mark.parametrize("filename", ["chromeinstall-8u31.exe"])
def test_store_all_py3(self, capsys, filename):
commands.Open().run('-f', os.path.join(FIXTURE_DIR, filename))
commands.Store().run()
commands.Store().run('-f', FIXTURE_DIR)
out, err = capsys.readouterr()
lines = out.split("\n")
assert re.search(r".*Session opened on.*", lines[0])
assert re.search(r".*appears to be already stored.*", out)
assert re.search(r".*Skip, file \"chromeinstall-8u31.exe\" appears to be already stored.*", out)
@pytest.mark.parametrize("filename", ["chromeinstall-8u31.exe"])
def test_open(self, capsys, filename):
with open(os.path.join(FIXTURE_DIR, filename), 'rb') as f:
hashfile = sha256(f.read()).hexdigest()
commands.Open().run(hashfile)
commands.Info().run()
commands.Close().run()
out, err = capsys.readouterr()
lines = out.split("\n")
assert re.search(r".*Session opened on.*", lines[0])
assert re.search(r".*| SHA1 | 56c5b6cd34fa9532b5a873d6bdd4380cfd102218.*", lines[11])
@pytest.mark.parametrize("filename", ["chromeinstall-8u31.exe"])
def test_find(self, capsys, filename):
with open(os.path.join(FIXTURE_DIR, filename), 'rb') as f:
data = f.read()
hashfile_sha = sha256(data).hexdigest()
commands.Find().run('all')
commands.Find().run('sha256', hashfile_sha)
commands.Open().run('-l', '1')
commands.Close().run()
commands.Tags().run('-a', 'blah')
commands.Find().run('-t')
commands.Tags().run('-d', 'blah')
out, err = capsys.readouterr()
assert re.search(r".*EICAR.com.*", out)
assert re.search(r".*{0}.*".format(filename), out)
assert re.search(r".*Tag.*|.*# Entries.*", out)
def test_stats(self, capsys):
commands.Stats().run()
out, err = capsys.readouterr()
assert re.search(r".*Projects.*Name | Count.*", out)
| 41.274854
| 104
| 0.618589
| 900
| 7,058
| 4.78
| 0.177778
| 0.050209
| 0.056485
| 0.083682
| 0.770572
| 0.761506
| 0.761506
| 0.761506
| 0.744305
| 0.706183
| 0
| 0.019823
| 0.2138
| 7,058
| 170
| 105
| 41.517647
| 0.755451
| 0.042363
| 0
| 0.676259
| 0
| 0
| 0.183528
| 0.045623
| 0
| 0
| 0
| 0
| 0.194245
| 1
| 0.064748
| false
| 0
| 0.100719
| 0
| 0.172662
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
f3e0fe4fdd91f0ca53c9beeddf930a5ff2b49ee3
| 187
|
py
|
Python
|
tests/conftest.py
|
bstreiff/sistrum
|
2a8b2e36484dad15395fbec661f2edb354d46b79
|
[
"BSD-2-Clause"
] | null | null | null |
tests/conftest.py
|
bstreiff/sistrum
|
2a8b2e36484dad15395fbec661f2edb354d46b79
|
[
"BSD-2-Clause"
] | null | null | null |
tests/conftest.py
|
bstreiff/sistrum
|
2a8b2e36484dad15395fbec661f2edb354d46b79
|
[
"BSD-2-Clause"
] | null | null | null |
import pytest # type: ignore
import serial # type: ignore
@pytest.fixture(scope="module", autouse=True)
def pyserial_registrar():
serial.protocol_handler_packages.append("tests")
| 23.375
| 52
| 0.759358
| 23
| 187
| 6.043478
| 0.782609
| 0.143885
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.122995
| 187
| 7
| 53
| 26.714286
| 0.847561
| 0.13369
| 0
| 0
| 0
| 0
| 0.069182
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| true
| 0
| 0.4
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 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
| 5
|
6d4453bcf9f4770ec468d18921d151430829b0d7
| 294
|
py
|
Python
|
twitter_credentials.py
|
bmugenya/tweet-sentiment
|
e3badf39e90ae1b6d3ba6ff41805c7c291a6cff8
|
[
"MIT"
] | null | null | null |
twitter_credentials.py
|
bmugenya/tweet-sentiment
|
e3badf39e90ae1b6d3ba6ff41805c7c291a6cff8
|
[
"MIT"
] | null | null | null |
twitter_credentials.py
|
bmugenya/tweet-sentiment
|
e3badf39e90ae1b6d3ba6ff41805c7c291a6cff8
|
[
"MIT"
] | null | null | null |
# variables that contain user credentials
CONSUMER_KEY = "tMFjs33CpuKRq4MUqK3A87tPV"
CONSUMER_SECRET = "x9sKeTeUvXPLhkqkHutQYZInpNVNCjxqmyrR4Ve8R4kRzNsaCL"
ACCESS_TOKEN = "1005899876742377474-Fd44TJWSfTUiGBapM8YOtjah9Kv8Ef"
ACCESS_TOKEN_SECRET = "dlkbbp3Ibc7nSH6f1tHZeopMCn4XKPANqYAahQgXgheot"
| 49
| 70
| 0.891156
| 19
| 294
| 13.526316
| 0.789474
| 0.085603
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.141304
| 0.061224
| 294
| 5
| 71
| 58.8
| 0.789855
| 0.132653
| 0
| 0
| 0
| 0
| 0.671937
| 0.671937
| 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
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
6d5455bf492b14ad47974bb01588e1305474fce7
| 223
|
py
|
Python
|
Stage_0_Aderinsola.py
|
Derinsolar/team-greider
|
a034229d0918e744f110c04000f451d7aa2ad03e
|
[
"MIT"
] | null | null | null |
Stage_0_Aderinsola.py
|
Derinsolar/team-greider
|
a034229d0918e744f110c04000f451d7aa2ad03e
|
[
"MIT"
] | null | null | null |
Stage_0_Aderinsola.py
|
Derinsolar/team-greider
|
a034229d0918e744f110c04000f451d7aa2ad03e
|
[
"MIT"
] | null | null | null |
print("Name: Aderinsola Adebisi")
print("Email: adebisiaderinsola@gmail.com")
print("Slack username: @Aderinsola")
print("Biostack: Drug Development")
print("Twitter username: @Derinsolar")
print("Hamming distance: 2")
| 37.166667
| 44
| 0.753363
| 25
| 223
| 6.72
| 0.72
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.004951
| 0.09417
| 223
| 6
| 45
| 37.166667
| 0.826733
| 0
| 0
| 0
| 0
| 0
| 0.726027
| 0.123288
| 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
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
ed9c74d2807266b30af8f73fe67a747e14a94dd9
| 435
|
py
|
Python
|
app/model/builder.py
|
remirab/regression-api
|
8fa601ef2db1b0dbeaa3b82fe4e977624dcd1461
|
[
"MIT"
] | null | null | null |
app/model/builder.py
|
remirab/regression-api
|
8fa601ef2db1b0dbeaa3b82fe4e977624dcd1461
|
[
"MIT"
] | null | null | null |
app/model/builder.py
|
remirab/regression-api
|
8fa601ef2db1b0dbeaa3b82fe4e977624dcd1461
|
[
"MIT"
] | null | null | null |
from sklearn.linear_model import LinearRegression, BayesianRidge, ARDRegression, LogisticRegression, HuberRegressor, Ridge
class Model:
def __init__(self):
"""
Constructor
"""
pass
def maker(self):
raise Exception("Not implemented yet!")
def trainer(self):
raise Exception("Not implemented yet!")
def predictor(self):
raise Exception("Not implemented yet!")
| 22.894737
| 122
| 0.650575
| 42
| 435
| 6.619048
| 0.595238
| 0.097122
| 0.194245
| 0.226619
| 0.399281
| 0.399281
| 0.273381
| 0
| 0
| 0
| 0
| 0
| 0.257471
| 435
| 18
| 123
| 24.166667
| 0.860681
| 0.025287
| 0
| 0.3
| 0
| 0
| 0.15
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0.1
| 0.1
| 0
| 0.6
| 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
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
edb08f27c5ba02ef27742efc76814cb48d8c6d14
| 69
|
py
|
Python
|
kvfile/__init__.py
|
akariv/kvfile
|
7fd800e520a3617d729bfb4182f242b5d446e844
|
[
"MIT"
] | 3
|
2018-06-18T18:06:22.000Z
|
2019-06-26T11:50:01.000Z
|
kvfile/__init__.py
|
akariv/kvfile
|
7fd800e520a3617d729bfb4182f242b5d446e844
|
[
"MIT"
] | null | null | null |
kvfile/__init__.py
|
akariv/kvfile
|
7fd800e520a3617d729bfb4182f242b5d446e844
|
[
"MIT"
] | 1
|
2018-08-06T21:26:10.000Z
|
2018-08-06T21:26:10.000Z
|
from .kvfile import KVFile, db_kind
from .cached import CachedKVFile
| 23
| 35
| 0.826087
| 10
| 69
| 5.6
| 0.7
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.130435
| 69
| 2
| 36
| 34.5
| 0.933333
| 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
| 1
| 0
|
0
| 5
|
61031dc70fc51c90d4071e088341b56c022934e7
| 60
|
py
|
Python
|
flask_cloudflare_remote/__init__.py
|
cs91chris/flask_cloudflare_remote
|
f4f9e7dd3f0176223afd4da269dd921b7d13108b
|
[
"MIT"
] | 1
|
2020-04-14T13:32:42.000Z
|
2020-04-14T13:32:42.000Z
|
flask_cloudflare_remote/__init__.py
|
cs91chris/flask_cloudflare_remote
|
f4f9e7dd3f0176223afd4da269dd921b7d13108b
|
[
"MIT"
] | null | null | null |
flask_cloudflare_remote/__init__.py
|
cs91chris/flask_cloudflare_remote
|
f4f9e7dd3f0176223afd4da269dd921b7d13108b
|
[
"MIT"
] | 2
|
2020-12-25T16:47:58.000Z
|
2021-11-09T16:22:21.000Z
|
from .remote import CloudflareRemote
from .version import *
| 20
| 36
| 0.816667
| 7
| 60
| 7
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.133333
| 60
| 2
| 37
| 30
| 0.942308
| 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
| 1
| 0
|
0
| 5
|
b658b2f1f154d09a5a0215466d7c2b6a2bc0b4ad
| 155
|
py
|
Python
|
misc/socketClientPython.py
|
vyzboy92/Accelerated-Face-Reidentification-and-Emotion-Recognition
|
f653f6fbcc82f39667c3c8fa2025a8c26825c92a
|
[
"MIT"
] | 2
|
2019-05-01T23:17:46.000Z
|
2019-12-15T18:20:45.000Z
|
misc/socketClientPython.py
|
vyzboy92/Accelerated-Face-Reidentification-and-Emotion-Recognition
|
f653f6fbcc82f39667c3c8fa2025a8c26825c92a
|
[
"MIT"
] | null | null | null |
misc/socketClientPython.py
|
vyzboy92/Accelerated-Face-Reidentification-and-Emotion-Recognition
|
f653f6fbcc82f39667c3c8fa2025a8c26825c92a
|
[
"MIT"
] | 2
|
2019-04-17T08:02:20.000Z
|
2019-04-24T03:08:46.000Z
|
from websocket import create_connection
ws = create_connection("ws://localhost:8888/ws")
ws.send("Python , Vysah")
# while True:
# print ws.recv()
| 15.5
| 48
| 0.703226
| 21
| 155
| 5.095238
| 0.714286
| 0.299065
| 0.336449
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.030534
| 0.154839
| 155
| 9
| 49
| 17.222222
| 0.78626
| 0.2
| 0
| 0
| 0
| 0
| 0.302521
| 0.184874
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 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
| 1
| 0
| 0
| 0
|
0
| 5
|
b6632fd1365145f3ab7e32aeab2cb2ce84a107e6
| 76
|
py
|
Python
|
reading/reader/__init__.py
|
akyruu/blender-cartography-addon
|
4f34b029d9b6a72619227ab3ceaed9393506934e
|
[
"Apache-2.0"
] | null | null | null |
reading/reader/__init__.py
|
akyruu/blender-cartography-addon
|
4f34b029d9b6a72619227ab3ceaed9393506934e
|
[
"Apache-2.0"
] | null | null | null |
reading/reader/__init__.py
|
akyruu/blender-cartography-addon
|
4f34b029d9b6a72619227ab3ceaed9393506934e
|
[
"Apache-2.0"
] | null | null | null |
from .csv import CartographyCsvReader
from .tsv import CartographyTsvReader
| 25.333333
| 37
| 0.868421
| 8
| 76
| 8.25
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 76
| 2
| 38
| 38
| 0.970588
| 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
| 1
| 0
|
0
| 5
|
b66bcfbd16377872ee0d3ced4b79adcdff07c973
| 298
|
py
|
Python
|
src/ufdl/json/core/jobs/notification/_PrintNotification.py
|
waikato-ufdl/ufdl-json-messages
|
408901bdf79aa9ae7cff1af165deee83e62f6088
|
[
"Apache-2.0"
] | null | null | null |
src/ufdl/json/core/jobs/notification/_PrintNotification.py
|
waikato-ufdl/ufdl-json-messages
|
408901bdf79aa9ae7cff1af165deee83e62f6088
|
[
"Apache-2.0"
] | null | null | null |
src/ufdl/json/core/jobs/notification/_PrintNotification.py
|
waikato-ufdl/ufdl-json-messages
|
408901bdf79aa9ae7cff1af165deee83e62f6088
|
[
"Apache-2.0"
] | null | null | null |
from wai.json.object.property import StringProperty
from ._Notification import Notification
class PrintNotification(Notification['PrintNotification']):
"""
Notification specification for printing to standard output.
"""
# The message to print
message: str = StringProperty()
| 24.833333
| 63
| 0.751678
| 29
| 298
| 7.689655
| 0.689655
| 0.26009
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.171141
| 298
| 11
| 64
| 27.090909
| 0.902834
| 0.271812
| 0
| 0
| 0
| 0
| 0.084577
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
b67346b1c2fb3fe56dc06078553e75518effb594
| 43
|
py
|
Python
|
tests/components/blueprint/__init__.py
|
tbarbette/core
|
8e58c3aa7bc8d2c2b09b6bd329daa1c092d52d3c
|
[
"Apache-2.0"
] | 30,023
|
2016-04-13T10:17:53.000Z
|
2020-03-02T12:56:31.000Z
|
tests/components/blueprint/__init__.py
|
jagadeeshvenkatesh/core
|
1bd982668449815fee2105478569f8e4b5670add
|
[
"Apache-2.0"
] | 31,101
|
2020-03-02T13:00:16.000Z
|
2022-03-31T23:57:36.000Z
|
tests/components/blueprint/__init__.py
|
jagadeeshvenkatesh/core
|
1bd982668449815fee2105478569f8e4b5670add
|
[
"Apache-2.0"
] | 11,956
|
2016-04-13T18:42:31.000Z
|
2020-03-02T09:32:12.000Z
|
"""Tests for the blueprint integration."""
| 21.5
| 42
| 0.72093
| 5
| 43
| 6.2
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116279
| 43
| 1
| 43
| 43
| 0.815789
| 0.837209
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
b690c05d7d8b16b3fddda09517f8eb6c3dec8526
| 201
|
py
|
Python
|
python/Strings/python-mutations.py
|
cdrowley/hackerrank
|
cc5c925327cd3ce5b52c1614b814da75d42cca72
|
[
"MIT"
] | null | null | null |
python/Strings/python-mutations.py
|
cdrowley/hackerrank
|
cc5c925327cd3ce5b52c1614b814da75d42cca72
|
[
"MIT"
] | null | null | null |
python/Strings/python-mutations.py
|
cdrowley/hackerrank
|
cc5c925327cd3ce5b52c1614b814da75d42cca72
|
[
"MIT"
] | null | null | null |
# https://www.hackerrank.com/challenges/python-mutations/problem
def mutate_string(string, position, character):
string = list(string)
string[position] = character
return "".join(string)
| 25.125
| 64
| 0.731343
| 23
| 201
| 6.347826
| 0.695652
| 0.164384
| 0.273973
| 0.39726
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.139303
| 201
| 7
| 65
| 28.714286
| 0.843931
| 0.308458
| 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
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
b69d05047175f16a0433c44c5195c3b420a75371
| 129
|
py
|
Python
|
api/admin.py
|
Alonso-Arias/misPerris2019
|
9e1649839f498dc2ad78e685ab7bef0683de3b73
|
[
"MIT"
] | null | null | null |
api/admin.py
|
Alonso-Arias/misPerris2019
|
9e1649839f498dc2ad78e685ab7bef0683de3b73
|
[
"MIT"
] | 14
|
2019-12-05T01:02:44.000Z
|
2022-03-12T00:06:57.000Z
|
api/admin.py
|
Alonso-Arias/misPerris2019
|
9e1649839f498dc2ad78e685ab7bef0683de3b73
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Mascota, Usuario
admin.site.register(Mascota)
admin.site.register(Usuario)
| 21.5
| 36
| 0.821705
| 18
| 129
| 5.888889
| 0.555556
| 0.169811
| 0.320755
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.093023
| 129
| 5
| 37
| 25.8
| 0.905983
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
b69f963815f495af91ea8e5eea7a217686723ddd
| 51
|
py
|
Python
|
tests/data/codebases/simple_python2/bar.py
|
cgruber/make-open-easy
|
b433ba61d2f7b32d06eb7df8db38ba545827ad5e
|
[
"Apache-2.0"
] | 5
|
2016-05-08T00:55:46.000Z
|
2020-03-14T06:57:30.000Z
|
tests/data/codebases/simple_python2/bar.py
|
cgruber/make-open-easy
|
b433ba61d2f7b32d06eb7df8db38ba545827ad5e
|
[
"Apache-2.0"
] | null | null | null |
tests/data/codebases/simple_python2/bar.py
|
cgruber/make-open-easy
|
b433ba61d2f7b32d06eb7df8db38ba545827ad5e
|
[
"Apache-2.0"
] | 10
|
2015-06-08T21:15:13.000Z
|
2021-10-16T15:06:01.000Z
|
#!/usr/bin/env python
print 'Hello again, world!'
| 12.75
| 27
| 0.686275
| 8
| 51
| 4.375
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.137255
| 51
| 3
| 28
| 17
| 0.795455
| 0.392157
| 0
| 0
| 0
| 0
| 0.633333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 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
| 1
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
b6b2588f1716800543d047b34ee8072385b763e8
| 17
|
py
|
Python
|
cg/__init__.py
|
indranilsinharoy/iutils
|
1b102029306fa2947d69d8ca80d976d143f3d068
|
[
"MIT"
] | null | null | null |
cg/__init__.py
|
indranilsinharoy/iutils
|
1b102029306fa2947d69d8ca80d976d143f3d068
|
[
"MIT"
] | null | null | null |
cg/__init__.py
|
indranilsinharoy/iutils
|
1b102029306fa2947d69d8ca80d976d143f3d068
|
[
"MIT"
] | null | null | null |
# graphics utils
| 8.5
| 16
| 0.764706
| 2
| 17
| 6.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.176471
| 17
| 1
| 17
| 17
| 0.928571
| 0.823529
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
fcbd51fb077da8cf696034b1c9dd9cc84ca645a8
| 871
|
py
|
Python
|
python/taichi/ui/ui.py
|
kxxt/taichi
|
15f39b79c258080f1e34fcbdc29646d9ced0a4fe
|
[
"MIT"
] | 15
|
2020-01-29T19:07:19.000Z
|
2021-05-12T02:53:22.000Z
|
python/taichi/ui/ui.py
|
kxxt/taichi
|
15f39b79c258080f1e34fcbdc29646d9ced0a4fe
|
[
"MIT"
] | null | null | null |
python/taichi/ui/ui.py
|
kxxt/taichi
|
15f39b79c258080f1e34fcbdc29646d9ced0a4fe
|
[
"MIT"
] | 2
|
2020-01-31T20:10:35.000Z
|
2021-03-16T07:51:59.000Z
|
from taichi.core import ti_core as _ti_core
if _ti_core.GGUI_AVAILABLE:
from .camera import Camera # pylint: disable=unused-import
from .canvas import Canvas # pylint: disable=unused-import
from .constants import * # pylint: disable=unused-import,wildcard-import
from .imgui import Gui # pylint: disable=unused-import
from .scene import Scene # pylint: disable=unused-import
from .window import Window # pylint: disable=unused-import
def make_camera():
return Camera(_ti_core.PyCamera())
ProjectionMode = _ti_core.ProjectionMode
else:
def err_no_ggui():
raise Exception("GGUI Not Available")
class Window:
def __init__(self, name, res, vsync=False):
err_no_ggui()
class Scene:
def __init__(self):
err_no_ggui()
def make_camera():
err_no_ggui()
| 27.21875
| 77
| 0.676234
| 111
| 871
| 5.054054
| 0.342342
| 0.139037
| 0.203209
| 0.26738
| 0.206774
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.237658
| 871
| 31
| 78
| 28.096774
| 0.84488
| 0.223881
| 0
| 0.227273
| 0
| 0
| 0.026906
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.227273
| false
| 0
| 0.318182
| 0.045455
| 0.681818
| 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
| 1
| 0
| 1
| 0
|
0
| 5
|
fcc110062f8a5e41ca8bd58c0d75c0add5c93c04
| 10,887
|
py
|
Python
|
core/request_handlers/tests/test_files_handler.py
|
unklearn/python-runtime
|
d6647ce9bb9c02879a4b0fc58e267806b199eb2e
|
[
"MIT"
] | null | null | null |
core/request_handlers/tests/test_files_handler.py
|
unklearn/python-runtime
|
d6647ce9bb9c02879a4b0fc58e267806b199eb2e
|
[
"MIT"
] | null | null | null |
core/request_handlers/tests/test_files_handler.py
|
unklearn/python-runtime
|
d6647ce9bb9c02879a4b0fc58e267806b199eb2e
|
[
"MIT"
] | null | null | null |
import pytest
import json
import os
from support.base_test_handler import TestHandlerBase
from core.constants import CellEvents, CellExecutionStatus, CELLS_NAMESPACE
@pytest.mark.handlers
@pytest.mark.integration
class TestFilesHandler(TestHandlerBase):
def assert_file_and_remove(self,
file_path,
content=None,
remove=True,
response=None):
app = self.get_app()
full_path = os.path.join(app.config.FILE_ROOT_DIR, file_path)
assert os.path.exists(full_path)
if response:
body = response.body.decode('utf-8')
assert body == file_path
if content:
with open(full_path, 'r') as f:
assert f.read() == content
if remove:
os.unlink(full_path)
def test_creating_files(self):
resp = self.fetch('/files',
method='POST',
body=json.dumps({
'filePath': 'modules/test.py',
'content': 'print("Hello")'
}),
follow_redirects=False)
assert resp.code == 200
# Assert that file exists
self.assert_file_and_remove('modules/test.py',
'print("Hello")',
response=resp)
def test_file_overwrite(self):
resp = self.fetch('/files',
method='POST',
body=json.dumps({
'filePath': 'modules/test.py',
'content': 'print("Hello")'
}),
follow_redirects=False)
assert resp.code == 200
# Assert that file exists
self.assert_file_and_remove('modules/test.py',
content='print("Hello")',
remove=False,
response=resp)
resp = self.fetch('/files',
method='POST',
body=json.dumps({
'filePath': 'modules/test.py',
'content': 'print("World")'
}),
follow_redirects=False)
assert resp.code == 200
self.assert_file_and_remove('modules/test.py',
content='print("World")',
response=resp)
def test_missing_file_arguments(self):
resp = self.fetch('/files',
method='POST',
body=json.dumps({
'filePath': None,
'content': 'print("Hello")'
}),
follow_redirects=False)
assert resp.code == 400
resp = self.fetch('/files',
method='POST',
body=json.dumps({'filePath': 'modules/test.py'}),
follow_redirects=False)
assert resp.code == 400
def test_dangerous_file_path(self):
resp = self.fetch('/files',
method='POST',
body=json.dumps({
'filePath': '~/.ssh/config',
'content': 'Bad code'
}),
follow_redirects=False)
assert resp.code == 200
self.assert_file_and_remove('.ssh/config', 'Bad code', response=resp)
resp = self.fetch('/files',
method='POST',
body=json.dumps({
'filePath': '../../../..ssh/config',
'content': 'Bad code'
}),
follow_redirects=False)
assert resp.code == 200
# Assert that file exists
self.assert_file_and_remove('ssh/config')
resp = self.fetch('/files',
method='POST',
body=json.dumps({
'filePath': '../../../../ssh/config',
'content': 'Bad code'
}),
follow_redirects=False)
assert resp.code == 200
# Assert that file exists
self.assert_file_and_remove('ssh/config', response=resp)
def test_fetching_file_with_encoded_file_name(self):
resp = self.fetch('/files',
method='POST',
body=json.dumps({
'filePath': 'modules/test.py',
'content': 'print("Hello")'
}),
follow_redirects=False)
assert resp.code == 200
resp = self.fetch('/files/modules%2Ftest.py', method='GET')
assert resp.code == 200
assert resp.body == b'print("Hello")'
def test_fetching_file_with_unencoded_file_name(self):
resp = self.fetch('/files',
method='POST',
body=json.dumps({
'filePath': 'modules/test.py',
'content': 'print("Hello")'
}),
follow_redirects=False)
assert resp.code == 200
resp = self.fetch('/files/modules/test.py', method='GET')
assert resp.code == 404
self.assert_file_and_remove('modules/test.py')
def test_non_existent_file(self):
resp = self.fetch('/files/modules%2Ftest.py', method='GET')
assert resp.code == 404
@pytest.mark.integration
@pytest.mark.handlers
class TestFileExecutionHandler(TestHandlerBase):
def test_missing_args(self):
resp = self.fetch('/file-runs/', method='POST', body=json.dumps({}))
assert resp.code == 400
resp = self.fetch('/file-runs/',
method='POST',
body=json.dumps({'cellId': 'cid'}))
assert resp.code == 400
resp = self.fetch('/file-runs/',
method='POST',
body=json.dumps({
'cellId': 'cid',
'channel': 'channel'
}))
assert resp.code == 400
resp = self.fetch('/file-runs/',
method='POST',
body=json.dumps({
'cellId': 'cid',
'channel': 'channel',
'filePath': ''
}))
assert resp.code == 400
def test_non_existent_file_exec(self):
resp = self.fetch('/file-runs/',
method='POST',
body=json.dumps({
'cellId': 'cid',
'channel': 'channel',
'filePath': 'modules/test.py'
}))
assert resp.code == 404
def test_invalid_file_extension(self):
app = self.get_app()
file_path = os.path.join(app.config.FILE_ROOT_DIR, 'modules/test.sh')
with open(file_path, 'w') as f:
f.write('echo Hello')
resp = self.fetch('/file-runs/',
method='POST',
body=json.dumps({
'cellId': 'cid',
'channel': 'channel',
'filePath': 'modules/test.sh'
}))
assert resp.code == 400
os.unlink(file_path)
def test_file_run_success(self):
app = self.get_app()
file_path = os.path.join(app.config.FILE_ROOT_DIR, 'modules/test.py')
with open(file_path, 'w') as f:
f.write('print("Hello")')
resp = self.fetch('/file-runs/',
method='POST',
body=json.dumps({
'cellId': 'cid',
'channel': 'channel',
'filePath': 'modules/test.py'
}))
assert resp.code == 200
assert self.socketio.find_event(CellEvents.START_RUN, {
'id': 'cid',
'status': CellExecutionStatus.BUSY
},
room='channel',
namespace=CELLS_NAMESPACE)
assert self.socketio.find_event(CellEvents.RESULT, {
'id': 'cid',
'output': 'Hello\n',
'error': ''
},
room='channel',
namespace=CELLS_NAMESPACE)
assert self.socketio.find_event(CellEvents.END_RUN, {
'id': 'cid',
'status': CellExecutionStatus.DONE
},
room='channel',
namespace=CELLS_NAMESPACE)
os.unlink(file_path)
def test_file_run_failure(self):
app = self.get_app()
file_path = os.path.join(app.config.FILE_ROOT_DIR, 'modules/test.py')
with open(file_path, 'w') as f:
f.write('print("Hello"')
resp = self.fetch('/file-runs/',
method='POST',
body=json.dumps({
'cellId': 'cid',
'channel': 'channel',
'filePath': 'modules/test.py'
}))
assert resp.code == 200
assert self.socketio.find_event(CellEvents.START_RUN, {
'id': 'cid',
'status': CellExecutionStatus.BUSY
},
room='channel',
namespace=CELLS_NAMESPACE)
assert self.socketio.find_event(CellEvents.RESULT, {
'id':
'cid',
'output':
'',
'error':
' File "modules/test.py", line 2\n \n '
' ^\nSyntaxError: unexpected EOF while parsing\n'
},
room='channel',
namespace=CELLS_NAMESPACE)
assert self.socketio.find_event(CellEvents.END_RUN, {
'id': 'cid',
'status': CellExecutionStatus.ERROR
},
room='channel',
namespace=CELLS_NAMESPACE)
os.unlink(file_path)
| 35.695082
| 77
| 0.420961
| 911
| 10,887
| 4.897914
| 0.136114
| 0.049305
| 0.061183
| 0.072613
| 0.797624
| 0.776109
| 0.763559
| 0.74563
| 0.727701
| 0.680412
| 0
| 0.011548
| 0.467071
| 10,887
| 304
| 78
| 35.8125
| 0.757497
| 0.008726
| 0
| 0.692308
| 0
| 0
| 0.131362
| 0.010476
| 0
| 0
| 0
| 0
| 0.157895
| 1
| 0.052632
| false
| 0
| 0.020243
| 0
| 0.080972
| 0.048583
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
fcd8123688bde088722a4d0749e717e6225dc16b
| 74
|
py
|
Python
|
milk/measures/__init__.py
|
tzuryby/milk
|
a7159b748414d4d095741978fb994c4affcf6b9b
|
[
"MIT"
] | 1
|
2015-11-05T12:31:00.000Z
|
2015-11-05T12:31:00.000Z
|
milk/measures/__init__.py
|
tzuryby/milk
|
a7159b748414d4d095741978fb994c4affcf6b9b
|
[
"MIT"
] | null | null | null |
milk/measures/__init__.py
|
tzuryby/milk
|
a7159b748414d4d095741978fb994c4affcf6b9b
|
[
"MIT"
] | null | null | null |
from measures import accuracy, waccuracy, zero_one_loss, confusion_matrix
| 37
| 73
| 0.864865
| 10
| 74
| 6.1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.094595
| 74
| 1
| 74
| 74
| 0.910448
| 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
| 1
| 0
|
0
| 5
|
fce69ea48d9d6a8537d0d09c2f75b149a0b501f0
| 109
|
py
|
Python
|
src/test/test_python/test_wifi.py
|
Ladvien/micro-python-repl
|
b4683f8e43b54f75d5c53177524c2463251f9ac9
|
[
"MIT"
] | null | null | null |
src/test/test_python/test_wifi.py
|
Ladvien/micro-python-repl
|
b4683f8e43b54f75d5c53177524c2463251f9ac9
|
[
"MIT"
] | null | null | null |
src/test/test_python/test_wifi.py
|
Ladvien/micro-python-repl
|
b4683f8e43b54f75d5c53177524c2463251f9ac9
|
[
"MIT"
] | null | null | null |
import network
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
sta_if.connect('SSID', 'password')
| 18.166667
| 37
| 0.770642
| 18
| 109
| 4.444444
| 0.555556
| 0.25
| 0.3
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.082569
| 109
| 5
| 38
| 21.8
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.25
| 0.25
| 0
| 0.25
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
fcea12afd438e8f47f69f31ff693434516a0fb5a
| 15,058
|
py
|
Python
|
examples/temporal_rev_learn/utils.py
|
dimarkov/pyBefit
|
1d24ce6e488ecd9826862bcd765661407d8546f3
|
[
"MIT"
] | 1
|
2018-09-28T17:33:38.000Z
|
2018-09-28T17:33:38.000Z
|
examples/temporal_rev_learn/utils.py
|
dimarkov/pyBefit
|
1d24ce6e488ecd9826862bcd765661407d8546f3
|
[
"MIT"
] | null | null | null |
examples/temporal_rev_learn/utils.py
|
dimarkov/pyBefit
|
1d24ce6e488ecd9826862bcd765661407d8546f3
|
[
"MIT"
] | 1
|
2018-09-28T17:33:41.000Z
|
2018-09-28T17:33:41.000Z
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Various utility functions for simulations and inference
@author: Dimitrije Markovic
"""
import jax.numpy as jnp
import numpyro as npyro
import numpyro.distributions as dist
from jax import random, lax, nn
from numpyro.infer import log_likelihood
from numpyro.distributions import TransformedDistribution, transforms
from opt_einsum import contract
from numpyro.contrib.control_flow import scan
from pybefit.agents import HSMMAI as Agent
from pybefit.agents import logits
def einsum(equation, *args):
return contract(equation, *args, backend='jax')
def simulator(process, agent, gamma, seed=0, **model_kw):
# POMDP simulator
def sim_fn(carry, t):
rng_key, prior = carry
rng_key, _rng_key = random.split(rng_key)
choices = agent.action_selection(_rng_key, prior, gamma=gamma[..., t, :], **model_kw)
outcomes = process(t, choices)
posterior = agent.learning(t, outcomes, choices, prior)
return (rng_key, posterior), {'outcomes': outcomes,
'choices': choices}
rng_key = random.PRNGKey(seed)
_, sequence = lax.scan(sim_fn, (rng_key, agent.prior), jnp.arange(agent.T))
sequence['outcomes'].block_until_ready()
return sequence
def estimate_beliefs(outcomes, choices, device, mask=1, nu_max=10, nu_min=0, **kwargs):
# belief estimator from fixed responses and outcomes
T, N = choices.shape
assert outcomes.shape == (T, N)
agent = Agent(T, N, nu_max=nu_max, nu_min=nu_min, mask=mask, device=device, prior_kwargs=kwargs)
def sim_fn(carry, t):
prior = carry
posterior = agent.learning(t, outcomes[t], choices[t], prior)
p_cfm, params = prior
p_c = einsum('...cfm->...c', p_cfm)
return posterior, {'beliefs': (p_c, params)}
_, sequence = lax.scan(sim_fn, agent.prior, jnp.arange(T))
sequence['beliefs'][0].block_until_ready()
return sequence, agent
def generative_model(beliefs, y=None, mask=True):
# generative model
T, N = beliefs[0].shape[:2]
with npyro.plate('N', N):
gamma = npyro.sample('gamma', dist.Gamma(20., 2.))
td = TransformedDistribution(
dist.Normal(jnp.array([-1., .7]), jnp.array([1., 0.2])).to_event(1),
transforms.OrderedTransform()
)
lams = npyro.sample('lams', td)
U = jnp.pad(lams, ((0, 0), (0, 2)), 'constant', constant_values=(0,))
with npyro.plate('T', T):
logs = npyro.deterministic('logits', logits(beliefs, jnp.expand_dims(gamma, -1), jnp.expand_dims(U, -2)) )
npyro.sample('y', dist.CategoricalLogits(logs).mask(mask), obs=y)
def log_pred_density(model, samples, *args, **kwargs):
# waic score of posterior samples
log_lk = log_likelihood(model, samples, *args, **kwargs)['y']
ll = log_lk.sum(-1)
S = ll.shape[0]
lppd = nn.logsumexp(ll, 0) - jnp.log(S)
p_waic = jnp.var(ll, axis=0, ddof=1)
return lppd - p_waic, log_lk
def single_model(beliefs, y, mask, dynamic_gamma=False, dynamic_preference=False):
if dynamic_gamma:
if dynamic_preference:
fulldyn_single_model(beliefs, y, mask)
else:
gammadyn_single_model(beliefs, y, mask)
else:
if dynamic_preference:
prefdyn_single_model(beliefs, y, mask)
else:
nondyn_single_model(beliefs, y, mask)
def fulldyn_single_model(beliefs, y, mask):
T, _ = beliefs[0].shape
c0 = beliefs[-1]
mu = npyro.sample('mu', dist.Normal(5., 5.))
lam12 = npyro.sample('lam12', dist.HalfCauchy(1.).expand([2]).to_event(1))
lam34 = npyro.sample('lam34', dist.HalfCauchy(1.))
_lam34 = jnp.expand_dims(lam34, -1)
lam0 = npyro.deterministic('lam0', jnp.concatenate([lam12.cumsum(-1), _lam34, _lam34], -1))
eta = npyro.sample('eta', dist.Beta(1, 10))
scale = npyro.sample('scale', dist.HalfNormal(1.))
theta = npyro.sample('theta', dist.HalfCauchy(5.))
rho = jnp.exp(- theta)
sigma = jnp.sqrt( (1 - rho**2) / (2 * theta) ) * scale
x0 = jnp.zeros(1)
def transition_fn(carry, t):
lam_prev, x_prev = carry
gamma = npyro.deterministic('gamma', nn.softplus(mu + x_prev))
U = jnp.log(lam_prev) - jnp.log(lam_prev.sum(-1, keepdims=True))
logs = logits((beliefs[0][t], beliefs[1][t]), jnp.expand_dims(gamma, -1), jnp.expand_dims(U, -2))
lam_next = npyro.deterministic('lams', lam_prev + nn.one_hot(beliefs[2][t], 4) * jnp.expand_dims(mask[t] * eta, -1))
npyro.sample('y', dist.CategoricalLogits(logs).mask(mask[t]))
noise = npyro.sample('dw', dist.Normal(0., 1.))
x_next = rho * x_prev + sigma * noise
return (lam_next, x_next), None
lam_start = npyro.deterministic('lam_start', lam0 + jnp.expand_dims(eta, -1) * c0)
with npyro.handlers.condition(data={"y": y}):
scan(
transition_fn, (lam_start, x0), jnp.arange(T)
)
def gammadyn_single_model(beliefs, y, mask):
T, _ = beliefs[0].shape
gamma = npyro.sample('gamma', dist.InverseGamma(2., 2.))
lam12 = npyro.sample('lam12', dist.HalfCauchy(1.).expand([2]).to_event(1))
lam34 = npyro.sample('lam34', dist.HalfCauchy(1.))
_lam34 = jnp.expand_dims(lam34, -1)
lam0 = npyro.deterministic('lam0', jnp.concatenate([lam12.cumsum(-1), _lam34, _lam34], -1))
U = jnp.log(lam0) - jnp.log(lam0.sum(-1, keepdims=True))
scale = npyro.sample('scale', dist.HalfNormal(1.))
theta = npyro.sample('theta', dist.HalfCauchy(5.))
rho = jnp.exp(- theta)
sigma = jnp.sqrt( (1 - rho**2) / (2 * theta) ) * scale
x0 = jnp.zeros(1)
def transition_fn(carry, t):
x_prev = carry
dyn_gamma = npyro.deterministic('dyn_gamma', nn.softplus( jnp.log(jnp.exp(gamma) - 1) + x_prev))
logs = logits((beliefs[0][t], beliefs[1][t]), jnp.expand_dims(gamma, -1), jnp.expand_dims(U, -2))
npyro.sample('y', dist.CategoricalLogits(logs).mask(mask[t]))
noise = npyro.sample('dw', dist.Normal(0., 1.))
x_next = rho * x_prev + sigma * noise
return x_next, None
with npyro.handlers.condition(data={"y": y}):
scan(
transition_fn, x0, jnp.arange(T)
)
def prefdyn_single_model(beliefs, y, mask):
T, _ = beliefs[0].shape
c0 = beliefs[-1]
lam12 = npyro.sample('lam12', dist.HalfCauchy(1.).expand([2]).to_event(1))
lam34 = npyro.sample('lam34', dist.HalfCauchy(1.))
_lam34 = jnp.expand_dims(lam34, -1)
lam0 = npyro.deterministic('lam0', jnp.concatenate([lam12.cumsum(-1), _lam34, _lam34], -1))
eta = npyro.sample('eta', dist.Beta(1, 10))
gamma = npyro.sample('gamma', dist.InverseGamma(2., 2.))
def transition_fn(carry, t):
lam_prev = carry
U = jnp.log(lam_prev) - jnp.log(lam_prev.sum(-1, keepdims=True))
logs = logits((beliefs[0][t], beliefs[1][t]), jnp.expand_dims(gamma, -1), jnp.expand_dims(U, -2))
lam_next = npyro.deterministic('lams', lam_prev + nn.one_hot(beliefs[2][t], 4) * jnp.expand_dims(mask[t] * eta, -1))
npyro.sample('y', dist.CategoricalLogits(logs).mask(mask[t]))
return lam_next, None
lam_start = npyro.deterministic('lam_start', lam0 + jnp.expand_dims(eta, -1) * c0)
with npyro.handlers.condition(data={"y": y}):
scan(
transition_fn, lam_start, jnp.arange(T)
)
def nondyn_single_model(beliefs, y, mask):
T, _ = beliefs[0].shape
lam12 = npyro.sample('lam12', dist.HalfCauchy(1.).expand([2]).to_event(1))
lam34 = npyro.sample('lam34', dist.HalfCauchy(1.))
_lam34 = jnp.expand_dims(lam34, -1)
lam0 = npyro.deterministic('lam0', jnp.concatenate([lam12.cumsum(-1), _lam34, _lam34], -1))
U = jnp.log(lam0) - jnp.log(lam0.sum(-1, keepdims=True))
gamma = npyro.sample('gamma', dist.InverseGamma(2., 2.))
def transition_fn(carry, t):
logs = logits((beliefs[0][t], beliefs[1][t]), jnp.expand_dims(gamma, -1), jnp.expand_dims(U, -2))
npyro.sample('y', dist.CategoricalLogits(logs).mask(mask[t]))
return None, None
with npyro.handlers.condition(data={"y": y}):
scan(
transition_fn, None, jnp.arange(T)
)
def mixture_model(beliefs, y, mask, dynamic_gamma=False, dynamic_preference=False):
if dynamic_gamma:
if dynamic_preference:
fulldyn_mixture_model(beliefs, y, mask)
else:
gammadyn_mixture_model(beliefs, y, mask)
else:
if dynamic_preference:
prefdyn_mixture_model(beliefs, y, mask)
else:
nondynamic_mixture_model(beliefs, y, mask)
def fulldyn_mixture_model(beliefs, y, mask):
M, T, N, _ = beliefs[0].shape
c0 = beliefs[-1]
tau = .5
with npyro.plate('N', N):
weights = npyro.sample('weights', dist.Dirichlet(tau * jnp.ones(M)))
assert weights.shape == (N, M)
mu = npyro.sample('mu', dist.Normal(5., 5.))
lam12 = npyro.sample('lam12', dist.HalfCauchy(1.).expand([2]).to_event(1))
lam34 = npyro.sample('lam34', dist.HalfCauchy(1.))
_lam34 = jnp.expand_dims(lam34, -1)
lam0 = npyro.deterministic('lam0', jnp.concatenate([lam12.cumsum(-1), _lam34, _lam34], -1))
eta = npyro.sample('eta', dist.Beta(1, 10))
scale = npyro.sample('scale', dist.HalfNormal(1.))
theta = npyro.sample('theta', dist.HalfCauchy(5.))
rho = jnp.exp(- theta)
sigma = jnp.sqrt( (1 - rho**2) / (2 * theta) ) * scale
x0 = jnp.zeros(N)
def transition_fn(carry, t):
lam_prev, x_prev = carry
gamma = npyro.deterministic('gamma', nn.softplus(mu + x_prev))
U = jnp.log(lam_prev) - jnp.log(lam_prev.sum(-1, keepdims=True))
logs = logits((beliefs[0][:, t], beliefs[1][:, t]), jnp.expand_dims(gamma, -1), jnp.expand_dims(U, -2))
lam_next = npyro.deterministic('lams', lam_prev + nn.one_hot(beliefs[2][t], 4) * jnp.expand_dims(mask[t] * eta, -1))
mixing_dist = dist.CategoricalProbs(weights)
component_dist = dist.CategoricalLogits(logs.swapaxes(0, 1)).mask(mask[t][..., None])
with npyro.plate('subjects', N):
y = npyro.sample('y', dist.MixtureSameFamily(mixing_dist, component_dist))
noise = npyro.sample('dw', dist.Normal(0., 1.))
x_next = rho * x_prev + sigma * noise
return (lam_next, x_next), None
lam_start = npyro.deterministic('lam_start', lam0 + jnp.expand_dims(eta, -1) * c0)
with npyro.handlers.condition(data={"y": y}):
scan(
transition_fn, (lam_start, x0), jnp.arange(T)
)
def prefdyn_mixture_model(beliefs, y, mask):
M, T, N, _ = beliefs[0].shape
c0 = beliefs[-1]
tau = .5
with npyro.plate('N', N):
weights = npyro.sample('weights', dist.Dirichlet(tau * jnp.ones(M)))
assert weights.shape == (N, M)
mu = npyro.sample('mu', dist.Normal(5., 5.))
lam12 = npyro.sample('lam12', dist.HalfCauchy(1.).expand([2]).to_event(1))
lam34 = npyro.sample('lam34', dist.HalfCauchy(1.))
_lam34 = jnp.expand_dims(lam34, -1)
lam0 = npyro.deterministic('lam0', jnp.concatenate([lam12.cumsum(-1), _lam34, _lam34], -1))
eta = npyro.sample('eta', dist.Beta(1, 10))
gamma = npyro.deterministic('gamma', nn.softplus(mu))
def transition_fn(carry, t):
lam_prev = carry
U = jnp.log(lam_prev) - jnp.log(lam_prev.sum(-1, keepdims=True))
logs = logits((beliefs[0][:, t], beliefs[1][:, t]), jnp.expand_dims(gamma, -1), jnp.expand_dims(U, -2))
lam_next = npyro.deterministic('lams', lam_prev + nn.one_hot(beliefs[2][t], 4) * jnp.expand_dims(mask[t] * eta, -1))
mixing_dist = dist.CategoricalProbs(weights)
component_dist = dist.CategoricalLogits(logs.swapaxes(0, 1)).mask(mask[t][..., None])
with npyro.plate('subjects', N):
npyro.sample('y', dist.MixtureSameFamily(mixing_dist, component_dist))
return (lam_next), None
lam_start = npyro.deterministic('lam_start', lam0 + jnp.expand_dims(eta, -1) * c0)
with npyro.handlers.condition(data={"y": y}):
scan(
transition_fn, (lam_start), jnp.arange(T)
)
def gammadyn_mixture_model(beliefs, y, mask):
M, T, _ = beliefs[0].shape
tau = .5
weights = npyro.sample('weights', dist.Dirichlet(tau * jnp.ones(M)))
assert weights.shape == (M,)
gamma = npyro.sample('gamma', dist.InverseGamma(2., 2.))
mu = jnp.log(jnp.exp(gamma) - 1)
p = npyro.sample('p', dist.Dirichlet(jnp.ones(3)))
p0 = npyro.deterministic('p0',
jnp.concatenate([p[..., :1]/2, p[..., :1]/2 + p[..., 1:2], p[..., 2:]/2, p[..., 2:]/2], -1)
)
scale = npyro.sample('scale', dist.Gamma(1., 1.))
rho = npyro.sample('rho', dist.Beta(1., 2.))
sigma = jnp.sqrt( - (1 - rho**2) / (2 * jnp.log(rho)) ) * scale
U = jnp.log(p0)
def transition_fn(carry, t):
x_prev = carry
gamma_dyn = npyro.deterministic('gamma_dyn', nn.softplus(mu + x_prev))
logs = logits((beliefs[0][:, t],
beliefs[1][:, t]),
jnp.expand_dims(gamma_dyn, -1),
jnp.expand_dims(U, -2))
mixing_dist = dist.CategoricalProbs(weights)
component_dist = dist.CategoricalLogits(logs).mask(mask[t])
npyro.sample('y', dist.MixtureSameFamily(mixing_dist, component_dist))
with npyro.handlers.reparam(config={"x_next": npyro.infer.reparam.TransformReparam()}):
affine = dist.transforms.AffineTransform(rho*x_prev, sigma)
x_next = npyro.sample('x_next', dist.TransformedDistribution(dist.Normal(0., 1.), affine))
return (x_next), None
x0 = jnp.zeros(1)
with npyro.handlers.condition(data={"y": y}):
scan(
transition_fn, (x0), jnp.arange(T)
)
def nondynamic_mixture_model(beliefs, y, mask):
M, T, _ = beliefs[0].shape
tau = .5
weights = npyro.sample('weights', dist.Dirichlet(tau * jnp.ones(M)))
assert weights.shape == (M,)
gamma = npyro.sample('gamma', dist.InverseGamma(2., 2.))
p = npyro.sample('p', dist.Dirichlet(jnp.ones(3)))
p0 = npyro.deterministic('p0', jnp.concatenate([p[..., :1]/2, p[..., :1]/2 + p[..., 1:2], p[..., 2:]/2, p[..., 2:]/2], -1))
U = jnp.log(p0)
def transition_fn(carry, t):
logs = logits((beliefs[0][:, t], beliefs[1][:, t]), jnp.expand_dims(gamma, -1), jnp.expand_dims(U, -2))
mixing_dist = dist.CategoricalProbs(weights)
component_dist = dist.CategoricalLogits(logs).mask(mask[t])
npyro.sample('y', dist.MixtureSameFamily(mixing_dist, component_dist))
return None, None
with npyro.handlers.condition(data={"y": y}):
scan(
transition_fn, None, jnp.arange(T)
)
| 33.762332
| 127
| 0.606389
| 2,056
| 15,058
| 4.316634
| 0.102626
| 0.06569
| 0.046873
| 0.034479
| 0.78062
| 0.747493
| 0.713239
| 0.707831
| 0.701183
| 0.671549
| 0
| 0.032944
| 0.225926
| 15,058
| 446
| 128
| 33.762332
| 0.728466
| 0.016138
| 0
| 0.622837
| 0
| 0
| 0.028035
| 0
| 0
| 0
| 0
| 0
| 0.017301
| 1
| 0.086505
| false
| 0
| 0.034602
| 0.00346
| 0.16955
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
fcfb11c55122b97ba21767929257af72f7b25677
| 101
|
py
|
Python
|
main.py
|
OlegMoiseev/tryCI
|
f2fc638d3d85720766c7b27a032d8b9bb3ce4633
|
[
"Apache-2.0"
] | null | null | null |
main.py
|
OlegMoiseev/tryCI
|
f2fc638d3d85720766c7b27a032d8b9bb3ce4633
|
[
"Apache-2.0"
] | null | null | null |
main.py
|
OlegMoiseev/tryCI
|
f2fc638d3d85720766c7b27a032d8b9bb3ce4633
|
[
"Apache-2.0"
] | null | null | null |
import numpy as np
def add(x, y):
return x + y
def get_zero_matrix(n):
return np.zeros((n, n))
| 10.1
| 24
| 0.643564
| 21
| 101
| 3
| 0.666667
| 0.063492
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.217822
| 101
| 9
| 25
| 11.222222
| 0.797468
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0.2
| 0.4
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
1e1304e99800167fefd9009f7950cc8e6d8262c8
| 164
|
py
|
Python
|
myvenv/lib/python3.5/site-packages/allauth/socialaccount/providers/amazon/urls.py
|
tuvapp/tuvappcom
|
5ca2be19f4b0c86a1d4a9553711a4da9d3f32841
|
[
"MIT"
] | 3
|
2015-02-13T15:06:40.000Z
|
2016-05-23T23:23:11.000Z
|
myvenv/lib/python3.5/site-packages/allauth/socialaccount/providers/amazon/urls.py
|
tuvapp/tuvappcom
|
5ca2be19f4b0c86a1d4a9553711a4da9d3f32841
|
[
"MIT"
] | 9
|
2020-06-05T17:18:43.000Z
|
2022-03-11T23:15:04.000Z
|
myvenv/lib/python3.5/site-packages/allauth/socialaccount/providers/amazon/urls.py
|
tuvapp/tuvappcom
|
5ca2be19f4b0c86a1d4a9553711a4da9d3f32841
|
[
"MIT"
] | 3
|
2015-08-13T22:28:36.000Z
|
2016-07-04T18:46:46.000Z
|
from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns
from .provider import AmazonProvider
urlpatterns = default_urlpatterns(AmazonProvider)
| 32.8
| 75
| 0.878049
| 17
| 164
| 8.352941
| 0.647059
| 0.253521
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006579
| 0.073171
| 164
| 4
| 76
| 41
| 0.927632
| 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 | 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
| 1
| 0
|
0
| 5
|
1e771e9de7ffaa39b7f5a42bf041dc70c63f203f
| 65
|
py
|
Python
|
tasks/mm_tasks/__init__.py
|
JustinLin610/OFA
|
f71efb85ead76bcb8b78e7020e182f108e4e9b36
|
[
"Apache-2.0"
] | null | null | null |
tasks/mm_tasks/__init__.py
|
JustinLin610/OFA
|
f71efb85ead76bcb8b78e7020e182f108e4e9b36
|
[
"Apache-2.0"
] | null | null | null |
tasks/mm_tasks/__init__.py
|
JustinLin610/OFA
|
f71efb85ead76bcb8b78e7020e182f108e4e9b36
|
[
"Apache-2.0"
] | null | null | null |
from .caption import CaptionTask
from .refcoco import RefcocoTask
| 32.5
| 32
| 0.861538
| 8
| 65
| 7
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.107692
| 65
| 2
| 33
| 32.5
| 0.965517
| 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
| 1
| 0
|
0
| 5
|
bf727168d4170005ebc5946d4cb30b7f91218416
| 43
|
py
|
Python
|
lib/nodegam/__init__.py
|
zzzace2000/cairl_nodegam
|
90d0d56a0e7be3d1cbba6179cbfc36d626456770
|
[
"MIT"
] | 3
|
2021-11-10T14:48:24.000Z
|
2022-01-03T12:35:39.000Z
|
lib/nodegam/__init__.py
|
zzzace2000/cairl_nodegam
|
90d0d56a0e7be3d1cbba6179cbfc36d626456770
|
[
"MIT"
] | null | null | null |
lib/nodegam/__init__.py
|
zzzace2000/cairl_nodegam
|
90d0d56a0e7be3d1cbba6179cbfc36d626456770
|
[
"MIT"
] | null | null | null |
from .arch import *
from .nn_utils import *
| 21.5
| 23
| 0.744186
| 7
| 43
| 4.428571
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.162791
| 43
| 2
| 23
| 21.5
| 0.861111
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
bf8699a1ad524bfa182495ea2f084bb6fa24d0e4
| 20,371
|
py
|
Python
|
tests/layout/test_footnotes.py
|
03psb/WeasyPrint
|
fa1d1766c7e0b7e64ca8d43243022e762930d650
|
[
"BSD-3-Clause"
] | null | null | null |
tests/layout/test_footnotes.py
|
03psb/WeasyPrint
|
fa1d1766c7e0b7e64ca8d43243022e762930d650
|
[
"BSD-3-Clause"
] | null | null | null |
tests/layout/test_footnotes.py
|
03psb/WeasyPrint
|
fa1d1766c7e0b7e64ca8d43243022e762930d650
|
[
"BSD-3-Clause"
] | null | null | null |
"""
weasyprint.tests.layout.footnotes
---------------------------------
Tests for footnotes layout.
"""
import pytest
from ..testing_utils import assert_no_logs, render_pages, tree_position
@assert_no_logs
def test_inline_footnote():
page, = render_pages('''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
size: 9px 7px;
background: white;
}
div {
font-family: weasyprint;
font-size: 2px;
line-height: 1;
}
span {
float: footnote;
}
</style>
<div>abc<span>de</span></div>''')
html, footnote_area = page.children
body, = html.children
div, = body.children
div_textbox, footnote_call = div.children[0].children
assert div_textbox.text == 'abc'
assert footnote_call.children[0].text == '1'
assert div_textbox.position_y == 0
footnote_marker, footnote_textbox = (
footnote_area.children[0].children[0].children)
assert footnote_marker.children[0].text == '1.'
assert footnote_textbox.text == 'de'
assert footnote_area.position_y == 5
@assert_no_logs
def test_block_footnote():
page, = render_pages('''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
size: 9px 7px;
background: white;
}
div {
font-family: weasyprint;
font-size: 2px;
line-height: 1;
}
div.footnote {
float: footnote;
}
</style>
<div>abc<div class="footnote">de</div></div>''')
html, footnote_area = page.children
body, = html.children
div, = body.children
div_textbox, footnote_call = div.children[0].children
assert div_textbox.text == 'abc'
assert footnote_call.children[0].text == '1'
assert div_textbox.position_y == 0
footnote_marker, footnote_textbox = (
footnote_area.children[0].children[0].children)
assert footnote_marker.children[0].text == '1.'
assert footnote_textbox.text == 'de'
assert footnote_area.position_y == 5
@assert_no_logs
def test_long_footnote():
page, = render_pages('''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
size: 9px 7px;
background: white;
}
div {
font-family: weasyprint;
font-size: 2px;
line-height: 1;
}
span {
float: footnote;
}
</style>
<div>abc<span>de f</span></div>''')
html, footnote_area = page.children
body, = html.children
div, = body.children
div_textbox, footnote_call = div.children[0].children
assert div_textbox.text == 'abc'
assert footnote_call.children[0].text == '1'
assert div_textbox.position_y == 0
footnote_line1, footnote_line2 = footnote_area.children[0].children
footnote_marker, footnote_content1 = footnote_line1.children
footnote_content2 = footnote_line2.children[0]
assert footnote_marker.children[0].text == '1.'
assert footnote_content1.text == 'de'
assert footnote_area.position_y == 3
assert footnote_content2.text == 'f'
assert footnote_content2.position_y == 5
@pytest.mark.xfail
@assert_no_logs
def test_after_marker_footnote():
# TODO: this syntax is in the specification, but we’re currently limited to
# one pseudo element per selector, according to CSS 2.1:
# https://drafts.csswg.org/css2/#selector-syntax
# and Selectors Level 3:
# https://drafts.csswg.org/selectors-3/#selector-syntax
# This limitation doesn’t exist anymore in Selectors Level 4:
# https://drafts.csswg.org/selectors-4/#typedef-compound-selector
page, = render_pages('''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
size: 9px 7px;
background: white;
}
div {
font-family: weasyprint;
font-size: 2px;
line-height: 1;
}
span {
float: footnote;
}
::footnote-marker::after {
content: '|';
}
</style>
<div>abc<span>de</span></div>''')
html, footnote_area = page.children
footnote_marker, _ = footnote_area.children[0].children[0].children
assert footnote_marker.children[0].text == '1.|'
@assert_no_logs
def test_several_footnote():
page1, page2, = render_pages('''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
size: 9px 7px;
background: white;
}
div {
font-family: weasyprint;
font-size: 2px;
line-height: 1;
orphans: 1;
widows: 1;
}
span {
float: footnote;
}
</style>
<div>abcd e<span>fg</span> hijk l<span>mn</span></div>''')
html1, footnote_area1 = page1.children
body1, = html1.children
div1, = body1.children
div1_line1, div1_line2 = div1.children
assert div1_line1.children[0].text == 'abcd'
div1_line2_text, div1_footnote_call = div1.children[1].children
assert div1_line2_text.text == 'e'
assert div1_footnote_call.children[0].text == '1'
footnote_marker1, footnote_textbox1 = (
footnote_area1.children[0].children[0].children)
assert footnote_marker1.children[0].text == '1.'
assert footnote_textbox1.text == 'fg'
html2, footnote_area2 = page2.children
body2, = html2.children
div2, = body2.children
div2_line1, div2_line2 = div2.children
assert div2_line1.children[0].text == 'hijk'
div2_line2_text, div2_footnote_call = div2.children[1].children
assert div2_line2_text.text == 'l'
assert div2_footnote_call.children[0].text == '2'
footnote_marker2, footnote_textbox2 = (
footnote_area2.children[0].children[0].children)
assert footnote_marker2.children[0].text == '2.'
assert footnote_textbox2.text == 'mn'
@assert_no_logs
def test_reported_footnote_1():
page1, page2, = render_pages('''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
size: 9px 7px;
background: white;
}
div {
font-family: weasyprint;
font-size: 2px;
line-height: 1;
orphans: 1;
widows: 1;
}
span {
float: footnote;
}
</style>
<div>abc<span>f1</span> hij<span>f2</span></div>''')
html1, footnote_area1 = page1.children
body1, = html1.children
div1, = body1.children
div_line1, div_line2 = div1.children
div_line1_text, div_footnote_call1 = div_line1.children
assert div_line1_text.text == 'abc'
assert div_footnote_call1.children[0].text == '1'
div_line2_text, div_footnote_call2 = div_line2.children
assert div_line2_text.text == 'hij'
assert div_footnote_call2.children[0].text == '2'
footnote_marker1, footnote_textbox1 = (
footnote_area1.children[0].children[0].children)
assert footnote_marker1.children[0].text == '1.'
assert footnote_textbox1.text == 'f1'
html2, footnote_area2 = page2.children
assert not html2.children
footnote_marker2, footnote_textbox2 = (
footnote_area2.children[0].children[0].children)
assert footnote_marker2.children[0].text == '2.'
assert footnote_textbox2.text == 'f2'
@assert_no_logs
def test_reported_footnote_2():
page1, page2, = render_pages('''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
size: 9px 7px;
background: white;
}
div {
font-family: weasyprint;
font-size: 2px;
line-height: 1;
orphans: 1;
widows: 1;
}
span {
float: footnote;
}
</style>
<div>abc<span>f1</span> hij<span>f2</span> wow</div>''')
html1, footnote_area1 = page1.children
body1, = html1.children
div1, = body1.children
div_line1, div_line2 = div1.children
div_line1_text, div_footnote_call1 = div_line1.children
assert div_line1_text.text == 'abc'
assert div_footnote_call1.children[0].text == '1'
div_line2_text, div_footnote_call2 = div_line2.children
assert div_line2_text.text == 'hij'
assert div_footnote_call2.children[0].text == '2'
footnote_marker1, footnote_textbox1 = (
footnote_area1.children[0].children[0].children)
assert footnote_marker1.children[0].text == '1.'
assert footnote_textbox1.text == 'f1'
html2, footnote_area2 = page2.children
body2, = html2.children
div2, = body2.children
div2_line, = div2.children
assert div2_line.children[0].text == 'wow'
footnote_marker2, footnote_textbox2 = (
footnote_area2.children[0].children[0].children)
assert footnote_marker2.children[0].text == '2.'
assert footnote_textbox2.text == 'f2'
@assert_no_logs
def test_reported_footnote_3():
page1, page2, = render_pages('''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
size: 9px 10px;
background: white;
}
div {
font-family: weasyprint;
font-size: 2px;
line-height: 1;
orphans: 1;
widows: 1;
}
span {
float: footnote;
}
</style>
<div>
abc<span>1</span>
def<span>v long 2</span>
ghi<span>3</span>
</div>''')
html1, footnote_area1 = page1.children
body1, = html1.children
div1, = body1.children
line1, line2, line3 = div1.children
assert line1.children[0].text == 'abc'
assert line1.children[1].children[0].text == '1'
assert line2.children[0].text == 'def'
assert line2.children[1].children[0].text == '2'
assert line3.children[0].text == 'ghi'
assert line3.children[1].children[0].text == '3'
footnote1, = footnote_area1.children
assert footnote1.children[0].children[0].children[0].text == '1.'
assert footnote1.children[0].children[1].text == '1'
html2, footnote_area2 = page2.children
footnote2, footnote3 = footnote_area2.children
assert footnote2.children[0].children[0].children[0].text == '2.'
assert footnote2.children[0].children[1].text == 'v'
assert footnote2.children[1].children[0].text == 'long'
assert footnote2.children[2].children[0].text == '2'
assert footnote3.children[0].children[0].children[0].text == '3.'
assert footnote3.children[0].children[1].text == '3'
@assert_no_logs
@pytest.mark.parametrize('css, tail', (
('p { break-inside: avoid }', '<br>e<br>f'),
('p { widows: 4 }', '<br>e<br>f'),
('p + p { break-before: avoid }', '</p><p>e<br>f'),
))
def test_footnote_area_after_call(css, tail):
pages = render_pages('''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
size: 9px 10px;
background: white;
margin: 0;
}
body {
font-family: weasyprint;
font-size: 2px;
line-height: 1;
orphans: 2;
widows: 2;
margin: 0;
}
span {
float: footnote;
}
%s
</style>
<div>a<br>b</div>
<p>c<br>d<span>x</span>%s</p>''' % (css, tail))
footnote_call = tree_position(
pages, lambda box: box.element_tag == 'p::footnote-call')
footnote_area = tree_position(
pages, lambda box: type(box).__name__ == 'FootnoteAreaBox')
assert footnote_call < footnote_area
@assert_no_logs
def test_footnote_display_inline():
page, = render_pages('''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
size: 9px 50px;
background: white;
}
div {
font-family: weasyprint;
font-size: 2px;
line-height: 1;
}
span {
float: footnote;
footnote-display: inline;
}
</style>
<div>abc<span>d</span> fgh<span>i</span></div>''')
html, footnote_area = page.children
body, = html.children
div, = body.children
div_line1, div_line2 = div.children
div_textbox1, footnote_call1 = div_line1.children
div_textbox2, footnote_call2 = div_line2.children
assert div_textbox1.text == 'abc'
assert div_textbox2.text == 'fgh'
assert footnote_call1.children[0].text == '1'
assert footnote_call2.children[0].text == '2'
line = footnote_area.children[0]
footnote_mark1, footnote_textbox1 = line.children[0].children
footnote_mark2, footnote_textbox2 = line.children[1].children
assert footnote_mark1.children[0].text == '1.'
assert footnote_textbox1.text == 'd'
assert footnote_mark2.children[0].text == '2.'
assert footnote_textbox2.text == 'i'
@assert_no_logs
def test_footnote_longer_than_space_left():
page1, page2 = render_pages('''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
size: 9px 7px;
background: white;
}
div {
font-family: weasyprint;
font-size: 2px;
line-height: 1;
}
span {
float: footnote;
}
</style>
<div>abc<span>def ghi jkl</span></div>''')
html1, = page1.children
body1, = html1.children
div, = body1.children
div_textbox, footnote_call = div.children[0].children
assert div_textbox.text == 'abc'
assert footnote_call.children[0].text == '1'
html2, footnote_area = page2.children
assert not html2.children
footnote_line1, footnote_line2, footnote_line3 = (
footnote_area.children[0].children)
footnote_marker, footnote_content1 = footnote_line1.children
footnote_content2 = footnote_line2.children[0]
footnote_content3 = footnote_line3.children[0]
assert footnote_marker.children[0].text == '1.'
assert footnote_content1.text == 'def'
assert footnote_content2.text == 'ghi'
assert footnote_content3.text == 'jkl'
@assert_no_logs
def test_footnote_longer_than_page():
# Nothing is defined for this use case in the specification. In WeasyPrint,
# the content simply overflows.
page1, page2 = render_pages('''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
size: 9px 7px;
background: white;
}
div {
font-family: weasyprint;
font-size: 2px;
line-height: 1;
}
span {
float: footnote;
}
</style>
<div>abc<span>def ghi jkl mno</span></div>''')
html1, = page1.children
body1, = html1.children
div, = body1.children
div_textbox, footnote_call = div.children[0].children
assert div_textbox.text == 'abc'
assert footnote_call.children[0].text == '1'
html2, footnote_area2 = page2.children
assert not html2.children
footnote_line1, footnote_line2, footnote_line3, footnote_line4 = (
footnote_area2.children[0].children)
footnote_marker1, footnote_content1 = footnote_line1.children
footnote_content2 = footnote_line2.children[0]
footnote_content3 = footnote_line3.children[0]
footnote_content4 = footnote_line4.children[0]
assert footnote_marker1.children[0].text == '1.'
assert footnote_content1.text == 'def'
assert footnote_content2.text == 'ghi'
assert footnote_content3.text == 'jkl'
assert footnote_content4.text == 'mno'
@assert_no_logs
def test_footnote_policy_line():
page1, page2 = render_pages('''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
size: 9px 9px;
background: white;
}
div {
font-family: weasyprint;
font-size: 2px;
line-height: 1;
}
span {
float: footnote;
footnote-policy: line;
}
</style>
<div>abc def ghi jkl<span>1</span></div>''')
html, = page1.children
body, = html.children
div, = body.children
linebox1, linebox2 = div.children
assert linebox1.children[0].text == 'abc'
assert linebox2.children[0].text == 'def'
html, footnote_area = page2.children
body, = html.children
div, = body.children
linebox1, linebox2 = div.children
assert linebox1.children[0].text == 'ghi'
assert linebox2.children[0].text == 'jkl'
assert linebox2.children[1].children[0].text == '1'
footnote_marker, footnote_textbox = (
footnote_area.children[0].children[0].children)
assert footnote_marker.children[0].text == '1.'
assert footnote_textbox.text == '1'
@assert_no_logs
def test_footnote_policy_block():
page1, page2 = render_pages('''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
size: 9px 9px;
background: white;
}
div {
font-family: weasyprint;
font-size: 2px;
line-height: 1;
}
span {
float: footnote;
footnote-policy: block;
}
</style>
<div>abc</div><div>def ghi jkl<span>1</span></div>''')
html, = page1.children
body, = html.children
div, = body.children
linebox1, = div.children
assert linebox1.children[0].text == 'abc'
html, footnote_area = page2.children
body, = html.children
div, = body.children
linebox1, linebox2, linebox3 = div.children
assert linebox1.children[0].text == 'def'
assert linebox2.children[0].text == 'ghi'
assert linebox3.children[0].text == 'jkl'
assert linebox3.children[1].children[0].text == '1'
footnote_marker, footnote_textbox = (
footnote_area.children[0].children[0].children)
assert footnote_marker.children[0].text == '1.'
assert footnote_textbox.text == '1'
@assert_no_logs
def test_footnote_repagination():
page, = render_pages('''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
size: 9px 7px;
background: white;
}
div {
font-family: weasyprint;
font-size: 2px;
line-height: 1;
}
div::after {
content: counter(pages);
}
span {
float: footnote;
}
</style>
<div>ab<span>de</span></div>''')
html, footnote_area = page.children
body, = html.children
div, = body.children
div_textbox, footnote_call, div_after = div.children[0].children
assert div_textbox.text == 'ab'
assert footnote_call.children[0].text == '1'
assert div_textbox.position_y == 0
assert div_after.children[0].text == '1'
footnote_marker, footnote_textbox = (
footnote_area.children[0].children[0].children)
assert footnote_marker.children[0].text == '1.'
assert footnote_textbox.text == 'de'
assert footnote_area.position_y == 5
| 32.962783
| 79
| 0.577586
| 2,281
| 20,371
| 5.001315
| 0.083735
| 0.083626
| 0.063815
| 0.034362
| 0.818198
| 0.75114
| 0.739218
| 0.71108
| 0.690743
| 0.688903
| 0
| 0.038378
| 0.301605
| 20,371
| 617
| 80
| 33.016207
| 0.763478
| 0.028226
| 0
| 0.675676
| 0
| 0.009009
| 0.401538
| 0.018974
| 0
| 0
| 0
| 0.001621
| 0.223423
| 1
| 0.027027
| false
| 0
| 0.003604
| 0
| 0.030631
| 0.054054
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 5
|
bfc50ee74e15339d389c232f477c1173fc3a183b
| 353
|
py
|
Python
|
pyxq/msg/md.py
|
goodchinas/pyxq
|
c7f6ea63084c18178049451f30f32f04080a511c
|
[
"MIT"
] | 4
|
2019-12-17T11:05:53.000Z
|
2020-06-01T05:41:02.000Z
|
pyxq/msg/md.py
|
goodchinas/pyxq
|
c7f6ea63084c18178049451f30f32f04080a511c
|
[
"MIT"
] | null | null | null |
pyxq/msg/md.py
|
goodchinas/pyxq
|
c7f6ea63084c18178049451f30f32f04080a511c
|
[
"MIT"
] | 2
|
2019-11-13T01:11:53.000Z
|
2019-12-17T10:55:44.000Z
|
"""
market message type.
"""
import dataclasses as dc
from . import fa
from .. import ba
@dc.dataclass
class Tick(fa.S):
price: float
volume: float
pass
@dc.dataclass
class OrderBook(fa.S):
pass
@dc.dataclass
class Open(ba.Msg):
pass
class Close(ba.Msg):
pass
@dc.dataclass
class Factor(fa.S):
data: dict
pass
| 10.085714
| 24
| 0.643059
| 52
| 353
| 4.365385
| 0.480769
| 0.193833
| 0.281938
| 0.264317
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.240793
| 353
| 34
| 25
| 10.382353
| 0.847015
| 0.056657
| 0
| 0.45
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.25
| 0.15
| 0
| 0.55
| 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
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
449c4e015fdda53f5836b011ad6748e1931e4b5f
| 16,411
|
py
|
Python
|
tests/contrib/operators/test_gcp_compute_operator.py
|
tekn0ir/incubator-airflow
|
7df4405aa5a0c99e51722321caa7af660d35794b
|
[
"Apache-2.0"
] | 4
|
2019-01-17T06:21:45.000Z
|
2020-06-20T01:59:57.000Z
|
tests/contrib/operators/test_gcp_compute_operator.py
|
tekn0ir/incubator-airflow
|
7df4405aa5a0c99e51722321caa7af660d35794b
|
[
"Apache-2.0"
] | 14
|
2018-10-24T03:15:11.000Z
|
2019-01-02T19:02:58.000Z
|
tests/contrib/operators/test_gcp_compute_operator.py
|
cse-airflow/incubator-airflow
|
215b8c8170bd63f4c449614945bb4b6d90f6a860
|
[
"Apache-2.0"
] | 6
|
2018-12-04T12:15:23.000Z
|
2020-11-23T03:51:41.000Z
|
# -*- coding: utf-8 -*-
#
# 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 ast
import unittest
from airflow import AirflowException, configuration
from airflow.contrib.operators.gcp_compute_operator import GceInstanceStartOperator, \
GceInstanceStopOperator, GceSetMachineTypeOperator
from airflow.models import TaskInstance, DAG
from airflow.utils import timezone
try:
# noinspection PyProtectedMember
from unittest import mock
except ImportError:
try:
import mock
except ImportError:
mock = None
PROJECT_ID = 'project-id'
LOCATION = 'zone'
RESOURCE_ID = 'resource-id'
SHORT_MACHINE_TYPE_NAME = 'n1-machine-type'
SET_MACHINE_TYPE_BODY = {
'machineType': 'zones/{}/machineTypes/{}'.format(LOCATION, SHORT_MACHINE_TYPE_NAME)
}
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
class GceInstanceStartTest(unittest.TestCase):
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_instance_start(self, mock_hook):
mock_hook.return_value.start_instance.return_value = True
op = GceInstanceStartOperator(
project_id=PROJECT_ID,
zone=LOCATION,
resource_id=RESOURCE_ID,
task_id='id'
)
result = op.execute(None)
mock_hook.assert_called_once_with(api_version='v1',
gcp_conn_id='google_cloud_default')
mock_hook.return_value.start_instance.assert_called_once_with(
PROJECT_ID, LOCATION, RESOURCE_ID
)
self.assertTrue(result)
# Setting all of the operator's input parameters as templated dag_ids
# (could be anything else) just to test if the templating works for all fields
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_instance_start_with_templates(self, mock_hook):
dag_id = 'test_dag_id'
configuration.load_test_config()
args = {
'start_date': DEFAULT_DATE
}
self.dag = DAG(dag_id, default_args=args)
op = GceInstanceStartOperator(
project_id='{{ dag.dag_id }}',
zone='{{ dag.dag_id }}',
resource_id='{{ dag.dag_id }}',
gcp_conn_id='{{ dag.dag_id }}',
api_version='{{ dag.dag_id }}',
task_id='id',
dag=self.dag
)
ti = TaskInstance(op, DEFAULT_DATE)
ti.render_templates()
self.assertEqual(dag_id, getattr(op, 'project_id'))
self.assertEqual(dag_id, getattr(op, 'zone'))
self.assertEqual(dag_id, getattr(op, 'resource_id'))
self.assertEqual(dag_id, getattr(op, 'gcp_conn_id'))
self.assertEqual(dag_id, getattr(op, 'api_version'))
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_start_should_throw_ex_when_missing_project_id(self, mock_hook):
with self.assertRaises(AirflowException) as cm:
op = GceInstanceStartOperator(
project_id="",
zone=LOCATION,
resource_id=RESOURCE_ID,
task_id='id'
)
op.execute(None)
err = cm.exception
self.assertIn("The required parameter 'project_id' is missing", str(err))
mock_hook.assert_not_called()
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_start_should_throw_ex_when_missing_zone(self, mock_hook):
with self.assertRaises(AirflowException) as cm:
op = GceInstanceStartOperator(
project_id=PROJECT_ID,
zone="",
resource_id=RESOURCE_ID,
task_id='id'
)
op.execute(None)
err = cm.exception
self.assertIn("The required parameter 'zone' is missing", str(err))
mock_hook.assert_not_called()
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_start_should_throw_ex_when_missing_resource_id(self, mock_hook):
with self.assertRaises(AirflowException) as cm:
op = GceInstanceStartOperator(
project_id=PROJECT_ID,
zone=LOCATION,
resource_id="",
task_id='id'
)
op.execute(None)
err = cm.exception
self.assertIn("The required parameter 'resource_id' is missing", str(err))
mock_hook.assert_not_called()
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_instance_stop(self, mock_hook):
mock_hook.return_value.stop_instance.return_value = True
op = GceInstanceStopOperator(
project_id=PROJECT_ID,
zone=LOCATION,
resource_id=RESOURCE_ID,
task_id='id'
)
result = op.execute(None)
mock_hook.assert_called_once_with(api_version='v1',
gcp_conn_id='google_cloud_default')
mock_hook.return_value.stop_instance.assert_called_once_with(
PROJECT_ID, LOCATION, RESOURCE_ID
)
self.assertTrue(result)
# Setting all of the operator's input parameters as templated dag_ids
# (could be anything else) just to test if the templating works for all fields
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_instance_stop_with_templates(self, mock_hook):
dag_id = 'test_dag_id'
configuration.load_test_config()
args = {
'start_date': DEFAULT_DATE
}
self.dag = DAG(dag_id, default_args=args)
op = GceInstanceStopOperator(
project_id='{{ dag.dag_id }}',
zone='{{ dag.dag_id }}',
resource_id='{{ dag.dag_id }}',
gcp_conn_id='{{ dag.dag_id }}',
api_version='{{ dag.dag_id }}',
task_id='id',
dag=self.dag
)
ti = TaskInstance(op, DEFAULT_DATE)
ti.render_templates()
self.assertEqual(dag_id, getattr(op, 'project_id'))
self.assertEqual(dag_id, getattr(op, 'zone'))
self.assertEqual(dag_id, getattr(op, 'resource_id'))
self.assertEqual(dag_id, getattr(op, 'gcp_conn_id'))
self.assertEqual(dag_id, getattr(op, 'api_version'))
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_stop_should_throw_ex_when_missing_project_id(self, mock_hook):
with self.assertRaises(AirflowException) as cm:
op = GceInstanceStopOperator(
project_id="",
zone=LOCATION,
resource_id=RESOURCE_ID,
task_id='id'
)
op.execute(None)
err = cm.exception
self.assertIn("The required parameter 'project_id' is missing", str(err))
mock_hook.assert_not_called()
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_stop_should_throw_ex_when_missing_zone(self, mock_hook):
with self.assertRaises(AirflowException) as cm:
op = GceInstanceStopOperator(
project_id=PROJECT_ID,
zone="",
resource_id=RESOURCE_ID,
task_id='id'
)
op.execute(None)
err = cm.exception
self.assertIn("The required parameter 'zone' is missing", str(err))
mock_hook.assert_not_called()
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_stop_should_throw_ex_when_missing_resource_id(self, mock_hook):
with self.assertRaises(AirflowException) as cm:
op = GceInstanceStopOperator(
project_id=PROJECT_ID,
zone=LOCATION,
resource_id="",
task_id='id'
)
op.execute(None)
err = cm.exception
self.assertIn("The required parameter 'resource_id' is missing", str(err))
mock_hook.assert_not_called()
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_set_machine_type(self, mock_hook):
mock_hook.return_value.set_machine_type.return_value = True
op = GceSetMachineTypeOperator(
project_id=PROJECT_ID,
zone=LOCATION,
resource_id=RESOURCE_ID,
body=SET_MACHINE_TYPE_BODY,
task_id='id'
)
result = op.execute(None)
mock_hook.assert_called_once_with(api_version='v1',
gcp_conn_id='google_cloud_default')
mock_hook.return_value.set_machine_type.assert_called_once_with(
PROJECT_ID, LOCATION, RESOURCE_ID, SET_MACHINE_TYPE_BODY
)
self.assertTrue(result)
# Setting all of the operator's input parameters as templated dag_ids
# (could be anything else) just to test if the templating works for all fields
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_set_machine_type_with_templates(self, mock_hook):
dag_id = 'test_dag_id'
configuration.load_test_config()
args = {
'start_date': DEFAULT_DATE
}
self.dag = DAG(dag_id, default_args=args)
op = GceSetMachineTypeOperator(
project_id='{{ dag.dag_id }}',
zone='{{ dag.dag_id }}',
resource_id='{{ dag.dag_id }}',
body={},
gcp_conn_id='{{ dag.dag_id }}',
api_version='{{ dag.dag_id }}',
task_id='id',
dag=self.dag
)
ti = TaskInstance(op, DEFAULT_DATE)
ti.render_templates()
self.assertEqual(dag_id, getattr(op, 'project_id'))
self.assertEqual(dag_id, getattr(op, 'zone'))
self.assertEqual(dag_id, getattr(op, 'resource_id'))
self.assertEqual(dag_id, getattr(op, 'gcp_conn_id'))
self.assertEqual(dag_id, getattr(op, 'api_version'))
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_set_machine_type_should_throw_ex_when_missing_project_id(self, mock_hook):
with self.assertRaises(AirflowException) as cm:
op = GceSetMachineTypeOperator(
project_id="",
zone=LOCATION,
resource_id=RESOURCE_ID,
body=SET_MACHINE_TYPE_BODY,
task_id='id'
)
op.execute(None)
err = cm.exception
self.assertIn("The required parameter 'project_id' is missing", str(err))
mock_hook.assert_not_called()
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_set_machine_type_should_throw_ex_when_missing_zone(self, mock_hook):
with self.assertRaises(AirflowException) as cm:
op = GceSetMachineTypeOperator(
project_id=PROJECT_ID,
zone="",
resource_id=RESOURCE_ID,
body=SET_MACHINE_TYPE_BODY,
task_id='id'
)
op.execute(None)
err = cm.exception
self.assertIn("The required parameter 'zone' is missing", str(err))
mock_hook.assert_not_called()
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_set_machine_type_should_throw_ex_when_missing_resource_id(self, mock_hook):
with self.assertRaises(AirflowException) as cm:
op = GceSetMachineTypeOperator(
project_id=PROJECT_ID,
zone=LOCATION,
resource_id="",
body=SET_MACHINE_TYPE_BODY,
task_id='id'
)
op.execute(None)
err = cm.exception
self.assertIn("The required parameter 'resource_id' is missing", str(err))
mock_hook.assert_not_called()
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook')
def test_set_machine_type_should_throw_ex_when_missing_machine_type(self, mock_hook):
with self.assertRaises(AirflowException) as cm:
op = GceSetMachineTypeOperator(
project_id=PROJECT_ID,
zone=LOCATION,
resource_id=RESOURCE_ID,
body={},
task_id='id'
)
op.execute(None)
err = cm.exception
self.assertIn(
"The required body field 'machineType' is missing. Please add it.", str(err))
mock_hook.assert_called_once_with(api_version='v1',
gcp_conn_id='google_cloud_default')
MOCK_OP_RESPONSE = "{'kind': 'compute#operation', 'id': '8529919847974922736', " \
"'name': " \
"'operation-1538578207537-577542784f769-7999ab71-94f9ec1d', " \
"'zone': 'https://www.googleapis.com/compute/v1/projects/polidea" \
"-airflow/zones/europe-west3-b', 'operationType': " \
"'setMachineType', 'targetLink': " \
"'https://www.googleapis.com/compute/v1/projects/polidea-airflow" \
"/zones/europe-west3-b/instances/pa-1', 'targetId': " \
"'2480086944131075860', 'status': 'DONE', 'user': " \
"'uberdarek@polidea-airflow.iam.gserviceaccount.com', " \
"'progress': 100, 'insertTime': '2018-10-03T07:50:07.951-07:00', "\
"'startTime': '2018-10-03T07:50:08.324-07:00', 'endTime': " \
"'2018-10-03T07:50:08.484-07:00', 'error': {'errors': [{'code': " \
"'UNSUPPORTED_OPERATION', 'message': \"Machine type with name " \
"'machine-type-1' does not exist in zone 'europe-west3-b'.\"}]}, "\
"'httpErrorStatusCode': 400, 'httpErrorMessage': 'BAD REQUEST', " \
"'selfLink': " \
"'https://www.googleapis.com/compute/v1/projects/polidea-airflow" \
"/zones/europe-west3-b/operations/operation-1538578207537" \
"-577542784f769-7999ab71-94f9ec1d'} "
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook'
'._check_operation_status')
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook'
'._execute_set_machine_type')
@mock.patch('airflow.contrib.operators.gcp_compute_operator.GceHook.get_conn')
def test_set_machine_type_should_handle_and_trim_gce_error(
self, get_conn, _execute_set_machine_type, _check_operation_status):
get_conn.return_value = {}
_execute_set_machine_type.return_value = {"name": "test-operation"}
_check_operation_status.return_value = ast.literal_eval(self.MOCK_OP_RESPONSE)
with self.assertRaises(AirflowException) as cm:
op = GceSetMachineTypeOperator(
project_id=PROJECT_ID,
zone=LOCATION,
resource_id=RESOURCE_ID,
body=SET_MACHINE_TYPE_BODY,
task_id='id'
)
op.execute(None)
err = cm.exception
_check_operation_status.assert_called_once_with(
{}, "test-operation", PROJECT_ID, LOCATION)
_execute_set_machine_type.assert_called_once_with(
PROJECT_ID, LOCATION, RESOURCE_ID, SET_MACHINE_TYPE_BODY)
# Checking the full message was sometimes failing due to different order
# of keys in the serialized JSON
self.assertIn("400 BAD REQUEST: {", str(err)) # checking the square bracket trim
self.assertIn("UNSUPPORTED_OPERATION", str(err))
| 43.415344
| 90
| 0.624886
| 1,874
| 16,411
| 5.19317
| 0.142476
| 0.040691
| 0.03021
| 0.053432
| 0.774147
| 0.749589
| 0.739108
| 0.728113
| 0.728113
| 0.710543
| 0
| 0.017257
| 0.276156
| 16,411
| 377
| 91
| 43.530504
| 0.802004
| 0.083785
| 0
| 0.697248
| 0
| 0.009174
| 0.216832
| 0.105617
| 0
| 0
| 0
| 0
| 0.180428
| 1
| 0.051988
| false
| 0
| 0.030581
| 0
| 0.088685
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
44aa1eb79d10f65183bfbe8c4b98798c7f7f3843
| 133
|
py
|
Python
|
Ex7.py
|
jpsampaio/ExEcommIT
|
fabf3287aa86dafae00709341c776e446d4e2968
|
[
"MIT"
] | null | null | null |
Ex7.py
|
jpsampaio/ExEcommIT
|
fabf3287aa86dafae00709341c776e446d4e2968
|
[
"MIT"
] | null | null | null |
Ex7.py
|
jpsampaio/ExEcommIT
|
fabf3287aa86dafae00709341c776e446d4e2968
|
[
"MIT"
] | null | null | null |
n1 = float(input('Nota 1: '))
n2 = float(input('Nota 2: '))
print(f'Resultado: \n - Nota final: {n1+n2} \n - Média: {(n1+n2)/2:.1f}')
| 44.333333
| 73
| 0.571429
| 24
| 133
| 3.166667
| 0.583333
| 0.263158
| 0.368421
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.087719
| 0.142857
| 133
| 3
| 73
| 44.333333
| 0.578947
| 0
| 0
| 0
| 0
| 0.333333
| 0.589552
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.333333
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
44cb81985691abce07e61414b0955467d049696a
| 9,281
|
py
|
Python
|
tests/test_evaluate.py
|
IBM-HRL-MLHLS/Causality-Benchmarking-LBIDD
|
fa3d17af22521e2d41b4c734f9148365b7dc92fd
|
[
"Apache-2.0"
] | 67
|
2018-02-17T08:35:13.000Z
|
2022-02-26T13:37:13.000Z
|
tests/test_evaluate.py
|
IBM-HRL-MLHLS/Causality-Benchmarking-LBIDD
|
fa3d17af22521e2d41b4c734f9148365b7dc92fd
|
[
"Apache-2.0"
] | 1
|
2021-11-22T08:38:48.000Z
|
2021-11-30T16:48:22.000Z
|
tests/test_evaluate.py
|
IBM-HRL-MLHLS/Causality-Benchmarking-LBIDD
|
fa3d17af22521e2d41b4c734f9148365b7dc92fd
|
[
"Apache-2.0"
] | 11
|
2018-02-18T19:48:23.000Z
|
2022-02-24T01:15:12.000Z
|
"""
(C) IBM Corp, 2018, All rights reserved
Created on Jan 10, 2018
@author: EHUD KARAVANI
"""
from __future__ import division as __division
import os
import unittest
import pandas as pd
import numpy as np
from causalbenchmark import evaluate
evaluate.TABULAR_DELIMITER = "\t"
class TestEvaluate(unittest.TestCase):
def test_individual_single_size(self):
# Right prediction:
score = evaluate.evaluate(os.path.join("test_data_files", "single_sized_datasets",
"individual_prediction_right"),
os.path.join("test_data_files", "single_sized_datasets", "dummy_data"),
is_individual_prediction=True)
np.testing.assert_array_almost_equal(x=score,
y=pd.Series(data=[0.0, 0.0, 0.0], index=["enormse", "rmse", "bias"]))
# Wrong Prediction:
score = evaluate.evaluate(os.path.join("test_data_files", "single_sized_datasets",
"individual_prediction_wrong"),
os.path.join("test_data_files", "single_sized_datasets", "dummy_data"),
is_individual_prediction=True)
np.testing.assert_array_almost_equal(x=score,
y=pd.Series(data=[np.sqrt(17.0/9.0), np.sqrt((4 + 1 + (2/75)) / 3),
(-2 - 1 + (2.0 / 15)) / 3],
index=["enormse", "rmse", "bias"]))
def test_population_single_size(self):
# Right prediction:
score = evaluate.evaluate(os.path.join("test_data_files", "single_sized_datasets",
"population_prediction_right.csv"),
os.path.join("test_data_files", "single_sized_datasets", "dummy_data"),
is_individual_prediction=False)
np.testing.assert_array_almost_equal(x=score,
y=pd.Series(data=[0.0, 0.0, 0.0, 1.0, 5.0/3.0, 0.0],
index=["enormse", "rmse", "bias", "coverage", "encis", "cic"]))
# Wrong Prediction:
score = evaluate.evaluate(os.path.join("test_data_files", "single_sized_datasets",
"population_prediction_wrong.csv"),
os.path.join("test_data_files", "single_sized_datasets", "dummy_data"),
is_individual_prediction=False)
np.testing.assert_array_almost_equal(x=score,
y=pd.Series(data=[np.sqrt(5.0/12.0), np.sqrt((0.25 + 0 + 0.04) / 3),
(-0.5 + 0 + 0.2) / 3,
2.0/3.0, 5.0/3.0, 5.0/12.0],
index=["enormse", "rmse", "bias", "coverage", "encis", "cic"]))
def test_individual_multi_size(self):
# Right prediction:
score = evaluate.evaluate(os.path.join("test_data_files", "multi_sized_datasets",
"individual_prediction_right"),
os.path.join("test_data_files", "multi_sized_datasets", "dummy_data"),
is_individual_prediction=True)
np.testing.assert_array_almost_equal(x=score,
y=pd.Series(data=[0.0, 0.0, 0.0, 0.0, 0.0],
index=["enormse", "rmse", "bias", "enormse_4", "enormse_6"]))
# Wrong Prediction:
score = evaluate.evaluate(os.path.join("test_data_files", "multi_sized_datasets",
"individual_prediction_wrong"),
os.path.join("test_data_files", "multi_sized_datasets", "dummy_data"),
is_individual_prediction=True)
np.testing.assert_array_almost_equal(x=score,
y=pd.Series(data=[np.sqrt(((5.0 / 2.0) + (2.25 * 17.0 / 9.0)) / 3.25),
np.sqrt(((4*(4 + 0.04)) + 6*(4 + 1 + (4.0 / 150))) / 26),
(4*(-2 + 0.2) + 6*(-2 - 1 + (2.0/15))) / (4*2 + 6*3),
np.sqrt(5.0 / 2.0), np.sqrt(17.0/9.0)],
index=["enormse", "rmse", "bias", "enormse_4", "enormse_6"]))
def test_population_multi_size(self):
# Right prediction:
score = evaluate.evaluate(os.path.join("test_data_files", "multi_sized_datasets",
"population_prediction_right.csv"),
os.path.join("test_data_files", "multi_sized_datasets", "dummy_data"),
is_individual_prediction=False)
score = score[["enormse", "enormse_4", "enormse_6", "rmse", "bias", "coverage", "encis", "cic"]] # rearrange
np.testing.assert_array_almost_equal(x=score,
y=pd.Series(data=[0.0, 0.0, 0.0, 0.0, 0.0, 1.0,
(6 * (2 + 2 + 1) + 4 * (2 + 1)) / (6 * 3 + 4 * 2),
0.0],
index=["enormse", "enormse_4", "enormse_6", "rmse", "bias",
"coverage", "encis", "cic"]))
# Wrong Prediction:
score = evaluate.evaluate(os.path.join("test_data_files", "multi_sized_datasets",
"population_prediction_wrong.csv"),
os.path.join("test_data_files", "multi_sized_datasets", "dummy_data"),
is_individual_prediction=False)
score = score[["enormse", "enormse_4", "enormse_6", "rmse", "bias", "coverage", "encis", "cic"]] # rearrange
np.testing.assert_array_almost_equal(x=score,
y=pd.Series(data=[np.sqrt(((4*(0.25+1)) + (6*(0.25+0+1))) / (4*2 + 6*3)),
np.sqrt((0.25 + 1) / 2), np.sqrt((1 + 0 + 0.25) / 3),
np.sqrt((4*(0.25+0.04) + 6*(0.25+0+0.04)) / (4*2 + 6*3)),
(4*(-0.5 + 0.2) + 6*(-0.5 + 0 + 0.2)) / (4*2 + 6*3),
(4 * 1 + 6 * 2) / (4 * 2 + 6 * 3),
(6 * (2 + 2 + 1) + 4 * (2 + 1)) / (6 * 3 + 4 * 2),
(4 * (0.25 + 1) + 6 * (0.25 + 0 + 1)) / (4 * 2 + 6 * 3)],
index=["enormse", "enormse_4", "enormse_6", "rmse", "bias",
"coverage", "encis", "cic"]))
def test_input_consistency(self):
data_path = os.path.join("test_data_files", "multi_sized_datasets", "dummy_data")
# population effect with directory input:
dir_path = os.path.join("test_data_files", "multi_sized_datasets", "individual_prediction_right")
is_individual_prediction = False
with self.subTest(dir_path=dir_path, data_path=data_path, is_individual_prediction=is_individual_prediction):
self.assertRaises(RuntimeError, evaluate.evaluate,
dir_path, data_path, is_individual_prediction)
# individual effect with file input:
file_path = os.path.join("test_data_files", "multi_sized_datasets", "population_prediction_wrong.csv")
is_individual_prediction = True
with self.subTest(file_path=file_path, data_path=data_path, is_individual_prediction=is_individual_prediction):
self.assertRaises(RuntimeError, evaluate.evaluate,
file_path, data_path, is_individual_prediction)
def test_missing_predictions(self):
data_path = os.path.join("test_data_files", "single_sized_datasets", "dummy_data")
individual_prediction_dir_path = os.path.join("test_data_files", "single_sized_datasets",
"individual_prediction_missing")
self.assertRaises(IOError, evaluate._score_individual, individual_prediction_dir_path, data_path)
population_prediction_file_path = os.path.join("test_data_files", "single_sized_datasets",
"population_prediction_missing.csv")
self.assertRaises(AssertionError, evaluate._score_population, population_prediction_file_path, data_path)
if __name__ == '__main__':
unittest.main()
| 65.822695
| 120
| 0.472255
| 965
| 9,281
| 4.27772
| 0.109845
| 0.017442
| 0.018169
| 0.074612
| 0.786095
| 0.768411
| 0.742975
| 0.739099
| 0.722626
| 0.705911
| 0
| 0.049909
| 0.406314
| 9,281
| 140
| 121
| 66.292857
| 0.699274
| 0.035233
| 0
| 0.504673
| 0
| 0
| 0.178735
| 0.065249
| 0
| 0
| 0
| 0
| 0.11215
| 1
| 0.056075
| false
| 0
| 0.056075
| 0
| 0.121495
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
44e3592245067044ff9503495ca28551a857ca5f
| 123
|
py
|
Python
|
__init__.py
|
hamburgduo/mdpicker-github
|
b91403ce58054d22e818c98eba6b105719d29168
|
[
"MIT"
] | 3
|
2018-08-27T00:58:27.000Z
|
2018-12-17T12:57:15.000Z
|
__init__.py
|
hamburgduo/mdpicker-github
|
b91403ce58054d22e818c98eba6b105719d29168
|
[
"MIT"
] | null | null | null |
__init__.py
|
hamburgduo/mdpicker-github
|
b91403ce58054d22e818c98eba6b105719d29168
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
@author: ??
@file: __init__.py.py
@time: 2018/8/23 10:18
@desc:
'''
| 15.375
| 23
| 0.536585
| 19
| 123
| 3.263158
| 0.894737
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.118812
| 0.178862
| 123
| 8
| 24
| 15.375
| 0.49505
| 0.853659
| 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
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
44e45a3caa3c5ecd8c8e71932347399ac35277c4
| 183
|
py
|
Python
|
systems/admin.py
|
alexhong121/ai_cupboard
|
50baa791c969b951de5b47d980e19c0df3c04e7f
|
[
"MIT"
] | null | null | null |
systems/admin.py
|
alexhong121/ai_cupboard
|
50baa791c969b951de5b47d980e19c0df3c04e7f
|
[
"MIT"
] | null | null | null |
systems/admin.py
|
alexhong121/ai_cupboard
|
50baa791c969b951de5b47d980e19c0df3c04e7f
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from systems.models import Configuration,Information
# Register your models here.
admin.site.register(Configuration)
admin.site.register(Information)
| 30.5
| 52
| 0.846995
| 23
| 183
| 6.73913
| 0.565217
| 0.116129
| 0.219355
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.081967
| 183
| 6
| 53
| 30.5
| 0.922619
| 0.142077
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
44f9f6f34a6064b9e80df533e674adfd817cf125
| 144
|
py
|
Python
|
NHentaidesu/__init__.py
|
rushkii/NHentaidesu
|
c1ee1ced37fa5dbed6feb53c89349cda913e7f06
|
[
"MIT"
] | 4
|
2021-09-27T07:53:09.000Z
|
2022-03-15T00:53:18.000Z
|
NHentaidesu/__init__.py
|
rushkii/NHentaidesu
|
c1ee1ced37fa5dbed6feb53c89349cda913e7f06
|
[
"MIT"
] | null | null | null |
NHentaidesu/__init__.py
|
rushkii/NHentaidesu
|
c1ee1ced37fa5dbed6feb53c89349cda913e7f06
|
[
"MIT"
] | null | null | null |
from .client import DoujinClient
from . import utils
from . import sync
__version__ = "1.9"
__author__ = "Kiizuha <github.com/rushkii>"
| 20.571429
| 44
| 0.715278
| 18
| 144
| 5.277778
| 0.777778
| 0.210526
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.017094
| 0.1875
| 144
| 7
| 44
| 20.571429
| 0.794872
| 0
| 0
| 0
| 0
| 0
| 0.223022
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.6
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
781dd4e3222d8a68cb2ecbb027bebb897a8fa8c7
| 39
|
py
|
Python
|
plugins/dna_royale.py
|
GRAYgoose124/mushishi
|
6dd4512908e39bf6506be023d1834611f58e894b
|
[
"MIT"
] | 2
|
2018-10-19T07:47:19.000Z
|
2020-02-11T05:03:11.000Z
|
plugins/dna_royale.py
|
GRAYgoose124/mushishi
|
6dd4512908e39bf6506be023d1834611f58e894b
|
[
"MIT"
] | null | null | null |
plugins/dna_royale.py
|
GRAYgoose124/mushishi
|
6dd4512908e39bf6506be023d1834611f58e894b
|
[
"MIT"
] | null | null | null |
# from discord.ext.commands import Cog
| 19.5
| 38
| 0.794872
| 6
| 39
| 5.166667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.128205
| 39
| 1
| 39
| 39
| 0.911765
| 0.923077
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
782b5bee78c1864d031bd424b2ea4556227e98c9
| 86
|
py
|
Python
|
src/index.py
|
seyedk/aws-sls-tf
|
08b566a3fa52743c2033121550c38f960250058a
|
[
"Apache-2.0"
] | null | null | null |
src/index.py
|
seyedk/aws-sls-tf
|
08b566a3fa52743c2033121550c38f960250058a
|
[
"Apache-2.0"
] | null | null | null |
src/index.py
|
seyedk/aws-sls-tf
|
08b566a3fa52743c2033121550c38f960250058a
|
[
"Apache-2.0"
] | null | null | null |
def lambda_handler(event, context):
print("Hello world")
return "Hello World!"
| 28.666667
| 35
| 0.697674
| 11
| 86
| 5.363636
| 0.818182
| 0.338983
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.174419
| 86
| 3
| 36
| 28.666667
| 0.830986
| 0
| 0
| 0
| 0
| 0
| 0.264368
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0
| 0.666667
| 0.333333
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
78b6418d1302575bd42676a5e8467c79052b0a4a
| 57
|
py
|
Python
|
den/codegen/__init__.py
|
MonliH/Den
|
9c2e69744dcf26ae01154eac32aa4ea8ff2adee3
|
[
"MIT"
] | null | null | null |
den/codegen/__init__.py
|
MonliH/Den
|
9c2e69744dcf26ae01154eac32aa4ea8ff2adee3
|
[
"MIT"
] | null | null | null |
den/codegen/__init__.py
|
MonliH/Den
|
9c2e69744dcf26ae01154eac32aa4ea8ff2adee3
|
[
"MIT"
] | null | null | null |
from .codegen import ModuleCodeGen
from .module import *
| 19
| 34
| 0.807018
| 7
| 57
| 6.571429
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.140351
| 57
| 2
| 35
| 28.5
| 0.938776
| 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
| 1
| 0
|
0
| 5
|
78d0694dc1db5c1d2123122da45bf075b07bdd09
| 131
|
py
|
Python
|
tests/reponses/test_responses.py
|
dongwooklee96/clean-architecture
|
d3444b5110adebdc57f055414a07069789038a4a
|
[
"MIT"
] | null | null | null |
tests/reponses/test_responses.py
|
dongwooklee96/clean-architecture
|
d3444b5110adebdc57f055414a07069789038a4a
|
[
"MIT"
] | null | null | null |
tests/reponses/test_responses.py
|
dongwooklee96/clean-architecture
|
d3444b5110adebdc57f055414a07069789038a4a
|
[
"MIT"
] | null | null | null |
from rentomatic.responses import ResponseSuccess
def test_response_success_is_true():
assert bool(ResponseSuccess()) is True
| 21.833333
| 48
| 0.816794
| 16
| 131
| 6.4375
| 0.8125
| 0.116505
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.122137
| 131
| 5
| 49
| 26.2
| 0.895652
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.333333
| 1
| 0.333333
| true
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
78d1eb4b1a2dba0eb927b1bc4d2614a230258b7f
| 116
|
py
|
Python
|
backend/digits/admin.py
|
shreenath2001/digit-recognition-webapp
|
2ebdd012ec52b35bd99c19b71a257e7562c01684
|
[
"MIT"
] | 1
|
2021-01-25T14:13:48.000Z
|
2021-01-25T14:13:48.000Z
|
backend/digits/admin.py
|
shreenath2001/digit-recognition-webapp
|
2ebdd012ec52b35bd99c19b71a257e7562c01684
|
[
"MIT"
] | null | null | null |
backend/digits/admin.py
|
shreenath2001/digit-recognition-webapp
|
2ebdd012ec52b35bd99c19b71a257e7562c01684
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Digit
# Register your models here.
admin.site.register(Digit)
| 19.333333
| 32
| 0.801724
| 17
| 116
| 5.470588
| 0.647059
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12931
| 116
| 5
| 33
| 23.2
| 0.920792
| 0.224138
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
78d30b9b218f9e6e65680334a1d97d7d8f097762
| 9,478
|
py
|
Python
|
cheggparser.py
|
aidarjpg/chegg_cheap_books
|
86970cbd432ecebb3b2e6e2a6eda1472fcc2cb64
|
[
"MIT"
] | null | null | null |
cheggparser.py
|
aidarjpg/chegg_cheap_books
|
86970cbd432ecebb3b2e6e2a6eda1472fcc2cb64
|
[
"MIT"
] | null | null | null |
cheggparser.py
|
aidarjpg/chegg_cheap_books
|
86970cbd432ecebb3b2e6e2a6eda1472fcc2cb64
|
[
"MIT"
] | null | null | null |
from bs4 import BeautifulSoup
import requests
import time
import random
import re
import requests
import requests
headers = {
'authority': 'www.chegg.com',
'cache-control': 'max-age=0',
'dnt': '1',
'upgrade-insecure-requests': '1',
'user-agent': 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1',
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'sec-fetch-site': 'same-origin',
'sec-fetch-mode': 'navigate',
'sec-fetch-user': '?1',
'sec-fetch-dest': 'document',
'referer': 'https://www.chegg.com/textbooks/fiction-1/1',
'accept-language': 'en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7',
'cookie': 'user_geo_location=%7B%22country_iso_code%22%3A%22KZ%22%2C%22country_name%22%3A%22Kazakhstan%22%2C%22region%22%3A%22AST%22%2C%22region_full%22%3A%22Nur-Sultan%22%2C%22city_name%22%3A%22Nur-Sultan%22%2C%22locale%22%3A%7B%22localeCode%22%3A%5B%5D%7D%7D; C=0; O=0; V=3b1d923f709674d92795555e1e8423e6611f3d24079d38.92528446; optimizelyEndUserId=oeu1629437225202r0.07314845927650726; _omappvp=AunRsMITonPY8gDQVDJ88Yugt7AG7aczLToIzTJ6IVTgHanVlbdVvfm22wMJMMysF3qWuzRZJXVAsysVHGUvnwGRUxtfzRvx; mcid=34170275019725926454610467429233929911; _pxvid=42c8dc76-0177-11ec-aee4-52684761666c; adobeujs-optin=%7B%22aam%22%3Atrue%2C%22adcloud%22%3Atrue%2C%22aa%22%3Atrue%2C%22campaign%22%3Atrue%2C%22ecid%22%3Atrue%2C%22livefyre%22%3Atrue%2C%22target%22%3Atrue%2C%22mediaaa%22%3Atrue%7D; AMCVS_3FE7CBC1556605A77F000101%40AdobeOrg=1; _ga=GA1.2.175503385.1629437242; _gcl_au=1.1.1842102386.1629437242; _rdt_uuid=1629437242151.4e6297a8-eb6c-483c-9cde-eec57cd5be09; s_ecid=MCMID%7C34170275019725926454610467429233929911; al_cell=main-1-control; _scid=d8000441-8ccb-4373-893a-c62990c3e69c; __ssid=06064b71af7a6d512ac1fd637ee1bab; PHPSESSID=e72o3874e8nquslkfrjjqkj0i5; chgmfatoken=%5B%20%22account_sharing_mfa%22%20%3D%3E%201%2C%20%22user_uuid%22%20%3D%3E%206a2d72ad-56fd-48a3-9e95-ec9e7a23532e%2C%20%22created_date%22%20%3D%3E%202021-08-25T09%3A08%3A16.915Z%20%5D; DFID=web|9paue9ZllVi2Rs5H1nX8; U=cfa7edcfad8ded9c9602daeaf8f99dee; gid=1; gidr=MA; _sdsat_cheggUserUUID=6a2d72ad-56fd-48a3-9e95-ec9e7a23532e; chgcsdmtoken=%7B%22user_uuid%22%3A%226a2d72ad-56fd-48a3-9e95-ec9e7a23532e%22%2C%22created_date%22%3A%222021-08-25T09%3A08%3A44.293Z%22%2C%22account_sharing_device_management%22%3A1%7D; chgcsdmtoken=6a2d72ad-56fd-48a3-9e95-ec9e7a23532e++web|9paue9ZllVi2Rs5H1nX8++1629882562848; CVID=431f4acc-57b1-4f94-8f6e-3b3f65023a99; __CT_Data=gpv=33&ckp=tld&dm=chegg.com&apv_79_www33=33&cpv_79_www33=33; _iidt=oYzNEeV5yTKQlf7XHoIaXgqmd6IYWR3zBc+PAuxBAKLJoKW9xM6Tp+8ACCfK+hIet57BL1JB//7c/A==; _vid_t=cByaA2ZpYymsbc5oHQ5kEGufONCz2cEbsiyWII3qcpsx9lSrhAhtC/3tjUvZQPjXuhdvWtKA6wE5GQ==; id_token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImRhbnlhcmJlay5uaXNAZ21haWwuY29tIiwiaXNzIjoiaHViLmNoZWdnLmNvbSIsInN1YiI6IjZhMmQ3MmFkLTU2ZmQtNDhhMy05ZTk1LWVjOWU3YTIzNTMyZSIsImF1ZCI6IkNIR0ciLCJpYXQiOjE2MzEyNTEwMDYsImV4cCI6MTYzOTAxNDcxOSwicmVwYWNrZXJfaWQiOiJhcHcifQ.ft5juQBfmS7-wYZXIqjs1xbJfCqJHSmFpqEC_0XDR7TqueCG9rcs1vgaTeGntqossOqMNf81s5Xtw51Ey4DQ1UUpj55bKIRoKM91NZaQDXulAD7SLLz6CBOxMywhWQ1PhiRC1hdfybiRB1aD-ExJN20n6hxODmpTYO0a4zU5p1SpjhQzb0iCjry4c6xybsanTngZLqxuBvlm0VneHqrPt3Ysbb7w_UxgQBCNZrWQbgprUXtIrjjQLS6K5bWxwi-cOFsUKJsYRTMyCqKXb-nPtxtqw4ypr0EmRhJVfMFgOFkfNMt-4KqnAbqdJ23TOVb8G-HD3X3mrPFjxUfN046Nsw; refresh_token=ext.a0.t00.v1.MfBQ3-rErT3Tvj0I_0WOmuhTlXYU49_Z6qvF-u5vK0yVo8iy4hDPt8hq1snyHudbukhrvVv1iT5gbDK5irZ9yFs; chegg_web_cbr_id=a; aamsc=aam%3D2053348%2Caam%3D2756555%2Caam%3D5674360%2Caam%3D10684699; aam_uuid=34153174160243599994608790746554200717; aam_tnt=aam%3D2053348; IR_gbd=chegg.com; _cs_c=0; userData=%7B%22authStatus%22%3A%22Soft%20Logged%20In%22%2C%22email%22%3A%22danyarbek.nis%40gmail.com%22%2C%22attributes%22%3A%7B%22cheggUserUUID%22%3A%226a2d72ad-56fd-48a3-9e95-ec9e7a23532e%22%2C%22uvn%22%3A%223b1d923f709674d92795555e1e8423e6611f3d24079d38.92528446%22%7D%7D; usprivacy=1YNY; exp=A311C%7CA803B%7CC024A%7CA560B%7CA209A%7CA212A%7CA263A%7CA264A%7CA448A%7CA278C%7CA110B%7CA270C%7CA966F; expkey=96E75F75D49D71E73BBF5C3680DE9993; intlPaQExitIntentModal=hide; forterToken=7dec183faf4d4beb99ff5875bb959323_1634225092990__UDF43_13ck; _gid=GA1.2.1364236036.1634225098; _sctr=1|1634148000000; OneTrustWPCCPAGoogleOptOut=false; _sdsat_authState=Hard%20Logged%20In; omSeen-ohvoola2gvm5qhhnb5b1=1634239250174; AMCV_3FE7CBC1556605A77F000101%40AdobeOrg=-408604571%7CMCIDTS%7C18915%7CMCMID%7C34170275019725926454610467429233929911%7CMCAAMLH-1634886274%7C6%7CMCAAMB-1634886274%7CRKhpRz8krg2tLO6pguXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y%7CMCOPTOUT-1634288674s%7CNONE%7CMCAID%7CNONE%7CvVersion%7C4.6.0%7CMCCIDH%7C1801216295; SU=oHkzKMLhJ1LuJRYcrAAw5094ePcVdjITmmQpvx4Y_jH917L2TdXIO36bFiaE6hlyNTJP-yvWv9M_8h50XP2Xynt46tyEYdDlbMRP1oAyMLGTjC5f6wKiIv9xJlMQfrTX; CSessionID=a701c2fd-6fd8-42a5-8ece-f2e56b03d836; _sdsat_highestContentConfidence={%22__typename%22:%22ContentClassification%22%2C%22course_uuid%22:%221b5e0286-a1c8-498a-9d89-da8660523fe5%22%2C%22course_name%22:%22composition%22%2C%22year_in_school%22:1%2C%22subject%22:[{%22__typename%22:%22Subject%22%2C%22uuid%22:%226ac5fb72-b976-495b-aabe-03da6c4ad094%22%2C%22name%22:%22languages-and-literatures%22}]}; _cs_mk=0.5572590084204676_1634287232313; CSID=1634287232386; ab.storage.deviceId.b283d3f6-78a7-451c-8b93-d98cdb32f9f1=%7B%22g%22%3A%222fbb322d-6f9d-bdc3-8882-499135ad21a5%22%2C%22c%22%3A1629437240174%2C%22l%22%3A1634287240655%7D; ab.storage.userId.b283d3f6-78a7-451c-8b93-d98cdb32f9f1=%7B%22g%22%3A%226a2d72ad-56fd-48a3-9e95-ec9e7a23532e%22%2C%22c%22%3A1629882516299%2C%22l%22%3A1634287240657%7D; schoolapi=8a948500-a86e-403b-b487-a7f005087d2b|0.52173913; _cs_cvars=%7B%221%22%3A%5B%22Page%20Name%22%2C%22Rent%22%5D%2C%222%22%3A%5B%22Experience%22%2C%22desktop%22%5D%2C%223%22%3A%5B%22Page%20Type%22%2C%22seo%22%5D%2C%224%22%3A%5B%22Auth%20Status%22%2C%22Logged%20Out%22%5D%7D; _pxff_rf=1; _pxff_fp=1; _px3=5cd8fc214fd0f871231dbb246ccc444ae70bed24d83d748717d502dca6e419e9:tJ/5uyjJYV1Z0cO22sagzR1G35iRYeq698zklMKYd1KXRN92mssImkh7NpuJyHwuHojbr08QA48nIPSApAfCcw==:1000:exLdrNKaGvQkiXYapAPtZS0eFvT9/XyYAzmIk77BKxqyBOTxlbm2er+5tQhh4gzziRfeIYDyO2kqh8m9jjHwhUNQoek/2Zox6z8zbck2EKeVh1KMcVIUmMaCVj/1Px1MtrY0ssSHfQLJXVF7gRYrqoNkFhuC4AQG51frDG/BRH5pKCcF4sjJvkvEgG6ZcLftUcycdAbmM88ZzQMOg+/OMw==; _px=tJ/5uyjJYV1Z0cO22sagzR1G35iRYeq698zklMKYd1KXRN92mssImkh7NpuJyHwuHojbr08QA48nIPSApAfCcw==:1000:+OGgyGn/+dpfxRemgH02LOzTSXicgRzVw8Uy8+FTdcwHNPb3kESFk1Q2FVFWksABK+3PD+lSBPeIGu/UKssSZ5BflLol6d4oX6HG7uIb+2xbZSIs70yXfSPgqai3YIVLxwoTGuqOv9Aj5kgJAbOMjamNxPjV+xdyrLwWRPAVHJD3+SRqSyHjehLSvfyRKeupHpnYD1uqOCtWM0Yc0Cu8M487SnUjTnQKp4LgVakxrSfgCQlTTrEz2T9dWHYYQmh+RBvM96hZ5ycfeauUD8ws5Q==; OptanonConsent=isIABGlobal=false&datestamp=Fri+Oct+15+2021+14%3A59%3A01+GMT%2B0600+(East+Kazakhstan+Time)&version=6.18.0&hosts=&consentId=7a286c80-eab0-4683-a4d5-7efb73212928&interactionCount=1&landingPath=NotLandingPage&AwaitingReconsent=false&groups=snc%3A1%2Cfnc%3A1%2Cprf%3A1%2CSPD_BG%3A1%2Ctrg%3A1; s_pers=%20buFirstVisit%3Dcore%252Ctb%252Ccs%252Cseo%252Cothers%7C1791983065820%3B%20gpv_v6%3Dchegg%257Cweb%257Ctb%257Cseo%257Crent%7C1634290142244%3B; s_sess=%20buVisited%3Dcore%252Ctb%252Ccs%252Cseo%252Cothers%3B%20s_sq%3D%3B%20cheggCTALink%3Dfalse%3B%20SDID%3D6CF1D600512CBD55-0B4DC2B6A3C133DC%3B%20s_cc%3Dtrue%3B%20s_ptc%3D0.01%255E%255E0.00%255E%255E0.00%255E%255E0.00%255E%255E0.80%255E%255E0.15%255E%255E6.59%255E%255E0.26%255E%255E7.66%3B; _uetsid=e4a4d4e02d0211ecafda1931db07b525; _uetvid=4b95e190017711ec8645550494a018ea; wcs_bt=s_4544d378d9e5:1634288347; ab.storage.sessionId.b283d3f6-78a7-451c-8b93-d98cdb32f9f1=%7B%22g%22%3A%22eea95e86-1477-4175-e8fe-1c24d8dd9448%22%2C%22e%22%3A1634290147587%2C%22c%22%3A1634287240652%2C%22l%22%3A1634288347587%7D; _gat=1; IR_14422=1634288349818%7C0%7C1634288349818%7C%7C; _tq_id.TV-8145726354-1.ad8a=ec5a2e9ee161ecb6.1629437249.0.1634288350..; _cs_id=23f4d81d-b5bc-afbd-d045-d9b21c016626.1629437256.13.1634288351.1634286656.1.1663601256003; _cs_s=6.0.0.1634290151439',
}
books = set()
for i in range(50):
try:
url = 'https://www.chegg.com/textbooks/fiction-1/'+str(i+1);
response = requests.get(url, headers=headers)
print(response.status_code)
soup = BeautifulSoup(response.content, 'html.parser')
linkto_starter = soup.find_all('a', class_='title')
for link in linkto_starter:
link = 'https://www.chegg.com' + link['href']
#print(link)
books.add(link)
except:
print('failed at '+url)
continue
time.sleep(5)
ans = []
for url in books:
try:
response = requests.get(url, headers=headers)
soup = BeautifulSoup(response.content, 'lxml')
print(response.status_code)
price = soup.find('span',class_ = 'PriceTabHeader__Price-sc-1494t2l-3 dUEhYD')
price = float(price.text.replace("$",""))
if(price > 10.0):
continue
name = soup.find('h1',class_ = 'styles__MainTitle-sc-3h4sqb-1 eDBkFr')
name = name.text
ans.append((price,name))
time.sleep(5)
except:
print('Failed to fetch html: ' + url)
continue
ans.sort()
for el in ans:
print('Name: '+el[1])
print('Price: '+str(el[0]))
print('--------------------')
| 145.815385
| 7,329
| 0.809559
| 1,141
| 9,478
| 6.620508
| 0.539001
| 0.011649
| 0.009267
| 0.019063
| 0.079031
| 0.061292
| 0.04673
| 0.037993
| 0.032433
| 0
| 0
| 0.291057
| 0.063304
| 9,478
| 65
| 7,330
| 145.815385
| 0.559811
| 0.001161
| 0
| 0.271186
| 0
| 0.067797
| 0.860576
| 0.783367
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.118644
| 0
| 0.118644
| 0.118644
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
1520e70dad95421ca5086006a6b9b68898fb8301
| 160
|
py
|
Python
|
lucene-experiment/whitespaceanalyzer.py
|
machacek/information-retrieval-project
|
725fb5dbc4c438bf4ab42ec277fa57bc97b8140b
|
[
"Unlicense"
] | null | null | null |
lucene-experiment/whitespaceanalyzer.py
|
machacek/information-retrieval-project
|
725fb5dbc4c438bf4ab42ec277fa57bc97b8140b
|
[
"Unlicense"
] | null | null | null |
lucene-experiment/whitespaceanalyzer.py
|
machacek/information-retrieval-project
|
725fb5dbc4c438bf4ab42ec277fa57bc97b8140b
|
[
"Unlicense"
] | 1
|
2019-03-16T16:37:04.000Z
|
2019-03-16T16:37:04.000Z
|
import lucene
class WhitespaceAnalyzer(lucene.PythonAnalyzer):
def tokenStream(self, fieldName, reader):
return lucene.WhitespaceTokenizer(reader)
| 26.666667
| 49
| 0.78125
| 15
| 160
| 8.333333
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.14375
| 160
| 5
| 50
| 32
| 0.912409
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0.25
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
15263eed174e42d01ccad59e003a78928789869a
| 1,727
|
py
|
Python
|
amalgam/primordials/comparison.py
|
PureFunctor/amalgam-lisp
|
c3c1a9794495ba3eb87fcedbf5a294463ed717c1
|
[
"MIT"
] | 3
|
2020-11-26T05:32:57.000Z
|
2021-01-01T19:45:40.000Z
|
amalgam/primordials/comparison.py
|
PureFunctor/amalgam-lisp
|
c3c1a9794495ba3eb87fcedbf5a294463ed717c1
|
[
"MIT"
] | 3
|
2020-11-25T04:00:43.000Z
|
2021-05-24T09:37:36.000Z
|
amalgam/primordials/comparison.py
|
PureFunctor/amalgam-lisp
|
c3c1a9794495ba3eb87fcedbf5a294463ed717c1
|
[
"MIT"
] | null | null | null |
from __future__ import annotations
from typing import TYPE_CHECKING
import amalgam.amalgams as am
from amalgam.primordials.utils import make_function
if TYPE_CHECKING: # pragma: no cover
from amalgam.environment import Environment
from amalgam.primordials.utils import Store
COMPARISON: Store = {}
@make_function(COMPARISON, ">")
def _gt(env: Environment, x: am.Amalgam, y: am.Amalgam) -> am.Atom:
"""Performs a `greater than` comparison."""
if x > y: # type: ignore
return am.Atom("TRUE")
return am.Atom("FALSE")
@make_function(COMPARISON, "<")
def _lt(env: Environment, x: am.Amalgam, y: am.Amalgam) -> am.Atom:
"""Performs a `less than` comparison."""
if x < y: # type: ignore
return am.Atom("TRUE")
return am.Atom("FALSE")
@make_function(COMPARISON, "=")
def _eq(env: Environment, x: am.Amalgam, y: am.Amalgam) -> am.Atom:
"""Performs an `equals` comparison."""
if x == y:
return am.Atom("TRUE")
return am.Atom("FALSE")
@make_function(COMPARISON, "/=")
def _ne(env: Environment, x: am.Amalgam, y: am.Amalgam) -> am.Atom:
"""Performs a `not equals` comparison."""
if x != y:
return am.Atom("TRUE")
return am.Atom("FALSE")
@make_function(COMPARISON, ">=")
def _ge(env: Environment, x: am.Amalgam, y: am.Amalgam) -> am.Atom:
"""Performs a `greater than or equal` comparison."""
if x >= y: # type: ignore
return am.Atom("TRUE")
return am.Atom("FALSE")
@make_function(COMPARISON, "<=")
def _le(env: Environment, x: am.Amalgam, y: am.Amalgam) -> am.Atom:
"""Performs a `less than or equal` comparison."""
if x <= y: # type: ignore
return am.Atom("TRUE")
return am.Atom("FALSE")
| 27.412698
| 67
| 0.642154
| 237
| 1,727
| 4.599156
| 0.198312
| 0.099083
| 0.13211
| 0.137615
| 0.798165
| 0.737615
| 0.737615
| 0.737615
| 0.737615
| 0.737615
| 0
| 0
| 0.199189
| 1,727
| 62
| 68
| 27.854839
| 0.788142
| 0.17487
| 0
| 0.315789
| 0
| 0
| 0.045324
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.157895
| false
| 0
| 0.157895
| 0
| 0.631579
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
1529789a92daa06e65cbc174e21f052d67652dad
| 2,683
|
py
|
Python
|
tests/transaction_tests.py
|
AoHRuthless/Doubloon
|
9279ac7decd434d43bf9b03487691aa52aab499f
|
[
"Apache-2.0"
] | 1
|
2018-08-13T10:26:39.000Z
|
2018-08-13T10:26:39.000Z
|
tests/transaction_tests.py
|
AoHRuthless/Doubloon
|
9279ac7decd434d43bf9b03487691aa52aab499f
|
[
"Apache-2.0"
] | null | null | null |
tests/transaction_tests.py
|
AoHRuthless/Doubloon
|
9279ac7decd434d43bf9b03487691aa52aab499f
|
[
"Apache-2.0"
] | null | null | null |
from unittest import TestCase
from Crypto import Random
from Crypto.PublicKey import RSA
from binascii import hexlify
from src.transaction import Transaction
PUBLIC_KEY = '30819f300d06092a864886f70d010101050003818d0030818902818100d99c9347b6ecd418b1df48012201c5bd2869a707e45dee91a5c63027dc8020210aa4cf6e34e81fc200f29c893add94fefbf37594a964641fc52f8905280c4d93457d4cee5fb216a09a9e8688c62e26bc9e962357c019c5e6c73818f155b87ccaa70059cfa0698c85f5d982bef73bc84e6dfac540cf4f43308b799b8439c1011d0203010001'
PRIVATE_KEY = '3082025b02010002818100d99c9347b6ecd418b1df48012201c5bd2869a707e45dee91a5c63027dc8020210aa4cf6e34e81fc200f29c893add94fefbf37594a964641fc52f8905280c4d93457d4cee5fb216a09a9e8688c62e26bc9e962357c019c5e6c73818f155b87ccaa70059cfa0698c85f5d982bef73bc84e6dfac540cf4f43308b799b8439c1011d02030100010281802b55c5f2a317f888ce6b33909e30122bc02f8206cd507360e7cd56eba93a8eab65ce3a4cad1688b47eb1d1c0764b880f5b273984185398a8c700d75d828328b34bffe18565d9145a0db7aef152a9452642acc0518ccfa224287ba38fabb93a51f0da4db17b82a0ca12b6b69ff1c7b172061ce60ae9665b064ee21490e5cd0215024100db115ac3a95d00bdeabb429f841100d2786ab0849753eed0e0208020e8fe2e5d7e171d69d7552a9adee2840e846e56a6b1452c3a7b7c330f02595b3479f815cf024100fe4c5fe8c71d1e746d83b9bd9021d1fd6027090382321421f432ffabc713fca58cf1d116108e493a7b98854be96c761300a891f281db40ffdb9edc09cb29e15302404ca9f3209c299ef3d7acb6f10a0fc540e2c13b8afb46754205dd79d98a90417b987fd05c54ee4a1daeb888cc67ce1166fe8c9da0cdcc36361f7553f4b6667a830240675e845e0b123b1ef8a5630b3b5b84108ad55344a9d7d1773bdcbf31046b8b7780238bea7c305a73fb69b445774d2f71ea029bd108182803d9326a1f51066521024052b9850ce79b3b2f2eeb481999d65426089fa3680fd35568e5010ba0121e37cf10c64ecc20843a26a09c5d5eefbb35a43061cd33b7adca63965d7dbfcedf6544'
class TransactionTests(TestCase):
def setUp(self):
self.transaction = Transaction(PUBLIC_KEY, 'receiver', 5)
def test_init(self):
self.assertEqual(self.transaction.sender, PUBLIC_KEY)
self.assertEqual(self.transaction.receiver, 'receiver')
self.assertEqual(self.transaction.amount, 5)
def test_dict(self):
transaction_dict = {
'sender': PUBLIC_KEY,
'receiver': 'receiver',
'amount': 5
}
self.assertEqual(self.transaction.dict, transaction_dict)
def test_verify_sig_passes(self):
self.assertTrue(self.transaction.verify_signature(PRIVATE_KEY))
def test_verify_sig_fails(self):
rng = Random.new().read
priv_key = RSA.generate(1024, rng)
rand_private_key = hexlify(priv_key.exportKey(format='DER')).decode(
'utf8')
self.assertFalse(self.transaction.verify_signature(rand_private_key))
| 70.605263
| 1,230
| 0.865822
| 134
| 2,683
| 17.156716
| 0.365672
| 0.052197
| 0.033058
| 0.052197
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.42183
| 0.091688
| 2,683
| 38
| 1,231
| 70.605263
| 0.521543
| 0
| 0
| 0
| 0
| 0
| 0.592027
| 0.573025
| 0
| 1
| 0
| 0
| 0.206897
| 1
| 0.172414
| false
| 0.034483
| 0.172414
| 0
| 0.37931
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
153758bd5ecce02407d503e454dc098e0ee43ee5
| 11,941
|
py
|
Python
|
demo/alphaction/modeling/backbone/slowfast.py
|
PANBOHE/Humanpose-fight
|
36e6218db526d567922fa528fa7e11497c53ad60
|
[
"Apache-2.0"
] | 1
|
2022-02-24T08:52:15.000Z
|
2022-02-24T08:52:15.000Z
|
demo/alphaction/modeling/backbone/slowfast.py
|
PANBOHE/Humanpose-fight
|
36e6218db526d567922fa528fa7e11497c53ad60
|
[
"Apache-2.0"
] | null | null | null |
demo/alphaction/modeling/backbone/slowfast.py
|
PANBOHE/Humanpose-fight
|
36e6218db526d567922fa528fa7e11497c53ad60
|
[
"Apache-2.0"
] | null | null | null |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import torch
import torch.nn as nn
from alphaction.modeling.common_blocks import ResNLBlock
from alphaction.layers import FrozenBatchNorm3d
def get_slow_model_cfg(cfg):
backbone_strs = cfg.MODEL.BACKBONE.CONV_BODY.split('-')[1:]
error_msg = 'Model backbone {} is not supported.'.format(cfg.MODEL.BACKBONE.CONV_BODY)
use_temp_convs_1 = [0]
temp_strides_1 = [1]
max_pool_stride_1 = 1
use_temp_convs_2 = [0, 0, 0]
temp_strides_2 = [1, 1, 1]
use_temp_convs_3 = [0, 0, 0, 0]
temp_strides_3 = [1, 1, 1, 1]
use_temp_convs_5 = [1, 1, 1]
temp_strides_5 = [1, 1, 1]
slow_stride = cfg.INPUT.TAU
avg_pool_stride = int(cfg.INPUT.FRAME_NUM / slow_stride)
if backbone_strs[0] == 'Resnet50':
block_config = (3, 4, 6, 3)
use_temp_convs_4 = [1, 1, 1, 1, 1, 1]
temp_strides_4 = [1, 1, 1, 1, 1, 1]
elif backbone_strs[0] == 'Resnet101':
block_config = (3, 4, 23, 3)
use_temp_convs_4 = [1, ] * 23
temp_strides_4 = [1, ] * 23
else:
raise KeyError(error_msg)
if len(backbone_strs) > 1:
raise KeyError(error_msg)
use_temp_convs_set = [use_temp_convs_1, use_temp_convs_2, use_temp_convs_3, use_temp_convs_4, use_temp_convs_5]
temp_strides_set = [temp_strides_1, temp_strides_2, temp_strides_3, temp_strides_4, temp_strides_5]
pool_strides_set = [max_pool_stride_1, avg_pool_stride]
return block_config, use_temp_convs_set, temp_strides_set, pool_strides_set
def get_fast_model_cfg(cfg):
backbone_strs = cfg.MODEL.BACKBONE.CONV_BODY.split('-')[1:]
error_msg = 'Model backbone {} is not supported.'.format(cfg.MODEL.BACKBONE.CONV_BODY)
use_temp_convs_1 = [2]
temp_strides_1 = [1]
max_pool_stride_1 = 1
use_temp_convs_2 = [1, 1, 1]
temp_strides_2 = [1, 1, 1]
use_temp_convs_3 = [1, 1, 1, 1]
temp_strides_3 = [1, 1, 1, 1]
use_temp_convs_5 = [1, 1, 1]
temp_strides_5 = [1, 1, 1]
fast_stride = cfg.INPUT.TAU // cfg.INPUT.ALPHA
avg_pool_stride = int(cfg.INPUT.FRAME_NUM / fast_stride)
if backbone_strs[0] == 'Resnet50':
block_config = (3, 4, 6, 3)
use_temp_convs_4 = [1, 1, 1, 1, 1, 1]
temp_strides_4 = [1, 1, 1, 1, 1, 1]
elif backbone_strs[0] == 'Resnet101':
block_config = (3, 4, 23, 3)
use_temp_convs_4 = [1, ] * 23
temp_strides_4 = [1, ] * 23
else:
raise KeyError(error_msg)
if len(backbone_strs) > 1:
raise KeyError(error_msg)
use_temp_convs_set = [use_temp_convs_1, use_temp_convs_2, use_temp_convs_3, use_temp_convs_4, use_temp_convs_5]
temp_strides_set = [temp_strides_1, temp_strides_2, temp_strides_3, temp_strides_4, temp_strides_5]
pool_strides_set = [max_pool_stride_1, avg_pool_stride]
return block_config, use_temp_convs_set, temp_strides_set, pool_strides_set
class LateralBlock(nn.Module):
def __init__(self, conv_dim, alpha):
super(LateralBlock, self).__init__()
self.conv = nn.Conv3d(conv_dim, conv_dim * 2, kernel_size=(5, 1, 1), stride=(alpha, 1, 1),
padding=(2, 0, 0), bias=True)
nn.init.kaiming_normal_(self.conv.weight)
nn.init.constant_(self.conv.bias, 0.0)
def forward(self, x):
out = self.conv(x)
return out
class FastPath(nn.Module):
def __init__(self, cfg):
super(FastPath, self).__init__()
self.cfg = cfg.clone()
block_config, use_temp_convs_set, temp_strides_set, pool_strides_set = get_fast_model_cfg(cfg)
conv3_nonlocal = cfg.MODEL.BACKBONE.SLOWFAST.FAST.CONV3_NONLOCAL
conv4_nonlocal = cfg.MODEL.BACKBONE.SLOWFAST.FAST.CONV4_NONLOCAL
dim_inner = 8
conv_dims = [8, 32, 64, 128, 256]
self.dim_out = conv_dims[-1]
n1, n2, n3, n4 = block_config
layer_mod = 2
conv3_nl_mod = layer_mod
conv4_nl_mod = layer_mod
if not conv3_nonlocal:
conv3_nl_mod = 1000
if not conv4_nonlocal:
conv4_nl_mod = 1000
self.c2_mapping = None
self.conv1 = nn.Conv3d(3, conv_dims[0], (1 + use_temp_convs_set[0][0] * 2, 7, 7),
stride=(temp_strides_set[0][0], 2, 2),
padding=(use_temp_convs_set[0][0], 3, 3), bias=False)
nn.init.kaiming_normal_(self.conv1.weight)
if cfg.MODEL.BACKBONE.FROZEN_BN:
self.bn1 = FrozenBatchNorm3d(conv_dims[0], eps=cfg.MODEL.BACKBONE.BN_EPSILON)
nn.init.constant_(self.bn1.weight, 1.0)
nn.init.constant_(self.bn1.bias, 0.0)
else:
self.bn1 = nn.BatchNorm3d(conv_dims[0], eps=cfg.MODEL.BACKBONE.BN_EPSILON,
momentum=cfg.MODEL.BACKBONE.BN_MOMENTUM)
self.relu = nn.ReLU(inplace=True)
self.maxpool1 = nn.MaxPool3d((pool_strides_set[0], 3, 3), stride=(pool_strides_set[0], 2, 2))
self.res_nl1 = ResNLBlock(cfg, conv_dims[0], conv_dims[1], stride=1, num_blocks=n1, dim_inner=dim_inner,
use_temp_convs=use_temp_convs_set[1], temp_strides=temp_strides_set[1])
self.res_nl2 = ResNLBlock(cfg, conv_dims[1], conv_dims[2], stride=2, num_blocks=n2,
dim_inner=dim_inner * 2, use_temp_convs=use_temp_convs_set[2],
temp_strides=temp_strides_set[2], nonlocal_mod=conv3_nl_mod,
group_nonlocal=cfg.MODEL.BACKBONE.SLOWFAST.FAST.CONV3_GROUP_NL)
self.res_nl3 = ResNLBlock(cfg, conv_dims[2], conv_dims[3], stride=2, num_blocks=n3,
dim_inner=dim_inner * 4, use_temp_convs=use_temp_convs_set[3],
temp_strides=temp_strides_set[3], nonlocal_mod=conv4_nl_mod)
self.res_nl4 = ResNLBlock(cfg, conv_dims[3], conv_dims[4], stride=1, num_blocks=n4,
dim_inner=dim_inner * 8, use_temp_convs=use_temp_convs_set[4],
temp_strides=temp_strides_set[4],
dilation=2)
if cfg.MODEL.BACKBONE.SLOWFAST.LATERAL == 'tconv':
self._tconv(conv_dims)
def _tconv(self, conv_dims):
alpha = self.cfg.INPUT.ALPHA
self.Tconv1 = LateralBlock(conv_dims[0], alpha)
self.Tconv2 = LateralBlock(conv_dims[1], alpha)
self.Tconv3 = LateralBlock(conv_dims[2], alpha)
self.Tconv4 = LateralBlock(conv_dims[3], alpha)
def forward(self, x):
out = self.conv1(x)
out = self.bn1(out)
out = self.relu(out)
out = self.maxpool1(out)
tconv1 = self.Tconv1(out)
out = self.res_nl1(out)
tconv2 = self.Tconv2(out)
out = self.res_nl2(out)
tconv3 = self.Tconv3(out)
out = self.res_nl3(out)
tconv4 = self.Tconv4(out)
out = self.res_nl4(out)
return out, [tconv1, tconv2, tconv3, tconv4]
class SlowPath(nn.Module):
def __init__(self, cfg):
super(SlowPath, self).__init__()
self.cfg = cfg.clone()
block_config, use_temp_convs_set, temp_strides_set, pool_strides_set = get_slow_model_cfg(cfg)
conv3_nonlocal = cfg.MODEL.BACKBONE.SLOWFAST.SLOW.CONV3_NONLOCAL
conv4_nonlocal = cfg.MODEL.BACKBONE.SLOWFAST.SLOW.CONV4_NONLOCAL
dim_inner = 64
conv_dims = [64, 256, 512, 1024, 2048]
self.dim_out = conv_dims[-1]
n1, n2, n3, n4 = block_config
layer_mod = 2
conv3_nl_mod = layer_mod
conv4_nl_mod = layer_mod
if not conv3_nonlocal:
conv3_nl_mod = 1000
if not conv4_nonlocal:
conv4_nl_mod = 1000
self.c2_mapping = None
self.conv1 = nn.Conv3d(3, conv_dims[0], (1 + use_temp_convs_set[0][0] * 2, 7, 7),
stride=(temp_strides_set[0][0], 2, 2),
padding=(use_temp_convs_set[0][0], 3, 3), bias=False)
nn.init.kaiming_normal_(self.conv1.weight)
if cfg.MODEL.BACKBONE.FROZEN_BN:
self.bn1 = FrozenBatchNorm3d(conv_dims[0], eps=cfg.MODEL.BACKBONE.BN_EPSILON)
nn.init.constant_(self.bn1.weight, 1.0)
nn.init.constant_(self.bn1.bias, 0.0)
else:
self.bn1 = nn.BatchNorm3d(conv_dims[0], eps=cfg.MODEL.BACKBONE.BN_EPSILON,
momentum=cfg.MODEL.BACKBONE.BN_MOMENTUM)
self.relu = nn.ReLU(inplace=True)
self.maxpool1 = nn.MaxPool3d((pool_strides_set[0], 3, 3), stride=(pool_strides_set[0], 2, 2))
self.res_nl1 = ResNLBlock(cfg, conv_dims[0], conv_dims[1], stride=1, num_blocks=n1, dim_inner=dim_inner,
use_temp_convs=use_temp_convs_set[1], temp_strides=temp_strides_set[1],
lateral=cfg.MODEL.BACKBONE.SLOWFAST.FAST.ACTIVE)
self.res_nl2 = ResNLBlock(cfg, conv_dims[1], conv_dims[2], stride=2, num_blocks=n2,
dim_inner=dim_inner * 2, use_temp_convs=use_temp_convs_set[2],
temp_strides=temp_strides_set[2], nonlocal_mod=conv3_nl_mod,
group_nonlocal=cfg.MODEL.BACKBONE.SLOWFAST.SLOW.CONV3_GROUP_NL,
lateral=cfg.MODEL.BACKBONE.SLOWFAST.FAST.ACTIVE)
self.res_nl3 = ResNLBlock(cfg, conv_dims[2], conv_dims[3], stride=2, num_blocks=n3,
dim_inner=dim_inner * 4, use_temp_convs=use_temp_convs_set[3],
temp_strides=temp_strides_set[3], nonlocal_mod=conv4_nl_mod,
lateral=cfg.MODEL.BACKBONE.SLOWFAST.FAST.ACTIVE)
self.res_nl4 = ResNLBlock(cfg, conv_dims[3], conv_dims[4], stride=1, num_blocks=n4,
dim_inner=dim_inner * 8, use_temp_convs=use_temp_convs_set[4],
temp_strides=temp_strides_set[4], lateral=cfg.MODEL.BACKBONE.SLOWFAST.FAST.ACTIVE,
dilation=2)
def forward(self, x, lateral_connection=None):
out = self.conv1(x)
out = self.bn1(out)
out = self.relu(out)
out = self.maxpool1(out)
if lateral_connection:
out = torch.cat([out, lateral_connection[0]], dim=1)
out = self.res_nl1(out)
if lateral_connection:
out = torch.cat([out, lateral_connection[1]], dim=1)
out = self.res_nl2(out)
if lateral_connection:
out = torch.cat([out, lateral_connection[2]], dim=1)
out = self.res_nl3(out)
if lateral_connection:
out = torch.cat([out, lateral_connection[3]], dim=1)
out = self.res_nl4(out)
return out
class SlowFast(nn.Module):
def __init__(self, cfg):
super(SlowFast, self).__init__()
self.cfg = cfg.clone()
if cfg.MODEL.BACKBONE.SLOWFAST.SLOW.ACTIVE:
self.slow = SlowPath(cfg)
if cfg.MODEL.BACKBONE.SLOWFAST.FAST.ACTIVE:
self.fast = FastPath(cfg)
if cfg.MODEL.BACKBONE.SLOWFAST.SLOW.ACTIVE and cfg.MODEL.BACKBONE.SLOWFAST.FAST.ACTIVE:
self.dim_out = self.slow.dim_out + self.fast.dim_out
elif cfg.MODEL.BACKBONE.SLOWFAST.SLOW.ACTIVE:
self.dim_out = self.slow.dim_out
elif cfg.MODEL.BACKBONE.SLOWFAST.FAST.ACTIVE:
self.dim_out = self.fast.dim_out
def forward(self, slow_x, fast_x):
tconv = None
cfg = self.cfg
slowout = None
fastout = None
if cfg.MODEL.BACKBONE.SLOWFAST.FAST.ACTIVE:
fastout, tconv = self.fast(fast_x)
if cfg.MODEL.BACKBONE.SLOWFAST.SLOW.ACTIVE:
slowout = self.slow(slow_x, tconv)
return slowout, fastout
| 39.936455
| 116
| 0.610418
| 1,697
| 11,941
| 3.988215
| 0.088981
| 0.01448
| 0.085106
| 0.067376
| 0.83156
| 0.801714
| 0.78753
| 0.724291
| 0.694149
| 0.661791
| 0
| 0.052185
| 0.279457
| 11,941
| 298
| 117
| 40.07047
| 0.734426
| 0
| 0
| 0.639485
| 0
| 0
| 0.009296
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.04721
| false
| 0
| 0.021459
| 0
| 0.111588
| 0.004292
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 5
|
1553f7c914f3f7e12ec3b6bae881115f6bdc2214
| 8,926
|
py
|
Python
|
pydiscordbot/ext/modules/botmodulemanager/botmodulemanager.py
|
wlsouza/pydiscordbot
|
848a991209013ff173b1ae574ae33f68ed8f859f
|
[
"MIT"
] | null | null | null |
pydiscordbot/ext/modules/botmodulemanager/botmodulemanager.py
|
wlsouza/pydiscordbot
|
848a991209013ff173b1ae574ae33f68ed8f859f
|
[
"MIT"
] | null | null | null |
pydiscordbot/ext/modules/botmodulemanager/botmodulemanager.py
|
wlsouza/pydiscordbot
|
848a991209013ff173b1ae574ae33f68ed8f859f
|
[
"MIT"
] | null | null | null |
from discord.ext import commands
from asyncio.exceptions import CancelledError, TimeoutError
from dislash import SelectMenu, SelectOption
from ext.modules import Module
from ext.config import settings
from ext.db import models
class BotModuleManager(Module):
# Auxiliary methods
def _get_unloaded_modules(self):
unloaded_modules = []
app_modules = self.app.extensions.keys()
db_modules = self.session.query(models.Module).filter(models.Module.disableable == True).all()
for db_module in db_modules:
if db_module.path not in app_modules:
unloaded_modules.append(db_module)
return unloaded_modules
def _get_loaded_modules(self):
loaded_modules = []
app_modules = self.app.extensions.keys()
db_modules = self.session.query(models.Module).filter(models.Module.disableable == True).all()
for db_module in db_modules:
if db_module.path in app_modules:
loaded_modules.append(db_module)
return loaded_modules
# Command methods
@commands.command()
@commands.is_owner()
async def load_modules(self, ctx):
try:
# set select/dropdown options
select_options = [
SelectOption(label="Cancel", value="cancel", emoji="❌")
]
for module in self._get_unloaded_modules():
select_options.insert(
0,
SelectOption(
label=module.name.title(),
value=module.path,
emoji=module.emoji
)
)
msg = await ctx.send(
"Select the module to be loaded into the bot:",
components=[
SelectMenu(
custom_id="load_module",
placeholder=f"Choose up to {len(select_options)} modules",
max_values=len(select_options),
options=select_options
)
]
)
# Wait for a click on the menu that was sent.
inter = await msg.wait_for_dropdown(
check=(lambda m: m.author == ctx.author),
timeout=60
)
# Tells which option was selected.
selected_options = inter.select_menu.selected_options
selected_labels = [option.label for option in selected_options]
selected_values = [option.value for option in selected_options]
if "cancel" in selected_values:
raise CancelledError()
# Load the modules
for module_path in selected_values:
self.app.load_extension(module_path)
await inter.reply(f"👌 The following module(s) has been loaded: {', '.join(selected_labels)}")
except CancelledError:
await inter.reply("⚠️ The process was canceled because the cancel option was selected.")
except TimeoutError:
await msg.reply(f"⚠️ No modules were selected within the timeout (60 seconds). The process was aborted.")
except ModuleNotFoundError:
await inter.reply(f"😿 Unknown error. Please contact the administrator. ")
@commands.command()
@commands.is_owner()
async def unload_modules(self, ctx):
try:
# set select/dropdown options
select_options = [
SelectOption(label="Cancel", value="cancel", emoji="❌")
]
for module in self._get_loaded_modules():
select_options.insert(
0,
SelectOption(
label=module.name.title(),
value=module.path,
emoji=module.emoji
)
)
msg = await ctx.send(
"Select the module to be unloaded from the bot:",
components=[
SelectMenu(
custom_id="unload_module",
placeholder=f"Choose up to {len(select_options)} modules",
max_values=len(select_options),
options=select_options
)
]
)
# Wait for a click on the menu that was sent.
inter = await msg.wait_for_dropdown(
check= (lambda m: m.author == ctx.author),
timeout=60
)
# Tells which option was selected.
selected_options = inter.select_menu.selected_options
selected_labels = [option.label for option in selected_options]
selected_values = [option.value for option in selected_options]
if "cancel" in selected_values:
raise CancelledError()
# Load the modules
for module_path in selected_values:
self.app.unload_extension(module_path)
await inter.reply(f"👌 The following module(s) has been unloaded: {', '.join(selected_labels)}")
except CancelledError:
await inter.reply("⚠️ The process was canceled because the cancel option was selected.")
except TimeoutError:
await msg.reply("⚠️ No modules were selected within the timeout (60 seconds). The process was aborted.")
except ModuleNotFoundError:
await inter.reply(f"😿 Unknown error. Please contact the administrator. ")
@commands.command()
@commands.is_owner()
async def reload_modules(self, ctx):
try:
# set select/dropdown options
select_options = [
SelectOption(label="Cancel", value="cancel", emoji="❌")
]
for module in self._get_loaded_modules():
select_options.insert(
0,
SelectOption(
label=module.name.title(),
value=module.path,
emoji=module.emoji
)
)
msg = await ctx.send(
"Select the module to be reloaded from the bot:",
components=[
SelectMenu(
custom_id="reload_module",
placeholder=f"Choose up to {len(select_options)} modules",
max_values=len(select_options),
options=select_options
)
]
)
# Wait for a click on the menu that was sent.
inter = await msg.wait_for_dropdown(
check= (lambda m: m.author == ctx.author),
timeout=60
)
# Tells which option was selected.
selected_options = inter.select_menu.selected_options
selected_labels = [option.label for option in selected_options]
selected_values = [option.value for option in selected_options]
if "cancel" in selected_values:
raise CancelledError()
# Load the modules
for module_path in selected_values:
self.app.unload_extension(module_path)
await inter.reply(f"👌 The following module(s) has been reloaded: {', '.join(selected_labels)}")
except CancelledError:
await inter.reply("⚠️ The process was canceled because the cancel option was selected.")
except TimeoutError:
await msg.reply("⚠️ No modules were selected within the timeout (60 seconds). The process was aborted.")
except ModuleNotFoundError:
await inter.reply(f"😿 Unknown error. Please contact the administrator. ")
@reload_modules.error
@unload_modules.error
@load_modules.error
async def extension_errors(self, ctx, error):
try:
error_msgs = {
commands.ExtensionNotFound: f"This extension was not found.\nPlease contact the system admin.",
commands.ExtensionAlreadyLoaded: f"This extension already loaded!",
commands.NoEntryPointError: f"This extension can't be loaded! Please contact the system admin.",
commands.ExtensionFailed: f"This extension cannot be loaded because an error was found in it."
f"Please contact the system admin.",
commands.ExtensionNotLoaded: f"This extension isn't loaded!"
}
if message := error_msgs.get(type(error.original)):
await ctx.send(message)
except AttributeError:
pass
# @commands.Cog.listener()
# async def on_command_error(self, ctx, error):
# if isinstance(error, commands.errors.MissingRole):
# await ctx.send("You don't have the correct role for this command.")
| 43.754902
| 117
| 0.561506
| 930
| 8,926
| 5.284946
| 0.175269
| 0.039674
| 0.027467
| 0.023194
| 0.782299
| 0.765412
| 0.744252
| 0.721058
| 0.721058
| 0.721058
| 0
| 0.002634
| 0.362088
| 8,926
| 204
| 118
| 43.754902
| 0.856867
| 0.067667
| 0
| 0.605714
| 0
| 0
| 0.176301
| 0.016257
| 0
| 0
| 0
| 0
| 0
| 1
| 0.011429
| false
| 0.005714
| 0.034286
| 0
| 0.062857
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
1575594b3b1111528a8ec7e5e21e551436e90b8c
| 2,485
|
py
|
Python
|
tests/test_solution.py
|
da1910/pymapdl
|
305b70b30e61a78011e974ff4cb409ee21f89e13
|
[
"MIT"
] | 194
|
2016-10-21T08:46:41.000Z
|
2021-01-06T20:39:23.000Z
|
tests/test_solution.py
|
da1910/pymapdl
|
305b70b30e61a78011e974ff4cb409ee21f89e13
|
[
"MIT"
] | 463
|
2021-01-12T14:07:38.000Z
|
2022-03-31T22:42:25.000Z
|
tests/test_solution.py
|
da1910/pymapdl
|
305b70b30e61a78011e974ff4cb409ee21f89e13
|
[
"MIT"
] | 66
|
2016-11-21T04:26:08.000Z
|
2020-12-28T09:27:27.000Z
|
"""Test ansys.mapdl.solution.Solution"""
def time_step_size(mapdl):
assert isinstance(mapdl.solution.time_step_size, float)
def test_n_cmls(mapdl):
assert isinstance(mapdl.solution.n_cmls, float)
def test_n_cmss(mapdl):
assert isinstance(mapdl.solution.n_cmss, float)
def test_n_eqit(mapdl):
assert isinstance(mapdl.solution.n_eqit, float)
def test_n_cmit(mapdl):
assert isinstance(mapdl.solution.n_cmit, float)
def test_converged(mapdl):
assert isinstance(mapdl.solution.converged, bool)
def test_mx_dof(mapdl):
assert isinstance(mapdl.solution.mx_dof, float)
def test_res_frq(mapdl):
assert isinstance(mapdl.solution.res_frq, float)
def test_res_eig(mapdl):
assert isinstance(mapdl.solution.res_eig, float)
def test_decent_parm(mapdl):
assert isinstance(mapdl.solution.decent_parm, float)
def test_force_cnv(mapdl):
assert isinstance(mapdl.solution.force_cnv, float)
def test_moment_cnv(mapdl):
assert isinstance(mapdl.solution.moment_cnv, float)
def test_heat_flow_cnv(mapdl):
assert isinstance(mapdl.solution.heat_flow_cnv, float)
def test_magnetic_flux_cnv(mapdl):
assert isinstance(mapdl.solution.magnetic_flux_cnv, float)
def test_current_segment_cnv(mapdl):
assert isinstance(mapdl.solution.current_segment_cnv, float)
def test_current_cnv(mapdl):
assert isinstance(mapdl.solution.current_cnv, float)
def test_fluid_flow_cnv(mapdl):
assert isinstance(mapdl.solution.fluid_flow_cnv, float)
def test_displacement_cnv(mapdl):
assert isinstance(mapdl.solution.displacement_cnv, float)
def test_rotation_cnv(mapdl):
assert isinstance(mapdl.solution.rotation_cnv, float)
def test_temperature_cnv(mapdl):
assert isinstance(mapdl.solution.temperature_cnv, float)
def test_vector_cnv(mapdl):
assert isinstance(mapdl.solution.vector_cnv, float)
def test_smcv(mapdl):
assert isinstance(mapdl.solution.smcv, float)
def test_voltage_conv(mapdl):
assert isinstance(mapdl.solution.voltage_conv, float)
def test_pressure_conv(mapdl):
assert isinstance(mapdl.solution.pressure_conv, float)
def test_velocity_conv(mapdl):
assert isinstance(mapdl.solution.velocity_conv, float)
def test_mx_creep_rat(mapdl):
assert isinstance(mapdl.solution.mx_creep_rat, float)
def test_mx_plastic_inc(mapdl):
assert isinstance(mapdl.solution.mx_plastic_inc, float)
def test_n_cg_iter(mapdl):
assert isinstance(mapdl.solution.n_cg_iter, float)
| 21.798246
| 64
| 0.781489
| 352
| 2,485
| 5.247159
| 0.142045
| 0.204115
| 0.318354
| 0.394153
| 0.605306
| 0.487277
| 0.092041
| 0
| 0
| 0
| 0
| 0
| 0.124748
| 2,485
| 113
| 65
| 21.99115
| 0.849195
| 0.013682
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0.5
| false
| 0
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
157df4dcb1edc3d4dfef73a83851840918ec55fd
| 193
|
py
|
Python
|
tensorpack/train/utility.py
|
layolu/tensorpack
|
97360e5b8ca9ce03d8a18b3abef5abfc92cb9907
|
[
"Apache-2.0"
] | 4,404
|
2018-05-30T23:38:42.000Z
|
2022-03-31T22:30:11.000Z
|
tensorpack/train/utility.py
|
layolu/tensorpack
|
97360e5b8ca9ce03d8a18b3abef5abfc92cb9907
|
[
"Apache-2.0"
] | 771
|
2018-06-01T09:54:00.000Z
|
2022-03-31T23:12:29.000Z
|
tensorpack/train/utility.py
|
layolu/tensorpack
|
97360e5b8ca9ce03d8a18b3abef5abfc92cb9907
|
[
"Apache-2.0"
] | 1,412
|
2018-06-01T00:29:43.000Z
|
2022-03-26T17:37:39.000Z
|
# -*- coding: utf-8 -*-
# File: utility.py
# for backwards-compatibility
from ..graph_builder.utils import LeastLoadedDeviceSetter, OverrideToLocalVariable, override_to_local_variable # noqa
| 32.166667
| 118
| 0.787565
| 21
| 193
| 7.047619
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005814
| 0.108808
| 193
| 5
| 119
| 38.6
| 0.854651
| 0.367876
| 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
| 1
| 0
|
0
| 5
|
158d847a26d9a9ebb08d769da4d0110882a642bd
| 2,053
|
py
|
Python
|
tools/third_party/html5lib/html5lib/tests/test_tokenizer2.py
|
meyerweb/wpt
|
f04261533819893c71289614c03434c06856c13e
|
[
"BSD-3-Clause"
] | 2,479
|
2018-05-28T14:51:29.000Z
|
2022-03-30T14:41:18.000Z
|
tools/third_party/html5lib/html5lib/tests/test_tokenizer2.py
|
meyerweb/wpt
|
f04261533819893c71289614c03434c06856c13e
|
[
"BSD-3-Clause"
] | 7,642
|
2018-05-28T09:38:03.000Z
|
2022-03-31T20:55:48.000Z
|
tools/third_party/html5lib/html5lib/tests/test_tokenizer2.py
|
meyerweb/wpt
|
f04261533819893c71289614c03434c06856c13e
|
[
"BSD-3-Clause"
] | 1,303
|
2018-05-29T14:50:02.000Z
|
2022-03-30T17:30:42.000Z
|
from __future__ import absolute_import, division, unicode_literals
import io
from six import unichr, text_type
from html5lib._tokenizer import HTMLTokenizer
from html5lib.constants import tokenTypes
def ignore_parse_errors(toks):
for tok in toks:
if tok['type'] != tokenTypes['ParseError']:
yield tok
def test_maintain_attribute_order():
# generate loads to maximize the chance a hash-based mutation will occur
attrs = [(unichr(x), text_type(i)) for i, x in enumerate(range(ord('a'), ord('z')))]
stream = io.StringIO("<span " + " ".join("%s='%s'" % (x, i) for x, i in attrs) + ">")
toks = HTMLTokenizer(stream)
out = list(ignore_parse_errors(toks))
assert len(out) == 1
assert out[0]['type'] == tokenTypes['StartTag']
attrs_tok = out[0]['data']
assert len(attrs_tok) == len(attrs)
for (in_name, in_value), (out_name, out_value) in zip(attrs, attrs_tok.items()):
assert in_name == out_name
assert in_value == out_value
def test_duplicate_attribute():
stream = io.StringIO("<span a=1 a=2 a=3>")
toks = HTMLTokenizer(stream)
out = list(ignore_parse_errors(toks))
assert len(out) == 1
assert out[0]['type'] == tokenTypes['StartTag']
attrs_tok = out[0]['data']
assert len(attrs_tok) == 1
assert list(attrs_tok.items()) == [('a', '1')]
def test_maintain_duplicate_attribute_order():
# generate loads to maximize the chance a hash-based mutation will occur
attrs = [(unichr(x), text_type(i)) for i, x in enumerate(range(ord('a'), ord('z')))]
stream = io.StringIO("<span " + " ".join("%s='%s'" % (x, i) for x, i in attrs) + " a=100>")
toks = HTMLTokenizer(stream)
out = list(ignore_parse_errors(toks))
assert len(out) == 1
assert out[0]['type'] == tokenTypes['StartTag']
attrs_tok = out[0]['data']
assert len(attrs_tok) == len(attrs)
for (in_name, in_value), (out_name, out_value) in zip(attrs, attrs_tok.items()):
assert in_name == out_name
assert in_value == out_value
| 30.641791
| 95
| 0.646371
| 299
| 2,053
| 4.264214
| 0.240803
| 0.056471
| 0.053333
| 0.065882
| 0.719216
| 0.719216
| 0.719216
| 0.719216
| 0.719216
| 0.719216
| 0
| 0.011592
| 0.201656
| 2,053
| 66
| 96
| 31.106061
| 0.766321
| 0.06868
| 0
| 0.595238
| 0
| 0
| 0.063908
| 0
| 0
| 0
| 0
| 0
| 0.333333
| 1
| 0.095238
| false
| 0
| 0.119048
| 0
| 0.214286
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
159c90da78395f39d17f3f8709606c7949060c68
| 99
|
py
|
Python
|
app/__init__.py
|
copygodistaken/newapp
|
eb2399a898dc22fc03392b3c6d7e8503ec400222
|
[
"MIT"
] | null | null | null |
app/__init__.py
|
copygodistaken/newapp
|
eb2399a898dc22fc03392b3c6d7e8503ec400222
|
[
"MIT"
] | null | null | null |
app/__init__.py
|
copygodistaken/newapp
|
eb2399a898dc22fc03392b3c6d7e8503ec400222
|
[
"MIT"
] | null | null | null |
from flask import Flask
app = Flask(__name__)
from app import views
from app import admin_views
| 12.375
| 27
| 0.787879
| 16
| 99
| 4.5625
| 0.4375
| 0.191781
| 0.356164
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 99
| 7
| 28
| 14.142857
| 0.901235
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.75
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 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
| 1
| 0
|
0
| 5
|
159cbf7bfa948706fa1b34137e35d338582e60e5
| 63
|
py
|
Python
|
mapped_config/__init__.py
|
maxpowel/mapped_config
|
dda6c67c3e4328c080dc25a5b258b567dccda694
|
[
"MIT"
] | 3
|
2016-08-30T16:16:56.000Z
|
2018-06-11T16:48:46.000Z
|
mapped_config/__init__.py
|
maxpowel/mapped_config
|
dda6c67c3e4328c080dc25a5b258b567dccda694
|
[
"MIT"
] | 6
|
2016-08-20T12:49:02.000Z
|
2021-03-25T21:50:12.000Z
|
mapped_config/__init__.py
|
maxpowel/mapped_config
|
dda6c67c3e4328c080dc25a5b258b567dccda694
|
[
"MIT"
] | 1
|
2019-05-27T10:25:40.000Z
|
2019-05-27T10:25:40.000Z
|
from .loader import YmlLoader, JsonLoader, InvalidDataException
| 63
| 63
| 0.873016
| 6
| 63
| 9.166667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.079365
| 63
| 1
| 63
| 63
| 0.948276
| 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
| 1
| 0
|
0
| 5
|
15bd090f09f582e5af17d8d98b75925cc242af86
| 172
|
py
|
Python
|
transcrypt/development/automated_tests/warnings/autotest.py
|
JMCanning78/Transcrypt
|
8a8dabe831240414fdf1d5027fa2b0d71ab45d05
|
[
"Apache-2.0"
] | 1
|
2017-08-11T01:51:51.000Z
|
2017-08-11T01:51:51.000Z
|
transcrypt/development/automated_tests/warnings/autotest.py
|
JMCanning78/Transcrypt
|
8a8dabe831240414fdf1d5027fa2b0d71ab45d05
|
[
"Apache-2.0"
] | 2
|
2021-03-11T07:09:19.000Z
|
2021-05-12T11:26:23.000Z
|
transcrypt/development/automated_tests/warnings/autotest.py
|
JMCanning78/Transcrypt
|
8a8dabe831240414fdf1d5027fa2b0d71ab45d05
|
[
"Apache-2.0"
] | 1
|
2021-02-07T00:22:12.000Z
|
2021-02-07T00:22:12.000Z
|
import org.transcrypt.autotester
import basic_tests
autoTester = org.transcrypt.autotester.AutoTester ()
autoTester.run( basic_tests, "basic_tests" )
autoTester.done()
| 17.2
| 52
| 0.802326
| 20
| 172
| 6.75
| 0.4
| 0.222222
| 0.340741
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098837
| 172
| 9
| 53
| 19.111111
| 0.870968
| 0
| 0
| 0
| 0
| 0
| 0.064327
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.4
| 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
| 1
| 0
| 0
| 0
|
0
| 5
|
ec5cacb80292b51e463059fc66ee42593c34c951
| 82
|
py
|
Python
|
model.py
|
team-backspace/backend
|
c4cced64f2f3f795dfe4684442d5563daa6b60e8
|
[
"Apache-2.0"
] | null | null | null |
model.py
|
team-backspace/backend
|
c4cced64f2f3f795dfe4684442d5563daa6b60e8
|
[
"Apache-2.0"
] | 1
|
2021-10-17T16:05:53.000Z
|
2021-10-17T16:05:53.000Z
|
model.py
|
team-backspace/backend
|
c4cced64f2f3f795dfe4684442d5563daa6b60e8
|
[
"Apache-2.0"
] | 1
|
2021-10-17T13:04:11.000Z
|
2021-10-17T13:04:11.000Z
|
from models.user import ProfileUser, LoginUser
#from models.project import Project
| 41
| 46
| 0.853659
| 11
| 82
| 6.363636
| 0.636364
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.097561
| 82
| 2
| 47
| 41
| 0.945946
| 0.414634
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
ec60815c2746d6b9519442b86d4c1afcfd09bc03
| 171
|
py
|
Python
|
SciFiReaders/readers/microscopy/__init__.py
|
sumner-harris/SciFiReaders
|
4494b7e7350ad2a6198c87590d193393566ad470
|
[
"MIT"
] | 8
|
2021-05-07T00:59:39.000Z
|
2021-12-10T21:03:59.000Z
|
SciFiReaders/readers/microscopy/__init__.py
|
sumner-harris/SciFiReaders
|
4494b7e7350ad2a6198c87590d193393566ad470
|
[
"MIT"
] | 31
|
2021-02-19T21:16:25.000Z
|
2022-03-04T22:28:09.000Z
|
SciFiReaders/readers/microscopy/__init__.py
|
sumner-harris/SciFiReaders
|
4494b7e7350ad2a6198c87590d193393566ad470
|
[
"MIT"
] | 6
|
2021-05-07T01:48:09.000Z
|
2022-01-21T21:14:36.000Z
|
from . import em
from . import spm
from .em import *
from .spm import *
__all__ = em.__all__ + spm.__all__ #+ ion.__all__
all_readers = em.all_readers + spm.all_readers
| 19
| 49
| 0.725146
| 27
| 171
| 3.888889
| 0.259259
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.175439
| 171
| 9
| 50
| 19
| 0.744681
| 0.076023
| 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 | 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
| 1
| 0
|
0
| 5
|
ec65a988ca34e460af0906d773e00b51a55d5836
| 37
|
py
|
Python
|
tests/__init__.py
|
mathiasbrito/matils
|
48456825943cbfe721bec3fd9a317182476e0144
|
[
"MIT"
] | null | null | null |
tests/__init__.py
|
mathiasbrito/matils
|
48456825943cbfe721bec3fd9a317182476e0144
|
[
"MIT"
] | null | null | null |
tests/__init__.py
|
mathiasbrito/matils
|
48456825943cbfe721bec3fd9a317182476e0144
|
[
"MIT"
] | null | null | null |
"""Package holding project tests."""
| 18.5
| 36
| 0.702703
| 4
| 37
| 6.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.108108
| 37
| 1
| 37
| 37
| 0.787879
| 0.810811
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
ec79d391d74b90b8d0fb87b0c4c8a30d36e716a4
| 77
|
py
|
Python
|
docker/common/_grains/overrides.py
|
risdenk/cloudbreak-images
|
012d79bb0a4059b3534522adefac037cecf39de1
|
[
"Apache-2.0"
] | 12
|
2017-11-13T00:02:42.000Z
|
2020-09-16T12:57:25.000Z
|
docker/common/_grains/overrides.py
|
risdenk/cloudbreak-images
|
012d79bb0a4059b3534522adefac037cecf39de1
|
[
"Apache-2.0"
] | 87
|
2017-11-22T15:02:21.000Z
|
2022-03-11T12:20:54.000Z
|
docker/common/_grains/overrides.py
|
risdenk/cloudbreak-images
|
012d79bb0a4059b3534522adefac037cecf39de1
|
[
"Apache-2.0"
] | 49
|
2017-10-04T19:15:43.000Z
|
2022-03-01T11:21:05.000Z
|
#!/usr/bin/env python
def override_init():
return { 'init': 'systemd' }
| 15.4
| 32
| 0.623377
| 10
| 77
| 4.7
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 77
| 4
| 33
| 19.25
| 0.746032
| 0.25974
| 0
| 0
| 0
| 0
| 0.196429
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
|
0
| 5
|
ec9be0a77a78f45730823bce422c4c745476135d
| 270
|
py
|
Python
|
p1_basic/day01_07base/day04/03_列表.py
|
dong-pro/fullStackPython
|
5ad8662f7b57f14c8529e7eaf64290eeda773557
|
[
"Apache-2.0"
] | 1
|
2020-04-03T01:32:05.000Z
|
2020-04-03T01:32:05.000Z
|
p1_basic/day01_07base/day04/03_列表.py
|
dong-pro/fullStackPython
|
5ad8662f7b57f14c8529e7eaf64290eeda773557
|
[
"Apache-2.0"
] | null | null | null |
p1_basic/day01_07base/day04/03_列表.py
|
dong-pro/fullStackPython
|
5ad8662f7b57f14c8529e7eaf64290eeda773557
|
[
"Apache-2.0"
] | null | null | null |
# lst = ['海上钢琴师', '奥特曼', '咒怨', '舌尖上的中国', '穹顶之下',
# '金刚', 110, True, False, ['人民币', '美金', '欧元']]
#
# print(lst[3][2]) # 上
# print(lst[-2]) # 穹顶之下
# print(lst[1:4]) # ['奥特曼', '咒怨', '舌尖上的中国']
# print(lst[-3:-1]) # 顾头不顾尾
# print(lst[1::2])
# print(lst[-1:-5:-2])
| 27
| 53
| 0.462963
| 43
| 270
| 2.906977
| 0.488372
| 0.384
| 0.216
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.068182
| 0.185185
| 270
| 9
| 54
| 30
| 0.5
| 0.914815
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 0
| 0
| 0
| null | 1
| 1
| 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
| 5
|
ecdc6dcfafe5333fc7a7bd208953f994825351a5
| 66
|
py
|
Python
|
satsmooth/tests/__init__.py
|
jgrss/satsmooth
|
9fa6de957eb1c938df070d2f3e6e7521a43778b3
|
[
"MIT"
] | 5
|
2021-09-13T08:44:18.000Z
|
2022-03-30T20:27:32.000Z
|
satsmooth/tests/__init__.py
|
jgrss/satsmooth
|
9fa6de957eb1c938df070d2f3e6e7521a43778b3
|
[
"MIT"
] | null | null | null |
satsmooth/tests/__init__.py
|
jgrss/satsmooth
|
9fa6de957eb1c938df070d2f3e6e7521a43778b3
|
[
"MIT"
] | 1
|
2021-11-21T13:08:41.000Z
|
2021-11-21T13:08:41.000Z
|
# from .test_speed import test_multi
#
# __all__ = ['test_multi']
| 16.5
| 36
| 0.712121
| 9
| 66
| 4.444444
| 0.666667
| 0.45
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.151515
| 66
| 3
| 37
| 22
| 0.714286
| 0.893939
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 1
| 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
| 5
|
bf048e176c9b8a095166dc556a35982069a5f463
| 51
|
py
|
Python
|
agents/__init__.py
|
taodav/Rainbow
|
cc76cdfcac98407a6b6aa81d519853e582d4a1af
|
[
"MIT"
] | null | null | null |
agents/__init__.py
|
taodav/Rainbow
|
cc76cdfcac98407a6b6aa81d519853e582d4a1af
|
[
"MIT"
] | null | null | null |
agents/__init__.py
|
taodav/Rainbow
|
cc76cdfcac98407a6b6aa81d519853e582d4a1af
|
[
"MIT"
] | null | null | null |
from .dqn import DQNAgent
from .mpr import MPRAgent
| 25.5
| 25
| 0.823529
| 8
| 51
| 5.25
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.137255
| 51
| 2
| 26
| 25.5
| 0.954545
| 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
| 1
| 0
|
0
| 5
|
170be22427c85746802d59e7c550b1bff58ac98e
| 200
|
py
|
Python
|
tokesim/template/__init__.py
|
tokesim/tokesim
|
981c9fb74e440d8fc3f0f093b3d5ed396c35180e
|
[
"Apache-2.0"
] | 3
|
2020-12-14T04:20:06.000Z
|
2022-02-11T13:43:20.000Z
|
tokesim/template/__init__.py
|
zcstarr/tokesim-1
|
b00ea50fe5e6647a0058e705ae9e1485af0d782b
|
[
"Apache-2.0"
] | 1
|
2020-04-23T08:11:56.000Z
|
2020-04-23T08:15:23.000Z
|
tokesim/template/__init__.py
|
zcstarr/tokesim-1
|
b00ea50fe5e6647a0058e705ae9e1485af0d782b
|
[
"Apache-2.0"
] | 2
|
2020-04-15T17:23:32.000Z
|
2022-02-11T13:43:58.000Z
|
# TODO rewrite using the latests models , and potentially include a visualization implementation for the TokenModel so it's more real
# and demonstrative of custom visualizations aka make a dashboard
| 66.666667
| 133
| 0.825
| 29
| 200
| 5.689655
| 0.896552
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.155
| 200
| 2
| 134
| 100
| 0.976331
| 0.975
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0.5
| 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
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
176a644ec8d6128be51c000e2c0ef8d2db45776d
| 151
|
py
|
Python
|
core/__init__.py
|
seanrivera/rosploit
|
f0ba18a6a7b79d3b8ab934a4d7edc85b6d47f3af
|
[
"MIT"
] | 7
|
2019-03-05T15:35:23.000Z
|
2022-01-02T15:49:44.000Z
|
core/__init__.py
|
seanrivera/rosploit
|
f0ba18a6a7b79d3b8ab934a4d7edc85b6d47f3af
|
[
"MIT"
] | 4
|
2020-12-17T09:09:09.000Z
|
2022-03-09T06:19:18.000Z
|
core/__init__.py
|
seanrivera/rosploit
|
f0ba18a6a7b79d3b8ab934a4d7edc85b6d47f3af
|
[
"MIT"
] | 3
|
2019-07-22T12:39:54.000Z
|
2020-10-18T11:40:00.000Z
|
from .exceptions import StateException
from .message import Message
from .node import Node
from .probe_node import probe_node
from .topic import Topic
| 25.166667
| 38
| 0.834437
| 22
| 151
| 5.636364
| 0.363636
| 0.16129
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.13245
| 151
| 5
| 39
| 30.2
| 0.946565
| 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
| 1
| 0
|
0
| 5
|
1786140523e8826a91066a83eeb2beec8ae1fd49
| 199
|
py
|
Python
|
dgpsi/__init__.py
|
mingdeyu/DGP
|
fcc630896d45175d1aa72219607178ca7648cffb
|
[
"MIT"
] | 12
|
2021-07-06T07:49:42.000Z
|
2022-03-10T09:49:04.000Z
|
dgpsi/__init__.py
|
mingdeyu/DGP
|
fcc630896d45175d1aa72219607178ca7648cffb
|
[
"MIT"
] | 5
|
2021-09-21T02:16:58.000Z
|
2022-01-20T05:16:52.000Z
|
dgpsi/__init__.py
|
mingdeyu/DGP
|
fcc630896d45175d1aa72219607178ca7648cffb
|
[
"MIT"
] | 3
|
2021-07-19T13:54:38.000Z
|
2021-10-13T19:55:27.000Z
|
from .dgp import dgp
from .emulation import emulator
from .kernel_class import kernel, combine
from .likelihood_class import Poisson, Hetero, NegBin
from .lgp import lgp
from .synthetic import path
| 24.875
| 53
| 0.81407
| 29
| 199
| 5.517241
| 0.517241
| 0.1375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.140704
| 199
| 7
| 54
| 28.428571
| 0.935673
| 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
| 1
| 0
|
0
| 5
|
179cd9ff6d22bd0ff4de449e6188424feb4113bf
| 3,025
|
py
|
Python
|
v0/aia_eis_v0/ml_sl/knn/distance_pack/standardized_euclidean.py
|
DreamBoatOve/aia_eis
|
458b4d29846669b10db4da1b3e86c0b394614ceb
|
[
"MIT"
] | 1
|
2022-03-02T12:57:19.000Z
|
2022-03-02T12:57:19.000Z
|
v0/aia_eis_v0/ml_sl/knn/distance_pack/standardized_euclidean.py
|
DreamBoatOve/aia_eis
|
458b4d29846669b10db4da1b3e86c0b394614ceb
|
[
"MIT"
] | null | null | null |
v0/aia_eis_v0/ml_sl/knn/distance_pack/standardized_euclidean.py
|
DreamBoatOve/aia_eis
|
458b4d29846669b10db4da1b3e86c0b394614ceb
|
[
"MIT"
] | null | null | null |
import math
from ml_sl.knn.distance_pack.data_wrapper import single_point_list_2_list, pack_list_2_list
def standardized_euclidean_distance_0(x_list, data_list):
"""
:param
x_list:
[(x0, y0), (x1, y1), (x2, y2), ..., (xn-2, yn-2), (xn-1, yn-1)]
data_list:
[x_list_0 (same data structure as x_list), x_list_1, x_list_2, ..., x_list_n-2, x_list_n-1]
:return:
sed_list
measure distance between numbers
"""
sed_list = []
x_list = single_point_list_2_list(x_list)
data_list = pack_list_2_list(data_list)
col_standard_variance_list = []
for col_index in range(len(data_list[0])):
col_list = [d_list[col_index] for d_list in data_list]
col_avg = sum(col_list) / len(col_list)
col_standard_variance = math.sqrt(sum([(col - col_avg) ** 2 for col in col_list]) / len(col_list))
col_standard_variance_list.append(col_standard_variance)
for d_list in data_list:
sed = math.sqrt(sum([((d - x) / col_sv) ** 2 for d, x, col_sv in zip(d_list, x_list, col_standard_variance_list)]))
sed_list.append(sed)
return sed_list
# if __name__ == '__main__':
# x_list = [(1,1)]
# data_list = [[(1, 1)],
# [(1, 2)],
# [(2, 1)]]
# sed_list = standardized_euclidean_distance_0(x_list, data_list)
# print('sed 0', sed_list)
def standardized_euclidean_distance_1(x_list, data_list):
"""
:param
x_list:
[(x0, y0), (x1, y1), (x2, y2), ..., (xn-2, yn-2), (xn-1, yn-1)]
data_list:
[x_list_0 (same data structure as x_list), x_list_1, x_list_2, ..., x_list_n-2, x_list_n-1]
:return:
sed_list
measure distance between points
"""
sed_list = []
data_num_list = pack_list_2_list(data_list)
col_standard_variance_list = []
for col_index in range(len(data_num_list[0])):
col_list = [d_list[col_index] for d_list in data_num_list]
col_avg = sum(col_list) / len(col_list)
col_standard_variance = math.sqrt(sum([(col - col_avg) ** 2 for col in col_list]) / len(col_list))
col_standard_variance_list.append(col_standard_variance)
for d_list in data_list:
col_index_count = 0
sed = 0.0
for x_coor, d_coor in zip(x_list, d_list):
col_standard_variance_pair = col_standard_variance_list[col_index_count : col_index_count + 2]
col_index_count += 2
sed += math.sqrt(sum([((d - x) / col_sv) ** 2 for d, x, col_sv in zip(d_coor, x_coor, col_standard_variance_pair)]))
sed_list.append(sed)
return sed_list
if __name__ == '__main__':
x_list = [(1, 1), (2, 2)]
data_list = [[(1, 1), (2, 2)],
[(1, 2), (2, 2)],
[(1, 1), (3, 2)],
[(2, 1), (2, 2)],
[(2, 1), (2, 3)],
[(1, 1), (2, 3)]]
sed_list = standardized_euclidean_distance_1(x_list, data_list)
print('sed 1', sed_list)
| 37.8125
| 128
| 0.593719
| 477
| 3,025
| 3.368973
| 0.132075
| 0.074673
| 0.141879
| 0.114499
| 0.810205
| 0.737399
| 0.727442
| 0.716864
| 0.626011
| 0.626011
| 0
| 0.039783
| 0.26876
| 3,025
| 80
| 129
| 37.8125
| 0.686709
| 0.252231
| 0
| 0.363636
| 0
| 0
| 0.005991
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.045455
| false
| 0
| 0.045455
| 0
| 0.136364
| 0.022727
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 5
|
17a491a06f41d1469b5c33231ba54aa7fd9d5aa4
| 634
|
py
|
Python
|
nssrc/com/citrix/netscaler/nitro/resource/config/tm/__init__.py
|
benfinke/ns_python
|
d651d7aa01d7dc63c1cd435c7b3314d7f5b26659
|
[
"Apache-2.0"
] | 2
|
2020-08-24T18:04:22.000Z
|
2020-08-24T18:04:47.000Z
|
nssrc/com/citrix/netscaler/nitro/resource/config/tm/__init__.py
|
benfinke/ns_python
|
d651d7aa01d7dc63c1cd435c7b3314d7f5b26659
|
[
"Apache-2.0"
] | 1
|
2017-01-20T22:56:58.000Z
|
2017-01-20T22:56:58.000Z
|
nssrc/com/citrix/netscaler/nitro/resource/config/tm/__init__.py
|
benfinke/ns_python
|
d651d7aa01d7dc63c1cd435c7b3314d7f5b26659
|
[
"Apache-2.0"
] | 6
|
2015-04-21T13:14:08.000Z
|
2020-12-03T07:27:52.000Z
|
__all__ = ['tmformssoaction', 'tmglobal_auditnslogpolicy_binding', 'tmglobal_auditsyslogpolicy_binding', 'tmglobal_binding', 'tmglobal_tmsessionpolicy_binding', 'tmglobal_tmtrafficpolicy_binding', 'tmsamlssoprofile', 'tmsessionaction', 'tmsessionparameter', 'tmsessionpolicy', 'tmsessionpolicy_aaagroup_binding', 'tmsessionpolicy_aaauser_binding', 'tmsessionpolicy_authenticationvserver_binding', 'tmsessionpolicy_binding', 'tmsessionpolicy_tmglobal_binding', 'tmtrafficaction', 'tmtrafficpolicy', 'tmtrafficpolicy_binding', 'tmtrafficpolicy_csvserver_binding', 'tmtrafficpolicy_lbvserver_binding', 'tmtrafficpolicy_tmglobal_binding']
| 634
| 634
| 0.862776
| 47
| 634
| 11.021277
| 0.361702
| 0.11583
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0347
| 634
| 1
| 634
| 634
| 0.846405
| 0
| 0
| 0
| 0
| 0
| 0.850394
| 0.653543
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
bdb31572cfbb881d25e67fcf89561d00f437920b
| 10,659
|
py
|
Python
|
openrasp_iast/test/modules/monitor/test_monitor.py
|
r3aker/iast
|
52e5689c371c29db6e18233be5597093c378774d
|
[
"Apache-2.0"
] | null | null | null |
openrasp_iast/test/modules/monitor/test_monitor.py
|
r3aker/iast
|
52e5689c371c29db6e18233be5597093c378774d
|
[
"Apache-2.0"
] | null | null | null |
openrasp_iast/test/modules/monitor/test_monitor.py
|
r3aker/iast
|
52e5689c371c29db6e18233be5597093c378774d
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
Copyright 2017-2019 Baidu Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import json
import time
import pytest
import helper
from core.components.config import Config
from core.components.communicator import Communicator
# http_data = {
# "invalid": {
# "json": "Test"
# },
# "start_scanner_0": {
# "host": "127.0.0.1",
# "port": 8005,
# "auth_plugin": "default",
# "scan_plugin_list": []
# },
# "start_scanner_1": {
# "host": "127.0.0.1",
# "port": 8006,
# "auth_plugin": "default",
# "scan_plugin_list": []
# },
# "start_scanner_2": {
# "host": "127.0.0.1",
# "port": 8007,
# "auth_plugin": "default",
# "scan_plugin_list": []
# },
# "kill_scanner_0": {
# "scanner_id": 0
# },
# "kill_scanner_1": {
# "scanner_id": 1
# },
# "clean_target_0": {
# "host": "127.0.0.1",
# "port": 8005,
# },
# "clean_target_1": {
# "host": "127.0.0.1",
# "port": 8006,
# },
# "get_report": {
# "host": "127.0.0.1",
# "port": 8006,
# "page": 1,
# "perpage": 10
# }
# }
# http_sender = helper.HttpSender(
# "127.0.0.1", Config().get_config("monitor.console_port"))
# def test_http_server_run(monitor_fixture):
# """
# 测试monitor http server正常启动
# """
# r = http_sender.test_connect("/api/model/get_report")
# assert r.status_code == 405
# def test_send_invalid_data(monitor_fixture):
# """
# 测试json格式校验失败
# """
# json_data = http_data["invalid"]
# try:
# status_code = http_sender.send_data(
# json_data, "/api/model/get_report").status_code
# except Exception as e:
# assert False
# else:
# assert status_code == 415
# def test_cpu(monitor_fixture):
# monitor_fixture["set_system_info"](1, 2)
# def test_start_scanner(monitor_fixture):
# """
# 测试启动scanner
# """
# data = http_data["start_scanner_0"]
# path = "/api/scanner/new"
# # 启动第1个scanner
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 0
# # 目标已被scanner_1扫描
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 3
# data = http_data["start_scanner_1"]
# # 启动第2个scanner
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 0
# data = http_data["start_scanner_2"]
# # scanner数量达到上限
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 2
# data = http_data["invalid"]
# # 启动参数格式错误
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 1
# time.sleep(2)
# # 验证启动结果
# data = {}
# path = "/api/model/get_all"
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 0
# data = json.loads(r.text)
# assert data["data"]["total"] == 2
# def test_scheduler(monitor_fixture):
# max_cr_last = Communicator().get_value("max_concurrent_request", "Scanner_0")
# for i in range(5):
# Communicator().add_value("send_request", "Scanner_0", 30)
# time.sleep(Config().get_config("monitor.schedule_interval") * 1.5)
# max_cr = Communicator().get_value("max_concurrent_request", "Scanner_0")
# assert max_cr > max_cr_last or max_cr == Config(
# ).get_config("scanner.max_concurrent_request")
# max_cr_last = max_cr
# assert max_cr_last == 5
# for i in range(20):
# Communicator().add_value("send_request", "Scanner_0", 30)
# Communicator().add_value("failed_request", "Scanner_0", 1)
# time.sleep(Config().get_config("monitor.schedule_interval") * 1.5)
# max_cr = Communicator().get_value("max_concurrent_request", "Scanner_0")
# ri = Communicator().get_value("request_interval", "Scanner_0")
# assert max_cr < max_cr_last or max_cr == 1 or ri <= 256
# max_cr_last = max_cr
# assert max_cr_last == 1
# for i in range(50):
# Communicator().add_value("send_request", "Scanner_0", 30)
# time.sleep(Config().get_config("monitor.schedule_interval") * 1.5)
# max_cr = Communicator().get_value("max_concurrent_request", "Scanner_0")
# ri = Communicator().get_value("request_interval", "Scanner_0")
# assert max_cr == 1
# for i in range(50):
# Communicator().add_value("send_request", "Scanner_0", 30)
# time.sleep(Config().get_config("monitor.schedule_interval") * 1.5)
# max_cr = Communicator().get_value("max_concurrent_request", "Scanner_0")
# ri = Communicator().get_value("request_interval", "Scanner_0")
# if max_cr > 1:
# break
# assert max_cr > 1
# def test_kill_scanner_0(monitor_fixture):
# data = http_data["invalid"]
# path = "/api/scanner/kill"
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 1
# data = http_data["kill_scanner_0"]
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 0
# canceled = False
# for i in range(20):
# data = {}
# path = "/api/model/get_all"
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# data = json.loads(r.text)
# for item in data["data"]["result"]:
# if item["host"] == "127.0.0.1" and item["port"] == 8005:
# if id not in item:
# canceled = True
# break
# else:
# time.sleep(2)
# assert canceled
# # 测试cancel 不存在的scanner
# data = http_data["kill_scanner_0"]
# path = "/api/scanner/kill"
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 2
# def test_clean_target(monitor_fixture):
# data = http_data["invalid"]
# path = "/api/model/clean_target"
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 1
# data = http_data["clean_target_0"]
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 0
# data = http_data["clean_target_1"]
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 2
# def test_get_all_target(monitor_fixture):
# data = {}
# path = "/api/model/get_all"
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# ret = json.loads(r.text)
# assert ret["status"] == 0
# assert ret["data"]["total"] == 1
# def test_get_report(monitor_fixture):
# sql = """INSERT INTO `ori`.`127.0.0.1_8006_Report` VALUES (1, 'test', '123abcd', '{\"request_id\": \"php1\", \"scan_request_id\": \"\", \"web_server\": {\"host\": \"127.0.0.1\", \"port\": 8005}, \"context\": {\"json\": {}, \"server\": {\"language\": \"php\", \"name\": \"PHP\", \"version\": \"7.2.19\", \"os\": \"Linux\"}, \"body\": \"\", \"appBasePath\": \"/var/www/html\", \"remoteAddr\": \"172.17.0.1\", \"protocol\": \"http\", \"method\": \"get\", \"querystring\": \"url=http://192.168.154.200.xip.io\", \"path\": \"/011-ssrf-curl.php\", \"parameter\": {\"url\": [\"http://192.168.154.200.xip.io\"]}, \"header\": {\"host\": \"127.0.0.1:8005\", \"connection\": \"keep-alive\", \"upgrade-insecure-requests\": \"1\", \"dnt\": \"1\", \"user-agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36\", \"accept\": \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3\", \"referer\": \"http://127.0.0.1:8005/011-ssrf-curl.php\", \"accept-encoding\": \"gzip, deflate, br\", \"accept-language\": \"zh-CN,zh;q=0.9\"}, \"url\": \"http://127.0.0.1:8005/011-ssrf-curl.php?url=http://192.168.154.200.xip.io\"}, \"hook_info\": []}', 'payload_seq', 'test msg', 1, 0);"""
# helper.execute_sql(sql)
# data = http_data["invalid"]
# path = "/api/model/get_report"
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 1
# data = http_data["get_report"]
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# ret = json.loads(r.text)
# assert ret["status"] == 0
# assert ret["data"]["total"] == 1
# def test_kill_scanner(monitor_fixture):
# data = http_data["invalid"]
# path = "/api/scanner/kill"
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 1
# data = http_data["kill_scanner_1"]
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# data = {}
# path = "/api/model/get_all"
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 0
# data = json.loads(r.text)
# for item in data["data"]["result"]:
# if item["host"] == "127.0.0.1" and item["port"] == 8006:
# assert id not in item
# data = http_data["kill_scanner_1"]
# path = "/api/scanner/kill"
# r = http_sender.send_json(data, path)
# assert r.status_code == 200
# status = json.loads(r.text)["status"]
# assert status == 2
| 33.624606
| 1,309
| 0.590487
| 1,423
| 10,659
| 4.231904
| 0.189037
| 0.039854
| 0.038359
| 0.059283
| 0.625208
| 0.59648
| 0.581036
| 0.56908
| 0.508801
| 0.49917
| 0
| 0.050298
| 0.229665
| 10,659
| 316
| 1,310
| 33.731013
| 0.683108
| 0.93414
| 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
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
bdc22b4768c02eac289a6afb4eb5c2acdc51c1a1
| 333
|
py
|
Python
|
rasterio/warnings.py
|
rouault/rasterio
|
0b101b0414a575b263dcebefb0775b672f07cdeb
|
[
"BSD-3-Clause"
] | null | null | null |
rasterio/warnings.py
|
rouault/rasterio
|
0b101b0414a575b263dcebefb0775b672f07cdeb
|
[
"BSD-3-Clause"
] | null | null | null |
rasterio/warnings.py
|
rouault/rasterio
|
0b101b0414a575b263dcebefb0775b672f07cdeb
|
[
"BSD-3-Clause"
] | 1
|
2017-10-16T12:50:16.000Z
|
2017-10-16T12:50:16.000Z
|
"""Rasterio warnings."""
class NodataShadowWarning(Warning):
"""Warn that a dataset's nodata attribute is shadowing its alpha band"""
def __str__(self):
return ("The dataset's nodata attribute is shadowing "
"the alpha band. All masks will be determined "
"by the nodata attribute")
| 33.3
| 76
| 0.645646
| 40
| 333
| 5.275
| 0.7
| 0.21327
| 0.132701
| 0.218009
| 0.322275
| 0.322275
| 0
| 0
| 0
| 0
| 0
| 0
| 0.264264
| 333
| 9
| 77
| 37
| 0.861224
| 0.255255
| 0
| 0
| 0
| 0
| 0.472574
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0
| 0.2
| 0.6
| 0
| 0
| 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
| 1
| 1
| 0
|
0
| 5
|
bdcfe285ffc7f58c1dbed78656f58b819aac99dc
| 149
|
py
|
Python
|
lightlabel/__init__.py
|
smilelight/lightLabel
|
18aeaf49e1aba7c8857f6182e52f9418651d15dc
|
[
"Apache-2.0"
] | 3
|
2020-02-21T10:55:20.000Z
|
2021-03-31T18:12:20.000Z
|
lightlabel/__init__.py
|
smilelight/lightLabel
|
18aeaf49e1aba7c8857f6182e52f9418651d15dc
|
[
"Apache-2.0"
] | null | null | null |
lightlabel/__init__.py
|
smilelight/lightLabel
|
18aeaf49e1aba7c8857f6182e52f9418651d15dc
|
[
"Apache-2.0"
] | 4
|
2020-02-27T12:24:38.000Z
|
2021-07-09T08:33:17.000Z
|
from .projects import TextClassification
from .web import Engine
from .tasks import BaseTask
from .plan import Plan
from .db import DataBase, MongoDB
| 29.8
| 40
| 0.825503
| 21
| 149
| 5.857143
| 0.571429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.134228
| 149
| 5
| 41
| 29.8
| 0.953488
| 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
| 1
| 0
|
0
| 5
|
bdede389776cd04d9659cc9e720ca2fc2c48a3ad
| 658
|
py
|
Python
|
lib/gii/qt/controls/GraphicsView/GraphNodeItemBase.py
|
tommo/gii
|
03624a57cf74a07e38bfdc7f53c50bd926b7b5a7
|
[
"MIT"
] | 7
|
2016-02-13T18:47:23.000Z
|
2020-07-03T13:47:49.000Z
|
lib/gii/qt/controls/GraphicsView/GraphNodeItemBase.py
|
tommo/gii
|
03624a57cf74a07e38bfdc7f53c50bd926b7b5a7
|
[
"MIT"
] | 1
|
2018-06-13T04:55:27.000Z
|
2021-11-05T05:52:51.000Z
|
lib/gii/qt/controls/GraphicsView/GraphNodeItemBase.py
|
tommo/gii
|
03624a57cf74a07e38bfdc7f53c50bd926b7b5a7
|
[
"MIT"
] | 4
|
2016-02-15T13:32:46.000Z
|
2019-12-12T17:22:31.000Z
|
# -*- coding: utf-8 -*-
from PyQt4 import QtGui, QtCore, QtOpenGL, uic
from PyQt4.QtCore import Qt, QObject, QEvent, pyqtSignal
from PyQt4.QtCore import QPoint, QRect, QSize
from PyQt4.QtCore import QPointF, QRectF, QSizeF
from PyQt4.QtGui import QColor, QTransform
from GraphicsViewHelper import *
import sys
import math
##----------------------------------------------------------------##
class GraphNodeItemBase():
def isGroup( self ):
return False
def initGraphNode( self ):
pass
def acceptConnection( self, conn ):
return False
def createConnection( self, **options ):
return None
if __name__ == '__main__':
import TestGraphView
| 20.5625
| 68
| 0.667173
| 73
| 658
| 5.90411
| 0.589041
| 0.104408
| 0.104408
| 0.146172
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010791
| 0.155015
| 658
| 32
| 69
| 20.5625
| 0.764388
| 0.129179
| 0
| 0.105263
| 0
| 0
| 0.014085
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.210526
| false
| 0.052632
| 0.473684
| 0.157895
| 0.894737
| 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
| 1
| 1
| 1
| 0
|
0
| 5
|
bdf4044c22db48bbf8dc221a396a025970209892
| 96
|
py
|
Python
|
venv/lib/python3.8/site-packages/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/concrete.py
|
GiulianaPola/select_repeats
|
17a0d053d4f874e42cf654dd142168c2ec8fbd11
|
[
"MIT"
] | 2
|
2022-03-13T01:58:52.000Z
|
2022-03-31T06:07:54.000Z
|
venv/lib/python3.8/site-packages/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/concrete.py
|
DesmoSearch/Desmobot
|
b70b45df3485351f471080deb5c785c4bc5c4beb
|
[
"MIT"
] | 19
|
2021-11-20T04:09:18.000Z
|
2022-03-23T15:05:55.000Z
|
venv/lib/python3.8/site-packages/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/concrete.py
|
DesmoSearch/Desmobot
|
b70b45df3485351f471080deb5c785c4bc5c4beb
|
[
"MIT"
] | null | null | null |
/home/runner/.cache/pip/pool/2b/61/ce/134461b82d0cccd3877da946bbad75d3b5a7280f4fbabde1dd22d03cb2
| 96
| 96
| 0.895833
| 9
| 96
| 9.555556
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.354167
| 0
| 96
| 1
| 96
| 96
| 0.541667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
da4774b6df5dd36eeb0944b62372c624ea4d58b4
| 186
|
py
|
Python
|
RaspberryPi/server/__init__.py
|
Ernstsen/RC-car
|
eda8ec6ae28686380c06f442c889ea89a077315b
|
[
"MIT"
] | null | null | null |
RaspberryPi/server/__init__.py
|
Ernstsen/RC-car
|
eda8ec6ae28686380c06f442c889ea89a077315b
|
[
"MIT"
] | 3
|
2021-03-23T15:13:14.000Z
|
2021-03-23T16:15:20.000Z
|
RaspberryPi/server/__init__.py
|
Ernstsen/RC-car
|
eda8ec6ae28686380c06f442c889ea89a077315b
|
[
"MIT"
] | null | null | null |
from .command_handler import CommandHandler
from .dict_command_handler import DictCommandHandler
from .server import Server
__all__ = ["Server", "CommandHandler", "DictCommandHandler"]
| 31
| 60
| 0.827957
| 19
| 186
| 7.736842
| 0.473684
| 0.190476
| 0.272109
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.096774
| 186
| 5
| 61
| 37.2
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0.204301
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.75
| 0
| 0.75
| 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
| 1
| 0
|
0
| 5
|
e50803d209375afc165657fa3d47f0c661dbe84e
| 152
|
py
|
Python
|
plotly/validators/layout/geo/projection/__init__.py
|
gnestor/plotly.py
|
a8ae062795ddbf9867b8578fe6d9e244948c15ff
|
[
"MIT"
] | 12
|
2020-04-18T18:10:22.000Z
|
2021-12-06T10:11:15.000Z
|
plotly/validators/layout/geo/projection/__init__.py
|
gnestor/plotly.py
|
a8ae062795ddbf9867b8578fe6d9e244948c15ff
|
[
"MIT"
] | 27
|
2020-04-28T21:23:12.000Z
|
2021-06-25T15:36:38.000Z
|
plotly/validators/layout/geo/projection/__init__.py
|
gnestor/plotly.py
|
a8ae062795ddbf9867b8578fe6d9e244948c15ff
|
[
"MIT"
] | 6
|
2020-04-18T23:07:08.000Z
|
2021-11-18T07:53:06.000Z
|
from ._type import TypeValidator
from ._scale import ScaleValidator
from ._rotation import RotationValidator
from ._parallels import ParallelsValidator
| 30.4
| 42
| 0.868421
| 16
| 152
| 8
| 0.625
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 152
| 4
| 43
| 38
| 0.941176
| 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
| 1
| 0
|
0
| 5
|
e5150ce99a08ca80692dcebf32b1b2401f01e618
| 48
|
py
|
Python
|
products/__init__.py
|
stephane-lucienvauthier/foodstock-api
|
6b886cd638b5f1a10774280845bc85fd37a6ca9d
|
[
"Apache-2.0"
] | null | null | null |
products/__init__.py
|
stephane-lucienvauthier/foodstock-api
|
6b886cd638b5f1a10774280845bc85fd37a6ca9d
|
[
"Apache-2.0"
] | null | null | null |
products/__init__.py
|
stephane-lucienvauthier/foodstock-api
|
6b886cd638b5f1a10774280845bc85fd37a6ca9d
|
[
"Apache-2.0"
] | null | null | null |
"""This module initializes the products app."""
| 24
| 47
| 0.729167
| 6
| 48
| 5.833333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125
| 48
| 1
| 48
| 48
| 0.833333
| 0.854167
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
e540c26ed89a2af7c925fa9b329619321c050b95
| 1,260
|
py
|
Python
|
app/tests/view_test.py
|
hkawinzi/news-highlight
|
9f5c022fe1de6273725407606589ed218e77d4df
|
[
"Unlicense"
] | null | null | null |
app/tests/view_test.py
|
hkawinzi/news-highlight
|
9f5c022fe1de6273725407606589ed218e77d4df
|
[
"Unlicense"
] | 1
|
2021-06-02T00:20:54.000Z
|
2021-06-02T00:20:54.000Z
|
app/tests/view_test.py
|
hkawinzi/news-highlight
|
9f5c022fe1de6273725407606589ed218e77d4df
|
[
"Unlicense"
] | null | null | null |
import unittest
from app.models import view
class NewsTest(unittest.TestCase):
'''
Test Class to test the behaviour of the News class
'''
def setUp(self):
'''
Set up method that will run before every Test
'''
self.new_view = View('Cointelegraph By Aaron Wood','Crypto and Blockchain Adoption Grows: 5 Important Developments Sept. 2–8','Adoption is critical for the success of the blockchain and cryptocurrency industries. Here are five examples of developments that could spur adoption from last week','https://cointelegraph.com/news/crypto-and-blockchain-adoption-grows-5-important-developments-sept-28','https://images.cointelegraph.com/images/740_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy8wMzYyZDU2NTQxN2JjNmY0ZmQyMzk0MGM0Y2VmYTlkNC5qcGc=.jpg','2019-09-09T01:49:00Z','Analysts have long predicted that the increased participation of governments and institutional players in the blockchain and cryptocurrency space shows how the respective industries are maturing. The founder of crypto merchant bank Galaxy Digital, Michael Nov… [+3146 chars]')
def test_instance(self):
self.assertTrue(isinstance(self.new_view,View))
if __name__ == '__main__':
unittest.main()
| 54.782609
| 871
| 0.771429
| 160
| 1,260
| 6.025
| 0.625
| 0.010373
| 0.022822
| 0.03112
| 0.120332
| 0.120332
| 0.120332
| 0.120332
| 0.120332
| 0
| 0
| 0.041045
| 0.149206
| 1,260
| 22
| 872
| 57.272727
| 0.854478
| 0.07619
| 0
| 0
| 0
| 0.333333
| 0.738201
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 1
| 0.222222
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
e54808140a29d63d791d1336648e8990b8b482ff
| 135
|
py
|
Python
|
pyrobomogen/pub_sub/__init__.py
|
virtual-origami/pyrobomogen
|
30cd4e854704b0297142d7f817dabe08c9cbbd2e
|
[
"MIT"
] | null | null | null |
pyrobomogen/pub_sub/__init__.py
|
virtual-origami/pyrobomogen
|
30cd4e854704b0297142d7f817dabe08c9cbbd2e
|
[
"MIT"
] | 2
|
2021-04-08T17:23:00.000Z
|
2021-12-11T11:58:18.000Z
|
pywalkgen/pub_sub/__init__.py
|
virtual-origami/pywalkgen
|
e860b8fb327aa6ceb05849f610855657f917a1ea
|
[
"MIT"
] | null | null | null |
from __future__ import generator_stop
from __future__ import annotations
from .AMQP import PubSubAMQP
__all__ = [
'PubSubAMQP'
]
| 15
| 37
| 0.785185
| 15
| 135
| 6.2
| 0.6
| 0.215054
| 0.344086
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.17037
| 135
| 8
| 38
| 16.875
| 0.830357
| 0
| 0
| 0
| 0
| 0
| 0.074074
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 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
| 1
| 0
| 0
| 0
|
0
| 5
|
e5a0a36f28634cc9e7647d0745be65d74d11c518
| 20
|
py
|
Python
|
__version__.py
|
SeanHildreth/pygeocoder
|
6e3c7f098f450e222acb65c011089c74c25432f4
|
[
"BSD-3-Clause"
] | 5
|
2015-06-29T22:15:10.000Z
|
2019-08-02T00:45:49.000Z
|
__version__.py
|
SeanHildreth/pygeocoder
|
6e3c7f098f450e222acb65c011089c74c25432f4
|
[
"BSD-3-Clause"
] | null | null | null |
__version__.py
|
SeanHildreth/pygeocoder
|
6e3c7f098f450e222acb65c011089c74c25432f4
|
[
"BSD-3-Clause"
] | 5
|
2015-06-09T05:56:54.000Z
|
2020-04-04T15:15:45.000Z
|
VERSION = '1.2.0.1'
| 10
| 19
| 0.55
| 5
| 20
| 2.2
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.235294
| 0.15
| 20
| 1
| 20
| 20
| 0.411765
| 0
| 0
| 0
| 0
| 0
| 0.35
| 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
| 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
| 5
|
e5b2e546b2e2f2fd05f5353ce58197dd4d24acd1
| 79
|
py
|
Python
|
user/models/__init__.py
|
ThePokerFaCcCe/messenger
|
2db3d5c2ccd05ac40d2442a13d664ca9ad3cb14c
|
[
"MIT"
] | null | null | null |
user/models/__init__.py
|
ThePokerFaCcCe/messenger
|
2db3d5c2ccd05ac40d2442a13d664ca9ad3cb14c
|
[
"MIT"
] | null | null | null |
user/models/__init__.py
|
ThePokerFaCcCe/messenger
|
2db3d5c2ccd05ac40d2442a13d664ca9ad3cb14c
|
[
"MIT"
] | null | null | null |
from .user import User
from .device import Device
from .contact import Contact
| 19.75
| 28
| 0.810127
| 12
| 79
| 5.333333
| 0.416667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.151899
| 79
| 3
| 29
| 26.333333
| 0.955224
| 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
| 1
| 0
|
0
| 5
|
e5e2f4b0778f649eb7126c0145e07d7c95941260
| 40
|
py
|
Python
|
modules/2.79/bpy/types/SequenceColorBalance.py
|
cmbasnett/fake-bpy-module
|
acb8b0f102751a9563e5b5e5c7cd69a4e8aa2a55
|
[
"MIT"
] | null | null | null |
modules/2.79/bpy/types/SequenceColorBalance.py
|
cmbasnett/fake-bpy-module
|
acb8b0f102751a9563e5b5e5c7cd69a4e8aa2a55
|
[
"MIT"
] | null | null | null |
modules/2.79/bpy/types/SequenceColorBalance.py
|
cmbasnett/fake-bpy-module
|
acb8b0f102751a9563e5b5e5c7cd69a4e8aa2a55
|
[
"MIT"
] | null | null | null |
class SequenceColorBalance:
pass
| 6.666667
| 27
| 0.725
| 3
| 40
| 9.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.25
| 40
| 5
| 28
| 8
| 0.966667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
f91cd84a1f262de261dcb6072fe130629e385218
| 107
|
py
|
Python
|
Python/empire/ejson/__init__.py
|
Tombmyst/Empire
|
f28782787c5fa9127e353549b73ec90d3c82c003
|
[
"Apache-2.0"
] | null | null | null |
Python/empire/ejson/__init__.py
|
Tombmyst/Empire
|
f28782787c5fa9127e353549b73ec90d3c82c003
|
[
"Apache-2.0"
] | null | null | null |
Python/empire/ejson/__init__.py
|
Tombmyst/Empire
|
f28782787c5fa9127e353549b73ec90d3c82c003
|
[
"Apache-2.0"
] | null | null | null |
# TODO:
# JSON_FIND: ex: trouver tous les fields 'originalRecord.contactFirstName' où le length est <= 2
| 35.666667
| 98
| 0.738318
| 15
| 107
| 5.2
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011236
| 0.168224
| 107
| 2
| 99
| 53.5
| 0.865169
| 0.953271
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0.5
| 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
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
0066b1a4d10d61890a472cd46c8b86fdfd6791ae
| 10,755
|
py
|
Python
|
_modules/nexus3_blobstores.py
|
jsandas/saltstack-nexus3-module
|
e090dfe18cd3b5d90d1c71b0747ff150eb96e328
|
[
"MIT"
] | 1
|
2020-11-15T00:18:55.000Z
|
2020-11-15T00:18:55.000Z
|
_modules/nexus3_blobstores.py
|
jsandas/saltstack-nexus3-module
|
e090dfe18cd3b5d90d1c71b0747ff150eb96e328
|
[
"MIT"
] | 1
|
2020-11-21T19:08:07.000Z
|
2020-11-21T19:14:37.000Z
|
_modules/nexus3_blobstores.py
|
jsandas/saltstack-nexus3-module
|
e090dfe18cd3b5d90d1c71b0747ff150eb96e328
|
[
"MIT"
] | null | null | null |
''''
execution module for Nexus 3 blobstores
:version: v0.2.1
:configuration: In order to connect to Nexus 3, certain configuration is required
in /etc/salt/minion on the relevant minions.
Example:
nexus3:
hostname: '127.0.0.1:8081'
username: 'admin'
password: 'admin123'
'''
import json
import logging
import nexus3
log = logging.getLogger(__name__)
__outputter__ = {
"sls": "highstate",
"apply_": "highstate",
"highstate": "highstate",
}
blobstore_path = 'v1/blobstores'
def create(name,
quota_type=None,
quota_limit=1000000,
store_type='file',
s3_accessKeyId='',
s3_bucket='nexus3',
s3_endpoint='',
s3_expiration=3,
s3_forcePathStyle=False,
s3_prefix='',
s3_region='Default',
s3_secretAccessKey=''):
'''
name (str):
Name of blobstore
.. note::
The blobstore name is used for blobstore path.
quota_type (str):
Quota type [None|spaceRemainingQuota|spaceUsedQuota] (Default: None)
quota_limit (int):
Quota limit in bytes (Default: 1000000)
.. note::
The limit should be no less than 1000000 bytes (1 MB) otherwise
it does not display properly in the UI.
store_type (str):
Type of blobstore [file|s3] (Default: file)
s3_accessKeyId (str):
AWS Access Key for S3 bucket (Default: '')
s3_bucket (str):
Name of S3 bucket (Default: 'nexus3')
s3_endpoint (str):
custom URL for s3 api [http://localhost:9000] (Default: '')
.. note::
only required if using a s3 compatible service
s3_expiration (int):
days until deleted blobs are purged from bucket (Default: 3)
.. note::
set to -1 to disable
s3_forcePathStyle (bool):
force path style url format (Default: False)
.. note:
if using s3 compatible service like min.io, set this to True
s3_region (str):
Region of S3 bucket [us-east-1,us-east-2,us-west-1,us-west-2,etc] (Default: 'Default')
s3_secretAccessKey (str):
AWS Secret Access Key for S3 bucket (Default: '')
CLI Example::
.. code-block:: bash
salt myminion nexus3_blobstores.create name=myblobstore
salt myminion nexus3_blobstores.create name=myblobstore quota_type=spaceRemainingQuota spaceRemainingQuota=5000000
salt myminion nexus3_blobstores.create name=mys3blobstore store_type=s3 s3_bucket=nexus3 s3_accessKeyId=AKIAIOSFODNN7EXAMPLE s3_secretAccessKey=wJalrXUtnFEMIK7MDENGbPxRfiCYEXAMPLEKEY s3_endpoint=http://minio:9000 s3_forcePathStyle=True
'''
ret = {
'blobstore': {},
}
path = '{}/{}'.format(blobstore_path, store_type)
payload = {
'name': name,
}
if store_type == 'file':
payload['path'] = '/nexus-data/blobs/' + name
if store_type == 's3':
s3_config = {}
s3_config['bucket'] = {
'region': s3_region,
'name': s3_bucket,
'prefix': s3_prefix,
'expiration': s3_expiration
}
if s3_accessKeyId != '' or s3_secretAccessKey != '':
s3_config['bucketSecurity'] ={
'accessKeyId': s3_accessKeyId,
'secretAccessKey': s3_secretAccessKey,
# 'role': 'string',
# 'sessionToken': 'string'
}
# TODO: added encryption support
# "encryption": {
# 'encryptionType': 's3ManagedEncryption',
# 'encryptionKey': 'string'
# }
if s3_endpoint != '':
s3_config['advancedBucketConnection'] = {
'endpoint': s3_endpoint,
'signerType': 'DEFAULT',
'forcePathStyle': s3_forcePathStyle
}
payload['bucketConfiguration'] = s3_config
if quota_type is not None:
payload['softQuota'] = {
'type': quota_type,
'limit': quota_limit
}
nc = nexus3.NexusClient()
resp = nc.get(path + '/' + name)
if resp['status'] == 200:
ret['comment'] = 'blobstore {} already exists.'.format(name)
return ret
resp = nc.post(path, payload)
if resp['status'] in [201, 204]:
ret['blobstore'] = describe(name)['blobstore']
else:
ret['comment'] = 'could not create blobstore {}.'.format(name)
ret['error'] = {
'code': resp['status'],
'msg': resp['body']
}
return ret
def delete(name):
'''
name (str):
Name of blobstore
CLI Example::
.. code-block:: bash
salt myminion nexus3_blobstores.delete name=myblobstore
'''
ret = {
'comment': 'Deleted blobstore "{}"'.format(name)
}
path = '{}/{}'.format(blobstore_path, name)
nc = nexus3.NexusClient()
resp = nc.delete(path)
if resp['status'] == 404:
ret['comment'] = 'blobstore {} does not exist.'.format(name)
elif resp['status'] != 204:
ret['comment'] = 'could not delete blobstore {}.'.format(name)
ret['error'] = {
'code': resp['status'],
'msg': resp['body']
}
return ret
def describe(name):
'''
name (str):
Name of blobstore
CLI Example::
.. code-block:: bash
salt myminion nexus3_blobstores.describe name=myblobstore
'''
ret = {
'blobstore': {},
}
resp = list_all()
if 'error' in resp.keys():
ret['result'] = False
ret['comment'] = 'could not retrieve blobstore {}.'.format(name)
ret['error'] = resp['error']
return ret
for bstore in resp['blobstores']:
if bstore['name'] == name:
ret['blobstore'] = bstore
break
if ret['blobstore']:
path = '{}/{}/{}'.format(blobstore_path, ret['blobstore']['type'].lower(), name)
nc = nexus3.NexusClient()
resp = nc.get(path)
if resp['status'] == 200:
ret['blobstore'].update(json.loads(resp['body']))
else:
ret['comment'] = 'could not retrieve blobstore {}'.format(name)
ret['error'] = {
'code': resp['status'],
'msg': resp['body']
}
return ret
def list_all():
'''
CLI Example::
.. code-block:: bash
salt myminion nexus3_blobstores.list_all
'''
ret = {
'blobstores': {}
}
nc = nexus3.NexusClient()
resp = nc.get(blobstore_path)
if resp['status'] == 200:
ret['blobstores'] = json.loads(resp['body'])
else:
ret['comment'] = 'could not retrieve blobstores.'
ret['error'] = {
'code': resp['status'],
'msg': resp['body']
}
return ret
def update(name,
quota_type=None,
quota_limit=1000000,
s3_accessKeyId='',
s3_bucket='nexus3',
s3_endpoint='',
s3_expiration=3,
s3_forcePathStyle=False,
s3_prefix='',
s3_region='Default',
s3_secretAccessKey=''):
'''
name (str):
Name of blobstore
.. note::
The blobstore name is used for blobstore path.
quota_type (str):
Quota type [None|spaceRemainingQuota|spaceUsedQuota] (Default: None)
quota_limit (int):
Quota limit in bytes (Default: 1000000)
.. note::
The limit should be no less than 1000000 bytes (1 MB) otherwise
it does not display properly in the UI.
s3_accessKeyId (str):
AWS Access Key for S3 bucket (Default: '')
s3_bucket (str):
Name of S3 bucket (Default: 'nexus3')
s3_endpoint (str):
custom URL for s3 api [http://localhost:9000] (Default: '')
.. note::
only required if using a s3 compatible service
s3_expiration (int):
days until deleted blobs are purged from bucket (Default: 3)
.. note::
set to -1 to disable
s3_forcePathStyle (bool):
force path style url format (Default: False)
.. note:
if using s3 compatible service like min.io, set this to True
s3_region (str):
Region of S3 bucket [us-east-1,us-east-2,us-west-1,us-west-2,etc] (Default: 'Default')
s3_secretAccessKey (str):
AWS Secret Access Key for S3 bucket (Default: '')
CLI Example::
.. code-block:: bash
salt myminion nexus3_blobstores.update name=myblobstore quota_type=spaceRemainingQuota quota_limit=5000000
salt myminion nexus3_blobstores.update name=mys3blobstore s3_bucket=nexus3 s3_accessKeyId=AKIAIOSFODNN7EXAMPLE s3_secretAccessKey=wJalrXUtnFEMIK7MDENGbPxRfiCYEXAMPLEKEY s3_endpoint=http://minio:9000 s3_forcePathStyle=True
'''
ret = {
'blobstore': {}
}
metadata = describe(name)
if not metadata['blobstore']:
return metadata
payload = {
'name': name,
}
if metadata['blobstore']['type'].lower() == 'file':
payload['path'] = '/nexus-data/blobs/' + name
if metadata['blobstore']['type'].lower() == 's3':
s3_config = {}
s3_config['bucket'] = {
'region': s3_region,
'name': s3_bucket,
'prefix': s3_prefix,
'expiration': s3_expiration
}
if s3_accessKeyId != '' or s3_secretAccessKey != '':
s3_config['bucketSecurity'] ={
'accessKeyId': s3_accessKeyId,
'secretAccessKey': s3_secretAccessKey,
# 'role': 'string',
# 'sessionToken': 'string'
}
# TODO: added encryption support
# "encryption": {
# 'encryptionType': 's3ManagedEncryption',
# 'encryptionKey': 'string'
# }
if s3_endpoint != '':
s3_config['advancedBucketConnection'] = {
'endpoint': s3_endpoint,
'signerType': 'DEFAULT',
'forcePathStyle': s3_forcePathStyle
}
payload['bucketConfiguration'] = s3_config
if quota_type is not None:
payload['softQuota'] = {
'type': quota_type,
'limit': quota_limit
}
path = '{}/{}/{}'.format(blobstore_path, metadata['blobstore']['type'].lower(), name)
nc = nexus3.NexusClient()
resp = nc.put(path, payload)
if resp['status'] == 204:
ret['blobstore'] = describe(name)['blobstore']
else:
ret['comment'] = 'could not update blobstore {}.'.format(name)
ret['error'] = {
'code': resp['status'],
'msg': resp['body']
}
return ret
| 25.791367
| 243
| 0.559089
| 1,109
| 10,755
| 5.312895
| 0.173129
| 0.021724
| 0.02444
| 0.038018
| 0.806348
| 0.781738
| 0.730991
| 0.70095
| 0.68907
| 0.66446
| 0
| 0.033834
| 0.312971
| 10,755
| 416
| 244
| 25.853365
| 0.763567
| 0.390795
| 0
| 0.579787
| 0
| 0
| 0.197847
| 0.007829
| 0
| 0
| 0
| 0.004808
| 0
| 1
| 0.026596
| false
| 0
| 0.015957
| 0
| 0.085106
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 5
|
00743f4db17ecdf4faa38a1f410d8c5f93f80fa3
| 161
|
py
|
Python
|
surefire/encoders/identity.py
|
jasonkriss/surefire
|
55365939dbb4a7e41ec28fa40471a6c1e8dd23a1
|
[
"MIT"
] | null | null | null |
surefire/encoders/identity.py
|
jasonkriss/surefire
|
55365939dbb4a7e41ec28fa40471a6c1e8dd23a1
|
[
"MIT"
] | null | null | null |
surefire/encoders/identity.py
|
jasonkriss/surefire
|
55365939dbb4a7e41ec28fa40471a6c1e8dd23a1
|
[
"MIT"
] | null | null | null |
from surefire.encoders import Encoder
class IdentityEncoder(Encoder):
def forward(self, x):
return x
def num_features(self):
return 1
| 16.1
| 37
| 0.670807
| 20
| 161
| 5.35
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.008403
| 0.26087
| 161
| 9
| 38
| 17.888889
| 0.890756
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.166667
| 0.333333
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
00a5b7e0d83a59aaa0843c6fd5957ec822b9283c
| 149
|
py
|
Python
|
sets/admin.py
|
CASDON-MYSTERY/studentapp
|
0fd942e963a10a02a6c9f358dd362cfd646eecc3
|
[
"MIT"
] | null | null | null |
sets/admin.py
|
CASDON-MYSTERY/studentapp
|
0fd942e963a10a02a6c9f358dd362cfd646eecc3
|
[
"MIT"
] | null | null | null |
sets/admin.py
|
CASDON-MYSTERY/studentapp
|
0fd942e963a10a02a6c9f358dd362cfd646eecc3
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Set, Level
# Register your models here.
admin.site.register(Level)
admin.site.register(Set)
| 16.555556
| 32
| 0.778523
| 22
| 149
| 5.272727
| 0.545455
| 0.155172
| 0.293103
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.134228
| 149
| 9
| 33
| 16.555556
| 0.899225
| 0.174497
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
00a98a75c071d0e0f358aa8fedccf90461032a8f
| 239
|
py
|
Python
|
tests/unit/_modules/test_example.py
|
yagnik/saltstack-template
|
fe069f49e3d200f7c2849be45d065234db67a0f2
|
[
"Apache-2.0"
] | 9
|
2017-09-25T16:14:04.000Z
|
2021-12-12T19:27:09.000Z
|
tests/unit/_modules/test_example.py
|
yagnik/salt-template
|
fe069f49e3d200f7c2849be45d065234db67a0f2
|
[
"Apache-2.0"
] | 1
|
2017-07-10T09:07:24.000Z
|
2017-07-15T13:06:15.000Z
|
tests/unit/_modules/test_example.py
|
yagnik/saltstack-template
|
fe069f49e3d200f7c2849be45d065234db67a0f2
|
[
"Apache-2.0"
] | 1
|
2017-06-30T16:50:47.000Z
|
2017-06-30T16:50:47.000Z
|
from tests import TestMinion
class TestExample(TestMinion):
def test_func(self, __salt__):
assert __salt__['example.func']()
def util_func(self, __salt__):
assert __salt__['example.util_func']() == "I'm helping"
| 23.9
| 63
| 0.682008
| 29
| 239
| 4.965517
| 0.586207
| 0.111111
| 0.166667
| 0.25
| 0.402778
| 0.402778
| 0
| 0
| 0
| 0
| 0
| 0
| 0.192469
| 239
| 9
| 64
| 26.555556
| 0.746114
| 0
| 0
| 0
| 0
| 0
| 0.167364
| 0
| 0
| 0
| 0
| 0
| 0.333333
| 1
| 0.333333
| false
| 0
| 0.166667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
00db66d809e49450b985ebb0040ec7336da8723b
| 603,288
|
py
|
Python
|
Learning_Tensorflow/Advanced_Tensorflow/text/neural_machine_translation_attention.py
|
oke-aditya/Machine_Learning
|
3dd40ae2b9cba1890e7060448e75c14194b27775
|
[
"MIT"
] | 15
|
2019-11-16T11:09:24.000Z
|
2022-01-09T01:58:03.000Z
|
Learning_Tensorflow/Advanced_Tensorflow/text/neural_machine_translation_attention.py
|
oke-aditya/Machine_Learning
|
3dd40ae2b9cba1890e7060448e75c14194b27775
|
[
"MIT"
] | 1
|
2021-11-10T19:46:00.000Z
|
2021-11-10T19:46:00.000Z
|
Learning_Tensorflow/Advanced_Tensorflow/text/neural_machine_translation_attention.py
|
oke-aditya/Machine_Learning
|
3dd40ae2b9cba1890e7060448e75c14194b27775
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
"""Neural_Machine_Translation_Attention.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1f7uW5_n27jMXhZBpwll0eyHF543SVmRm
# Neural Machine Translation with Attention
- This uses seq2seq model.
- RNN based encoder. Again a RNN based decoder.
- We also have attention mechanism which focuses on words that are important.
"""
# Commented out IPython magic to ensure Python compatibility.
# %tensorflow_version 2.x
import tensorflow as tf
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from sklearn.model_selection import train_test_split
import unicodedata
import re
import numpy as np
import os
import io
import time
"""# Make Dataset
Download and prepare the dataset
We'll use a language dataset provided by http://www.manythings.org/anki/. This dataset contains language translation pairs in the format:
May I borrow this book? ¿Puedo tomar prestado este libro?
fter downloading the dataset, here are the steps we'll take to prepare the data:
- Add a start and end token to each sentence.
- Clean the sentences by removing special characters.
- Create a word index and reverse word index (dictionaries mapping from word → id and id → word).
- Pad each sentence to a maximum length.
"""
path_to_zip = tf.keras.utils.get_file('spa-eng.zip', origin='http://storage.googleapis.com/download.tensorflow.org/data/spa-eng.zip',
extract=True)
path_to_file = os.path.dirname(path_to_zip)+"/spa-eng/spa.txt"
print(path_to_file)
"""# Data Preprocessing"""
# Convert unicode file to ascii
def unicode_to_ascii(s):
return ''.join(c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn')
def preprocess_sentence(w):
w = unicode_to_ascii(w.lower().strip())
# creating a space between a word and the punctuation following it
# eg: "he is a boy." => "he is a boy ."
# Reference:- https://stackoverflow.com/questions/3645931/python-padding-punctuation-with-white-spaces-keeping-punctuation
w = re.sub(r"([?.!,¿])", r" \1 ", w)
w = re.sub(r'[" "]+', " ", w)
# replacing everything with space except (a-z, A-Z, ".", "?", "!", ",")
w = re.sub(r"[^a-zA-Z?.!,¿]+", " ", w)
w = w.strip()
# adding a start and an end token to the sentence
# so that the model know when to start and stop predicting.
w = '<start> ' + w + ' <end>'
return w
en_sentence = u"May I borrow this book ?"
sp_sentence = u"¿Puedo tomar prestado este libro?"
print(preprocess_sentence(en_sentence))
print(preprocess_sentence(sp_sentence).encode('utf-8'))
# 1. Remove the accents
# 2. Clean the sentences
# 3. Return word pairs in the format: [ENGLISH, SPANISH]
def create_dataset(path, num_examples):
lines = io.open(path, encoding='UTF-8').read().strip().split('\n')
word_pairs = [[preprocess_sentence(w) for w in l.split('\t')] for l in lines[:num_examples]]
return(zip(*word_pairs))
en, sp = create_dataset(path_to_file, None)
print(en[-1])
print(sp[-1])
def max_length(tensor):
return max(len(t) for t in tensor)
def tokenize(lang):
lang_tokenizer = tf.keras.preprocessing.text.Tokenizer(filters='')
lang_tokenizer.fit_on_texts(lang)
tensor = lang_tokenizer.texts_to_sequences(lang)
# print(tensor.shape)
tensor = tf.keras.preprocessing.sequence.pad_sequences(tensor, padding='post')
# print(tensor.shape)
return tensor, lang_tokenizer
def load_dataset(path, num_examples=None):
targ_lang, inp_lang = create_dataset(path, num_examples)
input_tensor, inp_lang_tokenizer = tokenize(inp_lang)
target_tensor, targ_lang_tokenizer = tokenize(targ_lang)
return input_tensor, target_tensor, inp_lang_tokenizer, targ_lang_tokenizer
"""Limit the size of the dataset to experiment faster (optional)
Training on the complete dataset of >100,000 sentences will take a long time. To train faster, we can limit the size of the dataset to 30,000 sentences (of course, translation quality degrades with less data):
"""
num_examples = 30000
input_tensor, target_tensor, inp_lang_tokenizer, targ_lang_tokenizer = load_dataset(path_to_file, num_examples=num_examples)
print(input_tensor.shape)
print(target_tensor.shape)
print(inp_lang_tokenized)
max_length_target = max_length(target_tensor)
max_length_inp = max_length(input_tensor)
print(max_length_target)
print(max_length_inp)
# Creating training and validation sets using an 80-20 split
input_tensor_train, input_tensor_val, target_tensor_train, target_tensor_val = train_test_split(input_tensor, target_tensor, test_size=0.2)
# Show length
print(len(input_tensor_train), len(target_tensor_train), len(input_tensor_val), len(target_tensor_val))
"""# Let's see after preprocessing
- Our aim should be converting the from these tokenized words from one language to other.
"""
def convert(lang, tensor):
for t in tensor:
if t != 0:
print("%d ------> %s" %(t, lang.index_word[t]))
print("Input Language: tokenized index")
convert(inp_lang_tokenizer, input_tensor_train[0])
print()
print("Target language: tokenized index")
convert(targ_lang_tokenizer, target_tensor_train[0])
"""# Create a tf.data Dataset object"""
BUFFER_SIZE = len(input_tensor_train)
BATCH_SIZE = 64
steps_per_epoch = len(input_tensor_train) // BATCH_SIZE
embedding_dim = 256
units = 1024
vocab_inp_size = len(inp_lang_tokenizer.word_index) + 1
vocab_tar_size = len(targ_lang_tokenizer.word_index) + 1
dataset = tf.data.Dataset.from_tensor_slices((input_tensor_train, target_tensor_train)).shuffle(BUFFER_SIZE).batch(BATCH_SIZE, drop_remainder=True)
example_input_batch, example_target_batch = next(iter(dataset))
example_input_batch.shape, example_target_batch.shape
"""# Time for enocder + decoder model
# Enocder
Implement an encoder-decoder model with attention which you can read about in the TensorFlow Neural Machine Translation (seq2seq) tutorial. This example uses a more recent set of APIs.
This notebook implements the attention equations from the seq2seq tutorial. The following diagram shows that each input words is assigned a weight by the attention mechanism which is then used by the decoder to predict the next word in the sentence.
The below picture and formulas are an example of attention mechanism from Luong's paper.

The input is put through an encoder model which gives us the encoder output of shape (batch_size, max_length, hidden_size) and the encoder hidden state of shape (batch_size, hidden_size).
Here are the equations that are implemented:

his tutorial uses Bahdanau attention for the encoder. Let's decide on notation before writing the simplified form:
FC = Fully connected (dense) layer
EO = Encoder output
H = hidden state
X = input to the decoder
And the pseudo-code:
score = FC(tanh(FC(EO) + FC(H)))
attention weights = softmax(score, axis = 1). Softmax by default is applied on the last axis but here we want to apply it on the 1st axis, since the shape of score is (batch_size, max_length, hidden_size). Max_length is the length of our input. Since we are trying to assign a weight to each input, softmax should be applied on that axis.
context vector = sum(attention weights * EO, axis = 1). Same reason as above for choosing axis as 1.
embedding output = The input to the decoder X is passed through an embedding layer.
merged vector = concat(embedding output, context vector)
This merged vector is then given to the GRU
The shapes of all the vectors at each step have been specified in the comments in the code:
"""
class Encoder(tf.keras.Model):
def __init__(self, vocab_size, embedding_dim, enc_units, batch_sz):
super().__init__()
self.batch_sz = batch_sz
self.enc_units = enc_units
self.embedding = tf.keras.layers.Embedding(vocab_size, embedding_dim)
self.gru = tf.keras.layers.GRU(self.enc_units, return_sequences=True, return_state=True, recurrent_initializer='glorot_uniform')
def call(self, x, hidden):
x = self.embedding(x)
output, state = self.gru(x, initial_state=hidden)
return output, state
def initialize_hidden_state(self):
return tf.zeros((self.batch_sz, self.enc_units))
encoder = Encoder(vocab_inp_size, embedding_dim, units, BATCH_SIZE)
sample_hidden = encoder.initialize_hidden_state()
sample_output, sample_hidden = encoder(example_input_batch, sample_hidden)
print ('Encoder output shape: (batch size, sequence length, units) {}'.format(sample_output.shape))
print ('Encoder Hidden state shape: (batch size, units) {}'.format(sample_hidden.shape))
print(example_input_batch.shape)
print(sample_hidden.shape)
print(vocab_inp_size)
print(vocab_tar_size)
"""# Adding Attention"""
class BahdanauAttention(tf.keras.layers.Layer):
def __init__(self, units):
super().__init__()
self.W1 = tf.keras.layers.Dense(units)
self.W2 = tf.keras.layers.Dense(units)
self.V = tf.keras.layers.Dense(1)
def call(self, query, values):
# query hidden state shape == (batch_size, hidden size)
# query_with_time_axis shape == (batch_size, 1, hidden size)
# values shape == (batch_size, max_len, hidden size)
# we are doing this to broadcast addition along the time axis to calculate the score
query_with_time_axis = tf.expand_dims(query, axis=1)
# score shape == (batch_size, max_length, 1)
# we get 1 at the last axis because we are applying score to self.V
# the shape of the tensor before applying self.V is (batch_size, max_length, units)
score = self.V(tf.nn.tanh(self.W1(query_with_time_axis) + self.W2(values)))
# attention_weights shape == (batch_size, max_length, 1)
attention_weights = tf.nn.softmax(score, axis=1)
# context_vector shape after sum == (batch_size, hidden_size)
context_vector = attention_weights * values
context_vector = tf.reduce_sum(context_vector, axis=1)
return context_vector, attention_weights
attention_layer = BahdanauAttention(10)
attention_result, attention_weights = attention_layer(sample_hidden, sample_output)
print("Attention result shape: (batch size, units) {}".format(attention_result.shape))
print("Attention weights shape: (batch_size, sequence_length, 1) {}".format(attention_weights.shape))
class Decoder(tf.keras.Model):
def __init__(self, vocab_size, embedding_dim, dec_units, batch_sz):
super().__init__()
self.batch_sz = batch_sz
self.dec_units = dec_units
self.embedding = tf.keras.layers.Embedding(vocab_size, embedding_dim)
self.gru = tf.keras.layers.GRU(self.dec_units, return_sequences=True, return_state=True, recurrent_initializer='glorot_uniform')
self.fc = tf.keras.layers.Dense(vocab_size)
self.attention = BahdanauAttention(self.dec_units)
def call(self, x, hidden, enc_output):
# enc_output shape == (batch_size, max_length, hidden_size)
context_vector, attention_weights = self.attention(hidden, enc_output)
# x shape after passing through embedding == (batch_size, 1, embedding_dim)
x = self.embedding(x)
# x shape after concatenation == (batch_size, 1, embedding_dim + hidden_size)
x = tf.concat([tf.expand_dims(context_vector, 1), x], axis=-1)
# passing the concatenated vector to the GRU
output, state = self.gru(x)
# output shape == (batch_size * 1, hidden_size)
output = tf.reshape(output, (-1, output.shape[2]))
# output shape == (batch_size, vocab)
x = self.fc(output)
return x, state, attention_weights
decoder = Decoder(vocab_tar_size, embedding_dim, units, BATCH_SIZE)
sample_decoder_output, _, _ = decoder(tf.random.uniform((BATCH_SIZE, 1)),sample_hidden, sample_output)
print ('Decoder output shape: (batch_size, vocab size) {}'.format(sample_decoder_output.shape))
"""# Configure optimizer, loss fn and train"""
optimizer = tf.keras.optimizers.Adam()
loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True, reduction='none')
def loss_function(real, pred):
mask = tf.math.logical_not(tf.math.equal(real, 0))
loss_ = loss(real, pred)
mask = tf.cast(mask, dtype=loss_.dtype)
loss_ *= mask
return tf.reduce_mean(loss_)
checkpoint_dir = './training_checkpoints'
checkpoint_prefix = os.path.join(checkpoint_dir, "ckpt")
checkpoint = tf.train.Checkpoint(optimizer=optimizer,
encoder=encoder,
decoder=decoder)
"""# Training
- Pass the input through the encoder which return encoder output and the encoder hidden state.
- The encoder output, encoder hidden state and the decoder input (which is the start token) is passed to the decoder.
- The decoder returns the predictions and the decoder hidden state.
- The decoder hidden state is then passed back into the model and the predictions are used to calculate the loss.
* Use teacher forcing to decide the next input to the decoder.
* Teacher forcing is the technique where the target word is passed as the next input to the decoder.
* The final step is to calculate the gradients and apply it to the optimizer and backpropagate.
"""
@tf.function
def train_step(inp, targ, enc_hidden):
loss = 0
with tf.GradientTape() as tape:
enc_output, enc_hidden = enocder(inp, enc_hidden)
dec_hidden = enc_hidden
dec_input = tf.expand_dims([targ_lang_tokenizer.word_index['<start>']] * BATCH_SIZE, 1)
# Use teacher forcing - feed the target as next input not predictions of model
for t in range(1, targ.shape[1]):
# passing enc_output to the decoder
predictions, dec_hidden, _ = decoder(dec_input, dec_hidden, enc_output)
loss += loss_function(targ[:, t], predictions)
# Use the teacher forcing
dec_input = tf.expand_dims(targ[:, t], 1)
batch_loss = (loss / int(targ.shape[1]))
variables = encoder.trainable_variables + decoder.trainable_variables
gradients = tape.gradient(loss, variables)
optimizer.apply_gradients(zip(gradients, variables))
return batch_loss
EPOCHS = 10
for epoch in range(EPOCHS):
start = time.time()
enc_hidden = encoder.initialize_hidden_state()
total_loss = 0
for (batch, (inp, targ)) in enumerate(dataset.take(steps_per_epoch)):
batch_loss = train_step(inp, targ, enc_hidden)
total_loss += batch_loss
if batch % 100 == 0:
print('Epoch {} Batch {} Loss {:.4f}'.format(epoch + 1,
batch,
batch_loss.numpy()))
# saving (checkpoint) the model every 2 epochs
if (epoch + 1) % 2 == 0:
checkpoint.save(file_prefix = checkpoint_prefix)
print('Epoch {} Loss {:.4f}'.format(epoch + 1,
total_loss / steps_per_epoch))
print('Time taken for 1 epoch {} sec\n'.format(time.time() - start))
"""# Translate
The evaluate function is similar to the training loop, except we don't use teacher forcing here. The input to the decoder at each time step is its previous predictions along with the hidden state and the encoder output.
Stop predicting when the model predicts the end token.
And store the attention weights for every time step.
"""
def evaluate(sentence):
attention_plot = np.zeros((max_length_target, max_length_inp))
sentence = preprocess_sentence(sentence)
inputs = [inp_lang_tokenizer.word_index[i] for i in sentence.split(' ')]
inputs = tf.keras.preprocessing.sequence.pad_sequences([inputs],
maxlen=max_length_inp,
padding='post')
inputs = tf.convert_to_tensor(inputs)
result = ''
hidden = [tf.zeros((1, units))]
enc_out, enc_hidden = encoder(inputs, hidden)
dec_hidden = enc_hidden
dec_input = tf.expand_dims([targ_lang_tokenizer.word_index['<start>']], 0)
for t in range(max_length_target):
predictions, dec_hidden, attention_weights = decoder(dec_input,
dec_hidden,
enc_out)
# storing the attention weights to plot later on
attention_weights = tf.reshape(attention_weights, (-1, ))
attention_plot[t] = attention_weights.numpy()
predicted_id = tf.argmax(predictions[0]).numpy()
result += targ_lang_tokenizer.index_word[predicted_id] + ' '
if targ_lang_tokenizer.index_word[predicted_id] == '<end>':
return result, sentence, attention_plot
# the predicted ID is fed back into the model
dec_input = tf.expand_dims([predicted_id], 0)
return result, sentence, attention_plot
# function for plotting the attention weights
def plot_attention(attention, sentence, predicted_sentence):
fig = plt.figure(figsize=(10,10))
ax = fig.add_subplot(1, 1, 1)
ax.matshow(attention, cmap='viridis')
fontdict = {'fontsize': 14}
ax.set_xticklabels([''] + sentence, fontdict=fontdict, rotation=90)
ax.set_yticklabels([''] + predicted_sentence, fontdict=fontdict)
ax.xaxis.set_major_locator(ticker.MultipleLocator(1))
ax.yaxis.set_major_locator(ticker.MultipleLocator(1))
plt.show()
def translate(sentence):
result, sentence, attention_plot = evaluate(sentence)
print('Input: %s' % (sentence))
print('Predicted translation: {}'.format(result))
attention_plot = attention_plot[:len(result.split(' ')), :len(sentence.split(' '))]
plot_attention(attention_plot, sentence.split(' '), result.split(' '))
checkpoint.restore(tf.train.latest_checkpoint(checkpoint_dir))
translate(u'hace mucho frio aqui.')
translate(u'esta es mi vida.')
translate(u'hace mucho frio aqui.')
translate(u'¿todavia estan en casa?')
translate(u'trata de averiguarlo.')
| 1,262.108787
| 312,972
| 0.957778
| 20,856
| 603,288
| 27.683832
| 0.854574
| 0.000421
| 0.000364
| 0.000187
| 0.004876
| 0.00318
| 0.001895
| 0.001438
| 0.001309
| 0.001309
| 0
| 0.154829
| 0.005647
| 603,288
| 477
| 312,973
| 1,264.754717
| 0.80764
| 0.00388
| 0
| 0.065217
| 1
| 0.004348
| 0.076354
| 0.001894
| 0
| 1
| 0
| 0.002096
| 0
| 1
| 0.082609
| false
| 0
| 0.043478
| 0.013043
| 0.195652
| 0.126087
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
00db6e60d16768c9cf31da23c9222b5ad9dd3655
| 757
|
py
|
Python
|
miguelvazsilva/datastructures/dequeue.py
|
miguelvazsilva/python-data-structures-algorithms
|
28e167340d1c5f93ad182eba6bc71df91881df3b
|
[
"MIT"
] | null | null | null |
miguelvazsilva/datastructures/dequeue.py
|
miguelvazsilva/python-data-structures-algorithms
|
28e167340d1c5f93ad182eba6bc71df91881df3b
|
[
"MIT"
] | null | null | null |
miguelvazsilva/datastructures/dequeue.py
|
miguelvazsilva/python-data-structures-algorithms
|
28e167340d1c5f93ad182eba6bc71df91881df3b
|
[
"MIT"
] | null | null | null |
# Miguel Vaz Silva
# Data Structures and Algorithms in Python - Dequeue Implementation
# Copyright 2018
class Dequeue(object):
def __init__(self):
self.items = []
def addFront(self,n):
self.items.insert(0,n)
def addBack(self,n):
self.items.append(n)
def removeBack(self):
return self.items.pop()
def removeFront(self):
return self.items.pop(0)
def dequeuePrint(self):
print("Queue Print:")
for x in self.items:
print(x)
def dequeueEmpty(self):
return self.items == []
def dequeueSize(self):
return len(self.items)
def peek(self):
return self.items[len(self.items)-1]
| 22.264706
| 67
| 0.561427
| 89
| 757
| 4.730337
| 0.438202
| 0.213777
| 0.133017
| 0.180523
| 0.104513
| 0
| 0
| 0
| 0
| 0
| 0
| 0.013834
| 0.331572
| 757
| 33
| 68
| 22.939394
| 0.818182
| 0.128137
| 0
| 0
| 0
| 0
| 0.018293
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.428571
| false
| 0
| 0
| 0.238095
| 0.714286
| 0.095238
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
00f2c61e5b8f9f5f39ce450861d2c3f2d757a124
| 166
|
py
|
Python
|
ys_code/src/skin_mb/data/__init__.py
|
sverbanic/ps2-npjBM
|
646585d787e5ae2d553a04ea4960b36e9d05bf29
|
[
"CC0-1.0"
] | null | null | null |
ys_code/src/skin_mb/data/__init__.py
|
sverbanic/ps2-npjBM
|
646585d787e5ae2d553a04ea4960b36e9d05bf29
|
[
"CC0-1.0"
] | null | null | null |
ys_code/src/skin_mb/data/__init__.py
|
sverbanic/ps2-npjBM
|
646585d787e5ae2d553a04ea4960b36e9d05bf29
|
[
"CC0-1.0"
] | null | null | null |
from .table import OtuTable, OtuTableFilter
from .deseq2 import DeseqResult
from .bayesian import BayesianRes
from .diff_abun import DiffAbunRes
from . import blastn
| 27.666667
| 43
| 0.837349
| 21
| 166
| 6.571429
| 0.619048
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006897
| 0.126506
| 166
| 6
| 44
| 27.666667
| 0.944828
| 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
| 1
| 0
|
0
| 5
|
daa95b1063f637c5f78c792885b461b90306aadb
| 233
|
py
|
Python
|
networkapi/snippets/urls.py
|
vinicius-marinho/GloboNetworkAPI
|
94651d3b4dd180769bc40ec966814f3427ccfb5b
|
[
"Apache-2.0"
] | 73
|
2015-04-13T17:56:11.000Z
|
2022-03-24T06:13:07.000Z
|
networkapi/snippets/urls.py
|
leopoldomauricio/GloboNetworkAPI
|
3b5b2e336d9eb53b2c113977bfe466b23a50aa29
|
[
"Apache-2.0"
] | 99
|
2015-04-03T01:04:46.000Z
|
2021-10-03T23:24:48.000Z
|
networkapi/snippets/urls.py
|
shildenbrand/GloboNetworkAPI
|
515d5e961456cee657c08c275faa1b69b7452719
|
[
"Apache-2.0"
] | 64
|
2015-08-05T21:26:29.000Z
|
2022-03-22T01:06:28.000Z
|
# -*- coding: utf-8 -*-
from django.conf.urls import patterns
from django.conf.urls import url
urlpatterns = patterns('networkapi.snippets.views',
url(r'^snippets/$', 'snippet_list'),
)
| 29.125
| 59
| 0.579399
| 25
| 233
| 5.36
| 0.68
| 0.149254
| 0.208955
| 0.268657
| 0.358209
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005988
| 0.283262
| 233
| 7
| 60
| 33.285714
| 0.796407
| 0.090129
| 0
| 0
| 0
| 0
| 0.228571
| 0.119048
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
dab710cfba4367f066e2eb7fd26a4b01daa5bd27
| 554
|
py
|
Python
|
smtp_tls_reporting/features/exceptions/__init__.py
|
YnkDK/smtp_tls_reporting
|
5d43cab3efd1fc9d32093ec2c7853b8bc65ab1ca
|
[
"MIT"
] | null | null | null |
smtp_tls_reporting/features/exceptions/__init__.py
|
YnkDK/smtp_tls_reporting
|
5d43cab3efd1fc9d32093ec2c7853b8bc65ab1ca
|
[
"MIT"
] | null | null | null |
smtp_tls_reporting/features/exceptions/__init__.py
|
YnkDK/smtp_tls_reporting
|
5d43cab3efd1fc9d32093ec2c7853b8bc65ab1ca
|
[
"MIT"
] | null | null | null |
"""
SMTP TLS reporting handler
Copyright (C) 2021 Martin Storgaard Dieu
This code is licensed under MIT license (see LICENSE.md for details)
"""
from smtp_tls_reporting.features.exceptions.GzipError import GzipError
from smtp_tls_reporting.features.exceptions.InternalError import InternalError
from smtp_tls_reporting.features.exceptions.JsonError import JsonError
from smtp_tls_reporting.features.exceptions.MissingParameterError import MissingParameterError
from smtp_tls_reporting.features.exceptions.NotFoundError import NotFoundError
| 46.166667
| 94
| 0.850181
| 67
| 554
| 6.880597
| 0.447761
| 0.091106
| 0.208243
| 0.21692
| 0.412148
| 0.412148
| 0
| 0
| 0
| 0
| 0
| 0.008048
| 0.102888
| 554
| 11
| 95
| 50.363636
| 0.919517
| 0.249097
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
dae7835d53392878112c9525e263bc336fc76eb3
| 38
|
py
|
Python
|
tests/__init__.py
|
williamcanin/zshpower
|
797533b60cd7f9dbd8cf2162db9a19d970a7be33
|
[
"MIT"
] | 10
|
2020-04-03T20:39:44.000Z
|
2021-12-09T22:26:56.000Z
|
tests/__init__.py
|
williamcanin/zshpower
|
797533b60cd7f9dbd8cf2162db9a19d970a7be33
|
[
"MIT"
] | 9
|
2021-05-15T13:26:48.000Z
|
2021-11-15T07:03:00.000Z
|
tests/__init__.py
|
williamcanin/zshpower
|
797533b60cd7f9dbd8cf2162db9a19d970a7be33
|
[
"MIT"
] | 2
|
2020-04-22T08:50:11.000Z
|
2021-06-23T05:03:02.000Z
|
"""Unit test package for zshpower."""
| 19
| 37
| 0.684211
| 5
| 38
| 5.2
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.131579
| 38
| 1
| 38
| 38
| 0.787879
| 0.815789
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.