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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ddaf32623e9212a8ad7d7c91e2ffa35b5445c1d1
| 63
|
py
|
Python
|
pysparktestingexample/string_helpers.py
|
zhangabner/pyspark-debug-test
|
e79ab5f1784900b28b0625badd0cec77c4503071
|
[
"CNRI-Python"
] | null | null | null |
pysparktestingexample/string_helpers.py
|
zhangabner/pyspark-debug-test
|
e79ab5f1784900b28b0625badd0cec77c4503071
|
[
"CNRI-Python"
] | null | null | null |
pysparktestingexample/string_helpers.py
|
zhangabner/pyspark-debug-test
|
e79ab5f1784900b28b0625badd0cec77c4503071
|
[
"CNRI-Python"
] | null | null | null |
def dots_to_underscores(s):
return s.replace(".", "_", 1)
| 15.75
| 33
| 0.619048
| 9
| 63
| 4
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.019231
| 0.174603
| 63
| 3
| 34
| 21
| 0.673077
| 0
| 0
| 0
| 0
| 0
| 0.032258
| 0
| 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
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
ddb75ed5037c132c5fb0e2b04d93692055dcd63e
| 193
|
py
|
Python
|
imgui_ros/scripts/old/imgui_ros/__init__.py
|
lucasw/imgui_ros
|
e4cc3474cecedfa51673677abb0cb38b8eef16fc
|
[
"BSD-3-Clause"
] | 25
|
2019-01-10T04:11:59.000Z
|
2021-11-03T17:31:57.000Z
|
imgui_ros/scripts/old/imgui_ros/__init__.py
|
lucasw/imgui_ros
|
e4cc3474cecedfa51673677abb0cb38b8eef16fc
|
[
"BSD-3-Clause"
] | 82
|
2018-10-19T04:49:03.000Z
|
2020-09-22T16:14:09.000Z
|
imgui_ros/scripts/old/imgui_ros/__init__.py
|
lucasw/imgui_ros
|
e4cc3474cecedfa51673677abb0cb38b8eef16fc
|
[
"BSD-3-Clause"
] | 2
|
2021-06-18T18:46:34.000Z
|
2021-09-29T02:52:04.000Z
|
from .add_shaders import AddShadersNode, add_default_shaders
from .demo_imgui_ros import DemoImguiRos
from .demo_gui import DemoGui
from .cameras import Cameras
from .pub_shape import PubShape
| 32.166667
| 60
| 0.860104
| 28
| 193
| 5.678571
| 0.571429
| 0.100629
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.108808
| 193
| 5
| 61
| 38.6
| 0.924419
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
ddbaaf2153b2522139d58289ecfe9c8ba637802a
| 449
|
py
|
Python
|
OpenGLCffi/GL/EXT/AMD/sparse_texture.py
|
cydenix/OpenGLCffi
|
c78f51ae5e6b655eb2ea98f072771cf69e2197f3
|
[
"MIT"
] | null | null | null |
OpenGLCffi/GL/EXT/AMD/sparse_texture.py
|
cydenix/OpenGLCffi
|
c78f51ae5e6b655eb2ea98f072771cf69e2197f3
|
[
"MIT"
] | null | null | null |
OpenGLCffi/GL/EXT/AMD/sparse_texture.py
|
cydenix/OpenGLCffi
|
c78f51ae5e6b655eb2ea98f072771cf69e2197f3
|
[
"MIT"
] | null | null | null |
from OpenGLCffi.GL import params
@params(api='gl', prms=['target', 'internalFormat', 'width', 'height', 'depth', 'layers', 'flags'])
def glTexStorageSparseAMD(target, internalFormat, width, height, depth, layers, flags):
pass
@params(api='gl', prms=['texture', 'target', 'internalFormat', 'width', 'height', 'depth', 'layers', 'flags'])
def glTextureStorageSparseAMD(texture, target, internalFormat, width, height, depth, layers, flags):
pass
| 37.416667
| 110
| 0.712695
| 49
| 449
| 6.530612
| 0.387755
| 0.25
| 0.3125
| 0.3875
| 0.675
| 0.675
| 0.675
| 0.675
| 0
| 0
| 0
| 0
| 0.10245
| 449
| 11
| 111
| 40.818182
| 0.794045
| 0
| 0
| 0.285714
| 0
| 0
| 0.234899
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0.285714
| 0.142857
| 0
| 0.428571
| 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
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
ddd97923a37ec3e4bae2d4ee7b21a913c0579f28
| 164
|
py
|
Python
|
utils/model_loader.py
|
qiuhuachuan/poly-encoder
|
cfd8c2719a15bc90e73f07852f31986d3a42d300
|
[
"MIT"
] | null | null | null |
utils/model_loader.py
|
qiuhuachuan/poly-encoder
|
cfd8c2719a15bc90e73f07852f31986d3a42d300
|
[
"MIT"
] | null | null | null |
utils/model_loader.py
|
qiuhuachuan/poly-encoder
|
cfd8c2719a15bc90e73f07852f31986d3a42d300
|
[
"MIT"
] | null | null | null |
from transformers import BertModel, BertConfig
model_path = './models'
bert = BertModel.from_pretrained(model_path)
config = BertConfig.from_pretrained(model_path)
| 32.8
| 47
| 0.829268
| 20
| 164
| 6.55
| 0.55
| 0.206107
| 0.290076
| 0.351145
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.085366
| 164
| 5
| 47
| 32.8
| 0.873333
| 0
| 0
| 0
| 0
| 0
| 0.048485
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 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
| 0
| 0
| 0
| 0
|
0
| 5
|
ddfabf57e3a97f009d59153a18762e23169ee8bf
| 53
|
py
|
Python
|
third_party/modeling/__init__.py
|
qdmy/Adelaidet-Quantization
|
e88cf41c62dc3944d2bd57ffc1d365535b0a1c4b
|
[
"Apache-2.0"
] | null | null | null |
third_party/modeling/__init__.py
|
qdmy/Adelaidet-Quantization
|
e88cf41c62dc3944d2bd57ffc1d365535b0a1c4b
|
[
"Apache-2.0"
] | null | null | null |
third_party/modeling/__init__.py
|
qdmy/Adelaidet-Quantization
|
e88cf41c62dc3944d2bd57ffc1d365535b0a1c4b
|
[
"Apache-2.0"
] | null | null | null |
from .backbone import fpn
#print("import backbone")
| 13.25
| 25
| 0.754717
| 7
| 53
| 5.714286
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.132075
| 53
| 3
| 26
| 17.666667
| 0.869565
| 0.45283
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
ddfcd52ae10e91e000ed9999de0f08bd6da376b1
| 131
|
py
|
Python
|
various/import_order/dundunall/package/__init__.py
|
sideroff/python-exercises
|
6a9cc55735d977a71697204c734b3ade84a0c4fd
|
[
"MIT"
] | null | null | null |
various/import_order/dundunall/package/__init__.py
|
sideroff/python-exercises
|
6a9cc55735d977a71697204c734b3ade84a0c4fd
|
[
"MIT"
] | 4
|
2020-03-24T18:00:07.000Z
|
2021-06-02T00:51:22.000Z
|
various/import_order/dundunall/package/__init__.py
|
sideroff/python-exercises
|
6a9cc55735d977a71697204c734b3ade84a0c4fd
|
[
"MIT"
] | null | null | null |
from .functions.module import *
from .functions.module2 import *
__all__ = (functions.module.__all__ + functions.module2.__all__)
| 26.2
| 64
| 0.78626
| 15
| 131
| 6.066667
| 0.4
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.017094
| 0.10687
| 131
| 4
| 65
| 32.75
| 0.760684
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
fb0f777e1ebae048356f5758b291586d70e7d64e
| 111
|
py
|
Python
|
5_8_8.py
|
rursvd/pynumerical2
|
4b2d33125b64a39099ac8eddef885e0ea11b237d
|
[
"MIT"
] | null | null | null |
5_8_8.py
|
rursvd/pynumerical2
|
4b2d33125b64a39099ac8eddef885e0ea11b237d
|
[
"MIT"
] | null | null | null |
5_8_8.py
|
rursvd/pynumerical2
|
4b2d33125b64a39099ac8eddef885e0ea11b237d
|
[
"MIT"
] | 1
|
2019-12-03T01:34:19.000Z
|
2019-12-03T01:34:19.000Z
|
from numpy import array
A = array([[1,2,3],[4,5,6],[7,8,9]])
print('A[:,0] =',A[:,0])
print('A[:,2] =',A[:,2])
| 22.2
| 36
| 0.477477
| 25
| 111
| 2.12
| 0.64
| 0.226415
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.13
| 0.099099
| 111
| 4
| 37
| 27.75
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0.144144
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 0.5
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
fb268f6a71e6844486da95619572e5686cfbac7a
| 381
|
py
|
Python
|
swarm_tasks/tasks/__init__.py
|
rmvanarse/swarm_tasks
|
3335297ba8fcdbff756ae519002bcce919d54a84
|
[
"MIT"
] | 6
|
2021-03-13T12:54:18.000Z
|
2022-01-29T12:12:28.000Z
|
swarm_tasks/tasks/__init__.py
|
rmvanarse/swarm_tasks
|
3335297ba8fcdbff756ae519002bcce919d54a84
|
[
"MIT"
] | null | null | null |
swarm_tasks/tasks/__init__.py
|
rmvanarse/swarm_tasks
|
3335297ba8fcdbff756ae519002bcce919d54a84
|
[
"MIT"
] | 2
|
2021-08-06T15:02:15.000Z
|
2022-02-08T12:11:30.000Z
|
#This module combines functions from the rest of the modules to create functions for tasks
#Structure of the files is similar to ../test.py and ../controllers
import numpy as np
import os
import swarm_tasks.utils
import swarm_tasks.simulation
import swarm_tasks.envs
import swarm_tasks.controllers
import swarm_tasks.modules
#TODO: os.path.dirname() global var may be needed
| 22.411765
| 90
| 0.805774
| 61
| 381
| 4.95082
| 0.622951
| 0.182119
| 0.264901
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.141732
| 381
| 16
| 91
| 23.8125
| 0.923547
| 0.532808
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0625
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
34a1de0cf7a594688c785af071288fa1da5a0d96
| 10,960
|
py
|
Python
|
discovery_sdk_utils/tests/test_discovery_sdk_utils.py
|
sv-github/greenkey-discovery-sdk
|
75ea9e2c2ab1f1381c4727f43015b6867ba39239
|
[
"Apache-2.0"
] | null | null | null |
discovery_sdk_utils/tests/test_discovery_sdk_utils.py
|
sv-github/greenkey-discovery-sdk
|
75ea9e2c2ab1f1381c4727f43015b6867ba39239
|
[
"Apache-2.0"
] | null | null | null |
discovery_sdk_utils/tests/test_discovery_sdk_utils.py
|
sv-github/greenkey-discovery-sdk
|
75ea9e2c2ab1f1381c4727f43015b6867ba39239
|
[
"Apache-2.0"
] | null | null | null |
import pytest
import sys
from discovery_sdk_utils import find_errors_in_entity_definition
class TestEntityDefinitionValidator(object):
def test_entity_definition_is_dictionary(self):
entity_definition = 'this is a string'
errors = find_errors_in_entity_definition(entity_definition)
assert errors == ['Your ENTITY_DEFINITION must be a dictionary!']
def test_patterns_property_exists(self):
entity_definition = {'missing': 'keys'}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == ['Your ENTITY_DEFINITION must contain a "patterns" property!']
def test_patterns_property_has_correct_value_string(self):
entity_definition = {'patterns': 'wrong stuff'}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == [
'The "patterns" property of ENTITY_DEFINITION must be a list of lists of lists of strings. e.g. [[["NUM"], ["LETTER"]]]'
]
def test_patterns_property_has_correct_value_list(self):
entity_definition = {'patterns': ['wrong stuff']}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == [
'The "patterns" property of ENTITY_DEFINITION must be a list of lists of lists of strings. e.g. [[["NUM"], ["LETTER"]]]'
]
def test_patterns_property_has_correct_value_nested_list(self):
entity_definition = {'patterns': [['still wrong stuff']]}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == [
'The "patterns" property of ENTITY_DEFINITION must be a list of lists of lists of strings. e.g. [[["NUM"], ["LETTER"]]]'
]
def test_patterns_property_has_correct_value_valid(self):
# this finally has a correct patterns value
entity_definition = {'patterns': [[['NUM']]]}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == []
def test_validate_extraTokens(self):
entity_definition = {'patterns': [[['defined_wrong']]], 'extraTokens': 'defined_wrong'}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == ['The property "extraTokens" must be a tuple!']
def test_validate_extraTokens_2(self):
entity_definition = {'patterns': [[['defined_wrong']]], 'extraTokens': ['defined_wrong']}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == ['The property "extraTokens" must be a tuple!']
def test_validate_extra_tokens_and_pattern_tokens(self):
entity_definition = {'patterns': [[['what_am_i']]]}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == [
'The token "what_am_i" is used in "patterns" but is not a built in token, please define "what_am_i" in "extraTokens"'
]
def test_validate_extra_tokens_and_pattern_tokens_tuple_of_strings(self):
entity_definition = {'patterns': [[['defined_wrong']]], 'extraTokens': ('defined_wrong',)}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == ['Your "extraTokens" must be a tuple of dictionaries!']
def test_validate_extra_tokens_and_pattern_tokens_missing_values_prop(self):
entity_definition = {'patterns': [[['defined_wrong']]], 'extraTokens': ({'label': 'defined_wrong'},)}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == ['Your "extraTokens" dictionaries must contain a "values" property!']
def test_validate_extra_tokens_and_pattern_tokens_missing_label_prop(self):
entity_definition = {'patterns': [[['defined_wrong']]], 'extraTokens': ({'values': ('defined_wrong')},)}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == ['Your "extraTokens" dictionaries must contain a "label" property!']
def test_validate_extra_tokens_and_pattern_tokens_tokens_not_defined(self):
entity_definition = {
'patterns': [[['defined_wrong']]],
'extraTokens': ({
'label': 'correctly',
'values': ('defined')
},)
}
errors = find_errors_in_entity_definition(entity_definition)
expected_errors = [
'The token "correctly" is defined in "extraTokens" but is not used in any "patterns"',
'The token "defined_wrong" is used in "patterns" but is not a built in token, '
'please define "defined_wrong" in "extraTokens"'
]
assert errors == expected_errors
def test_validate_extra_tokens_and_pattern_tokens_valid(self):
# this function should finally pass
entity_definition = {
'patterns': [[['DEFINED_CORRECT']]],
'extraTokens': ({
'label': 'DEFINED_CORRECT',
'values': ('defined')
},)
}
assert [] == find_errors_in_entity_definition(entity_definition)
def test_validate_extraCleaning_is_dict(self):
entity_definition = {
'patterns': [[['DEFINED_CORRECT']]],
'extraTokens': ({
'label': 'DEFINED_CORRECT',
'values': ('defined')
},),
'extraCleaning': ''
}
assert ['The property "extraCleaning" must be a dict!'] == find_errors_in_entity_definition(entity_definition)
def test_validate_extraCleaning_is_functions(self):
entity_definition = {
'patterns': [[['DEFINED_CORRECT']]],
'extraTokens': ({
'label': 'DEFINED_CORRECT',
'values': ('defined')
},),
'extraCleaning': {
'NUM': ''
}
}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == ['Each property in "extraCleaning" must be a function!']
def test_do_symbol_type_checks_spacing(self):
entity_definition = {
'patterns': [[['DEFINED_CORRECT']]],
'extraTokens': ({
'label': 'DEFINED_CORRECT',
'values': ('defined')
},),
'spacing': ''
}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == ['The property "spacing" must be a dict!']
def test_do_symbol_type_checks_ontological_tags(self):
entity_definition = {
'patterns': [[['DEFINED_CORRECT']]],
'extraTokens': ({
'label': 'DEFINED_CORRECT',
'values': ('defined')
},),
'ontological_tags': ''
}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == ['The property "ontological_tags" must be a bool!']
def test_do_symbol_type_checks_entityCleaning(self):
entity_definition = {
'patterns': [[['DEFINED_CORRECT']]],
'extraTokens': ({
'label': 'DEFINED_CORRECT',
'values': ('defined')
},),
'entityCleaning': ''
}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == ['The property "entityCleaning" must be a function!']
def test_do_symbol_type_checks_entityValidation(self):
entity_definition = {
'patterns': [[['DEFINED_CORRECT']]],
'extraTokens': ({
'label': 'DEFINED_CORRECT',
'values': ('defined')
},),
'entityValidation': ''
}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == ['The property "entityValidation" must be a function!']
def test_validate_collapsiblePatterns(self):
entity_definition = {
'patterns': [[['DEFINED_CORRECT']]],
'extraTokens': ({
'label': 'DEFINED_CORRECT',
'values': ('defined')
},),
'collapsiblePatterns': ''
}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == ['The property "collapsiblePatterns" must be a tuple!']
def test_validate_many_errors(self):
entity_definition = {
'patterns': [[['defined_wrong']]],
'extraTokens': ({
'label': 'correctly',
'values': ('defined')
},),
'extraCleaning': {
'NUM': ''
},
'spacing': '',
'entityValidation': '',
'collapsiblePatterns': '',
'entityCleaning': '',
'ontological_tags': ''
}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == [
'The token "correctly" is defined in "extraTokens" but is not used in any "patterns"',
'The token "defined_wrong" is used in "patterns" but is not a built in token, '
'please define "defined_wrong" in "extraTokens"', 'Each property in "extraCleaning" must be a function!',
'The property "spacing" must be a dict!', 'The property "ontological_tags" must be a bool!',
'The property "entityCleaning" must be a function!', 'The property "entityValidation" must be a function!',
'The property "collapsiblePatterns" must be a tuple!'
]
def test_valid_definition(self):
def dumb_function(arg):
return arg
def dumb_validator(arg):
return True
entity_definition = {
'patterns': [[['DEFINED_CORRECT']]],
'extraTokens': ({
'label': 'DEFINED_CORRECT',
'values': ('defined')
},),
'extraCleaning': {
'DEFINED_CORRECT': dumb_function
},
'spacing': {
'NUM': '',
'NUM_ORD': '',
'default': ' ',
},
'ontological_tags': False,
'entityCleaning': dumb_function,
'entityValidation': dumb_validator,
'collapsiblePatterns': (),
}
errors = find_errors_in_entity_definition(entity_definition)
assert errors == []
def test_importing_address_number(self):
import sys
import os
from importlib import import_module
directions_entity_folder_path = os.path.abspath(os.path.join('..', 'examples', 'directions', 'custom', 'entities'))
sys.path.append(directions_entity_folder_path)
entity = 'address_number.py'
entity_name = entity.split("/")[-1].replace(".py", "")
entity_module = import_module(entity_name)
if 'ENTITY_DEFINITION' in dir(entity_module):
errors = find_errors_in_entity_definition(entity_module.ENTITY_DEFINITION)
assert errors == []
if __name__ == '__main__':
pytest.main(sys.argv)
| 41.515152
| 132
| 0.606569
| 1,076
| 10,960
| 5.847584
| 0.118959
| 0.20089
| 0.04768
| 0.071519
| 0.776701
| 0.764145
| 0.755086
| 0.713764
| 0.648919
| 0.610299
| 0
| 0.000253
| 0.277464
| 10,960
| 263
| 133
| 41.673004
| 0.794292
| 0.006843
| 0
| 0.497797
| 0
| 0.017621
| 0.306102
| 0.00386
| 0
| 0
| 0
| 0
| 0.105727
| 1
| 0.114537
| false
| 0
| 0.035242
| 0.008811
| 0.162996
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
34ded48b22e636bf76c0036c38946e1089d66223
| 28
|
py
|
Python
|
PyGL/__init__.py
|
chaosphere2112/PyGL
|
9bb878f5c30144aea33de436e4907794ae9995dd
|
[
"MIT"
] | null | null | null |
PyGL/__init__.py
|
chaosphere2112/PyGL
|
9bb878f5c30144aea33de436e4907794ae9995dd
|
[
"MIT"
] | null | null | null |
PyGL/__init__.py
|
chaosphere2112/PyGL
|
9bb878f5c30144aea33de436e4907794ae9995dd
|
[
"MIT"
] | null | null | null |
from app import Application
| 14
| 27
| 0.857143
| 4
| 28
| 6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 28
| 1
| 28
| 28
| 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
| 0
| 0
|
0
| 5
|
34e1c033634804b8aa427ccf4964b71192ab07e1
| 209
|
py
|
Python
|
settings.py
|
dtaivpp/mediawiki-to-sharepoint
|
cd96a76bb935e5d54f29d3ea9c1d17e5375a9c01
|
[
"MIT"
] | null | null | null |
settings.py
|
dtaivpp/mediawiki-to-sharepoint
|
cd96a76bb935e5d54f29d3ea9c1d17e5375a9c01
|
[
"MIT"
] | null | null | null |
settings.py
|
dtaivpp/mediawiki-to-sharepoint
|
cd96a76bb935e5d54f29d3ea9c1d17e5375a9c01
|
[
"MIT"
] | null | null | null |
# settings.py
from dotenv import load_dotenv
load_dotenv()
import os
Sharepoint_User = os.getenv("SHAREPOINT_USER")
Sharepoint_Pass = os.getenv("SHAREPOINT_PASS")
Sharepoint_Url = os.getenv("SHAREPOINT_URL")
| 26.125
| 46
| 0.803828
| 29
| 209
| 5.517241
| 0.413793
| 0.15
| 0.3375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.090909
| 209
| 8
| 47
| 26.125
| 0.842105
| 0.052632
| 0
| 0
| 0
| 0
| 0.22335
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.166667
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
|
0
| 5
|
9b3a93108d1d0c083ce6ebe81bcf5e6b5095609b
| 38
|
py
|
Python
|
src/insights/__init__.py
|
Lawliet19189/Euller
|
d4b989182e3d4a4bd27707001b560e8b606396cd
|
[
"MIT"
] | null | null | null |
src/insights/__init__.py
|
Lawliet19189/Euller
|
d4b989182e3d4a4bd27707001b560e8b606396cd
|
[
"MIT"
] | null | null | null |
src/insights/__init__.py
|
Lawliet19189/Euller
|
d4b989182e3d4a4bd27707001b560e8b606396cd
|
[
"MIT"
] | null | null | null |
from .topk_insight import analyse_text
| 38
| 38
| 0.894737
| 6
| 38
| 5.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.078947
| 38
| 1
| 38
| 38
| 0.914286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
9b49fafec846b41ae5b769a68a179f69071eccdf
| 294
|
py
|
Python
|
pycache/_shared/_singleton.py
|
HuiiBuh/pycache
|
300bd51f9e575fd77014d6c86497dd58f313f752
|
[
"MIT"
] | 1
|
2021-09-04T05:34:26.000Z
|
2021-09-04T05:34:26.000Z
|
pycache/_shared/_singleton.py
|
HuiiBuh/pycache
|
300bd51f9e575fd77014d6c86497dd58f313f752
|
[
"MIT"
] | 1
|
2021-03-14T19:26:01.000Z
|
2021-03-16T18:46:38.000Z
|
pycache/_shared/_singleton.py
|
HuiiBuh/pycache
|
300bd51f9e575fd77014d6c86497dd58f313f752
|
[
"MIT"
] | null | null | null |
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
class_name = cls.__name__
if class_name not in cls._instances:
cls._instances[class_name] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instances[class_name]
| 32.666667
| 88
| 0.646259
| 35
| 294
| 4.857143
| 0.428571
| 0.211765
| 0.2
| 0.247059
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.234694
| 294
| 8
| 89
| 36.75
| 0.755556
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| false
| 0
| 0
| 0
| 0.571429
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
9b54a39b9a33963701de6f4c451d2960e9fd560c
| 125
|
py
|
Python
|
morseus/__init__.py
|
cmin764/morseus
|
8754d2e27e710fb556667ddccb064c11ab9d0372
|
[
"MIT"
] | 23
|
2018-07-03T19:16:00.000Z
|
2021-09-14T11:28:54.000Z
|
morseus/__init__.py
|
cmin764/morseus
|
8754d2e27e710fb556667ddccb064c11ab9d0372
|
[
"MIT"
] | null | null | null |
morseus/__init__.py
|
cmin764/morseus
|
8754d2e27e710fb556667ddccb064c11ab9d0372
|
[
"MIT"
] | 2
|
2018-07-07T15:31:12.000Z
|
2019-07-31T12:58:48.000Z
|
"""Main package classes, functions and utilities."""
from .app import Morseus
from .patches import patch_all
patch_all()
| 13.888889
| 52
| 0.752
| 17
| 125
| 5.411765
| 0.764706
| 0.173913
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.152
| 125
| 8
| 53
| 15.625
| 0.867925
| 0.368
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
9bbe5956410cfe1f9aebdfb87bf727f13b7e3a6a
| 838
|
py
|
Python
|
ascii_art.py
|
mzsbz/Codecademy-CS101_Python-Terminal-Game
|
bef13d88ad61fe8baaaaf15fca07641598d3fe56
|
[
"MIT"
] | null | null | null |
ascii_art.py
|
mzsbz/Codecademy-CS101_Python-Terminal-Game
|
bef13d88ad61fe8baaaaf15fca07641598d3fe56
|
[
"MIT"
] | null | null | null |
ascii_art.py
|
mzsbz/Codecademy-CS101_Python-Terminal-Game
|
bef13d88ad61fe8baaaaf15fca07641598d3fe56
|
[
"MIT"
] | null | null | null |
title = """
__ \ ___| |
| | | | __ \ _` | _ \ _ \ __ \ | __| _` | \ \ \ / | _ \ __|
| | | | | | ( | __/ ( | | | | | ( | \ \ \ / | __/ |
____/ \__,_| _| _| \__, | \___| \___/ _| _| \____| _| \__,_| \_/\_/ _| \___| _|
|___/ """
gameover = """
___| _ \
| _` | __ `__ \ _ \ | | \ \ / _ \ __|
| | ( | | | | __/ | | \ \ / __/ |
\____| \__,_| _| _| _| \___| \___/ \_/ \___| _|
"""
| 64.461538
| 121
| 0.131265
| 2
| 838
| 6.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.701671
| 838
| 13
| 122
| 64.461538
| 0.052
| 0
| 0
| 0
| 0
| 0.333333
| 0.959476
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
fd151fabac68bc01449515a561672bdf8744f546
| 1,539
|
py
|
Python
|
config.py
|
Lazkjaz/KH_RPG
|
57da7ac1e245b9d8c1a78e9136ffa00016b2be7c
|
[
"Unlicense"
] | 1
|
2021-07-09T23:46:44.000Z
|
2021-07-09T23:46:44.000Z
|
config.py
|
Lazkjaz/KH_RPG
|
57da7ac1e245b9d8c1a78e9136ffa00016b2be7c
|
[
"Unlicense"
] | null | null | null |
config.py
|
Lazkjaz/KH_RPG
|
57da7ac1e245b9d8c1a78e9136ffa00016b2be7c
|
[
"Unlicense"
] | null | null | null |
TILESIZE = 29
PLAYER_LAYER = 4
ENEMY_LAYER = 3
BLOCK_LAYER = 2
GROUND_LAYER = 1
PLAYER_SPEED = 3
player_speed = 0
WHITE = (255, 255, 255)
BLUE = (0, 0, 255)
RED = (255, 0, 0)
BLACK = (0, 0, 0)
tilemap = [
'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
'B....................................................................B',
'B....................................................................B',
'B....................................................................B',
'B....................................................................B',
'B....................................................................B',
'B....................................................................B',
'B.................................................................E..B',
'B...........P........................................................B',
'B....................................................................B',
'B....................................................................B',
'B....................................................................B',
'B....................................................................B',
'B....................................................................B',
'B....................................................................B',
'B....................................................................B',
'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB'
]
| 45.264706
| 77
| 0.197531
| 71
| 1,539
| 4.197183
| 0.323944
| 0.181208
| 0.241611
| 0.295302
| 0.09396
| 0.09396
| 0.09396
| 0.09396
| 0.09396
| 0.09396
| 0
| 0.021398
| 0.089019
| 1,539
| 33
| 78
| 46.636364
| 0.191155
| 0
| 0
| 0.433333
| 0
| 0
| 0.773229
| 0.773229
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
b5bb401dbb4104864dc523e5a0ab46d5a032edb9
| 3,545
|
py
|
Python
|
8_format_strings/4_find_end_of_eventlog.py
|
RainbowCache/my-osed-scripts
|
e61b48bee0216a452633722c6681d8e5e2d75a9f
|
[
"Unlicense"
] | 1
|
2022-02-03T05:37:19.000Z
|
2022-02-03T05:37:19.000Z
|
8_format_strings/4_find_end_of_eventlog.py
|
RainbowCache/my-osed-scripts
|
e61b48bee0216a452633722c6681d8e5e2d75a9f
|
[
"Unlicense"
] | null | null | null |
8_format_strings/4_find_end_of_eventlog.py
|
RainbowCache/my-osed-scripts
|
e61b48bee0216a452633722c6681d8e5e2d75a9f
|
[
"Unlicense"
] | 2
|
2022-02-28T06:59:46.000Z
|
2022-03-20T04:30:19.000Z
|
#!/usr/bin/env python3
import socket
import sys
from struct import pack
def main():
server = "192.168.185.10"
if len(sys.argv) >= 2:
server = sys.argv[1]
port = 11460
# psAgentCommand
buf = pack(">i", 0x400)
buf += bytearray([0x41] * 0xC)
buf += pack("<i", 0x604) # opcode
buf += pack("<i", 0x0) # 1st memcpy: offset
buf += pack("<i", 0x100) # 1st memcpy: size field
buf += pack("<i", 0x100) # 2nd memcpy: offset
buf += pack("<i", 0x100) # 2nd memcpy: size field
buf += pack("<i", 0x200) # 3rd memcpy: offset
buf += pack("<i", 0x100) # 3rd memcpy: size field
buf += bytearray([0x41] * 0x8)
# psCommandBuffer
buf += b"%x " * 0x40
buf += b"B" * 0x100
buf += b"C" * 0x100
# Padding
buf += bytearray([0x41] * (0x404 - len(buf)))
# s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# s.connect((server, port))
# s.send(buf)
# s.close()
startValue = 0x00
while True:
# psAgentCommand
buf = pack(">i", 0x400)
buf += bytearray([0x41] * 0xC)
buf += pack("<i", 0x520) # opcode
buf += pack("<i", 0x0) # 1st memcpy: offset
buf += pack("<i", 0x100) # 1st memcpy: size field
buf += pack("<i", 0x100) # 2nd memcpy: offset
buf += pack("<i", 0x100) # 2nd memcpy: size field
buf += pack("<i", 0x200) # 3rd memcpy: offset
buf += pack("<i", 0x100) # 3rd memcpy: size field
buf += bytearray([0x41] * 0x8)
# psCommandBuffer
buf += b"FileType: %d ,Start: %d, Length: %d" % (1, startValue, 0x1000)
buf += b"B" * 0x100
buf += b"C" * 0x100
# Padding
buf += bytearray([0x41] * (0x404 - len(buf)))
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((server, port))
s.send(buf)
s.settimeout(2)
response = s.recv(4)
response_size = int(response.hex(), 16)
print("Start Value: " + str(hex(startValue)) + " Size: " + str(hex(response_size)))
if response_size >= 0x100000:
s.close()
startValue += 0x1000
continue
s.close()
response_size = response_size >> 8
startValue += response_size
break
print("Ideal start value: " + str(hex(startValue)))
# psAgentCommand
buf = pack(">i", 0x400)
buf += bytearray([0x41] * 0xC)
buf += pack("<i", 0x520) # opcode
buf += pack("<i", 0x0) # 1st memcpy: offset
buf += pack("<i", 0x100) # 1st memcpy: size field
buf += pack("<i", 0x100) # 2nd memcpy: offset
buf += pack("<i", 0x100) # 2nd memcpy: size field
buf += pack("<i", 0x200) # 3rd memcpy: offset
buf += pack("<i", 0x100) # 3rd memcpy: size field
buf += bytearray([0x41] * 0x8)
# psCommandBuffer
buf += b"FileType: %d ,Start: %d, Length: %d" % (1, startValue, 0x1000)
buf += b"B" * 0x100
buf += b"C" * 0x100
# Padding
buf += bytearray([0x41] * (0x404 - len(buf)))
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(10)
s.connect((server, port))
s.send(buf)
response = s.recv(4)
response_size = int(response.hex(), 16)
print("Downloading " + str(response_size) + " bytes...")
response = b""
try:
while True:
response += s.recv(4096)
except Exception as e:
print(e)
s.close()
print(response)
print("[+] Packet sent")
sys.exit(0)
if __name__ == "__main__":
main()
| 27.061069
| 91
| 0.538787
| 446
| 3,545
| 4.233184
| 0.217489
| 0.088983
| 0.101695
| 0.082627
| 0.751589
| 0.724047
| 0.724047
| 0.710275
| 0.710275
| 0.710275
| 0
| 0.097678
| 0.295346
| 3,545
| 131
| 92
| 27.061069
| 0.658127
| 0.180254
| 0
| 0.632184
| 0
| 0
| 0.078343
| 0
| 0
| 0
| 0.086003
| 0
| 0
| 1
| 0.011494
| false
| 0
| 0.034483
| 0
| 0.045977
| 0.068966
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
b5cd6072eef015e7a952b81a690e6b97b4cfce10
| 540
|
py
|
Python
|
Python-For-Everyone-Horstmann/Chapter11-Recursion/nose_square_area.py
|
islayy/Books-solutions
|
5fe05deb4e9f65875284d8af43bd383bf9ae145b
|
[
"MIT"
] | null | null | null |
Python-For-Everyone-Horstmann/Chapter11-Recursion/nose_square_area.py
|
islayy/Books-solutions
|
5fe05deb4e9f65875284d8af43bd383bf9ae145b
|
[
"MIT"
] | null | null | null |
Python-For-Everyone-Horstmann/Chapter11-Recursion/nose_square_area.py
|
islayy/Books-solutions
|
5fe05deb4e9f65875284d8af43bd383bf9ae145b
|
[
"MIT"
] | 1
|
2021-01-30T22:19:07.000Z
|
2021-01-30T22:19:07.000Z
|
# Unit tests for square_area.py
# IMPORTS
from square_area import square_area
from nose.tools import eq_
class TestSquareArea():
def test_square_area_negative(self):
eq_(0, square_area(-5))
def test_square_area_0(self):
eq_(0, square_area(0))
def test_square_area_1(self):
eq_(1, square_area(1))
def test_square_area_2(self):
eq_(4, square_area(2))
def test_square_area_3(self):
eq_(9, square_area(3))
def test_square_area_11(self):
eq_(121, square_area(11))
| 20
| 40
| 0.67037
| 86
| 540
| 3.813953
| 0.313953
| 0.457317
| 0.237805
| 0.310976
| 0.103659
| 0
| 0
| 0
| 0
| 0
| 0
| 0.050239
| 0.225926
| 540
| 26
| 41
| 20.769231
| 0.73445
| 0.068519
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0.133333
| 0
| 0.6
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
b5ddc6e72d3a765f6e1db74de7772af00c67689c
| 152
|
py
|
Python
|
Lib/glyphsLib/interpolation.py
|
schriftgestalt/glyphsLib
|
cf19d1e52725ac8ab463d9122cfa1e6174cc4e08
|
[
"Apache-2.0"
] | null | null | null |
Lib/glyphsLib/interpolation.py
|
schriftgestalt/glyphsLib
|
cf19d1e52725ac8ab463d9122cfa1e6174cc4e08
|
[
"Apache-2.0"
] | null | null | null |
Lib/glyphsLib/interpolation.py
|
schriftgestalt/glyphsLib
|
cf19d1e52725ac8ab463d9122cfa1e6174cc4e08
|
[
"Apache-2.0"
] | null | null | null |
from __future__ import absolute_import, unicode_literals
from glyphsLib.builder.instances import apply_instance_data
__all__ = ["apply_instance_data"]
| 30.4
| 59
| 0.861842
| 19
| 152
| 6.157895
| 0.684211
| 0.222222
| 0.290598
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.085526
| 152
| 4
| 60
| 38
| 0.841727
| 0
| 0
| 0
| 0
| 0
| 0.125
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
bd353b72bebd05cc6595c907af7eb2a7d9695504
| 35
|
py
|
Python
|
spellcast/__main__.py
|
lillanes/mage
|
7a8460373f9faf032c55e96d1e937f04ce504497
|
[
"MIT"
] | 1
|
2022-02-01T14:19:16.000Z
|
2022-02-01T14:19:16.000Z
|
spellcast/__main__.py
|
lillanes/spellcast
|
7a8460373f9faf032c55e96d1e937f04ce504497
|
[
"MIT"
] | null | null | null |
spellcast/__main__.py
|
lillanes/spellcast
|
7a8460373f9faf032c55e96d1e937f04ce504497
|
[
"MIT"
] | null | null | null |
from .spellcast import main
main()
| 11.666667
| 27
| 0.771429
| 5
| 35
| 5.4
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 35
| 2
| 28
| 17.5
| 0.9
| 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 | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
bd3ba75584b00b41d114d20ca6f5171dcfc1fdc7
| 240
|
py
|
Python
|
backend/Django/logsyllogsite/logapp/admin.py
|
emg/syllog
|
8855575ba97b9fefbc9980e4e1030f201b908470
|
[
"MIT"
] | null | null | null |
backend/Django/logsyllogsite/logapp/admin.py
|
emg/syllog
|
8855575ba97b9fefbc9980e4e1030f201b908470
|
[
"MIT"
] | null | null | null |
backend/Django/logsyllogsite/logapp/admin.py
|
emg/syllog
|
8855575ba97b9fefbc9980e4e1030f201b908470
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from logapp import models
admin.site.register(models.Answer)
admin.site.register(models.Answer2)
admin.site.register(models.Answer3)
admin.site.register(models.Answer4)
admin.site.register(models.Answer5)
| 24
| 35
| 0.829167
| 34
| 240
| 5.852941
| 0.411765
| 0.226131
| 0.427136
| 0.577889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.017778
| 0.0625
| 240
| 9
| 36
| 26.666667
| 0.866667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.285714
| 0
| 0.285714
| 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
| 0
| 0
| 0
| 0
|
0
| 5
|
bd497ec4c047929f44a0cee0faf451ae150669fa
| 60
|
py
|
Python
|
utils/__init__.py
|
leeamen/aae
|
69c28dda08228f214446109464707ff36afe982f
|
[
"Apache-2.0"
] | null | null | null |
utils/__init__.py
|
leeamen/aae
|
69c28dda08228f214446109464707ff36afe982f
|
[
"Apache-2.0"
] | null | null | null |
utils/__init__.py
|
leeamen/aae
|
69c28dda08228f214446109464707ff36afe982f
|
[
"Apache-2.0"
] | null | null | null |
import configuration
import distributions
import load_data
| 12
| 20
| 0.883333
| 7
| 60
| 7.428571
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116667
| 60
| 4
| 21
| 15
| 0.981132
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
bd509e8f3ff358fb9f3cf415e71432cc16af18e0
| 170
|
py
|
Python
|
Program_Python_code/25.py
|
skyhigh8591/Learning_Test_Program
|
5f3c0f11874618919002126863772e0dd06a1072
|
[
"MIT"
] | null | null | null |
Program_Python_code/25.py
|
skyhigh8591/Learning_Test_Program
|
5f3c0f11874618919002126863772e0dd06a1072
|
[
"MIT"
] | null | null | null |
Program_Python_code/25.py
|
skyhigh8591/Learning_Test_Program
|
5f3c0f11874618919002126863772e0dd06a1072
|
[
"MIT"
] | null | null | null |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
count = 0
while count < 5:
print count, " is less than 5"
count = count + 1
else:
print count, " is not less than 5"
| 17
| 37
| 0.582353
| 28
| 170
| 3.535714
| 0.607143
| 0.20202
| 0.242424
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.048
| 0.264706
| 170
| 9
| 38
| 18.888889
| 0.744
| 0.223529
| 0
| 0
| 0
| 0
| 0.271318
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.333333
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
1fdf6742c51bb561e24384637ecc566cbe42df42
| 166
|
py
|
Python
|
Jeffery99/__init__.py
|
rscalzo/pyBoloSN
|
dbd490b66d94a2f7913d2a8d312a45339c4d34a5
|
[
"MIT"
] | 6
|
2015-06-18T15:49:16.000Z
|
2021-04-12T12:09:14.000Z
|
Jeffery99/__init__.py
|
rscalzo/pyBoloSN
|
dbd490b66d94a2f7913d2a8d312a45339c4d34a5
|
[
"MIT"
] | 5
|
2015-06-18T05:27:51.000Z
|
2015-06-18T06:06:52.000Z
|
Jeffery99/__init__.py
|
rscalzo/pyBoloSN
|
dbd490b66d94a2f7913d2a8d312a45339c4d34a5
|
[
"MIT"
] | 1
|
2019-12-15T13:55:08.000Z
|
2019-12-15T13:55:08.000Z
|
from .QGP import t0, kgamma, QGP
from .QGP import stdQgp_exp_pklfn, stdQgp_pow3x3_pklfn
__all__ = ['t0', 'kgamma', 'QGP', 'stdQgp_exp_pklfn', 'stdQgp_pow3x3_pklfn']
| 33.2
| 76
| 0.753012
| 25
| 166
| 4.52
| 0.4
| 0.123894
| 0.230089
| 0.353982
| 0.548673
| 0.548673
| 0
| 0
| 0
| 0
| 0
| 0.040816
| 0.114458
| 166
| 4
| 77
| 41.5
| 0.727891
| 0
| 0
| 0
| 0
| 0
| 0.277108
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
1ff6630a9dae47b538f8b14fce20e2a85724e206
| 692
|
py
|
Python
|
extractor/entrytype/__init__.py
|
adambiser/snes-wolf3d-extractor
|
6b10148f0a49857d3b92c67b8689146225298dec
|
[
"MIT"
] | 4
|
2019-04-28T14:42:05.000Z
|
2021-09-19T16:20:21.000Z
|
extractor/entrytype/__init__.py
|
adambiser/snes-wolf3d-extractor
|
6b10148f0a49857d3b92c67b8689146225298dec
|
[
"MIT"
] | 4
|
2017-07-18T07:05:11.000Z
|
2017-09-26T01:42:19.000Z
|
extractor/entrytype/__init__.py
|
adambiser/snes-wolf3d-extractor
|
6b10148f0a49857d3b92c67b8689146225298dec
|
[
"MIT"
] | 1
|
2021-12-18T02:15:32.000Z
|
2021-12-18T02:15:32.000Z
|
# Import entry types.
# noinspection PyUnresolvedReferences
from .abstractentry import AbstractEntry
# noinspection PyUnresolvedReferences
from .bytedata import ByteData
# noinspection PyUnresolvedReferences
from .image import Image
# noinspection PyUnresolvedReferences
from .instrument_list import InstrumentList
# noinspection PyUnresolvedReferences
from .map import Map
# noinspection PyUnresolvedReferences
from .palette import Palette
# noinspection PyUnresolvedReferences
from .song import Song
# noinspection PyUnresolvedReferences
from .sound import Sound
# noinspection PyUnresolvedReferences
from .sprite import Sprite
# noinspection PyUnresolvedReferences
from .text import Text
| 30.086957
| 43
| 0.859827
| 64
| 692
| 9.28125
| 0.28125
| 0.572391
| 0.639731
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.108382
| 692
| 22
| 44
| 31.454545
| 0.962723
| 0.547688
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
9510f4859a3fb1e9d042f226cde79a05914ca881
| 11,955
|
py
|
Python
|
patterning_algorithm/Raster_to_SVG_halftone.py
|
abhishek-sehgal954/SVG_Digital_Halftoning
|
8ca166f35facc721144631457565e62a6398c7c0
|
[
"MIT"
] | 10
|
2017-10-17T19:12:58.000Z
|
2021-09-10T19:51:29.000Z
|
patterning_algorithm/Raster_to_SVG_halftone.py
|
abhishek-sehgal954/SVG_Digital_Halftoning
|
8ca166f35facc721144631457565e62a6398c7c0
|
[
"MIT"
] | null | null | null |
patterning_algorithm/Raster_to_SVG_halftone.py
|
abhishek-sehgal954/SVG_Digital_Halftoning
|
8ca166f35facc721144631457565e62a6398c7c0
|
[
"MIT"
] | 3
|
2018-10-01T17:30:25.000Z
|
2019-11-20T02:43:54.000Z
|
#This program takes a raster image and produces its vector halftone using patterning algorithm .
# It supports 4 patterns
# 1. Clustered dot
# 2. Triangle
# 3. Hexagon
# 4. Dispersed dot
# output file produced is output.svg which can be opened with any SVG viewer (inkscape, imagemagick etc.)
import os
import sys
import svgwrite
import numpy as np
from PIL import Image
def intensity(arr):
# calcluates intensity of a pixel from 0 to 9
mini = 999
maxi = 0
for i in range(len(arr)):
for j in range(len(arr[0])):
maxi = max(arr[i][j],maxi)
mini = min(arr[i][j],mini)
level = float(float(maxi-mini)/float(10));
brr = [[0]*len(arr[0]) for i in range(len(arr))]
for i in range(10):
l1 = mini+level*i
l2 = l1+level
for j in range(len(arr)):
for k in range(len(arr[0])):
if(arr[j][k] >= l1 and arr[j][k] <= l2):
brr[j][k]=i
return brr
def clustered_dot(image):
# based on the intensity maps pixel to the circle of different radiuses
# intensity 0 begin the circle with maximum black area
arr = np.asarray(image)
brr = intensity(arr)
gray_level = [0]*10
gray_level[0] = 2.5
gray_level[1] = 2.2
gray_level[2] = 2
gray_level[3] = 1.8
gray_level[4] = 1.6
gray_level[5] = 1.4
gray_level[6] = 1.2
gray_level[7] = 1
gray_level[8] = 0.8
gray_level[9] = 0
startu = 0
endu = 0
dwg = svgwrite.Drawing('output.svg', profile = 'full')
for i in range(len(brr)):
for j in range(len(brr[i])):
dwg.add(dwg.circle((int((startu+startu+5)/2),int((endu+endu+5)/2)),gray_level[brr[i][j]]))
startu = startu+5
endu = endu+5
startu = 0
dwg.save()
def triangle(image):
# based on the intensity maps pixel to the triangle of different areas
# intensity 0 begin the triangle with maximum black area
arr = np.asarray(image)
brr = intensity(arr)
dwg = svgwrite.Drawing('output.svg', profile='full')
startu = 0
endu = 0
for i in range(len(brr)):
for j in range(len(brr[i])):
temp_list = []
if(brr[i][j] == 0):
temp_list.append((int((startu+startu+5)/2),endu))
temp_list.append((startu,endu+5))
temp_list.append((startu+5,endu+5))
elif(brr[i][j] == 1):
temp_list.append((int((startu+startu+5)/2),endu+0.1))
temp_list.append((startu+0.1,endu+5-0.1))
temp_list.append((startu+5-0.1,endu+5-0.1))
elif(brr[i][j] == 2):
temp_list.append((int((startu+startu+5)/2),endu+0.2))
temp_list.append((startu+0.2,endu+5-0.2))
temp_list.append((startu+5-0.2,endu+5-0.2))
elif(brr[i][j] == 3):
temp_list.append((int((startu+startu+5)/2),endu+0.3))
temp_list.append((startu+0.3,endu+5-0.3))
temp_list.append((startu+5-0.3,endu+5-0.3))
elif(brr[i][j] == 4):
temp_list.append((int((startu+startu+5)/2),endu+0.4))
temp_list.append((startu+0.4,endu+5-0.4))
temp_list.append((startu+5-0.4,endu+5-0.4))
elif(brr[i][j] == 5):
temp_list.append((int((startu+startu+5)/2),endu+0.5))
temp_list.append((startu+0.5,endu+5-0.5))
temp_list.append((startu+5-0.5,endu+5-0.5))
elif(brr[i][j] == 6):
temp_list.append((int((startu+startu+5)/2),endu+0.6))
temp_list.append((startu+0.6,endu+5-0.6))
temp_list.append((startu+5-0.6,endu+5-0.6))
elif(brr[i][j] == 7):
temp_list.append((int((startu+startu+5)/2),endu+0.7))
temp_list.append((startu+0.7,endu+5-0.7))
temp_list.append((startu+5-0.7,endu+5-0.7))
elif(brr[i][j] == 8):
temp_list.append((int((startu+startu+5)/2),endu+0.8))
temp_list.append((startu+0.8,endu+5-0.8))
temp_list.append((startu+5-0.8,endu+5-0.8))
if(len(temp_list) != 0):
dwg.add(dwg.polygon(temp_list,fill='black'))
startu = startu+5
endu = endu+5
startu = 0
dwg.save()
def hexagon(image):
# based on the intensity maps pixel to the hexagon of different areas
# intensity 0 begin the hexagon with maximum black area
arr = np.asarray(image)
brr = intensity(arr)
dwg = svgwrite.Drawing('output.svg', profile='full')
startu = 0
endu = 0
for i in range(len(brr)):
for j in range(len(brr[i])):
temp_list = []
if(brr[i][j] == 0):
temp_list.append((startu+2,endu))
temp_list.append((startu+4,endu))
temp_list.append((startu,endu+3))
temp_list.append((startu+6,endu+3))
temp_list.append((startu+2,endu+3))
temp_list.append((startu+4,endu+3))
elif(brr[i][j] == 1):
temp_list.append((startu+2,endu+0.2))
temp_list.append((startu+4,endu+0.2))
temp_list.append((startu+0.2,endu+3))
temp_list.append((startu+6-0.2,endu+3))
temp_list.append((startu+2,endu+3-0.2))
temp_list.append((startu+4,endu+3-0.2))
elif(brr[i][j] == 2):
temp_list.append((startu+2,endu+0.4))
temp_list.append((startu+4,endu+0.4))
temp_list.append((startu+0.4,endu+3))
temp_list.append((startu+6-0.4,endu+3))
temp_list.append((startu+2,endu+3-0.4))
temp_list.append((startu+4,endu+3-0.4))
elif(brr[i][j] == 3):
temp_list.append((startu+2,endu+0.6))
temp_list.append((startu+4,endu+0.6))
temp_list.append((startu+0.6,endu+3))
temp_list.append((startu+6-0.6,endu+3))
temp_list.append((startu+2,endu+3-0.6))
temp_list.append((startu+4,endu+3-0.6))
elif(brr[i][j] == 4):
temp_list.append((startu+2,endu+0.8))
temp_list.append((startu+4,endu+0.8))
temp_list.append((startu+0.8,endu+3))
temp_list.append((startu+6-0.8,endu+3))
temp_list.append((startu+2,endu+3-0.8))
temp_list.append((startu+4,endu+3-0.8))
elif(brr[i][j] == 5):
temp_list.append((startu+2,endu+1))
temp_list.append((startu+4,endu+1))
temp_list.append((startu+1,endu+3))
temp_list.append((startu+6-1,endu+3))
temp_list.append((startu+2,endu+3-1))
temp_list.append((startu+4,endu+3-1))
elif(brr[i][j] == 6):
temp_list.append((startu+2,endu+1.2))
temp_list.append((startu+4,endu+1.2))
temp_list.append((startu+1.2,endu+3))
temp_list.append((startu+6-1.2,endu+3))
temp_list.append((startu+2,endu+3-1.2))
temp_list.append((startu+4,endu+3-1.2))
elif(brr[i][j] == 7):
temp_list.append((startu+2,endu+1.4))
temp_list.append((startu+4,endu+1.4))
temp_list.append((startu+1.4,endu+3))
temp_list.append((startu+6-1.4,endu+3))
temp_list.append((startu+2,endu+3-1.4))
temp_list.append((startu+4,endu+3-1.4))
elif(brr[i][j] == 8):
temp_list.append((startu+2,endu+1.6))
temp_list.append((startu+4,endu+1.6))
temp_list.append((startu+1.6,endu+3))
temp_list.append((startu+6-1.6,endu+3))
temp_list.append((startu+2,endu+3-1.6))
temp_list.append((startu+4,endu+3-1.6))
if(len(temp_list) != 0):
dwg.add(dwg.polygon(temp_list,fill='black'))
startu = startu+5
endu = endu+5
startu = 0
dwg.save()
def dispersed_dot(image):
arr = np.asarray(image)
brr = intensity(arr)
dwg = svgwrite.Drawing('output.svg', profile='full')
startu = 0
endu = 0
for i in range(len(brr)):
for j in range(len(brr[i])):
if(brr[i][j] == 0):
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+3)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+5)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+3)/2)),1))
dwg.add(dwg.circle((int((startu+startu+3)/2),int((endu+endu+3)/2)),1))
dwg.add(dwg.circle((int((startu+startu+5)/2),int((endu+endu+3)/2)),1))
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+5)/2)),1))
dwg.add(dwg.circle((int((startu+startu+3)/2),int((endu+endu+5)/2)),1))
dwg.add(dwg.circle((int((startu+startu+5)/2),int((endu+endu+5)/2)),1))
elif(brr[i][j] == 1):
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+3)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+5)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+3)/2)),1))
dwg.add(dwg.circle((int((startu+startu+3)/2),int((endu+endu+3)/2)),1))
dwg.add(dwg.circle((int((startu+startu+5)/2),int((endu+endu+3)/2)),1))
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+5)/2)),1))
dwg.add(dwg.circle((int((startu+startu+3)/2),int((endu+endu+5)/2)),1))
elif(brr[i][j] == 2):
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+3)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+5)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+3)/2)),1))
dwg.add(dwg.circle((int((startu+startu+5)/2),int((endu+endu+3)/2)),1))
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+5)/2)),1))
dwg.add(dwg.circle((int((startu+startu+3)/2),int((endu+endu+5)/2)),1))
elif(brr[i][j] == 3):
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+5)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+3)/2)),1))
dwg.add(dwg.circle((int((startu+startu+5)/2),int((endu+endu+3)/2)),1))
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+5)/2)),1))
dwg.add(dwg.circle((int((startu+startu+3)/2),int((endu+endu+5)/2)),1))
elif(brr[i][j] == 4):
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+5)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+3)/2)),1))
dwg.add(dwg.circle((int((startu+startu+5)/2),int((endu+endu+3)/2)),1))
dwg.add(dwg.circle((int((startu+startu+3)/2),int((endu+endu+5)/2)),1))
elif(brr[i][j] == 5):
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+5)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+5)/2),int((endu+endu+3)/2)),1))
dwg.add(dwg.circle((int((startu+startu+3)/2),int((endu+endu+5)/2)),1))
elif(brr[i][j] == 6):
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+5)/2),int((endu+endu+3)/2)),1))
dwg.add(dwg.circle((int((startu+startu+3)/2),int((endu+endu+5)/2)),1))
elif(brr[i][j] == 7):
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+1)/2)),1))
dwg.add(dwg.circle((int((startu+startu+3)/2),int((endu+endu+5)/2)),1))
elif(brr[i][j] == 8):
dwg.add(dwg.circle((int((startu+startu+1)/2),int((endu+endu+1)/2)),1))
startu = startu+3
endu = endu+3;
startu = 0;
dwg.save()
def main():
fname = 'test.jpg'
image = Image.open(fname).convert('L')
if(sys.argv[1] == 'clustered_dot'):
clustered_dot(image)
elif(sys.argv[1] == 'triangle'):
triangle(image)
elif(sys.argv[1]=='hexagon'):
hexagon(image)
elif(sys.argv[1]=='dispersed_dot'):
dispersed_dot(image)
if __name__=="__main__":
main()
| 43.315217
| 105
| 0.571978
| 2,076
| 11,955
| 3.239403
| 0.058285
| 0.103494
| 0.168625
| 0.214126
| 0.859182
| 0.844015
| 0.765204
| 0.71777
| 0.578439
| 0.558364
| 0
| 0.067089
| 0.208281
| 11,955
| 276
| 106
| 43.315217
| 0.643423
| 0.058051
| 0
| 0.464567
| 0
| 0
| 0.011042
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.023622
| false
| 0
| 0.019685
| 0
| 0.047244
| 0
| 0
| 0
| 0
| null | 0
| 0
| 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
| 5
|
952143772522a136c98174ca85361c2342a4a2a8
| 355
|
py
|
Python
|
main.py
|
gonvaled/RunningMedian.py
|
4a3a046c378993a14b0fb29c1b477b08f73153a5
|
[
"MIT"
] | null | null | null |
main.py
|
gonvaled/RunningMedian.py
|
4a3a046c378993a14b0fb29c1b477b08f73153a5
|
[
"MIT"
] | null | null | null |
main.py
|
gonvaled/RunningMedian.py
|
4a3a046c378993a14b0fb29c1b477b08f73153a5
|
[
"MIT"
] | null | null | null |
import random
from running_median.example import compute_median
def generate_samples(samples):
return (random.randint(0, 1000) for _ in range(samples))
def main(samples, window_size, check=False, display=1000):
compute_median(generate_samples(samples), window_size, check, display)
if __name__ == "__main__":
main(100000, 10000, False)
| 22.1875
| 74
| 0.757746
| 47
| 355
| 5.382979
| 0.574468
| 0.102767
| 0.173913
| 0.173913
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.065574
| 0.140845
| 355
| 15
| 75
| 23.666667
| 0.763934
| 0
| 0
| 0
| 1
| 0
| 0.022535
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0.125
| 0.625
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
1f30b6b71572e875bf74a560c1ee13cdc9c3eb5f
| 2,294
|
py
|
Python
|
server/rest_api/migrations/0003_auto_20160317_2258.py
|
GOKUPIKA/ivanc
|
27775fb220392e7cd33a401e58b22fa8cb6d97d5
|
[
"Apache-2.0"
] | 14
|
2016-05-16T02:49:18.000Z
|
2021-08-01T16:28:22.000Z
|
server/rest_api/migrations/0003_auto_20160317_2258.py
|
GOKUPIKA/ivanc
|
27775fb220392e7cd33a401e58b22fa8cb6d97d5
|
[
"Apache-2.0"
] | 3
|
2020-10-01T13:13:25.000Z
|
2020-10-02T20:11:48.000Z
|
server/rest_api/migrations/0003_auto_20160317_2258.py
|
GOKUPIKA/ivanc
|
27775fb220392e7cd33a401e58b22fa8cb6d97d5
|
[
"Apache-2.0"
] | 94
|
2016-06-18T03:46:07.000Z
|
2020-11-04T18:01:43.000Z
|
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-03-17 22:58
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('rest_api', '0002_article'),
]
operations = [
migrations.AlterModelOptions(
name='app',
options={'ordering': ('-start_date',)},
),
migrations.AlterModelOptions(
name='article',
options={'ordering': ('-publish_date',)},
),
migrations.AlterField(
model_name='app',
name='end_date',
field=models.DateField(blank=True, null=True),
),
migrations.AlterField(
model_name='app',
name='image',
field=models.ImageField(blank=True, null=True, upload_to='images/'),
),
migrations.AlterField(
model_name='app',
name='platform',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='rest_api.Platform'),
),
migrations.AlterField(
model_name='app',
name='store_url',
field=models.URLField(blank=True, null=True),
),
migrations.AlterField(
model_name='article',
name='image',
field=models.ImageField(blank=True, null=True, upload_to='images/'),
),
migrations.AlterField(
model_name='article',
name='platform',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='rest_api.Platform'),
),
migrations.AlterField(
model_name='repo',
name='end_date',
field=models.DateField(blank=True, null=True),
),
migrations.AlterField(
model_name='repo',
name='image',
field=models.ImageField(blank=True, null=True, upload_to='images/'),
),
migrations.AlterField(
model_name='repo',
name='platform',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='rest_api.Platform'),
),
]
| 32.771429
| 128
| 0.566696
| 228
| 2,294
| 5.570175
| 0.263158
| 0.141732
| 0.177165
| 0.205512
| 0.717323
| 0.717323
| 0.661417
| 0.661417
| 0.625197
| 0.625197
| 0
| 0.012438
| 0.299041
| 2,294
| 69
| 129
| 33.246377
| 0.777363
| 0.029207
| 0
| 0.758065
| 1
| 0
| 0.109712
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.048387
| 0
| 0.096774
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
1f50c54ebde76c85c44f4eaf07cc4af2cfb9ddab
| 125
|
py
|
Python
|
zqtflearn2/tflearn/models/__init__.py
|
ZhengDeQuan/AAA
|
7755c6aa1cfa484a2836ae6059bca721de2a90e8
|
[
"MIT"
] | null | null | null |
zqtflearn2/tflearn/models/__init__.py
|
ZhengDeQuan/AAA
|
7755c6aa1cfa484a2836ae6059bca721de2a90e8
|
[
"MIT"
] | null | null | null |
zqtflearn2/tflearn/models/__init__.py
|
ZhengDeQuan/AAA
|
7755c6aa1cfa484a2836ae6059bca721de2a90e8
|
[
"MIT"
] | 1
|
2020-10-14T03:46:08.000Z
|
2020-10-14T03:46:08.000Z
|
from __future__ import absolute_import
from .dnn import DNN
from .zqdnn import ZQDNN
from .generator import SequenceGenerator
| 31.25
| 40
| 0.856
| 17
| 125
| 6
| 0.470588
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12
| 125
| 4
| 40
| 31.25
| 0.927273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
1f53cd484c2ae009c201227220ab808fc738eec5
| 25
|
py
|
Python
|
crawler2.py
|
guillermohf/OpenPolitics
|
54623532d6db334bbbc66a175267ddf6ef138ef5
|
[
"MIT"
] | 1
|
2018-03-15T16:57:56.000Z
|
2018-03-15T16:57:56.000Z
|
crawler2.py
|
guillermohf/OpenPolitics
|
54623532d6db334bbbc66a175267ddf6ef138ef5
|
[
"MIT"
] | null | null | null |
crawler2.py
|
guillermohf/OpenPolitics
|
54623532d6db334bbbc66a175267ddf6ef138ef5
|
[
"MIT"
] | null | null | null |
#crawler made with scrapy
| 25
| 25
| 0.84
| 4
| 25
| 5.25
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12
| 25
| 1
| 25
| 25
| 0.954545
| 0.96
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
1f69c13dcab71071fb7b7db33be6e147f388016d
| 189
|
py
|
Python
|
tf_covid19_care/tests/demo.py
|
wangjuncongyu/covid19_recovery
|
4b32b8f415a7da10d100d1899f44c7b457cd6c0f
|
[
"Apache-2.0"
] | null | null | null |
tf_covid19_care/tests/demo.py
|
wangjuncongyu/covid19_recovery
|
4b32b8f415a7da10d100d1899f44c7b457cd6c0f
|
[
"Apache-2.0"
] | null | null | null |
tf_covid19_care/tests/demo.py
|
wangjuncongyu/covid19_recovery
|
4b32b8f415a7da10d100d1899f44c7b457cd6c0f
|
[
"Apache-2.0"
] | 1
|
2021-12-03T04:17:51.000Z
|
2021-12-03T04:17:51.000Z
|
import _init_pathes
from CAD_wrapper.CAD_pipeline import CAD_Pipeline
pipeline = CAD_Pipeline()
pipeline.initialize()
pipeline.predict_risk_for(r'D:\data\data_root\patient_0000232')
| 27
| 63
| 0.820106
| 27
| 189
| 5.37037
| 0.62963
| 0.227586
| 0.262069
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.040936
| 0.095238
| 189
| 7
| 63
| 27
| 0.807018
| 0
| 0
| 0
| 0
| 0
| 0.179348
| 0.179348
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
1f7fe5c4cedd939b506d08ca96abc1872210d1e4
| 88
|
py
|
Python
|
binarysearch/listPartitioning.py
|
Ry4nW/python-wars
|
76e3fb24b7ae2abf35db592f1ad59cf8d5f9e508
|
[
"MIT"
] | 1
|
2021-06-06T19:55:22.000Z
|
2021-06-06T19:55:22.000Z
|
binarysearch/listPartitioning.py
|
Ry4nW/python-wars
|
76e3fb24b7ae2abf35db592f1ad59cf8d5f9e508
|
[
"MIT"
] | 1
|
2022-01-20T19:20:33.000Z
|
2022-01-20T23:51:46.000Z
|
binarysearch/listPartitioning.py
|
Ry4nW/python-wars
|
76e3fb24b7ae2abf35db592f1ad59cf8d5f9e508
|
[
"MIT"
] | null | null | null |
class Solution:
def solve(self, strs):
return sorted(strs, reverse = True)
| 17.6
| 43
| 0.636364
| 11
| 88
| 5.090909
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.261364
| 88
| 4
| 44
| 22
| 0.861538
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
2f071198cd0a0a308601f1f31ea9c80daafa0b49
| 36,173
|
py
|
Python
|
supplies/views.py
|
cupracer/family-tools
|
95a9f4d845fca4a00e2b666afc7eb791745121e7
|
[
"MIT"
] | null | null | null |
supplies/views.py
|
cupracer/family-tools
|
95a9f4d845fca4a00e2b666afc7eb791745121e7
|
[
"MIT"
] | null | null | null |
supplies/views.py
|
cupracer/family-tools
|
95a9f4d845fca4a00e2b666afc7eb791745121e7
|
[
"MIT"
] | null | null | null |
from datetime import datetime
from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
from django.db import models
from django.db.models import Count
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render
from django.contrib.messages.views import SuccessMessageMixin
from django.urls import reverse_lazy
from django.utils.timezone import now
from django.views import generic
from bootstrap_modal_forms.mixins import PassRequestMixin
from django.contrib import messages
from django.views.generic.detail import BaseDetailView
from guardian.mixins import PermissionRequiredMixin as GuardianPermissionRequiredMixin
from django.http import JsonResponse
from rest_framework.response import Response
from todoist.api import SyncError
from rest_framework import generics
from django.db.models import Q
from family_tools import settings
from .forms import BrandForm, CategoryForm, SupplyForm, SupplyItemForm, SupplyItemCreateForm, PackagingForm, ProductForm
from .models import Brand, Category, Supply, SupplyItem, Packaging, Product
from .serializers import SupplyItemSerializer, SupplySerializer, ProductSerializer
from .todoist import TodoistSync
class CategoryIndex(LoginRequiredMixin, GuardianPermissionRequiredMixin, generic.TemplateView):
model = Category
context_object_name = 'categories'
template_name = 'supplies/categories/list.html'
permission_required = 'supplies.view_category'
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Categories'
}
nav = {
'first_level': 'supplies',
'second_level': 'categories'
}
def get(self, request, *args, **kwargs):
return render(request, self.template_name, {
'site': self.site,
'nav': self.nav,
'can_add': self.request.user.has_perm('supplies.add_category')
})
class CategoryCreateView(LoginRequiredMixin, PermissionRequiredMixin, PassRequestMixin, SuccessMessageMixin, generic.CreateView):
template_name = 'supplies/categories/new.html'
form_class = CategoryForm
permission_required = 'supplies.add_category'
success_message = 'Success: category was created.'
success_url = reverse_lazy('supplies_category_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Create category'
}
nav = {
'first_level': 'supplies',
'second_level': 'categories'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
def form_valid(self, form):
form.instance.user = self.request.user
return super().form_valid(form)
class CategoryUpdateView(LoginRequiredMixin, GuardianPermissionRequiredMixin, SuccessMessageMixin, generic.UpdateView):
model = Category
form_class = CategoryForm
template_name = 'supplies/categories/edit.html'
permission_required = 'supplies.change_category'
success_message = 'Success: Category was updated.'
success_url = reverse_lazy('supplies_category_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Edit category'
}
nav = {
'first_level': 'supplies',
'second_level': 'categories'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
class CategoryDeleteView(LoginRequiredMixin, GuardianPermissionRequiredMixin, SuccessMessageMixin, generic.DeleteView):
model = Category
form_class = CategoryForm
template_name = 'supplies/categories/delete.html'
permission_required = 'supplies.delete_category'
success_message = 'Success: Category was deleted.'
error_message = 'Error: Could not delete category.'
success_url = reverse_lazy('supplies_category_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Delete category'
}
nav = {
'first_level': 'supplies',
'second_level': 'categories'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
def get_error_message(self, cleaned_data):
return self.error_message % cleaned_data
def delete(self, request, *args, **kwargs):
self.object = self.get_object()
success_url = self.get_success_url()
try:
self.object.delete()
messages.success(self.request, self.success_message)
return HttpResponseRedirect(success_url)
except models.ProtectedError:
messages.error(self.request, self.error_message + ' (still in use)')
return HttpResponseRedirect(success_url)
class BrandIndex(LoginRequiredMixin, GuardianPermissionRequiredMixin, generic.TemplateView):
model = Brand
context_object_name = 'brands'
template_name = 'supplies/brands/list.html'
permission_required = 'supplies.view_brand'
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Brands'
}
nav = {
'first_level': 'supplies',
'second_level': 'brands'
}
def get(self, request, *args, **kwargs):
return render(request, self.template_name, {
'site': self.site,
'nav': self.nav,
'can_add': self.request.user.has_perm('supplies.add_brand')
})
class BrandCreateView(LoginRequiredMixin, PermissionRequiredMixin, PassRequestMixin, SuccessMessageMixin, generic.CreateView):
template_name = 'supplies/brands/new.html'
form_class = BrandForm
permission_required = 'supplies.add_brand'
success_message = 'Success: brand was created.'
success_url = reverse_lazy('brand_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Create brand'
}
nav = {
'first_level': 'supplies',
'second_level': 'brands'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
def form_valid(self, form):
form.instance.user = self.request.user
return super().form_valid(form)
class BrandUpdateView(LoginRequiredMixin, GuardianPermissionRequiredMixin, SuccessMessageMixin, generic.UpdateView):
model = Brand
form_class = BrandForm
template_name = 'supplies/brands/edit.html'
permission_required = 'supplies.change_brand'
success_message = 'Success: brand was updated.'
success_url = reverse_lazy('brand_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Edit brand'
}
nav = {
'first_level': 'supplies',
'second_level': 'brands'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
class BrandDeleteView(LoginRequiredMixin, PermissionRequiredMixin, SuccessMessageMixin, generic.DeleteView):
model = Brand
form_class = BrandForm
template_name = 'supplies/brands/delete.html'
permission_required = 'supplies.delete_brand'
success_message = 'Success: brand was deleted.'
error_message = 'Error: Could not delete brand.'
success_url = reverse_lazy('brand_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Delete brand'
}
nav = {
'first_level': 'supplies',
'second_level': 'brands'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
def get_error_message(self, cleaned_data):
return self.error_message % cleaned_data
def delete(self, request, *args, **kwargs):
self.object = self.get_object()
success_url = self.get_success_url()
try:
self.object.delete()
messages.success(self.request, self.success_message)
return HttpResponseRedirect(success_url)
except models.ProtectedError:
messages.error(self.request, self.error_message + ' (still in use)')
return HttpResponseRedirect(success_url)
class PackagingIndex(LoginRequiredMixin, GuardianPermissionRequiredMixin, generic.TemplateView):
model = Packaging
context_object_name = 'packagings'
template_name = 'supplies/packagings/list.html'
permission_required = 'supplies.view_packaging'
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Packagings'
}
nav = {
'first_level': 'supplies',
'second_level': 'packagings'
}
def get(self, request, *args, **kwargs):
return render(request, self.template_name, {
'site': self.site,
'nav': self.nav,
'can_add': self.request.user.has_perm('supplies.add_packaging')
})
class PackagingCreateView(LoginRequiredMixin, PermissionRequiredMixin, PassRequestMixin, SuccessMessageMixin, generic.CreateView):
template_name = 'supplies/packagings/new.html'
form_class = PackagingForm
permission_required = 'supplies.add_packaging'
success_message = 'Success: packaging was created.'
success_url = reverse_lazy('packaging_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Create packaging'
}
nav = {
'first_level': 'supplies',
'second_level': 'packagings'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
def form_valid(self, form):
form.instance.user = self.request.user
return super().form_valid(form)
class PackagingUpdateView(LoginRequiredMixin, GuardianPermissionRequiredMixin, SuccessMessageMixin, generic.UpdateView):
model = Packaging
form_class = PackagingForm
template_name = 'supplies/packagings/edit.html'
permission_required = 'supplies.change_packaging'
success_message = 'Success: packaging was updated.'
success_url = reverse_lazy('packaging_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Edit packaging'
}
nav = {
'first_level': 'supplies',
'second_level': 'packagings'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
class PackagingDeleteView(LoginRequiredMixin, PermissionRequiredMixin, SuccessMessageMixin, generic.DeleteView):
model = Packaging
form_class = PackagingForm
template_name = 'supplies/packagings/delete.html'
permission_required = 'supplies.delete_packaging'
success_message = 'Success: packaging was deleted.'
error_message = 'Error: Could not delete packaging.'
success_url = reverse_lazy('packaging_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Delete packaging'
}
nav = {
'first_level': 'supplies',
'second_level': 'packagings'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
def get_error_message(self, cleaned_data):
return self.error_message % cleaned_data
def delete(self, request, *args, **kwargs):
self.object = self.get_object()
success_url = self.get_success_url()
try:
self.object.delete()
messages.success(self.request, self.success_message)
return HttpResponseRedirect(success_url)
except models.ProtectedError:
messages.error(self.request, self.error_message + ' (still in use)')
return HttpResponseRedirect(success_url)
class SupplyIndex(LoginRequiredMixin, GuardianPermissionRequiredMixin, generic.TemplateView):
model = Supply
context_object_name = 'supplies'
template_name = 'supplies/supplies/list.html'
permission_required = 'supplies.view_supply'
def get(self, request, *args, **kwargs):
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Supplies'
}
nav = {
'first_level': 'supplies',
'second_level': 'supplies'
}
datatables_path = '/api/supplies/supplies/?format=datatables'
context = {
'site': site,
'nav': nav,
'can_add': self.request.user.has_perm('supplies.add_supply'),
'use_todoist': True if self.request.user.todoist_api_key else False,
'datatables_path': datatables_path
}
if 'supply_id' in kwargs:
supply = Supply.objects.get(id=kwargs['supply_id'])
context['datatables_path'] = '/supplies/supplies/by_id/' + \
str(kwargs['supply_id']) + '/json/?format=datatables'
context['site']['page_title'] = 'Supplies (filtered by "' + supply.name + '")'
return render(request, self.template_name, context)
# I wasted several hours for this sh*tty class!
# Without that get() method and using "many=True" the serializer returned an empty result only.
# I still don't understand why this all is needed, because "housekeeping_book/views.py" doesn't need it. :-(
class SupplyByIdJson(generics.ListAPIView):
serializer_class = SupplySerializer()
def get_queryset(self):
supply_id = self.kwargs['supply_id']
return Supply.objects.filter(pk=supply_id).annotate(
num_items=Count('supplyitem', distinct=True, filter=Q(supplyitem__checkout_date=None)))
def get(self, request, *args, **kwargs):
queryset = self.get_queryset()
serializer = SupplySerializer(queryset, many=True)
return Response(serializer.data)
class SupplyCreateView(LoginRequiredMixin, PermissionRequiredMixin, PassRequestMixin, SuccessMessageMixin, generic.CreateView):
template_name = 'supplies/supplies/new.html'
form_class = SupplyForm
permission_required = 'supplies.add_supply'
success_message = 'Success: supply was created.'
success_url = reverse_lazy('supply_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Create supply'
}
nav = {
'first_level': 'supplies',
'second_level': 'supplies'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
def form_valid(self, form):
form.instance.user = self.request.user
return super().form_valid(form)
class SupplyUpdateView(LoginRequiredMixin, PermissionRequiredMixin, SuccessMessageMixin, generic.UpdateView):
model = Supply
form_class = SupplyForm
template_name = 'supplies/supplies/edit.html'
permission_required = 'supplies.change_supply'
success_message = 'Success: supply was updated.'
success_url = reverse_lazy('supply_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Edit supply'
}
nav = {
'first_level': 'supplies',
'second_level': 'supplies'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
class SupplyDeleteView(LoginRequiredMixin, PermissionRequiredMixin, SuccessMessageMixin, generic.DeleteView):
model = Supply
form_class = SupplyForm
template_name = 'supplies/supplies/delete.html'
permission_required = 'supplies.delete_supply'
success_message = 'Success: supply was deleted.'
error_message = 'Error: Could not delete supply.'
success_url = reverse_lazy('supply_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Delete supply'
}
nav = {
'first_level': 'supplies',
'second_level': 'supplies'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
def get_error_message(self, cleaned_data):
return self.error_message % cleaned_data
def delete(self, request, *args, **kwargs):
self.object = self.get_object()
success_url = self.get_success_url()
try:
self.object.delete()
messages.success(self.request, self.success_message)
return HttpResponseRedirect(success_url)
except models.ProtectedError:
messages.error(self.request, self.error_message + ' (still in use)')
return HttpResponseRedirect(success_url)
class SupplyAddToTodoistView(LoginRequiredMixin, PermissionRequiredMixin, BaseDetailView):
permission_required = 'supplies.view_supply'
queryset = Supply.objects.all()
def get(self, request, *args, **kwargs):
self.object = self.get_object()
context = self.get_context_data(object=self.object)
try:
if not self.request.user.todoist_api_key:
raise Exception('Todoist API key is missing.')
result = TodoistSync(self.request.user.todoist_api_key).add_to_shopping_list(
project_name=settings.TODOIST_PROJECT_NAME,
section_name=settings.TODOIST_SECTION_NAME,
supply_name=self.object.name
)
return JsonResponse({
"status": "success",
"message": result
})
except SyncError:
return JsonResponse({
"status": "error",
"message": "sync error"
})
# except TypeError:
# return JsonResponse({
# "status": "error",
# "message": "type error"
# })
except Exception as inst:
return JsonResponse({
"status": "error",
"message": inst.args
})
class ProductIndex(LoginRequiredMixin, GuardianPermissionRequiredMixin, generic.TemplateView):
model = Product
context_object_name = 'products'
template_name = 'supplies/products/list.html'
permission_required = 'supplies.view_product'
def get(self, request, *args, **kwargs):
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Products'
}
nav = {
'first_level': 'supplies',
'second_level': 'products'
}
datatables_path = '/api/supplies/products/?format=datatables'
context = {
'site': site,
'nav': nav,
'can_add': self.request.user.has_perm('supplies.add_product'),
'use_todoist': True if self.request.user.todoist_api_key else False,
'datatables_path': datatables_path
}
if 'product_id' in kwargs:
product = Product.objects.get(id=kwargs['product_id'])
context['datatables_path'] = '/supplies/products/by_id/' + \
str(kwargs['product_id']) + '/json/?format=datatables'
context['site']['page_title'] = 'Products (filtered by "' + product.supply.name + '")'
if 'supply_id' in kwargs:
supply = Supply.objects.get(id=kwargs['supply_id'])
context['datatables_path'] = '/supplies/products/by_supply/' + \
str(kwargs['supply_id']) + '/json/?format=datatables'
context['site']['page_title'] = 'Products (filtered by "' + supply.name + '")'
return render(request, self.template_name, context)
# I wasted several hours for this sh*tty class!
# Without that get() method and using "many=True" the serializer returned an empty result only.
# I still don't understand why this all is needed, because "housekeeping_book/views.py" doesn't need it. :-(
class ProductByIdJson(generics.ListAPIView):
serializer_class = ProductSerializer()
def get_queryset(self):
product_id = self.kwargs['product_id']
return Product.objects.filter(pk=product_id).annotate(
num_items=Count('supplyitem', distinct=True, filter=Q(supplyitem__checkout_date=None)))
def get(self, request, *args, **kwargs):
queryset = self.get_queryset()
serializer = ProductSerializer(queryset, many=True)
return Response(serializer.data)
# I wasted several hours for this sh*tty class!
# Without that get() method and using "many=True" the serializer returned an empty result only.
# I still don't understand why this all is needed, because "housekeeping_book/views.py" doesn't need it. :-(
class ProductBySupplyJson(generics.ListAPIView):
serializer_class = ProductSerializer()
def get_queryset(self):
supply_id = self.kwargs['supply_id']
return Product.objects.filter(supply_id=supply_id).annotate(
num_items=Count('supplyitem', distinct=True, filter=Q(supplyitem__checkout_date=None)))
def get(self, request, *args, **kwargs):
queryset = self.get_queryset()
serializer = ProductSerializer(queryset, many=True)
return Response(serializer.data)
class ProductCreateView(LoginRequiredMixin, PermissionRequiredMixin, PassRequestMixin, SuccessMessageMixin, generic.CreateView):
template_name = 'supplies/products/new.html'
form_class = ProductForm
permission_required = 'supplies.add_product'
success_message = 'Success: product was created.'
success_url = reverse_lazy('product_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Create product'
}
nav = {
'first_level': 'supplies',
'second_level': 'products'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
def form_valid(self, form):
form.instance.user = self.request.user
return super().form_valid(form)
class ProductUpdateView(LoginRequiredMixin, PermissionRequiredMixin, SuccessMessageMixin, generic.UpdateView):
model = Product
form_class = ProductForm
template_name = 'supplies/products/edit.html'
permission_required = 'supplies.change_product'
success_message = 'Success: product was updated.'
success_url = reverse_lazy('product_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Edit product'
}
nav = {
'first_level': 'supplies',
'second_level': 'products'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
class ProductDeleteView(LoginRequiredMixin, PermissionRequiredMixin, SuccessMessageMixin, generic.DeleteView):
model = Product
form_class = ProductForm
template_name = 'supplies/products/delete.html'
permission_required = 'supplies.delete_product'
success_message = 'Success: product was deleted.'
error_message = 'Error: Could not delete product.'
success_url = reverse_lazy('product_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Delete product'
}
nav = {
'first_level': 'supplies',
'second_level': 'products'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
def get_error_message(self, cleaned_data):
return self.error_message % cleaned_data
def delete(self, request, *args, **kwargs):
self.object = self.get_object()
success_url = self.get_success_url()
try:
self.object.delete()
messages.success(self.request, self.success_message)
return HttpResponseRedirect(success_url)
except models.ProtectedError:
messages.error(self.request, self.error_message + ' (still in use)')
return HttpResponseRedirect(success_url)
class ProductAddToTodoistView(LoginRequiredMixin, PermissionRequiredMixin, BaseDetailView):
permission_required = 'supplies.view_product'
queryset = Product.objects.all()
def get(self, request, *args, **kwargs):
self.object = self.get_object()
context = self.get_context_data(object=self.object)
try:
if not self.request.user.todoist_api_key:
raise Exception('Todoist API key is missing.')
result = TodoistSync(self.request.user.todoist_api_key).add_to_shopping_list(
project_name=settings.TODOIST_PROJECT_NAME,
section_name=settings.TODOIST_SECTION_NAME,
supply_name=str(self.object)
)
return JsonResponse({
"status": "success",
"message": result
})
except SyncError:
return JsonResponse({
"status": "error",
"message": "sync error"
})
# except TypeError:
# return JsonResponse({
# "status": "error",
# "message": "type error"
# })
except Exception as inst:
return JsonResponse({
"status": "error",
"message": inst.args
})
class SupplyItemIndex(LoginRequiredMixin, GuardianPermissionRequiredMixin, generic.TemplateView):
model = SupplyItem
context_object_name = 'supply_items'
template_name = 'supplies/supply_items/list.html'
permission_required = 'supplies.view_supplyitem'
def get(self, request, *args, **kwargs):
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Supply items'
}
nav = {
'first_level': 'supplies',
'second_level': 'supply_items'
}
datatables_path = '/api/supplies/supply_items/?format=datatables'
context = {
'site': site,
'nav': nav,
'can_add': self.request.user.has_perm('supplies.add_supplyitem'),
'datatables_path': datatables_path
}
if 'supply_id' in kwargs:
supply = Supply.objects.get(id=kwargs['supply_id'])
context['datatables_path'] = '/supplies/supply_items/by_supply/' + \
str(kwargs['supply_id']) + '/json/?format=datatables'
context['site']['page_title'] = 'Supply items (filtered by supply "' + supply.name + '")'
if 'product_id' in kwargs:
product = Product.objects.get(id=kwargs['product_id'])
context['datatables_path'] = '/supplies/supply_items/by_product/' + \
str(kwargs['product_id']) + '/json/?format=datatables'
context['site']['page_title'] = 'Supply items (filtered by product "' + product.supply.name + '")'
return render(request, self.template_name, context)
# I wasted several hours for this sh*tty class!
# Without that get() method and using "many=True" the serializer returned an empty result only.
# I still don't understand why this all is needed, because "housekeeping_book/views.py" doesn't need it. :-(
class SupplyItemBySupplyJson(generics.ListAPIView):
serializer_class = SupplyItemSerializer()
def get_queryset(self):
supply_id = self.kwargs['supply_id']
return SupplyItem.objects.filter(product__supply_id=supply_id, checkout_date=None)
def get(self, request, *args, **kwargs):
queryset = self.get_queryset()
serializer = SupplyItemSerializer(queryset, many=True)
return Response(serializer.data)
# I wasted several hours for this sh*tty class!
# Without that get() method and using "many=True" the serializer returned an empty result only.
# I still don't understand why this all is needed, because "housekeeping_book/views.py" doesn't need it. :-(
class SupplyItemByProductJson(generics.ListAPIView):
serializer_class = SupplyItemSerializer()
def get_queryset(self):
product_id = self.kwargs['product_id']
return SupplyItem.objects.filter(product_id=product_id, checkout_date=None)
def get(self, request, *args, **kwargs):
queryset = self.get_queryset()
serializer = SupplyItemSerializer(queryset, many=True)
return Response(serializer.data)
class SupplyItemCreateView(LoginRequiredMixin, PermissionRequiredMixin, PassRequestMixin, SuccessMessageMixin, generic.CreateView):
template_name = 'supplies/supply_items/new.html'
form_class = SupplyItemCreateForm
permission_required = 'supplies.add_supplyitem'
success_message = 'Success: supply item was created.'
success_url = reverse_lazy('supply_item_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Create supply item'
}
nav = {
'first_level': 'supplies',
'second_level': 'supply_items'
}
def get_initial(self):
initial = super(SupplyItemCreateView, self).get_initial()
initial = initial.copy()
if 'supplies.add_supplyitem.purchase_date' in self.request.session:
initial['purchase_date'] = datetime.fromisoformat(
self.request.session['supplies.add_supplyitem.purchase_date'])
else:
initial['purchase_date'] = datetime.today().date
return initial
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
def form_valid(self, form):
form.instance.user = self.request.user
for x in range(1, form.cleaned_data['count']+1):
form.instance.pk = None
self.object = form.save()
self.request.session['supplies.add_supplyitem.purchase_date'] = form.cleaned_data['purchase_date'].isoformat()
success_message = self.get_success_message(form.cleaned_data)
if success_message:
messages.success(self.request, success_message)
return HttpResponseRedirect(reverse_lazy('supply_item_new'))
class SupplyItemUpdateView(LoginRequiredMixin, PermissionRequiredMixin, SuccessMessageMixin, generic.UpdateView):
model = SupplyItem
form_class = SupplyItemForm
template_name = 'supplies/supply_items/edit.html'
permission_required = 'supplies.change_supplyitem'
success_message = 'Success: supply item was updated.'
success_url = reverse_lazy('supply_item_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Edit supply item'
}
nav = {
'first_level': 'supplies',
'second_level': 'supply_items'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
class SupplyItemCloneView(LoginRequiredMixin, PermissionRequiredMixin, SuccessMessageMixin, generic.UpdateView):
model = SupplyItem
form_class = SupplyItemCreateForm
template_name = 'supplies/supply_items/new.html'
permission_required = 'supplies.add_supplyitem'
success_message = 'Success: supply item was created.'
success_url = reverse_lazy('supply_item_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Create supply item'
}
nav = {
'first_level': 'supplies',
'second_level': 'supply_items'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
def form_valid(self, form):
form.instance.user = self.request.user
for x in range(1, form.cleaned_data['count']+1):
form.instance.pk = None
self.object = form.save()
success_message = self.get_success_message(form.cleaned_data)
if success_message:
messages.success(self.request, success_message)
return HttpResponseRedirect(self.get_success_url())
class SupplyItemDeleteView(LoginRequiredMixin, PermissionRequiredMixin, SuccessMessageMixin, generic.DeleteView):
model = SupplyItem
form_class = SupplyItemForm
template_name = 'supplies/supply_items/delete.html'
permission_required = 'supplies.delete_supplyitem'
success_message = 'Success: supply item was deleted.'
error_message = 'Error: Could not delete supply item.'
success_url = reverse_lazy('supply_item_index')
site = {
'name': 'FamilyTools',
'app_title': 'Supplies',
'page_title': 'Delete supply items'
}
nav = {
'first_level': 'supplies',
'second_level': 'supply_items'
}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['site'] = self.site
context['nav'] = self.nav
return context
def get_error_message(self, cleaned_data):
return self.error_message % cleaned_data
def delete(self, request, *args, **kwargs):
self.object = self.get_object()
success_url = self.get_success_url()
try:
self.object.delete()
messages.success(self.request, self.success_message)
return HttpResponseRedirect(success_url)
except models.ProtectedError:
messages.error(self.request, self.error_message + ' (still in use)')
return HttpResponseRedirect(success_url)
class SupplyItemCheckoutView(LoginRequiredMixin, PermissionRequiredMixin, BaseDetailView):
permission_required = 'supplies.change_supplyitem'
queryset = SupplyItem.objects.all()
def get(self, request, *args, **kwargs):
self.object = self.get_object()
context = self.get_context_data(object=self.object)
try:
self.object.checkout_date = now()
self.object.save()
return JsonResponse({
"status": "success",
"id": self.object.id,
"message": self.object.product.supply.name,
})
except:
return JsonResponse({
"status": "error",
"message": "some error occurred"
})
class SupplyItemCheckinView(LoginRequiredMixin, PermissionRequiredMixin, BaseDetailView):
permission_required = 'supplies.change_supplyitem'
queryset = SupplyItem.objects.all()
def get(self, request, *args, **kwargs):
self.object = self.get_object()
context = self.get_context_data(object=self.object)
try:
self.object.checkout_date = None
self.object.save()
return JsonResponse({
"status": "success",
"message": self.object.product.supply.name
})
except:
return JsonResponse({
"status": "error",
"message": "some error occurred"
})
| 35.498528
| 131
| 0.648246
| 3,712
| 36,173
| 6.132543
| 0.068696
| 0.027543
| 0.02583
| 0.024161
| 0.858549
| 0.831488
| 0.735767
| 0.71266
| 0.69153
| 0.60868
| 0
| 0.000146
| 0.241865
| 36,173
| 1,018
| 132
| 35.533399
| 0.82993
| 0.040196
| 0
| 0.694611
| 0
| 0
| 0.193728
| 0.054218
| 0
| 0
| 0
| 0
| 0
| 1
| 0.070659
| false
| 0.008383
| 0.028743
| 0.010778
| 0.458683
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
2f1b6ba45feef6526ce157d194cd9b046f2c4336
| 33
|
py
|
Python
|
core/Login.py
|
sunumukundan/fuuerza
|
d11056b7683b4eb3a5f14297d2e289c84bd6c49a
|
[
"MIT"
] | null | null | null |
core/Login.py
|
sunumukundan/fuuerza
|
d11056b7683b4eb3a5f14297d2e289c84bd6c49a
|
[
"MIT"
] | null | null | null |
core/Login.py
|
sunumukundan/fuuerza
|
d11056b7683b4eb3a5f14297d2e289c84bd6c49a
|
[
"MIT"
] | null | null | null |
print("Hello");
print("updated");
| 16.5
| 17
| 0.666667
| 4
| 33
| 5.5
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.030303
| 33
| 2
| 17
| 16.5
| 0.6875
| 0
| 0
| 0
| 0
| 0
| 0.352941
| 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
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
2f2a48955c4011aa6ad6a63a02dc59738bee3848
| 198
|
py
|
Python
|
lists_mutation/insert_method.py
|
magicalcarpet/the_complete_python_course
|
0ac0c5015a93607d7d29258ac0a3fc38dda81bd2
|
[
"MIT"
] | null | null | null |
lists_mutation/insert_method.py
|
magicalcarpet/the_complete_python_course
|
0ac0c5015a93607d7d29258ac0a3fc38dda81bd2
|
[
"MIT"
] | null | null | null |
lists_mutation/insert_method.py
|
magicalcarpet/the_complete_python_course
|
0ac0c5015a93607d7d29258ac0a3fc38dda81bd2
|
[
"MIT"
] | null | null | null |
plays = ['Hamlet', 'Macbeth', 'King Lear']
plays.insert(1, 'Julius Caesar')
print(plays)
plays.insert(0, 'Romeo & Juliet')
print(plays)
plays.insert(10, "A Midsummer Night's Dreams")
print(plays)
| 19.8
| 46
| 0.69697
| 29
| 198
| 4.758621
| 0.655172
| 0.23913
| 0.217391
| 0.304348
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.022857
| 0.116162
| 198
| 10
| 47
| 19.8
| 0.765714
| 0
| 0
| 0.428571
| 0
| 0
| 0.376884
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.428571
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
c82810a900c9bcd3900e2f39a64e17680f2bd67e
| 117
|
py
|
Python
|
blackbox/handlers/__init__.py
|
rabibh/blackbox
|
c77dac14449a4a3d74ee3d2b00170b3085642bbf
|
[
"MIT"
] | 31
|
2021-01-07T11:29:24.000Z
|
2022-03-19T12:43:43.000Z
|
blackbox/handlers/__init__.py
|
rabibh/blackbox
|
c77dac14449a4a3d74ee3d2b00170b3085642bbf
|
[
"MIT"
] | 61
|
2021-01-07T11:28:00.000Z
|
2021-07-05T11:25:54.000Z
|
blackbox/handlers/__init__.py
|
rabibh/blackbox
|
c77dac14449a4a3d74ee3d2b00170b3085642bbf
|
[
"MIT"
] | 10
|
2021-01-22T18:25:49.000Z
|
2022-03-05T18:19:08.000Z
|
from .databases import BlackboxDatabase
from .notifiers import BlackboxNotifier
from .storage import BlackboxStorage
| 29.25
| 39
| 0.871795
| 12
| 117
| 8.5
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.102564
| 117
| 3
| 40
| 39
| 0.971429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
c077025b22cadf5f61b706c01dfe3426ea3b2e36
| 337
|
py
|
Python
|
src/tzer/tir/mutate/none.py
|
Tzer-AnonBot/tzer
|
07799222118f757bdcb6a14654a6addda2dcf55c
|
[
"Apache-2.0"
] | 47
|
2021-12-16T19:48:49.000Z
|
2022-03-24T03:14:14.000Z
|
src/tzer/tir/mutate/none.py
|
Tzer-AnonBot/tzer
|
07799222118f757bdcb6a14654a6addda2dcf55c
|
[
"Apache-2.0"
] | null | null | null |
src/tzer/tir/mutate/none.py
|
Tzer-AnonBot/tzer
|
07799222118f757bdcb6a14654a6addda2dcf55c
|
[
"Apache-2.0"
] | 4
|
2021-10-16T20:36:58.000Z
|
2022-01-25T04:27:49.000Z
|
from .mutator import Mutator
from tzer.tir.util import TIRNode
from tzer.tir.semantic import Context
class Nilizer(Mutator):
"""any -> None"""
def mutate(self, op: TIRNode, context: Context) -> TIRNode:
return None # type: ignore
def will_modify(self, op: TIRNode, context: Context) -> bool:
return True
| 24.071429
| 65
| 0.676558
| 44
| 337
| 5.159091
| 0.545455
| 0.070485
| 0.096916
| 0.176211
| 0.237885
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.216617
| 337
| 13
| 66
| 25.923077
| 0.859848
| 0.074184
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.375
| 0.25
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 5
|
c08b80e15a047323fe71447f042deb4f4abb1c7b
| 164
|
py
|
Python
|
sfdc_api/utils/soap.py
|
FernandoPicazo/sfdc_api
|
7a40b51f61db285fc01f52ec2bba6d4ff78e8f2d
|
[
"MIT"
] | null | null | null |
sfdc_api/utils/soap.py
|
FernandoPicazo/sfdc_api
|
7a40b51f61db285fc01f52ec2bba6d4ff78e8f2d
|
[
"MIT"
] | 1
|
2020-09-12T20:08:25.000Z
|
2020-09-15T04:08:22.000Z
|
sfdc_api/utils/soap.py
|
FernandoPicazo/sfdc_api
|
7a40b51f61db285fc01f52ec2bba6d4ff78e8f2d
|
[
"MIT"
] | null | null | null |
from .constants import SOAP_BODY_TEMPLATE
def soap_body_builder(session_id, body):
body_str = SOAP_BODY_TEMPLATE
return body_str.format(session_id, body)
| 23.428571
| 44
| 0.79878
| 25
| 164
| 4.84
| 0.52
| 0.198347
| 0.264463
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.140244
| 164
| 6
| 45
| 27.333333
| 0.858156
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
23b72c797cf4b8588bb5181921f5be3c22262e55
| 37
|
py
|
Python
|
webpython/assess.py
|
jgraichen/codeocean
|
131f6101168c9da990cba06f61e470398d448803
|
[
"BSD-3-Clause"
] | 53
|
2015-01-22T17:48:44.000Z
|
2022-03-16T16:53:38.000Z
|
webpython/assess.py
|
jgraichen/codeocean
|
131f6101168c9da990cba06f61e470398d448803
|
[
"BSD-3-Clause"
] | 569
|
2015-02-27T14:04:59.000Z
|
2022-03-23T20:46:43.000Z
|
webpython/assess.py
|
jgraichen/codeocean
|
131f6101168c9da990cba06f61e470398d448803
|
[
"BSD-3-Clause"
] | 32
|
2015-02-27T15:59:08.000Z
|
2021-08-18T09:04:28.000Z
|
# moved to dockerfiles/ubuntu-python
| 18.5
| 36
| 0.810811
| 5
| 37
| 6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.108108
| 37
| 1
| 37
| 37
| 0.909091
| 0.918919
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
23c04d2bbce52cf334fd8170cec001bf28e8e434
| 4,485
|
py
|
Python
|
cortical/termsApi.py
|
npd15393/ResumeMiner
|
9644ae97aaad869c3739b2b7b92e4e5a6f857206
|
[
"BSD-2-Clause"
] | null | null | null |
cortical/termsApi.py
|
npd15393/ResumeMiner
|
9644ae97aaad869c3739b2b7b92e4e5a6f857206
|
[
"BSD-2-Clause"
] | null | null | null |
cortical/termsApi.py
|
npd15393/ResumeMiner
|
9644ae97aaad869c3739b2b7b92e4e5a6f857206
|
[
"BSD-2-Clause"
] | null | null | null |
#!/usr/bin/env python
"""
/*******************************************************************************
* Copyright (c) cortical.io GmbH. All rights reserved.
*
* This software is confidential and proprietary information.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with cortical.io GmbH.
******************************************************************************/
"""
from cortical.models.term import Term
from cortical.models import context
class TermsApi(object):
def __init__(self, apiClient):
self.apiClient = apiClient
def getTerm(self, retina_name, term=None, get_fingerprint=None, start_index=0, max_results=10):
"""Get term objects
Args:
term, str: A term in the retina (optional) (optional)
get_fingerprint, bool: Configure if the fingerprint should be returned as part of the results (optional)
retina_name, str: The retina name (required)
start_index, int: The start-index for pagination (optional) (optional)
max_results, int: Max results per page (optional) (optional)
Returns: Array[Term]
"""
resourcePath = '/terms'
method = 'GET'
queryParams = {}
headerParams = {'Accept': 'Application/json', 'Content-Type': 'application/json'}
postData = None
queryParams['retina_name'] = retina_name
queryParams['term'] = term
queryParams['start_index'] = start_index
queryParams['max_results'] = max_results
queryParams['get_fingerprint'] = get_fingerprint
response = self.apiClient._callAPI(resourcePath, method, queryParams, postData, headerParams)
return [Term(**r) for r in response.json()]
def getContextsForTerm(self, retina_name, term, get_fingerprint=None, start_index=0, max_results=5):
"""Get the contexts for a given term
Args:
term, str: A term in the retina (required)
get_fingerprint, bool: Configure if the fingerprint should be returned as part of the results (optional)
retina_name, str: The retina name (required)
start_index, int: The start-index for pagination (optional) (optional)
max_results, int: Max results per page (optional) (optional)
Returns: Array[Context]
"""
resourcePath = '/terms/contexts'
method = 'GET'
queryParams = {}
headerParams = {'Accept': 'Application/json', 'Content-Type': 'application/json'}
postData = None
queryParams['retina_name'] = retina_name
queryParams['term'] = term
queryParams['start_index'] = start_index
queryParams['max_results'] = max_results
queryParams['get_fingerprint'] = get_fingerprint
response = self.apiClient._callAPI(resourcePath, method, queryParams, postData, headerParams)
return [context.Context(**r) for r in response.json()]
def getSimilarTerms(self, retina_name, term, context_id=None, pos_type=None, get_fingerprint=None, start_index=0, max_results=10):
"""Get the similar terms of a given term
Args:
term, str: A term in the retina (required)
context_id, int: The identifier of a context (optional) (optional)
pos_type, str: Part of speech (optional) (optional)
get_fingerprint, bool: Configure if the fingerprint should be returned as part of the results (optional)
retina_name, str: The retina name (required)
start_index, int: The start-index for pagination (optional) (optional)
max_results, int: Max results per page (optional) (optional)
Returns: Array[Term]
"""
resourcePath = '/terms/similar_terms'
method = 'GET'
queryParams = {}
headerParams = {'Accept': 'Application/json', 'Content-Type': 'application/json'}
postData = None
queryParams['retina_name'] = retina_name
queryParams['term'] = term
queryParams['context_id'] = context_id
queryParams['start_index'] = start_index
queryParams['max_results'] = max_results
queryParams['pos_type'] = pos_type
queryParams['get_fingerprint'] = get_fingerprint
response = self.apiClient._callAPI(resourcePath, method, queryParams, postData, headerParams)
return [Term(**r) for r in response.json()]
| 40.772727
| 134
| 0.625418
| 491
| 4,485
| 5.582485
| 0.209776
| 0.054725
| 0.015323
| 0.019701
| 0.76432
| 0.76432
| 0.76432
| 0.755199
| 0.73112
| 0.73112
| 0
| 0.002365
| 0.245708
| 4,485
| 109
| 135
| 41.146789
| 0.807863
| 0.397993
| 0
| 0.695652
| 0
| 0
| 0.151847
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.086957
| false
| 0
| 0.043478
| 0
| 0.217391
| 0.130435
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
9b0fd32de72834499c5ddbd6c410637a7014fc4a
| 251
|
py
|
Python
|
UnlockPro.py
|
wsdx233/wsdx-bs-mods
|
2aac0701e014017d50163145f3bab8e13b384344
|
[
"AFL-3.0"
] | null | null | null |
UnlockPro.py
|
wsdx233/wsdx-bs-mods
|
2aac0701e014017d50163145f3bab8e13b384344
|
[
"AFL-3.0"
] | null | null | null |
UnlockPro.py
|
wsdx233/wsdx-bs-mods
|
2aac0701e014017d50163145f3bab8e13b384344
|
[
"AFL-3.0"
] | null | null | null |
# -*- coding: UTF-8 -*-
# 解锁器自动生成,请勿修改
import re;
import base64;
from bsUtils import *
import bsUtils;
def _unlockedPro():
return True
def _boughtPro():
return True
bsUtils._haveProOptions = _unlockedPro;
bsUtils._havePro = _boughtPro;
| 20.916667
| 39
| 0.709163
| 28
| 251
| 6.142857
| 0.607143
| 0.116279
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.014634
| 0.183267
| 251
| 12
| 40
| 20.916667
| 0.82439
| 0.135458
| 0
| 0.2
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| true
| 0
| 0.4
| 0.2
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
| 1
| 0
|
0
| 5
|
f1a1ef3742fd59016233698b546ec94f0db155b3
| 78
|
py
|
Python
|
plotly/validators/scatterternary/unselected/__init__.py
|
gnestor/plotly.py
|
a8ae062795ddbf9867b8578fe6d9e244948c15ff
|
[
"MIT"
] | 12
|
2020-04-18T18:10:22.000Z
|
2021-12-06T10:11:15.000Z
|
plotly/validators/scatterternary/unselected/__init__.py
|
gnestor/plotly.py
|
a8ae062795ddbf9867b8578fe6d9e244948c15ff
|
[
"MIT"
] | 27
|
2020-04-28T21:23:12.000Z
|
2021-06-25T15:36:38.000Z
|
plotly/validators/scatterternary/unselected/__init__.py
|
gnestor/plotly.py
|
a8ae062795ddbf9867b8578fe6d9e244948c15ff
|
[
"MIT"
] | 6
|
2020-04-18T23:07:08.000Z
|
2021-11-18T07:53:06.000Z
|
from ._textfont import TextfontValidator
from ._marker import MarkerValidator
| 26
| 40
| 0.871795
| 8
| 78
| 8.25
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.102564
| 78
| 2
| 41
| 39
| 0.942857
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
f1bd637f13121d70bd34f4968837f65bc222aebd
| 98
|
py
|
Python
|
RemoveWindowsLockScreenAds/__main__.py
|
clarkb7/RemoveWindowsLockScreenAds
|
83382f78f63b17e452c02c1b9bb7a197900a4703
|
[
"MIT"
] | null | null | null |
RemoveWindowsLockScreenAds/__main__.py
|
clarkb7/RemoveWindowsLockScreenAds
|
83382f78f63b17e452c02c1b9bb7a197900a4703
|
[
"MIT"
] | null | null | null |
RemoveWindowsLockScreenAds/__main__.py
|
clarkb7/RemoveWindowsLockScreenAds
|
83382f78f63b17e452c02c1b9bb7a197900a4703
|
[
"MIT"
] | null | null | null |
import sys
from RemoveWindowsLockScreenAds.RemoveWindowsLockScreenAds import main
main(sys.argv)
| 19.6
| 70
| 0.877551
| 10
| 98
| 8.6
| 0.6
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.081633
| 98
| 4
| 71
| 24.5
| 0.955556
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
f1d35bcfd46e0503f0970dced9fb493040eae0c8
| 95
|
py
|
Python
|
src/views/__init__.py
|
conrad-evans/reportX_backend
|
aa077c8fd0ea24e2efd6bc775979cfed6c4dea16
|
[
"MIT"
] | null | null | null |
src/views/__init__.py
|
conrad-evans/reportX_backend
|
aa077c8fd0ea24e2efd6bc775979cfed6c4dea16
|
[
"MIT"
] | null | null | null |
src/views/__init__.py
|
conrad-evans/reportX_backend
|
aa077c8fd0ea24e2efd6bc775979cfed6c4dea16
|
[
"MIT"
] | null | null | null |
from flask import Blueprint
auth_blueprint = Blueprint('auth', __name__, url_prefix='/auth')
| 19
| 64
| 0.768421
| 12
| 95
| 5.583333
| 0.666667
| 0.38806
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115789
| 95
| 4
| 65
| 23.75
| 0.797619
| 0
| 0
| 0
| 0
| 0
| 0.094737
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 1
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
|
0
| 5
|
7b13106d0f553727f6bdb32c47a6babf70d8f4a8
| 554
|
py
|
Python
|
tools/wpt/tests/test_revlist.py
|
CanonMukai/wpt
|
378b84eb6e81d893a7c009cf8712aa46c2adbd9e
|
[
"BSD-3-Clause"
] | 8
|
2019-04-09T21:13:05.000Z
|
2021-11-23T17:25:18.000Z
|
tools/wpt/tests/test_revlist.py
|
CanonMukai/wpt
|
378b84eb6e81d893a7c009cf8712aa46c2adbd9e
|
[
"BSD-3-Clause"
] | 7
|
2019-07-08T22:23:16.000Z
|
2021-03-18T23:42:32.000Z
|
tools/wpt/tests/test_revlist.py
|
CanonMukai/wpt
|
378b84eb6e81d893a7c009cf8712aa46c2adbd9e
|
[
"BSD-3-Clause"
] | 11
|
2019-04-12T01:20:16.000Z
|
2021-11-23T17:25:02.000Z
|
from tools.wpt import revlist
def test_calculate_cutoff_date():
assert revlist.calculate_cutoff_date(3601, 3600, 0) == 3600
assert revlist.calculate_cutoff_date(3600, 3600, 0) == 3600
assert revlist.calculate_cutoff_date(3599, 3600, 0) == 0
assert revlist.calculate_cutoff_date(3600, 3600, 1) == 1
assert revlist.calculate_cutoff_date(3600, 3600, -1) == 3599
def test_parse_epoch():
assert revlist.parse_epoch(b"10h") == 36000
assert revlist.parse_epoch(b"10d") == 864000
assert revlist.parse_epoch(b"10w") == 6048000
| 34.625
| 64
| 0.729242
| 80
| 554
| 4.825
| 0.3125
| 0.26943
| 0.295337
| 0.362694
| 0.704663
| 0.435233
| 0.435233
| 0.42487
| 0
| 0
| 0
| 0.17735
| 0.155235
| 554
| 15
| 65
| 36.933333
| 0.647436
| 0
| 0
| 0
| 0
| 0
| 0.016245
| 0
| 0
| 0
| 0
| 0
| 0.727273
| 1
| 0.181818
| true
| 0
| 0.090909
| 0
| 0.272727
| 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
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
9e3d78e40e652661a33710554ef21012bcfe354e
| 97
|
py
|
Python
|
HomPolys/__init__.py
|
madelynandersen/HomomorphismPolynomials
|
a2d856314b55d59f807f4aeafbd946811159e1ef
|
[
"BSD-2-Clause"
] | null | null | null |
HomPolys/__init__.py
|
madelynandersen/HomomorphismPolynomials
|
a2d856314b55d59f807f4aeafbd946811159e1ef
|
[
"BSD-2-Clause"
] | null | null | null |
HomPolys/__init__.py
|
madelynandersen/HomomorphismPolynomials
|
a2d856314b55d59f807f4aeafbd946811159e1ef
|
[
"BSD-2-Clause"
] | null | null | null |
from .core import Monomial, Polynomial
from .graphs import make_multi_simple, create_graph_edges
| 32.333333
| 57
| 0.85567
| 14
| 97
| 5.642857
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.103093
| 97
| 2
| 58
| 48.5
| 0.908046
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
9e8f1394370402e560413c9208c4623a35e95511
| 47
|
py
|
Python
|
web_applications/norges_roforbund/account/utils.py
|
Had96dad/Python
|
9b5cdf0a18fdb195abb8ed9861ff471d6dacde1b
|
[
"MIT"
] | null | null | null |
web_applications/norges_roforbund/account/utils.py
|
Had96dad/Python
|
9b5cdf0a18fdb195abb8ed9861ff471d6dacde1b
|
[
"MIT"
] | null | null | null |
web_applications/norges_roforbund/account/utils.py
|
Had96dad/Python
|
9b5cdf0a18fdb195abb8ed9861ff471d6dacde1b
|
[
"MIT"
] | null | null | null |
import datetime
now = datetime.datetime.now()
| 11.75
| 29
| 0.765957
| 6
| 47
| 6
| 0.5
| 0.611111
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12766
| 47
| 3
| 30
| 15.666667
| 0.878049
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 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
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
7b45ab4903fe38848408f15c65146e8217e472f1
| 34
|
py
|
Python
|
Views/LogoutView.py
|
AiursoftWeb/Kahla.CLI
|
5f83fa79914fab8ad5ce628b56d18d83d77cc049
|
[
"MIT"
] | 10
|
2019-03-21T13:38:24.000Z
|
2019-12-15T11:42:02.000Z
|
Views/LogoutView.py
|
AiursoftWeb/Kahla.CLI
|
5f83fa79914fab8ad5ce628b56d18d83d77cc049
|
[
"MIT"
] | 31
|
2019-04-10T04:29:40.000Z
|
2019-08-11T10:05:31.000Z
|
Views/LogoutView.py
|
AiursoftWeb/Kahla.CLI
|
5f83fa79914fab8ad5ce628b56d18d83d77cc049
|
[
"MIT"
] | 8
|
2019-03-21T14:17:42.000Z
|
2019-08-14T00:04:24.000Z
|
def Logout(data):
print(data)
| 11.333333
| 17
| 0.647059
| 5
| 34
| 4.4
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.205882
| 34
| 2
| 18
| 17
| 0.814815
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 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
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
7b5788168bc707e13f11a26dbe0e46be2c8d8da2
| 906
|
py
|
Python
|
ccas/models/password.py
|
Davasny/ccas
|
7682151e4a13f536d43ddc1d6717b497cb289be5
|
[
"MIT"
] | 3
|
2017-06-03T17:55:11.000Z
|
2021-02-11T10:01:48.000Z
|
ccas/models/password.py
|
Davasny/ccas
|
7682151e4a13f536d43ddc1d6717b497cb289be5
|
[
"MIT"
] | null | null | null |
ccas/models/password.py
|
Davasny/ccas
|
7682151e4a13f536d43ddc1d6717b497cb289be5
|
[
"MIT"
] | 1
|
2018-01-13T08:00:55.000Z
|
2018-01-13T08:00:55.000Z
|
from . import database
import hashlib
from flask import request
def generate_hash(new_password):
return hashlib.sha256(new_password.encode('utf-8')).hexdigest()
def check_if_pass():
if 'password' in request.cookies and request.cookies['password'] != 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855':
return True
else:
return False
def get_pass_hash_short():
password = request.cookies.get('password')
return password[:5] + " [...] " + password[len(password) - 5:]
def get_current_pass():
return request.cookies.get('password')
def check_if_first_run():
response = database.new_query("SELECT `value` FROM `settings` WHERE `name`='pass_made' ;")[0][0]
return True if 'False' in response else False
def made_first_run():
return database.new_argument_query("UPDATE `settings` SET `value`='True' WHERE `name`='pass_made' ;", ())
| 27.454545
| 139
| 0.711921
| 113
| 906
| 5.530973
| 0.40708
| 0.0896
| 0.032
| 0.08
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.066754
| 0.156733
| 906
| 32
| 140
| 28.3125
| 0.751309
| 0
| 0
| 0
| 1
| 0
| 0.257174
| 0.07064
| 0
| 0
| 0
| 0
| 0
| 1
| 0.3
| false
| 0.55
| 0.15
| 0.15
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 5
|
7b5a08f999e6bce20f69a9d69605564247c29880
| 152
|
py
|
Python
|
Meus_dessafios/Exercicios2021/ex111/testes.py
|
DiegoSilvaHoffmann/Curso-de-Python
|
62824bbd3ed42b256fda77acd49536ec7cf23b29
|
[
"MIT"
] | null | null | null |
Meus_dessafios/Exercicios2021/ex111/testes.py
|
DiegoSilvaHoffmann/Curso-de-Python
|
62824bbd3ed42b256fda77acd49536ec7cf23b29
|
[
"MIT"
] | null | null | null |
Meus_dessafios/Exercicios2021/ex111/testes.py
|
DiegoSilvaHoffmann/Curso-de-Python
|
62824bbd3ed42b256fda77acd49536ec7cf23b29
|
[
"MIT"
] | null | null | null |
from ex111.UtilidadeCeV import moeda
from ex111.UtilidadeCeV import dado
valor = dado.leiadinheiro('Informe um valor: R$')
moeda.resumo(valor, 35, 22)
| 25.333333
| 49
| 0.782895
| 22
| 152
| 5.409091
| 0.636364
| 0.151261
| 0.352941
| 0.453782
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.074627
| 0.118421
| 152
| 5
| 50
| 30.4
| 0.813433
| 0
| 0
| 0
| 0
| 0
| 0.131579
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
7b5e21ad99caad95382a2b8f4b2adc7741560432
| 210
|
py
|
Python
|
privacy_encoder/models/__init__.py
|
IsaacCorley/Privacy-Encoder
|
435b1096627a23927d7b0d35dfc7e20e0c5dae7a
|
[
"MIT"
] | 1
|
2022-02-01T11:25:22.000Z
|
2022-02-01T11:25:22.000Z
|
privacy_encoder/models/__init__.py
|
IsaacCorley/Privacy-Encoder
|
435b1096627a23927d7b0d35dfc7e20e0c5dae7a
|
[
"MIT"
] | null | null | null |
privacy_encoder/models/__init__.py
|
IsaacCorley/Privacy-Encoder
|
435b1096627a23927d7b0d35dfc7e20e0c5dae7a
|
[
"MIT"
] | 1
|
2022-02-01T11:25:23.000Z
|
2022-02-01T11:25:23.000Z
|
from .autoencoder import AutoEncoder
from .encoding_classifier import EncodingClassifier
from .image_classifier import ImageClassifier, CelebAImageClassifier
from .privacy_autoencoder import PrivacyAutoEncoder
| 42
| 68
| 0.895238
| 20
| 210
| 9.25
| 0.55
| 0.183784
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.080952
| 210
| 4
| 69
| 52.5
| 0.958549
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
7b6770560362f724616944717559ec55b97279e2
| 46
|
py
|
Python
|
src/disk/__init__.py
|
grenlayk/text-deep-fake
|
3068ddb74f781c1728363c2b8dea2080e7826357
|
[
"MIT"
] | 5
|
2022-02-28T03:37:36.000Z
|
2022-03-31T11:04:45.000Z
|
src/disk/__init__.py
|
grenlayk/text-deep-fake
|
3068ddb74f781c1728363c2b8dea2080e7826357
|
[
"MIT"
] | 2
|
2022-03-20T03:37:03.000Z
|
2022-03-29T22:39:27.000Z
|
src/disk/__init__.py
|
grenlayk/text-deep-fake
|
3068ddb74f781c1728363c2b8dea2080e7826357
|
[
"MIT"
] | null | null | null |
from src.disk.disk import Disk
disk = Disk()
| 11.5
| 30
| 0.717391
| 8
| 46
| 4.125
| 0.5
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.173913
| 46
| 3
| 31
| 15.333333
| 0.868421
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 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
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
7b7fca18763074d99e3ba7346a8ff28d2594b988
| 50
|
py
|
Python
|
wheel5/tricks/gradcam/__init__.py
|
xdralex/pytorch-wheel5
|
336529e354a45908cf3f8f12cd401a95fb2a5351
|
[
"MIT"
] | 2
|
2020-06-08T13:10:06.000Z
|
2020-07-07T05:34:18.000Z
|
wheel5/tricks/gradcam/__init__.py
|
xdralex/pytorch-wheel5
|
336529e354a45908cf3f8f12cd401a95fb2a5351
|
[
"MIT"
] | 1
|
2020-04-29T08:46:14.000Z
|
2020-04-29T08:46:14.000Z
|
wheel5/tricks/gradcam/__init__.py
|
xdralex/pytorch-wheel5
|
336529e354a45908cf3f8f12cd401a95fb2a5351
|
[
"MIT"
] | null | null | null |
from .generator import *
from .auxiliary import *
| 16.666667
| 24
| 0.76
| 6
| 50
| 6.333333
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.16
| 50
| 2
| 25
| 25
| 0.904762
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
7b8cb6436955f4757f7022c75d62a0df5f6198b4
| 122
|
py
|
Python
|
sfepy/postprocess/__init__.py
|
olivierverdier/sfepy
|
83aefb7b33ea17f4acb83388ba8bc7314c77616c
|
[
"BSD-3-Clause"
] | 1
|
2015-07-30T13:47:23.000Z
|
2015-07-30T13:47:23.000Z
|
sfepy/postprocess/__init__.py
|
olivierverdier/sfepy
|
83aefb7b33ea17f4acb83388ba8bc7314c77616c
|
[
"BSD-3-Clause"
] | null | null | null |
sfepy/postprocess/__init__.py
|
olivierverdier/sfepy
|
83aefb7b33ea17f4acb83388ba8bc7314c77616c
|
[
"BSD-3-Clause"
] | null | null | null |
from viewer import Viewer, ViewerGUI
from utils import get_data_ranges
from sources import FileSource, create_file_source
| 30.5
| 50
| 0.868852
| 18
| 122
| 5.666667
| 0.722222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.114754
| 122
| 3
| 51
| 40.666667
| 0.944444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
7baa2d40e2919a9c040d3a42c00fdbcfc699ead5
| 22
|
py
|
Python
|
opsimsummary/version.py
|
LSSTDESC/OpSimSummary
|
4f24a9d10cab1e263e599051b43e5f35bb0d9efe
|
[
"BSD-3-Clause"
] | 4
|
2019-05-13T19:09:01.000Z
|
2022-03-14T01:29:50.000Z
|
opsimsummary/version.py
|
LSSTDESC/OpSimSummary
|
4f24a9d10cab1e263e599051b43e5f35bb0d9efe
|
[
"BSD-3-Clause"
] | 17
|
2019-08-20T18:26:44.000Z
|
2022-03-11T01:18:00.000Z
|
opsimsummary/version.py
|
LSSTDESC/OpSimSummary
|
4f24a9d10cab1e263e599051b43e5f35bb0d9efe
|
[
"BSD-3-Clause"
] | 4
|
2019-05-09T17:48:45.000Z
|
2021-09-01T13:32:30.000Z
|
__VERSION__ = "2.2.2"
| 11
| 21
| 0.636364
| 4
| 22
| 2.5
| 0.5
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 0.136364
| 22
| 1
| 22
| 22
| 0.368421
| 0
| 0
| 0
| 0
| 0
| 0.227273
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
7bad0bedb632a0789f8668f3dcfa506a487b03fe
| 460
|
py
|
Python
|
internos/activityinfo/management/commands/import_data_and_generate_live_crisis_report.py
|
UNICEFLebanonInnovation/Staging-Neuro
|
aac1e4f335ff4ec32041f989a9c22f8581a4961a
|
[
"MIT"
] | null | null | null |
internos/activityinfo/management/commands/import_data_and_generate_live_crisis_report.py
|
UNICEFLebanonInnovation/Staging-Neuro
|
aac1e4f335ff4ec32041f989a9c22f8581a4961a
|
[
"MIT"
] | null | null | null |
internos/activityinfo/management/commands/import_data_and_generate_live_crisis_report.py
|
UNICEFLebanonInnovation/Staging-Neuro
|
aac1e4f335ff4ec32041f989a9c22f8581a4961a
|
[
"MIT"
] | null | null | null |
__author__ = 'achamseddine'
from django.core.management.base import BaseCommand
from internos.activityinfo.tasks import import_data_and_generate_live_crisis_report
class Command(BaseCommand):
help = 'import_data_and_generate_live_crisis_report'
def add_arguments(self, parser):
parser.add_argument('--database', default=None)
def handle(self, *args, **options):
import_data_and_generate_live_crisis_report(options['database'])
| 30.666667
| 83
| 0.782609
| 57
| 460
| 5.894737
| 0.578947
| 0.089286
| 0.116071
| 0.1875
| 0.330357
| 0.330357
| 0.330357
| 0
| 0
| 0
| 0
| 0
| 0.128261
| 460
| 14
| 84
| 32.857143
| 0.837905
| 0
| 0
| 0
| 1
| 0
| 0.158696
| 0.093478
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0.444444
| 0
| 0.888889
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
7bc920906c0a92aa38d9ee9dfc3266fcecb7f6b5
| 308
|
py
|
Python
|
tests/import_order.py
|
tngTUDOR/presamples
|
beb7ec1720b28bb45f45b4250661c03e94366fbf
|
[
"BSD-3-Clause"
] | 9
|
2020-03-19T09:52:57.000Z
|
2021-08-07T15:30:13.000Z
|
tests/import_order.py
|
tngTUDOR/presamples
|
beb7ec1720b28bb45f45b4250661c03e94366fbf
|
[
"BSD-3-Clause"
] | 18
|
2019-06-12T15:59:51.000Z
|
2021-08-30T07:56:38.000Z
|
tests/import_order.py
|
tngTUDOR/presamples
|
beb7ec1720b28bb45f45b4250661c03e94366fbf
|
[
"BSD-3-Clause"
] | 10
|
2019-06-06T14:27:26.000Z
|
2022-02-19T14:02:18.000Z
|
import pytest
def test_presamples_import_first():
import presamples
from bw2calc.lca import PackagesDataLoader
assert PackagesDataLoader is not None
def test_bw2calc_import_first():
from bw2calc.lca import PackagesDataLoader
import presamples
assert PackagesDataLoader is not None
| 23.692308
| 46
| 0.795455
| 36
| 308
| 6.638889
| 0.388889
| 0.058577
| 0.117155
| 0.167364
| 0.594142
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011858
| 0.178571
| 308
| 12
| 47
| 25.666667
| 0.932806
| 0
| 0
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.222222
| 1
| 0.222222
| true
| 0
| 0.777778
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
c87893231c0b540b44022f8b283a0b708b305758
| 148
|
py
|
Python
|
gitanalysis/domain/stdout.py
|
FabienArcellier/gitanalysis
|
ab9639fc0913a75999702da05e81286436714d30
|
[
"MIT"
] | 2
|
2019-03-21T13:49:59.000Z
|
2019-03-21T14:05:40.000Z
|
gitanalysis/domain/stdout.py
|
FabienArcellier/gitanalysis
|
ab9639fc0913a75999702da05e81286436714d30
|
[
"MIT"
] | null | null | null |
gitanalysis/domain/stdout.py
|
FabienArcellier/gitanalysis
|
ab9639fc0913a75999702da05e81286436714d30
|
[
"MIT"
] | null | null | null |
from abc import ABCMeta, abstractmethod
class Stdout:
__metaclass__ = ABCMeta
@abstractmethod
def write(self, content):
pass
| 14.8
| 39
| 0.689189
| 15
| 148
| 6.533333
| 0.866667
| 0.428571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.256757
| 148
| 9
| 40
| 16.444444
| 0.890909
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0.166667
| 0.166667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
7402998dc73bf2167785ea7a0aae05adb9f6c6c2
| 51
|
py
|
Python
|
social/backends/beats.py
|
raccoongang/python-social-auth
|
81c0a542d158772bd3486d31834c10af5d5f08b0
|
[
"BSD-3-Clause"
] | 1,987
|
2015-01-01T16:12:45.000Z
|
2022-03-29T14:24:25.000Z
|
social/backends/beats.py
|
raccoongang/python-social-auth
|
81c0a542d158772bd3486d31834c10af5d5f08b0
|
[
"BSD-3-Clause"
] | 731
|
2015-01-01T22:55:25.000Z
|
2022-03-10T15:07:51.000Z
|
virtual/lib/python3.6/site-packages/social/backends/beats.py
|
dennismwaniki67/awards
|
80ed10541f5f751aee5f8285ab1ad54cfecba95f
|
[
"MIT"
] | 1,082
|
2015-01-01T16:27:26.000Z
|
2022-03-22T21:18:33.000Z
|
from social_core.backends.beats import BeatsOAuth2
| 25.5
| 50
| 0.882353
| 7
| 51
| 6.285714
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.021277
| 0.078431
| 51
| 1
| 51
| 51
| 0.914894
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
cd9eb91bc8841495fe2d9710ca37b0cd2853fb66
| 299
|
py
|
Python
|
src/dbxdeploy/notebook/RelativePathResolver.py
|
DataSentics/dbx-deploy
|
c019d80a2b947b4f180071e97c3981daa3a2214a
|
[
"MIT"
] | null | null | null |
src/dbxdeploy/notebook/RelativePathResolver.py
|
DataSentics/dbx-deploy
|
c019d80a2b947b4f180071e97c3981daa3a2214a
|
[
"MIT"
] | null | null | null |
src/dbxdeploy/notebook/RelativePathResolver.py
|
DataSentics/dbx-deploy
|
c019d80a2b947b4f180071e97c3981daa3a2214a
|
[
"MIT"
] | null | null | null |
from pathlib import PurePosixPath
class RelativePathResolver:
def __init__(
self,
baseDirPath: str,
):
self.__baseDirPath = baseDirPath
def resolve(self, notebookPath: PurePosixPath):
return notebookPath.relative_to(self.__baseDirPath).with_suffix('')
| 23
| 75
| 0.695652
| 27
| 299
| 7.333333
| 0.666667
| 0.227273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.227425
| 299
| 12
| 76
| 24.916667
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0.111111
| 0.111111
| 0.555556
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
cdd8fafda1e63003d0f4116bd4a7ab5e073eff5a
| 497
|
py
|
Python
|
ml_tools/transformers/__init__.py
|
educauchy/kaggle-tab-playground-may21
|
c2ab06b6b182bdf9a583bdec0dafdb1349326d63
|
[
"MIT"
] | null | null | null |
ml_tools/transformers/__init__.py
|
educauchy/kaggle-tab-playground-may21
|
c2ab06b6b182bdf9a583bdec0dafdb1349326d63
|
[
"MIT"
] | null | null | null |
ml_tools/transformers/__init__.py
|
educauchy/kaggle-tab-playground-may21
|
c2ab06b6b182bdf9a583bdec0dafdb1349326d63
|
[
"MIT"
] | null | null | null |
from .AnomalyDetectionTransformer import AnomalyDetectionTransformer
from .ClusteringTransformer import ClusteringTransformer
from .DropColumnsTransformer import DropColumnsTransformer
from .EncoderTransformer import EncoderTransformer
from .FeatureExtractionTransformer import FeatureExtractionTransformer
from .FeatureInteractionTransformer import FeatureInteractionTransformer
from .FeatureSelectionTransformer import FeatureSelectionTransformer
from .ImputeTransformer import ImputeTransformer
| 62.125
| 72
| 0.921529
| 32
| 497
| 14.3125
| 0.3125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.062374
| 497
| 8
| 73
| 62.125
| 0.982833
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
a811cec4f96d391937aac35759bcfa6491c15788
| 4,857
|
py
|
Python
|
tests/UnitTests/controller/test_Timer.py
|
ferranSanchezLlado/ModularChess
|
896fa192fd49f86062ea79dd0d3cbe7e5cdc9d6b
|
[
"MIT"
] | null | null | null |
tests/UnitTests/controller/test_Timer.py
|
ferranSanchezLlado/ModularChess
|
896fa192fd49f86062ea79dd0d3cbe7e5cdc9d6b
|
[
"MIT"
] | null | null | null |
tests/UnitTests/controller/test_Timer.py
|
ferranSanchezLlado/ModularChess
|
896fa192fd49f86062ea79dd0d3cbe7e5cdc9d6b
|
[
"MIT"
] | null | null | null |
import time
import unittest
from datetime import timedelta
from ModularChess.controller.Timer import Timer
from ModularChess.utils.Exceptions import TimerError
class TestTimer(unittest.TestCase):
def setUp(self):
def end_call():
self.finished = True
self.end_call = end_call
self.time = timedelta(seconds=1)
self.increment = timedelta(milliseconds=1)
self.finished = False
self.timer = Timer(self.time, self.increment, self.end_call)
def test_not_started(self):
self.assertEqual(self.time, self.timer.remaining_time())
self.assertEqual(timedelta(seconds=0), self.timer.elapsed_time())
self.assertFalse(self.timer.has_started())
self.assertFalse(self.timer.has_finished())
self.assertFalse(self.timer.has_stopped())
self.assertFalse(self.finished)
def test_started(self):
self.timer.start()
time.sleep(0.01)
self.assertGreater(self.time, self.timer.remaining_time())
self.assertLess(timedelta(seconds=0), self.timer.elapsed_time())
self.assertTrue(self.timer.has_started())
self.assertFalse(self.timer.has_finished())
self.assertFalse(self.timer.has_stopped())
self.assertFalse(self.finished)
self.timer.stop()
def test_started_and_stopped(self):
self.timer.start()
time.sleep(0.01)
self.timer.stop()
self.assertGreater(self.time, self.timer.remaining_time())
self.assertLess(timedelta(seconds=0), self.timer.elapsed_time())
self.assertTrue(self.timer.has_started())
self.assertFalse(self.timer.has_finished())
self.assertTrue(self.timer.has_stopped())
self.assertFalse(self.finished)
def test_finished(self):
self.timer.start()
time.sleep(1.25 * self.time.total_seconds())
self.assertEqual(timedelta(seconds=0), self.timer.remaining_time())
self.assertEqual(self.time.seconds, self.timer.elapsed_time().seconds) # Precision error in finish time
self.assertTrue(self.timer.has_started())
self.assertTrue(self.timer.has_finished())
self.assertTrue(self.timer.has_stopped())
self.assertTrue(self.finished)
def test_increment(self):
self.timer.start()
self.timer.add_increment()
time.sleep(1.25 * self.time.total_seconds())
self.assertEqual(timedelta(seconds=0), self.timer.remaining_time())
self.assertEqual(self.time.seconds, self.timer.elapsed_time().seconds) # Precision error in finish time
self.assertTrue(self.timer.has_started())
self.assertTrue(self.timer.has_finished())
self.assertTrue(self.timer.has_stopped())
self.assertTrue(self.finished)
def test_increment_stop(self):
self.timer.start()
self.timer.add_increment()
self.timer.stop()
self.assertEqual(self.time + self.increment, self.timer.remaining_time() + self.timer.elapsed_time())
self.assertTrue(self.timer.has_started())
self.assertFalse(self.timer.has_finished())
self.assertTrue(self.timer.has_stopped())
self.assertFalse(self.finished)
def test_move(self):
self.timer.start()
self.timer.move()
self.assertEqual(self.time + self.increment, self.timer.remaining_time() + self.timer.elapsed_time())
self.assertTrue(self.timer.has_started())
self.assertFalse(self.timer.has_finished())
self.assertTrue(self.timer.has_stopped())
self.assertFalse(self.finished)
def test_exceptions(self):
self.assertRaises(TimerError, self.timer.add_increment)
self.assertRaises(TimerError, self.timer.stop)
self.assertRaises(TimerError, self.timer.resume)
self.timer.start()
self.assertRaises(TimerError, self.timer.resume)
def test_resume(self):
self.timer.start()
self.timer.stop()
self.timer.resume()
time.sleep(1.25 * self.time.total_seconds())
self.assertEqual(timedelta(seconds=0), self.timer.remaining_time())
self.assertEqual(self.time.seconds, self.timer.elapsed_time().seconds) # Precision error in finish time
self.assertTrue(self.timer.has_started())
self.assertTrue(self.timer.has_finished())
self.assertTrue(self.timer.has_stopped())
self.assertTrue(self.finished)
def test_str(self):
hours, minutes, seconds = int(self.timer.remaining_time().total_seconds() // 3600), \
int(self.timer.remaining_time().total_seconds() // 60 % 60), \
self.timer.remaining_time().total_seconds() % 60
self.assertEqual(f"{hours}:{minutes:02d}:{seconds:05.2f}s", str(self.timer))
if __name__ == '__main__':
unittest.main()
| 37.651163
| 112
| 0.667284
| 584
| 4,857
| 5.416096
| 0.118151
| 0.184951
| 0.091053
| 0.116345
| 0.810307
| 0.766993
| 0.718305
| 0.668669
| 0.631046
| 0.610813
| 0
| 0.009845
| 0.205271
| 4,857
| 128
| 113
| 37.945313
| 0.809585
| 0.018942
| 0
| 0.633663
| 0
| 0
| 0.009662
| 0.007982
| 0
| 0
| 0
| 0
| 0.504951
| 1
| 0.118812
| false
| 0
| 0.049505
| 0
| 0.178218
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
a833cc32df6bb3f1ae6feadf091f16ad8d1b5a5b
| 211
|
py
|
Python
|
writers/abstract_writer.py
|
LorhanSohaky/POOA
|
c604f03f9b7bbfccecb75a982cc76fe428c36433
|
[
"MIT"
] | 1
|
2020-12-05T21:01:10.000Z
|
2020-12-05T21:01:10.000Z
|
writers/abstract_writer.py
|
LorhanSohaky/POOA
|
c604f03f9b7bbfccecb75a982cc76fe428c36433
|
[
"MIT"
] | null | null | null |
writers/abstract_writer.py
|
LorhanSohaky/POOA
|
c604f03f9b7bbfccecb75a982cc76fe428c36433
|
[
"MIT"
] | null | null | null |
from abc import ABC, abstractmethod
class AbstractWriter(ABC):
def __init__(self):
pass
@abstractmethod
def write_file(self,output_filename, list_news):
raise NotImplementedError()
| 21.1
| 52
| 0.7109
| 23
| 211
| 6.217391
| 0.782609
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.218009
| 211
| 9
| 53
| 23.444444
| 0.866667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0.142857
| 0.142857
| 0
| 0.571429
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
a834bc59e0e5208888829e9525c66124f827bcc2
| 53
|
py
|
Python
|
friendlyloris/__init__.py
|
jackdcasey/friendlyloris
|
13dafb5cc0d90183e14b59221f25a73e8505cc08
|
[
"MIT"
] | 1
|
2019-11-11T07:40:56.000Z
|
2019-11-11T07:40:56.000Z
|
friendlyloris/__init__.py
|
jackdcasey/friendlyloris
|
13dafb5cc0d90183e14b59221f25a73e8505cc08
|
[
"MIT"
] | 2
|
2020-03-20T20:53:00.000Z
|
2020-03-20T20:54:29.000Z
|
friendlyloris/__init__.py
|
jackdcasey/friendlyloris
|
13dafb5cc0d90183e14b59221f25a73e8505cc08
|
[
"MIT"
] | 1
|
2020-03-16T21:53:17.000Z
|
2020-03-16T21:53:17.000Z
|
from friendlyloris.friendlyloris import FriendlyLoris
| 53
| 53
| 0.924528
| 5
| 53
| 9.8
| 0.6
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.056604
| 53
| 1
| 53
| 53
| 0.98
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
b52328504f4b47272901e7f8f9249d04a6c041da
| 63
|
py
|
Python
|
ia_utils/__init__.py
|
psychemedia/storynotes
|
ead6ac4570565bab615ee31b8bbd7c96cd9cdd42
|
[
"MIT"
] | null | null | null |
ia_utils/__init__.py
|
psychemedia/storynotes
|
ead6ac4570565bab615ee31b8bbd7c96cd9cdd42
|
[
"MIT"
] | null | null | null |
ia_utils/__init__.py
|
psychemedia/storynotes
|
ead6ac4570565bab615ee31b8bbd7c96cd9cdd42
|
[
"MIT"
] | null | null | null |
from pathlib import Path
from internetarchive import download
| 15.75
| 36
| 0.857143
| 8
| 63
| 6.75
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 63
| 3
| 37
| 21
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
b547fd2285d275847aa77f384faf377df3a57d8b
| 47
|
py
|
Python
|
jsonvl/core/__init__.py
|
gregorybchris/jsonvl
|
bece787c767c49ab32cb7d499a1ab71657827cb7
|
[
"Apache-2.0"
] | 5
|
2021-02-19T00:51:27.000Z
|
2022-01-17T16:59:21.000Z
|
jsonvl/core/__init__.py
|
gregorybchris/jsonvl
|
bece787c767c49ab32cb7d499a1ab71657827cb7
|
[
"Apache-2.0"
] | 7
|
2021-02-18T01:06:12.000Z
|
2021-12-01T19:11:58.000Z
|
jsonvl/core/__init__.py
|
gregorybchris/jsonvl
|
bece787c767c49ab32cb7d499a1ab71657827cb7
|
[
"Apache-2.0"
] | null | null | null |
"""Module for core jsonvl validation logic."""
| 23.5
| 46
| 0.723404
| 6
| 47
| 5.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12766
| 47
| 1
| 47
| 47
| 0.829268
| 0.851064
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
b576e9977e5f65f4d9cc1c566f6466ef46288df0
| 82
|
py
|
Python
|
cornflow-dags/DAG/facility_location/solvers/__init__.py
|
ggsdc/corn
|
4c17c46a70f95b8882bcb6a55ef7daa1f69e0456
|
[
"MIT"
] | 2
|
2020-07-09T20:58:47.000Z
|
2020-07-20T20:40:46.000Z
|
cornflow-dags/DAG/facility_location/solvers/__init__.py
|
baobabsoluciones/cornflow
|
bd7cae22107e5fe148704d5f41d4f58f9c410b40
|
[
"Apache-2.0"
] | 2
|
2022-03-31T08:42:10.000Z
|
2022-03-31T12:05:23.000Z
|
cornflow-dags/DAG/facility_location/solvers/__init__.py
|
ggsdc/corn
|
4c17c46a70f95b8882bcb6a55ef7daa1f69e0456
|
[
"MIT"
] | null | null | null |
""" Imports to make the classes available"""
from .PyomoSolver import PyomoSolver
| 27.333333
| 44
| 0.780488
| 10
| 82
| 6.4
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.134146
| 82
| 2
| 45
| 41
| 0.901408
| 0.45122
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
b59e4fd50f55930c203dbe022671335491fabb89
| 1,146
|
py
|
Python
|
specHdl/rawdata/DestPost.py
|
huhub/prototypeTester
|
3ebb1af5afef26c678fad8d36f945ca2fd804b7d
|
[
"Apache-2.0"
] | null | null | null |
specHdl/rawdata/DestPost.py
|
huhub/prototypeTester
|
3ebb1af5afef26c678fad8d36f945ca2fd804b7d
|
[
"Apache-2.0"
] | null | null | null |
specHdl/rawdata/DestPost.py
|
huhub/prototypeTester
|
3ebb1af5afef26c678fad8d36f945ca2fd804b7d
|
[
"Apache-2.0"
] | null | null | null |
DestPost = {'DsMemVlanPortMask': ['portMask'], 'CtlFwdPortIsolate': ['vlanId', 'forcePortEgressMask'], 'DsMemSrcPortEgressMask': ['portEgressMask'], 'CtlFwdEgressFilter': ['egrFilteringEn'], 'DsMemMcastPort': ['portMask', 'applyVlanMask'], 'CtlFwdMcast': ['mcFilteringEn', 'mcastExcludeSrc'], 'DsMemTsnSplit': ['destBmp'], 'DsRegLagGrp': ['memberBitmap', 'linkNumber', 'srcMatchDiscard'], 'DsRegLagPort': ['destPort'], 'CtlFwdUnknownFilter': ['bcastFilter', 'unknownMcastFilter', 'unknownUcastFilter'], 'CtlFwdExcp': ['excepToCpu'], 'CtlCommon': ['cpuPortNo'], 'CtlFwdDest': ['redirPtpType', 'ptpSnifferType'], 'CtlFwdEgressSpan': ['l2EgrSpanEn'], 'CtlCpuStats': ['statsEn'], 'DsMemCpuStats': ['pktCnt', 'byteCntHi', 'byteCnt'], 'DsRegDestPortChnlMap': ['channelId'], 'DsMemTsnSpec': ['gateId', 'cycleSel', 'prior', 'addRtag'], 'DsMemTsnEdit': ['genSeqNum'], 'CtlFwdLog': ['fwdBitmap', 'fwdBitmapW1', 'vlanDiscard', 'mcastFlood', 'destMap', 'opCode', 'ucastFlood', 'criticalPacket', 'forbidEdit', 'redirPtp', 'egrPortFilted', 'egrVlanFilted', 'lagFilted', 'ptpValid', 'ptp2Cpu', 'addRtag', 'tsnGateId', 'tsnCycle', 'cpuPktType', 'destLostInCfg']}
| 1,146
| 1,146
| 0.711169
| 73
| 1,146
| 11.164384
| 0.972603
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.002796
| 0.0637
| 1,146
| 1
| 1,146
| 1,146
| 0.756757
| 0
| 0
| 0
| 0
| 0
| 0.703575
| 0.01918
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
a974461266e2937bfd21668b37232ea168df2378
| 210
|
py
|
Python
|
tests/test_dummy.py
|
FlorentCollin/6tisch-simulator
|
c73ac7fa8cfc62672e0d2f461aa6b5c6b211c248
|
[
"BSD-3-Clause"
] | 1
|
2020-05-26T12:35:21.000Z
|
2020-05-26T12:35:21.000Z
|
tests/test_dummy.py
|
FlorentCollin/6tisch-simulator
|
c73ac7fa8cfc62672e0d2f461aa6b5c6b211c248
|
[
"BSD-3-Clause"
] | null | null | null |
tests/test_dummy.py
|
FlorentCollin/6tisch-simulator
|
c73ac7fa8cfc62672e0d2f461aa6b5c6b211c248
|
[
"BSD-3-Clause"
] | 1
|
2020-06-15T12:25:35.000Z
|
2020-06-15T12:25:35.000Z
|
"""
dummy tests
"""
#============================ helpers =========================================
#============================ tests ===========================================
def test_dummy():
pass
| 19.090909
| 79
| 0.185714
| 8
| 210
| 4.75
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.095238
| 210
| 10
| 80
| 21
| 0.2
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
a98ad20b4a1b457d3c824dbf0028b97076750bd1
| 94
|
py
|
Python
|
Player/admin.py
|
zkxjzmswkwl/Gunzpedia
|
332b416a3d68062b443797d7bb2916de54f51e86
|
[
"MIT"
] | null | null | null |
Player/admin.py
|
zkxjzmswkwl/Gunzpedia
|
332b416a3d68062b443797d7bb2916de54f51e86
|
[
"MIT"
] | null | null | null |
Player/admin.py
|
zkxjzmswkwl/Gunzpedia
|
332b416a3d68062b443797d7bb2916de54f51e86
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from Player.models import Player
admin.site.register(Player)
| 23.5
| 32
| 0.840426
| 14
| 94
| 5.642857
| 0.642857
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.095745
| 94
| 4
| 33
| 23.5
| 0.929412
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
8d1c9aa70e30c564d5a60d2aba0ccba1875e7b17
| 242
|
py
|
Python
|
prettyqt/widgets/graphicspathitem.py
|
phil65/PrettyQt
|
26327670c46caa039c9bd15cb17a35ef5ad72e6c
|
[
"MIT"
] | 7
|
2019-05-01T01:34:36.000Z
|
2022-03-08T02:24:14.000Z
|
prettyqt/widgets/graphicspathitem.py
|
phil65/PrettyQt
|
26327670c46caa039c9bd15cb17a35ef5ad72e6c
|
[
"MIT"
] | 141
|
2019-04-16T11:22:01.000Z
|
2021-04-14T15:12:36.000Z
|
prettyqt/widgets/graphicspathitem.py
|
phil65/PrettyQt
|
26327670c46caa039c9bd15cb17a35ef5ad72e6c
|
[
"MIT"
] | 5
|
2019-04-17T11:48:19.000Z
|
2021-11-21T10:30:19.000Z
|
from __future__ import annotations
from prettyqt import widgets
from prettyqt.qt import QtWidgets
QtWidgets.QGraphicsPathItem.__bases__ = (widgets.AbstractGraphicsShapeItem,)
class GraphicsPathItem(QtWidgets.QGraphicsPathItem):
pass
| 20.166667
| 76
| 0.838843
| 23
| 242
| 8.478261
| 0.608696
| 0.123077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.11157
| 242
| 11
| 77
| 22
| 0.906977
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.166667
| 0.5
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
|
0
| 5
|
8d456a7db1d620212bacfa1a641f19acbecba68d
| 49
|
py
|
Python
|
Task/Apply-a-callback-to-an-array/Python/apply-a-callback-to-an-array-3.py
|
LaudateCorpus1/RosettaCodeData
|
9ad63ea473a958506c041077f1d810c0c7c8c18d
|
[
"Info-ZIP"
] | 5
|
2021-01-29T20:08:05.000Z
|
2022-03-22T06:16:05.000Z
|
Task/Apply-a-callback-to-an-array/Python/apply-a-callback-to-an-array-3.py
|
seanwallawalla-forks/RosettaCodeData
|
9ad63ea473a958506c041077f1d810c0c7c8c18d
|
[
"Info-ZIP"
] | null | null | null |
Task/Apply-a-callback-to-an-array/Python/apply-a-callback-to-an-array-3.py
|
seanwallawalla-forks/RosettaCodeData
|
9ad63ea473a958506c041077f1d810c0c7c8c18d
|
[
"Info-ZIP"
] | 1
|
2018-11-09T22:08:40.000Z
|
2018-11-09T22:08:40.000Z
|
print " ".join(map(str, map(square, range(10))))
| 24.5
| 48
| 0.632653
| 8
| 49
| 3.875
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.045455
| 0.102041
| 49
| 1
| 49
| 49
| 0.659091
| 0
| 0
| 0
| 0
| 0
| 0.020408
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 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
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
57208476418272af438e17cebd04109450b45528
| 114
|
py
|
Python
|
asset_scanner/admin.py
|
kimnnmadsen/eve-abyssal-market
|
1e07498b98be9282b969badff51d55258c72e7ed
|
[
"MIT"
] | 13
|
2018-08-23T14:27:22.000Z
|
2020-12-07T12:35:38.000Z
|
asset_scanner/admin.py
|
kimnnmadsen/eve-abyssal-market
|
1e07498b98be9282b969badff51d55258c72e7ed
|
[
"MIT"
] | 25
|
2018-10-09T14:37:33.000Z
|
2020-05-15T20:21:48.000Z
|
asset_scanner/admin.py
|
kimnnmadsen/eve-abyssal-market
|
1e07498b98be9282b969badff51d55258c72e7ed
|
[
"MIT"
] | 4
|
2021-08-12T05:34:05.000Z
|
2022-01-06T05:28:36.000Z
|
from django.contrib import admin
from asset_scanner.models import AssetRecord
admin.site.register(AssetRecord)
| 16.285714
| 44
| 0.842105
| 15
| 114
| 6.333333
| 0.733333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 114
| 6
| 45
| 19
| 0.931373
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
57300723251f929b707757a716da14431306df6d
| 22,086
|
py
|
Python
|
qdev_wrappers/transmon/sequencing/floquet.py
|
GateBuilder/qdev-wrappers
|
2f4cfbad74d40d5bdb13dd68feec5ad319b209c5
|
[
"MIT"
] | 13
|
2018-01-10T09:32:50.000Z
|
2022-01-24T00:15:59.000Z
|
qdev_wrappers/transmon/sequencing/floquet.py
|
GateBuilder/qdev-wrappers
|
2f4cfbad74d40d5bdb13dd68feec5ad319b209c5
|
[
"MIT"
] | 122
|
2017-11-01T10:17:50.000Z
|
2020-09-28T06:33:39.000Z
|
qdev_wrappers/transmon/sequencing/floquet.py
|
GateBuilder/qdev-wrappers
|
2f4cfbad74d40d5bdb13dd68feec5ad319b209c5
|
[
"MIT"
] | 30
|
2017-10-31T12:25:32.000Z
|
2022-03-20T04:43:37.000Z
|
from . import make_readout_wf, get_calibration_val, ramp_array, \
cos_array, sin_array, flat_array, gaussian_array, \
make_time_varying_sequence, make_readout_ssb_wf_I, make_readout_ssb_wf_Q, \
get_calibration_array, \
cos_gaussian_array, sin_gaussian_array, get_qubit_count, make_pulse_dict
from . import Segment, Waveform, Element
import logging
log = logging.getLogger(__name__)
def _get_required_channels(
qubit_num=1, control_channels_per_qubit=1, readout_SSB=False,
one_readout_ch_many_qubits=False):
channels_required = 0
readout_channels_per_qubit = 0
if one_readout_ch_many_qubits:
channels_required += 1
if readout_SSB:
channels_required += 1
else:
readout_channels_per_qubit += 1
if readout_SSB:
readout_channels_per_qubit += 1
log.warning('why are you using SSB if you have one '
'microwave source per readout resonator '
'anyway??')
channels_required += qubit_num * \
(control_channels_per_qubit + readout_channels_per_qubit)
return channels_required
def _make_pulse_mod_markers(**kwargs):
if kwargs['pulse_mod']:
pmtime = get_calibration_val('pulse_mod_time')
pulse_mod_markers = {
1: {'delay_time': [-1 * pmtime],
'duration_time': [pmtime]}}
else:
pulse_mod_markers = None
return pulse_mod_markers
def make_i_waveform(**kwargs):
time_after_qubit = (get_calibration_val('cycle_time') -
get_calibration_val('pulse_end'))
compensating_x_wait_segment = Segment(
name='compensating_x_wait', gen_func=flat_array, func_args={'amp': 0})
if kwargs['form'] == 'cos':
floquet_drive = Segment(
name='floquet_drive', gen_func=cos_array,
func_args={'amp': kwargs['amp'], 'freq': kwargs['floquet_freq'],
'positive': kwargs['positive']})
elif kwargs['form'] == 'sin':
floquet_drive = Segment(
name='floquet_drive', gen_func=sin_array,
func_args={'amp': kwargs['amp'], 'freq': kwargs['floquet_freq'],
'positive': kwargs['positive']})
else:
raise Exception('unrecognised form, should be cos or sin')
end_wait_x_segment = Segment(
name='wait', gen_func=flat_array,
func_args={'amp': 0, 'dur': time_after_qubit},
time_markers=kwargs['pulse_mod_markers'])
if all([i in kwargs for i in
['pi_half_before', 'pi_half_after', 'pi_half_after_neg',
'z_ramp_dur']]):
wait_for_z_ramp = Segment(
name='wait', gen_func=flat_array,
func_args={'amp': 0, 'dur': kwargs['z_ramp_dur']},
time_markers=kwargs['pulse_mod_markers'])
if kwargs['pi_half_before']:
before_gate = kwargs['q_pulse_dict']['X/2_I']
else:
before_gate = kwargs['q_pulse_dict']['identity']
if kwargs['pi_half_after']:
after_gate = kwargs['q_pulse_dict']['X/2_I']
elif kwargs['pi_half_after_neg']:
after_gate = kwargs['q_pulse_dict']['-X/2_I']
else:
after_gate = kwargs['q_pulse_dict']['identity']
return Waveform(
channel=kwargs['channel'],
segment_list=[compensating_x_wait_segment, before_gate,
wait_for_z_ramp, floquet_drive, wait_for_z_ramp,
after_gate, end_wait_x_segment])
elif all([i in kwargs for i in
['pi_half_before', 'pi_half_after', 'pi_half_after_neg']]):
if kwargs['pi_half_before']:
before_gate = kwargs['q_pulse_dict']['X/2_I']
else:
before_gate = kwargs['q_pulse_dict']['identity']
if kwargs['pi_half_after']:
after_gate = kwargs['q_pulse_dict']['X/2_I']
elif kwargs['pi_half_after_neg']:
after_gate = kwargs['q_pulse_dict']['-X/2_I']
else:
after_gate = kwargs['q_pulse_dict']['identity']
return Waveform(
channel=kwargs['channel'],
segment_list=[compensating_x_wait_segment, before_gate,
floquet_drive,
after_gate, end_wait_x_segment])
elif 'z_ramp_dur' in kwargs:
wait_for_z_ramp = Segment(
name='wait', gen_func=flat_array,
func_args={'amp': 0, 'dur': kwargs['z_ramp_dur']},
time_markers=kwargs['pulse_mod_markers'])
return Waveform(
channel=kwargs['channel'],
segment_list=[compensating_x_wait_segment,
wait_for_z_ramp, floquet_drive, wait_for_z_ramp,
end_wait_x_segment])
else:
return Waveform(
channel=kwargs['channel'],
segment_list=[compensating_x_wait_segment,
floquet_drive, end_wait_x_segment])
def make_q_waveform(**kwargs):
time_after_qubit = (get_calibration_val('cycle_time') -
get_calibration_val('pulse_end'))
compensating_y_wait_segment = Segment(
name='compensating_y_wait', gen_func=flat_array, func_args={'amp': 0})
wait_for_z_ramp = Segment(
name='wait', gen_func=flat_array,
func_args={'amp': 0, 'dur': kwargs['z_ramp_dur']},
time_markers=kwargs['pulse_mod_markers'])
floquet_wait_segment = Segment(
name='wait_for_floquet', gen_func=flat_array, func_args={'amp': 0})
end_wait_x_segment = Segment(
name='wait', gen_func=flat_array,
func_args={'amp': 0, 'dur': time_after_qubit},
time_markers=kwargs['pulse_mod_markers'])
if all([i in kwargs for i in
['pi_half_before', 'pi_half_after', 'pi_half_after_neg']]):
if kwargs['pi_half_before']:
before_gate = kwargs['q_pulse_dict']['X/2_Q']
else:
before_gate = kwargs['q_pulse_dict']['identity']
if kwargs['pi_half_after']:
after_gate = kwargs['q_pulse_dict']['X/2_Q']
elif kwargs['pi_half_after_neg']:
after_gate = kwargs['q_pulse_dict']['-X/2_Q']
else:
after_gate = kwargs['q_pulse_dict']['identity']
return Waveform(
channel=kwargs['channel'],
segment_list=[compensating_y_wait_segment, before_gate,
wait_for_z_ramp, floquet_wait_segment,
wait_for_z_ramp, after_gate, end_wait_x_segment])
else:
raise RuntimeError("['pi_half_before', 'pi_half_after', "
"'pi_half_after_neg'] not all in kwargs")
def make_z_waveform(**kwargs):
time_after_qubit = (get_calibration_val('cycle_time') -
get_calibration_val('pulse_end'))
compensating_z_wait_segment = Segment(
name='compensating_z_wait', gen_func=flat_array,
func_args={'amp': 0})
z_ramp_segment_up = Segment(
name='z_ramp_up', gen_func=ramp_array,
func_args={'start': 0, 'stop': kwargs['z_amp'],
'dur': kwargs['z_ramp_dur']})
z_on = Segment(
name='z_on', gen_func=flat_array,
func_args={'amp': kwargs['z_amp']})
z_ramp_segment_down = Segment(
name='z_ramp_down', gen_func=ramp_array,
func_args={'start': kwargs['z_amp'], 'stop': 0,
'dur': kwargs['z_ramp_dur']})
wait_z_segment = Segment(
name='wait', gen_func=flat_array,
func_args={'amp': 0, 'dur': time_after_qubit},
time_markers=kwargs['pulse_mod_markers'])
if 'gate_duration' in kwargs:
wait_z_segment = Segment(
name='wait', gen_func=flat_array,
func_args={
'amp': 0,
'dur': time_after_qubit + kwargs['gate_duration']},
time_markers=kwargs['pulse_mod_markers'])
else:
wait_z_segment = Segment(
name='wait', gen_func=flat_array,
func_args={'amp': 0, 'dur': time_after_qubit},
time_markers=kwargs['pulse_mod_markers'])
return Waveform(
channel=kwargs['channel'],
segment_list=[compensating_z_wait_segment, z_ramp_segment_up,
z_on, z_ramp_segment_down, wait_z_segment])
def make_floquet_dur_sequence(
start, stop, step, qubit_indices=None, amp=1, floquet_freq=1e6,
channels=[1, 4], form='cos', z_amps=None, z_ramp_dur=0,
readout_SSBfreqs=None, pulse_mod=False):
"""
Channels go like [x1, z1, x2, z2, ..., readoutI, readoutQ]
qubit_SSBfreqs goes like [SSB1, SSB2, ...]
readout_SSBfreqs goes [SSB1, SSB2, ...]
"""
# check channels and z_amps match requirements and set up lists
# for vary_args and vary_settings
if qubit_indices is None:
qubit_num = get_qubit_count() or 1
else:
qubit_num = len(qubit_indices)
ch_per_qubit = 1
if qubit_num > 1:
ch_per_qubit += 1
if z_amps is None or len(z_amps) != qubit_num:
raise Exception('qubit num is {} but z_amps provided:{}'.format(
qubit_num, z_amps))
# [(chan1, seg1, func_arg1), ...]
vary_args_list = [()] * ch_per_qubit * qubit_num
# [(start1, stop1, step1), ...]
vary_settings_list = [(start, stop, step)] * ch_per_qubit * qubit_num
readout_SSB = (False if readout_SSBfreqs is None else True)
required_channels = _get_required_channels(
qubit_num=qubit_num, control_channels_per_qubit=ch_per_qubit,
readout_SSB=readout_SSB, one_readout_ch_many_qubits=True)
if len(channels) != required_channels:
raise Exception('require {} channels, got {}'
''.format(required_channels, len(channels)))
# set up pulse_mod_markers
pulse_mod_markers = _make_pulse_mod_markers(pulse_mod=pulse_mod)
# make qubit x channel waveforms
if qubit_num == 1:
qubit_wf = make_i_waveform(
form=form, amp=amp, floquet_freq=floquet_freq,
positive=True,
pulse_mod_markers=pulse_mod_markers, channel=channels[0])
else:
qubit_wfs = []
for i in range(qubit_num):
vary_args_list[i * ch_per_qubit] = (
channels[i * ch_per_qubit], 2, 'dur', 0)
vary_settings_list[i * 2] = (start, stop, step)
if i % 2 == 0:
qubit_wfs.append(
make_i_waveform(
form=form, amp=amp, floquet_freq=floquet_freq,
positive=True, z_ramp_dur=z_ramp_dur,
pulse_mod_markers=pulse_mod_markers,
channel=channels[i * 2]))
else:
qubit_wfs.append(
make_i_waveform(
form=form, amp=amp, floquet_freq=floquet_freq,
positive=False, z_ramp_dur=z_ramp_dur,
pulse_mod_markers=pulse_mod_markers,
channel=channels[i * 2]))
# make qubit z channel wafevorms
if qubit_num > 1:
z_wfs = []
for i in range(qubit_num):
vary_args_list[(i * ch_per_qubit) +
1] = (channels[(i * ch_per_qubit) + 1], 2, 'dur', 0)
z_wfs.append(
make_z_waveform(
z_amp=z_amps[i], z_ramp_dur=z_ramp_dur,
pulse_mod_markers=pulse_mod_markers,
channel=channels[(i * ch_per_qubit) + 1]))
# add waveforms to blueprint element
floquet_element = Element(sample_rate=get_calibration_val('sample_rate'))
if qubit_num == 1:
floquet_element.add_waveform(qubit_wf)
else:
for i in range(qubit_num):
floquet_element.add_waveform(qubit_wfs[i])
floquet_element.add_waveform(z_wfs[i])
# add readout waveform(s)
if readout_SSBfreqs is not None:
readout_wf_I = make_readout_ssb_wf_I(readout_SSBfreqs,
channel=channels[-2])
readout_wf_Q = make_readout_ssb_wf_Q(readout_SSBfreqs,
channel=channels[-1])
floquet_element.add_waveform(readout_wf_I)
floquet_element.add_waveform(readout_wf_Q)
r_ch = channels[-2]
else:
readout_wf = make_readout_wf(channel=channels[-1])
floquet_element.add_waveform(readout_wf)
r_ch = channels[-1]
floquet_element.print_segment_lists()
# make sequence
marker_points = int(get_calibration_val('marker_time') *
get_calibration_val('sample_rate'))
if qubit_num == 1:
floquet_sequence = make_time_varying_sequence(
floquet_element, channels[0], 1, 'dur', start, stop, step,
0, get_calibration_val('cycle_time'),
name='floquet_seq',
variable_name='floquet_drive_dur', variable_unit='s',
readout_ch=r_ch, marker_points=marker_points)
else:
floquet_sequence = make_time_varying_sequence(
floquet_element, vary_args_list, vary_settings_list,
get_calibration_val('cycle_time'),
name='floquet_seq',
variable_name='floquet_drive_dur', variable_unit='s',
readout_ch=r_ch, marker_points=marker_points)
floquet_sequence.labels = {
'seq_type': 'floquet', 'floquet_freq': floquet_freq,
'pulse_mod': pulse_mod, 'readoutSSBfreqs': readout_SSBfreqs,
'z_amps': z_amps, 'z_ramp_dur': z_ramp_dur}
return floquet_sequence
def make_floquet_dur_seq_gated(
start, stop, step, qubit_indices=None, amp=1, floquet_freq=1e6,
channels=[1, 4], z_amps=None, z_ramp_dur=0,
form='cos', pi_half_before=None, pi_half_after=None,
gaussian=True, pi_half_after_neg=None, qubit_SSBfreqs=None,
pi_half_amps=None, pulse_mod=False, readout_SSBfreqs=None):
"""
Channels go like [x1, z1, x2, z2, ..., readoutI, readoutQ]
pi_half_X goes like [True, False, False, ...]
qubit_SSBfreqs goes like [SSB1, SSB2, ...]
readout_SSBfreqs goes [SSB1, SSB2, ...]
"""
if qubit_indices is None:
raise RuntimeError('must specify qubit indices')
qubit_num = len(qubit_indices)
# check length of arrays specifying gates
if pi_half_before is None:
pi_half_before = [False] * qubit_num
elif len(pi_half_before) != qubit_num:
raise Exception(
'pi_half_before list length {} is not the same '
'as the qubit_num {}'.format(len(pi_half_before), qubit_num))
if pi_half_after is None:
pi_half_after = [False] * qubit_num
elif len(pi_half_after) != qubit_num:
raise Exception(
'pi_half_after list length {} is not the same '
'as the qubit_num {}'.format(len(pi_half_after), qubit_num))
if pi_half_after_neg is None:
pi_half_after_neg = [False] * qubit_num
elif len(pi_half_after_neg) != qubit_num:
raise Exception(
'pi_half_after_neg list length {} is not the same '
'as the qubit_num {}'.format(len(pi_half_after_neg), qubit_num))
if qubit_SSBfreqs is None and qubit_num > 1:
raise RuntimeError('more than one qubit but no SSB freqs given,'
' use make_floquet_seq for ungated')
# check channels and z_amps match requirements and set up lists
# for vary_args and vary_settings
ch_per_qubit = 2 if qubit_SSBfreqs else 1
if qubit_num > 1:
ch_per_qubit += 1
if z_amps is None or len(z_amps) != qubit_num:
raise Exception('qubit num is {} but z_amps provided:{}'.format(
qubit_num, z_amps))
# vary args for each channel to be varied per element:
# [(chan1, seg1, func_arg1), ...]
vary_args_list = [()] * ch_per_qubit * qubit_num
# vary settings for each channel to be vaied per element:
# [(start1, stop1, step1), ...]
vary_settings_list = [(start, stop, step)] * ch_per_qubit * \
qubit_num
readout_SSB = (False if readout_SSBfreqs is None else True)
required_channels = _get_required_channels(
qubit_num=qubit_num, control_channels_per_qubit=ch_per_qubit,
readout_SSB=readout_SSB, one_readout_ch_many_qubits=True)
if len(channels) != required_channels:
raise Exception('require {} channels, got {}'
''.format(required_channels, len(channels)))
pulse_mod_markers = _make_pulse_mod_markers(pulse_mod=pulse_mod)
sample_rate = get_calibration_val('sample_rate')
gate_dict = make_pulse_dict(qubit_indices=qubit_indices,
SSBfreqs=qubit_SSBfreqs, gaussian=gaussian,
drag=False, z_gates=False, SR=sample_rate)
gate_duration = gate_dict[next(iter(gate_dict))]['X/2_I'].duration
# make qubit x, y and z channel waveforms
if qubit_num == 1:
qubit_wf = make_i_waveform(
form=form, amp=amp, floquet_freq=floquet_freq,
positive=True, pi_half_before=pi_half_before[0],
pi_half_after=pi_half_after[0], q_pulse_dict=gate_dict[0],
pi_half_after_neg=pi_half_after_neg[0],
pulse_mod_markers=pulse_mod_markers, channel=channels[0])
else:
qubit_wfs_I = []
qubit_wfs_Q = []
qubit_wfs_Z = []
for i in range(qubit_num):
vary_args_list[i * ch_per_qubit] = (
channels[i * ch_per_qubit], 3, 'dur', 0)
vary_args_list[i * ch_per_qubit +
1] = (channels[i * ch_per_qubit + 1], 3, 'dur', 0)
vary_args_list[i * ch_per_qubit +
2] = (channels[i * ch_per_qubit + 2], 2, 'dur', 0)
if i % 2 == 0:
qubit_wfs_I.append(
make_i_waveform(
form=form, amp=amp, floquet_freq=floquet_freq,
positive=True, z_ramp_dur=z_ramp_dur,
pi_half_before=pi_half_before[i],
pi_half_after=pi_half_after[i],
q_pulse_dict=gate_dict[i],
pi_half_after_neg=pi_half_after_neg[i],
pulse_mod_markers=pulse_mod_markers,
channel=channels[i * ch_per_qubit]))
else:
qubit_wfs_I.append(
make_i_waveform(
form=form, amp=amp, floquet_freq=floquet_freq,
positive=False, z_ramp_dur=z_ramp_dur,
pi_half_before=pi_half_before[i],
pi_half_after=pi_half_after[i],
q_pulse_dict=gate_dict[i],
pi_half_after_neg=pi_half_after_neg[i],
pulse_mod_markers=pulse_mod_markers,
channel=channels[i * ch_per_qubit]))
qubit_wfs_Q.append(
make_q_waveform(
z_ramp_dur=z_ramp_dur,
pi_half_before=pi_half_before[i],
pi_half_after=pi_half_after[i],
q_pulse_dict=gate_dict[i],
pi_half_after_neg=pi_half_after_neg[i],
pulse_mod_markers=pulse_mod_markers,
channel=channels[i * ch_per_qubit + 1]))
if qubit_num > 1:
qubit_wfs_Z.append(
make_z_waveform(
z_amp=z_amps[i], z_ramp_dur=z_ramp_dur,
gate_duration=gate_duration, q_pulse_dict=gate_dict[i],
pulse_mod_markers=pulse_mod_markers,
channel=channels[i * ch_per_qubit + 2]))
# add waveforms to blueprint element
floquet_element = Element(sample_rate=get_calibration_val('sample_rate'))
if qubit_num == 1:
floquet_element.add_waveform(qubit_wf)
else:
for i in range(qubit_num):
floquet_element.add_waveform(qubit_wfs_I[i])
floquet_element.add_waveform(qubit_wfs_Q[i])
floquet_element.add_waveform(qubit_wfs_Z[i])
# add readout waveform(s)
if readout_SSBfreqs is not None:
readout_wf_I = make_readout_ssb_wf_I(readout_SSBfreqs,
channel=channels[-2])
readout_wf_Q = make_readout_ssb_wf_Q(readout_SSBfreqs,
channel=channels[-1])
floquet_element.add_waveform(readout_wf_I)
floquet_element.add_waveform(readout_wf_Q)
r_ch = channels[-2]
else:
readout_wf = make_readout_wf(channel=channels[-1])
floquet_element.add_waveform(readout_wf)
r_ch = channels[-1]
# make sequence
marker_points = int(get_calibration_val('marker_time') *
get_calibration_val('sample_rate'))
floquet_element.print_segment_lists()
if qubit_num == 1:
floquet_sequence = make_time_varying_sequence(
floquet_element, channels[0], 2, 'dur',
start, stop, step,
0, get_calibration_val('cycle_time'),
name='floquet_seq',
variable_name='floquet_drive_dur', variable_unit='s',
readout_ch=r_ch, marker_points=marker_points)
else:
floquet_sequence = make_time_varying_sequence(
floquet_element, vary_args_list, vary_settings_list,
get_calibration_val('cycle_time'),
name='floquet_seq',
variable_name='floquet_drive_dur', variable_unit='s',
readout_ch=r_ch, marker_points=marker_points)
floquet_sequence.labels = {
'seq_type': 'floquet', 'floquet_freq': floquet_freq,
'pulse_mod': pulse_mod, 'readoutSSBfreqs': readout_SSBfreqs,
'z_amps': z_amps, 'z_ramp_dur': z_ramp_dur,
'pi_half_before': pi_half_before, 'pi_half_after': pi_half_after,
'pi_half_after_neg': pi_half_after_neg,
'qubitSSBfreqs': qubit_SSBfreqs}
return floquet_sequence
| 43.648221
| 79
| 0.604908
| 2,835
| 22,086
| 4.300176
| 0.069136
| 0.034944
| 0.041506
| 0.026413
| 0.817488
| 0.772455
| 0.747519
| 0.717661
| 0.697072
| 0.677631
| 0
| 0.008922
| 0.294621
| 22,086
| 505
| 80
| 43.734653
| 0.773605
| 0.048266
| 0
| 0.654462
| 0
| 0
| 0.112034
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.016018
| false
| 0
| 0.006865
| 0
| 0.045767
| 0.004577
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
5758972c0d60b31ba89006a9e283860194cfb5c5
| 40
|
py
|
Python
|
tests/__init__.py
|
UKHO/sentinelpy
|
aafadf93f68dbd7ebca6bdf354411e42e725cf69
|
[
"MIT"
] | 2
|
2021-01-11T09:09:25.000Z
|
2021-01-13T11:16:03.000Z
|
tests/__init__.py
|
UKHO/sentinelpy
|
aafadf93f68dbd7ebca6bdf354411e42e725cf69
|
[
"MIT"
] | 32
|
2021-03-03T12:51:00.000Z
|
2022-03-25T01:20:10.000Z
|
tests/__init__.py
|
UKHO/sentinelpy
|
aafadf93f68dbd7ebca6bdf354411e42e725cf69
|
[
"MIT"
] | 1
|
2021-02-07T13:22:40.000Z
|
2021-02-07T13:22:40.000Z
|
"""Unit test package for sentinelpy."""
| 20
| 39
| 0.7
| 5
| 40
| 5.6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125
| 40
| 1
| 40
| 40
| 0.8
| 0.825
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
93c07de8ae4a40b1091aea3223157e1f23d1c37e
| 88
|
py
|
Python
|
PPKomp 2021/Set A/03 Hens & Goats (2).py
|
jaredliw/ppkomp-python-solutions
|
ecb92f3de27100f37595ef31fd46eccd984b84f7
|
[
"MIT"
] | 1
|
2021-04-09T13:58:03.000Z
|
2021-04-09T13:58:03.000Z
|
PPKomp 2021/Set A/03 Hens & Goats (2).py
|
jaredliw/ppkomp-python-solutions
|
ecb92f3de27100f37595ef31fd46eccd984b84f7
|
[
"MIT"
] | null | null | null |
PPKomp 2021/Set A/03 Hens & Goats (2).py
|
jaredliw/ppkomp-python-solutions
|
ecb92f3de27100f37595ef31fd46eccd984b84f7
|
[
"MIT"
] | null | null | null |
hens, goats = map(int, input().split())
print(2 * hens + 4 * goats, 2 * (hens + goats))
| 29.333333
| 47
| 0.579545
| 14
| 88
| 3.642857
| 0.642857
| 0.352941
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.042254
| 0.193182
| 88
| 2
| 48
| 44
| 0.676056
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
93d6e6b2fdf2ba9ac4d0d68a18fccdd3b9e2a133
| 56
|
py
|
Python
|
chroot.py
|
avyadro/gentoo-install
|
b57beab05870df94b3168739d20ef846a9705471
|
[
"MIT"
] | null | null | null |
chroot.py
|
avyadro/gentoo-install
|
b57beab05870df94b3168739d20ef846a9705471
|
[
"MIT"
] | null | null | null |
chroot.py
|
avyadro/gentoo-install
|
b57beab05870df94b3168739d20ef846a9705471
|
[
"MIT"
] | null | null | null |
import os, sys
os.system('pwd')
os.system('ls -l /root')
| 18.666667
| 24
| 0.660714
| 11
| 56
| 3.363636
| 0.727273
| 0.432432
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.107143
| 56
| 3
| 24
| 18.666667
| 0.74
| 0
| 0
| 0
| 0
| 0
| 0.245614
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
f521045191e124b383e8e3a98afd9b57a9ff01d4
| 89
|
py
|
Python
|
dlnlputils/__init__.py
|
Rojanson/stepik-dl-nlp
|
e32748fbccd0868a8e4a131e4749188935ed524f
|
[
"MIT"
] | 120
|
2019-10-29T20:55:45.000Z
|
2022-03-30T05:47:29.000Z
|
dlnlputils/__init__.py
|
sigmadt/stepik-dl-nlp
|
9b01f41768bcdc62772d733c8253ce95fa5e94e4
|
[
"MIT"
] | 2
|
2019-11-20T15:00:15.000Z
|
2019-11-20T15:34:05.000Z
|
dlnlputils/__init__.py
|
sigmadt/stepik-dl-nlp
|
9b01f41768bcdc62772d733c8253ce95fa5e94e4
|
[
"MIT"
] | 122
|
2019-10-24T08:36:25.000Z
|
2022-03-09T12:39:56.000Z
|
from . import data
from . import pipeline
from . import visualization
from . import base
| 17.8
| 27
| 0.775281
| 12
| 89
| 5.75
| 0.5
| 0.57971
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.179775
| 89
| 4
| 28
| 22.25
| 0.945205
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
f52a7e09ade8d12ea503e389ae6f588982993d75
| 108
|
py
|
Python
|
boa3_test/test_sc/built_in_methods_test/MaxInt.py
|
hal0x2328/neo3-boa
|
6825a3533384cb01660773050719402a9703065b
|
[
"Apache-2.0"
] | 25
|
2020-07-22T19:37:43.000Z
|
2022-03-08T03:23:55.000Z
|
boa3_test/test_sc/built_in_methods_test/MaxInt.py
|
hal0x2328/neo3-boa
|
6825a3533384cb01660773050719402a9703065b
|
[
"Apache-2.0"
] | 419
|
2020-04-23T17:48:14.000Z
|
2022-03-31T13:17:45.000Z
|
boa3_test/test_sc/built_in_methods_test/MaxInt.py
|
hal0x2328/neo3-boa
|
6825a3533384cb01660773050719402a9703065b
|
[
"Apache-2.0"
] | 15
|
2020-05-21T21:54:24.000Z
|
2021-11-18T06:17:24.000Z
|
from boa3.builtin import public
@public
def main(val1: int, val2: int) -> int:
return max(val1, val2)
| 15.428571
| 38
| 0.685185
| 17
| 108
| 4.352941
| 0.705882
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.057471
| 0.194444
| 108
| 6
| 39
| 18
| 0.793103
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0.25
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
f5376dc3cb3ba1b484712d5b9dd6c8351e305a31
| 200
|
py
|
Python
|
hdlconfig-example.py
|
roys/python-hdl-networklogger
|
c22e6565afee01cb9a562a5ef777fac69ef70915
|
[
"MIT"
] | 1
|
2021-06-08T07:26:11.000Z
|
2021-06-08T07:26:11.000Z
|
hdlconfig-example.py
|
roys/python-hdl-networklogger
|
c22e6565afee01cb9a562a5ef777fac69ef70915
|
[
"MIT"
] | null | null | null |
hdlconfig-example.py
|
roys/python-hdl-networklogger
|
c22e6565afee01cb9a562a5ef777fac69ef70915
|
[
"MIT"
] | 1
|
2022-01-02T15:24:55.000Z
|
2022-01-02T15:24:55.000Z
|
HDL_PORT = 6000
EMAIL_ADDRESS_FROM = 'sender@example.com'
EMAIL_ADDRESS_TO = 'receiver@example.com'
SMTP_HOST = 'smtp.example.com'
SMTP_PORT = 587
SMTP_USERNAME = 'sender'
SMTP_PASSWORD = 'topsecret'
| 25
| 41
| 0.78
| 29
| 200
| 5.068966
| 0.586207
| 0.204082
| 0.190476
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.039106
| 0.105
| 200
| 7
| 42
| 28.571429
| 0.782123
| 0
| 0
| 0
| 0
| 0
| 0.345
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.142857
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
f53bfe4560776660cdfba36710d8d0647d5485f1
| 266
|
py
|
Python
|
ligm.core/ligm/core/text/editor/__init__.py
|
ligm74/LiGM
|
f22f91a4fcfd7707664935bdf1e2cd41704c8e15
|
[
"MIT"
] | 2
|
2019-11-08T18:10:04.000Z
|
2019-11-08T18:10:36.000Z
|
ligm.core/ligm/core/text/editor/__init__.py
|
ligm74/LiGM
|
f22f91a4fcfd7707664935bdf1e2cd41704c8e15
|
[
"MIT"
] | null | null | null |
ligm.core/ligm/core/text/editor/__init__.py
|
ligm74/LiGM
|
f22f91a4fcfd7707664935bdf1e2cd41704c8e15
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Core : Text editor (2.6.0)
"""Embedded text editor."""
from .editor import TextEditor # noqa
from .abstract import IEditor # noqa
| 29.555556
| 79
| 0.451128
| 26
| 266
| 4.615385
| 0.769231
| 0.166667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.033113
| 0.432331
| 266
| 8
| 80
| 33.25
| 0.761589
| 0.383459
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
f540f9494cf5d290e8cbe32e6e62d7b0d4362656
| 133
|
py
|
Python
|
bluetooth/data_types/hayes_command/argument_validation/string_argument.py
|
jmg292/pyarmoryctl
|
8a3804b55da3725d376562d65c7713944319bd1a
|
[
"MIT"
] | null | null | null |
bluetooth/data_types/hayes_command/argument_validation/string_argument.py
|
jmg292/pyarmoryctl
|
8a3804b55da3725d376562d65c7713944319bd1a
|
[
"MIT"
] | null | null | null |
bluetooth/data_types/hayes_command/argument_validation/string_argument.py
|
jmg292/pyarmoryctl
|
8a3804b55da3725d376562d65c7713944319bd1a
|
[
"MIT"
] | null | null | null |
class StringValidator(object):
def __init__(self, max_length=-1):
self.max_length = max_length
self.value = None
| 26.6
| 38
| 0.669173
| 17
| 133
| 4.823529
| 0.647059
| 0.329268
| 0.317073
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009804
| 0.233083
| 133
| 5
| 39
| 26.6
| 0.794118
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 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
| 0
| 0
| 0
|
0
| 5
|
f5a47294b1a3f99539e6ac7840e3d5fb3f90a0ad
| 253
|
py
|
Python
|
calculate.py
|
cu-swe4s-fall-2019/version-control-xifu0847
|
d52946c7ebf17018daf61f734fa8b33c8acd5548
|
[
"MIT"
] | null | null | null |
calculate.py
|
cu-swe4s-fall-2019/version-control-xifu0847
|
d52946c7ebf17018daf61f734fa8b33c8acd5548
|
[
"MIT"
] | null | null | null |
calculate.py
|
cu-swe4s-fall-2019/version-control-xifu0847
|
d52946c7ebf17018daf61f734fa8b33c8acd5548
|
[
"MIT"
] | null | null | null |
import math_lib
# main function
if __name__== "__main__":
print ("The result of 6 / 3 is :" + str(math_lib.div(6, 3)))
print ("The result of 2 + 3 is :" + str(math_lib.add(2, 3)))
print ("The result of 3 / 0 is :" + str(math_lib.div(3, 0)))
| 36.142857
| 64
| 0.600791
| 47
| 253
| 2.978723
| 0.404255
| 0.2
| 0.3
| 0.342857
| 0.557143
| 0
| 0
| 0
| 0
| 0
| 0
| 0.060914
| 0.221344
| 253
| 7
| 65
| 36.142857
| 0.649746
| 0.051383
| 0
| 0
| 0
| 0
| 0.334728
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.2
| 0
| 0.2
| 0.6
| 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
| 0
| 0
| 0
| 1
|
0
| 5
|
1933757b2261a0fd78d6578f1e68b2365624c084
| 239
|
py
|
Python
|
semana02/ejemplo02.py
|
haroldtr/python-p32021
|
774552481a8f941b193bc9f1f4af93cd37786be6
|
[
"MIT"
] | 1
|
2021-09-30T15:00:26.000Z
|
2021-09-30T15:00:26.000Z
|
semana02/ejemplo02.py
|
haroldtr/python-p32021
|
774552481a8f941b193bc9f1f4af93cd37786be6
|
[
"MIT"
] | null | null | null |
semana02/ejemplo02.py
|
haroldtr/python-p32021
|
774552481a8f941b193bc9f1f4af93cd37786be6
|
[
"MIT"
] | null | null | null |
numero = int(input('Ingresa un numero positivo'))
if numero <= 0:
print('Le indicamos que el valor sea positivo')
# print("El valor capturado es ", numero)
print("I'm")
print(f"El valor capturado es {numero} por tanto es correcto")
| 23.9
| 62
| 0.698745
| 38
| 239
| 4.394737
| 0.605263
| 0.125749
| 0.191617
| 0.215569
| 0.287425
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005051
| 0.171548
| 239
| 9
| 63
| 26.555556
| 0.838384
| 0.16318
| 0
| 0
| 0
| 0
| 0.60101
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.6
| 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
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
195bf49c018acb9867eb1ca42cd1f28b77187c2a
| 125
|
py
|
Python
|
src/manydataapi/plotting/__init__.py
|
sdpython/manyapi
|
dc2aadc58a5d72904f95424dbe57bb832d3ccd73
|
[
"MIT"
] | 1
|
2020-08-08T13:38:45.000Z
|
2020-08-08T13:38:45.000Z
|
src/manydataapi/plotting/__init__.py
|
sdpython/manyapi
|
dc2aadc58a5d72904f95424dbe57bb832d3ccd73
|
[
"MIT"
] | 8
|
2018-05-05T10:03:04.000Z
|
2019-06-08T10:21:30.000Z
|
src/manydataapi/plotting/__init__.py
|
sdpython/manyapi
|
dc2aadc58a5d72904f95424dbe57bb832d3ccd73
|
[
"MIT"
] | null | null | null |
"""
@file
@brief Shortcuts to parsers.
"""
from .dummies import daily_timeseries
from .timeseries import plot_aggregated_ts
| 15.625
| 42
| 0.784
| 16
| 125
| 5.9375
| 0.8125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.128
| 125
| 7
| 43
| 17.857143
| 0.87156
| 0.272
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
19667422657cd79117d5710bd3319044211c4fb5
| 130
|
py
|
Python
|
doexcel3/mainlogic/__init__.py
|
majiashu/data-processing
|
772dc341657c416cef7046473ed3030efa200e33
|
[
"MIT"
] | 1
|
2020-07-31T15:13:02.000Z
|
2020-07-31T15:13:02.000Z
|
doexcel3/utils/__init__.py
|
majiashu/data-processing
|
772dc341657c416cef7046473ed3030efa200e33
|
[
"MIT"
] | null | null | null |
doexcel3/utils/__init__.py
|
majiashu/data-processing
|
772dc341657c416cef7046473ed3030efa200e33
|
[
"MIT"
] | null | null | null |
# -*- encoding: utf-8 -*-
"""
__init__.py.py
Created on 2018/7/11 13:25
Copyright (c) 2018/7/11,
@author: 马家树(majstx@163.com)
"""
| 18.571429
| 28
| 0.630769
| 23
| 130
| 3.391304
| 0.826087
| 0.128205
| 0.179487
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.19469
| 0.130769
| 130
| 7
| 29
| 18.571429
| 0.495575
| 0.930769
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
199b099b97adf16e75cc41995d519c1cbd5c9de4
| 570
|
py
|
Python
|
tests/opwen_email_server/utils/test_path.py
|
kulado/mailserver
|
d05c0b2e8d8c97b7b7a08028a9eacd4427a59c4b
|
[
"Apache-2.0"
] | 15
|
2020-07-06T02:33:15.000Z
|
2021-08-09T19:24:11.000Z
|
tests/opwen_email_server/utils/test_path.py
|
kulado/mailserver
|
d05c0b2e8d8c97b7b7a08028a9eacd4427a59c4b
|
[
"Apache-2.0"
] | 298
|
2016-12-24T20:19:56.000Z
|
2020-04-29T03:13:21.000Z
|
tests/opwen_email_server/utils/test_path.py
|
sbathgate/lokole
|
a4e3fa5da5373880f6783379f7ef8d843e4cc79d
|
[
"Apache-2.0"
] | 12
|
2017-06-05T12:13:35.000Z
|
2020-01-23T03:26:05.000Z
|
from unittest import TestCase
from opwen_email_server.utils import path
class GetExtensionTests(TestCase):
def test_with_simple_extension(self):
self.assertEqual(path.get_extension('foo.txt'), '.txt')
def test_without_complex_extension(self):
self.assertEqual(path.get_extension('foo.txt.gz'), '.txt.gz')
def test_without_extension(self):
self.assertEqual(path.get_extension('foo'), '')
def test_handles_null(self):
self.assertEqual(path.get_extension(None), '')
self.assertEqual(path.get_extension(''), '')
| 30
| 69
| 0.710526
| 71
| 570
| 5.464789
| 0.380282
| 0.193299
| 0.244845
| 0.283505
| 0.548969
| 0.469072
| 0.378866
| 0.378866
| 0.257732
| 0
| 0
| 0
| 0.157895
| 570
| 18
| 70
| 31.666667
| 0.808333
| 0
| 0
| 0
| 0
| 0
| 0.054386
| 0
| 0
| 0
| 0
| 0
| 0.416667
| 1
| 0.333333
| false
| 0
| 0.166667
| 0
| 0.583333
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
19a111ccf5ef1cbf492d6d1a92a7ea3e24e13434
| 343
|
py
|
Python
|
gram/tokens.py
|
Tuitoek/Clonegram
|
ed3a87ee0233855d43341fe580027e8b32e080e5
|
[
"MIT"
] | null | null | null |
gram/tokens.py
|
Tuitoek/Clonegram
|
ed3a87ee0233855d43341fe580027e8b32e080e5
|
[
"MIT"
] | null | null | null |
gram/tokens.py
|
Tuitoek/Clonegram
|
ed3a87ee0233855d43341fe580027e8b32e080e5
|
[
"MIT"
] | null | null | null |
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.utils import six
class TokenGenerator(PasswordResetTokenGenerator):
def _make_hash_value(self,user,timestamp):
return (six.text_type(user.pk)+six.text_type(timestamp)+six.text_type(user.is_active))
account_activation_token = TokenGenerator()
| 38.111111
| 94
| 0.798834
| 42
| 343
| 6.309524
| 0.642857
| 0.079245
| 0.124528
| 0.113208
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.113703
| 343
| 8
| 95
| 42.875
| 0.871711
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0.333333
| 0.333333
| 0.166667
| 0.833333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
|
0
| 5
|
19abbb2244f5069e03503edcdc7a0e91bd6ee29f
| 437
|
py
|
Python
|
pset_challenging_ext/exercises/solutions/p80.py
|
mottaquikarim/pydev-psets
|
9749e0d216ee0a5c586d0d3013ef481cc21dee27
|
[
"MIT"
] | 5
|
2019-04-08T20:05:37.000Z
|
2019-12-04T20:48:45.000Z
|
pset_challenging_ext/exercises/solutions/p80.py
|
mottaquikarim/pydev-psets
|
9749e0d216ee0a5c586d0d3013ef481cc21dee27
|
[
"MIT"
] | 8
|
2019-04-15T15:16:05.000Z
|
2022-02-12T10:33:32.000Z
|
pset_challenging_ext/exercises/solutions/p80.py
|
mottaquikarim/pydev-psets
|
9749e0d216ee0a5c586d0d3013ef481cc21dee27
|
[
"MIT"
] | 2
|
2019-04-10T00:14:42.000Z
|
2020-02-26T20:35:21.000Z
|
"""
Please write a program to randomly generate a list with 5 numbers, which are divisible by 5 and 7 , between 1 and 1000 inclusive.
"""
"""Question:
Please write a program to randomly generate a list with 5 numbers, which are divisible by 5 and 7 , between 1 and 1000 inclusive.
Hints:
Use random.sample() to generate a list of random values.
"""
import random
print random.sample([i for i in range(1,1001) if i%5==0 and i%7==0], 5)
| 33.615385
| 129
| 0.729977
| 81
| 437
| 3.938272
| 0.45679
| 0.08464
| 0.122257
| 0.119122
| 0.639498
| 0.639498
| 0.639498
| 0.639498
| 0.639498
| 0.639498
| 0
| 0.072626
| 0.180778
| 437
| 12
| 130
| 36.416667
| 0.818436
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.5
| null | null | 0.5
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 1
|
0
| 5
|
5ffc783195bc321ae9ac918feb3253709bd96d57
| 142
|
py
|
Python
|
unitorch/datasets/__init__.py
|
fuliucansheng/UniTorch
|
47038321593ce4e7eabda555bd58c0cf89482146
|
[
"MIT"
] | 2
|
2022-02-05T08:52:00.000Z
|
2022-03-27T07:01:34.000Z
|
unitorch/datasets/__init__.py
|
Lixin-Qian/unitorch
|
47038321593ce4e7eabda555bd58c0cf89482146
|
[
"MIT"
] | null | null | null |
unitorch/datasets/__init__.py
|
Lixin-Qian/unitorch
|
47038321593ce4e7eabda555bd58c0cf89482146
|
[
"MIT"
] | 1
|
2022-03-27T07:01:13.000Z
|
2022-03-27T07:01:13.000Z
|
# Copyright (c) FULIUCANSHENG.
# Licensed under the MIT License.
from unitorch.datasets.huggingface import hf_datasets, hf_iterable_datasets
| 28.4
| 75
| 0.823944
| 18
| 142
| 6.333333
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.112676
| 142
| 4
| 76
| 35.5
| 0.904762
| 0.422535
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
272108419d2fe13c9c90b571ca57bbc48dc064e6
| 129
|
py
|
Python
|
mymodule.py
|
batux/python_course_workspace
|
a81c691929cae623fce61728a2c5c908f5d5a5a8
|
[
"MIT"
] | 2
|
2020-11-08T07:23:14.000Z
|
2021-08-10T10:43:15.000Z
|
mymodule.py
|
batux/python_course_workspace
|
a81c691929cae623fce61728a2c5c908f5d5a5a8
|
[
"MIT"
] | null | null | null |
mymodule.py
|
batux/python_course_workspace
|
a81c691929cae623fce61728a2c5c908f5d5a5a8
|
[
"MIT"
] | null | null | null |
"""
DOCSTRING: Bu çok güzel bir modüldür :)
"""
print("Module added!")
def sayHello():
print("merhabalar dünyalı :)")
| 12.9
| 43
| 0.612403
| 14
| 129
| 5.642857
| 0.928571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.209302
| 129
| 9
| 44
| 14.333333
| 0.77451
| 0.302326
| 0
| 0
| 0
| 0
| 0.441558
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| true
| 0
| 0
| 0
| 0.333333
| 0.666667
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
277b5e62593b7d420fea01c3101778a1a04b8e7d
| 129
|
py
|
Python
|
kaylee/manager/__init__.py
|
BasicWolf/archived-kaylee
|
91e5c9025a525f3b0033b067d810a38c9e6be4d3
|
[
"MIT"
] | 2
|
2018-02-18T09:52:23.000Z
|
2018-03-04T06:23:15.000Z
|
kaylee/manager/__init__.py
|
BasicWolf/archived-kaylee
|
91e5c9025a525f3b0033b067d810a38c9e6be4d3
|
[
"MIT"
] | 6
|
2017-08-03T18:51:38.000Z
|
2017-08-03T18:51:38.000Z
|
kaylee/manager/__init__.py
|
BasicWolf/archived-kaylee
|
91e5c9025a525f3b0033b067d810a38c9e6be4d3
|
[
"MIT"
] | null | null | null |
from .command import (BaseCommand, LocalCommand, AdminCommand,
AdminCommandsManager, LocalCommandsManager)
| 43
| 65
| 0.713178
| 8
| 129
| 11.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.232558
| 129
| 2
| 66
| 64.5
| 0.929293
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
27a2a296744cd1d161dff33b9144e1c2e427dedb
| 159
|
py
|
Python
|
metamon/__init__.py
|
knowru/metamon
|
7c128f4f54731f1f197e3b48db5e5a6619974427
|
[
"MIT"
] | null | null | null |
metamon/__init__.py
|
knowru/metamon
|
7c128f4f54731f1f197e3b48db5e5a6619974427
|
[
"MIT"
] | null | null | null |
metamon/__init__.py
|
knowru/metamon
|
7c128f4f54731f1f197e3b48db5e5a6619974427
|
[
"MIT"
] | null | null | null |
from .functions import (
parse_file_to_data_dict, bucketize
, get_metadata_from_data_dict, get_metadata_from_file
, process_data_dict_by_metadata
)
| 31.8
| 57
| 0.811321
| 23
| 159
| 4.956522
| 0.565217
| 0.210526
| 0.263158
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.144654
| 159
| 5
| 58
| 31.8
| 0.838235
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.2
| 0
| 0.2
| 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
| 0
| 0
| 0
| 0
|
0
| 5
|
27a5a54bc68307af629773026e6b577b678a7336
| 57
|
py
|
Python
|
anothernew.py
|
cev4gx/cs3240-labdemo
|
e1cc116821611ee8a616464dc8b5147344ddb190
|
[
"MIT"
] | null | null | null |
anothernew.py
|
cev4gx/cs3240-labdemo
|
e1cc116821611ee8a616464dc8b5147344ddb190
|
[
"MIT"
] | null | null | null |
anothernew.py
|
cev4gx/cs3240-labdemo
|
e1cc116821611ee8a616464dc8b5147344ddb190
|
[
"MIT"
] | null | null | null |
print("this is a new file created in the master branch")
| 28.5
| 56
| 0.754386
| 11
| 57
| 3.909091
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.175439
| 57
| 1
| 57
| 57
| 0.914894
| 0
| 0
| 0
| 0
| 0
| 0.824561
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
27e6ee1506d847ab7ad56fa575fa6cf2d03fa751
| 2,479
|
py
|
Python
|
leetcode/1419_minimum-number-of-frogs-croaking.py
|
heyf/cloaked-octo-adventure
|
8180684a8a1859efb836edd48556b5f3088be398
|
[
"MIT"
] | null | null | null |
leetcode/1419_minimum-number-of-frogs-croaking.py
|
heyf/cloaked-octo-adventure
|
8180684a8a1859efb836edd48556b5f3088be398
|
[
"MIT"
] | null | null | null |
leetcode/1419_minimum-number-of-frogs-croaking.py
|
heyf/cloaked-octo-adventure
|
8180684a8a1859efb836edd48556b5f3088be398
|
[
"MIT"
] | null | null | null |
# https://leetcode.com/problems/minimum-number-of-frogs-croaking
class Solution:
def minNumberOfFrogs(self, croakOfFrogs: str) -> int:
min_frog = 0
status = [0,0,0,0,0]
cindex_dict = {
"c": 0,
"r": 1,
"o": 2,
"a": 3,
"k": 4
}
for c in croakOfFrogs:
cindex = cindex_dict.get(c)
if cindex == 0:
status[cindex] += 1
continue
if status[cindex-1] == 0:
return -1
status[cindex-1] -= 1
status[cindex] += 1
min_frog = max(min_frog, sum(status[:4]) if cindex < 4 else 1 + sum(status[:4]))
if sum(status[:4]) > 0:
return -1
return min_frog
sl = Solution()
# croakOfFrogs = "croakcroak"
# croakOfFrogs = "crcoakroak"
# croakOfFrogs = "croakcrook"
# croakOfFrogs = "croakcroa"
croakOfFrogs = "ccccccccrcccrcccccccccrccccccrccccccrcccccccccccccccrccccrcccccccccccccrccrcrccccccccccrrrcccrcccrrcccrrccccrccccccccccccrcrrcrccccoccccrcccrcccccrcrccccrrrccrcrcccrcorcccccccrrccccccrrrrrcoocoocorcocrrcorccoccccrrcccrcrcacorcrocccrcrrrocccracrorrrrccococcccocrcrrrrrrrocarrrrcoccrorrrccckroccocrroacoccrrororrocrocaocrcrccccccrrooocoocorrrcrarcocrkcorrrrrorrraccrrrooarrraoccroaacrroccraaoraoorroorccokooaorcoocaroororrrocrroccrcrraookoarorrkcrrcoorrorackroooroarcacrorccaroaacorcraccrcocorrroorcraoooroaorccoorrroocokaaooaooarrrrocarcarkraroooorkrcoakarorraoarrooacccrrorkcroorrcockkaaoraororoccckraoccooackorarroookraooaarrrraacrarkkkrcaokaroroakarroorooorrorkkrkaraaocaackroorarocoackarracckkoorraccrrooaaokaooaorokoaaaoaaoarkarackooaaccoraaaooaokrckrooocraakkkaarraarrkoaarraaorrakcaaakockkkcookccaaaacrorooaokkorooaarkrkookkcakooaarocokrkrrarrcaakrorrakrokkrorakoaroaoaaaaaakkkookrakakckaaccokkaorkakrokkrkooooaakaoaakkraokoaoorooaorkoorkoraarkaaoacarkraokoakaookcorookaokrkrracaokkooaroroarkaraokkaakakcorkrackoarkakarkroackakcoarakaakrkarkcrkkaookkaakkkaacraakokkraoaaoaakaaakokookaooorrkooakkrokooraookaoraakkaakaokarackkkkkoaakakacoakaoakokokkarkaookkaokakkoaoaraaokorkkkaoakkoaaaaokoakkkkkkaoaoaakaokakkakoaookakrokaarakaaaooaoarakookkkkkkokkkkkokaakkkaooaaokrooorarkroaaaoakkookoakaakaoaaaaaakkkkaokrokakakakkkokorcakkarkkakkkorakkcaoaaooaokkkkookkkkakrkakkakkkaokkkkkkkkkaakaaakkkkkakkakaokkakkaookkakkaakkkakaoakakkckkakakkkakkaaakakkkkkkkkkakkakroakkkkkkkaakkkkkokkokarakoakk"
ret = sl.minNumberOfFrogs(croakOfFrogs)
print(ret)
| 68.861111
| 1,507
| 0.803953
| 112
| 2,479
| 17.741071
| 0.4375
| 0.014092
| 0.02617
| 0.004026
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012253
| 0.14401
| 2,479
| 35
| 1,508
| 70.828571
| 0.924128
| 0.069786
| 0
| 0.142857
| 0
| 0
| 0.65
| 0.647826
| 0
| 1
| 0
| 0
| 0
| 1
| 0.035714
| false
| 0
| 0
| 0
| 0.178571
| 0.035714
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
27f05d0b9a52f3eec37abc68686babaa8be90cee
| 8,598
|
py
|
Python
|
Data_Evaluation_Code/Content_Classification/main.py
|
dimitristaufer/Cloud-NLP-Evaluation
|
201d7721616f4526ae58bed503fc05874cf2e52a
|
[
"MIT"
] | null | null | null |
Data_Evaluation_Code/Content_Classification/main.py
|
dimitristaufer/Cloud-NLP-Evaluation
|
201d7721616f4526ae58bed503fc05874cf2e52a
|
[
"MIT"
] | null | null | null |
Data_Evaluation_Code/Content_Classification/main.py
|
dimitristaufer/Cloud-NLP-Evaluation
|
201d7721616f4526ae58bed503fc05874cf2e52a
|
[
"MIT"
] | 1
|
2022-03-26T11:47:11.000Z
|
2022-03-26T11:47:11.000Z
|
import sys
sys.path.append('../')
sys.path.append('../..')
from datetime import datetime
from nltk import word_tokenize, pos_tag
import psutil
import unknown_words
import content_classification_calls as ServiceCalls
from mongo_connect import Connect
### Mongo DB Init ###
connection = Connect.get_connection()
db = connection.contentClassification
googleGroundTruthCopy = db.googleGroundTruthCopy # only work on copy
ibmGroundTruthCopy = db.ibmGroundTruthCopy # only work on copy
evaluationResultsGoogle = db.evaluationResultsGoogle
evaluationResultsIBM = db.evaluationResultsIBM
### ###
def currentDateString():
"""
Gets the current date and time as string.
Returns:
String -- The current date and time
"""
now = datetime.now()
return now.strftime("%d-%m-%Y %H:%M:%S")
def wordCount(text):
"""
Counts the number of words in a text string using the NLTK word_tokenize() function.
Arguments:
text {String} -- The text to be analyzed
Returns:
Integer -- The number of words
"""
count = 0
wds = word_tokenize(text)
for wd in wds:
if len(wd) > 1:
count += 1
return count
def nouns(text): # also counts and lists multiple occurrences
"""
Counts the number of nouns in a text string using the NLTK pos_tag() and word_tokenize() function.
Arguments:
text {String} -- The text to be analyzed
Returns:
Dictionary -- The number of nouns and their values
"""
count = 0
words = ""
for wd, pos in pos_tag(word_tokenize(text)):
# NN (noun singular), NNS (noun plural), NNP (proper noun singular), NNPS (proper noun plural)
if pos.startswith('NN'):
count += 1
words += wd+", "
if len(words) >= 2:
words = words[:-2] # remove ", " at the end
return {"count": count,
"words": words}
def googleGetTest():
"""
Retrieves one Google CC test sentence from a local MongoDB database.
Returns:
Dictionary -- An annotated test sentence
"""
test = googleGroundTruthCopy.find_one()
return test
def ibmGetTest():
"""
Retrieves one IBM CC test sentence from a local MongoDB database.
Returns:
Dictionary -- An annotated test sentence
"""
test = ibmGroundTruthCopy.find_one()
return test
def googleTestOne():
"""
Performs all the necessary calls the retrieve, evaluate, and store a content classification test news article for Google's service.
Returns:
Integer -- Returns 1 if the to be evaluated text was to short (under 20 words), and 0 otherwise
"""
print("Getting Google test ...")
test = googleGetTest()
testCategory = test['test_category'] # l0
searchCategory = test['search_category'] # l1+
articleText = test['article']['site_article']
if wordCount(articleText) < 20:
print("Article text to short. Skipping...")
googleGroundTruthCopy.delete_one({"_id": test["_id"]})
return 1
print("Testing ...")
testResult = ServiceCalls.googleMakeCall(articleText)
l0Detected = 0
l1pDetected = 0
for detectedCategory in testResult['categories']:
if testCategory in detectedCategory['category']:
l0Detected = 1
if searchCategory in detectedCategory['category']:
l1pDetected = 1
print("Storing ...")
evaluationResultsGoogle.insert_one({
"test_id": test['article_hash'],
"test_date": currentDateString(),
"result": {
"l0_detected": l0Detected,
"l1p_detected": l1pDetected
},
"provider_response": testResult,
"article": {
"article_hash": test['article_hash'],
"retrieval_date": test['test_date'],
"test_category": testCategory,
"search_category": searchCategory,
"unknown_words": unknown_words.measureUnknownWords(articleText),
"pos_nouns": {"count": nouns(articleText)['count'],
"values": nouns(articleText)['words'],
"percentage": round(nouns(articleText)['count']/wordCount(articleText), 2)},
"word_count": wordCount(articleText)
},
"runtime_Env": {"python_version": "Python 3.7.5 64-bit",
"machine_info": "MacBookPro16,1 | 2,3 GHz 8-Core Intel Core i9 | 64 GB 2667 MHz DDR4",
"available_ram": str(round(psutil.virtual_memory().available/float(1 << 20)))+" MB / 65536 MB",
"internet_router": "Vodafone Docsis 3.1 | 01.01.117.01.EURO",
"internet_speed": "Down: 100 Mbit/s | Up: 50 Mbit/s",
"internet_connection_type": "Wi-Fi",
"geo_location": "Berlin, Germany",
"parallel_requests": "false"},
"failed": int(len(testResult['categories']) == 0),
"nlp_library_versions": {"ibm": "ibm-cloud-sdk-core-1.5.1 ibm-watson-4.3.0",
"google": "google-api-core-1.15.0 google-cloud-language-1.3.0",
"microsoft": "azure-core-1.2.2 azure-ai-textanalytics-1.0.0b2",
"amazon": "awscli-1.18.5 boto3-1.12.5"}
})
print("Deleting test from copy ...")
googleGroundTruthCopy.delete_one({"_id": test["_id"]})
print("Done.")
return 0
def ibmTestOne():
"""
Performs all the necessary calls the retrieve, evaluate, and store a content classification test news article for IBM's service.
Returns:
Integer -- Returns 1 if the to be evaluated text was to short (under 20 words), and 0 otherwise
"""
print("Getting IBM test ...")
test = ibmGetTest()
testCategory = test['test_category'] # l0
searchCategory = test['search_category'] # l1+
articleText = test['article']['site_article']
if wordCount(articleText) < 20:
print("Article text to short. Skipping...")
ibmGroundTruthCopy.delete_one({"_id": test["_id"]})
return 1
print("Testing ...")
testResult = ServiceCalls.ibmMakeCall(articleText)
l0Detected = 0
l1pDetected = 0
for detectedCategory in testResult['categories']:
if testCategory in detectedCategory['category']:
l0Detected = 1
if searchCategory in detectedCategory['category']:
l1pDetected = 1
print("Storing ...")
evaluationResultsIBM.insert_one({
"test_id": test['article_hash'],
"test_date": currentDateString(),
"result": {
"l0_detected": l0Detected,
"l1p_detected": l1pDetected
},
"provider_response": testResult,
"article": {
"article_hash": test['article_hash'],
"retrieval_date": test['test_date'],
"test_category": testCategory,
"search_category": searchCategory,
"unknown_words": unknown_words.measureUnknownWords(articleText),
"pos_nouns": {"count": nouns(articleText)['count'],
"values": nouns(articleText)['words'],
"percentage": round(nouns(articleText)['count']/wordCount(articleText), 2)},
"word_count": wordCount(articleText)
},
"runtime_Env": {"python_version": "Python 3.7.5 64-bit",
"machine_info": "MacBookPro16,1 | 2,3 GHz 8-Core Intel Core i9 | 64 GB 2667 MHz DDR4",
"available_ram": str(round(psutil.virtual_memory().available/float(1 << 20)))+" MB / 65536 MB",
"internet_router": "Vodafone Docsis 3.1 | 01.01.117.01.EURO",
"internet_speed": "Down: 100 Mbit/s | Up: 50 Mbit/s",
"internet_connection_type": "Wi-Fi",
"geo_location": "Berlin, Germany",
"parallel_requests": "false"},
"failed": int(len(testResult['categories']) == 0),
"nlp_library_versions": {"ibm": "ibm-cloud-sdk-core-1.5.1 ibm-watson-4.3.0",
"google": "google-api-core-1.15.0 google-cloud-language-1.3.0",
"microsoft": "azure-core-1.2.2 azure-ai-textanalytics-1.0.0b2",
"amazon": "awscli-1.18.5 boto3-1.12.5"}
})
print("Deleting test from copy ...")
ibmGroundTruthCopy.delete_one({"_id": test["_id"]})
print("Done.")
return 0
# Usage Example:
#while 1:
# googleTestOne()
# ibmTestOne()
| 36.432203
| 135
| 0.59258
| 938
| 8,598
| 5.332623
| 0.254797
| 0.009596
| 0.008796
| 0.011995
| 0.742503
| 0.72611
| 0.710516
| 0.70052
| 0.70052
| 0.687325
| 0
| 0.032389
| 0.28181
| 8,598
| 235
| 136
| 36.587234
| 0.777652
| 0.177134
| 0
| 0.679487
| 0
| 0.025641
| 0.288084
| 0.036956
| 0
| 0
| 0
| 0
| 0
| 1
| 0.044872
| false
| 0
| 0.044872
| 0
| 0.147436
| 0.076923
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
7e0fdfc76aa51c6607246dbbea8249affd490c0e
| 17
|
py
|
Python
|
test.py
|
IlyaDjurin/diplom-project
|
93f5a11480531907452f1159958d01300f02a5aa
|
[
"MIT"
] | null | null | null |
test.py
|
IlyaDjurin/diplom-project
|
93f5a11480531907452f1159958d01300f02a5aa
|
[
"MIT"
] | null | null | null |
test.py
|
IlyaDjurin/diplom-project
|
93f5a11480531907452f1159958d01300f02a5aa
|
[
"MIT"
] | null | null | null |
print("Hello Py")
| 17
| 17
| 0.705882
| 3
| 17
| 4
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.058824
| 17
| 1
| 17
| 17
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0.444444
| 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
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
7e10bf7162775a44457afebb006dbe4397712c09
| 67
|
py
|
Python
|
printprog.py
|
Ewerton12F/Python-Notebook
|
85c4d38c35c6063fb475c25ebf4645688ec9dbcb
|
[
"MIT"
] | null | null | null |
printprog.py
|
Ewerton12F/Python-Notebook
|
85c4d38c35c6063fb475c25ebf4645688ec9dbcb
|
[
"MIT"
] | null | null | null |
printprog.py
|
Ewerton12F/Python-Notebook
|
85c4d38c35c6063fb475c25ebf4645688ec9dbcb
|
[
"MIT"
] | null | null | null |
from printfunc import printText
var = 'Olá, mundo!'
printText(var)
| 16.75
| 31
| 0.761194
| 9
| 67
| 5.666667
| 0.777778
| 0.470588
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.134328
| 67
| 4
| 32
| 16.75
| 0.87931
| 0
| 0
| 0
| 0
| 0
| 0.161765
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0.666667
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
|
0
| 5
|
fda3a88bd98fb7b3884fb580480f04aa2a7b9503
| 129
|
py
|
Python
|
bin/apache-hive-3.1.2-bin/hcatalog/sbin/hcat_server.py
|
ptrick/hdfs-hive-sql-playground
|
83f2aaa79f022a3c320939eace1fd2d06583187f
|
[
"Apache-2.0"
] | null | null | null |
bin/apache-hive-3.1.2-bin/hcatalog/sbin/hcat_server.py
|
ptrick/hdfs-hive-sql-playground
|
83f2aaa79f022a3c320939eace1fd2d06583187f
|
[
"Apache-2.0"
] | null | null | null |
bin/apache-hive-3.1.2-bin/hcatalog/sbin/hcat_server.py
|
ptrick/hdfs-hive-sql-playground
|
83f2aaa79f022a3c320939eace1fd2d06583187f
|
[
"Apache-2.0"
] | null | null | null |
version https://git-lfs.github.com/spec/v1
oid sha256:87f90891e74b53cf223aa46d65d639322028bf331a0ebf06d9f43b0ee4f4e630
size 5450
| 32.25
| 75
| 0.883721
| 13
| 129
| 8.769231
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.406504
| 0.046512
| 129
| 3
| 76
| 43
| 0.520325
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
fdbe558a40279682e23c9150e590aebe16631036
| 279
|
py
|
Python
|
code/pyworkshop/02_list/02_list_slice.py
|
archeranimesh/pythonFundamentals
|
35662181d95406505002fe6a39f577822bfd560b
|
[
"MIT"
] | null | null | null |
code/pyworkshop/02_list/02_list_slice.py
|
archeranimesh/pythonFundamentals
|
35662181d95406505002fe6a39f577822bfd560b
|
[
"MIT"
] | null | null | null |
code/pyworkshop/02_list/02_list_slice.py
|
archeranimesh/pythonFundamentals
|
35662181d95406505002fe6a39f577822bfd560b
|
[
"MIT"
] | null | null | null |
# We can get a part of list by using slice.
my_list = ["h", "e", "l", "l", "o", "!"]
print(my_list[0:3]) # Returns 0 - 2nd index
print(my_list[:]) # clone full list
print(my_list[-1]) # Special way to get last element
del my_list[2] # delete item from list.
print(my_list)
| 27.9
| 53
| 0.637993
| 53
| 279
| 3.245283
| 0.641509
| 0.209302
| 0.255814
| 0.174419
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.026549
| 0.189964
| 279
| 9
| 54
| 31
| 0.734513
| 0.480287
| 0
| 0
| 0
| 0
| 0.043165
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.666667
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.