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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c01a75ce2d0fd048116f0c45f5bcc1944a557708 | 542 | py | Python | isw2-master/src/app/core/estadoCampania.py | marlanbar/academic-projects | bcdc8ca36b6984ab3f83c10b8a3ed45576ecfca1 | [
"MIT"
] | null | null | null | isw2-master/src/app/core/estadoCampania.py | marlanbar/academic-projects | bcdc8ca36b6984ab3f83c10b8a3ed45576ecfca1 | [
"MIT"
] | null | null | null | isw2-master/src/app/core/estadoCampania.py | marlanbar/academic-projects | bcdc8ca36b6984ab3f83c10b8a3ed45576ecfca1 | [
"MIT"
] | null | null | null | class EstadoCampania():
def yaFinalizo(self):
raise NotImplemented("'yaFinalizo' no fue implementado")
def yaFueEvaluada(self):
raise NotImplemented("'yaFueEvaluada' no fue implementado")
def puedeEvaluarse(self):
raise NotImplemented("'puedeEvaluarse' no fue implementado")
def finalizar(self):
raise NotImplemented("'finalizar' no fue implementado")
def evaluar(self, unaEvaluacion):
raise NotImplemented("'evaluar' no fue implementado")
def getEvaluacion(self):
raise NotImplemented("'getEvaluacion' no fue implementado") | 41.692308 | 62 | 0.778598 | 57 | 542 | 7.403509 | 0.280702 | 0.270142 | 0.241706 | 0.236967 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114391 | 542 | 13 | 63 | 41.692308 | 0.879167 | 0 | 0 | 0 | 0 | 0 | 0.364641 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.461538 | false | 0 | 0 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 5 |
c02bfa39ab4af877076080035e9325baabeca10f | 89 | py | Python | extensions/.stubs/clrclasses/System/Runtime/DesignerServices/__init__.py | vicwjb/Pycad | 7391cd694b7a91ad9f9964ec95833c1081bc1f84 | [
"MIT"
] | 1 | 2020-03-25T03:27:24.000Z | 2020-03-25T03:27:24.000Z | extensions/.stubs/clrclasses/System/Runtime/DesignerServices/__init__.py | vicwjb/Pycad | 7391cd694b7a91ad9f9964ec95833c1081bc1f84 | [
"MIT"
] | null | null | null | extensions/.stubs/clrclasses/System/Runtime/DesignerServices/__init__.py | vicwjb/Pycad | 7391cd694b7a91ad9f9964ec95833c1081bc1f84 | [
"MIT"
] | null | null | null | from __clrclasses__.System.Runtime.DesignerServices import WindowsRuntimeDesignerContext
| 44.5 | 88 | 0.921348 | 7 | 89 | 11.142857 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044944 | 89 | 1 | 89 | 89 | 0.917647 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
c0420384fa2ef0c04fc4665e3fbb38fccb5899c8 | 220 | py | Python | fortytwocli/exception.py | dhaiibfiukkiu/42cli | a67da5168fe9e8a8905ed436e575e4c9bba6f608 | [
"MIT"
] | 4 | 2020-06-10T08:35:13.000Z | 2020-08-14T01:32:36.000Z | fortytwocli/exception.py | 4nm1tsu/42cli | a67da5168fe9e8a8905ed436e575e4c9bba6f608 | [
"MIT"
] | null | null | null | fortytwocli/exception.py | 4nm1tsu/42cli | a67da5168fe9e8a8905ed436e575e4c9bba6f608 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf=8 -*-
class GitError(Exception):
pass
class ApiAccessError(Exception):
pass
class AuthorizeError(Exception):
pass
class NoConfigFoundError(Exception):
pass
| 11.578947 | 36 | 0.686364 | 23 | 220 | 6.565217 | 0.608696 | 0.344371 | 0.357616 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00565 | 0.195455 | 220 | 18 | 37 | 12.222222 | 0.847458 | 0.190909 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
fbffed0894436f1e81c761dce6f35b8121ed54dd | 53 | py | Python | autogl/solver/classifier/hetero/__init__.py | dedsec-9/AutoGL | 487f2b2f798b9b1363ad5dc100fb410b12222e06 | [
"MIT"
] | null | null | null | autogl/solver/classifier/hetero/__init__.py | dedsec-9/AutoGL | 487f2b2f798b9b1363ad5dc100fb410b12222e06 | [
"MIT"
] | null | null | null | autogl/solver/classifier/hetero/__init__.py | dedsec-9/AutoGL | 487f2b2f798b9b1363ad5dc100fb410b12222e06 | [
"MIT"
] | null | null | null | from .node_classifier import AutoHeteroNodeClassifier | 53 | 53 | 0.924528 | 5 | 53 | 9.6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.056604 | 53 | 1 | 53 | 53 | 0.96 | 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 |
2206fa25fb4e590f553090204dedd8a409bc7b24 | 100 | py | Python | autogp/datasets/__init__.py | Alwaysproblem/AutoGP | a1a324246ac0f053e367054e34e956a4af063f65 | [
"Apache-2.0"
] | 1 | 2019-01-22T00:41:17.000Z | 2019-01-22T00:41:17.000Z | autogp/datasets/__init__.py | Alwaysproblem/AutoGP | a1a324246ac0f053e367054e34e956a4af063f65 | [
"Apache-2.0"
] | null | null | null | autogp/datasets/__init__.py | Alwaysproblem/AutoGP | a1a324246ac0f053e367054e34e956a4af063f65 | [
"Apache-2.0"
] | null | null | null | from __future__ import absolute_import
from .dataset import DataSet
from .mnist import import_mnist
| 25 | 38 | 0.86 | 14 | 100 | 5.714286 | 0.428571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12 | 100 | 3 | 39 | 33.333333 | 0.909091 | 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 |
222186f70d900ccc832cf9b92c028d2a27292c5c | 67 | py | Python | knx_stack/decode/layer/transport/t_data_group/__init__.py | majamassarini/knx-stack | 11a9baac6b7600649b5fbca43c93b200b23676b4 | [
"MIT"
] | 2 | 2021-07-28T07:42:28.000Z | 2022-01-25T18:56:05.000Z | knx_stack/decode/layer/transport/t_data_group/__init__.py | majamassarini/knx-stack | 11a9baac6b7600649b5fbca43c93b200b23676b4 | [
"MIT"
] | 6 | 2021-07-25T21:36:01.000Z | 2022-02-20T21:11:31.000Z | knx_stack/decode/layer/transport/t_data_group/__init__.py | majamassarini/knx-stack | 11a9baac6b7600649b5fbca43c93b200b23676b4 | [
"MIT"
] | null | null | null | from knx_stack.decode.layer.transport.t_data_group import con, ind
| 33.5 | 66 | 0.850746 | 12 | 67 | 4.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.074627 | 67 | 1 | 67 | 67 | 0.870968 | 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 |
222b52be004eda9333e5cda676f139189b5c5a23 | 232 | py | Python | trans_ms/transport_management/doctype/vehicle_documents_type/test_vehicle_documents_type.py | mohsinalimat/transport | 3d32bd27f505f64b948f48d0bfc5c7ccaf61c4a2 | [
"MIT"
] | null | null | null | trans_ms/transport_management/doctype/vehicle_documents_type/test_vehicle_documents_type.py | mohsinalimat/transport | 3d32bd27f505f64b948f48d0bfc5c7ccaf61c4a2 | [
"MIT"
] | null | null | null | trans_ms/transport_management/doctype/vehicle_documents_type/test_vehicle_documents_type.py | mohsinalimat/transport | 3d32bd27f505f64b948f48d0bfc5c7ccaf61c4a2 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (c) 2017, Aakvatech Limited and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestVehicleDocumentsType(unittest.TestCase):
pass
| 19.333333 | 56 | 0.771552 | 27 | 232 | 6.444444 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025253 | 0.146552 | 232 | 11 | 57 | 21.090909 | 0.853535 | 0.396552 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.2 | 0.6 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 5 |
2241537b5414ee579e31bf13677a065bab92b35f | 58 | py | Python | PP4E/Examples/PP4E/System/Streams/writer2.py | BeacherHou/Python-_Markdown- | 015d79a02d32f49395b80ca10919b3a09b72c4df | [
"MIT"
] | 1 | 2017-05-04T08:23:46.000Z | 2017-05-04T08:23:46.000Z | books/techno/python/programming_python_4_ed_m_lutz/code/chapter_3/09_chaning_programs_with_pipes_2/writer2.py | ordinary-developer/lin_education | 13d65b20cdbc3e5467b2383e5c09c73bbcdcb227 | [
"MIT"
] | null | null | null | books/techno/python/programming_python_4_ed_m_lutz/code/chapter_3/09_chaning_programs_with_pipes_2/writer2.py | ordinary-developer/lin_education | 13d65b20cdbc3e5467b2383e5c09c73bbcdcb227 | [
"MIT"
] | null | null | null | for data in (123, 0, 999, 42):
print('%03d' % data)
| 19.333333 | 31 | 0.517241 | 10 | 58 | 3 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.261905 | 0.275862 | 58 | 2 | 32 | 29 | 0.452381 | 0 | 0 | 0 | 0 | 0 | 0.071429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
2277e42854d159abc923c688be6837c0b36f8193 | 7,025 | py | Python | terraform_compliance/steps/then/its_value_condition_match_the_search_regex.py | check-spelling/terraform-compliance | 83636f0a0bad2e0e73eae70cf153c76f952cd2f3 | [
"MIT"
] | null | null | null | terraform_compliance/steps/then/its_value_condition_match_the_search_regex.py | check-spelling/terraform-compliance | 83636f0a0bad2e0e73eae70cf153c76f952cd2f3 | [
"MIT"
] | null | null | null | terraform_compliance/steps/then/its_value_condition_match_the_search_regex.py | check-spelling/terraform-compliance | 83636f0a0bad2e0e73eae70cf153c76f952cd2f3 | [
"MIT"
] | 1 | 2020-07-01T23:31:26.000Z | 2020-07-01T23:31:26.000Z | # -*- coding: utf-8 -*-
from terraform_compliance.common.helper import (
EmptyStash,
get_resource_name_from_stash
)
from terraform_compliance.common.error_handling import Error
import re
def its_value_condition_match_the_search_regex_regex(_step_obj, condition, search_regex, _stash=EmptyStash, case_insensitive=True):
def fail(condition, name=None):
text = 'matches' if condition == 'must not' else 'does not match'
name = name if (name is not None or name is not False) else _step_obj.context.name
pattern = 'Null/None' if regex == '\x00' else regex
Error(_step_obj, '{} property in {} {} {} with {} {} regex. '
'It is set to {}.'.format(_step_obj.context.property_name,
name,
_step_obj.context.type,
text,
pattern,
regex_flag_error_text,
values))
regex = r'{}'.format(search_regex)
values = _step_obj.context.stash if _stash is EmptyStash else _stash
regex_flags = re.IGNORECASE if case_insensitive else 0
regex_flag_error_text = 'case insensitive' if case_insensitive else 'case sensitive'
if isinstance(values, (str, int, bool, float)) or values is None:
matches = re.match(regex, str(values), flags=regex_flags)
if (condition == 'must' and matches is None) or (condition == "must not" and matches is not None):
_stash = get_resource_name_from_stash(_step_obj.context.stash, _stash, _step_obj.context.address)
fail(condition, name=_stash.get('address'))
elif isinstance(values, list):
for value in values:
its_value_condition_match_the_search_regex_regex(_step_obj,
condition,
search_regex,
value,
case_insensitive=case_insensitive)
elif isinstance(values, dict):
if not hasattr(_step_obj.context, 'address'):
_step_obj.context.address = None
_step_obj.context.address = values.get('address', _step_obj.context.address)
if 'values' in values:
if values['values'] is None and regex == '\x00' and condition == 'must not':
values = values['values']
fail(condition, name=_stash.get('address'))
else:
its_value_condition_match_the_search_regex_regex(_step_obj,
condition,
search_regex,
values.get('values'),
case_insensitive=case_insensitive)
else:
for key, value in values.items():
its_value_condition_match_the_search_regex_regex(_step_obj,
condition,
search_regex,
value,
case_insensitive=case_insensitive)
def any_of_its_values_condition_match_the_search_regex_regex(_step_obj, condition, search_regex, _stash=EmptyStash, case_insensitive=True):
def fail(condition, name=None):
text = 'matches' if condition == 'must not' else 'does not match'
name = name if (
name is not None or name is not False) else _step_obj.context.name
pattern = 'Null/None' if regex == '\x00' else regex
Error(_step_obj, '{} property in {} {} {} with {} {} regex. '
'It is set to {}.'.format(_step_obj.context.property_name,
name,
_step_obj.context.type,
text,
pattern,
regex_flag_error_text,
values))
found = False
def search(values):
nonlocal found
if found:
return True
if isinstance(values, (str, int, bool, float)) or values is None:
matches = re.match(regex, str(values), flags=regex_flags)
if (condition == 'must' and matches is not None) or (condition == "must not" and matches is None):
found = True
return found
elif isinstance(values, list):
return any(map(search, values))
elif isinstance(values, dict):
if not hasattr(_step_obj.context, 'address'):
_step_obj.context.address = None
_step_obj.context.address = values.get('address', _step_obj.context.address)
if 'values' in values:
return search(values['values'])
else:
return any(map(search, values.values()))
return False
regex = r'{}'.format(search_regex)
values = _step_obj.context.stash if _stash is EmptyStash else _stash
regex_flags = re.IGNORECASE if case_insensitive else 0
regex_flag_error_text = 'case insensitive' if case_insensitive else 'case sensitive'
if not search(values):
_stash = get_resource_name_from_stash(_step_obj.context.stash, _stash, _step_obj.context.address)
fail(condition, name=_stash.get('address'))
def its_singular_value_condition_match_the_search_regex_regex(_step_obj, condition, search_regex, _stash=EmptyStash, case_insensitive=True):
resources = _step_obj.context.stash if _stash is EmptyStash else _stash
if isinstance(resources, dict):
if 'values' in resources: # in case the object is in 'address', 'values', 'type' format
resources = resources['values']
else:
Error(_step_obj, '{} is multivalued! Please use any/all versions of this step instead.'.format(_step_obj.context.property_name,))
return
elif isinstance(resources, list):
for resource in resources:
if isinstance(resource, dict):
resource = resource.get('values', resource)
if isinstance(resource, (dict, list)) and len(resource) > 1:
Error(_step_obj, '{} is multivalued! Please use any/all versions of this step instead.'.format(_step_obj.context.property_name,))
return
its_value_condition_match_the_search_regex_regex(_step_obj, condition, search_regex, _stash, case_insensitive)
| 48.448276 | 145 | 0.538505 | 724 | 7,025 | 4.955801 | 0.128453 | 0.066332 | 0.089744 | 0.058528 | 0.779543 | 0.756689 | 0.74777 | 0.74777 | 0.728818 | 0.728818 | 0 | 0.002308 | 0.383345 | 7,025 | 144 | 146 | 48.784722 | 0.825946 | 0.01153 | 0 | 0.640351 | 0 | 0 | 0.077655 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | false | 0 | 0.026316 | 0 | 0.149123 | 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 |
97dc8d1bb2c674d7ed77e47b14e9540744584716 | 108 | py | Python | UTILS/memleak_finder.py | binary-husky/hmp2g | 1a4f4093cd296f07348f4db4c7503aca6e1fb05c | [
"MIT"
] | 2 | 2022-02-25T12:04:55.000Z | 2022-03-15T02:37:59.000Z | UTILS/memleak_finder.py | binary-husky/hmp2g | 1a4f4093cd296f07348f4db4c7503aca6e1fb05c | [
"MIT"
] | null | null | null | UTILS/memleak_finder.py | binary-husky/hmp2g | 1a4f4093cd296f07348f4db4c7503aca6e1fb05c | [
"MIT"
] | null | null | null | from pympler import tracker
tr = tracker.SummaryTracker()
def memdb_print_diff():
tr.print_diff()
| 15.428571 | 29 | 0.722222 | 14 | 108 | 5.357143 | 0.714286 | 0.24 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.185185 | 108 | 7 | 30 | 15.428571 | 0.852273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0.5 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
97e3b0d0020e3e92cd5da09605d821b398a7c255 | 785 | py | Python | YoutubeTags/__init__.py | Sainravi541/YoutubeTags | 49963e6e0db7e3b339b4858958f82297febf4e39 | [
"MIT"
] | 11 | 2021-09-10T09:40:54.000Z | 2021-11-15T07:40:57.000Z | YoutubeTags/__init__.py | Sainravi541/YoutubeTags | 49963e6e0db7e3b339b4858958f82297febf4e39 | [
"MIT"
] | null | null | null | YoutubeTags/__init__.py | Sainravi541/YoutubeTags | 49963e6e0db7e3b339b4858958f82297febf4e39 | [
"MIT"
] | 4 | 2021-09-19T17:31:13.000Z | 2021-10-16T16:30:18.000Z | import html5lib
import requests
import bs4
from bs4 import BeautifulSoup
def videotags(url):
try:
request = requests.get(url)
soup = BeautifulSoup(request.content, 'html5lib')
tags = ', '.join([ meta.attrs.get("content") for meta in soup.find_all("meta",{"property": "og:video:tag"}) ])
return tags
except:
return None
def channeltags(url):
try:
request = requests.get(url)
soup = BeautifulSoup(request.content, 'html5lib')
tags = ', '.join([ meta.attrs.get("content") for meta in soup.find_all("meta",{"property": "og:video:tag"}) ])
return tags
except:
return None
| 28.035714 | 124 | 0.526115 | 80 | 785 | 5.1375 | 0.375 | 0.029197 | 0.06326 | 0.10219 | 0.783455 | 0.783455 | 0.783455 | 0.783455 | 0.783455 | 0.783455 | 0 | 0.009901 | 0.356688 | 785 | 27 | 125 | 29.074074 | 0.80396 | 0 | 0 | 0.7 | 0 | 0 | 0.104459 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.2 | 0 | 0.5 | 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 |
97e7bd3a133e2cc7375bbf200f04ec0bf54315a2 | 147 | py | Python | doc2json/spp2json/spp/spp_json_to_s2orc_json.py | josephcc/s2orc-doc2json | 8a6a21b7a8a3c6ad11cd42bdd0d46ee32a5a990d | [
"Apache-2.0"
] | 132 | 2021-02-15T18:16:12.000Z | 2022-03-29T04:47:17.000Z | doc2json/spp2json/spp/spp_json_to_s2orc_json.py | josephcc/s2orc-doc2json | 8a6a21b7a8a3c6ad11cd42bdd0d46ee32a5a990d | [
"Apache-2.0"
] | 6 | 2021-02-21T09:52:11.000Z | 2022-02-01T17:45:43.000Z | pdf_to_txt/doc2json/spp2json/spp/spp_json_to_s2orc_json.py | Kabongosalomon/task-dataset-metric-nli-extraction | 2f7ecd7e1e4a456d2e23d9384f11c453653c4351 | [
"MIT"
] | 18 | 2021-02-15T18:18:05.000Z | 2022-03-11T19:37:47.000Z | from typing import *
from doc2json.s2orc import Paper
def convert_spp_json_to_s2orc_json(spp_json: Dict) -> Paper:
raise NotImplementedError | 21 | 60 | 0.802721 | 21 | 147 | 5.333333 | 0.666667 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02381 | 0.142857 | 147 | 7 | 61 | 21 | 0.865079 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.5 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
97f0a8767f3e910dd4b242b2c4e782de9d30f367 | 120 | py | Python | grr/core/grr_response_core/lib/rdfvalues/__init__.py | nkrios/grr | 399e078ed522bf0555a2666fb086aa7809d54971 | [
"Apache-2.0"
] | 4,238 | 2015-01-01T15:34:50.000Z | 2022-03-31T08:18:05.000Z | grr/core/grr_response_core/lib/rdfvalues/__init__.py | tomchop/grr | 27ba38dc0f5ad4f3e0cdbfb146a0a789e3b0d27b | [
"Apache-2.0"
] | 787 | 2015-01-02T21:34:24.000Z | 2022-03-02T13:26:38.000Z | grr/core/grr_response_core/lib/rdfvalues/__init__.py | tomchop/grr | 27ba38dc0f5ad4f3e0cdbfb146a0a789e3b0d27b | [
"Apache-2.0"
] | 856 | 2015-01-02T02:50:11.000Z | 2022-03-31T11:11:53.000Z | #!/usr/bin/env python
"""AFF4 RDFValue implementations.
This module contains the various RDFValue implementations.
"""
| 20 | 58 | 0.775 | 14 | 120 | 6.642857 | 0.857143 | 0.494624 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009434 | 0.116667 | 120 | 5 | 59 | 24 | 0.867925 | 0.925 | 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 |
3f38fd20d3f0c0c2f34c6acb1e019373dc99dfe5 | 136 | py | Python | seven/c4.py | xiaolinzi-xl/python_imooc | 07bde890e3ab0ddef4467b0c77ef33614339a657 | [
"Apache-2.0"
] | null | null | null | seven/c4.py | xiaolinzi-xl/python_imooc | 07bde890e3ab0ddef4467b0c77ef33614339a657 | [
"Apache-2.0"
] | null | null | null | seven/c4.py | xiaolinzi-xl/python_imooc | 07bde890e3ab0ddef4467b0c77ef33614339a657 | [
"Apache-2.0"
] | null | null | null | a = [1,2,3,4,5,6,7,8]
for i in range(0,len(a),2): # 打印 1,3,5,7
print(a[i],end=' | ')
print()
b = a[0:len(a):2] # 使用分片更加优雅
print(b) | 19.428571 | 40 | 0.507353 | 36 | 136 | 1.916667 | 0.555556 | 0.115942 | 0.144928 | 0.173913 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144144 | 0.183824 | 136 | 7 | 41 | 19.428571 | 0.477477 | 0.139706 | 0 | 0 | 0 | 0 | 0.026087 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 1 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
3f690519304fd00065183904f5405ead1f17b3b2 | 17,449 | py | Python | Homework_1/104501527_Hw1.py | woodyhoko/Neural_Networks_coursework | 3d12a31047a1eb54a3ae52bb502c5371e5478701 | [
"MIT"
] | null | null | null | Homework_1/104501527_Hw1.py | woodyhoko/Neural_Networks_coursework | 3d12a31047a1eb54a3ae52bb502c5371e5478701 | [
"MIT"
] | null | null | null | Homework_1/104501527_Hw1.py | woodyhoko/Neural_Networks_coursework | 3d12a31047a1eb54a3ae52bb502c5371e5478701 | [
"MIT"
] | null | null | null |
import matplotlib.pyplot as plt
from tkinter import *
import os
import random
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
def read():
filename=e[0].get()
f=open(filename,'r')
data=f.readlines()
random.shuffle(data)
data=[list(map(float,line.split())) for line in data]
dimension=len(data[0])-1
Label(master,text="Learning rate : ").grid(row=3)
Label(master,text="Learning time : ").grid(row=4)
Label(master,text="Learn data rate : ").grid(row=5)
Label(master,text="Accept correct rate : ").grid(row=6)
Label(master,text="initialize").grid(row=7)
Label(master,text=("Dimension : "+str(dimension))).grid(row=7,column=1)
Label(master,text="Threshold : ").grid(row=8)
di=0
i=[Entry]*(dimension+1)
for di in range(dimension):
Label(master,text=("wieght","of","x"+str(di+1),":")).grid(row=di+9)
i[di+1]=Entry(master)
i[di+1].grid(row=di+9,column=1)
e[2]=Entry(master)
e[3]=Entry(master)
e[4]=Entry(master)
e[5]=Entry(master)
i[0]=Entry(master)
e[2].grid(row=3,column=1)
e[3].grid(row=4,column=1)
e[4].grid(row=5,column=1)
e[5].grid(row=6,column=1)
i[0].grid(row=8,column=1)
Button(master,text='Start',command=lambda:realstart(dimension,data,i)).grid(row=50,column=1, sticky=W,pady=4)
def realstart(dimension,data,i):
areas=sorted(list(map(int,list(set([point[dimension] for point in data])))))
print(areas)
cs='brgcmyk'
smartlineinfo=[[int]*2 for _ in range(sum(k for k in range(len(areas))))]
ax=ay=0
for aa in range(sum(k for k in range(len(areas)))):
ay+=1
if ay>=len(areas):
ax+=1
ay=ax+1
smartlineinfo[aa][0]=areas[ax]
smartlineinfo[aa][1]=areas[ay]
savedir=e[1].get()
if not os.path.exists(savedir):
os.makedirs(savedir)
learningrate=float(e[2].get())
ldr=float(e[4].get())
print(data)
largest=[float]*(dimension+1)
smallest=[float]*(dimension+1)
for k in range(dimension+1):
largest[k]=smallest[k]=data[0][k]
for k in range(len(data)):
for w in range(dimension):
if largest[w]<data[k][w]:
largest[w]=data[k][w]
elif smallest[w]>data[k][w]:
smallest[w]=data[k][w]
smartline=[[float]*(dimension+1) for _ in range(sum(k for k in range(len(areas))))]
bestsmartline=[[float]*(dimension+1) for _ in range(sum(k for k in range(len(areas))))]
bestrate=0
for aa in range(sum(k for k in range(len(areas)))):
thres=float(i[0].get())
smartline[aa][0]=thres
for k in range(dimension):
smartline[aa][k+1]=float(i[k+1].get())
for aa in range(sum(k for k in range(len(areas)))):
print(', '.join(str(x) for x in smartline[aa]))
n=int(e[3].get())
acceptrate=float(e[5].get())
raterecord=[float]*(n+1)
for aa in range(sum(k for k in range(len(areas)))):
for bb in range(dimension+1):
if smartline[aa][bb]==0:
smartline[aa][bb]+=0.000000001
r=0
currentrate=0
correctnum=0
if r<len(data)-int(len(data)*ldr)!=0:
while(r<len(data)-int(len(data)*ldr)):
counting=[0]*(sum(k for k in range(len(areas)))+2)
besta=0
for aa in range(sum(k for k in range(len(areas)))):
if (-smartline[aa][0]+sum(smartline[aa][k+1]*data[(int(len(data)*ldr)+r)][k] for k in range(dimension)))>((smartlineinfo[aa][0]+smartlineinfo[aa][1])/2):
counting[smartlineinfo[aa][1]]+=1
else:
counting[smartlineinfo[aa][0]]+=1
for aa in range(sum(k for k in range(len(areas)))+2):
if counting[aa]>counting[besta]:
besta=aa
if besta==int(data[(int(len(data)*ldr)+r)][dimension]):
correctnum+=1
r+=1
currentrate=correctnum/(len(data)-int(len(data)*ldr))
else:
while(r<len(data)):
counting=[0]*(sum(k for k in range(len(areas)))+2)
besta=0
for aa in range(sum(k for k in range(len(areas)))):
if (-smartline[aa][0]+sum(smartline[aa][k+1]*data[r][k] for k in range(dimension)))>((smartlineinfo[aa][0]+smartlineinfo[aa][1])/2):
counting[smartlineinfo[aa][1]]+=1
else:
counting[smartlineinfo[aa][0]]+=1
for aa in range(sum(k for k in range(len(areas)))+2):
if counting[aa]>counting[besta]:
besta=aa
if besta==int(data[r][dimension]):
correctnum+=1
r+=1
currentrate=correctnum/(len(data))
raterecord[0]=currentrate
print(currentrate)
pic=0
t=0
if(dimension==2):
for area, c in zip(areas, cs):
fdata=list(filter(lambda point: point[2]==area, data[:int(len(data)*ldr-1):]))
xs=[point[0] for point in fdata]
ys=[point[1] for point in fdata]
plt.scatter(xs, ys, c=c, marker='o')
for area, c in zip(areas, cs):
fdata=list(filter(lambda point: point[2]==area, data[int(len(data)*ldr):]))
xs=[point[0] for point in fdata]
ys=[point[1] for point in fdata]
plt.scatter(xs, ys, c=c, marker='^')
plt.axhline(0,color='g', linestyle='--')
plt.axvline(0,color='g', linestyle='--')
for aa in range(sum(k for k in range(len(areas)))):
plt.plot([smallest[0]-1,largest[0]+1],[(smartline[aa][0]-smartline[aa][1]*(smallest[0]-1))/smartline[aa][2],(smartline[aa][0]-smartline[aa][1]*(largest[1]+1))/smartline[aa][2]],color=cs[aa])
parastr=['{:.3f}'.format(x) for x in smartline[aa]]
plt.figtext(0.25,-0.05-0.05*aa,'Parameter'+str(aa)+' = '+'{ '+', '.join(x for x in parastr)+' }')
plt.figtext(0.4,-0.05-0.05*(sum(k for k in range(len(areas)))),'correct rate = '+ "%.3f"% currentrate)
plt.axis([smallest[0]-1,largest[0]+1,smallest[1]-1,largest[1]+1])
plt.suptitle('Initialized status ', fontsize=12)
plt.savefig(savedir+'/'+str(pic)+'.png',bbox_inches='tight', pad_inches=0.3)
plt.close('all')
elif(dimension==3):
fig = plt.figure()
aaa = fig.add_subplot(111, projection='3d')
for area, c in zip(areas, cs):
fdata=list(filter(lambda point: point[3]==area, data[:int(len(data)*ldr-1):]))
xs=[point[0] for point in fdata]
ys=[point[1] for point in fdata]
zs=[point[2] for point in fdata]
aaa.scatter(xs, ys, zs, c=c, marker='o')
for area, c in zip(areas, cs):
fdata=list(filter(lambda point: point[3]==area, data[int(len(data)*ldr):]))
xs=[point[0] for point in fdata]
ys=[point[1] for point in fdata]
zs=[point[2] for point in fdata]
aaa.scatter(xs, ys, zs, c=c, marker='^')
X=np.arange(smallest[0]-1,largest[0]+1,(-smallest[0]+largest[0])/10)
Y=np.arange(smallest[1]-1,largest[1]+1,(-smallest[1]+largest[1])/10)
X,Y=np.meshgrid(X,Y)
for aa in range(sum(k for k in range(len(areas)))):
Z=(((smartlineinfo[aa][0]+smartlineinfo[aa][1])/2)+smartline[aa][0]-smartline[aa][1]*X-smartline[aa][2]*Y)/smartline[aa][3]
aaa.plot_wireframe(X,Y,Z,color=cs[aa])
parastr=['{:.3f}'.format(x) for x in smartline[aa]]
plt.figtext(0.25,-0.05-0.05*aa,'Parameter'+str(aa+1)+' = '+'{ '+', '.join(x for x in parastr)+' }')
aaa.set_zlim3d(smallest[2]-1,largest[2]+1)
plt.figtext(0.4,-0.05-0.05*(sum(k for k in range(len(areas)))),'correct rate = '+ "%.3f"% currentrate)
plt.suptitle('Iteration '+str(t), fontsize=12)
plt.axis([smallest[0]-1,largest[0]+1,smallest[1]-1,largest[1]+1])
plt.savefig(savedir+'/'+str(pic)+'.png',bbox_inches='tight', pad_inches=0.3)
plt.close('all')
else:
for aa in range(sum(k for k in range(len(areas)))):
parastr=['{:.3f}'.format(x) for x in smartline[aa]]
plt.figtext(0.25,-0.05-0.05*aa,'Parameter'+str(aa+1)+' = '+'{ '+', '.join(x for x in parastr)+' }')
plt.suptitle('Iteration '+str(t), fontsize=12)
plt.figtext(0.4,-0.05-0.05*(sum(k for k in range(len(areas)))),'correct rate = '+ "%.3f"% currentrate)
plt.savefig(savedir+'/'+str(pic)+'.png',bbox_inches='tight', pad_inches=0.3)
plt.close('all')
while(t<n and currentrate<acceptrate):
check=0
for aa in range(sum(k for k in range(len(areas)))):
if (-smartline[aa][0]+sum(smartline[aa][k+1]*data[t%int(len(data)*ldr)][k] for k in range(dimension))>=(smartlineinfo[aa][0]+smartlineinfo[aa][1])/2) and (data[t%int(len(data)*ldr)][dimension]<(smartlineinfo[aa][0]+smartlineinfo[aa][1])/2):
smartline[aa][0]-=-learningrate
for k in range(dimension):
smartline[aa][k+1]-=learningrate*data[t%int(len(data)*ldr)][k]
check=1
elif (-smartline[aa][0]+sum(smartline[aa][k+1]*data[t%int(len(data)*ldr)][k] for k in range(dimension))<=(smartlineinfo[aa][0]+smartlineinfo[aa][1])/2) and (data[t%int(len(data)*ldr)][dimension]>(smartlineinfo[aa][0]+smartlineinfo[aa][1])/2):
smartline[aa][0]+=-learningrate
for k in range(dimension):
smartline[aa][k+1]+=learningrate*data[t%int(len(data)*ldr)][k]
check=1
for aa in range(sum(k for k in range(len(areas)))):
for bb in range(dimension+1):
if smartline[aa][bb]==0:
smartline[aa][bb]+=0.000000001
correctnum=0
r=0
if r<len(data)-int(len(data)*ldr)!=0:
while(r<len(data)-int(len(data)*ldr)):
counting=[0]*(sum(k for k in range(len(areas)))+2)
besta=0
for aa in range(sum(k for k in range(len(areas)))):
if (-smartline[aa][0]+sum(smartline[aa][k+1]*data[(int(len(data)*ldr)+r)][k] for k in range(dimension)))>((smartlineinfo[aa][0]+smartlineinfo[aa][1])/2):
counting[smartlineinfo[aa][1]]+=1
else:
counting[smartlineinfo[aa][0]]+=1
for aa in range(sum(k for k in range(len(areas)))+2):
if counting[aa]>counting[besta]:
besta=aa
if besta==int(data[(int(len(data)*ldr)+r)][dimension]):
correctnum+=1
r+=1
currentrate=correctnum/(len(data)-int(len(data)*ldr))
else:
while(r<len(data)):
counting=[0]*(sum(k for k in range(len(areas)))+2)
besta=0
for aa in range(sum(k for k in range(len(areas)))):
if (-smartline[aa][0]+sum(smartline[aa][k+1]*data[r][k] for k in range(dimension)))>((smartlineinfo[aa][0]+smartlineinfo[aa][1])/2):
counting[smartlineinfo[aa][1]]+=1
else:
counting[smartlineinfo[aa][0]]+=1
for aa in range(sum(k for k in range(len(areas)))+2):
if counting[aa]>counting[besta]:
besta=aa
if besta==int(data[r][dimension]):
correctnum+=1
r+=1
currentrate=correctnum/(len(data))
t+=1
if check!=0:
pic+=1
print(t)
for aa in range(sum(k for k in range(len(areas)))):
print("neuron"+str(aa+1)+" : "+', '.join(str(x) for x in smartline[aa]))
print(currentrate)
if(dimension==2):
for area, c in zip(areas, cs):
fdata=list(filter(lambda point: point[2]==area, data[:int(len(data)*ldr-1):]))
xs=[point[0] for point in fdata]
ys=[point[1] for point in fdata]
plt.scatter(xs, ys, c=c, marker='o')
for area, c in zip(areas, cs):
fdata=list(filter(lambda point: point[2]==area, data[int(len(data)*ldr):]))
xs=[point[0] for point in fdata]
ys=[point[1] for point in fdata]
plt.scatter(xs, ys, c=c, marker='^')
plt.axhline(0,color='g', linestyle='--')
plt.axvline(0,color='g', linestyle='--')
for aa in range(sum(k for k in range(len(areas)))):
plt.plot([smallest[0]-1,largest[0]+1],[(smartline[aa][0]+((smartlineinfo[aa][0]+smartlineinfo[aa][1])/2)-smartline[aa][1]*(smallest[0]-1))/smartline[aa][2],(smartline[aa][0]+((smartlineinfo[aa][0]+smartlineinfo[aa][1])/2)-smartline[aa][1]*(largest[0]+1))/smartline[aa][2]],color=cs[aa])
parastr=['{:.3f}'.format(x) for x in smartline[aa]]
plt.figtext(0.25,-0.05-0.05*aa,'Parameter'+str(aa+1)+' = '+'{ '+', '.join(x for x in parastr)+' }')
plt.figtext(0.4,-0.05-0.05*(sum(k for k in range(len(areas)))),'correct rate = '+ "%.3f"% currentrate)
plt.suptitle('Iteration '+str(t), fontsize=12)
plt.axis([smallest[0]-1,largest[0]+1,smallest[1]-1,largest[1]+1])
plt.savefig(savedir+'/'+str(pic)+'.png',bbox_inches='tight', pad_inches=0.3)
plt.close('all')
elif(dimension==3):
fig = plt.figure()
aaa = fig.add_subplot(111, projection='3d')
for area, c in zip(areas, cs):
fdata=list(filter(lambda point: point[3]==area, data[:int(len(data)*ldr-1):]))
xs=[point[0] for point in fdata]
ys=[point[1] for point in fdata]
zs=[point[2] for point in fdata]
aaa.scatter(xs, ys, zs, c=c, marker='o')
for area, c in zip(areas, cs):
fdata=list(filter(lambda point: point[3]==area, data[int(len(data)*ldr):]))
xs=[point[0] for point in fdata]
ys=[point[1] for point in fdata]
zs=[point[2] for point in fdata]
aaa.scatter(xs, ys, zs, c=c, marker='^')
X=np.arange(smallest[0]-1,largest[0]+1,(-smallest[0]+largest[0])/10)
Y=np.arange(smallest[1]-1,largest[1]+1,(-smallest[1]+largest[1])/10)
X,Y=np.meshgrid(X,Y)
for aa in range(sum(k for k in range(len(areas)))):
Z=(((smartlineinfo[aa][0]+smartlineinfo[aa][1])/2)+smartline[aa][0]-smartline[aa][1]*X-smartline[aa][2]*Y)/smartline[aa][3]
aaa.plot_wireframe(X,Y,Z,color=cs[aa])
parastr=['{:.3f}'.format(x) for x in smartline[aa]]
plt.figtext(0.25,-0.05-0.05*aa,'Parameter'+str(aa+1)+' = '+'{ '+', '.join(x for x in parastr)+' }')
aaa.set_zlim3d(smallest[2]-1,largest[2]+1)
plt.figtext(0.4,-0.05-0.05*(sum(k for k in range(len(areas)))),'correct rate = '+ "%.3f"% currentrate)
plt.suptitle('Iteration '+str(t), fontsize=12)
plt.axis([smallest[0]-1,largest[0]+1,smallest[1]-1,largest[1]+1])
plt.savefig(savedir+'/'+str(pic)+'.png',bbox_inches='tight', pad_inches=0.3)
plt.close('all')
else:
for aa in range(sum(k for k in range(len(areas)))):
parastr=['{:.3f}'.format(x) for x in smartline[aa]]
plt.figtext(0.25,-0.05-0.05*aa,'Parameter'+str(aa+1)+' = '+'{ '+', '.join(x for x in parastr)+' }')
plt.suptitle('Iteration '+str(t), fontsize=12)
plt.figtext(0.4,-0.05-0.05*(sum(k for k in range(len(areas)))),'correct rate = '+ "%.3f"% currentrate)
plt.savefig(savedir+'/'+str(pic)+'.png',bbox_inches='tight', pad_inches=0.3)
plt.close('all')
raterecord[t]=currentrate
if currentrate>bestrate:
bestsmartline=smartline
bestrate=currentrate
plt.suptitle('Learning progress',fontsize=12)
for chc in range(n):
plt.plot([chc,chc+1],[raterecord[chc],raterecord[chc+1]],color='b')
for aa in range(sum(k for k in range(len(areas)))):
parastr=['{:.3f}'.format(x) for x in bestsmartline[aa]]
plt.figtext(0.25,-0.05-0.05*aa,'Parameter'+str(aa+1)+' = '+'{ '+', '.join(x for x in parastr)+' }')
plt.figtext(0.4,-0.05-0.05*(sum(k for k in range(len(areas)))),'best rate = '+ "%.3f"% bestrate)
plt.savefig(savedir+'/record.png',bbox_inches='tight', pad_inches=0.3)
plt.close('all')
master = Tk()
master.title("Hw 1")
Label(master,text="Data File name : ").grid(row=0)
Label(master,text="Save folder name : ").grid(row=1)
Button(master,text='Read',command=read).grid(row=2,column=1, sticky=W,pady=4)
e=[Entry]*6
e[0]=Entry(master)
e[1]=Entry(master)
e[0].grid(row=0,column=1)
e[1].grid(row=1,column=1)
Button(master,text='Quit',command=master.quit,fg="red").grid(row=100,column=1,sticky=W,pady=4)
mainloop()
| 45.558747 | 306 | 0.531836 | 2,585 | 17,449 | 3.580658 | 0.074662 | 0.058233 | 0.030467 | 0.055856 | 0.787489 | 0.774092 | 0.76264 | 0.761344 | 0.755942 | 0.752377 | 0 | 0.043447 | 0.275832 | 17,449 | 382 | 307 | 45.67801 | 0.689063 | 0 | 0 | 0.634675 | 0 | 0 | 0.040064 | 0 | 0.021672 | 0 | 0 | 0 | 0 | 1 | 0.006192 | false | 0 | 0.018576 | 0 | 0.024768 | 0.021672 | 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 |
58c45ee225492c080ca905366fe1db057febd136 | 481 | py | Python | pytheos/plot/__init__.py | SHDShim/pytheos | be079624405e92fbec60c5ead253eb5917e55237 | [
"Apache-2.0"
] | 6 | 2017-06-23T03:28:51.000Z | 2020-12-02T01:06:50.000Z | pytheos/plot/__init__.py | SHDShim/pytheos | be079624405e92fbec60c5ead253eb5917e55237 | [
"Apache-2.0"
] | 3 | 2018-03-06T00:07:51.000Z | 2018-07-18T17:42:26.000Z | pytheos/plot/__init__.py | SHDShim/pytheos | be079624405e92fbec60c5ead253eb5917e55237 | [
"Apache-2.0"
] | 6 | 2017-07-11T19:40:12.000Z | 2021-01-12T02:20:39.000Z | """
from .BM3 import *
from .conversion import *
from .debye import *
from .kunc import *
from .objs import *
from .objs_for_fit import *
from .pth import *
from .pth_ConstQ import *
from .pth_Dorogokupets2007 import *
from .pth_Dorogokupets2015 import *
from .pth_Speziale2001 import *
from .pth_Tange import *
from .pvt import *
from .vinet import *
from .hugoniot import *
"""
from .static_fit import static_fit_result
from .thermal_fit import thermal_data, thermal_fit_result
| 22.904762 | 57 | 0.769231 | 68 | 481 | 5.235294 | 0.323529 | 0.421348 | 0.219101 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.031785 | 0.149688 | 481 | 20 | 58 | 24.05 | 0.838631 | 0.77131 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
58ec809d5d553cae857ea12062fe339fe8420c19 | 4,549 | py | Python | tests/unit/test_four_key_metrics.py | play-code-tools/crawling-gocd | 4e2bae3c8bfeb091e49979dac785c96d22b90688 | [
"MIT"
] | null | null | null | tests/unit/test_four_key_metrics.py | play-code-tools/crawling-gocd | 4e2bae3c8bfeb091e49979dac785c96d22b90688 | [
"MIT"
] | 1 | 2020-03-18T13:30:05.000Z | 2020-03-18T13:30:05.000Z | tests/unit/test_four_key_metrics.py | play-code-tools/crawling-gocd | 4e2bae3c8bfeb091e49979dac785c96d22b90688 | [
"MIT"
] | null | null | null | import unittest
import json
import datetime
import tests.unit.test_fixture as fixture
from crawling_gocd.four_key_metrics import DeploymentFrequency, ChangeFailPercentage, MeanTimeToRestore, ChangeFailPercentage_ignoredContinuousFailed
from crawling_gocd.gocd_domain import Pipeline
from crawling_gocd.crawler import CrawlingDataMapper
from crawling_gocd.calculate_domain import InputsCalcConfig
class DeploymentFrequencyTest(unittest.TestCase):
def setUp(self):
self.pipeline = fixture.generatePipeline()
def test_should_calculate_deployment_frequency_correctly(self):
handler = DeploymentFrequency()
results = handler.calculate([self.pipeline], [])
self.assertEqual("".join(str(x) for x in results),
"{ pipelineName: go_service, metricsName: DeploymentFrequency, groupName: qa, value: 5 }")
class ChangeFailPercentageTest(unittest.TestCase):
def setUp(self):
self.pipeline = fixture.generatePipeline()
self.handler = ChangeFailPercentage()
def test_should_calculate_change_fail_percentage_correctly(self):
results = self.handler.calculate([self.pipeline], [])
self.assertEqual("".join(str(x) for x in results),
"{ pipelineName: go_service, metricsName: ChangeFailPercentage, groupName: qa, value: 40.0% }")
def test_should_return_NA_when_zero_deployment(self):
self.pipeline.calcConfig.endTime = datetime.datetime(2019, 8, 29, 8, 34, tzinfo=datetime.timezone.utc)
results = self.handler.calculate([self.pipeline], [])
self.assertEqual("".join(str(x) for x in results),
"{ pipelineName: go_service, metricsName: ChangeFailPercentage, groupName: qa, value: N/A }")
class ChangeFailPercentage_ignoredContinuousFailedTest(unittest.TestCase):
def setUp(self):
self.pipeline = fixture.generatePipeline()
self.handler = ChangeFailPercentage_ignoredContinuousFailed()
def test_should_calculate_change_fail_percentage_correctly(self):
results = self.handler.calculate([self.pipeline], [])
self.assertEqual("".join(str(x) for x in results),
"{ pipelineName: go_service, metricsName: ChangeFailPercentage_2, groupName: qa, value: 40.0% }")
def test_return_NA_when_zero_deployment(self):
self.pipeline.calcConfig.endTime = datetime.datetime(2019, 8, 29, 8, 34, tzinfo=datetime.timezone.utc)
results = self.handler.calculate([self.pipeline], [])
self.assertEqual("".join(str(x) for x in results),
"{ pipelineName: go_service, metricsName: ChangeFailPercentage_2, groupName: qa, value: N/A }")
class MeanTimeToRestoreTest(unittest.TestCase):
def setUp(self):
self.pipeline = fixture.generatePipeline()
self.handler = MeanTimeToRestore()
def test_should_calculate_mean_time_to_restore_correctly_when_last_history_is_failed(self):
results = self.handler.calculate([self.pipeline], [])
self.assertEqual("".join(str(x) for x in results),
"{ pipelineName: go_service, metricsName: MeanTimeToRestore, groupName: qa, value: 837(mins) }")
def test_should_calculate_mean_time_to_restore_correctly_when_last_history_is_successful(self):
self.pipeline.calcConfig.endTime = datetime.datetime(2019, 8, 30, 8, 34, tzinfo=datetime.timezone.utc)
results = self.handler.calculate([self.pipeline], [])
self.assertEqual("".join(str(x) for x in results),
"{ pipelineName: go_service, metricsName: MeanTimeToRestore, groupName: qa, value: 69(mins) }")
def test_should_calculate_mean_time_to_restore_when_newest_is_failed(self):
self.pipeline.histories.pop(-1)
self.pipeline.calcConfig.endTime = datetime.datetime(2019, 9, 2, tzinfo=datetime.timezone.utc)
results = self.handler.calculate([self.pipeline], [])
self.assertEqual("".join(str(x) for x in results),
"{ pipelineName: go_service, metricsName: MeanTimeToRestore, groupName: qa, value: 1229(mins) }")
def test_should_return_NA_when_zero_depolyment(self):
self.pipeline.calcConfig.endTime = datetime.datetime(2019, 8, 29, 8, 34, tzinfo=datetime.timezone.utc)
results = self.handler.calculate([self.pipeline], [])
self.assertEqual("".join(str(x) for x in results),
"{ pipelineName: go_service, metricsName: MeanTimeToRestore, groupName: qa, value: N/A }") | 56.160494 | 149 | 0.702132 | 500 | 4,549 | 6.206 | 0.192 | 0.073477 | 0.046407 | 0.081212 | 0.766033 | 0.765388 | 0.760877 | 0.727361 | 0.727361 | 0.674509 | 0 | 0.017658 | 0.190811 | 4,549 | 81 | 150 | 56.160494 | 0.825319 | 0 | 0 | 0.454545 | 0 | 0 | 0.18044 | 0.019341 | 0 | 0 | 0 | 0 | 0.136364 | 1 | 0.19697 | false | 0 | 0.121212 | 0 | 0.378788 | 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 |
451baa433e183faa4cde044f78d849ee1f6b8680 | 46 | py | Python | services/kozipipe/src/errors.py | HerrLeStrate/training-27-10-19 | 6c95aa03ffc59a0065f93ebb54829c58efadb4e7 | [
"WTFPL"
] | null | null | null | services/kozipipe/src/errors.py | HerrLeStrate/training-27-10-19 | 6c95aa03ffc59a0065f93ebb54829c58efadb4e7 | [
"WTFPL"
] | 2 | 2021-03-10T06:12:44.000Z | 2021-05-11T02:02:43.000Z | services/kozipipe/src/errors.py | HerrLeStrate/training-27-10-19 | 6c95aa03ffc59a0065f93ebb54829c58efadb4e7 | [
"WTFPL"
] | 3 | 2020-02-14T14:10:56.000Z | 2020-12-07T07:40:38.000Z | class ServerException(BaseException):
pass | 23 | 37 | 0.804348 | 4 | 46 | 9.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130435 | 46 | 2 | 38 | 23 | 0.925 | 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 |
188d5331cdaa97941f3dbc377d222fc98861bd7d | 42 | py | Python | hello_test.py | bipul2002star/hello-world-1 | 2eec63acfdb03f71cbe5b5728725e54a09b12d4e | [
"BSD-2-Clause"
] | null | null | null | hello_test.py | bipul2002star/hello-world-1 | 2eec63acfdb03f71cbe5b5728725e54a09b12d4e | [
"BSD-2-Clause"
] | null | null | null | hello_test.py | bipul2002star/hello-world-1 | 2eec63acfdb03f71cbe5b5728725e54a09b12d4e | [
"BSD-2-Clause"
] | null | null | null | #/bin/python
#功能
import sys
sys.exit()
| 5.25 | 12 | 0.642857 | 7 | 42 | 3.857143 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.190476 | 42 | 7 | 13 | 6 | 0.794118 | 0.309524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
1891311cf51aee0d5ca9587e77f1540d1271fdb6 | 45 | py | Python | focusnfe/core/__init__.py | jdcarvalho/python-focusnfe | c0769e6b4a5bf5123aba311cab7a6a0d4cfc5542 | [
"MIT"
] | 8 | 2019-11-19T14:40:39.000Z | 2020-03-12T19:03:37.000Z | focusnfe/core/__init__.py | devlarysson/python-focusnfe | ac452d92437e822b04cc73abe1e56d93da5f91c0 | [
"MIT"
] | 2 | 2020-03-20T00:01:10.000Z | 2021-06-02T00:41:31.000Z | focusnfe/core/__init__.py | devlarysson/python-focusnfe | ac452d92437e822b04cc73abe1e56d93da5f91c0 | [
"MIT"
] | 2 | 2020-03-13T13:37:47.000Z | 2021-03-02T21:58:40.000Z | from .base import *
from .exception import *
| 15 | 24 | 0.733333 | 6 | 45 | 5.5 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.177778 | 45 | 2 | 25 | 22.5 | 0.891892 | 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 |
18c19de7bfa3f93ff5c9c24fdea2c954878d21a2 | 156 | py | Python | coptic/ingest/tasks.py | lgessler/cts | c2db155b7b77f7eab8c07b7fa324b2bf05c59ec1 | [
"Apache-2.0"
] | 1 | 2021-12-10T08:36:02.000Z | 2021-12-10T08:36:02.000Z | coptic/ingest/tasks.py | lgessler/cts | c2db155b7b77f7eab8c07b7fa324b2bf05c59ec1 | [
"Apache-2.0"
] | null | null | null | coptic/ingest/tasks.py | lgessler/cts | c2db155b7b77f7eab8c07b7fa324b2bf05c59ec1 | [
"Apache-2.0"
] | null | null | null | import threading
from ingest.ingest import fetch_texts
def ingest_asynch( ingest_id ):
threading.Thread(target=fetch_texts, args=(ingest_id,)).start()
| 26 | 67 | 0.788462 | 22 | 156 | 5.363636 | 0.590909 | 0.169492 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.108974 | 156 | 5 | 68 | 31.2 | 0.848921 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.5 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
7a166c4d5d5d12670cec01255a8427a9cc2711bc | 2,575 | py | Python | qa/qa_process.py | JinkelaCrops/t2t-learning | 5d9b5a5164af763c24f1cbce9d97561e9f2b772c | [
"Apache-2.0"
] | 5 | 2019-03-28T03:52:32.000Z | 2021-02-24T07:09:26.000Z | qa/qa_process.py | JinkelaCrops/t2t-learning | 5d9b5a5164af763c24f1cbce9d97561e9f2b772c | [
"Apache-2.0"
] | null | null | null | qa/qa_process.py | JinkelaCrops/t2t-learning | 5d9b5a5164af763c24f1cbce9d97561e9f2b772c | [
"Apache-2.0"
] | 2 | 2018-08-07T03:43:09.000Z | 2019-12-09T06:41:40.000Z | import re
sep = "\t"
def set_intersection(s1, s2):
return list(set(s1) - (set(s1) - set(s2)))
def compare(src, tgt):
bi_1 = src + sep + tgt
bi_2 = tgt + sep + src
fd_1 = re.findall("(.+)(?=.*%s.*\\1)" % sep, bi_1)
fd_2 = re.findall("(.+)(?=.*%s.*\\1)" % sep, bi_2)
fd = set_intersection(fd_1, fd_2)
output_src = src
output_tgt = tgt
if len(fd) > 0:
fd_regex = "(" + "|".join([re.escape(x) for x in fd]) + ")"
output_src = re.sub(fd_regex, "<tag>\\1</tag>", output_src)
output_tgt = re.sub(fd_regex, "<tag>\\1</tag>", output_tgt)
return output_src, output_tgt
def compare_get_words(src, tgt):
bi_1 = src + sep + tgt
bi_2 = tgt + sep + src
fd_1 = re.findall("(.+)(?=.*%s.*\\1)" % sep, bi_1)
fd_2 = re.findall("(.+)(?=.*%s.*\\1)" % sep, bi_2)
fd = set_intersection(fd_1, fd_2)
return fd
# prefix = '/media/tmxmall/a36811aa-0e87-4ba1-b14f-370134452449'
# with open(f"{prefix}/t2t_med/mynmt/data/medicine.sample.txt/medicine.sample.txt.zh", "r", encoding="utf8") as f:
# src_lines = [x.strip() for x in f.readlines()]
#
# with open(f"{prefix}/t2t_med/mynmt/data/medicine.sample.txt/medicine.sample.txt.en", "r", encoding="utf8") as f:
# tgt_lines = [x.strip() for x in f.readlines()]
#
# output_src_lines = []
# output_tgt_lines = []
# for k, (src, tgt) in enumerate(zip(src_lines, tgt_lines)):
# output_src, output_tgt = compare(src, tgt)
# output_src_lines.append(output_src + "\n")
# output_tgt_lines.append(output_tgt + "\n")
# if k % 10 == 10 - 1:
# print("processing %s" % (k + 1))
#
# with open(f"{prefix}/t2t_med/mynmt/data/medicine.sample.txt/medicine.sample.txt.zh.tag", "w", encoding="utf8") as f:
# f.writelines(output_src_lines)
#
# with open(f"{prefix}/t2t_med/mynmt/data/medicine.sample.txt/medicine.sample.txt.en.tag", "w", encoding="utf8") as f:
# f.writelines(output_tgt_lines)
prefix = '/media/tmxmall/a36811aa-0e87-4ba1-b14f-370134452449'
with open(f"{prefix}/t2t_med/mynmt/data/medicine.sample.txt/medicine.sample.txt.zh", "r", encoding="utf8") as f:
src_lines = [x.strip() for x in f.readlines()]
with open(f"{prefix}/t2t_med/mynmt/data/medicine.sample.txt/medicine.sample.txt.en", "r", encoding="utf8") as f:
tgt_lines = [x.strip() for x in f.readlines()]
output_words = []
for k, (src, tgt) in enumerate(zip(src_lines, tgt_lines)):
words = compare_get_words(src, tgt)
output_words += words
if k % 10 == 10 - 1:
print("processing %s" % (k + 1))
print(sorted(list(set(output_words))))
| 34.333333 | 118 | 0.624078 | 416 | 2,575 | 3.701923 | 0.173077 | 0.109091 | 0.132468 | 0.058442 | 0.758442 | 0.735065 | 0.735065 | 0.735065 | 0.702597 | 0.655844 | 0 | 0.047103 | 0.175534 | 2,575 | 74 | 119 | 34.797297 | 0.678285 | 0.389903 | 0 | 0.277778 | 0 | 0.055556 | 0.203357 | 0.123305 | 0.027778 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0.027778 | 0.027778 | 0.194444 | 0.055556 | 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 |
e130b4c9de5d6be3972b70ac86b2b0836cf66e0a | 182 | py | Python | StaticRotor.py | cristian-tamblay/EnigmaMachine | 0db12806915ce28f9d345ce2dca3a5924e6e742f | [
"MIT"
] | null | null | null | StaticRotor.py | cristian-tamblay/EnigmaMachine | 0db12806915ce28f9d345ce2dca3a5924e6e742f | [
"MIT"
] | null | null | null | StaticRotor.py | cristian-tamblay/EnigmaMachine | 0db12806915ce28f9d345ce2dca3a5924e6e742f | [
"MIT"
] | null | null | null | class StaticRotor:
def __init__(self):
self.permutation = list(range(0, 27)) # Identidad
def cipher(self, plainLetter):
return self.permutation[plainLetter]
| 26 | 57 | 0.675824 | 20 | 182 | 5.95 | 0.7 | 0.252101 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021127 | 0.21978 | 182 | 6 | 58 | 30.333333 | 0.816901 | 0.049451 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0.2 | 0.8 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 5 |
e14b2d305a8bf55212899537d0d19a228ec9c44d | 241 | py | Python | build_automation/content_management/apps.py | mattjurenka/DLMS | 0a69796b1b9940b37ee4ea7bc375a41dd63ec817 | [
"MIT"
] | 2 | 2018-08-02T23:38:32.000Z | 2019-12-20T10:54:37.000Z | build_automation/content_management/apps.py | mattjurenka/DLMS | 0a69796b1b9940b37ee4ea7bc375a41dd63ec817 | [
"MIT"
] | 28 | 2018-02-23T21:20:31.000Z | 2018-05-02T22:38:31.000Z | build_automation/content_management/apps.py | mattjurenka/DLMS | 0a69796b1b9940b37ee4ea7bc375a41dd63ec817 | [
"MIT"
] | 3 | 2019-11-16T03:54:48.000Z | 2021-09-10T18:53:20.000Z | from django.apps import AppConfig
class ContentManagementConfig(AppConfig):
name = 'content_management'
verbose_name = 'Content Management'
def ready(self):
import content_management.signals # noqa: F401
pass
| 21.909091 | 55 | 0.713693 | 25 | 241 | 6.76 | 0.72 | 0.301775 | 0.248521 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015957 | 0.219917 | 241 | 10 | 56 | 24.1 | 0.882979 | 0.041494 | 0 | 0 | 0 | 0 | 0.157205 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0.142857 | 0.285714 | 0 | 0.857143 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 5 |
e15fee3ad4b826314d122f4024abea7d663cb496 | 61 | py | Python | pyabeles/__init__.py | MiroFurtado/pyabeles | c6de027c3bbd44c213cdf571c091c7b64a250820 | [
"Apache-2.0"
] | null | null | null | pyabeles/__init__.py | MiroFurtado/pyabeles | c6de027c3bbd44c213cdf571c091c7b64a250820 | [
"Apache-2.0"
] | null | null | null | pyabeles/__init__.py | MiroFurtado/pyabeles | c6de027c3bbd44c213cdf571c091c7b64a250820 | [
"Apache-2.0"
] | null | null | null | from .core import Layer, Scanner, Surface, Experiment, Fitter | 61 | 61 | 0.803279 | 8 | 61 | 6.125 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114754 | 61 | 1 | 61 | 61 | 0.907407 | 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 |
e181786b0bca092779c6bcb3492c40b0806094b4 | 1,670 | py | Python | openprocurement/bridge/rbot/defaults.py | openprocurement/openprocurement.bridge.rbot | 32d362287df2f3a3e186b838d6c8fa39a007c452 | [
"Apache-2.0"
] | null | null | null | openprocurement/bridge/rbot/defaults.py | openprocurement/openprocurement.bridge.rbot | 32d362287df2f3a3e186b838d6c8fa39a007c452 | [
"Apache-2.0"
] | null | null | null | openprocurement/bridge/rbot/defaults.py | openprocurement/openprocurement.bridge.rbot | 32d362287df2f3a3e186b838d6c8fa39a007c452 | [
"Apache-2.0"
] | 1 | 2021-01-19T14:29:24.000Z | 2021-01-19T14:29:24.000Z | config = {
"worker_type": "contracting",
"client_inc_step_timeout": 0.1,
"client_dec_step_timeout": 0.02,
"drop_threshold_client_cookies": 2,
"worker_sleep": 5,
"retry_default_timeout": 3,
"retries_count": 10,
"queue_timeout": 3,
"bulk_save_limit": 100,
"bulk_save_interval": 3,
"resources_api_token": "",
"resources_api_version": "",
"public_resources_api_server": "",
"input_resources_api_server": "",
"input_public_resources_api_server": "",
"input_resource": "tenders",
"output_resources_api_server": "",
"output_public_resources_api_server": "",
"output_resource": "tenders",
"handler_rBot": {
"resources_api_token": "",
"output_resources_api_token": "",
"resources_api_version": "",
"input_resources_api_token": "",
"input_resources_api_server": "",
"input_public_resources_api_server": "",
"input_resource": "tenders",
"output_resources_api_server": "",
"output_public_resources_api_server": "",
"output_resource": "tenders",
'webreneder_url': 'http://localhost:8080'
}
}
CONFIG_MAPPING = {
"input_resources_api_token": "resources_api_token",
"output_resources_api_token": "resources_api_token",
"resources_api_version": "resources_api_version",
"input_resources_api_server": "resources_api_server",
"input_public_resources_api_server": "public_resources_api_server",
"input_resource": "resource",
"output_resource": "resource",
"output_resources_api_server": "resources_api_server",
"output_public_resources_api_server": "public_resources_api_server"
}
| 35.531915 | 71 | 0.683234 | 181 | 1,670 | 5.690608 | 0.265193 | 0.337864 | 0.297087 | 0.209709 | 0.717476 | 0.694175 | 0.525243 | 0.525243 | 0.386408 | 0.285437 | 0 | 0.013848 | 0.178443 | 1,670 | 46 | 72 | 36.304348 | 0.73688 | 0 | 0 | 0.355556 | 0 | 0 | 0.664671 | 0.432934 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
e1a99cefafd7ee90eacf42e733abd408452e8076 | 34 | py | Python | firmware/eppenwolf/protocols/pulse_1.py | 0xDBFB7/covidinator | e9c103e5e62bc128169400998df5f5cd13bd8949 | [
"MIT"
] | null | null | null | firmware/eppenwolf/protocols/pulse_1.py | 0xDBFB7/covidinator | e9c103e5e62bc128169400998df5f5cd13bd8949 | [
"MIT"
] | null | null | null | firmware/eppenwolf/protocols/pulse_1.py | 0xDBFB7/covidinator | e9c103e5e62bc128169400998df5f5cd13bd8949 | [
"MIT"
] | null | null | null | import device_comms
import sweep
| 8.5 | 19 | 0.852941 | 5 | 34 | 5.6 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147059 | 34 | 3 | 20 | 11.333333 | 0.965517 | 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 |
e1b0a1339b1f07acaee66dead5639ec23ca8ee22 | 74 | py | Python | shops/__init__.py | tinnuadan/redcogs | 7a3cf31e39a7a024e6ee0faf68c9ca7943dfce3e | [
"MIT"
] | 1 | 2020-09-14T06:43:03.000Z | 2020-09-14T06:43:03.000Z | shops/__init__.py | tinnuadan/redcogs | 7a3cf31e39a7a024e6ee0faf68c9ca7943dfce3e | [
"MIT"
] | null | null | null | shops/__init__.py | tinnuadan/redcogs | 7a3cf31e39a7a024e6ee0faf68c9ca7943dfce3e | [
"MIT"
] | null | null | null | from .src.cog import ShopsCog
def setup(bot):
bot.add_cog(ShopsCog()) | 18.5 | 29 | 0.716216 | 12 | 74 | 4.333333 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148649 | 74 | 4 | 30 | 18.5 | 0.825397 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
e1b8024413494418275956522cc5e23a6adef03f | 54 | py | Python | blogmods/__init__.py | stonescar/multi-user-blog | a402dafde1f7d94031129638aa072ce39223e80e | [
"MIT"
] | null | null | null | blogmods/__init__.py | stonescar/multi-user-blog | a402dafde1f7d94031129638aa072ce39223e80e | [
"MIT"
] | null | null | null | blogmods/__init__.py | stonescar/multi-user-blog | a402dafde1f7d94031129638aa072ce39223e80e | [
"MIT"
] | null | null | null | import models
import handlers
import utils
import seq
| 10.8 | 15 | 0.851852 | 8 | 54 | 5.75 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148148 | 54 | 4 | 16 | 13.5 | 1 | 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 |
e1cf3b454d904f76a9080bc8ea7f61f6e340b810 | 151 | py | Python | backend/home/models.py | crowdbotics-dev/testappauto20-dev-23504 | 39f2855f3e3331c8b0b24440a97d46beb45e4ebf | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | backend/home/models.py | crowdbotics-dev/testappauto20-dev-23504 | 39f2855f3e3331c8b0b24440a97d46beb45e4ebf | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | backend/home/models.py | crowdbotics-dev/testappauto20-dev-23504 | 39f2855f3e3331c8b0b24440a97d46beb45e4ebf | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | from django.conf import settings
from django.db import models
class Home(models.Model):
"Generated Model"
address = models.BigIntegerField()
| 18.875 | 38 | 0.754967 | 19 | 151 | 6 | 0.684211 | 0.175439 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.165563 | 151 | 7 | 39 | 21.571429 | 0.904762 | 0.099338 | 0 | 0 | 1 | 0 | 0.099338 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
bed71fd8016082e3880af522bcd129efb392c5ab | 420 | py | Python | pythia/pyre/templates/__init__.py | willic3/pythia | 2657b95a0c07fd3c914ab6b5f7ec89a8edba004c | [
"BSD-3-Clause"
] | 1 | 2015-11-30T08:01:39.000Z | 2015-11-30T08:01:39.000Z | pythia/pyre/templates/__init__.py | willic3/pythia | 2657b95a0c07fd3c914ab6b5f7ec89a8edba004c | [
"BSD-3-Clause"
] | 27 | 2018-05-24T18:31:25.000Z | 2021-10-16T03:57:52.000Z | pythia/pyre/templates/__init__.py | willic3/pythia | 2657b95a0c07fd3c914ab6b5f7ec89a8edba004c | [
"BSD-3-Clause"
] | 7 | 2019-07-19T02:30:56.000Z | 2021-06-02T22:00:01.000Z | #!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# California Institute of Technology
# (C) 2006 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
def codecTmpl():
from .CodecTmpl import CodecTmpl
return CodecTmpl()
# end of file
| 20 | 80 | 0.340476 | 25 | 420 | 5.72 | 0.84 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012308 | 0.22619 | 420 | 20 | 81 | 21 | 0.427692 | 0.745238 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | true | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
83174af768e3c75af1a08cd95d27fd309be1c6a0 | 154 | py | Python | flask/app/views.py | Rohitkuru/applicationflask | 8137d67222e0cf72a5594ad6c3fd17bee19abe87 | [
"MIT"
] | null | null | null | flask/app/views.py | Rohitkuru/applicationflask | 8137d67222e0cf72a5594ad6c3fd17bee19abe87 | [
"MIT"
] | null | null | null | flask/app/views.py | Rohitkuru/applicationflask | 8137d67222e0cf72a5594ad6c3fd17bee19abe87 | [
"MIT"
] | null | null | null | #!/app/flask/env/bin/python3
from app import *
import os
@app.route("/",methods=['POST','GET'])
def index():
return render_template("index.html")
| 14 | 40 | 0.662338 | 22 | 154 | 4.590909 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007463 | 0.12987 | 154 | 10 | 41 | 15.4 | 0.746269 | 0.175325 | 0 | 0 | 0 | 0 | 0.144 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | true | 0 | 0.4 | 0.2 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 5 |
832f776fff38684bb04d25267d808ce9fe7cd58b | 123 | py | Python | tests/utils.py | codingbeast/webdriver_manager | ec1e1278d18dfdb49e2489b0117018a4dd326031 | [
"Apache-2.0"
] | 670 | 2016-12-27T14:33:12.000Z | 2022-03-31T05:56:15.000Z | tests/utils.py | codingbeast/webdriver_manager | ec1e1278d18dfdb49e2489b0117018a4dd326031 | [
"Apache-2.0"
] | 318 | 2016-12-29T07:11:08.000Z | 2022-03-31T22:26:08.000Z | tests/utils.py | codingbeast/webdriver_manager | ec1e1278d18dfdb49e2489b0117018a4dd326031 | [
"Apache-2.0"
] | 150 | 2016-12-27T12:50:00.000Z | 2022-03-31T05:58:27.000Z | import os
project_root = os.path.dirname(os.path.dirname(__file__))
driver_directory = f"{project_root}{os.sep}.drivers"
| 20.5 | 57 | 0.772358 | 19 | 123 | 4.631579 | 0.631579 | 0.25 | 0.295455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.081301 | 123 | 5 | 58 | 24.6 | 0.778761 | 0 | 0 | 0 | 0 | 0 | 0.243902 | 0.243902 | 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 |
55d260b061f6368fe3b5750ee850bfb859264b1d | 77 | py | Python | modules/keras/backend/backend_main.py | jawahar273/scaling-in-python | 47a96e17facf4d092ca52eeb4ccd812a2cad45d4 | [
"MIT"
] | null | null | null | modules/keras/backend/backend_main.py | jawahar273/scaling-in-python | 47a96e17facf4d092ca52eeb4ccd812a2cad45d4 | [
"MIT"
] | null | null | null | modules/keras/backend/backend_main.py | jawahar273/scaling-in-python | 47a96e17facf4d092ca52eeb4ccd812a2cad45d4 | [
"MIT"
] | null | null | null |
def first():
print( (10 * 10) )
def second():
print( ( 20 * 20 ) )
| 9.625 | 24 | 0.454545 | 10 | 77 | 3.5 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.156863 | 0.337662 | 77 | 7 | 25 | 11 | 0.529412 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | true | 0 | 0 | 0 | 0.5 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
55d7efbbe5b4aa4d19e877e4dc51bfeb91e65240 | 210 | py | Python | ecosante/utils/tests.py | betagouv/recosante-api | 4560b2cf2ff4dc19597792fe15a3805f6259201d | [
"MIT"
] | 3 | 2021-09-24T14:07:51.000Z | 2021-12-14T13:48:34.000Z | ecosante/utils/tests.py | betagouv/recosante-api | 4560b2cf2ff4dc19597792fe15a3805f6259201d | [
"MIT"
] | 187 | 2021-03-25T16:43:49.000Z | 2022-03-23T14:40:31.000Z | ecosante/utils/tests.py | betagouv/recosante-api | 4560b2cf2ff4dc19597792fe15a3805f6259201d | [
"MIT"
] | null | null | null | from ecosante.recommandations.models import Recommandation
def published_recommandation(**kw):
kw.setdefault('type_', 'indice_atmo')
kw.setdefault('status', 'published')
return Recommandation(**kw) | 35 | 58 | 0.757143 | 22 | 210 | 7.090909 | 0.681818 | 0.205128 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114286 | 210 | 6 | 59 | 35 | 0.83871 | 0 | 0 | 0 | 0 | 0 | 0.146919 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | true | 0 | 0.2 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 5 |
55fbc81565e9b38105caafcd7718fe7a87bd688b | 181 | py | Python | deduplipy/blocking/__init__.py | sbrugman/deduplipy | 871bc69409a30f097642a6f798f51c39663ca7f7 | [
"MIT"
] | null | null | null | deduplipy/blocking/__init__.py | sbrugman/deduplipy | 871bc69409a30f097642a6f798f51c39663ca7f7 | [
"MIT"
] | null | null | null | deduplipy/blocking/__init__.py | sbrugman/deduplipy | 871bc69409a30f097642a6f798f51c39663ca7f7 | [
"MIT"
] | null | null | null | from .blocking import Blocking
from .blocking_rules import all_rules
from .set_cover import greedy_set_cover
__all__ = [
"Blocking",
"greedy_set_cover",
"all_rules",
]
| 18.1 | 39 | 0.740331 | 24 | 181 | 5.083333 | 0.333333 | 0.196721 | 0.229508 | 0.278689 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176796 | 181 | 9 | 40 | 20.111111 | 0.818792 | 0 | 0 | 0 | 0 | 0 | 0.18232 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.375 | 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 |
55fdad9fb7c7429cae6c299634a63836f90a228e | 58 | py | Python | WangWangBot/handlers/users/__init__.py | seekdoor/WangWangBot | e0a54da5107e6d005019e5adad3e5c53327b75fc | [
"MIT"
] | 57 | 2021-08-11T16:07:25.000Z | 2022-01-29T07:44:42.000Z | WangWangBot/handlers/users/__init__.py | seekdoor/WangWangBot | e0a54da5107e6d005019e5adad3e5c53327b75fc | [
"MIT"
] | 11 | 2021-08-06T15:28:52.000Z | 2021-09-26T13:05:17.000Z | WangWangBot/handlers/users/__init__.py | seekdoor/WangWangBot | e0a54da5107e6d005019e5adad3e5c53327b75fc | [
"MIT"
] | 9 | 2021-08-18T08:44:03.000Z | 2021-08-24T02:14:08.000Z | from . import help
from . import start
from . import admin | 19.333333 | 19 | 0.758621 | 9 | 58 | 4.888889 | 0.555556 | 0.681818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.189655 | 58 | 3 | 20 | 19.333333 | 0.93617 | 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 |
36077665a795801eac5f3a74c09853d090f15ad2 | 144 | py | Python | deepgp/models/__init__.py | LBJ-Wade/PyDeepGP | f2a1f568a7462633a58ed433520dcf7f0c98515c | [
"BSD-3-Clause"
] | 201 | 2017-02-22T20:13:12.000Z | 2022-03-16T13:20:30.000Z | deepgp/models/__init__.py | LBJ-Wade/PyDeepGP | f2a1f568a7462633a58ed433520dcf7f0c98515c | [
"BSD-3-Clause"
] | 23 | 2017-03-27T18:41:56.000Z | 2021-06-28T03:05:07.000Z | deepgp/models/__init__.py | LBJ-Wade/PyDeepGP | f2a1f568a7462633a58ed433520dcf7f0c98515c | [
"BSD-3-Clause"
] | 59 | 2017-03-24T12:45:14.000Z | 2022-03-02T05:13:21.000Z | # Copyright (c) 2015-2016, the authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
from .model import DeepGP | 36 | 59 | 0.75 | 23 | 144 | 4.695652 | 0.782609 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.073171 | 0.145833 | 144 | 4 | 60 | 36 | 0.804878 | 0.784722 | 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 |
3614c0a9187487b8da22d43d1bb2b457818f9641 | 198 | py | Python | qr_code/urls.py | HackRoboy/CoinBoy | 5e10e763fe2e1e492f733fdf2531c77f13cef3a4 | [
"BSD-3-Clause"
] | null | null | null | qr_code/urls.py | HackRoboy/CoinBoy | 5e10e763fe2e1e492f733fdf2531c77f13cef3a4 | [
"BSD-3-Clause"
] | null | null | null | qr_code/urls.py | HackRoboy/CoinBoy | 5e10e763fe2e1e492f733fdf2531c77f13cef3a4 | [
"BSD-3-Clause"
] | null | null | null | from django.conf.urls import url
from qr_code import views
app_name = 'qr_code'
urlpatterns = [
url(r'^images/serve_qr_code_image/$', views.serve_qr_code_image, name='serve_qr_code_image')
]
| 19.8 | 96 | 0.762626 | 33 | 198 | 4.212121 | 0.484848 | 0.215827 | 0.23741 | 0.345324 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126263 | 198 | 9 | 97 | 22 | 0.803468 | 0 | 0 | 0 | 0 | 0 | 0.277778 | 0.146465 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
36482c5301ce8562075cc644a026360bb1d1137f | 3,168 | py | Python | app/update/result_test.py | limshengli/tinypilot | aeba23e2e108008bea2b7577f16cfef949238648 | [
"MIT"
] | 1,334 | 2020-07-14T01:53:02.000Z | 2021-06-08T09:48:28.000Z | app/update/result_test.py | limshengli/tinypilot | aeba23e2e108008bea2b7577f16cfef949238648 | [
"MIT"
] | 320 | 2020-07-07T20:18:05.000Z | 2021-06-07T21:18:42.000Z | app/update/result_test.py | limshengli/tinypilot | aeba23e2e108008bea2b7577f16cfef949238648 | [
"MIT"
] | 124 | 2020-07-23T16:39:06.000Z | 2021-06-04T10:22:53.000Z | import datetime
import io
import unittest
import update.result
class UpdateResultTest(unittest.TestCase):
def test_reads_correct_values_for_successful_result(self):
self.assertEqual(
update.result.Result(
error=None,
timestamp=datetime.datetime(2021,
2,
10,
8,
57,
35,
tzinfo=datetime.timezone.utc),
),
update.result.read(
io.StringIO("""
{
"error": null,
"timestamp": "2021-02-10T085735Z"
}
""")))
def test_reads_correct_values_for_failed_result(self):
self.assertEqual(
update.result.Result(
error='dummy update error',
timestamp=datetime.datetime(2021,
2,
10,
8,
57,
35,
tzinfo=datetime.timezone.utc),
),
update.result.read(
io.StringIO("""
{
"error": "dummy update error",
"timestamp": "2021-02-10T085735Z"
}
""")))
def test_reads_default_values_for_empty_dict(self):
self.assertEqual(
update.result.Result(
error=None,
timestamp=datetime.datetime.utcfromtimestamp(0),
), update.result.read(io.StringIO('{}')))
def test_writes_success_result_accurately(self):
mock_file = io.StringIO()
update.result.write(
update.result.Result(
error=None,
timestamp=datetime.datetime(2021,
2,
10,
8,
57,
35,
tzinfo=datetime.timezone.utc),
), mock_file)
self.assertEqual(('{"error": null, "timestamp": "2021-02-10T085735Z"}'),
mock_file.getvalue())
def test_writes_error_result_accurately(self):
mock_file = io.StringIO()
update.result.write(
update.result.Result(
error='dummy update error',
timestamp=datetime.datetime(2021,
2,
10,
8,
57,
35,
tzinfo=datetime.timezone.utc),
), mock_file)
self.assertEqual(('{"error": "dummy update error", '
'"timestamp": "2021-02-10T085735Z"}'),
mock_file.getvalue())
| 35.595506 | 80 | 0.383207 | 217 | 3,168 | 5.447005 | 0.225806 | 0.111675 | 0.076142 | 0.097293 | 0.841794 | 0.819797 | 0.775804 | 0.686125 | 0.590525 | 0.590525 | 0 | 0.07109 | 0.533775 | 3,168 | 88 | 81 | 36 | 0.729181 | 0 | 0 | 0.7375 | 0 | 0 | 0.090278 | 0.013258 | 0 | 0 | 0 | 0 | 0.0625 | 1 | 0.0625 | false | 0 | 0.05 | 0 | 0.125 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
36b4b0604cf3d976ba7f61fa6dd17c31a2914e99 | 941 | py | Python | venv/Lib/site-packages/tensorflow/keras/__init__.py | caiovini/Image_reader_api | 7fae630a17195d3415eb739278ef21a3b58cae76 | [
"MIT"
] | null | null | null | venv/Lib/site-packages/tensorflow/keras/__init__.py | caiovini/Image_reader_api | 7fae630a17195d3415eb739278ef21a3b58cae76 | [
"MIT"
] | null | null | null | venv/Lib/site-packages/tensorflow/keras/__init__.py | caiovini/Image_reader_api | 7fae630a17195d3415eb739278ef21a3b58cae76 | [
"MIT"
] | null | null | null | # This file is MACHINE GENERATED! Do not edit.
# Generated by: tensorflow/tools/api/generator/create_python_api.py script.
"""Implementation of the Keras API meant to be a high-level API for TensorFlow.
Detailed documentation and user guides are available at
[keras.io](https://keras.io).
"""
from __future__ import print_function
from . import activations
from . import applications
from . import backend
from . import callbacks
from . import constraints
from . import datasets
from . import estimator
from . import initializers
from . import layers
from . import losses
from . import metrics
from . import models
from . import optimizers
from . import preprocessing
from . import regularizers
from . import utils
from . import wrappers
from tensorflow.python.keras import Input
from tensorflow.python.keras import Model
from tensorflow.python.keras import Sequential
from tensorflow.python.keras import __version__
del print_function
| 26.885714 | 79 | 0.802338 | 129 | 941 | 5.75969 | 0.503876 | 0.228802 | 0.107672 | 0.13459 | 0.166891 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140276 | 941 | 34 | 80 | 27.676471 | 0.918418 | 0.300744 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.956522 | 0 | 0.956522 | 0.086957 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
36b6486d7762d9a97bfb98a1bdf609c51d90ae75 | 50 | py | Python | evo_gym/envs/atari/__init__.py | SamuelSchmidgall/EvolutionarySelfReplication | 1a6f8225378b59423a97b439b56710bbed2754e9 | [
"MIT"
] | 12 | 2021-08-19T22:15:26.000Z | 2022-03-27T20:31:40.000Z | evo_gym/envs/atari/__init__.py | SamuelSchmidgall/EvolutionarySelfReplication | 1a6f8225378b59423a97b439b56710bbed2754e9 | [
"MIT"
] | null | null | null | evo_gym/envs/atari/__init__.py | SamuelSchmidgall/EvolutionarySelfReplication | 1a6f8225378b59423a97b439b56710bbed2754e9 | [
"MIT"
] | null | null | null | from evo_gym.envs.atari.atari_env import AtariEnv
| 25 | 49 | 0.86 | 9 | 50 | 4.555556 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.08 | 50 | 1 | 50 | 50 | 0.891304 | 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 |
36d38aa41e7836253332c4df33b45ab200b7030e | 90 | py | Python | pyelexon/exceptions.py | atsangarides/pyelexon | fbaa1a8c7e7dcd8b9f75413d7dfb76c148433039 | [
"MIT"
] | null | null | null | pyelexon/exceptions.py | atsangarides/pyelexon | fbaa1a8c7e7dcd8b9f75413d7dfb76c148433039 | [
"MIT"
] | null | null | null | pyelexon/exceptions.py | atsangarides/pyelexon | fbaa1a8c7e7dcd8b9f75413d7dfb76c148433039 | [
"MIT"
] | null | null | null | class InvalidApiKey(Exception):
pass
class UnsuccessfulRequest(Exception):
pass
| 12.857143 | 37 | 0.755556 | 8 | 90 | 8.5 | 0.625 | 0.382353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.177778 | 90 | 6 | 38 | 15 | 0.918919 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
36dac338fdf69057e87baf28daca33b9a4ec09cc | 28 | py | Python | bbpyp/test/test_context.py | BloggerBust/bbpyp | 078f940dd38bc3ee7c5adcfb2555c2843a4ca57b | [
"Apache-2.0"
] | null | null | null | bbpyp/test/test_context.py | BloggerBust/bbpyp | 078f940dd38bc3ee7c5adcfb2555c2843a4ca57b | [
"Apache-2.0"
] | null | null | null | bbpyp/test/test_context.py | BloggerBust/bbpyp | 078f940dd38bc3ee7c5adcfb2555c2843a4ca57b | [
"Apache-2.0"
] | null | null | null | class TestContext:
pass
| 9.333333 | 18 | 0.714286 | 3 | 28 | 6.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 28 | 2 | 19 | 14 | 0.952381 | 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 |
36f943429ecbd011b9b02aaba0294be00a318dee | 13,632 | py | Python | tests/test_outlier_handler.py | kartikra/mlshark | 9ce6fb856c04486eab1d617681bdd01b856ad003 | [
"BSD-3-Clause"
] | null | null | null | tests/test_outlier_handler.py | kartikra/mlshark | 9ce6fb856c04486eab1d617681bdd01b856ad003 | [
"BSD-3-Clause"
] | null | null | null | tests/test_outlier_handler.py | kartikra/mlshark | 9ce6fb856c04486eab1d617681bdd01b856ad003 | [
"BSD-3-Clause"
] | null | null | null | # Authors: Kartik Ramasubramanian <r.kartik@berkeley.edu>
# License: BSD 3 clause
import pytest
import numpy as np
import pandas as pd
from sklearn.exceptions import NotFittedError
from mlshark.feature_builder.outlier_removers import Winsorizer, ArbitraryOutlierCapper, OutlierTrimmer
def test_Windsorizer(dataframe_normal_dist, dataframe_na, dataframe_vartypes):
# test case 1: mean and std, right tail
transformer = Winsorizer(distribution='gaussian', tail='right', fold=1)
X = transformer.fit_transform(dataframe_normal_dist)
df_transf = dataframe_normal_dist.copy()
df_transf['var'] = np.where(df_transf['var'] > 0.10727677848029868, 0.10727677848029868, df_transf['var'])
# init params
assert transformer.distribution == 'gaussian'
assert transformer.tail == 'right'
assert transformer.fold == 1
# fit params
assert transformer.right_tail_caps_ == {'var': 0.10727677848029868}
# assert round(transformer.right_tail_caps_['var'], 8) == round(0.10727677848029868, 8)
assert transformer.left_tail_caps_ == {}
assert transformer.input_shape_ == (100, 1)
# transform params
pd.testing.assert_frame_equal(X, df_transf)
assert X['var'].max() <= 0.10727677848029868
assert dataframe_normal_dist['var'].max() > 0.10727677848029868
# test case 2: mean and std, both tails, different fold value
transformer = Winsorizer(distribution='gaussian', tail='both', fold=2)
X = transformer.fit_transform(dataframe_normal_dist)
df_transf = dataframe_normal_dist.copy()
df_transf['var'] = np.where(df_transf['var'] > 0.20857275540714884, 0.20857275540714884, df_transf['var'])
df_transf['var'] = np.where(df_transf['var'] < -0.19661115230025186, -0.19661115230025186, df_transf['var'])
# fit params
assert transformer.right_tail_caps_ == {'var': 0.20857275540714884}
assert transformer.left_tail_caps_ == {'var': -0.19661115230025186}
# transform params
pd.testing.assert_frame_equal(X, df_transf)
assert X['var'].max() <= 0.20857275540714884
assert X['var'].min() >= -0.19661115230025186
assert dataframe_normal_dist['var'].max() > 0.20857275540714884
assert dataframe_normal_dist['var'].min() < -0.19661115230025186
# test case 3: IQR, both tails, fold 1
transformer = Winsorizer(distribution='skewed', tail='both', fold=1)
X = transformer.fit_transform(dataframe_normal_dist)
df_transf = dataframe_normal_dist.copy()
df_transf['var'] = np.where(df_transf['var'] > 0.21180113880445128, 0.21180113880445128, df_transf['var'])
df_transf['var'] = np.where(df_transf['var'] < -0.20247907173293223, -0.20247907173293223, df_transf['var'])
# fit params
assert transformer.right_tail_caps_ == {'var': 0.21180113880445128}
assert transformer.left_tail_caps_ == {'var': -0.20247907173293223}
# transform params
pd.testing.assert_frame_equal(X, df_transf)
assert X['var'].max() <= 0.21180113880445128
assert X['var'].min() >= -0.20247907173293223
assert dataframe_normal_dist['var'].max() > 0.21180113880445128
assert dataframe_normal_dist['var'].min() < -0.20247907173293223
# test case 4: IQR, left tail, fold 2
transformer = Winsorizer(distribution='skewed', tail='left', fold=0.8)
X = transformer.fit_transform(dataframe_normal_dist)
df_transf = dataframe_normal_dist.copy()
df_transf['var'] = np.where(df_transf['var'] < -0.17486039103044, -0.17486039103044, df_transf['var'])
# fit params
assert transformer.right_tail_caps_ == {}
assert transformer.left_tail_caps_ == {'var': -0.17486039103044}
# transform params
pd.testing.assert_frame_equal(X, df_transf)
assert X['var'].min() >= -0.17486039103044
assert dataframe_normal_dist['var'].min() < -0.17486039103044
# test case 5: quantiles, both tails, fold 10%
transformer = Winsorizer(distribution='quantiles', tail='both', fold=0.1)
X = transformer.fit_transform(dataframe_normal_dist)
df_transf = dataframe_normal_dist.copy()
df_transf['var'] = np.where(df_transf['var'] > 0.14712481122898166, 0.14712481122898166, df_transf['var'])
df_transf['var'] = np.where(df_transf['var'] < -0.12366227743232801, -0.12366227743232801, df_transf['var'])
# fit params
assert transformer.right_tail_caps_ == {'var': 0.14712481122898166}
assert transformer.left_tail_caps_ == {'var': -0.12366227743232801}
# transform params
pd.testing.assert_frame_equal(X, df_transf)
assert X['var'].max() <= 0.14712481122898166
assert X['var'].min() >= -0.12366227743232801
assert dataframe_normal_dist['var'].max() > 0.14712481122898166
assert dataframe_normal_dist['var'].min() < -0.12366227743232801
# test case 6: quantiles, right tail, fold 15%
transformer = Winsorizer(distribution='quantiles', tail='right', fold=0.15)
X = transformer.fit_transform(dataframe_normal_dist)
df_transf = dataframe_normal_dist.copy()
df_transf['var'] = np.where(df_transf['var'] > 0.11823196128033647, 0.11823196128033647, df_transf['var'])
# fit params
assert transformer.right_tail_caps_ == {'var': 0.11823196128033647}
assert transformer.left_tail_caps_ == {}
# transform params
pd.testing.assert_frame_equal(X, df_transf)
assert X['var'].max() <= 0.11823196128033647
assert dataframe_normal_dist['var'].max() > 0.11823196128033647
# test case 7: dataset contains na and transformer is asked to ignore them
transformer = Winsorizer(distribution='gaussian', tail='right', fold=1,
variables=['Age', 'Marks'],
missing_values='ignore')
X = transformer.fit_transform(dataframe_na)
df_transf = dataframe_na.copy()
df_transf['Age'] = np.where(df_transf['Age'] > 38.79255087111844, 38.79255087111844, df_transf['Age'])
df_transf['Marks'] = np.where(df_transf['Marks'] > 0.8970309389976613, 0.8970309389976613, df_transf['Marks'])
# fit params
assert transformer.right_tail_caps_ == {'Age': 38.79255087111844, 'Marks': 0.8970309389976613}
assert transformer.left_tail_caps_ == {}
assert transformer.input_shape_ == (8, 6)
# transform params
pd.testing.assert_frame_equal(X, df_transf)
assert X['Age'].max() <= 38.79255087111844
assert dataframe_na['Age'].max() > 38.79255087111844
# test error raises
with pytest.raises(ValueError):
Winsorizer(distribution='other')
with pytest.raises(ValueError):
Winsorizer(tail='other')
with pytest.raises(ValueError):
Winsorizer(missing_values='other')
with pytest.raises(ValueError):
Winsorizer(fold=-1)
with pytest.raises(ValueError):
Winsorizer(distribution='quantiles', fold=0.3)
# test case 8: when dataset contains na, fit method
with pytest.raises(ValueError):
transformer = Winsorizer()
transformer.fit(dataframe_na)
# test case 9: when dataset contains na, transform method
with pytest.raises(ValueError):
transformer = Winsorizer()
transformer.fit(dataframe_vartypes)
transformer.transform(dataframe_na[['Name', 'City', 'Age', 'Marks', 'dob']])
with pytest.raises(NotFittedError):
transformer = Winsorizer()
transformer.transform(dataframe_vartypes)
def test_ArbitraryOutlierCapper(dataframe_normal_dist, dataframe_na, dataframe_vartypes):
# test case 1: right end capping
transformer = ArbitraryOutlierCapper(max_capping_dict={'var': 0.10727677848029868}, min_capping_dict=None)
X = transformer.fit_transform(dataframe_normal_dist)
df_transf = dataframe_normal_dist.copy()
df_transf['var'] = np.where(df_transf['var'] > 0.10727677848029868, 0.10727677848029868, df_transf['var'])
# init params
assert transformer.max_capping_dict == {'var': 0.10727677848029868}
assert transformer.min_capping_dict is None
assert transformer.variables == ['var']
# fit params
assert transformer.right_tail_caps_ == {'var': 0.10727677848029868}
assert transformer.left_tail_caps_ == {}
assert transformer.input_shape_ == (100, 1)
# transform params
pd.testing.assert_frame_equal(X, df_transf)
assert X['var'].max() <= 0.10727677848029868
assert dataframe_normal_dist['var'].max() > 0.10727677848029868
# test case 2: both tails
transformer = ArbitraryOutlierCapper(max_capping_dict={'var': 0.20857275540714884},
min_capping_dict={'var': -0.19661115230025186})
X = transformer.fit_transform(dataframe_normal_dist)
df_transf = dataframe_normal_dist.copy()
df_transf['var'] = np.where(df_transf['var'] > 0.20857275540714884, 0.20857275540714884, df_transf['var'])
df_transf['var'] = np.where(df_transf['var'] < -0.19661115230025186, -0.19661115230025186, df_transf['var'])
# fit params
assert transformer.right_tail_caps_ == {'var': 0.20857275540714884}
assert transformer.left_tail_caps_ == {'var': -0.19661115230025186}
# transform params
pd.testing.assert_frame_equal(X, df_transf)
assert X['var'].max() <= 0.20857275540714884
assert X['var'].min() >= -0.19661115230025186
assert dataframe_normal_dist['var'].max() > 0.20857275540714884
assert dataframe_normal_dist['var'].min() < -0.19661115230025186
# test case 3: left tail
transformer = ArbitraryOutlierCapper(max_capping_dict=None, min_capping_dict={'var': -0.17486039103044})
X = transformer.fit_transform(dataframe_normal_dist)
df_transf = dataframe_normal_dist.copy()
df_transf['var'] = np.where(df_transf['var'] < -0.17486039103044, -0.17486039103044, df_transf['var'])
# init param
assert transformer.max_capping_dict is None
assert transformer.min_capping_dict == {'var': -0.17486039103044}
# fit params
assert transformer.right_tail_caps_ == {}
assert transformer.left_tail_caps_ == {'var': -0.17486039103044}
# transform params
pd.testing.assert_frame_equal(X, df_transf)
assert X['var'].min() >= -0.17486039103044
assert dataframe_normal_dist['var'].min() < -0.17486039103044
# test case 4: dataset contains na and transformer is asked to ignore them
transformer = ArbitraryOutlierCapper(max_capping_dict=None, min_capping_dict={'Age': 20},
missing_values='ignore')
X = transformer.fit_transform(dataframe_na)
df_transf = dataframe_na.copy()
df_transf['Age'] = np.where(df_transf['Age'] < 20, 20, df_transf['Age'])
# fit params
assert transformer.max_capping_dict is None
assert transformer.min_capping_dict == {'Age': 20}
assert transformer.input_shape_ == (8, 6)
# transform params
pd.testing.assert_frame_equal(X, df_transf)
assert X['Age'].min() >= 20
assert dataframe_na['Age'].min() < 20
with pytest.raises(ValueError):
ArbitraryOutlierCapper(max_capping_dict='other')
with pytest.raises(ValueError):
ArbitraryOutlierCapper(min_capping_dict='other')
with pytest.raises(ValueError):
ArbitraryOutlierCapper(min_capping_dict=None, max_capping_dict=None)
with pytest.raises(ValueError):
ArbitraryOutlierCapper(missing_values='other')
df_na = dataframe_normal_dist.copy()
df_na.loc[1, 'var'] = np.nan
# test case 5: when dataset contains na, fit method
with pytest.raises(ValueError):
transformer = ArbitraryOutlierCapper(min_capping_dict={'var': -0.17486039103044})
transformer.fit(df_na)
# test case 6: when dataset contains na, transform method
with pytest.raises(ValueError):
transformer = ArbitraryOutlierCapper(min_capping_dict={'var': -0.17486039103044})
transformer.fit(dataframe_normal_dist)
transformer.transform(df_na)
with pytest.raises(NotFittedError):
transformer = ArbitraryOutlierCapper(min_capping_dict={'var': -0.17486039103044})
transformer.transform(dataframe_vartypes)
def test_OutlierTrimmer(dataframe_normal_dist, dataframe_na):
# test case 1: mean and std, right tail
transformer = OutlierTrimmer(distribution='gaussian', tail='right', fold=1)
X = transformer.fit_transform(dataframe_normal_dist)
df_transf = dataframe_normal_dist.copy()
outliers = np.where(df_transf['var'] > 0.10727677848029868, True, False)
df_transf = df_transf.loc[~outliers]
# transform params
pd.testing.assert_frame_equal(X, df_transf)
assert len(X) == 83
# test case 2: mean and std, both tails, different fold value
transformer = OutlierTrimmer(distribution='gaussian', tail='both', fold=2)
X = transformer.fit_transform(dataframe_normal_dist)
assert len(X) == 96
# test case 3: IQR, left tail, fold 2
transformer = OutlierTrimmer(distribution='skewed', tail='left', fold=0.8)
X = transformer.fit_transform(dataframe_normal_dist)
df_transf = dataframe_normal_dist.copy()
outliers = np.where(df_transf['var'] < -0.17486039103044, True, False)
df_transf = df_transf.loc[~outliers]
pd.testing.assert_frame_equal(X, df_transf)
assert len(X) == 98
# test case 4: dataset contains na, and transformer is asked to ignore
transformer = OutlierTrimmer(distribution='gaussian', tail='right', fold=1,
variables=['Age'], missing_values='ignore')
X = transformer.fit_transform(dataframe_na)
df_transf = dataframe_na.copy()
outliers = np.where(df_transf['Age'] > 38.79255087111844, True, False)
df_transf = df_transf.loc[~outliers]
pd.testing.assert_frame_equal(X, df_transf)
assert len(X) == 6
| 43.27619 | 114 | 0.70738 | 1,669 | 13,632 | 5.565009 | 0.081486 | 0.073213 | 0.083872 | 0.030685 | 0.83441 | 0.77078 | 0.718454 | 0.67022 | 0.650086 | 0.61854 | 0 | 0.138205 | 0.168794 | 13,632 | 314 | 115 | 43.414013 | 0.681493 | 0.105707 | 0 | 0.572139 | 0 | 0 | 0.046784 | 0 | 0 | 0 | 0 | 0 | 0.40796 | 1 | 0.014925 | false | 0 | 0.024876 | 0 | 0.039801 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
3d0a1f88032d2939321d0fd97811a667565569a9 | 845 | py | Python | uvicore/http/middleware/__init__.py | coboyoshi/uvicore | 9cfdeeac83000b156fe48f068b4658edaf51c8de | [
"MIT"
] | 11 | 2021-03-22T22:07:49.000Z | 2022-03-08T16:18:33.000Z | uvicore/http/middleware/__init__.py | coboyoshi/uvicore | 9cfdeeac83000b156fe48f068b4658edaf51c8de | [
"MIT"
] | 12 | 2021-03-04T05:51:24.000Z | 2021-09-22T05:16:18.000Z | uvicore/http/middleware/__init__.py | coboyoshi/uvicore | 9cfdeeac83000b156fe48f068b4658edaf51c8de | [
"MIT"
] | 2 | 2021-03-25T14:49:56.000Z | 2021-11-17T23:20:29.000Z | # Uvicore custom
from .authentication import Authentication
# Starlette passthrough via class proxy
from starlette.middleware.base import BaseHTTPMiddleware as _Base
from starlette.middleware.cors import CORSMiddleware as _CORS
from starlette.middleware.gzip import GZipMiddleware as _Gzip
from starlette.middleware.httpsredirect import HTTPSRedirectMiddleware as _HTTPSRedirect
from starlette.middleware.sessions import SessionMiddleware as _Session
from starlette.middleware.trustedhost import TrustedHostMiddleware as _TrustedHost
from starlette.middleware.wsgi import WSGIMiddleware as _WSGI
class Middleware(_Base):
pass
class CORS(_CORS):
pass
class Gzip(_Gzip):
pass
class HTTPSRedirect(_HTTPSRedirect):
pass
class Session(_Session):
pass
class TrustedHost(_TrustedHost):
pass
class WSGI(_WSGI):
pass
| 24.852941 | 88 | 0.821302 | 95 | 845 | 7.157895 | 0.294737 | 0.133824 | 0.236765 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133728 | 845 | 33 | 89 | 25.606061 | 0.928962 | 0.061538 | 0 | 0.318182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.318182 | 0.363636 | 0 | 0.681818 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 5 |
3d3d6d93e9bfa8ad173ccab65e24036ca118e0b0 | 43 | py | Python | gongda/0_Python_notes/2_matplotlib_notes.py | eamarais/eam-group | a9976092a9b7d4cad6035b8965e82cf6ef12f321 | [
"MIT"
] | 3 | 2020-04-01T14:31:23.000Z | 2020-04-22T08:13:19.000Z | gongda/0_Python_notes/2_matplotlib_notes.py | eamarais/eam-group | a9976092a9b7d4cad6035b8965e82cf6ef12f321 | [
"MIT"
] | 2 | 2020-05-28T12:12:57.000Z | 2020-06-25T19:34:23.000Z | gongda/0_Python_notes/2_matplotlib_notes.py | eamarais/eam-group | a9976092a9b7d4cad6035b8965e82cf6ef12f321 | [
"MIT"
] | 2 | 2020-06-06T19:15:02.000Z | 2022-01-05T21:56:58.000Z | ####
# Later will summarize matplolib here
| 14.333333 | 37 | 0.72093 | 5 | 43 | 6.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.162791 | 43 | 2 | 38 | 21.5 | 0.861111 | 0.813953 | 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 |
e9e6b4271b0d1d36451045b47f1d3540182618d6 | 139 | py | Python | test/test_edit_group.py | daltonik666/python_training | 99e243c346aeeeb1698e31be04e1742cce6029d9 | [
"Apache-2.0"
] | null | null | null | test/test_edit_group.py | daltonik666/python_training | 99e243c346aeeeb1698e31be04e1742cce6029d9 | [
"Apache-2.0"
] | null | null | null | test/test_edit_group.py | daltonik666/python_training | 99e243c346aeeeb1698e31be04e1742cce6029d9 | [
"Apache-2.0"
] | null | null | null | from model.group import Group
def test_edit_group(app):
app.group.edit(Group(name="groupname1", header="headre1", footer="footer1"))
| 23.166667 | 80 | 0.741007 | 20 | 139 | 5.05 | 0.7 | 0.178218 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024194 | 0.107914 | 139 | 5 | 81 | 27.8 | 0.790323 | 0 | 0 | 0 | 0 | 0 | 0.173913 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
a1126dc2f548a134ac2766df197896ccb22903ec | 226 | py | Python | pynini/writing.py | daffidilly/pynini | 11a8b0756199c17be5864eafaa4256d897933197 | [
"Apache-2.0"
] | 5 | 2016-11-21T08:53:59.000Z | 2018-01-25T23:21:36.000Z | pynini/writing.py | daffidilly/pynini | 11a8b0756199c17be5864eafaa4256d897933197 | [
"Apache-2.0"
] | 1 | 2017-02-21T19:07:22.000Z | 2018-09-24T16:51:37.000Z | pynini/writing.py | daffidilly/pynini | 11a8b0756199c17be5864eafaa4256d897933197 | [
"Apache-2.0"
] | null | null | null | class TemplateFileWriter(object):
"""A writer that formats the template to a file."""
def __init__(self):
pass
def write(self, template, context, out_path):
template.stream(context).dump(out_path) | 28.25 | 55 | 0.672566 | 29 | 226 | 5.034483 | 0.724138 | 0.09589 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.216814 | 226 | 8 | 56 | 28.25 | 0.824859 | 0.199115 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0.2 | 0 | 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 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 5 |
a116343108a98380741acc938b318eb5265a53e3 | 39 | py | Python | dataSc_cli/generator/__init__.py | hatemBT/DataSc_cli | e745e8f338c039856d36bdac3cb7a97cbc49ac1e | [
"MIT"
] | null | null | null | dataSc_cli/generator/__init__.py | hatemBT/DataSc_cli | e745e8f338c039856d36bdac3cb7a97cbc49ac1e | [
"MIT"
] | null | null | null | dataSc_cli/generator/__init__.py | hatemBT/DataSc_cli | e745e8f338c039856d36bdac3cb7a97cbc49ac1e | [
"MIT"
] | null | null | null | """
this package generate md files
""" | 13 | 31 | 0.666667 | 5 | 39 | 5.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.179487 | 39 | 3 | 32 | 13 | 0.8125 | 0.769231 | 0 | null | 1 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
a120a40f7b2a4f57e37643fddbe9568b27a6fe91 | 114 | py | Python | Common/WebScrappers/Yahoo/YahooBalanceScrapper.py | enriqueescobar-askida/Kinito.Finance | 5308748b64829ac798a858161f9b4a9e5829db44 | [
"MIT"
] | 2 | 2020-03-04T11:18:38.000Z | 2020-05-10T15:36:42.000Z | Common/WebScrappers/Yahoo/YahooBalanceScrapper.py | enriqueescobar-askida/Kinito.Finance | 5308748b64829ac798a858161f9b4a9e5829db44 | [
"MIT"
] | 6 | 2020-03-30T16:42:47.000Z | 2021-12-13T20:37:21.000Z | Common/WebScrappers/Yahoo/YahooBalanceScrapper.py | enriqueescobar-askida/Kinito.Finance | 5308748b64829ac798a858161f9b4a9e5829db44 | [
"MIT"
] | 1 | 2020-04-14T11:26:16.000Z | 2020-04-14T11:26:16.000Z | from Common.WebScrappers.YahooScrapper import YahooScrapper
class YahooBalanceScrapper(YahooScrapper):
pass
| 19 | 59 | 0.842105 | 10 | 114 | 9.6 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114035 | 114 | 5 | 60 | 22.8 | 0.950495 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.333333 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 5 |
a13a002da51436e7c6684e2e153faaaceae5ccee | 978 | py | Python | test_unfurl.py | durple/unfurl | d7778a708086a345ab0cf47cfc3c7204fe45449f | [
"MIT"
] | 2 | 2015-11-05T11:42:29.000Z | 2016-07-20T13:04:23.000Z | test_unfurl.py | durple/unfurl | d7778a708086a345ab0cf47cfc3c7204fe45449f | [
"MIT"
] | null | null | null | test_unfurl.py | durple/unfurl | d7778a708086a345ab0cf47cfc3c7204fe45449f | [
"MIT"
] | 2 | 2016-01-19T23:20:53.000Z | 2016-05-06T21:30:24.000Z | # -*- coding: utf-8 -*-
from unfurl import expand_url as eu
def test_bitly():
assert eu("http://j.mp/Y4seGv") == "http://www.nytimes.com/2013/03/11/world/asia/karzai-accuses-us-and-taliban-of-colluding-in-afghanistan.html?ref=global-home&_r=0"
assert eu("http://j.mp/13ND7TO") == "http://www.profnetconnect.com/angela_smith/blog/2013/03/07/angie%E2%80%99s_social_media_angels:_givingtuesday"
def test_tco():
assert eu("http://t.co/bxPFQgZ1AV") == "http://www.nytimes.com/2013/03/14/crosswords/bridge/bridge-spring-north-american-championships.html?partner=rss&emc=rss&_r=0"
def test_arrows():
assert eu(u"http://➡.ws/kd") == "http://www.theglobeandmail.com/technology/tech-news/crtc-will-rescind-unlimited-use-internet-decision---or-ottawa-will-overturn-it/article565223/"
assert eu(u"http://➡.ws/wwwwwwwww") == "http://expandurl.appspot.com/"
def test_tinyurl():
assert eu("http://tinyurl.com/l7953rg") == "http://espnfc.com/blog/_/name/espnfcunited/id/9949?cc=5901"
| 57.529412 | 180 | 0.736196 | 157 | 978 | 4.515924 | 0.649682 | 0.067701 | 0.067701 | 0.036671 | 0.152327 | 0.110014 | 0 | 0 | 0 | 0 | 0 | 0.059459 | 0.054192 | 978 | 16 | 181 | 61.125 | 0.704865 | 0.021472 | 0 | 0 | 0 | 0.454545 | 0.746597 | 0 | 0 | 0 | 0 | 0 | 0.545455 | 1 | 0.363636 | true | 0 | 0.090909 | 0 | 0.454545 | 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 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
a14400e8a5e312d5140569ffcb4b666968ccbbe7 | 294 | py | Python | flask-api/schema/login.py | PapamichMarios/Intranet | 65cd98d08a1a550d70e1afa4859a0b105c049817 | [
"MIT"
] | 1 | 2021-12-21T19:13:37.000Z | 2021-12-21T19:13:37.000Z | flask-api/schema/login.py | PapamichMarios/Intranet | 65cd98d08a1a550d70e1afa4859a0b105c049817 | [
"MIT"
] | null | null | null | flask-api/schema/login.py | PapamichMarios/Intranet | 65cd98d08a1a550d70e1afa4859a0b105c049817 | [
"MIT"
] | null | null | null | from marshmallow import Schema, fields, validate
class LoginSchema(Schema):
username = fields.String(attribute="username", validate=validate.Length(min=3, max=256), required=True)
password = fields.String(attribute="password", validate=validate.Length(min=8, max=256), required=True)
| 42 | 107 | 0.765306 | 37 | 294 | 6.081081 | 0.540541 | 0.106667 | 0.186667 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030303 | 0.102041 | 294 | 6 | 108 | 49 | 0.82197 | 0 | 0 | 0 | 0 | 0 | 0.054422 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.25 | 0.25 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 5 |
a1659a21056ea5c20aeff977978e80b93ede9ceb | 1,870 | py | Python | src/tests/test_click_set_var_command_line.py | ndejong/pyvboxmanage | 6cb49546782ae97f177e7035982b1dc86b8f61db | [
"BSD-2-Clause"
] | 1 | 2020-12-28T02:19:35.000Z | 2020-12-28T02:19:35.000Z | src/tests/test_click_set_var_command_line.py | ndejong/pyvboxmanage | 6cb49546782ae97f177e7035982b1dc86b8f61db | [
"BSD-2-Clause"
] | null | null | null | src/tests/test_click_set_var_command_line.py | ndejong/pyvboxmanage | 6cb49546782ae97f177e7035982b1dc86b8f61db | [
"BSD-2-Clause"
] | null | null | null |
import os
import pytest
from click.testing import CliRunner
from pyvboxmanage.cli import click
# NB: these tests work in isolation, however when they are run together with other runner.invoke() that use `args`
# then the result.stdout returns empty - it is not obvious how to resolve this even using a manual `del` on
# variable names in other tests does not resolve.
# def test_pyvboxmanage_dryrun_test01_set_var_cli():
# runner = CliRunner()
# config01_filename = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test01config.yml')
#
# result = runner.invoke(click.pyvboxmanage, args='--dry-run --setting source_vmname=FOOBAR "{}"'.
# format(config01_filename) )
# assert result.exit_code == 0
# assert 'Successfully executed command line "vboxmanage clonevm FOOBAR --basefolder' in result.stdout
# def test_pyvboxmanage_dryrun_test02_set_var_cli():
# runner = CliRunner()
# config01_filename = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test01config.yml')
#
# result = runner.invoke(click.pyvboxmanage, args='--dry-run --setting source_vmname=FOOBAR "{}"'.
# format(config01_filename) )
# assert result.exit_code == 0
# assert 'Successfully executed command line "vboxmanage clonevm FOOBAR --basefolder' in result.stdout
# def test_pyvboxmanage_dryrun_test03_set_var_cli():
#
# runner = CliRunner()
# config_filename = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test03config.yml')
#
# result = runner.invoke(click.pyvboxmanage, args='--dry-run --setting unset_variable01=replacement_sourcevm01 "{}"'.
# format(config_filename) )
# assert result.exit_code == 0
# assert 'Successfully executed command line "vboxmanage showvminfo replacement_sourcevm01"' in result.stdout
| 44.52381 | 121 | 0.708556 | 230 | 1,870 | 5.569565 | 0.4 | 0.042155 | 0.044496 | 0.058548 | 0.653396 | 0.63466 | 0.63466 | 0.63466 | 0.63466 | 0.63466 | 0 | 0.018979 | 0.182888 | 1,870 | 41 | 122 | 45.609756 | 0.819372 | 0.913904 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
a1ae39aa1e19311d8026f36dea4679fb55a8e27d | 161 | py | Python | Scripts/python/scripts mundo 1/scripts sem cor/Desafio027.py | BrenoNAlmeida/Scripts-Escola | 20d886d0401ef7f40a4a46e307eadbf5b1c0a5eb | [
"Apache-2.0"
] | null | null | null | Scripts/python/scripts mundo 1/scripts sem cor/Desafio027.py | BrenoNAlmeida/Scripts-Escola | 20d886d0401ef7f40a4a46e307eadbf5b1c0a5eb | [
"Apache-2.0"
] | null | null | null | Scripts/python/scripts mundo 1/scripts sem cor/Desafio027.py | BrenoNAlmeida/Scripts-Escola | 20d886d0401ef7f40a4a46e307eadbf5b1c0a5eb | [
"Apache-2.0"
] | null | null | null | nome=str(input('digite seu nome completo =')).split()
print('seu primeiro nome é {}'.format(nome[0]))
print('e seu ultimo nome é {}'.format(nome[len(nome)-1] ))
| 40.25 | 58 | 0.670807 | 27 | 161 | 4 | 0.592593 | 0.092593 | 0.203704 | 0.277778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013889 | 0.10559 | 161 | 3 | 59 | 53.666667 | 0.736111 | 0 | 0 | 0 | 0 | 0 | 0.434783 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.666667 | 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 | 0 | 0 | 0 | 1 | 0 | 5 |
a1b62117f5ea7b2e1922850c4c63530fcc261ce2 | 159 | py | Python | ex010.py | gabrielwai/exercicios_de_Python | 3767775748db7c501a6e0364edf7ba4f079e62f9 | [
"MIT"
] | null | null | null | ex010.py | gabrielwai/exercicios_de_Python | 3767775748db7c501a6e0364edf7ba4f079e62f9 | [
"MIT"
] | null | null | null | ex010.py | gabrielwai/exercicios_de_Python | 3767775748db7c501a6e0364edf7ba4f079e62f9 | [
"MIT"
] | null | null | null | din = float(input('Digite sua quantidade de dinheiro (em reais):R$'))
print('A quantidade de dólares que você pode comprar é: US${:.2f}'.format(din/3.27))
| 39.75 | 85 | 0.691824 | 27 | 159 | 4.074074 | 0.888889 | 0.218182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029412 | 0.144654 | 159 | 3 | 86 | 53 | 0.779412 | 0 | 0 | 0 | 0 | 0 | 0.677419 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
a1d6e250bf590c86ac7792aacd10dd70e79798f0 | 2,653 | py | Python | yamale/tests/test_command_line.py | kpmadhan/Yamale | 36f9b8b1bfd3c5355491e43607dc44ef90473f25 | [
"MIT"
] | null | null | null | yamale/tests/test_command_line.py | kpmadhan/Yamale | 36f9b8b1bfd3c5355491e43607dc44ef90473f25 | [
"MIT"
] | null | null | null | yamale/tests/test_command_line.py | kpmadhan/Yamale | 36f9b8b1bfd3c5355491e43607dc44ef90473f25 | [
"MIT"
] | null | null | null | import os
import pytest
from .. import command_line
dir_path = os.path.dirname(os.path.realpath(__file__))
parsers = ['pyyaml', 'PyYAML', 'ruamel']
@pytest.mark.parametrize('parser', parsers)
def test_bad_yaml(capsys, parser):
try:
command_line._router(
'yamale/tests/command_line_fixtures/yamls/bad.yaml',
'schema.yaml', 1, parser)
except ValueError as e:
assert 'Validation failed!' in str(e)
captured = capsys.readouterr()
assert "map.bad: '12.5' is not a str." in captured.out
return
assert False
@pytest.mark.parametrize('parser', parsers)
def test_required_keys_yaml(capsys, parser):
try:
command_line._router(
'yamale/tests/command_line_fixtures/yamls/required_keys_bad.yaml',
'required_keys_schema.yaml', 1, parser)
except ValueError as e:
assert 'Validation failed!' in str(e)
captured = capsys.readouterr()
assert "map.key: Required field missing" in captured.out
return
assert False
@pytest.mark.parametrize('parser', parsers)
def test_good_yaml(parser):
command_line._router(
'yamale/tests/command_line_fixtures/yamls/good.yaml',
'schema.yaml', 1, parser)
@pytest.mark.parametrize('parser', parsers)
def test_good_relative_yaml(parser):
command_line._router(
'yamale/tests/command_line_fixtures/yamls/good.yaml',
'../schema_dir/external.yaml', 1, parser)
@pytest.mark.parametrize('parser', parsers)
def test_external_glob_schema(parser):
command_line._router(
'yamale/tests/command_line_fixtures/yamls/good.yaml',
os.path.join(dir_path, 'command_line_fixtures/schema_dir/ex*.yaml'), 1, parser)
def test_external_schema():
command_line._router(
'yamale/tests/command_line_fixtures/yamls/good.yaml',
os.path.join(dir_path, 'command_line_fixtures/schema_dir/external.yaml'), 1, 'PyYAML')
def test_bad_dir():
try:
command_line._router(
'yamale/tests/command_line_fixtures/yamls',
'schema.yaml', 4, 'PyYAML')
except ValueError as e:
assert 'Validation failed!' in str(e)
return
assert False
def test_bad_strict(capsys):
try:
command_line._router(
'yamale/tests/command_line_fixtures/yamls/required_keys_extra_element.yaml',
'required_keys_schema.yaml',
4, 'PyYAML', strict=True)
except ValueError as e:
assert 'Validation failed!' in str(e)
captured = capsys.readouterr()
assert "map.key2: Unexpected element" in captured.out
return
assert False
| 29.477778 | 94 | 0.672069 | 334 | 2,653 | 5.113772 | 0.203593 | 0.122365 | 0.111241 | 0.107728 | 0.796253 | 0.755269 | 0.737705 | 0.7137 | 0.709016 | 0.709016 | 0 | 0.005761 | 0.214851 | 2,653 | 89 | 95 | 29.808989 | 0.81421 | 0 | 0 | 0.608696 | 0 | 0 | 0.319638 | 0.222013 | 0 | 0 | 0 | 0 | 0.15942 | 1 | 0.115942 | false | 0 | 0.043478 | 0 | 0.217391 | 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 |
b80f987bb8ac6ec8e1b0321d7b81da51e6b9efb4 | 22 | py | Python | avwx/patterns/__init__.py | AirbusDriver/avwx-engine | e3fed8f744a48faca58c3e94ddbf214f9c719d3d | [
"MIT"
] | null | null | null | avwx/patterns/__init__.py | AirbusDriver/avwx-engine | e3fed8f744a48faca58c3e94ddbf214f9c719d3d | [
"MIT"
] | 3 | 2019-11-21T17:59:14.000Z | 2019-12-04T03:45:05.000Z | avwx/patterns/__init__.py | AirbusDriver/avwx-engine | e3fed8f744a48faca58c3e94ddbf214f9c719d3d | [
"MIT"
] | null | null | null | from . import remarks
| 11 | 21 | 0.772727 | 3 | 22 | 5.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 22 | 1 | 22 | 22 | 0.944444 | 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 |
6299a0b66f98ba5b888c1638a187be6c4799ed53 | 168 | py | Python | 1 Python Basics/4_compound_list_types.py | narayanants/python-mega-course | 2ba2980ab21dfbed5f86f00695559f7831b5c566 | [
"MIT"
] | null | null | null | 1 Python Basics/4_compound_list_types.py | narayanants/python-mega-course | 2ba2980ab21dfbed5f86f00695559f7831b5c566 | [
"MIT"
] | null | null | null | 1 Python Basics/4_compound_list_types.py | narayanants/python-mega-course | 2ba2980ab21dfbed5f86f00695559f7831b5c566 | [
"MIT"
] | null | null | null | student_grades = list(range(50,100,10))
print(sum(student_grades))
student_grades.append(100)
print(student_grades)
student_grades.remove(100)
print(student_grades) | 16.8 | 39 | 0.809524 | 25 | 168 | 5.2 | 0.44 | 0.6 | 0.307692 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.082803 | 0.065476 | 168 | 10 | 40 | 16.8 | 0.745223 | 0 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
62aa0fc68fd5e906bb2b5e2c63d5729be106e41e | 74 | py | Python | dags/tasks/__init__.py | jsmithdataanalytics/house_price_tracker | a4795db21c25c014f45ff6742c5bb30ad26ded75 | [
"MIT"
] | 1 | 2020-04-23T00:48:52.000Z | 2020-04-23T00:48:52.000Z | dags/tasks/__init__.py | jsmithdataanalytics/house_price_tracker | a4795db21c25c014f45ff6742c5bb30ad26ded75 | [
"MIT"
] | null | null | null | dags/tasks/__init__.py | jsmithdataanalytics/house_price_tracker | a4795db21c25c014f45ff6742c5bb30ad26ded75 | [
"MIT"
] | null | null | null | from .get_listings import get_listings
from .send_email import send_email
| 24.666667 | 38 | 0.864865 | 12 | 74 | 5 | 0.5 | 0.366667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.108108 | 74 | 2 | 39 | 37 | 0.909091 | 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 |
62c1c2c0097550597f414e8f7ebf1886bc000f91 | 92 | py | Python | npbench/benchmarks/polybench/gemm/gemm_numpy.py | frahlg/npbench | 1bc4d9e2e22f3ca67fa2bc7f40e2e751a9c8dd26 | [
"BSD-3-Clause"
] | 27 | 2021-05-10T11:49:13.000Z | 2022-03-22T18:07:19.000Z | npbench/benchmarks/polybench/gemm/gemm_numpy.py | frahlg/npbench | 1bc4d9e2e22f3ca67fa2bc7f40e2e751a9c8dd26 | [
"BSD-3-Clause"
] | 3 | 2021-12-01T13:03:17.000Z | 2022-03-17T10:53:00.000Z | npbench/benchmarks/polybench/gemm/gemm_numpy.py | frahlg/npbench | 1bc4d9e2e22f3ca67fa2bc7f40e2e751a9c8dd26 | [
"BSD-3-Clause"
] | 7 | 2021-06-24T03:40:25.000Z | 2022-01-26T09:04:33.000Z | import numpy as np
def kernel(alpha, beta, C, A, B):
C[:] = alpha * A @ B + beta * C
| 13.142857 | 35 | 0.532609 | 17 | 92 | 2.882353 | 0.647059 | 0.204082 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.304348 | 92 | 6 | 36 | 15.333333 | 0.765625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
1a01abd9369679b7bffaf7f6f397a9e3232838b6 | 5,198 | py | Python | Week 10 - Neural Networks/submission.py | lvolkmann/CS-490-Deep-Learning | 48e637e6892d2e87999ed87b994be659cb30f1e2 | [
"MIT"
] | null | null | null | Week 10 - Neural Networks/submission.py | lvolkmann/CS-490-Deep-Learning | 48e637e6892d2e87999ed87b994be659cb30f1e2 | [
"MIT"
] | null | null | null | Week 10 - Neural Networks/submission.py | lvolkmann/CS-490-Deep-Learning | 48e637e6892d2e87999ed87b994be659cb30f1e2 | [
"MIT"
] | null | null | null | from keras import Sequential
from keras.datasets import mnist
import numpy as np
from keras.layers import Dense
from keras.utils import to_categorical
from keras.preprocessing.image import img_to_array
import matplotlib.pyplot as plt
(train_images, train_labels), (test_images, test_labels) = mnist.load_data()
# process the data
# 1. convert each image of shape 28*28 to 784 dimensional which will be fed to the network as a single feature
dimData = np.prod(train_images.shape[1:])
# print(dimData)
train_data = train_images.reshape(train_images.shape[0], dimData)
test_data = test_images.reshape(test_images.shape[0], dimData)
# convert data to float and scale values between 0 and 1
train_data = train_data.astype('float')
test_data = test_data.astype('float')
# scale data
train_data /= 255.0
test_data /= 255.0
# change the labels frominteger to one-hot encoding. to_categorical is doing the same thing as LabelEncoder()
train_labels_one_hot = to_categorical(train_labels)
test_labels_one_hot = to_categorical(test_labels)
# creating network
model = Sequential()
model.add(Dense(512, activation='relu', input_shape=(dimData,)))
model.add(Dense(512, activation='relu'))
model.add(Dense(10, activation='softmax'))
model.compile(optimizer='rmsprop', loss='categorical_crossentropy', metrics=['accuracy'])
print()
history = model.fit(train_data, train_labels_one_hot, batch_size=256, epochs=10, verbose=1,
validation_data=(test_data, test_labels_one_hot))
loss, accuracy = model.evaluate(test_data, test_labels_one_hot)
print("LOSS: {}".format(loss))
print("ACCURACY: {}".format(accuracy))
# 1 Plot loss and accuracy
print("Rendering Loss/Acc Trends...")
for key in history.history:
plt.plot(history.history[key])
plt.title("{} vs Epoch".format(key))
plt.ylabel(key)
plt.xlabel('Epoch')
plt.show()
# 2 Single test image
print("Rendering test image...")
test_img_seven = test_images[26]
test_data_seven = test_data[[26], :]
plt.imshow(test_img_seven, cmap=plt.get_cmap('gray'))
plt.title("Model Prediction: {}".format(model.predict_classes(test_data_seven)[0]))
plt.show()
# 3 Change number of hidden layers and activation
print("Training a model with more relu hidden layers...")
model = Sequential()
model.add(Dense(512, activation='relu', input_shape=(dimData,)))
model.add(Dense(512, activation='relu'))
model.add(Dense(512, activation='relu'))
model.add(Dense(512, activation='relu'))
model.add(Dense(10, activation='softmax'))
model.compile(optimizer='rmsprop', loss='categorical_crossentropy', metrics=['accuracy'])
print()
model.fit(train_data, train_labels_one_hot, batch_size=256, epochs=10, verbose=1,
validation_data=(test_data, test_labels_one_hot))
loss2, accuracy2 = model.evaluate(test_data, test_labels_one_hot)
print("More relu layer model with respect to original model...")
print("NEW LOSS: {} CHANGE: {}".format(loss2, loss2 - loss))
print("NEW ACCURACY: {} CHANGE: {}".format(accuracy2, accuracy2 - accuracy))
print("Training a model with sigmoid activation instead of relu...")
model = Sequential()
model.add(Dense(512, activation='sigmoid', input_shape=(dimData,)))
model.add(Dense(512, activation='sigmoid'))
model.add(Dense(10, activation='softmax'))
model.compile(optimizer='rmsprop', loss='categorical_crossentropy', metrics=['accuracy'])
print()
model.fit(train_data, train_labels_one_hot, batch_size=256, epochs=10, verbose=1,
validation_data=(test_data, test_labels_one_hot))
loss2, accuracy2 = model.evaluate(test_data, test_labels_one_hot)
print("Sigmoid model with respect to original model...")
print("NEW LOSS: {} CHANGE: {}".format(loss2, loss2 - loss))
print("NEW ACCURACY: {} CHANGE: {}".format(accuracy2, accuracy2 - accuracy))
# 4 Without scaling
# process the data
# 1. convert each image of shape 28*28 to 784 dimensional which will be fed to the network as a single feature
dimData = np.prod(train_images.shape[1:])
# print(dimData)
train_data = train_images.reshape(train_images.shape[0], dimData)
test_data = test_images.reshape(test_images.shape[0], dimData)
# convert data to float and scale values between 0 and 1
train_data = train_data.astype('float')
test_data = test_data.astype('float')
# not scaling the data this time
# change the labels from integer to one-hot encoding. to_categorical is doing the same thing as LabelEncoder()
train_labels_one_hot = to_categorical(train_labels)
test_labels_one_hot = to_categorical(test_labels)
print("Training a model with more relu hidden layers...")
model = Sequential()
model.add(Dense(512, activation='relu', input_shape=(dimData,)))
model.add(Dense(512, activation='relu'))
model.add(Dense(10, activation='softmax'))
model.compile(optimizer='rmsprop', loss='categorical_crossentropy', metrics=['accuracy'])
print()
model.fit(train_data, train_labels_one_hot, batch_size=256, epochs=10, verbose=1,
validation_data=(test_data, test_labels_one_hot))
loss2, accuracy2 = model.evaluate(test_data, test_labels_one_hot)
print("Non-scaled model respect to original model...")
print("NEW LOSS: {} CHANGE: {}".format(loss2, loss2 - loss))
print("NEW ACCURACY: {} CHANGE: {}".format(accuracy2, accuracy2 - accuracy)) | 39.679389 | 110 | 0.757599 | 763 | 5,198 | 4.990826 | 0.182176 | 0.037815 | 0.05042 | 0.042017 | 0.763393 | 0.757353 | 0.753676 | 0.74291 | 0.731618 | 0.720588 | 0 | 0.026572 | 0.109465 | 5,198 | 131 | 111 | 39.679389 | 0.796068 | 0.149673 | 0 | 0.651685 | 0 | 0 | 0.184647 | 0.021803 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.078652 | 0 | 0.078652 | 0.224719 | 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 |
a7e7efa3bf5c3da377f2769c1a5691e8c502ef9e | 4,935 | py | Python | tflite/QuantizationParameters.py | erezinman/tflite-flatbuffer-explorer | 0fe1828b80108de3b6b7075de6a66162dfd0d322 | [
"MIT"
] | 1 | 2019-10-30T00:52:21.000Z | 2019-10-30T00:52:21.000Z | tflite/QuantizationParameters.py | erezinman/tflite-flatbuffer-explorer | 0fe1828b80108de3b6b7075de6a66162dfd0d322 | [
"MIT"
] | null | null | null | tflite/QuantizationParameters.py | erezinman/tflite-flatbuffer-explorer | 0fe1828b80108de3b6b7075de6a66162dfd0d322 | [
"MIT"
] | null | null | null | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite
import flatbuffers
class QuantizationParameters(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsQuantizationParameters(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = QuantizationParameters()
x.Init(buf, n + offset)
return x
# QuantizationParameters
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# QuantizationParameters
def Min(self, j):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
a = self._tab.Vector(o)
return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# QuantizationParameters
def MinAsNumpy(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
return 0
# QuantizationParameters
def MinLength(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.VectorLen(o)
return 0
# QuantizationParameters
def Max(self, j):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
a = self._tab.Vector(o)
return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# QuantizationParameters
def MaxAsNumpy(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
return 0
# QuantizationParameters
def MaxLength(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
return self._tab.VectorLen(o)
return 0
# QuantizationParameters
def Scale(self, j):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
a = self._tab.Vector(o)
return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# QuantizationParameters
def ScaleAsNumpy(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
return 0
# QuantizationParameters
def ScaleLength(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
return self._tab.VectorLen(o)
return 0
# QuantizationParameters
def ZeroPoint(self, j):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
if o != 0:
a = self._tab.Vector(o)
return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8))
return 0
# QuantizationParameters
def ZeroPointAsNumpy(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
if o != 0:
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o)
return 0
# QuantizationParameters
def ZeroPointLength(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
if o != 0:
return self._tab.VectorLen(o)
return 0
def QuantizationParametersStart(builder): builder.StartObject(4)
def QuantizationParametersAddMin(builder, min): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(min), 0)
def QuantizationParametersStartMinVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def QuantizationParametersAddMax(builder, max): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(max), 0)
def QuantizationParametersStartMaxVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def QuantizationParametersAddScale(builder, scale): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(scale), 0)
def QuantizationParametersStartScaleVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def QuantizationParametersAddZeroPoint(builder, zeroPoint): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(zeroPoint), 0)
def QuantizationParametersStartZeroPointVector(builder, numElems): return builder.StartVector(8, numElems, 8)
def QuantizationParametersEnd(builder): return builder.EndObject()
| 41.470588 | 160 | 0.703749 | 555 | 4,935 | 6.10991 | 0.151351 | 0.059864 | 0.181657 | 0.206429 | 0.654674 | 0.633441 | 0.585078 | 0.585078 | 0.572398 | 0.526393 | 0 | 0.019226 | 0.198987 | 4,935 | 118 | 161 | 41.822034 | 0.838604 | 0.077609 | 0 | 0.588235 | 1 | 0 | 0.000882 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.282353 | false | 0 | 0.011765 | 0.058824 | 0.611765 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 5 |
a7ecfc30a353025da83e4a661dca60600376b0c2 | 187 | py | Python | sympy/combinatorics/__init__.py | Narsil/sympy | 4d837e074b871af351b42591697fe126411a910f | [
"BSD-3-Clause"
] | 1 | 2020-12-27T18:43:22.000Z | 2020-12-27T18:43:22.000Z | sympy_old/combinatorics/__init__.py | curzel-it/KiPyCalc | 909c783d5e6967ea58ca93f875106d8a8e3ca5db | [
"MIT"
] | null | null | null | sympy_old/combinatorics/__init__.py | curzel-it/KiPyCalc | 909c783d5e6967ea58ca93f875106d8a8e3ca5db | [
"MIT"
] | 1 | 2022-03-21T09:07:27.000Z | 2022-03-21T09:07:27.000Z | from sympy.combinatorics.permutations import Permutation
from sympy.combinatorics.prufer import Prufer
from sympy.combinatorics.generators import cyclic, alternating, symmetric, dihedral
| 46.75 | 83 | 0.871658 | 21 | 187 | 7.761905 | 0.571429 | 0.165644 | 0.404908 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.080214 | 187 | 3 | 84 | 62.333333 | 0.947674 | 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 | 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 |
a7f3a8f7033b7547fbf773d593e390e45808f7d0 | 90 | py | Python | app/main/admin.py | alanVergara/trips-manager-api | 62d73da4d05c2ad9704911d65da76c493938629d | [
"MIT"
] | null | null | null | app/main/admin.py | alanVergara/trips-manager-api | 62d73da4d05c2ad9704911d65da76c493938629d | [
"MIT"
] | null | null | null | app/main/admin.py | alanVergara/trips-manager-api | 62d73da4d05c2ad9704911d65da76c493938629d | [
"MIT"
] | null | null | null | from django.contrib import admin
from main.models import User
admin.site.register(User)
| 15 | 32 | 0.811111 | 14 | 90 | 5.214286 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.122222 | 90 | 5 | 33 | 18 | 0.924051 | 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 |
c501e55d8201d36a00f44756bd5629978d43eaa3 | 106 | py | Python | core/admin.py | Esatyilmaz0/MyBlogProject | 01997effa0fc51ea61626d90a05344364ff3b8f8 | [
"MIT"
] | null | null | null | core/admin.py | Esatyilmaz0/MyBlogProject | 01997effa0fc51ea61626d90a05344364ff3b8f8 | [
"MIT"
] | null | null | null | core/admin.py | Esatyilmaz0/MyBlogProject | 01997effa0fc51ea61626d90a05344364ff3b8f8 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .sub_models.Category import Category
admin.site.register(Category)
| 21.2 | 41 | 0.839623 | 15 | 106 | 5.866667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09434 | 106 | 4 | 42 | 26.5 | 0.916667 | 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 |
c504726f1d0b4bdd673d62e4a4f023b07abf0533 | 208 | py | Python | src/demos/dynamicprogramming/coinchange8.py | DavidLlorens/algoritmia | 40ca0a89ea6de9b633fa5f697f0a28cae70816a2 | [
"MIT"
] | 6 | 2018-09-15T15:09:10.000Z | 2022-02-27T01:23:11.000Z | src/demos/dynamicprogramming/coinchange8.py | JeromeIllgner/algoritmia | 406afe7206f2411557859bf03480c16db7dcce0d | [
"MIT"
] | null | null | null | src/demos/dynamicprogramming/coinchange8.py | JeromeIllgner/algoritmia | 406afe7206f2411557859bf03480c16db7dcce0d | [
"MIT"
] | 5 | 2018-07-10T20:19:55.000Z | 2021-03-31T03:32:22.000Z | #coding: latin1
#< full
from algoritmia.problems.generalizedcoinchange.dynamicprogramming8 import IterativeDynamicCoinChanger
print(IterativeDynamicCoinChanger([1, 2, 5], [1, 1, 4]).weight(7))
#> full | 29.714286 | 102 | 0.769231 | 21 | 208 | 7.619048 | 0.809524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.048649 | 0.110577 | 208 | 7 | 103 | 29.714286 | 0.816216 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 5 |
c506b02a9c259fac2cbeac1fbaa5b3252bbe55aa | 73 | py | Python | tests/test_simple.py | knabben/graphene-telemetry | 98e292b4a7d269dac7b83803c1729441642a6e45 | [
"MIT"
] | null | null | null | tests/test_simple.py | knabben/graphene-telemetry | 98e292b4a7d269dac7b83803c1729441642a6e45 | [
"MIT"
] | null | null | null | tests/test_simple.py | knabben/graphene-telemetry | 98e292b4a7d269dac7b83803c1729441642a6e45 | [
"MIT"
] | null | null | null | class TestSimple():
def test_assertion(self):
assert 1 == 1
| 14.6 | 29 | 0.60274 | 9 | 73 | 4.777778 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.038462 | 0.287671 | 73 | 4 | 30 | 18.25 | 0.788462 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 5 |
c51f2414da1ca948c9b45c38d1d5957b8e4fb037 | 76 | py | Python | psipy/visualization/__init__.py | jj-gonzalez-aviles/PsiPy | 415436b1f449e7125e9e8ff31385e9fc70af28a7 | [
"MIT"
] | 4 | 2021-05-12T07:28:22.000Z | 2022-03-23T13:38:14.000Z | psipy/visualization/__init__.py | jj-gonzalez-aviles/PsiPy | 415436b1f449e7125e9e8ff31385e9fc70af28a7 | [
"MIT"
] | 26 | 2021-07-14T19:26:32.000Z | 2022-03-31T13:54:51.000Z | psipy/visualization/__init__.py | jj-gonzalez-aviles/PsiPy | 415436b1f449e7125e9e8ff31385e9fc70af28a7 | [
"MIT"
] | 4 | 2021-02-11T17:04:00.000Z | 2022-03-13T16:31:08.000Z | """
Helper functions for data visualiszation.
"""
from .matplotlib import *
| 15.2 | 41 | 0.736842 | 8 | 76 | 7 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144737 | 76 | 4 | 42 | 19 | 0.861538 | 0.539474 | 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 |
c528c83209c07f5f77b6e1aa50ee32dd783ff1ef | 75 | py | Python | mxnext/__init__.py | jie311/RangeDet | 5078ce339c6d27a009aed1ca2790911ce4d10bc7 | [
"Apache-2.0"
] | 125 | 2021-08-09T02:14:04.000Z | 2022-03-30T03:41:56.000Z | mxnext/__init__.py | jie311/RangeDet | 5078ce339c6d27a009aed1ca2790911ce4d10bc7 | [
"Apache-2.0"
] | 15 | 2021-08-31T06:12:31.000Z | 2022-03-17T00:21:35.000Z | mxnext/__init__.py | jie311/RangeDet | 5078ce339c6d27a009aed1ca2790911ce4d10bc7 | [
"Apache-2.0"
] | 8 | 2021-08-10T03:08:10.000Z | 2022-03-09T06:21:11.000Z | from .simple import *
from .complicate import *
from .initializer import *
| 18.75 | 26 | 0.76 | 9 | 75 | 6.333333 | 0.555556 | 0.350877 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16 | 75 | 3 | 27 | 25 | 0.904762 | 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 |
c545b6b1b6f7c81294025b786b12910e5c234611 | 21 | py | Python | pox/lib/recoco/__init__.py | brenocg29/TP1RedesInteligentes | 3b73b3567089f9eb2e475ec8402113bf8803bb59 | [
"Apache-2.0"
] | 49 | 2015-01-07T06:36:30.000Z | 2021-03-15T18:49:54.000Z | pox/lib/recoco/__init__.py | brenocg29/TP1RedesInteligentes | 3b73b3567089f9eb2e475ec8402113bf8803bb59 | [
"Apache-2.0"
] | 29 | 2019-01-17T15:44:48.000Z | 2021-06-02T00:19:40.000Z | OFCONTROLLERS/pox/pox/lib/recoco/__init__.py | ViniGarcia/NIEP | 5cdf779795b9248e1bbc12195479083475f3edab | [
"MIT"
] | 65 | 2015-02-16T03:19:46.000Z | 2021-12-22T15:51:06.000Z | from recoco import *
| 10.5 | 20 | 0.761905 | 3 | 21 | 5.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.190476 | 21 | 1 | 21 | 21 | 0.941176 | 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 |
c54798d2bfba10486252ceff262764a682632919 | 136 | py | Python | code/hello_world.py | StefanoMartella/UnivaqThesisTemplate | 3b3ac3ba0ca94a51be6bfd4408ade712209ae90d | [
"MIT"
] | 6 | 2020-07-27T14:36:02.000Z | 2022-02-23T13:34:26.000Z | code/hello_world.py | StefanoMartella/UnivaqThesisTemplate | 3b3ac3ba0ca94a51be6bfd4408ade712209ae90d | [
"MIT"
] | null | null | null | code/hello_world.py | StefanoMartella/UnivaqThesisTemplate | 3b3ac3ba0ca94a51be6bfd4408ade712209ae90d | [
"MIT"
] | null | null | null | def main_function():
""" This is the main function. """
print('Hello Wolrd!')
if __name__ == '__main__':
main_function()
| 15.111111 | 38 | 0.610294 | 16 | 136 | 4.5625 | 0.6875 | 0.493151 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.227941 | 136 | 8 | 39 | 17 | 0.695238 | 0.191176 | 0 | 0 | 0 | 0 | 0.196078 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | true | 0 | 0 | 0 | 0.25 | 0.25 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
c5673c362f486b623d458617dca12ba3fae50ef3 | 8,277 | py | Python | SGCS/apps/base/views.py | gconelhero/clinica | 997da552a033be1fc49ca8b88eef79d7061430ec | [
"MIT"
] | null | null | null | SGCS/apps/base/views.py | gconelhero/clinica | 997da552a033be1fc49ca8b88eef79d7061430ec | [
"MIT"
] | null | null | null | SGCS/apps/base/views.py | gconelhero/clinica | 997da552a033be1fc49ca8b88eef79d7061430ec | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from decimal import Decimal
from django.views.generic import TemplateView
from django.shortcuts import render
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import F, Sum
from SGCS.apps.cadastro.models import Cliente, Fornecedor, Produto, Empresa, Transportadora
from SGCS.apps.cadastro.models.paciente import Paciente
from SGCS.apps.financeiro.models.lancamento import Lancamento
from SGCS.apps.vendas.models import OrcamentoVenda, PedidoVenda
from SGCS.apps.compras.models import OrcamentoCompra, PedidoCompra
from SGCS.apps.financeiro.models import MovimentoCaixa, Entrada, Saida
from datetime import datetime
class IndexView(TemplateView):
template_name = 'base/index.html'
def get_context_data(self, **kwargs):
context = super(IndexView, self).get_context_data(**kwargs)
quantidade_cadastro = {}
agenda_hoje = {}
alertas = {}
data_atual = datetime.now().date()
context['data_atual'] = data_atual.strftime('%d/%m/%Y')
quantidade_cadastro['clientes'] = Paciente.objects.all().count()
quantidade_cadastro['fornecedores'] = Fornecedor.objects.all().count()
quantidade_cadastro['produtos'] = Produto.objects.all().count()
quantidade_cadastro['empresas'] = Empresa.objects.all().count()
quantidade_cadastro[
'transportadoras'] = Transportadora.objects.all().count()
context['quantidade_cadastro'] = quantidade_cadastro
agenda_hoje['orcamento_venda_hoje'] = OrcamentoVenda.objects.filter(
data_vencimento=data_atual, status='0').count()
agenda_hoje['orcamento_compra_hoje'] = OrcamentoCompra.objects.filter(
data_vencimento=data_atual, status='0').count()
agenda_hoje['pedido_venda_hoje'] = PedidoVenda.objects.filter(
data_emissao=data_atual, status='0').count()
agenda_hoje['pedido_compra_hoje'] = PedidoCompra.objects.filter(
data_entrega=data_atual, status='0').count()
agenda_hoje['contas_receber_hoje'] = Entrada.objects.filter(
data_vencimento=data_atual, status__in=['1', '2']).count()
agenda_hoje['contas_pagar_hoje'] = Saida.objects.filter(
data_vencimento=data_atual, status__in=['1', '2']).count()
context['agenda_hoje'] = agenda_hoje
alertas['produtos_baixo_estoque'] = Produto.objects.filter(
estoque_atual__lte=F('estoque_minimo')).count()
alertas['orcamentos_venda_vencidos'] = OrcamentoVenda.objects.filter(
data_vencimento__lte=data_atual, status='0').count()
alertas['pedidos_venda_atrasados'] = PedidoVenda.objects.filter(
data_entrega__lte=data_atual, status='0').count()
alertas['orcamentos_compra_vencidos'] = OrcamentoCompra.objects.filter(
data_vencimento__lte=data_atual, status='0').count()
alertas['pedidos_compra_atrasados'] = PedidoCompra.objects.filter(
data_entrega__lte=data_atual, status='0').count()
alertas['contas_receber_atrasadas'] = Entrada.objects.filter(
data_vencimento__lte=data_atual, status__in=['1', '2']).count()
alertas['contas_pagar_atrasadas'] = Saida.objects.filter(
data_vencimento__lte=data_atual, status__in=['1', '2']).count()
context['alertas'] = alertas
try:
context['movimento_dia'] = MovimentoCaixa.objects.get(
data_movimento=data_atual)
except (MovimentoCaixa.DoesNotExist, ObjectDoesNotExist):
ultimo_mvmt = MovimentoCaixa.objects.filter(
data_movimento__lt=data_atual)
if ultimo_mvmt:
context['saldo'] = ultimo_mvmt.latest(
'data_movimento').saldo_final
else:
context['saldo'] = '0,00'
return context
def handler404(request):
response = render(request, '404.html', {})
response.status_code = 404
return response
def handler500(request):
response = render(request, '500.html', {})
response.status_code = 500
return response
'''
class IndexView(TemplateView):
template_name = 'base/index.html'
def get_context_data(self, **kwargs):
context = super(IndexView, self).get_context_data(**kwargs)
quantidade_cadastro = {}
agenda_hoje = {}
alertas = {}
data_atual = datetime.now().date()
context['data_atual'] = data_atual.strftime('%d/%m/%Y')
quantidade_cadastro['clientes'] = Paciente.objects.all().count()
quantidade_cadastro['fornecedores'] = Fornecedor.objects.all().count()
quantidade_cadastro['produtos'] = Produto.objects.all().count()
quantidade_cadastro['empresas'] = Empresa.objects.all().count()
quantidade_cadastro[
'transportadoras'] = Transportadora.objects.all().count()
context['quantidade_cadastro'] = quantidade_cadastro
agenda_hoje['orcamento_venda_hoje'] = OrcamentoVenda.objects.filter(
data_vencimento=data_atual, status='0').count()
agenda_hoje['orcamento_compra_hoje'] = OrcamentoCompra.objects.filter(
data_vencimento=data_atual, status='0').count()
agenda_hoje['pedido_venda_hoje'] = PedidoVenda.objects.filter(
data_emissao=data_atual, status='0').count()
agenda_hoje['pedido_compra_hoje'] = PedidoCompra.objects.filter(
data_entrega=data_atual, status='0').count()
agenda_hoje['contas_receber_hoje'] = Entrada.objects.filter(data_vencimento=data_atual, status__in=['1', '2']).count()
#Novo contas a receber // Pacientes devendo...
agenda_hoje['contas_receber_hoje'] = Paciente.objects.filter(limite_de_credito__lt=0).count() #Entrada.objects.filter(data_vencimento=data_atual, status__in=['1', '2']).count()
agenda_hoje['contas_pagar_hoje'] = Saida.objects.filter(
data_vencimento=data_atual, status__in=['1', '2']).count()
context['agenda_hoje'] = agenda_hoje
alertas['produtos_baixo_estoque'] = Produto.objects.filter(
estoque_atual__lte=F('estoque_minimo')).count()
alertas['orcamentos_venda_vencidos'] = OrcamentoVenda.objects.filter(
data_vencimento__lte=data_atual, status='0').count()
alertas['pedidos_venda_atrasados'] = PedidoVenda.objects.filter(
data_entrega__lte=data_atual, status='0').count()
alertas['orcamentos_compra_vencidos'] = OrcamentoCompra.objects.filter(
data_vencimento__lte=data_atual, status='0').count()
alertas['pedidos_compra_atrasados'] = PedidoCompra.objects.filter(
data_entrega__lte=data_atual, status='0').count()
alertas['contas_receber_atrasadas'] = Entrada.objects.filter(
data_vencimento__lte=data_atual, status__in=['1', '2']).count()
alertas['contas_pagar_atrasadas'] = Saida.objects.filter(
data_vencimento__lte=data_atual, status__in=['1', '2']).count()
context['alertas'] = alertas
context['movimento_dia'] = float('00.00')
try:
movimento_dia_saida = float(Saida.objects.filter(data_emissao=data_atual).aggregate(Sum('valor_total'))['valor_total__sum'])
except:
movimento_dia_saida = float('00.00')
try:
movimento_dia_entrada = float(Entrada.objects.filter(data_emissao=data_atual).aggregate(Sum('valor_total'))['valor_total__sum'])
except:
movimento_dia_entrada = float('00.00')
try:
saldo_inicial = float(Paciente.objects.aggregate(Sum('limite_de_credito'))['limite_de_credito__sum'])
except:
saldo_inicial = float('00.00')
context['salto_inicial'] = saldo_inicial
context['moviemnto_dia_saida'] = movimento_dia_saida
context['moviemnto_dia_entrada'] = movimento_dia_entrada
context['saldo'] = '0,00'
return context
def handler404(request):
response = render(request, '404.html', {})
response.status_code = 404
return response
def handler500(request):
response = render(request, '500.html', {})
response.status_code = 500
return response
''' | 44.983696 | 184 | 0.671016 | 905 | 8,277 | 5.845304 | 0.148066 | 0.059546 | 0.089981 | 0.086767 | 0.797164 | 0.771645 | 0.762571 | 0.762571 | 0.762571 | 0.762571 | 0 | 0.014253 | 0.203214 | 8,277 | 184 | 185 | 44.983696 | 0.78787 | 0.002537 | 0 | 0.157895 | 0 | 0 | 0.118392 | 0.045554 | 0 | 0 | 0 | 0 | 0 | 1 | 0.039474 | false | 0 | 0.157895 | 0 | 0.263158 | 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 |
3da186ae0d9b6f06f2beee613b97a61d7110a4be | 131 | py | Python | test/test_project/backends.py | jaap3/django-otp | d7980bf516018319158570cc75353c905375a3ab | [
"BSD-2-Clause"
] | 318 | 2019-08-27T15:57:05.000Z | 2022-03-30T08:38:29.000Z | test/test_project/backends.py | jaap3/django-otp | d7980bf516018319158570cc75353c905375a3ab | [
"BSD-2-Clause"
] | 77 | 2019-09-17T11:48:38.000Z | 2022-03-13T17:26:56.000Z | test/test_project/backends.py | jaap3/django-otp | d7980bf516018319158570cc75353c905375a3ab | [
"BSD-2-Clause"
] | 76 | 2019-08-30T20:29:40.000Z | 2022-03-30T09:14:36.000Z | class DummyBackend:
def authenticate(self, request):
return None
def get_user(self, user_id):
return None
| 18.714286 | 36 | 0.648855 | 16 | 131 | 5.1875 | 0.6875 | 0.240964 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.282443 | 131 | 6 | 37 | 21.833333 | 0.882979 | 0 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0.4 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 5 |
3dd5cf84241328b5619847583891af1a62dcecb0 | 21 | py | Python | macmini-liz/wrangle/src/main/python/wrangle/equity/__init__.py | ggear/asystem | c949a1624812eab5b063681f46a88ccc9527266e | [
"Apache-2.0"
] | 4 | 2019-03-26T13:57:54.000Z | 2021-11-04T04:55:49.000Z | macmini-liz/wrangle/src/main/python/wrangle/equity/__init__.py | ggear/asystem | c949a1624812eab5b063681f46a88ccc9527266e | [
"Apache-2.0"
] | 1 | 2021-04-03T01:10:11.000Z | 2021-04-03T01:10:11.000Z | macmini-liz/wrangle/src/main/python/wrangle/equity/__init__.py | ggear/asystem | c949a1624812eab5b063681f46a88ccc9527266e | [
"Apache-2.0"
] | 2 | 2019-04-02T19:20:34.000Z | 2019-08-13T16:39:52.000Z | from equity import *
| 10.5 | 20 | 0.761905 | 3 | 21 | 5.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.190476 | 21 | 1 | 21 | 21 | 0.941176 | 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 |
3dfa9b70d1fb34391f28dbabbee1056aca33e3a7 | 215 | py | Python | code/test-dbscan.py | amitthere/clustering-algorithms | a5483032e81a9229b5eea0ff0bd05862c02974fc | [
"Apache-2.0"
] | null | null | null | code/test-dbscan.py | amitthere/clustering-algorithms | a5483032e81a9229b5eea0ff0bd05862c02974fc | [
"Apache-2.0"
] | null | null | null | code/test-dbscan.py | amitthere/clustering-algorithms | a5483032e81a9229b5eea0ff0bd05862c02974fc | [
"Apache-2.0"
] | 1 | 2018-11-07T05:07:44.000Z | 2018-11-07T05:07:44.000Z | import numpy as np
from densitybasedclustering.dbscan import DBSCAN
from visualization import Visualization
from clustervalidation import ExternalIndex
def main():
pass
if __name__ == "__main__":
main()
| 16.538462 | 48 | 0.781395 | 24 | 215 | 6.666667 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.167442 | 215 | 12 | 49 | 17.916667 | 0.893855 | 0 | 0 | 0 | 0 | 0 | 0.037209 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | true | 0.125 | 0.5 | 0 | 0.625 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 5 |
9a86f27b7b5922f404237c07c6271e02ee339841 | 155 | py | Python | Examples/AppKit/CocoaBindings/FilteringController/FilteringController.py | Khan/pyobjc-framework-Cocoa | f8b015ea2a72d8d78be6084fb12925c4785b8f1f | [
"MIT"
] | 132 | 2015-01-01T10:02:42.000Z | 2022-03-09T12:51:01.000Z | mac/pyobjc-framework-Cocoa/Examples/AppKit/CocoaBindings/FilteringController/FilteringController.py | mba811/music-player | 7998986b34cfda2244ef622adefb839331b81a81 | [
"BSD-2-Clause"
] | 6 | 2015-01-06T08:23:19.000Z | 2019-03-14T12:22:06.000Z | mac/pyobjc-framework-Cocoa/Examples/AppKit/CocoaBindings/FilteringController/FilteringController.py | mba811/music-player | 7998986b34cfda2244ef622adefb839331b81a81 | [
"BSD-2-Clause"
] | 27 | 2015-02-23T11:51:43.000Z | 2022-03-07T02:34:18.000Z | #
# FilteringController
#
from PyObjCTools import AppHelper
import FilteringControllerDocument
import FilteringArrayController
AppHelper.runEventLoop()
| 15.5 | 34 | 0.858065 | 11 | 155 | 12.090909 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.103226 | 155 | 9 | 35 | 17.222222 | 0.956835 | 0.122581 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.75 | 0 | 0.75 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
9abcccd4211f8fe0ad4fa14c9ea90140d73157c3 | 4,898 | py | Python | python/plot_mca_linear_figure.py | eladnoor/small-molecule-regulation | 83127f20859093a06ee493128d672ac7428cec83 | [
"MIT"
] | 3 | 2018-03-29T12:14:05.000Z | 2021-03-22T09:04:22.000Z | python/plot_mca_linear_figure.py | eladnoor/small-molecule-regulation | 83127f20859093a06ee493128d672ac7428cec83 | [
"MIT"
] | 9 | 2016-05-30T16:43:21.000Z | 2017-03-17T13:15:02.000Z | python/plot_mca_linear_figure.py | eladnoor/small-molecule-regulation | 83127f20859093a06ee493128d672ac7428cec83 | [
"MIT"
] | 1 | 2021-03-22T09:04:26.000Z | 2021-03-22T09:04:26.000Z | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 22 15:43:18 2017
@author: noore
"""
import matplotlib.pyplot as plt
from matplotlib import rcParams
import numpy as np
import os
from settings import RESULT_DIR
rcParams['font.family'] = 'sans-serif'
rcParams['mathtext.sf'] = 'serif'
rcParams['mathtext.fontset'] = 'cm'
fig, axs = plt.subplots(2, 2, figsize=(7, 7))
# first, plot the MM rate law (as a function of s)
Vmax = 1 # umol/min
Km = 1 # mM
s_range = np.linspace(0, 50, 100) # 10 uM - 100 mM
v = lambda s: Vmax * s / (Km + s)
eps = lambda s: 1 - s / (Km + s)
arrowprops = dict(facecolor='black', shrink=0.01, width=1.5, headwidth=4)
x_low = 0.1
x_high = 45.0
fig.text(0.5, 0.95, 'Michaelis-Menten kinetics', fontsize=17, ha='center')
fig.text(0.5, 0.47, 'non-competitive inhibition', fontsize=17, ha='center')
###############################################################################
ax = axs[0, 0]
ax.plot(s_range, list(map(v, s_range)), '-')
ax.set_xscale('linear')
ax.set_yscale('linear')
ax.set_xlabel('substrate conc. $s$ [mM]')
ax.set_ylabel('rate $v$ [$\mu$mol/min]')
ax.annotate(r'$|\epsilon_s^v| \approx 1$', xy=(x_low, v(x_low)), xycoords='data',
xytext=(50, 0), textcoords='offset points', va='center', ha='center',
fontsize=12,
arrowprops=arrowprops)
ax.annotate(r'$|\epsilon_s^v| \approx 0$', xy=(x_high, v(x_high)), xycoords='data',
xytext=(0, -30), textcoords='offset points', va='center', ha='center',
fontsize=12,
arrowprops=arrowprops)
ax.set_title('rate law')
ax.annotate(r'$v = V^+ \, \frac{s}{K_M + s}$', color=(0.2, 0.4, 1.0),
xy=(0.5, 0.5), xycoords='axes fraction', fontsize=14,
ha='center', va='center')
###############################################################################
ax = axs[0, 1]
ax.plot(s_range, list(map(eps, s_range)), '-')
ax.set_xscale('linear')
ax.set_yscale('linear')
ax.set_xlabel('substrate conc. $s$ [mM]')
ax.set_ylabel('elasticity $\epsilon_s^v$')
ax.annotate(r'$|\epsilon_s^v| \approx 1$', xy=(x_low, eps(x_low)),
xytext=(50, 0), textcoords='offset points', va='center', ha='center',
fontsize=12,
arrowprops=arrowprops)
ax.annotate(r'$|\epsilon_s^v| \approx 0$', xy=(x_high, eps(x_high)),
xytext=(0, 30), textcoords='offset points', va='center', ha='center',
fontsize=12,
arrowprops=arrowprops)
ax.annotate(r'$|\epsilon_s^v| = 1 - \frac{s}{K_M + s}$', color=(0.2, 0.4, 1.0),
xy=(0.5, 0.5), xycoords='axes fraction', fontsize=14,
ha='center', va='center')
ax.set_title('substrate elasticity')
###############################################################################
v = lambda s: Vmax * (1 - s / (Km + s))
eps = lambda s: -s / (Km + s)
ax = axs[1, 0]
ax.plot(s_range, list(map(v, s_range)), '-')
ax.set_xscale('linear')
ax.set_yscale('linear')
ax.set_xlabel('inhibitor conc. $I$ [mM]')
ax.set_ylabel('rate $v$ [$\mu$mol/min]')
ax.annotate(r'$|\epsilon_I^v| \approx 1$', xy=(x_low, v(x_low)),
xytext=(50, 0), textcoords='offset points', va='center', ha='center',
fontsize=12,
arrowprops=dict(facecolor='black', shrink=0.01, width=1.5, headwidth=4))
ax.annotate(r'$|\epsilon_I^v| \approx 0$', xy=(x_high, v(x_high)),
xytext=(0, 30), textcoords='offset points', va='center', ha='center',
fontsize=12,
arrowprops=dict(facecolor='black', shrink=0.01, width=1.5, headwidth=4))
ax.set_title('rate law')
ax.annotate(r'$v = V^+ ( 1 - \frac{I}{K_I + I} ) $', color=(0.2, 0.4, 1.0),
xy=(0.5, 0.5), xycoords='axes fraction', fontsize=14,
ha='center', va='center')
###############################################################################
ax = axs[1, 1]
ax.plot(s_range, list(map(eps, s_range)), '-')
ax.set_xscale('linear')
ax.set_yscale('linear')
ax.set_xlabel('inhibitor conc. $I$ [mM]')
ax.set_ylabel('elasticity $\epsilon_I^v$')
ax.annotate(r'$|\epsilon_I^v| \approx 0$', xy=(x_low, eps(x_low)),
xytext=(50, 0), textcoords='offset points', va='center', ha='center',
fontsize=12,
arrowprops=arrowprops)
ax.annotate(r'$|\epsilon_I^v| \approx 1$', xy=(x_high, eps(x_high)),
xytext=(0, 30), textcoords='offset points', va='center', ha='center',
fontsize=12,
arrowprops=arrowprops)
ax.annotate(r'$\epsilon_I^v = -\frac{I}{K_I + I}$', color=(0.2, 0.4, 1.0),
xy=(0.5, 0.5), xycoords='axes fraction', fontsize=14,
ha='center', va='center')
ax.set_title('inhibitor elasticity')
###############################################################################
fig.tight_layout(pad=4, h_pad=5, w_pad=1)
fig.savefig(os.path.join(RESULT_DIR, 'mca_linear.svg'))
fig.savefig(os.path.join(RESULT_DIR, 'mca_linear.pdf')) | 39.184 | 84 | 0.557983 | 732 | 4,898 | 3.636612 | 0.199454 | 0.037566 | 0.049587 | 0.067618 | 0.773103 | 0.764838 | 0.741548 | 0.741548 | 0.741548 | 0.705485 | 0 | 0.043905 | 0.167619 | 4,898 | 125 | 85 | 39.184 | 0.609026 | 0.034912 | 0 | 0.53125 | 0 | 0 | 0.258796 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.052083 | 0 | 0.052083 | 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 |
b1064b7211e95461a161b5705c752ffc518c1636 | 167 | py | Python | jornalismo_de_dados_V2.0/portal/admin.py | Benedito-Medeiros-Neto-UnB/TacProgWeb | c7d795a69524e428988d4ed796f4a1c2ded035e3 | [
"MIT"
] | 1 | 2021-04-12T13:34:00.000Z | 2021-04-12T13:34:00.000Z | jornalismo_de_dados_V2.0/portal/admin.py | Benedito-Medeiros-Neto-UnB/TacProgWeb | c7d795a69524e428988d4ed796f4a1c2ded035e3 | [
"MIT"
] | 19 | 2021-05-14T20:56:29.000Z | 2022-02-10T11:59:33.000Z | jornalismo_de_dados_V2.0/portal/admin.py | Benedito-Medeiros-Neto-UnB/TacProgWeb | c7d795a69524e428988d4ed796f4a1c2ded035e3 | [
"MIT"
] | 10 | 2021-05-13T16:18:53.000Z | 2021-11-08T14:30:08.000Z | from django.contrib import admin
from .models import Tweet, Article, Reference
admin.site.register(Tweet)
admin.site.register(Article)
admin.site.register(Reference)
| 23.857143 | 45 | 0.820359 | 23 | 167 | 5.956522 | 0.478261 | 0.19708 | 0.372263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.083832 | 167 | 6 | 46 | 27.833333 | 0.895425 | 0 | 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 |
b10d03a3eac90c4ab766c326eec2ef82e45104ff | 249 | py | Python | eaa_donations/donations/models/__init__.py | andrewbird2/eaa_donations | 40a2cb2431130b330130f101c89bd3f8c503d2e2 | [
"MIT"
] | null | null | null | eaa_donations/donations/models/__init__.py | andrewbird2/eaa_donations | 40a2cb2431130b330130f101c89bd3f8c503d2e2 | [
"MIT"
] | 13 | 2020-06-05T19:27:58.000Z | 2022-02-26T13:40:54.000Z | eaa_donations/donations/models/__init__.py | andrewbird2/eaa_donations | 40a2cb2431130b330130f101c89bd3f8c503d2e2 | [
"MIT"
] | null | null | null | from .gift import Gift
from .partner_charity import PartnerCharity
from .pledge import Pledge, PledgeComponent, PaymentMethod
from .referral_source import ReferralSource
from .transaction import BankTransaction, PaypalTransaction, StripeTransaction
| 41.5 | 78 | 0.86747 | 26 | 249 | 8.230769 | 0.615385 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096386 | 249 | 5 | 79 | 49.8 | 0.951111 | 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 |
b14930583aee1603265a4456bcb213c797cfcc37 | 94 | py | Python | enthought/envisage/i_plugin_manager.py | enthought/etsproxy | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | [
"BSD-3-Clause"
] | 3 | 2016-12-09T06:05:18.000Z | 2018-03-01T13:00:29.000Z | enthought/envisage/i_plugin_manager.py | enthought/etsproxy | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | [
"BSD-3-Clause"
] | 1 | 2020-12-02T00:51:32.000Z | 2020-12-02T08:48:55.000Z | enthought/envisage/i_plugin_manager.py | enthought/etsproxy | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | [
"BSD-3-Clause"
] | null | null | null | # proxy module
from __future__ import absolute_import
from envisage.i_plugin_manager import *
| 23.5 | 39 | 0.851064 | 13 | 94 | 5.615385 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117021 | 94 | 3 | 40 | 31.333333 | 0.879518 | 0.12766 | 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 |
b162a52a1c42fc792871f7cb51d81fd20da6b0d7 | 169 | py | Python | pages/base.py | FranciscoCarbonell/kivymd-login-example | 16aa38742b0467a6e25a89762a2153dfb6ee367e | [
"MIT"
] | 7 | 2020-06-04T12:20:29.000Z | 2022-03-20T11:14:00.000Z | pages/base.py | usher-rayko/kivymd-login-example | 16aa38742b0467a6e25a89762a2153dfb6ee367e | [
"MIT"
] | 1 | 2020-10-18T18:27:15.000Z | 2021-11-26T00:45:35.000Z | pages/base.py | usher-rayko/kivymd-login-example | 16aa38742b0467a6e25a89762a2153dfb6ee367e | [
"MIT"
] | 6 | 2020-07-26T04:41:18.000Z | 2022-02-13T05:17:32.000Z | from kivy.uix.screenmanager import Screen
from kivy.app import App
class BaseScreen(Screen):
@property
def root(self):
return App.get_running_app().root | 24.142857 | 41 | 0.733728 | 24 | 169 | 5.083333 | 0.666667 | 0.131148 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.183432 | 169 | 7 | 42 | 24.142857 | 0.884058 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0.166667 | 0.833333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 5 |
490a0f26714b6718bf8f20a7653f8f167d748f4b | 100 | py | Python | shapes/src/python/pyshapes/primitives/__init__.py | StefanBoca/cppwg | b41ce191be5b8d45607faaa032af8cfb3ead15fd | [
"MIT"
] | null | null | null | shapes/src/python/pyshapes/primitives/__init__.py | StefanBoca/cppwg | b41ce191be5b8d45607faaa032af8cfb3ead15fd | [
"MIT"
] | null | null | null | shapes/src/python/pyshapes/primitives/__init__.py | StefanBoca/cppwg | b41ce191be5b8d45607faaa032af8cfb3ead15fd | [
"MIT"
] | null | null | null | # Bring in everything from the shared module
from pyshapes.primitives._pyshapes_primitives import *
| 33.333333 | 54 | 0.84 | 13 | 100 | 6.307692 | 0.769231 | 0.439024 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12 | 100 | 2 | 55 | 50 | 0.931818 | 0.42 | 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 |
49339a24fef8be194a60f757d043ca89d7d970bd | 188 | py | Python | yape/command_line.py | d-little/yape | f96b4240029238502f05619255689a590bd20316 | [
"MIT"
] | 12 | 2017-02-10T13:13:31.000Z | 2019-05-10T21:41:55.000Z | yape/command_line.py | d-little/yape | f96b4240029238502f05619255689a590bd20316 | [
"MIT"
] | 18 | 2018-04-25T02:40:50.000Z | 2021-03-18T06:51:29.000Z | yape/command_line.py | d-little/yape | f96b4240029238502f05619255689a590bd20316 | [
"MIT"
] | 10 | 2017-02-20T10:20:50.000Z | 2019-07-24T16:51:30.000Z | import yape
import cProfile
def main():
yape.yape2()
def main_profile():
cProfile.run(
"import yape; yape.yape2()", "/Users/kazamatzuri/work/yape-testdata/stats"
)
| 14.461538 | 82 | 0.648936 | 23 | 188 | 5.26087 | 0.565217 | 0.165289 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013423 | 0.207447 | 188 | 12 | 83 | 15.666667 | 0.798658 | 0 | 0 | 0 | 0 | 0 | 0.361702 | 0.228723 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | true | 0 | 0.375 | 0 | 0.625 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
493cb495264dabbad58b4a94b96c6a2b1a6090dd | 57 | py | Python | geoplace_pkg/__init__.py | nayonacademy/geoplace | 1693b0f71e4341c37205667988c8f755edc1984c | [
"Unlicense"
] | null | null | null | geoplace_pkg/__init__.py | nayonacademy/geoplace | 1693b0f71e4341c37205667988c8f755edc1984c | [
"Unlicense"
] | null | null | null | geoplace_pkg/__init__.py | nayonacademy/geoplace | 1693b0f71e4341c37205667988c8f755edc1984c | [
"Unlicense"
] | null | null | null | from .functions import average, power
from .city import * | 28.5 | 37 | 0.789474 | 8 | 57 | 5.625 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140351 | 57 | 2 | 38 | 28.5 | 0.918367 | 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 |
495d9a89091c00bb948ee7a181e761e62bfee3c4 | 147 | py | Python | src/torchprune/torchprune/method/thres_filter/__init__.py | dani3l125/torchprune | f2589ec7514bd531ddaa7da3aed6388bb13712d3 | [
"MIT"
] | 74 | 2021-03-05T01:25:00.000Z | 2022-03-26T06:15:32.000Z | src/torchprune/torchprune/method/thres_filter/__init__.py | dani3l125/torchprune | f2589ec7514bd531ddaa7da3aed6388bb13712d3 | [
"MIT"
] | 4 | 2021-05-25T06:01:22.000Z | 2022-01-24T22:38:09.000Z | src/torchprune/torchprune/method/thres_filter/__init__.py | dani3l125/torchprune | f2589ec7514bd531ddaa7da3aed6388bb13712d3 | [
"MIT"
] | 7 | 2021-03-24T14:14:32.000Z | 2022-02-19T17:27:56.000Z | # flake8: noqa: F403,F401
"""The package for classic filter thresholding based on norms."""
from .thres_filter_net import FilterThresNet, SoftNet
| 29.4 | 65 | 0.782313 | 20 | 147 | 5.65 | 0.95 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.054688 | 0.129252 | 147 | 4 | 66 | 36.75 | 0.828125 | 0.571429 | 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 |
772549cc6ea67160e0c231c34a9640c84b2ecd32 | 3,692 | py | Python | extensions/.stubs/clrclasses/Autodesk/AutoCAD/Internal/Reactors/__init__.py | vicwjb/Pycad | 7391cd694b7a91ad9f9964ec95833c1081bc1f84 | [
"MIT"
] | 1 | 2020-03-25T03:27:24.000Z | 2020-03-25T03:27:24.000Z | extensions/.stubs/clrclasses/Autodesk/AutoCAD/Internal/Reactors/__init__.py | vicwjb/Pycad | 7391cd694b7a91ad9f9964ec95833c1081bc1f84 | [
"MIT"
] | null | null | null | extensions/.stubs/clrclasses/Autodesk/AutoCAD/Internal/Reactors/__init__.py | vicwjb/Pycad | 7391cd694b7a91ad9f9964ec95833c1081bc1f84 | [
"MIT"
] | null | null | null | from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import AcEdIPEReactorImpl
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import AcEdOPMObjectFilterReactorImpl
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import AcEdUcsReactorImpl
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import AcEdViewFinalChangeReactorImpl
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import AcSunViewportMonitorReactorImpl
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import AcVsESWDictionaryReactor
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import AcVsESWObjectReactor
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import ApplicationDockLayoutChangedEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import ApplicationDocumentFrameChangedEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import ApplicationEventManager
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import ApplicationMainWindowMovedEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import ApplicationMainWindowSizedEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import ApplicationMainWindowVisibleChangedEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import CuiEventManager
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import CuiLoadEventArgs
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import DictionaryEventManager
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import IPEEventArgs
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import IPEEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import IPEEventManager
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import LoadRibbonEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import OPMObjectFilterEventArgs
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import OPMObjectFilterEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import OPMObjectFilterEventManager
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import SunViewportMonitorEventManager
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import TableSubSelectFilter
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import TableSubSelectFilterEventArgs
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import TableSubSelectFilterEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import UcsEventArgs
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import UcsEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import UcsEventManager
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import ViewChangeEventArgs
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import ViewFinalChangeEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import ViewFinalChangeEventManager
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import ViewResizeEventArgs
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import ViewResizeEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import VisualStyleEventManager
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import VsESWDictionaryEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import VsESWObjectEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import WorkspaceEventArgs
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import WorkspaceRestoreEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import WorkspaceRibbonSaveEventHandler
from __clrclasses__.Autodesk.AutoCAD.Internal.Reactors import WorkspaceSettingsSavedEventHandler
| 85.860465 | 109 | 0.908992 | 336 | 3,692 | 9.488095 | 0.145833 | 0.184442 | 0.289837 | 0.382058 | 0.671895 | 0.671895 | 0.671895 | 0 | 0 | 0 | 0 | 0 | 0.045504 | 3,692 | 42 | 110 | 87.904762 | 0.904654 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 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 |
77298be29f5140b68d61b4798a2efcbdd10f94cd | 150 | py | Python | lib/galaxy/tools/util/__init__.py | rikeshi/galaxy | c536a877e4a9b3d12aa0d00fd4d5e705109a0d0a | [
"CC-BY-3.0"
] | 1,085 | 2015-02-18T16:14:38.000Z | 2022-03-30T23:52:07.000Z | lib/galaxy/tools/util/__init__.py | rikeshi/galaxy | c536a877e4a9b3d12aa0d00fd4d5e705109a0d0a | [
"CC-BY-3.0"
] | 11,253 | 2015-02-18T17:47:32.000Z | 2022-03-31T21:47:03.000Z | lib/galaxy/tools/util/__init__.py | rikeshi/galaxy | c536a877e4a9b3d12aa0d00fd4d5e705109a0d0a | [
"CC-BY-3.0"
] | 1,000 | 2015-02-18T16:18:10.000Z | 2022-03-29T08:22:56.000Z | """
Utilities used by various Galaxy tools
FIXME: These are used by tool scripts, not the framework, and should not live
in this package.
"""
| 21.428571 | 77 | 0.713333 | 23 | 150 | 4.652174 | 0.869565 | 0.11215 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.22 | 150 | 6 | 78 | 25 | 0.91453 | 0.94 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0.166667 | 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 |
91f1544bad4b62627e0c72082155313f02e67835 | 139 | py | Python | code/pay.py | liufuyang/Using_Python_Access_Web_Data | 630decbe749fef2ee8aa9d712d262e43ca7d5b1d | [
"MIT"
] | 41 | 2015-02-27T22:13:41.000Z | 2021-11-14T15:37:29.000Z | code/pay.py | liufuyang/Using_Python_Access_Web_Data | 630decbe749fef2ee8aa9d712d262e43ca7d5b1d | [
"MIT"
] | 2 | 2015-12-15T04:03:15.000Z | 2017-01-13T15:29:47.000Z | code/pay.py | liufuyang/Using_Python_Access_Web_Data | 630decbe749fef2ee8aa9d712d262e43ca7d5b1d | [
"MIT"
] | 45 | 2015-01-03T17:26:02.000Z | 2022-01-09T16:06:04.000Z | inp = raw_input('Enter Hours: ')
hours = float(inp)
inp = raw_input('Enter Rate: ')
rate = float(inp)
pay = hours * rate
print 'Pay:', pay
| 19.857143 | 32 | 0.654676 | 22 | 139 | 4.045455 | 0.409091 | 0.134831 | 0.247191 | 0.359551 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.172662 | 139 | 6 | 33 | 23.166667 | 0.773913 | 0 | 0 | 0 | 0 | 0 | 0.208633 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.166667 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
621eff62f247351ecdcf2ed5c3afa148f6cf6336 | 55 | py | Python | samanage/api/__init__.py | rodneymandap/samanage-py | 9e06b363e2fa43b3e8f92f97aa3975e1f0461a56 | [
"MIT"
] | null | null | null | samanage/api/__init__.py | rodneymandap/samanage-py | 9e06b363e2fa43b3e8f92f97aa3975e1f0461a56 | [
"MIT"
] | null | null | null | samanage/api/__init__.py | rodneymandap/samanage-py | 9e06b363e2fa43b3e8f92f97aa3975e1f0461a56 | [
"MIT"
] | 1 | 2022-01-25T21:40:48.000Z | 2022-01-25T21:40:48.000Z | from .incidents import Incident
from .sites import Site | 27.5 | 31 | 0.836364 | 8 | 55 | 5.75 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.127273 | 55 | 2 | 32 | 27.5 | 0.958333 | 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 |
6220a8faa6892ebe704d691f84d056983ece10e8 | 113 | py | Python | nullbytetest.py | nckackerman/Tank-d | 9c7818c1229dac16250a1dedb9a4f83b2273711b | [
"WTFPL"
] | null | null | null | nullbytetest.py | nckackerman/Tank-d | 9c7818c1229dac16250a1dedb9a4f83b2273711b | [
"WTFPL"
] | null | null | null | nullbytetest.py | nckackerman/Tank-d | 9c7818c1229dac16250a1dedb9a4f83b2273711b | [
"WTFPL"
] | null | null | null | if '\0' in open('poop.py').read():
print "you have null bytes in your input file"
else:
print "you don't" | 28.25 | 50 | 0.628319 | 21 | 113 | 3.380952 | 0.857143 | 0.225352 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011236 | 0.212389 | 113 | 4 | 51 | 28.25 | 0.786517 | 0 | 0 | 0 | 0 | 0 | 0.491228 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.5 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
6263ff41b468155a17bd475c0471dabe70460fcd | 147 | py | Python | examples/membership/libs/ezdata/__init__.py | kmcquinn/match | e92a23de28eab13b6b01c5d8fc48086bc1551bd7 | [
"MIT"
] | null | null | null | examples/membership/libs/ezdata/__init__.py | kmcquinn/match | e92a23de28eab13b6b01c5d8fc48086bc1551bd7 | [
"MIT"
] | null | null | null | examples/membership/libs/ezdata/__init__.py | kmcquinn/match | e92a23de28eab13b6b01c5d8fc48086bc1551bd7 | [
"MIT"
] | null | null | null | from .dictdataframe import DictDataFrame
from .plotter import Plotter, Group
from .simpletable import SimpleTable, AstroTable, AstroHelpers, stats
| 36.75 | 69 | 0.843537 | 16 | 147 | 7.75 | 0.5625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.108844 | 147 | 3 | 70 | 49 | 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 |
626fafde47b1601cf75628829996b0b29b86d3eb | 144 | py | Python | basic 0/argv0.py | rdparihar/Python | 5287081752e1cf69930ebe3bb94fa31486ae42a7 | [
"MIT"
] | null | null | null | basic 0/argv0.py | rdparihar/Python | 5287081752e1cf69930ebe3bb94fa31486ae42a7 | [
"MIT"
] | null | null | null | basic 0/argv0.py | rdparihar/Python | 5287081752e1cf69930ebe3bb94fa31486ae42a7 | [
"MIT"
] | null | null | null | import sys
if len(sys.argv) == 2:
print("hello, {}".format(sys.argv[1]))
#print("hello,"+(sys.argv[1]))
else:
print("hello world")
| 18 | 42 | 0.576389 | 22 | 144 | 3.772727 | 0.545455 | 0.253012 | 0.192771 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02521 | 0.173611 | 144 | 7 | 43 | 20.571429 | 0.672269 | 0.201389 | 0 | 0 | 0 | 0 | 0.175439 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0.4 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
6275204368872c802f88c3e0882fbe8664d42180 | 66 | py | Python | SQS/SQS-NotificationHandler/lambdaFunction.py | ptrehan/Python-AWS-Example | 8d6b9e962357a0df54efd9544267ce20043ae632 | [
"MIT"
] | null | null | null | SQS/SQS-NotificationHandler/lambdaFunction.py | ptrehan/Python-AWS-Example | 8d6b9e962357a0df54efd9544267ce20043ae632 | [
"MIT"
] | null | null | null | SQS/SQS-NotificationHandler/lambdaFunction.py | ptrehan/Python-AWS-Example | 8d6b9e962357a0df54efd9544267ce20043ae632 | [
"MIT"
] | null | null | null | import json
def lambda_handler(event, context):
print(event)
| 13.2 | 35 | 0.742424 | 9 | 66 | 5.333333 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 66 | 4 | 36 | 16.5 | 0.872727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0 | 0.666667 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
65aaa5fab6dbfef421a63ce2c7b794ab1990b026 | 59 | py | Python | helloworld.py | astro-alice/gitworkshop | dc1562c60c712172555057d34675ca3f6a675452 | [
"BSD-3-Clause"
] | null | null | null | helloworld.py | astro-alice/gitworkshop | dc1562c60c712172555057d34675ca3f6a675452 | [
"BSD-3-Clause"
] | null | null | null | helloworld.py | astro-alice/gitworkshop | dc1562c60c712172555057d34675ca3f6a675452 | [
"BSD-3-Clause"
] | null | null | null | print("Hello World")
print("Hello Gurl")
print("Whats Up")
| 14.75 | 20 | 0.694915 | 9 | 59 | 4.555556 | 0.666667 | 0.487805 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101695 | 59 | 3 | 21 | 19.666667 | 0.773585 | 0 | 0 | 0 | 0 | 0 | 0.491525 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
65c6aa9ee02fe9f86fb5f1967f2bd7a76b72d7c6 | 2,729 | py | Python | l_loc.py | Tavnos/Science_Discord_Bot | 94504fde9d91d4a128966c46c1a8266767683e01 | [
"Apache-2.0"
] | 1 | 2021-07-09T15:08:05.000Z | 2021-07-09T15:08:05.000Z | l_loc.py | Tavnos/Science_Discord_Bot | 94504fde9d91d4a128966c46c1a8266767683e01 | [
"Apache-2.0"
] | null | null | null | l_loc.py | Tavnos/Science_Discord_Bot | 94504fde9d91d4a128966c46c1a8266767683e01 | [
"Apache-2.0"
] | 1 | 2020-12-14T20:32:31.000Z | 2020-12-14T20:32:31.000Z | class Loc_D:
ls_read = []
def init_ls_list(self):
save_txt = open('user_list.txt', 'r')
str_read = save_txt.read()
save_txt.close()
str_read = str_read
self.ls_read = str_read.split()
def make_user_file(self):
save_txt = open('user_list.txt', 'w')
txt_nrw = ''
save_txt.write(txt_nrw)
save_txt.close()
def add_user(self, username):
username = username.replace('<','')
username = username.replace('>','')
save_txt = open('user_list.txt', 'r')
str_read = save_txt.read()
save_txt.close()
str_read = str_read + '\n' + username
self.ls_read = str_read.split()
save_txt = open('user_list.txt', 'w')
save_txt.write(str_read)
save_txt.close()
save_usr_txt = open('{}.txt'.format(username), 'w')
usr_txt_nrw = 'personal note:'
save_usr_txt.write(usr_txt_nrw)
save_usr_txt.close()
def display_user_file(self):
save_txt = open('user_list.txt', 'r')
str_read = save_txt.read()
ls_read = str_read.split()
u_read = ''
for i in ls_read:
u_read += "<{}> \n".format(i)
return u_read
def display_user_file_list(self):
save_txt = open('user_list.txt', 'r')
str_read = save_txt.read()
ls_read = str_read.split()
u_read = []
for i in ls_read:
u_read += ["{}".format(i)]
return u_read
def store_note(self, username, d_note):
username = username.replace('<','')
username = username.replace('>','')
if username in self.ls_read:
save_usr_txt = open('{}.txt'.format(username), 'r')
save_usr_str_read = save_usr_txt.read()
save_usr_txt.close()
save_usr_str_read = save_usr_str_read + '\n' + d_note
save_usr_txt = open('{}.txt'.format(username), 'w')
save_usr_txt.write(save_usr_str_read)
save_usr_txt.close()
def get_note(self, username):
username = username.replace('<','')
username = username.replace('>','')
if username in self.ls_read:
save_usr_txt = open('{}.txt'.format(username), 'r')
save_usr_str_read = save_usr_txt.read()
save_usr_txt.close()
return save_usr_str_read
def reset_note(self, username):
username = username.replace('<','')
username = username.replace('>','')
if username in self.ls_read:
save_usr_txt = open('{}.txt'.format(username), 'w')
usr_txt_nrw = 'personal note:'.format(username)
save_usr_txt.write(usr_txt_nrw)
save_usr_txt.close() | 38.43662 | 65 | 0.567241 | 363 | 2,729 | 3.92011 | 0.110193 | 0.103303 | 0.105411 | 0.078707 | 0.832045 | 0.824315 | 0.749122 | 0.71539 | 0.652143 | 0.622628 | 0 | 0 | 0.291682 | 2,729 | 71 | 66 | 38.43662 | 0.736161 | 0 | 0 | 0.661972 | 0 | 0 | 0.061538 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.112676 | false | 0 | 0 | 0 | 0.183099 | 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 |
65d3646f382bc9bad6171c53e710fcb76436fd83 | 23 | py | Python | agolutil/__init__.py | cityofaustin/atd-utils-agol | cceee75cd9dcaee1519b7a71a78b1bf1249e09e4 | [
"CC0-1.0"
] | 1 | 2019-05-22T02:11:25.000Z | 2019-05-22T02:11:25.000Z | agolutil/__init__.py | cityofaustin/atd-utils-agol | cceee75cd9dcaee1519b7a71a78b1bf1249e09e4 | [
"CC0-1.0"
] | null | null | null | agolutil/__init__.py | cityofaustin/atd-utils-agol | cceee75cd9dcaee1519b7a71a78b1bf1249e09e4 | [
"CC0-1.0"
] | null | null | null | from .agolutil import * | 23 | 23 | 0.782609 | 3 | 23 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130435 | 23 | 1 | 23 | 23 | 0.9 | 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 |
02a28f5bd65c7b7cb46a631599f2796520a05150 | 116 | py | Python | src/wagtail_rest_pack/generic_forms/actions/action.py | domibydzovsky/wagtail-rest-pack | 821d5d4111a4a7665e50272035e90f836a2c60c2 | [
"MIT"
] | null | null | null | src/wagtail_rest_pack/generic_forms/actions/action.py | domibydzovsky/wagtail-rest-pack | 821d5d4111a4a7665e50272035e90f836a2c60c2 | [
"MIT"
] | null | null | null | src/wagtail_rest_pack/generic_forms/actions/action.py | domibydzovsky/wagtail-rest-pack | 821d5d4111a4a7665e50272035e90f836a2c60c2 | [
"MIT"
] | null | null | null | from wagtail.core import blocks
class FormAction:
@staticmethod
def block_type() -> tuple:
pass
| 11.6 | 31 | 0.655172 | 13 | 116 | 5.769231 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.275862 | 116 | 9 | 32 | 12.888889 | 0.892857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | true | 0.2 | 0.2 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 5 |
b828c95798237b235caa00c7f0dc89f7cc8ba99a | 125 | py | Python | helper_functions.py | justinpaulturner/youtube-kanye-player | f5ec079936113c3d4028f08f33fd6c0701030c1a | [
"CC0-1.0"
] | null | null | null | helper_functions.py | justinpaulturner/youtube-kanye-player | f5ec079936113c3d4028f08f33fd6c0701030c1a | [
"CC0-1.0"
] | null | null | null | helper_functions.py | justinpaulturner/youtube-kanye-player | f5ec079936113c3d4028f08f33fd6c0701030c1a | [
"CC0-1.0"
] | null | null | null | from random import uniform
from time import sleep
def rand_sleep(minimim=.5,maximum=3):
sleep(uniform(minimim,maximum))
| 20.833333 | 37 | 0.776 | 19 | 125 | 5.052632 | 0.631579 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018349 | 0.128 | 125 | 5 | 38 | 25 | 0.862385 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.5 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
b8404a488a6688cb2ede9ed3a935b8386841f620 | 8,035 | py | Python | tests/test_layers/test_2d/test_layer.py | rahulgupta9202/ColossalAI | 993088d45eaa032e39cf5959df2a506f0663bc2e | [
"Apache-2.0"
] | 1 | 2021-11-02T14:00:27.000Z | 2021-11-02T14:00:27.000Z | tests/test_layers/test_2d/test_layer.py | rahulgupta9202/ColossalAI | 993088d45eaa032e39cf5959df2a506f0663bc2e | [
"Apache-2.0"
] | null | null | null | tests/test_layers/test_2d/test_layer.py | rahulgupta9202/ColossalAI | 993088d45eaa032e39cf5959df2a506f0663bc2e | [
"Apache-2.0"
] | null | null | null | import torch
from torch.nn import Parameter
from colossalai.context.parallel_mode import ParallelMode
from colossalai.core import global_context as gpc
from colossalai.nn import Linear2D, LayerNorm2D, TransformerSelfAttention2D, TransformerMLP2D, TransformerLayer2D
from colossalai.utils import get_current_device, print_rank_0
from common import HIDDEN_SIZE, DEPTH, BATCH_SIZE, SEQ_LENGTH, check_equal
def check_linear():
device = get_current_device()
dtype = torch.float32
INPUT_SIZE = HIDDEN_SIZE
OUTPUT_SIZE = 2 * HIDDEN_SIZE
j = gpc.get_local_rank(ParallelMode.PARALLEL_2D_ROW)
i = gpc.get_local_rank(ParallelMode.PARALLEL_2D_COL)
layer = Linear2D(INPUT_SIZE, OUTPUT_SIZE)
A_shape = (BATCH_SIZE, SEQ_LENGTH, INPUT_SIZE)
A_master = torch.randn(A_shape, dtype=dtype, device=device)
torch.distributed.broadcast(A_master, src=0)
A = torch.chunk(A_master, DEPTH, dim=0)[i]
A = torch.chunk(A, DEPTH, dim=-1)[j]
A = A.clone()
A.requires_grad = True
W_shape = (INPUT_SIZE, OUTPUT_SIZE)
W_master = torch.randn(W_shape, dtype=dtype, device=device)
torch.distributed.broadcast(W_master, src=0)
W = torch.chunk(W_master, DEPTH, dim=0)[i]
W = torch.chunk(W, DEPTH, dim=-1)[j]
W = W.clone()
W.requires_grad = True
B_shape = (OUTPUT_SIZE)
B_master = torch.randn(B_shape, dtype=dtype, device=device)
torch.distributed.broadcast(B_master, src=0)
B = torch.chunk(B_master, DEPTH, dim=0)[j]
B = B.clone()
B.requires_grad = True
layer.weight = Parameter(W)
layer.bias = Parameter(B)
out = layer(A)
A_master = A_master.clone()
A_master.requires_grad = True
W_master = W_master.clone()
W_master.requires_grad = True
B_master = B_master.clone()
B_master.requires_grad = True
C_master = torch.matmul(A_master, W_master) + B_master
C = torch.chunk(C_master, DEPTH, dim=0)[i]
C = torch.chunk(C, DEPTH, dim=-1)[j]
check_equal(out, C)
print_rank_0('linear forward: pass')
grad_shape = C_master.shape
grad_master = torch.randn(grad_shape, dtype=dtype, device=get_current_device())
torch.distributed.broadcast(grad_master, src=0)
grad = torch.chunk(grad_master, DEPTH, dim=0)[i]
grad = torch.chunk(grad, DEPTH, dim=-1)[j]
out.backward(grad)
C_master.backward(grad_master)
A_grad = A_master.grad
A_grad = torch.chunk(A_grad, DEPTH, dim=0)[i]
A_grad = torch.chunk(A_grad, DEPTH, dim=-1)[j]
check_equal(A_grad, A.grad)
W_grad = W_master.grad
W_grad = torch.chunk(W_grad, DEPTH, dim=0)[i]
W_grad = torch.chunk(W_grad, DEPTH, dim=-1)[j]
check_equal(W_grad, layer.weight.grad)
B_grad = B_master.grad
B_grad = torch.chunk(B_grad, DEPTH, dim=0)[j]
if i == 0:
check_equal(B_grad, layer.bias.grad)
print_rank_0('linear backward: pass')
def check_layernorm():
device = get_current_device()
dtype = torch.float32
INPUT_SIZE = HIDDEN_SIZE
EPS = 1e-12
j = gpc.get_local_rank(ParallelMode.PARALLEL_2D_ROW)
i = gpc.get_local_rank(ParallelMode.PARALLEL_2D_COL)
layernorm = LayerNorm2D(INPUT_SIZE)
A_shape = (BATCH_SIZE, SEQ_LENGTH, INPUT_SIZE)
A_master = torch.randn(A_shape, dtype=dtype, device=device)
torch.distributed.broadcast(A_master, src=0)
A = torch.chunk(A_master, DEPTH, dim=0)[i]
A = torch.chunk(A, DEPTH, dim=-1)[j]
A = A.clone()
A.requires_grad = True
out = layernorm(A)
A_master = A_master.clone()
A_master.requires_grad = True
E_master = torch.sum(A_master, dim=-1, keepdim=True)
E_master /= INPUT_SIZE
V_master = torch.sum(A_master * A_master, dim=-1, keepdim=True)
V_master /= INPUT_SIZE
V_master = V_master - E_master * E_master
V_master = 1.0 / torch.sqrt(V_master + EPS)
C_master = (A_master - E_master) * V_master
C = torch.chunk(C_master, DEPTH, dim=0)[i]
C = torch.chunk(C, DEPTH, dim=-1)[j]
check_equal(out, C)
print_rank_0('layer norm forward: pass')
grad_shape = C_master.shape
grad_master = torch.randn(grad_shape, dtype=dtype, device=get_current_device())
torch.distributed.broadcast(grad_master, src=0)
grad = torch.chunk(grad_master, DEPTH, dim=0)[i]
grad = torch.chunk(grad, DEPTH, dim=-1)[j]
out.backward(grad)
C_master.backward(grad_master)
A_grad = A_master.grad
A_grad = torch.chunk(A_grad, DEPTH, dim=0)[i]
A_grad = torch.chunk(A_grad, DEPTH, dim=-1)[j]
check_equal(A_grad, A.grad)
print_rank_0('layer norm backward: pass')
def check_attention():
device = get_current_device()
dtype = torch.float32
INPUT_SIZE = HIDDEN_SIZE
NUM_ATTENTION_HEADS = 2
j = gpc.get_local_rank(ParallelMode.PARALLEL_2D_ROW)
i = gpc.get_local_rank(ParallelMode.PARALLEL_2D_COL)
layer = TransformerSelfAttention2D(
HIDDEN_SIZE,
NUM_ATTENTION_HEADS,
attention_dropout_prob=0.5,
hidden_dropout_prob=0.5,
)
A_shape = (BATCH_SIZE, SEQ_LENGTH, INPUT_SIZE)
A_master = torch.randn(A_shape, dtype=dtype, device=device)
torch.distributed.broadcast(A_master, src=0)
A = torch.chunk(A_master, DEPTH, dim=0)[i]
A = torch.chunk(A, DEPTH, dim=-1)[j]
A = A.clone()
A.requires_grad = True
mask_shape = (BATCH_SIZE // DEPTH, NUM_ATTENTION_HEADS // DEPTH, SEQ_LENGTH, SEQ_LENGTH)
attention_mask = torch.zeros(mask_shape, dtype=dtype, device=device)
out = layer(A, attention_mask)
assert out.shape == (BATCH_SIZE // DEPTH, SEQ_LENGTH, INPUT_SIZE // DEPTH)
print_rank_0('self attention forward: pass')
grad_shape = out.shape
grad = torch.randn(grad_shape, dtype=dtype, device=device)
out.backward(grad)
assert A.grad.shape == A.shape
print_rank_0('self attention backward: pass')
def check_mlp():
device = get_current_device()
dtype = torch.float32
INPUT_SIZE = HIDDEN_SIZE
j = gpc.get_local_rank(ParallelMode.PARALLEL_2D_ROW)
i = gpc.get_local_rank(ParallelMode.PARALLEL_2D_COL)
layer = TransformerMLP2D(
HIDDEN_SIZE,
dropout_prob=0.5,
act_func='gelu',
)
A_shape = (BATCH_SIZE, SEQ_LENGTH, INPUT_SIZE)
A_master = torch.randn(A_shape, dtype=dtype, device=device)
torch.distributed.broadcast(A_master, src=0)
A = torch.chunk(A_master, DEPTH, dim=0)[i]
A = torch.chunk(A, DEPTH, dim=-1)[j]
A = A.clone()
A.requires_grad = True
out = layer(A)
assert out.shape == (BATCH_SIZE // DEPTH, SEQ_LENGTH, INPUT_SIZE // DEPTH)
print_rank_0('mlp forward: pass')
grad_shape = out.shape
grad = torch.randn(grad_shape, dtype=dtype, device=device)
out.backward(grad)
assert A.grad.shape == A.shape
print_rank_0('mlp backward: pass')
def check_transformerlayer():
device = get_current_device()
dtype = torch.float32
INPUT_SIZE = HIDDEN_SIZE
NUM_ATTENTION_HEADS = 2
j = gpc.get_local_rank(ParallelMode.PARALLEL_2D_ROW)
i = gpc.get_local_rank(ParallelMode.PARALLEL_2D_COL)
layer = TransformerLayer2D(
HIDDEN_SIZE,
NUM_ATTENTION_HEADS,
act_func='gelu',
attention_dropout_prob=0.5,
hidden_dropout_prob=0.5)
A_shape = (BATCH_SIZE, SEQ_LENGTH, INPUT_SIZE)
A_master = torch.randn(A_shape, dtype=dtype, device=device)
torch.distributed.broadcast(A_master, src=0)
A = torch.chunk(A_master, DEPTH, dim=0)[i]
A = torch.chunk(A, DEPTH, dim=-1)[j]
A = A.clone()
A.requires_grad = True
mask_shape = (BATCH_SIZE // DEPTH, NUM_ATTENTION_HEADS // DEPTH, SEQ_LENGTH, SEQ_LENGTH)
attention_mask = torch.zeros(mask_shape, dtype=dtype, device=device)
out = layer(A, attention_mask)
assert out.shape == (BATCH_SIZE // DEPTH, SEQ_LENGTH, INPUT_SIZE // DEPTH)
print_rank_0('transformerlayer forward: pass')
grad_shape = out.shape
grad = torch.randn(grad_shape, dtype=dtype, device=device)
out.backward(grad)
assert A.grad.shape == A.shape
print_rank_0('transformerlayer backward: pass')
| 32.269076 | 113 | 0.689981 | 1,216 | 8,035 | 4.305921 | 0.081414 | 0.037433 | 0.025783 | 0.05615 | 0.759931 | 0.715241 | 0.706837 | 0.704545 | 0.673988 | 0.673988 | 0 | 0.015257 | 0.192408 | 8,035 | 248 | 114 | 32.399194 | 0.791647 | 0 | 0 | 0.642857 | 0 | 0 | 0.031238 | 0 | 0 | 0 | 0 | 0 | 0.030612 | 1 | 0.02551 | false | 0.05102 | 0.035714 | 0 | 0.061224 | 0.056122 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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.