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
94731556c920289a514e9795ae24ba7e2367bdd5
200
py
Python
nn/activation.py
prabhatnagarajan/rl_lib
43fecc6ceb3b9299f6a55804e736a0a2b3247e9a
[ "MIT" ]
1
2017-09-29T02:14:43.000Z
2017-09-29T02:14:43.000Z
nn/activation.py
prabhatnagarajan/rl_lib
43fecc6ceb3b9299f6a55804e736a0a2b3247e9a
[ "MIT" ]
null
null
null
nn/activation.py
prabhatnagarajan/rl_lib
43fecc6ceb3b9299f6a55804e736a0a2b3247e9a
[ "MIT" ]
null
null
null
from enum import Enum import numpy as np # def sigmoid(value): # return np.exp(value)/(np.exp(value) + 1) class Activation(): def sigmoid(self, value): return np.exp(value)/(np.exp(value) + 1)
18.181818
43
0.68
33
200
4.121212
0.454545
0.147059
0.294118
0.235294
0.470588
0.470588
0.470588
0.470588
0.470588
0
0
0.011905
0.16
200
10
44
20
0.797619
0.305
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.4
0.2
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
5
84745ade7987c6321df2d5b27def25b655f517df
45
py
Python
tests/functional/test_functional/path-dependency/src/path_dependency/__init__.py
drhagen/nox-poetry
1afc0a007cea88614ff1e0b8be1415e0f8e84253
[ "MIT" ]
77
2020-09-30T14:17:18.000Z
2022-03-28T14:39:00.000Z
tests/functional/test_functional/path-dependency/src/path_dependency/__init__.py
drhagen/nox-poetry
1afc0a007cea88614ff1e0b8be1415e0f8e84253
[ "MIT" ]
260
2020-05-27T05:23:54.000Z
2022-03-30T23:28:55.000Z
tests/functional/test_functional/path-dependency/src/path_dependency/__init__.py
drhagen/nox-poetry
1afc0a007cea88614ff1e0b8be1415e0f8e84253
[ "MIT" ]
9
2020-06-01T10:43:09.000Z
2022-03-26T19:00:40.000Z
"""Example package for path dependencies."""
22.5
44
0.733333
5
45
6.6
1
0
0
0
0
0
0
0
0
0
0
0
0.111111
45
1
45
45
0.825
0.844444
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
847778e020feb1ce9c03286802e2123b789bde83
125
py
Python
lib/JumpScale/baselib/codetools/__init__.py
rudecs/jumpscale_core7
30c03f26f1cdad3edbb9d79d50fbada8acc974f5
[ "Apache-2.0" ]
null
null
null
lib/JumpScale/baselib/codetools/__init__.py
rudecs/jumpscale_core7
30c03f26f1cdad3edbb9d79d50fbada8acc974f5
[ "Apache-2.0" ]
4
2016-08-25T12:08:39.000Z
2018-04-12T12:36:01.000Z
lib/JumpScale/baselib/codetools/__init__.py
rudecs/jumpscale_core7
30c03f26f1cdad3edbb9d79d50fbada8acc974f5
[ "Apache-2.0" ]
3
2016-03-08T07:49:34.000Z
2018-10-19T13:56:43.000Z
from JumpScale import j def cb(): from .CodeTools import CodeTools return CodeTools() j._register('codetools', cb)
15.625
36
0.712
16
125
5.5
0.5625
0
0
0
0
0
0
0
0
0
0
0
0.192
125
7
37
17.857143
0.871287
0
0
0
0
0
0.072
0
0
0
0
0
0
1
0.2
true
0
0.4
0
0.8
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
84c5e51b0c7fb89be26b588cb386ddc89dcb31d3
134
py
Python
docs/source/handbook/pyplots/softplus.py
tuttelikz/farabi
5b65cdf39ceecbd69ae759d030b132ee74661b48
[ "Apache-2.0" ]
53
2021-04-06T17:57:12.000Z
2022-03-07T17:45:45.000Z
docs/source/handbook/pyplots/softplus.py
tuttelikz/farabi
5b65cdf39ceecbd69ae759d030b132ee74661b48
[ "Apache-2.0" ]
1
2022-03-07T19:48:44.000Z
2022-03-07T19:49:47.000Z
docs/source/handbook/pyplots/softplus.py
tuttelikz/farabi
5b65cdf39ceecbd69ae759d030b132ee74661b48
[ "Apache-2.0" ]
2
2021-12-06T14:42:44.000Z
2021-12-07T11:33:14.000Z
from activfuncs import plot, x import numpy as np def softplus(x): return np.log(1+np.exp(x)) plot(softplus, yaxis=(-0.4, 1.4))
16.75
33
0.679104
26
134
3.5
0.653846
0
0
0
0
0
0
0
0
0
0
0.044643
0.164179
134
7
34
19.142857
0.767857
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.4
0.2
0.8
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
5
84dc7e87a792e8a69567110ac542679ef6f2c352
22
py
Python
tccli/services/mvj/v20190926/__init__.py
zyh911/tencentcloud-cli
dfc5dbd660d4c60d265921c4edc630091478fc41
[ "Apache-2.0" ]
null
null
null
tccli/services/mvj/v20190926/__init__.py
zyh911/tencentcloud-cli
dfc5dbd660d4c60d265921c4edc630091478fc41
[ "Apache-2.0" ]
null
null
null
tccli/services/mvj/v20190926/__init__.py
zyh911/tencentcloud-cli
dfc5dbd660d4c60d265921c4edc630091478fc41
[ "Apache-2.0" ]
null
null
null
version = "2019-09-26"
22
22
0.681818
4
22
3.75
1
0
0
0
0
0
0
0
0
0
0
0.4
0.090909
22
1
22
22
0.35
0
0
0
0
0
0.434783
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
ca057d09f097148e2de84a08b4897399a17a0ffe
78
py
Python
helloworld.py
elijakotsi/second
2b29e24467d2583cd72339cccf1bf87110f19b72
[ "MIT" ]
null
null
null
helloworld.py
elijakotsi/second
2b29e24467d2583cd72339cccf1bf87110f19b72
[ "MIT" ]
null
null
null
helloworld.py
elijakotsi/second
2b29e24467d2583cd72339cccf1bf87110f19b72
[ "MIT" ]
null
null
null
print ('hello world') print ('hello second time') print ('Again and Again')
13
27
0.679487
11
78
4.818182
0.636364
0.377358
0
0
0
0
0
0
0
0
0
0
0.166667
78
5
28
15.6
0.815385
0
0
0
0
0
0.551282
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
ca0d6e6b4ab4d457a6e714e213bc3a5df6d118b7
449
py
Python
Fancy_aggregations/dissimilarities.py
Fuminides/Fancy_aggregations
9d7dbfa9b615ab6f582d8a36681ab24ccc94f759
[ "MIT" ]
10
2019-11-13T15:38:06.000Z
2022-01-29T09:27:38.000Z
Fancy_aggregations/dissimilarities.py
Fuminides/Fancy_aggregations
9d7dbfa9b615ab6f582d8a36681ab24ccc94f759
[ "MIT" ]
null
null
null
Fancy_aggregations/dissimilarities.py
Fuminides/Fancy_aggregations
9d7dbfa9b615ab6f582d8a36681ab24ccc94f759
[ "MIT" ]
4
2020-05-18T11:24:12.000Z
2022-03-07T08:34:13.000Z
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 22 15:58:57 2021 @author: javier """ import numpy as np def abs_v(x, y): return np.abs(x - y) def quadratic(x, y): return (x-y) * (x-y) def square(x, y): return np.sqrt(abs_v(x, y)) def squarewise(x, y): return np.abs(np.sqrt(x) - np.sqrt(y)) def abs_square(x, y): return np.abs(x*x - y*y) def root_square(x, y): return (np.sqrt(x) - np.sqrt(y))**2
17.269231
42
0.587973
90
449
2.888889
0.377778
0.084615
0.184615
0.192308
0.419231
0.346154
0
0
0
0
0
0.042135
0.207127
449
26
43
17.269231
0.688202
0.213808
0
0
0
0
0
0
0
0
0
0
0
1
0.461538
false
0
0.076923
0.461538
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
ca336065770f9c254e2e396b01677feda749f1b6
123
py
Python
pset_classes/class_basics/p1.py
mottaquikarim/pydev-psets
9749e0d216ee0a5c586d0d3013ef481cc21dee27
[ "MIT" ]
5
2019-04-08T20:05:37.000Z
2019-12-04T20:48:45.000Z
pset_classes/class_basics/p1.py
mottaquikarim/pydev-psets
9749e0d216ee0a5c586d0d3013ef481cc21dee27
[ "MIT" ]
8
2019-04-15T15:16:05.000Z
2022-02-12T10:33:32.000Z
pset_classes/class_basics/p1.py
mottaquikarim/pydev-psets
9749e0d216ee0a5c586d0d3013ef481cc21dee27
[ "MIT" ]
2
2019-04-10T00:14:42.000Z
2020-02-26T20:35:21.000Z
""" Person class """ # Create a Person class with the following properties # 1. name # 2. age # 3. social security number
13.666667
53
0.691057
18
123
4.722222
0.888889
0.258824
0
0
0
0
0
0
0
0
0
0.030612
0.203252
123
8
54
15.375
0.836735
0.861789
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
ca5ad904805e88571cfce613f0ee3f00d303b335
100
py
Python
microsockets/__init__.py
ParkerD559/microsockets-py
587d39e598d42cc6ee829a7c98ddb715013ee1f8
[ "MIT" ]
3
2019-02-05T16:55:52.000Z
2019-09-11T23:21:58.000Z
microsockets/__init__.py
ParkerD559/microsockets-py
587d39e598d42cc6ee829a7c98ddb715013ee1f8
[ "MIT" ]
2
2019-09-03T02:37:08.000Z
2019-09-03T02:37:30.000Z
microsockets/__init__.py
ParkerD559/microsockets-py
587d39e598d42cc6ee829a7c98ddb715013ee1f8
[ "MIT" ]
null
null
null
from .application import Application from .events import EventRouter from .rooms import RoomManager
25
36
0.85
12
100
7.083333
0.583333
0
0
0
0
0
0
0
0
0
0
0
0.12
100
3
37
33.333333
0.965909
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
04711d3844781615dc883581221c12cc3450cf19
187
py
Python
courseapp/admin.py
kumarisneha/coursebeta
fed0c42bdff60ebc5c5ee5a423e7ff930016c32b
[ "MIT" ]
null
null
null
courseapp/admin.py
kumarisneha/coursebeta
fed0c42bdff60ebc5c5ee5a423e7ff930016c32b
[ "MIT" ]
null
null
null
courseapp/admin.py
kumarisneha/coursebeta
fed0c42bdff60ebc5c5ee5a423e7ff930016c32b
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import CourseCreate, SyllabusAddition # Register your models here. admin.site.register(CourseCreate) admin.site.register(SyllabusAddition)
23.375
50
0.834225
22
187
7.090909
0.545455
0.115385
0.217949
0
0
0
0
0
0
0
0
0
0.096257
187
7
51
26.714286
0.923077
0.139037
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
048db3fa8666debcf09d1ac4fe6d3fc7088ca2e4
112
py
Python
src/remote_docker_aws/exceptions.py
lime-green/remote-docker-aws
bcbd8b72fa963187460c9658a0b83c6709f6cc18
[ "MIT" ]
16
2020-07-07T17:55:52.000Z
2021-12-02T20:49:27.000Z
src/remote_docker_aws/exceptions.py
lime-green/remote-docker
495c648868c112028b6ccdeed121b00b8b7c4a77
[ "MIT" ]
3
2020-12-19T17:33:55.000Z
2021-07-22T19:27:41.000Z
src/remote_docker_aws/exceptions.py
lime-green/remote-docker
495c648868c112028b6ccdeed121b00b8b7c4a77
[ "MIT" ]
3
2020-08-31T15:26:11.000Z
2021-08-05T02:08:12.000Z
class RemoteDockerException(RuntimeError): pass class InstanceNotRunning(RemoteDockerException): pass
16
48
0.803571
8
112
11.25
0.625
0
0
0
0
0
0
0
0
0
0
0
0.142857
112
6
49
18.666667
0.9375
0
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
0492c22df1907220b165a2a6356a3504f5581a22
143
py
Python
asyncio_mqtt/__init__.py
MBradbury/asyncio-mqtt
90647428097897c847fbeb6c4c57d30d952edde6
[ "BSD-3-Clause" ]
null
null
null
asyncio_mqtt/__init__.py
MBradbury/asyncio-mqtt
90647428097897c847fbeb6c4c57d30d952edde6
[ "BSD-3-Clause" ]
null
null
null
asyncio_mqtt/__init__.py
MBradbury/asyncio-mqtt
90647428097897c847fbeb6c4c57d30d952edde6
[ "BSD-3-Clause" ]
null
null
null
# SPDX-License-Identifier: BSD-3-Clause from .error import MqttError, MqttCodeError from .client import Client from .version import __version__
35.75
43
0.825175
19
143
6
0.684211
0
0
0
0
0
0
0
0
0
0
0.007813
0.104895
143
4
44
35.75
0.882813
0.258741
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
04a2a4c9a9c78b3647c4a021c532c83ece73f9f6
252
py
Python
tests/test_day12.py
khwilson/advent2020
066591265af5afe905fc583b9a67894d197297ae
[ "MIT" ]
null
null
null
tests/test_day12.py
khwilson/advent2020
066591265af5afe905fc583b9a67894d197297ae
[ "MIT" ]
null
null
null
tests/test_day12.py
khwilson/advent2020
066591265af5afe905fc583b9a67894d197297ae
[ "MIT" ]
null
null
null
from pathlib import Path from advent import day12 def test_first(fixture_path: Path): assert day12.first(fixture_path / "example12.txt") == 25 def test_second(fixture_path: Path): assert day12.second(fixture_path / "example12.txt") == 286
21
62
0.742063
36
252
5.027778
0.444444
0.243094
0.176796
0.232044
0.287293
0
0
0
0
0
0
0.070423
0.154762
252
11
63
22.909091
0.779343
0
0
0
0
0
0.103175
0
0
0
0
0
0.333333
1
0.333333
false
0
0.333333
0
0.666667
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
5
04a9a236d2a98fdce6687b13b31be83648c7b96f
317
py
Python
src/openpersonen/api/views/partner_historie.py
maykinmedia/open-personen
ddcf083ccd4eb864c5305bcd8bc75c6c64108272
[ "RSA-MD" ]
2
2020-08-26T11:24:43.000Z
2021-07-28T09:46:40.000Z
src/openpersonen/api/views/partner_historie.py
maykinmedia/open-personen
ddcf083ccd4eb864c5305bcd8bc75c6c64108272
[ "RSA-MD" ]
153
2020-08-26T10:45:35.000Z
2021-12-10T17:33:16.000Z
src/openpersonen/api/views/partner_historie.py
maykinmedia/open-personen
ddcf083ccd4eb864c5305bcd8bc75c6c64108272
[ "RSA-MD" ]
null
null
null
from openpersonen.api.data_classes import PartnerHistorie from openpersonen.api.serializers import PartnerHistorieSerializer from openpersonen.api.views.base import HistorieViewSet class PartnerHistorieViewSet(HistorieViewSet): serializer_class = PartnerHistorieSerializer instance_class = PartnerHistorie
31.7
66
0.864353
29
317
9.344828
0.551724
0.177122
0.210332
0
0
0
0
0
0
0
0
0
0.097792
317
9
67
35.222222
0.947552
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
1
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
b6c26fb1398689426594680c8358fda581a3a5a7
78
py
Python
sabersql.py
dhuber34/sabersql
27a4824d56dda9b7a8cd9b418fc06b3cc5dee935
[ "MIT" ]
1
2022-01-19T23:21:43.000Z
2022-01-19T23:21:43.000Z
sabersql.py
dhuber34/sabersql
27a4824d56dda9b7a8cd9b418fc06b3cc5dee935
[ "MIT" ]
2
2020-12-08T00:37:23.000Z
2022-01-19T21:34:54.000Z
sabersql.py
dhuber34/sabersql
27a4824d56dda9b7a8cd9b418fc06b3cc5dee935
[ "MIT" ]
1
2021-09-05T14:56:02.000Z
2021-09-05T14:56:02.000Z
#!/usr/bin/env python3 import sys from sabersql.__main__ import main main()
11.142857
34
0.75641
12
78
4.583333
0.75
0
0
0
0
0
0
0
0
0
0
0.014925
0.141026
78
6
35
13
0.80597
0.269231
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
b6dca7b9c17edef79f9f306f11702fc7661fd018
25
py
Python
spark-ingestion/test.py
philnandreoli/metadataingestion
20870ab4703817acb59f8abd3c20b1638efe6b77
[ "MIT" ]
null
null
null
spark-ingestion/test.py
philnandreoli/metadataingestion
20870ab4703817acb59f8abd3c20b1638efe6b77
[ "MIT" ]
1
2020-09-02T22:18:50.000Z
2020-09-02T22:18:50.000Z
spark-ingestion/test.py
philnandreoli/metadataingestion
20870ab4703817acb59f8abd3c20b1638efe6b77
[ "MIT" ]
null
null
null
from delta.table import *
25
25
0.8
4
25
5
1
0
0
0
0
0
0
0
0
0
0
0
0.12
25
1
25
25
0.909091
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
b6e387d35a87b4f50c2a22334cb4a189a6017bd1
5,509
py
Python
tests/st/ops/cpu/test_argminwithvalue_op.py
GuoSuiming/mindspore
48afc4cfa53d970c0b20eedfb46e039db2a133d5
[ "Apache-2.0" ]
3,200
2020-02-17T12:45:41.000Z
2022-03-31T20:21:16.000Z
tests/st/ops/cpu/test_argminwithvalue_op.py
zimo-geek/mindspore
665ec683d4af85c71b2a1f0d6829356f2bc0e1ff
[ "Apache-2.0" ]
176
2020-02-12T02:52:11.000Z
2022-03-28T22:15:55.000Z
tests/st/ops/cpu/test_argminwithvalue_op.py
zimo-geek/mindspore
665ec683d4af85c71b2a1f0d6829356f2bc0e1ff
[ "Apache-2.0" ]
621
2020-03-09T01:31:41.000Z
2022-03-30T03:43:19.000Z
# Copyright 2019 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ import numpy as np import pytest import mindspore.context as context import mindspore.nn as nn from mindspore import Tensor from mindspore.ops import operations as P context.set_context(mode=context.GRAPH_MODE, device_target="CPU") class NetArgminWithValue(nn.Cell): def __init__(self, axis=0, keep_dims=False): super(NetArgminWithValue, self).__init__() self.argmin = P.ArgMinWithValue(axis=axis, keep_dims=keep_dims) def construct(self, x): return self.argmin(x) @pytest.mark.level0 @pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_argminwithvalue_fp32(): x = np.array([[1., 20., 5.], [67., 8., 9.], [130., 24., 15.], [-0.5, 25, 100]]).astype(np.float32) argmin_a0 = NetArgminWithValue(axis=0, keep_dims=False) output0, output1 = argmin_a0(Tensor(x)) expect0 = np.array([3, 1, 0]).astype(np.int32) expect1 = np.array([-0.5, 8., 5.]).astype(np.float32) error = np.ones(shape=expect1.shape) * 1.0e-6 assert np.all(output0.asnumpy() == expect0) assert np.all(np.abs(output1.asnumpy() - expect1) < error) argmin_a0k = NetArgminWithValue(axis=0, keep_dims=True) output0, output1 = argmin_a0k(Tensor(x)) expect0 = np.array([[3, 1, 0]]).astype(np.int32) expect1 = np.array([[-0.5, 8., 5.]]).astype(np.float32) error = np.ones(shape=expect1.shape) * 1.0e-6 assert np.all(output0.asnumpy() == expect0) assert np.all(np.abs(output1.asnumpy() - expect1) < error) argmin_a1 = NetArgminWithValue(axis=1, keep_dims=False) output0, output1 = argmin_a1(Tensor(x)) expect0 = np.array([0, 1, 2, 0]).astype(np.int32) expect1 = np.array([1., 8., 15., -0.5]).astype(np.float32) error = np.ones(shape=expect1.shape) * 1.0e-6 assert np.all(output0.asnumpy() == expect0) assert np.all(np.abs(output1.asnumpy() - expect1) < error) argmin_a1k = NetArgminWithValue(axis=-1, keep_dims=True) output0, output1 = argmin_a1k(Tensor(x)) expect0 = np.array([[0], [1], [2], [0]]).astype(np.int32) expect1 = np.array([[1.], [8.], [15.], [-0.5]]).astype(np.float32) error = np.ones(shape=expect1.shape) * 1.0e-6 assert np.all(output0.asnumpy() == expect0) assert np.all(np.abs(output1.asnumpy() - expect1) < error) @pytest.mark.level0 @pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_argminwithvalue_fp16(): x = np.array([[1., 20., 5.], [67., 8., 9.], [130., 24., 15.], [-0.5, 25, 100]]).astype(np.float16) argmin_a0 = NetArgminWithValue(axis=0, keep_dims=False) output0, output1 = argmin_a0(Tensor(x)) expect0 = np.array([3, 1, 0]).astype(np.int32) expect1 = np.array([-0.5, 8., 5.]).astype(np.float16) error = np.ones(shape=expect1.shape) * 1.0e-6 assert np.all(output0.asnumpy() == expect0) assert np.all(np.abs(output1.asnumpy() - expect1) < error) argmin_a0k = NetArgminWithValue(axis=0, keep_dims=True) output0, output1 = argmin_a0k(Tensor(x)) expect0 = np.array([[3, 1, 0]]).astype(np.int32) expect1 = np.array([[-0.5, 8., 5.]]).astype(np.float16) error = np.ones(shape=expect1.shape) * 1.0e-6 assert np.all(output0.asnumpy() == expect0) assert np.all(np.abs(output1.asnumpy() - expect1) < error) argmin_a1 = NetArgminWithValue(axis=1, keep_dims=False) output0, output1 = argmin_a1(Tensor(x)) expect0 = np.array([0, 1, 2, 0]).astype(np.int32) expect1 = np.array([1., 8., 15., -0.5]).astype(np.float16) error = np.ones(shape=expect1.shape) * 1.0e-6 assert np.all(output0.asnumpy() == expect0) assert np.all(np.abs(output1.asnumpy() - expect1) < error) argmin_a1k = NetArgminWithValue(axis=-1, keep_dims=True) output0, output1 = argmin_a1k(Tensor(x)) expect0 = np.array([[0], [1], [2], [0]]).astype(np.int32) expect1 = np.array([[1.], [8.], [15.], [-0.5]]).astype(np.float16) error = np.ones(shape=expect1.shape) * 1.0e-6 assert np.all(output0.asnumpy() == expect0) assert np.all(np.abs(output1.asnumpy() - expect1) < error) @pytest.mark.level0 @pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_argminwithvalue_tensor(): prop = 100 if np.random.random() > 0.5 else -100 x = np.random.randn(3, 4, 5, 6).astype(np.float16) * prop argmin_a0 = NetArgminWithValue(axis=-2, keep_dims=False) output0, output1 = argmin_a0(Tensor(x)) expect0 = np.argmin(x, axis=-2) expect1 = np.min(x, axis=-2).astype(np.float16) error = np.ones(shape=expect1.shape) * 1.0e-6 assert np.all(output0.asnumpy() == expect0) assert np.all(np.abs(output1.asnumpy() - expect1) < error)
39.35
79
0.630968
788
5,509
4.340102
0.190355
0.046784
0.057895
0.042105
0.720468
0.715205
0.715205
0.715205
0.715205
0.715205
0
0.072912
0.195861
5,509
139
80
39.633094
0.699097
0.11581
0
0.683673
0
0
0.000636
0
0
0
0
0
0.183673
1
0.05102
false
0
0.061224
0.010204
0.132653
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
b6eecc44e1ba9e294320ab571d3acdc5599cdc2a
164
py
Python
tests/unit/test_app.py
shm-tar/Bachelors-Degree-Project
b924cdbe21e60f2260aa5f6e460fd44ccf5fd139
[ "Apache-2.0" ]
null
null
null
tests/unit/test_app.py
shm-tar/Bachelors-Degree-Project
b924cdbe21e60f2260aa5f6e460fd44ccf5fd139
[ "Apache-2.0" ]
null
null
null
tests/unit/test_app.py
shm-tar/Bachelors-Degree-Project
b924cdbe21e60f2260aa5f6e460fd44ccf5fd139
[ "Apache-2.0" ]
null
null
null
def test_testing_config(app): assert app.config['UPLOAD_PATH'] == 'static/uploads' assert app.config['SQLALCHEMY_DATABASE_URI'] == 'sqlite:///test_site.db'
41
76
0.72561
22
164
5.136364
0.727273
0.159292
0.265487
0
0
0
0
0
0
0
0
0
0.109756
164
3
77
54.666667
0.773973
0
0
0
0
0
0.426829
0.27439
0
0
0
0
0.666667
1
0.333333
false
0
0
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
1
0
1
0
0
0
0
0
0
0
5
8e40338e860f5ed0f03325d588347259fbaa9b11
152
py
Python
tests/web_platform/css_flexbox_1/test_flexbox_flex_0_1_N.py
fletchgraham/colosseum
77be4896ee52b8f5956a3d77b5f2ccd2c8608e8f
[ "BSD-3-Clause" ]
null
null
null
tests/web_platform/css_flexbox_1/test_flexbox_flex_0_1_N.py
fletchgraham/colosseum
77be4896ee52b8f5956a3d77b5f2ccd2c8608e8f
[ "BSD-3-Clause" ]
null
null
null
tests/web_platform/css_flexbox_1/test_flexbox_flex_0_1_N.py
fletchgraham/colosseum
77be4896ee52b8f5956a3d77b5f2ccd2c8608e8f
[ "BSD-3-Clause" ]
1
2020-01-16T01:56:41.000Z
2020-01-16T01:56:41.000Z
from tests.utils import W3CTestCase class TestFlexbox_Flex01N(W3CTestCase): vars().update(W3CTestCase.find_tests(__file__, 'flexbox_flex-0-1-N'))
25.333333
73
0.789474
20
152
5.65
0.85
0
0
0
0
0
0
0
0
0
0
0.050725
0.092105
152
5
74
30.4
0.768116
0
0
0
0
0
0.119205
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
6d010c71c0ecd2d1ddfaa24395a567846602d387
2,299
py
Python
UnityEngine/HumanLimit/__init__.py
Grim-es/udon-pie-auto-completion
c2cd86554ed615cdbbb01e19fa40665eafdfaedc
[ "MIT" ]
null
null
null
UnityEngine/HumanLimit/__init__.py
Grim-es/udon-pie-auto-completion
c2cd86554ed615cdbbb01e19fa40665eafdfaedc
[ "MIT" ]
null
null
null
UnityEngine/HumanLimit/__init__.py
Grim-es/udon-pie-auto-completion
c2cd86554ed615cdbbb01e19fa40665eafdfaedc
[ "MIT" ]
null
null
null
from UdonPie import System from UdonPie import UnityEngine from UdonPie.Undefined import * class HumanLimit: def __new__(cls, arg1=None): ''' :returns: HumanLimit :rtype: UnityEngine.HumanLimit ''' pass @staticmethod def get_useDefaultValues(): ''' :returns: Boolean :rtype: System.Boolean ''' pass @staticmethod def set_useDefaultValues(arg1): ''' :param arg1: Boolean :type arg1: System.Boolean or bool ''' pass @staticmethod def get_min(): ''' :returns: Vector3 :rtype: UnityEngine.Vector3 ''' pass @staticmethod def set_min(arg1): ''' :param arg1: Vector3 :type arg1: UnityEngine.Vector3 ''' pass @staticmethod def get_max(): ''' :returns: Vector3 :rtype: UnityEngine.Vector3 ''' pass @staticmethod def set_max(arg1): ''' :param arg1: Vector3 :type arg1: UnityEngine.Vector3 ''' pass @staticmethod def get_center(): ''' :returns: Vector3 :rtype: UnityEngine.Vector3 ''' pass @staticmethod def set_center(arg1): ''' :param arg1: Vector3 :type arg1: UnityEngine.Vector3 ''' pass @staticmethod def get_axisLength(): ''' :returns: Single :rtype: System.Single ''' pass @staticmethod def set_axisLength(arg1): ''' :param arg1: Single :type arg1: System.Single or float ''' pass @staticmethod def Equals(arg1): ''' :param arg1: Object :type arg1: System.Object :returns: Boolean :rtype: System.Boolean ''' pass @staticmethod def ToString(): ''' :returns: String :rtype: System.String ''' pass @staticmethod def GetHashCode(): ''' :returns: Int32 :rtype: System.Int32 ''' pass @staticmethod def GetType(): ''' :returns: Type :rtype: System.Type ''' pass
18.102362
42
0.492823
188
2,299
5.952128
0.207447
0.200179
0.237712
0.182306
0.431635
0.431635
0.431635
0.431635
0.340483
0.182306
0
0.025604
0.405394
2,299
126
43
18.246032
0.792977
0.320574
0
0.604167
0
0
0
0
0
0
0
0
0
1
0.3125
false
0.3125
0.0625
0
0.395833
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
6d1bbef02168a336cfae0f31eeb3a6fca95d4be5
1,060
py
Python
stayhome/business/migrations/0036_auto_20200407_2349.py
mageo/stayhomech
5afe922b13f0350a79eaff0401709f99c5a31e8b
[ "MIT" ]
3
2020-03-20T11:01:57.000Z
2020-03-20T16:29:12.000Z
stayhome/business/migrations/0036_auto_20200407_2349.py
stayhomech/stayhomech
5afe922b13f0350a79eaff0401709f99c5a31e8b
[ "MIT" ]
74
2020-03-23T21:35:07.000Z
2020-04-27T12:55:50.000Z
stayhome/business/migrations/0036_auto_20200407_2349.py
mageo/stayhomech
5afe922b13f0350a79eaff0401709f99c5a31e8b
[ "MIT" ]
3
2020-03-20T11:02:35.000Z
2020-03-20T16:29:23.000Z
# Generated by Django 3.0.4 on 2020-04-07 21:49 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('business', '0035_auto_20200328_1636'), ] operations = [ migrations.AddIndex( model_name='businesshistoryevent', index=models.Index(fields=['parent', '-time', 'new_status'], name='business_bu_parent__879b5a_idx'), ), migrations.AddIndex( model_name='businesshistoryevent', index=models.Index(fields=['parent', 'event_type', '-time', 'new_status'], name='business_bu_parent__ab97e2_idx'), ), migrations.AddIndex( model_name='requesthistoryevent', index=models.Index(fields=['parent', '-time', 'new_status'], name='business_re_parent__de5625_idx'), ), migrations.AddIndex( model_name='requesthistoryevent', index=models.Index(fields=['parent', 'event_type', '-time', 'new_status'], name='business_re_parent__512358_idx'), ), ]
35.333333
126
0.630189
109
1,060
5.825688
0.422018
0.113386
0.144882
0.170079
0.719685
0.714961
0.714961
0.664567
0.664567
0.664567
0
0.058824
0.230189
1,060
29
127
36.551724
0.719363
0.042453
0
0.521739
1
0
0.328727
0.141165
0
0
0
0
0
1
0
false
0
0.043478
0
0.173913
0
0
0
0
null
0
0
1
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
6d5443689bd319ee0ac11297ab3a6a37f839f380
587
py
Python
test/reflect/StubClass.py
pip-services-python/pip-services-commons-python
ecfe0aab2b1442ed3b550115dd2c2472537452de
[ "MIT" ]
null
null
null
test/reflect/StubClass.py
pip-services-python/pip-services-commons-python
ecfe0aab2b1442ed3b550115dd2c2472537452de
[ "MIT" ]
null
null
null
test/reflect/StubClass.py
pip-services-python/pip-services-commons-python
ecfe0aab2b1442ed3b550115dd2c2472537452de
[ "MIT" ]
2
2020-03-11T21:41:13.000Z
2020-03-14T00:26:20.000Z
import datetime class StubClass: _private_field = 123 public_field = "ABC" _public_prop = datetime.datetime.now() def __init__(self): pass def _get_private_prop(self): return 543 def _set_private_prop(self, value): pass def get_public_prop(self): return self._public_prop def set_public_prop(self, value): self._public_prop = value public_prop = property(get_public_prop, set_public_prop) def _private_method(self): pass def public_method(self, arg1, arg2): return arg1 + arg2
18.935484
60
0.655877
75
587
4.72
0.32
0.225989
0.062147
0
0
0
0
0
0
0
0
0.023364
0.270869
587
30
61
19.566667
0.803738
0
0
0.15
0
0
0.005111
0
0
0
0
0
0
1
0.35
false
0.15
0.05
0.15
0.8
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
5
edb0920c0024a744c3eb2a5c876cc1c52e470c96
48
py
Python
02_syntax/main.py
jmmedel/Python-tutorial-Youtube
d3319a8744cc636ad6a4fb3d90889278806a6cff
[ "MIT" ]
null
null
null
02_syntax/main.py
jmmedel/Python-tutorial-Youtube
d3319a8744cc636ad6a4fb3d90889278806a6cff
[ "MIT" ]
null
null
null
02_syntax/main.py
jmmedel/Python-tutorial-Youtube
d3319a8744cc636ad6a4fb3d90889278806a6cff
[ "MIT" ]
2
2020-07-16T05:10:35.000Z
2020-09-08T01:43:10.000Z
if 5 > 2: print("Hello World kagaya john")
12
36
0.604167
8
48
3.625
1
0
0
0
0
0
0
0
0
0
0
0.057143
0.270833
48
4
36
12
0.771429
0
0
0
0
0
0.489362
0
0
0
0
0
0
1
0
true
0
0
0
0
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
0
1
0
0
0
0
1
0
5
edd4566a085dece97c4e5bc22da7f377b43d5c5e
81
py
Python
rmexp/client/__init__.py
junjuew/scalable-edge-native-applications
1ace9ce71bef267880049633160e7cb74c57bddb
[ "Apache-2.0" ]
1
2021-05-12T12:49:15.000Z
2021-05-12T12:49:15.000Z
rmexp/client/__init__.py
junjuew/scalable-edge-native-applications
1ace9ce71bef267880049633160e7cb74c57bddb
[ "Apache-2.0" ]
null
null
null
rmexp/client/__init__.py
junjuew/scalable-edge-native-applications
1ace9ce71bef267880049633160e7cb74c57bddb
[ "Apache-2.0" ]
1
2021-11-21T08:12:19.000Z
2021-11-21T08:12:19.000Z
from rmexp.client.video import VideoClient, RTVideoClient, RTImageSequenceClient
40.5
80
0.876543
8
81
8.875
1
0
0
0
0
0
0
0
0
0
0
0
0.074074
81
1
81
81
0.946667
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
edef03ce6c08a09dd5595a733a6838c5a664cd81
178
py
Python
project/core/profiles/admin.py
robwise1/birdr
fa6cf9036baebb735bff9a59abc4c04867e40d61
[ "MIT" ]
null
null
null
project/core/profiles/admin.py
robwise1/birdr
fa6cf9036baebb735bff9a59abc4c04867e40d61
[ "MIT" ]
null
null
null
project/core/profiles/admin.py
robwise1/birdr
fa6cf9036baebb735bff9a59abc4c04867e40d61
[ "MIT" ]
null
null
null
from django.contrib import admin # Register your models here. from profiles.models import User class UserAdmin(admin.ModelAdmin): pass admin.site.register(User, UserAdmin)
19.777778
36
0.792135
24
178
5.875
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.134831
178
9
36
19.777778
0.915584
0.146067
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.2
0.4
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
1
0
0
0
0
5
edefdf7b031dd7b5ef7f4fe55e248f4ffe4cd823
40
py
Python
scripts/extraction/__init__.py
johnsbuck/nanogiants-hackathon-2021
de061db3827915b4c3389d6d666f956f059d7cb0
[ "MIT" ]
null
null
null
scripts/extraction/__init__.py
johnsbuck/nanogiants-hackathon-2021
de061db3827915b4c3389d6d666f956f059d7cb0
[ "MIT" ]
null
null
null
scripts/extraction/__init__.py
johnsbuck/nanogiants-hackathon-2021
de061db3827915b4c3389d6d666f956f059d7cb0
[ "MIT" ]
null
null
null
from .extractor import extract_features
20
39
0.875
5
40
6.8
1
0
0
0
0
0
0
0
0
0
0
0
0.1
40
1
40
40
0.944444
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
edf2a992a40bbcb3675650df8b6d393852631c63
337
py
Python
main/middlewares.py
lesnik512/smena-school
f51149d9086b3e4bd625f743fc59767b14374edd
[ "MIT" ]
null
null
null
main/middlewares.py
lesnik512/smena-school
f51149d9086b3e4bd625f743fc59767b14374edd
[ "MIT" ]
null
null
null
main/middlewares.py
lesnik512/smena-school
f51149d9086b3e4bd625f743fc59767b14374edd
[ "MIT" ]
null
null
null
from main.utils import create_basket class BasketMiddleware(object): def __init__(self, get_response): self.get_response = get_response def __call__(self, request): basket = create_basket(request) setattr(request, 'basket', basket) response = self.get_response(request) return response
25.923077
45
0.691395
38
337
5.763158
0.473684
0.200913
0.205479
0.210046
0
0
0
0
0
0
0
0
0.228487
337
12
46
28.083333
0.842308
0
0
0
0
0
0.017804
0
0
0
0
0
0
1
0.222222
false
0
0.111111
0
0.555556
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
6110ea68081db700eb7141b857d960253b7b8816
4,367
py
Python
python/flareapps/django/common/tests.py
flarebyte/wonderful-bazar
810514cd7d73505b11d738f8b84d91842d18d074
[ "MIT" ]
null
null
null
python/flareapps/django/common/tests.py
flarebyte/wonderful-bazar
810514cd7d73505b11d738f8b84d91842d18d074
[ "MIT" ]
null
null
null
python/flareapps/django/common/tests.py
flarebyte/wonderful-bazar
810514cd7d73505b11d738f8b84d91842d18d074
[ "MIT" ]
null
null
null
""" This file demonstrates two different styles of tests (one doctest and one unittest). These will both pass when you run "manage.py test". TODO: to transform this in unit test Replace these with more appropriate tests for your application. """ from django.test import TestCase import re class SimpleTest(TestCase): def test_basic_addition(self): """ Tests that 1 + 1 always equals 2. """ self.failUnlessEqual(1 + 1, 2) __test__ = {"doctest": """ Another way to test that 1 + 1 is equal to 2. >>> 1 + 1 == 2 True """} def printmatch(myregex,testtext): match = myregex.match(testtext) if match is None: print "---no match---",testtext else: print '<Match: %r, groups=%r>' % (match.group(), match.groups()) regex_ImageURLField = re.compile( r'(^https?://' # http:// or https:// r'(?:(?:[A-Z0-9-]+\.)+[A-Z]{2,6}|' #domain... r'localhost|' #localhost... r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # ...or ip r'(?::\d+)?' # optional port r'(?:[A-Z0-9-/._]+)' #image path r'(?:\.png|\.jpg|\.gif|\.svg)$)|' # or with placeholders r'(^\{media\}/\S+/\{locale\}/\{ext\}/\{size\}/' # {media}/application/{locale}/{ext}/{size}/ r'(?:[A-Z0-9-/._]+)' #image path r'(?:\-\{size\}\.\{ext\})$)' #-{size}.{ext} , re.IGNORECASE) #should not match printmatch(regex_ImageURLField,"/flairbyte.com/flarebyte/en/png/company/8/java.applications-594x594.png") printmatch(regex_ImageURLField,"http://10.12.25.26/flarebyte/en/png/company/8/java.applications-594x594-svg") printmatch(regex_ImageURLField,"http://flarebyte.com") printmatch(regex_ImageURLField,"http://localhost:8000/admin/") printmatch(regex_ImageURLField,"{media}/flarebyte/{locale}/{ext}/{size}/company/contact/java-applications.help") print "--should match>>>" #should match printmatch(regex_ImageURLField,"http://flairbyte.com/flarebyte/en/png/company/8/java.applications-594x594.png") printmatch(regex_ImageURLField,"https://flairbyte.com/flarebyte/en/png/company/8/java.applications-594x594.gif") printmatch(regex_ImageURLField,"http://flairbyte.com/flarebyte/en/png/company/8/java.applications-594x594.jpg") printmatch(regex_ImageURLField,"http://10.12.25.26/flarebyte/en/png/company/8/java.applications-594x594.gif") printmatch(regex_ImageURLField,"http://10.12.25.26/flarebyte/en/png/company/8/java.applications-594x594.svg") printmatch(regex_ImageURLField,"http://newsimg.bbc.co.uk/media/images/45437000/jpg/_45437564_tom1.jpg") printmatch(regex_ImageURLField,"{media}/flarebyte/{locale}/{ext}/{size}/company/contact/java-applicati.ons-{size}.{ext}") #----------------- regex_PageURLField = re.compile( r'(^https?://' # http:// or https:// r'(?:(?:[A-Z0-9-]+\.)+[A-Z]{2,6}|' #domain... r'localhost|' #localhost... r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # ...or ip r'(?::\d+)?' # optional port r'(?:[A-Z0-9-/._]+$))|' #image path r'(^\{xhtml\}/\S+/\{locale\}/\{size\}/\{options\}/' # {xhtml}/flarebyte/{locale}/{size}/{options}/ r'(?:[A-Z0-9-/._]+)$)' #image path , re.IGNORECASE) print "\n\n\n" #should not match printmatch(regex_PageURLField,"/flairbyte.com/flarebyte/en/png/company/8/java.applications-594x594.png") printmatch(regex_PageURLField,"http://10.12.25.26/flarebyte/en/png/company/8/java.applications-594x594-svg") printmatch(regex_PageURLField,"http://flarebyte.com") printmatch(regex_PageURLField,"http://localhost:8000/admin/") printmatch(regex_PageURLField,"{media}/flarebyte/{locale}/{ext}/{size}/company/contact/java-applications.help") print "--should match>>>" #should match printmatch(regex_PageURLField,"http://flairbyte.com/flarebyte/en/png/company/8/java.applications-594x594.png") printmatch(regex_PageURLField,"https://flairbyte.com/flarebyte/en/png/company/8/java.applications-594x594.gif") printmatch(regex_PageURLField,"http://flairbyte.com/flarebyte/en/png/company/8/java.applications-594x594") printmatch(regex_PageURLField,"http://10.12.25.26/flarebyte/en/png/company/8/java.applications-594x594.g") printmatch(regex_PageURLField,"http://10.12.25.26/flarebyte/en/png/company/8/java.applications-594x594.svg") printmatch(regex_PageURLField,"http://newsimg.bbc.co.uk/media/images/45437000/jpg/_45437564_tom1.jpg") printmatch(regex_PageURLField,"{xhtml}/flarebyte/{locale}/{size}/{options}/company/contact/java-applicati.ons")
45.020619
121
0.69384
601
4,367
4.975042
0.221298
0.120401
0.065552
0.098328
0.743478
0.671237
0.646823
0.641806
0.641806
0.641806
0
0.058291
0.088619
4,367
96
122
45.489583
0.692965
0.082894
0
0.246154
0
0.292308
0.589291
0.201685
0
0
0
0.010417
0
0
null
null
0
0.030769
null
null
0.461538
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
null
0
0
1
0
1
0
0
0
0
0
0
1
0
5
611a45f4bc40e1dd95b9bb217a4dc7d1f1128056
173
py
Python
test/wait-until/test.py
Rippletek/fnfig
156e87d23ab9a7521056c7d5059037fa2c15a274
[ "Apache-2.0" ]
1
2021-04-13T04:10:36.000Z
2021-04-13T04:10:36.000Z
test/foreach/test.py
Rippletek/fnfig
156e87d23ab9a7521056c7d5059037fa2c15a274
[ "Apache-2.0" ]
1
2021-04-09T03:43:38.000Z
2021-04-09T03:43:38.000Z
test/wait/test.py
Rippletek/fnfig
156e87d23ab9a7521056c7d5059037fa2c15a274
[ "Apache-2.0" ]
null
null
null
import fig_runner import main from fig_utils import FakeFDL if __name__ == "__main__": fig_runner._initializer_runner() FakeFDL(fig_runner._handler, {}, {}).run()
19.222222
46
0.734104
22
173
5.090909
0.545455
0.241071
0
0
0
0
0
0
0
0
0
0
0.150289
173
8
47
21.625
0.761905
0
0
0
0
0
0.046243
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
b6834a153c62da445d8df0e653190f65fe16163d
212
py
Python
Task1E.py
Yichen-Cai-yc539/Lab87-Flood-Warning-System
22f741c5a14e3350923385d23358167782ad4354
[ "MIT" ]
null
null
null
Task1E.py
Yichen-Cai-yc539/Lab87-Flood-Warning-System
22f741c5a14e3350923385d23358167782ad4354
[ "MIT" ]
null
null
null
Task1E.py
Yichen-Cai-yc539/Lab87-Flood-Warning-System
22f741c5a14e3350923385d23358167782ad4354
[ "MIT" ]
null
null
null
from floodsystem.stationdata import build_station_list from floodsystem.geo import rivers_by_station_number def run(): stations = build_station_list() print(rivers_by_station_number(stations, 10)) run()
26.5
54
0.811321
29
212
5.586207
0.551724
0.185185
0.197531
0.259259
0
0
0
0
0
0
0
0.010695
0.117925
212
8
55
26.5
0.855615
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.5
0.166667
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
b6a21260b2b06037d82300149df47572badf2e10
162
py
Python
django_toyo_auth/providers/toyo/urls.py
ayame-q/django-toyo-auth
8465d9ce79e9fab572e5a68492206ee981e7873e
[ "MIT" ]
null
null
null
django_toyo_auth/providers/toyo/urls.py
ayame-q/django-toyo-auth
8465d9ce79e9fab572e5a68492206ee981e7873e
[ "MIT" ]
null
null
null
django_toyo_auth/providers/toyo/urls.py
ayame-q/django-toyo-auth
8465d9ce79e9fab572e5a68492206ee981e7873e
[ "MIT" ]
null
null
null
from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns from .provider import ToyoProvider urlpatterns = default_urlpatterns(ToyoProvider)
23.142857
75
0.864198
17
162
8.117647
0.647059
0.26087
0
0
0
0
0
0
0
0
0
0.006757
0.08642
162
6
76
27
0.925676
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
b6a5d03bd0fbbcad49efe79181f32a9c574c95d6
108
py
Python
Test/Client.py
thekakodkar/Mapper
341943d847157c4bc5e0c32965008f11071ed608
[ "MIT" ]
1
2021-08-09T12:10:40.000Z
2021-08-09T12:10:40.000Z
Test/Client.py
thekakodkar/BODtoJSON
341943d847157c4bc5e0c32965008f11071ed608
[ "MIT" ]
null
null
null
Test/Client.py
thekakodkar/BODtoJSON
341943d847157c4bc5e0c32965008f11071ed608
[ "MIT" ]
null
null
null
from config import config from BODtoJSON.BODtoJSON import convert print(convert(config.input_var, 'Sync'))
21.6
40
0.814815
15
108
5.8
0.6
0
0
0
0
0
0
0
0
0
0
0
0.101852
108
4
41
27
0.896907
0
0
0
0
0
0.037037
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
fcc4ce20572d1812444863f7088739fe143ab2a4
5,649
py
Python
zakupki/core/models.py
kgazha/zakupki
68ca4856fbf0dfc16ecd311460e46472482e5721
[ "MIT" ]
null
null
null
zakupki/core/models.py
kgazha/zakupki
68ca4856fbf0dfc16ecd311460e46472482e5721
[ "MIT" ]
null
null
null
zakupki/core/models.py
kgazha/zakupki
68ca4856fbf0dfc16ecd311460e46472482e5721
[ "MIT" ]
null
null
null
from django.db import models class Resource(models.Model): code = models.CharField(max_length=255) path = models.CharField(max_length=255) description = models.CharField(max_length=255, blank=True, null=True) def __str__(self): return self.path class PurchaseTypeControl(models.Model): code = models.CharField(max_length=255) description = models.CharField(max_length=255, blank=True, null=True) def __str__(self): return self.code class PlacingWay(models.Model): code = models.CharField(max_length=255) name = models.CharField(max_length=255) date_added = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) def __str__(self): return self.name class Organization(models.Model): reg_num = models.CharField(max_length=255) cons_registry_num = models.CharField(max_length=255, blank=True, null=True) name = models.CharField(max_length=255, blank=True, null=True) full_name = models.TextField(blank=True, null=True) post_address = models.CharField(max_length=255, blank=True, null=True) fact_address = models.CharField(max_length=255, blank=True, null=True) inn = models.CharField(max_length=255, unique=True) kpp = models.CharField(max_length=255, blank=True, null=True) okato = models.CharField(max_length=255, blank=True, null=True) date_added = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) def __str__(self): return self.full_name class FinanceSource(models.Model): name = models.TextField() date_added = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) def __str__(self): return self.name class Purchase(models.Model): object_info = models.TextField(blank=True, null=True) purchase_number = models.CharField(max_length=255, unique=True) placing_way = models.ForeignKey(PlacingWay, on_delete=models.SET_NULL, blank=True, null=True) max_price = models.FloatField(blank=True, null=True) price = models.FloatField(blank=True, null=True) sign_date = models.DateField(blank=True, null=True) protocol_date = models.DateField(blank=True, null=True) direct_date = models.DateTimeField(blank=True, null=True) doc_publish_date = models.DateTimeField(blank=True, null=True) finance_source = models.ForeignKey(FinanceSource, on_delete=models.SET_NULL, blank=True, null=True) def __str__(self): return self.purchase_number class OrganizationRole(models.Model): name = models.CharField(max_length=255) date_added = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) def __str__(self): return self.name class OrganizationPurchase(models.Model): organization = models.ForeignKey(Organization, on_delete=models.CASCADE, blank=True, null=True) purchase = models.ForeignKey(Purchase, on_delete=models.CASCADE, blank=True, null=True) organization_role = models.ForeignKey(OrganizationRole, on_delete=models.CASCADE, blank=True, null=True) date_added = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) def __str__(self): return self.name class OKPD(models.Model): code = models.CharField(max_length=255) name = models.TextField(blank=True, null=True) date_added = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) def __str__(self): return self.name class OKPD2(models.Model): code = models.CharField(max_length=255) name = models.TextField(blank=True, null=True) date_added = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) def __str__(self): return self.name class OKEI(models.Model): code = models.CharField(max_length=255) national_code = models.CharField(max_length=255) full_name = models.CharField(max_length=255) date_added = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) def __str__(self): return self.name class PurchaseObject(models.Model): okpd = models.ForeignKey(OKPD, on_delete=models.SET_NULL, blank=True, null=True) okpd2 = models.ForeignKey(OKPD2, on_delete=models.SET_NULL, blank=True, null=True) okei = models.ForeignKey(OKEI, on_delete=models.SET_NULL, blank=True, null=True) purchase = models.ForeignKey(Purchase, on_delete=models.CASCADE) price = models.FloatField(blank=True, null=True) quantity = models.FloatField(blank=True, null=True) date_added = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) class Archive(models.Model): resource = models.ForeignKey(Resource, on_delete=models.CASCADE, blank=True, null=True) name = models.CharField(max_length=255) date_added = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) def __str__(self): return self.name class File(models.Model): name = models.CharField(max_length=255) archive = models.ForeignKey(Archive, on_delete=models.CASCADE) purchase = models.ForeignKey(Purchase, on_delete=models.SET_NULL, blank=True, null=True) purchase_type_control = models.ForeignKey(PurchaseTypeControl, on_delete=models.SET_NULL, blank=True, null=True) date_added = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) def __str__(self): return self.name
36.445161
116
0.743671
749
5,649
5.376502
0.108144
0.069282
0.100075
0.130867
0.803576
0.801589
0.773777
0.672461
0.61485
0.538366
0
0.015628
0.150469
5,649
154
117
36.681818
0.823505
0
0
0.530973
0
0
0
0
0
0
0
0
0
1
0.115044
false
0
0.00885
0.115044
1
0
0
0
0
null
0
0
0
1
1
1
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
1
1
0
0
5
fcd3db096351297de5fea1fb12c11e0237a8cee4
210
py
Python
boucanpy/core/api_token/__init__.py
bbhunter/boucanpy
7d2fb105e7b1e90653a511534fb878bb62d02f17
[ "MIT" ]
34
2019-11-16T17:22:15.000Z
2022-02-11T23:12:46.000Z
boucanpy/core/api_token/__init__.py
bbhunter/boucanpy
7d2fb105e7b1e90653a511534fb878bb62d02f17
[ "MIT" ]
1
2021-02-09T09:34:55.000Z
2021-02-10T21:46:20.000Z
boucanpy/core/api_token/__init__.py
bbhunter/boucanpy
7d2fb105e7b1e90653a511534fb878bb62d02f17
[ "MIT" ]
9
2019-11-18T22:18:07.000Z
2021-02-08T13:23:51.000Z
from .repos import ApiTokenRepo from .responses import ApiTokenResponse, ApiTokensResponse, SensitiveApiTokenResponse from .data import ApiTokenData, SensitiveApiTokenData from .forms import ApiTokenCreateForm
42
85
0.87619
19
210
9.684211
0.684211
0
0
0
0
0
0
0
0
0
0
0
0.090476
210
4
86
52.5
0.963351
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
1e3d15881b76267a95e0ce895586afe1ce713bf2
131
py
Python
easy_dash/__init__.py
kmader/easy_dash
1f98911c6fc7d1136e7d8b609d07a235227cc7c8
[ "Apache-2.0" ]
3
2019-04-03T20:47:33.000Z
2021-02-09T21:21:22.000Z
easy_dash/__init__.py
kmader/easy_dash
1f98911c6fc7d1136e7d8b609d07a235227cc7c8
[ "Apache-2.0" ]
5
2019-04-04T06:56:41.000Z
2019-10-04T12:50:18.000Z
easy_dash/__init__.py
kmader/easy_dash
1f98911c6fc7d1136e7d8b609d07a235227cc7c8
[ "Apache-2.0" ]
1
2020-07-18T06:13:32.000Z
2020-07-18T06:13:32.000Z
from __future__ import print_function from .easydash import EasyDash # noqa: F401 from .version import __version__ # noqa: F401
26.2
46
0.793893
17
131
5.588235
0.529412
0.168421
0
0
0
0
0
0
0
0
0
0.054545
0.160305
131
4
47
32.75
0.809091
0.160305
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
1e70bd80aa0978153345eb922318b55e0ef734ff
8,981
py
Python
models/roberta_sr_simple.py
alibaba/Retrieval-based-Pre-training-for-Machine-Reading-Comprehension
b27dc55446a29a53af7fffdad8628ccb545420da
[ "Apache-2.0" ]
7
2021-06-16T01:40:23.000Z
2021-12-04T02:40:35.000Z
models/roberta_sr_simple.py
SparkJiao/Retrieval-based-Pre-training-for-Machine-Reading-Comprehension
9ccad31bd0bf2216004cf729d1d511fc3e0b77c9
[ "Apache-2.0" ]
1
2021-08-16T09:10:05.000Z
2021-08-25T08:44:44.000Z
models/roberta_sr_simple.py
SparkJiao/Retrieval-based-Pre-training-for-Machine-Reading-Comprehension
9ccad31bd0bf2216004cf729d1d511fc3e0b77c9
[ "Apache-2.0" ]
3
2021-09-13T02:03:37.000Z
2021-10-11T18:48:21.000Z
import torch from torch import nn from torch.nn import functional as F from transformers import RobertaConfig, RobertaModel from transformers.modeling_roberta import RobertaPreTrainedModel from models.roberta_models import RobertaHAMCRCConfig from modules import layers from modules.layers import simple_circle_loss, sentence_sum, mul_sentence_sum, MHAToken, fix_circle_loss, \ cross_entropy_loss_and_accuracy, mask_scores_with_labels from modules.modeling_reusable_graph_attention import SentenceReorderDecoder, SentenceSum, SentenceReorderHead, \ SentenceReorderWithPosition class RobertaModelHiForMCRC(RobertaPreTrainedModel): model_prefix = 'roberta_h_mcrc' config_class = RobertaHAMCRCConfig def __init__(self, config: RobertaHAMCRCConfig): super().__init__(config) self.roberta = RobertaModel(config) self.q_sum = nn.Linear(config.hidden_size, config.hidden_size) self.s_sum = nn.Linear(config.hidden_size, config.hidden_size) self.use_new_pro = config.use_new_pro if self.use_new_pro: self.que_pro = nn.Linear(config.hidden_size, config.hidden_size) self.key_pro = nn.Linear(config.hidden_size, config.hidden_size) # self.val_pro = nn.Linear(config.hidden_size, config.hidden_size) else: self.project1 = nn.Linear(config.hidden_size, config.hidden_size) self.project2 = nn.Linear(config.hidden_size, config.hidden_size) if config.cls_type == 1: self.pooler = nn.Sequential( nn.Linear(config.hidden_size * 2, config.hidden_size), nn.Tanh() ) else: self.pooler = nn.Linear(config.hidden_size * 2, config.hidden_size) self.classifier = nn.Linear(config.hidden_size, 1) self.dropout = nn.Dropout(config.hidden_dropout_prob) self.init_weights() @staticmethod def fold_tensor(x): if x is None: return None return x.reshape(x.size(0) * x.size(1), *x.size()[2:]) def project(self, _query, _key): if self.use_new_pro: return self.que_pro(_query), self.key_pro(_key) else: return self.project1(_query), self.project2(_key) def forward(self, input_ids, attention_mask=None, token_type_ids=None, sentence_index=None, sentence_mask=None, sent_word_mask=None, labels=None, **kwargs): batch, num_choice, _ = input_ids.size() input_ids = self.fold_tensor(input_ids) token_type_ids = self.fold_tensor(token_type_ids) attention_mask = self.fold_tensor(attention_mask) sentence_index = self.fold_tensor(sentence_index) sent_word_mask = self.fold_tensor(sent_word_mask) sentence_mask = self.fold_tensor(sentence_mask) seq_output = self.roberta(input_ids=input_ids, attention_mask=attention_mask, token_type_ids=token_type_ids)[0] sentence_index, mask, sent_mask = sentence_index, sent_word_mask, sentence_mask fb, sent_num, seq_len = mask.size() sentence_index = sentence_index.unsqueeze(-1).expand( -1, -1, -1, self.config.hidden_size ).reshape(fb, sent_num * seq_len, self.config.hidden_size) cls_h = seq_output[:, 0] hidden = seq_output.gather(dim=1, index=sentence_index).reshape( fb, sent_num, seq_len, -1) hidden = hidden * (1 - mask.unsqueeze(-1)) q_op_hidden = hidden[:, :2].reshape(fb, 1, 2 * seq_len, -1) q_op_word_mask = mask[:, :2].reshape(fb, 1, 2 * seq_len) query_h, _ = sentence_sum( self.q_sum(cls_h), q_op_hidden, q_op_word_mask ) query_h = query_h.squeeze(1) p_hidden = hidden[:, 2:] p_word_mask = mask[:, 2:] sent_h, _ = sentence_sum( self.s_sum(query_h), p_hidden, p_word_mask ) _pro_query, _pro_key = self.project(query_h, sent_h) scores = torch.einsum( "bh,bsh->bs", _pro_query, _pro_key ) alpha = (scores + sent_mask[:, 2:] * -10000.0).softmax(dim=-1) attended_h = torch.einsum("bs,bsh->bh", alpha, sent_h) cls_input = torch.cat([query_h, attended_h], dim=-1) logits = self.classifier(self.dropout(self.pooler(cls_input))).view(batch, num_choice) outputs = (logits,) if labels is not None: loss = F.cross_entropy(logits, labels, ignore_index=-1) outputs = (loss,) + outputs _, pred = logits.max(dim=-1) acc = torch.sum(pred == labels) / (1.0 * batch) outputs = outputs + (acc,) return outputs class RobertaModelHiGForMCRC(RobertaPreTrainedModel): model_prefix = 'roberta_g_mcrc' config_class = RobertaHAMCRCConfig def __init__(self, config: RobertaHAMCRCConfig): super().__init__(config) self.roberta = RobertaModel(config) self.q_sum = nn.Linear(config.hidden_size, config.hidden_size) self.s_sum = nn.Linear(config.hidden_size, config.hidden_size) self.project1 = nn.Linear(config.hidden_size, config.hidden_size) self.project2 = nn.Linear(config.hidden_size, config.hidden_size) self.v_sum = nn.Linear(config.hidden_size, 1) if config.cls_type == 1: self.pooler = nn.Sequential( nn.Linear(config.hidden_size, config.hidden_size), nn.Tanh() ) else: self.pooler = nn.Linear(config.hidden_size, config.hidden_size) self.classifier = nn.Linear(config.hidden_size, 1) self.dropout = nn.Dropout(config.hidden_dropout_prob) self.init_weights() @staticmethod def fold_tensor(x): if x is None: return None return x.reshape(x.size(0) * x.size(1), *x.size()[2:]) def forward(self, input_ids, attention_mask=None, token_type_ids=None, sentence_index=None, sentence_mask=None, sent_word_mask=None, labels=None, **kwargs): batch, num_choice, _ = input_ids.size() input_ids = self.fold_tensor(input_ids) token_type_ids = self.fold_tensor(token_type_ids) attention_mask = self.fold_tensor(attention_mask) sentence_index = self.fold_tensor(sentence_index) sent_word_mask = self.fold_tensor(sent_word_mask) sentence_mask = self.fold_tensor(sentence_mask) seq_output = self.roberta(input_ids=input_ids, attention_mask=attention_mask, token_type_ids=token_type_ids)[0] sentence_index, mask, sent_mask = sentence_index, sent_word_mask, sentence_mask fb, sent_num, seq_len = mask.size() sentence_index = sentence_index.unsqueeze(-1).expand( -1, -1, -1, self.config.hidden_size ).reshape(fb, sent_num * seq_len, self.config.hidden_size) cls_h = seq_output[:, 0] hidden = seq_output.gather(dim=1, index=sentence_index).reshape( fb, sent_num, seq_len, -1) hidden = hidden * (1 - mask.unsqueeze(-1)) q_op_hidden = hidden[:, :2].reshape(fb, 1, 2 * seq_len, -1) q_op_word_mask = mask[:, :2].reshape(fb, 1, 2 * seq_len) query_h, _ = sentence_sum( self.q_sum(cls_h), q_op_hidden, q_op_word_mask ) query_h = query_h.squeeze(1) sent_h, _ = sentence_sum( self.s_sum(query_h), hidden, mask ) scores = torch.einsum( "bh,bsh->bs", self.project1(query_h), self.project2(sent_h) ) alpha = (scores + sent_mask * -10000.0).softmax(dim=-1) v_scores = self.v_sum(hidden).squeeze(-1) v_alpha = torch.softmax(v_scores + mask * -10000.0, dim=-1) v_sent_h = torch.einsum("bst,bsth->bsh", v_alpha, hidden) attended_h = torch.einsum("bs,bsh->bh", alpha, v_sent_h) # cls_input = torch.cat([query_h, attended_h], dim=-1) logits = self.classifier(self.dropout(self.pooler(attended_h))).view(batch, num_choice) outputs = (logits,) if labels is not None: loss = F.cross_entropy(logits, labels, ignore_index=-1) outputs = (loss,) + outputs _, pred = logits.max(dim=-1) acc = torch.sum(pred == labels) / (1.0 * batch) outputs = outputs + (acc,) return outputs roberta_models_for_mcrc_simple_map = { RobertaModelHiForMCRC.model_prefix: RobertaModelHiForMCRC, RobertaModelHiGForMCRC.model_prefix: RobertaModelHiGForMCRC }
37.11157
114
0.614408
1,125
8,981
4.605333
0.119111
0.09033
0.114264
0.069485
0.767419
0.755067
0.740398
0.740398
0.728045
0.707006
0
0.014275
0.282374
8,981
241
115
37.26556
0.789604
0.013028
0
0.677966
0
0
0.009397
0
0
0
0
0
0
1
0.039548
false
0
0.050847
0
0.169492
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
1e76b40b4f8c0c286576dd6a9691fbb612cab54e
167
py
Python
Linear/Separate/test.py
jesusdalvarado/CalculiX-Examples
79150c1167026cb6c0dfd2bd83f8abed144dcd75
[ "MIT" ]
2
2019-03-16T09:22:21.000Z
2019-03-16T09:22:23.000Z
Linear/Separate/test.py
jesusdalvarado/CalculiX-Examples
79150c1167026cb6c0dfd2bd83f8abed144dcd75
[ "MIT" ]
null
null
null
Linear/Separate/test.py
jesusdalvarado/CalculiX-Examples
79150c1167026cb6c0dfd2bd83f8abed144dcd75
[ "MIT" ]
1
2019-04-26T14:35:22.000Z
2019-04-26T14:35:22.000Z
#!/usr/bin/python import os os.system("cgx -b pre.fbd") os.system("ccx nodal") os.system("ccx element") os.system("cgx -b post-n.fbd") os.system("cgx -b post-e.fbd")
18.555556
30
0.670659
33
167
3.393939
0.484848
0.357143
0.294643
0.321429
0.285714
0
0
0
0
0
0
0
0.101796
167
8
31
20.875
0.746667
0.095808
0
0
0
0
0.453333
0
0
0
0
0
0
1
0
true
0
0.166667
0
0.166667
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
94cd78dd269ae2d8e12c28fb59fd1f1b671d6c89
812
py
Python
tests/rater/test_full.py
bst-mug/acres
46875edbb5619862064cf2380c8e167a418c1cac
[ "Apache-2.0" ]
1
2018-06-19T08:53:22.000Z
2018-06-19T08:53:22.000Z
tests/rater/test_full.py
bst-mug/acres
46875edbb5619862064cf2380c8e167a418c1cac
[ "Apache-2.0" ]
81
2018-05-15T13:36:00.000Z
2020-08-19T14:47:05.000Z
tests/rater/test_full.py
bst-mug/acres
46875edbb5619862064cf2380c8e167a418c1cac
[ "Apache-2.0" ]
2
2018-02-12T10:42:11.000Z
2018-02-17T11:35:15.000Z
from acres.rater import full def test__contain_acronym(): # Baseline assert not full._contain_acronym("Elektrokardiogramm") assert full._contain_acronym("VSM Bypass") assert full._contain_acronym("Gamma GT") # Only acronym assert full._contain_acronym("EKG") def test__compute_full_valid(): # Full form has parenthesis # assert 1 == full._compute_full_valid("Abcde(fghi") # Full form too short # assert 2 == full._compute_full_valid("Lasix") # Full form starts with stopword # assert 4 == full._compute_full_valid("Auf das") # Full form has no capitals assert 8 == full._compute_full_valid("ambulanz") # Full form has no capitals assert 16 == full._compute_full_valid("VSM Bypass") assert 16 == full._compute_full_valid("Thrombo ASS")
27.066667
58
0.705665
109
812
4.954128
0.40367
0.142593
0.207407
0.222222
0.192593
0.192593
0
0
0
0
0
0.012251
0.195813
812
29
59
28
0.814701
0.3633
0
0
0
0
0.134387
0
0
0
0
0
0.7
1
0.2
true
0.2
0.1
0
0.3
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
0
1
1
0
0
0
0
0
5
94ec7f5522879b03c7bdff61d29f61f2188f4bdf
64
py
Python
quadrant/__init__.py
e-champenois/quadrant
6d25b8d2379a2739f1a7f60dcc4f2cbf4c556b07
[ "MIT" ]
null
null
null
quadrant/__init__.py
e-champenois/quadrant
6d25b8d2379a2739f1a7f60dcc4f2cbf4c556b07
[ "MIT" ]
null
null
null
quadrant/__init__.py
e-champenois/quadrant
6d25b8d2379a2739f1a7f60dcc4f2cbf4c556b07
[ "MIT" ]
1
2022-02-22T19:36:44.000Z
2022-02-22T19:36:44.000Z
from .quadrant import foldQuadrant, unfoldQuadrant, resizeFolded
64
64
0.875
6
64
9.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.078125
64
1
64
64
0.949153
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
94eeb8749e11e9543af8a4269a86e74b9f2402d3
14,824
py
Python
fn_html2pdf/fn_html2pdf/util/customize.py
kennyleeshim1ibmcom/resilient-community-apps
fcbf6a9fbed912b0ca2620485bd2ba8cda7e9e92
[ "MIT" ]
null
null
null
fn_html2pdf/fn_html2pdf/util/customize.py
kennyleeshim1ibmcom/resilient-community-apps
fcbf6a9fbed912b0ca2620485bd2ba8cda7e9e92
[ "MIT" ]
null
null
null
fn_html2pdf/fn_html2pdf/util/customize.py
kennyleeshim1ibmcom/resilient-community-apps
fcbf6a9fbed912b0ca2620485bd2ba8cda7e9e92
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """Generate the Resilient customizations required for fn_html2pdf""" from __future__ import print_function from resilient_circuits.util import * def customization_data(client=None): """Produce any customization definitions (types, fields, message destinations, etc) that should be installed by `resilient-circuits customize` """ # This import data contains: # Function inputs: # html2pdf_data # html2pdf_data_type # html2pdf_stylesheet # Message Destinations: # fn_html2pdf # Functions: # html2pdf # Workflows: # example_html2pdf # Rules: # Example: HTML2PDF yield ImportDefinition(u""" eyJzZXJ2ZXJfdmVyc2lvbiI6IHsibWFqb3IiOiAzMSwgIm1pbm9yIjogMCwgImJ1aWxkX251bWJl ciI6IDAsICJ2ZXJzaW9uIjogIjMxLjAuMCJ9LCAiZXhwb3J0X2Zvcm1hdF92ZXJzaW9uIjogMiwg ImlkIjogMSwgImV4cG9ydF9kYXRlIjogMTUzNzIwOTAwMTA1NCwgImZpZWxkcyI6IFt7ImlkIjog NTEsICJuYW1lIjogImluY190cmFpbmluZyIsICJ0ZXh0IjogIlNpbXVsYXRpb24iLCAicHJlZml4 IjogbnVsbCwgInR5cGVfaWQiOiAwLCAidG9vbHRpcCI6ICJXaGV0aGVyIHRoZSBpbmNpZGVudCBp cyBhIHNpbXVsYXRpb24gb3IgYSByZWd1bGFyIGluY2lkZW50LiAgVGhpcyBmaWVsZCBpcyByZWFk LW9ubHkuIiwgImlucHV0X3R5cGUiOiAiYm9vbGVhbiIsICJoaWRlX25vdGlmaWNhdGlvbiI6IGZh bHNlLCAiY2hvc2VuIjogZmFsc2UsICJkZWZhdWx0X2Nob3Nlbl9ieV9zZXJ2ZXIiOiBmYWxzZSwg ImJsYW5rX29wdGlvbiI6IGZhbHNlLCAiaW50ZXJuYWwiOiBmYWxzZSwgInV1aWQiOiAiYzNmMGUz ZWQtMjFlMS00ZDUzLWFmZmItZmU1Y2EzMzA4Y2NhIiwgIm9wZXJhdGlvbnMiOiBbXSwgIm9wZXJh dGlvbl9wZXJtcyI6IHt9LCAidmFsdWVzIjogW10sICJyZWFkX29ubHkiOiB0cnVlLCAiY2hhbmdl YWJsZSI6IHRydWUsICJyaWNoX3RleHQiOiBmYWxzZSwgImV4cG9ydF9rZXkiOiAiaW5jaWRlbnQv aW5jX3RyYWluaW5nIiwgInRlbXBsYXRlcyI6IFtdLCAiZGVwcmVjYXRlZCI6IGZhbHNlfSwgeyJp ZCI6IDE2MywgIm5hbWUiOiAiaHRtbDJwZGZfc3R5bGVzaGVldCIsICJ0ZXh0IjogImh0bWwycGRm X3N0eWxlc2hlZXQiLCAicHJlZml4IjogbnVsbCwgInR5cGVfaWQiOiAxMSwgInRvb2x0aXAiOiAi Y3NzIGZvcm1hdHRlZCBzdHlsZXNoZWV0IGluZm9ybWF0aW9uIHRvIHVzZSB3aGVuIHJlbmRlcmlu ZyBQREYgZG9jdW1lbnQiLCAicGxhY2Vob2xkZXIiOiAiQHBhZ2UgeyBzaXplOiBsYW5kc2NhcGU7 IH0qIHsgZm9udC1mYW1pbHk6IEFyaWFsOyBmb250LXNpemU6IHNtYWxsOyB9dGFibGUgeyBib3Jk ZXItY29sbGFwc2U6IGNvbGxhcHNlOyB9dGFibGUsIHRoLCB0ZCB7IGJvcmRlcjogMXB4IHNvbGlk IGJsYWNrOyB9IiwgImlucHV0X3R5cGUiOiAidGV4dCIsICJoaWRlX25vdGlmaWNhdGlvbiI6IGZh bHNlLCAiY2hvc2VuIjogZmFsc2UsICJkZWZhdWx0X2Nob3Nlbl9ieV9zZXJ2ZXIiOiBmYWxzZSwg ImJsYW5rX29wdGlvbiI6IGZhbHNlLCAiaW50ZXJuYWwiOiBmYWxzZSwgInV1aWQiOiAiM2IwMWQ2 MWYtY2Q5My00N2Q3LWFiNGEtYjMyYzJiOGUxYmZhIiwgIm9wZXJhdGlvbnMiOiBbXSwgIm9wZXJh dGlvbl9wZXJtcyI6IHt9LCAidmFsdWVzIjogW10sICJyZWFkX29ubHkiOiBmYWxzZSwgImNoYW5n ZWFibGUiOiB0cnVlLCAicmljaF90ZXh0IjogZmFsc2UsICJleHBvcnRfa2V5IjogIl9fZnVuY3Rp b24vaHRtbDJwZGZfc3R5bGVzaGVldCIsICJ0ZW1wbGF0ZXMiOiBbXSwgImRlcHJlY2F0ZWQiOiBm YWxzZX0sIHsiaWQiOiAxNTksICJuYW1lIjogImh0bWwycGRmX2RhdGFfdHlwZSIsICJ0ZXh0Ijog Imh0bWwycGRmX2RhdGFfdHlwZSIsICJwcmVmaXgiOiBudWxsLCAidHlwZV9pZCI6IDExLCAidG9v bHRpcCI6ICJ0aGUgdHlwZSBvZiBkYXRhIHBhc3NlZCwgdXN1YWxseSB0aGUgYXJ0aWZhY3QgdHlw ZS4gVVJMIG9yIFVSSSBhcmUgbmVlZGVkIGZvciB3ZWJwYWdlIHNjYXBpbmciLCAicGxhY2Vob2xk ZXIiOiAiIiwgImlucHV0X3R5cGUiOiAidGV4dCIsICJyZXF1aXJlZCI6ICJhbHdheXMiLCAiaGlk ZV9ub3RpZmljYXRpb24iOiBmYWxzZSwgImNob3NlbiI6IGZhbHNlLCAiZGVmYXVsdF9jaG9zZW5f Ynlfc2VydmVyIjogZmFsc2UsICJibGFua19vcHRpb24iOiBmYWxzZSwgImludGVybmFsIjogZmFs c2UsICJ1dWlkIjogIjIxYWMyYWMwLWFiYzktNDg1YS1hNjZlLTVhYjY4MDQxNWI0MCIsICJvcGVy YXRpb25zIjogW10sICJvcGVyYXRpb25fcGVybXMiOiB7fSwgInZhbHVlcyI6IFtdLCAicmVhZF9v bmx5IjogZmFsc2UsICJjaGFuZ2VhYmxlIjogdHJ1ZSwgInJpY2hfdGV4dCI6IGZhbHNlLCAiZXhw b3J0X2tleSI6ICJfX2Z1bmN0aW9uL2h0bWwycGRmX2RhdGFfdHlwZSIsICJ0ZW1wbGF0ZXMiOiBb XSwgImRlcHJlY2F0ZWQiOiBmYWxzZX0sIHsiaWQiOiAxNTMsICJuYW1lIjogImh0bWwycGRmX2Rh dGEiLCAidGV4dCI6ICJodG1sMnBkZl9kYXRhIiwgInByZWZpeCI6IG51bGwsICJ0eXBlX2lkIjog MTEsICJ0b29sdGlwIjogInNwZWNpZnkgZWl0aGVyIGEgaHRtbCBzdHJpbmcgb3IgdXJsIHJlZmVy ZW5jZSIsICJwbGFjZWhvbGRlciI6ICIiLCAiaW5wdXRfdHlwZSI6ICJ0ZXh0IiwgInJlcXVpcmVk IjogImFsd2F5cyIsICJoaWRlX25vdGlmaWNhdGlvbiI6IGZhbHNlLCAiY2hvc2VuIjogZmFsc2Us ICJkZWZhdWx0X2Nob3Nlbl9ieV9zZXJ2ZXIiOiBmYWxzZSwgImJsYW5rX29wdGlvbiI6IGZhbHNl LCAiaW50ZXJuYWwiOiBmYWxzZSwgInV1aWQiOiAiOWQwZTI4ODctOTFiYy00NWVjLTgzMWYtYjUx OTk2ZTAxZmE2IiwgIm9wZXJhdGlvbnMiOiBbXSwgIm9wZXJhdGlvbl9wZXJtcyI6IHt9LCAidmFs dWVzIjogW10sICJyZWFkX29ubHkiOiBmYWxzZSwgImNoYW5nZWFibGUiOiB0cnVlLCAicmljaF90 ZXh0IjogZmFsc2UsICJleHBvcnRfa2V5IjogIl9fZnVuY3Rpb24vaHRtbDJwZGZfZGF0YSIsICJ0 ZW1wbGF0ZXMiOiBbXSwgImRlcHJlY2F0ZWQiOiBmYWxzZX1dLCAiaW5jaWRlbnRfdHlwZXMiOiBb eyJ1cGRhdGVfZGF0ZSI6IDE1MzcyMTAxMjg2MjUsICJjcmVhdGVfZGF0ZSI6IDE1MzcyMTAxMjg2 MjUsICJ1dWlkIjogImJmZWVjMmQ0LTM3NzAtMTFlOC1hZDM5LTRhMDAwNDA0NGFhMCIsICJkZXNj cmlwdGlvbiI6ICJDdXN0b21pemF0aW9uIFBhY2thZ2VzIChpbnRlcm5hbCkiLCAiZXhwb3J0X2tl eSI6ICJDdXN0b21pemF0aW9uIFBhY2thZ2VzIChpbnRlcm5hbCkiLCAibmFtZSI6ICJDdXN0b21p emF0aW9uIFBhY2thZ2VzIChpbnRlcm5hbCkiLCAiZW5hYmxlZCI6IGZhbHNlLCAic3lzdGVtIjog ZmFsc2UsICJwYXJlbnRfaWQiOiBudWxsLCAiaGlkZGVuIjogZmFsc2UsICJpZCI6IDB9XSwgInBo YXNlcyI6IFtdLCAiYXV0b21hdGljX3Rhc2tzIjogW10sICJvdmVycmlkZXMiOiBbXSwgIm1lc3Nh Z2VfZGVzdGluYXRpb25zIjogW3sibmFtZSI6ICJmbl9odG1sMnBkZiIsICJwcm9ncmFtbWF0aWNf bmFtZSI6ICJmbl9odG1sMnBkZiIsICJkZXN0aW5hdGlvbl90eXBlIjogMCwgImV4cGVjdF9hY2si OiB0cnVlLCAidXNlcnMiOiBbImJAYS5jb20iXSwgInV1aWQiOiAiOTA5ODYzODgtODIzZi00ZTI0 LWExMTAtYjJkY2ZmNjAyNzliIiwgImV4cG9ydF9rZXkiOiAiZm5faHRtbDJwZGYifV0sICJhY3Rp b25zIjogW3siaWQiOiAzNSwgIm5hbWUiOiAiRXhhbXBsZTogSFRNTDJQREYiLCAidHlwZSI6IDEs ICJvYmplY3RfdHlwZSI6ICJhcnRpZmFjdCIsICJjb25kaXRpb25zIjogW10sICJhdXRvbWF0aW9u cyI6IFtdLCAibWVzc2FnZV9kZXN0aW5hdGlvbnMiOiBbXSwgIndvcmtmbG93cyI6IFsiZXhhbXBs ZV9odG1sMnBkZiJdLCAidmlld19pdGVtcyI6IFtdLCAidGltZW91dF9zZWNvbmRzIjogODY0MDAs ICJ1dWlkIjogImNkYjQ5YTM0LTA5MTItNGM0YS1iZWYzLTBiZjVjY2UzNGFlNiIsICJleHBvcnRf a2V5IjogIkV4YW1wbGU6IEhUTUwyUERGIiwgImxvZ2ljX3R5cGUiOiAiYWxsIn1dLCAibGF5b3V0 cyI6IFtdLCAibm90aWZpY2F0aW9ucyI6IG51bGwsICJ0aW1lZnJhbWVzIjogbnVsbCwgImxvY2Fs ZSI6IG51bGwsICJpbmR1c3RyaWVzIjogbnVsbCwgInJlZ3VsYXRvcnMiOiBudWxsLCAiZ2VvcyI6 IG51bGwsICJ0YXNrX29yZGVyIjogW10sICJhY3Rpb25fb3JkZXIiOiBbXSwgInR5cGVzIjogW10s ICJzY3JpcHRzIjogW10sICJpbmNpZGVudF9hcnRpZmFjdF90eXBlcyI6IFtdLCAid29ya2Zsb3dz IjogW3sid29ya2Zsb3dfaWQiOiAyMiwgIm5hbWUiOiAiRXhhbXBsZTogSFRNTDJQREYiLCAicHJv Z3JhbW1hdGljX25hbWUiOiAiZXhhbXBsZV9odG1sMnBkZiIsICJvYmplY3RfdHlwZSI6ICJhcnRp ZmFjdCIsICJkZXNjcmlwdGlvbiI6ICIiLCAiY3JlYXRvcl9pZCI6ICJiQGEuY29tIiwgImxhc3Rf bW9kaWZpZWRfYnkiOiAiYkBhLmNvbSIsICJsYXN0X21vZGlmaWVkX3RpbWUiOiAxNTM3MjA4ODIz MTk0LCAiZXhwb3J0X2tleSI6ICJleGFtcGxlX2h0bWwycGRmIiwgInV1aWQiOiAiYjMxZTkwZjgt NTgzYy00NWMwLWE3YzAtMTVkOTRiOTY5YjM3IiwgImNvbnRlbnQiOiB7IndvcmtmbG93X2lkIjog ImV4YW1wbGVfaHRtbDJwZGYiLCAieG1sIjogIjw/eG1sIHZlcnNpb249XCIxLjBcIiBlbmNvZGlu Zz1cIlVURi04XCI/PjxkZWZpbml0aW9ucyB4bWxucz1cImh0dHA6Ly93d3cub21nLm9yZy9zcGVj L0JQTU4vMjAxMDA1MjQvTU9ERUxcIiB4bWxuczpicG1uZGk9XCJodHRwOi8vd3d3Lm9tZy5vcmcv c3BlYy9CUE1OLzIwMTAwNTI0L0RJXCIgeG1sbnM6b21nZGM9XCJodHRwOi8vd3d3Lm9tZy5vcmcv c3BlYy9ERC8yMDEwMDUyNC9EQ1wiIHhtbG5zOm9tZ2RpPVwiaHR0cDovL3d3dy5vbWcub3JnL3Nw ZWMvREQvMjAxMDA1MjQvRElcIiB4bWxuczpyZXNpbGllbnQ9XCJodHRwOi8vcmVzaWxpZW50Lmli bS5jb20vYnBtblwiIHhtbG5zOnhzZD1cImh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1h XCIgeG1sbnM6eHNpPVwiaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2Vc IiB0YXJnZXROYW1lc3BhY2U9XCJodHRwOi8vd3d3LmNhbXVuZGEub3JnL3Rlc3RcIj48cHJvY2Vz cyBpZD1cImV4YW1wbGVfaHRtbDJwZGZcIiBpc0V4ZWN1dGFibGU9XCJ0cnVlXCIgbmFtZT1cIkV4 YW1wbGU6IEhUTUwyUERGXCI+PGRvY3VtZW50YXRpb24vPjxzdGFydEV2ZW50IGlkPVwiU3RhcnRF dmVudF8xNTVhc3htXCI+PG91dGdvaW5nPlNlcXVlbmNlRmxvd18wc3d6Nm9iPC9vdXRnb2luZz48 L3N0YXJ0RXZlbnQ+PHNlcnZpY2VUYXNrIGlkPVwiU2VydmljZVRhc2tfMDhucHVuZFwiIG5hbWU9 XCJIVE1MMlBERlwiIHJlc2lsaWVudDp0eXBlPVwiZnVuY3Rpb25cIj48ZXh0ZW5zaW9uRWxlbWVu dHM+PHJlc2lsaWVudDpmdW5jdGlvbiB1dWlkPVwiM2Y5MjhlYWYtMTExNi00Yzg5LWE2ZTItZmVj MTkxOGI1ZGJhXCI+e1wiaW5wdXRzXCI6e1wiOWQwZTI4ODctOTFiYy00NWVjLTgzMWYtYjUxOTk2 ZTAxZmE2XCI6e1wiaW5wdXRfdHlwZVwiOlwic3RhdGljXCIsXCJzdGF0aWNfaW5wdXRcIjp7XCJt dWx0aXNlbGVjdF92YWx1ZVwiOltdLFwidGV4dF92YWx1ZVwiOlwiJmx0O3RhYmxlJmd0OyZsdDt0 ciZndDsmbHQ7dGQmZ3Q7YSZsdDsvdGQmZ3Q7Jmx0O3RkJmd0O2ImbHQ7L3RkJmd0OyZsdDsvdHIm Z3Q7Jmx0O3RyJmd0OyZsdDt0ZCZndDtjJmx0Oy90ZCZndDsmbHQ7dGQmZ3Q7ZCZsdDsvdGQmZ3Q7 Jmx0Oy90ciZndDsmbHQ7L3RhYmxlJmd0O1wifX0sXCIyMWFjMmFjMC1hYmM5LTQ4NWEtYTY2ZS01 YWI2ODA0MTViNDBcIjp7XCJpbnB1dF90eXBlXCI6XCJzdGF0aWNcIixcInN0YXRpY19pbnB1dFwi OntcIm11bHRpc2VsZWN0X3ZhbHVlXCI6W10sXCJ0ZXh0X3ZhbHVlXCI6XCJzdHJpbmdcIn19LFwi M2IwMWQ2MWYtY2Q5My00N2Q3LWFiNGEtYjMyYzJiOGUxYmZhXCI6e1wiaW5wdXRfdHlwZVwiOlwi c3RhdGljXCIsXCJzdGF0aWNfaW5wdXRcIjp7XCJtdWx0aXNlbGVjdF92YWx1ZVwiOltdLFwidGV4 dF92YWx1ZVwiOlwiQHBhZ2UgeyBzaXplOiBsYW5kc2NhcGU7IH0qIHsgZm9udC1mYW1pbHk6IEFy aWFsOyBmb250LXNpemU6IHNtYWxsOyB9dGFibGUgeyBib3JkZXItY29sbGFwc2U6IGNvbGxhcHNl OyB9dGFibGUsIHRoLCB0ZCB7IGJvcmRlcjogMXB4IHNvbGlkIGJsYWNrOyB9XCJ9fX0sXCJwb3N0 X3Byb2Nlc3Npbmdfc2NyaXB0XCI6XCIjIHJlc3VsdHMgaW4gYmFzZTY0LiBzZWUgb3V0cHV0IHBy b3BlcnR5ICdwZGYnXCJ9PC9yZXNpbGllbnQ6ZnVuY3Rpb24+PC9leHRlbnNpb25FbGVtZW50cz48 aW5jb21pbmc+U2VxdWVuY2VGbG93XzBzd3o2b2I8L2luY29taW5nPjxvdXRnb2luZz5TZXF1ZW5j ZUZsb3dfMHZwcjc5eDwvb3V0Z29pbmc+PC9zZXJ2aWNlVGFzaz48c2VxdWVuY2VGbG93IGlkPVwi U2VxdWVuY2VGbG93XzBzd3o2b2JcIiBzb3VyY2VSZWY9XCJTdGFydEV2ZW50XzE1NWFzeG1cIiB0 YXJnZXRSZWY9XCJTZXJ2aWNlVGFza18wOG5wdW5kXCIvPjxlbmRFdmVudCBpZD1cIkVuZEV2ZW50 XzA5M3dzeHdcIj48aW5jb21pbmc+U2VxdWVuY2VGbG93XzB2cHI3OXg8L2luY29taW5nPjwvZW5k RXZlbnQ+PHNlcXVlbmNlRmxvdyBpZD1cIlNlcXVlbmNlRmxvd18wdnByNzl4XCIgc291cmNlUmVm PVwiU2VydmljZVRhc2tfMDhucHVuZFwiIHRhcmdldFJlZj1cIkVuZEV2ZW50XzA5M3dzeHdcIi8+ PHRleHRBbm5vdGF0aW9uIGlkPVwiVGV4dEFubm90YXRpb25fMWt4eGl5dFwiPjx0ZXh0PlN0YXJ0 IHlvdXIgd29ya2Zsb3cgaGVyZTwvdGV4dD48L3RleHRBbm5vdGF0aW9uPjxhc3NvY2lhdGlvbiBp ZD1cIkFzc29jaWF0aW9uXzFzZXVqNDhcIiBzb3VyY2VSZWY9XCJTdGFydEV2ZW50XzE1NWFzeG1c IiB0YXJnZXRSZWY9XCJUZXh0QW5ub3RhdGlvbl8xa3h4aXl0XCIvPjx0ZXh0QW5ub3RhdGlvbiBp ZD1cIlRleHRBbm5vdGF0aW9uXzFvZG14MnhcIj48dGV4dD5SZXN1bHRzIGluIGJhc2U2NDwvdGV4 dD48L3RleHRBbm5vdGF0aW9uPjxhc3NvY2lhdGlvbiBpZD1cIkFzc29jaWF0aW9uXzFnM2g4bThc IiBzb3VyY2VSZWY9XCJTZXJ2aWNlVGFza18wOG5wdW5kXCIgdGFyZ2V0UmVmPVwiVGV4dEFubm90 YXRpb25fMW9kbXgyeFwiLz48L3Byb2Nlc3M+PGJwbW5kaTpCUE1ORGlhZ3JhbSBpZD1cIkJQTU5E aWFncmFtXzFcIj48YnBtbmRpOkJQTU5QbGFuZSBicG1uRWxlbWVudD1cInVuZGVmaW5lZFwiIGlk PVwiQlBNTlBsYW5lXzFcIj48YnBtbmRpOkJQTU5TaGFwZSBicG1uRWxlbWVudD1cIlN0YXJ0RXZl bnRfMTU1YXN4bVwiIGlkPVwiU3RhcnRFdmVudF8xNTVhc3htX2RpXCI+PG9tZ2RjOkJvdW5kcyBo ZWlnaHQ9XCIzNlwiIHdpZHRoPVwiMzZcIiB4PVwiMTYyXCIgeT1cIjE4OFwiLz48YnBtbmRpOkJQ TU5MYWJlbD48b21nZGM6Qm91bmRzIGhlaWdodD1cIjBcIiB3aWR0aD1cIjkwXCIgeD1cIjE1N1wi IHk9XCIyMjNcIi8+PC9icG1uZGk6QlBNTkxhYmVsPjwvYnBtbmRpOkJQTU5TaGFwZT48YnBtbmRp OkJQTU5TaGFwZSBicG1uRWxlbWVudD1cIlRleHRBbm5vdGF0aW9uXzFreHhpeXRcIiBpZD1cIlRl eHRBbm5vdGF0aW9uXzFreHhpeXRfZGlcIj48b21nZGM6Qm91bmRzIGhlaWdodD1cIjMwXCIgd2lk dGg9XCIxMDBcIiB4PVwiOTlcIiB5PVwiMjU0XCIvPjwvYnBtbmRpOkJQTU5TaGFwZT48YnBtbmRp OkJQTU5FZGdlIGJwbW5FbGVtZW50PVwiQXNzb2NpYXRpb25fMXNldWo0OFwiIGlkPVwiQXNzb2Np YXRpb25fMXNldWo0OF9kaVwiPjxvbWdkaTp3YXlwb2ludCB4PVwiMTY5XCIgeHNpOnR5cGU9XCJv bWdkYzpQb2ludFwiIHk9XCIyMjBcIi8+PG9tZ2RpOndheXBvaW50IHg9XCIxNTNcIiB4c2k6dHlw ZT1cIm9tZ2RjOlBvaW50XCIgeT1cIjI1NFwiLz48L2JwbW5kaTpCUE1ORWRnZT48YnBtbmRpOkJQ TU5TaGFwZSBicG1uRWxlbWVudD1cIlNlcnZpY2VUYXNrXzA4bnB1bmRcIiBpZD1cIlNlcnZpY2VU YXNrXzA4bnB1bmRfZGlcIj48b21nZGM6Qm91bmRzIGhlaWdodD1cIjgwXCIgd2lkdGg9XCIxMDBc IiB4PVwiMjU4XCIgeT1cIjE2NlwiLz48L2JwbW5kaTpCUE1OU2hhcGU+PGJwbW5kaTpCUE1ORWRn ZSBicG1uRWxlbWVudD1cIlNlcXVlbmNlRmxvd18wc3d6Nm9iXCIgaWQ9XCJTZXF1ZW5jZUZsb3df MHN3ejZvYl9kaVwiPjxvbWdkaTp3YXlwb2ludCB4PVwiMTk4XCIgeHNpOnR5cGU9XCJvbWdkYzpQ b2ludFwiIHk9XCIyMDZcIi8+PG9tZ2RpOndheXBvaW50IHg9XCIyNThcIiB4c2k6dHlwZT1cIm9t Z2RjOlBvaW50XCIgeT1cIjIwNlwiLz48YnBtbmRpOkJQTU5MYWJlbD48b21nZGM6Qm91bmRzIGhl aWdodD1cIjEzXCIgd2lkdGg9XCIwXCIgeD1cIjIyOFwiIHk9XCIxODRcIi8+PC9icG1uZGk6QlBN TkxhYmVsPjwvYnBtbmRpOkJQTU5FZGdlPjxicG1uZGk6QlBNTlNoYXBlIGJwbW5FbGVtZW50PVwi RW5kRXZlbnRfMDkzd3N4d1wiIGlkPVwiRW5kRXZlbnRfMDkzd3N4d19kaVwiPjxvbWdkYzpCb3Vu ZHMgaGVpZ2h0PVwiMzZcIiB3aWR0aD1cIjM2XCIgeD1cIjQ0N1wiIHk9XCIxODhcIi8+PGJwbW5k aTpCUE1OTGFiZWw+PG9tZ2RjOkJvdW5kcyBoZWlnaHQ9XCIxM1wiIHdpZHRoPVwiMFwiIHg9XCI0 NjVcIiB5PVwiMjI3XCIvPjwvYnBtbmRpOkJQTU5MYWJlbD48L2JwbW5kaTpCUE1OU2hhcGU+PGJw bW5kaTpCUE1ORWRnZSBicG1uRWxlbWVudD1cIlNlcXVlbmNlRmxvd18wdnByNzl4XCIgaWQ9XCJT ZXF1ZW5jZUZsb3dfMHZwcjc5eF9kaVwiPjxvbWdkaTp3YXlwb2ludCB4PVwiMzU4XCIgeHNpOnR5 cGU9XCJvbWdkYzpQb2ludFwiIHk9XCIyMDZcIi8+PG9tZ2RpOndheXBvaW50IHg9XCI0NDdcIiB4 c2k6dHlwZT1cIm9tZ2RjOlBvaW50XCIgeT1cIjIwNlwiLz48YnBtbmRpOkJQTU5MYWJlbD48b21n ZGM6Qm91bmRzIGhlaWdodD1cIjEzXCIgd2lkdGg9XCIwXCIgeD1cIjQwMi41XCIgeT1cIjE4NFwi Lz48L2JwbW5kaTpCUE1OTGFiZWw+PC9icG1uZGk6QlBNTkVkZ2U+PGJwbW5kaTpCUE1OU2hhcGUg YnBtbkVsZW1lbnQ9XCJUZXh0QW5ub3RhdGlvbl8xb2RteDJ4XCIgaWQ9XCJUZXh0QW5ub3RhdGlv bl8xb2RteDJ4X2RpXCI+PG9tZ2RjOkJvdW5kcyBoZWlnaHQ9XCIzMVwiIHdpZHRoPVwiMTMzXCIg eD1cIjM3NVwiIHk9XCI4M1wiLz48L2JwbW5kaTpCUE1OU2hhcGU+PGJwbW5kaTpCUE1ORWRnZSBi cG1uRWxlbWVudD1cIkFzc29jaWF0aW9uXzFnM2g4bThcIiBpZD1cIkFzc29jaWF0aW9uXzFnM2g4 bThfZGlcIj48b21nZGk6d2F5cG9pbnQgeD1cIjM1MlwiIHhzaTp0eXBlPVwib21nZGM6UG9pbnRc IiB5PVwiMTcwXCIvPjxvbWdkaTp3YXlwb2ludCB4PVwiNDIzXCIgeHNpOnR5cGU9XCJvbWdkYzpQ b2ludFwiIHk9XCIxMTRcIi8+PC9icG1uZGk6QlBNTkVkZ2U+PC9icG1uZGk6QlBNTlBsYW5lPjwv YnBtbmRpOkJQTU5EaWFncmFtPjwvZGVmaW5pdGlvbnM+IiwgInZlcnNpb24iOiAyfSwgImFjdGlv bnMiOiBbXX1dLCAicm9sZXMiOiBbXSwgIndvcmtzcGFjZXMiOiBbXSwgImZ1bmN0aW9ucyI6IFt7 ImlkIjogMjYsICJuYW1lIjogImh0bWwycGRmIiwgImRpc3BsYXlfbmFtZSI6ICJIVE1MMlBERiIs ICJkZXNjcmlwdGlvbiI6IHsiZm9ybWF0IjogInRleHQiLCAiY29udGVudCI6ICJjb252ZXJ0IGh0 bWwgdGV4dCBvciBhIHVybCByZWZlcmVuY2UgdG8gYSBiYXNlNjQgZW5jb2RlZCBwZGYgZG9jdW1l bnQuIn0sICJkZXN0aW5hdGlvbl9oYW5kbGUiOiAiZm5faHRtbDJwZGYiLCAiZXhwb3J0X2tleSI6 ICJodG1sMnBkZiIsICJ1dWlkIjogIjNmOTI4ZWFmLTExMTYtNGM4OS1hNmUyLWZlYzE5MThiNWRi YSIsICJ2ZXJzaW9uIjogMSwgImNyZWF0b3IiOiB7ImlkIjogMywgInR5cGUiOiAidXNlciIsICJu YW1lIjogImJAYS5jb20iLCAiZGlzcGxheV9uYW1lIjogIlJlc2lsaWVudCBTeXNhZG1pbiJ9LCAi bGFzdF9tb2RpZmllZF9ieSI6IHsiaWQiOiAzLCAidHlwZSI6ICJ1c2VyIiwgIm5hbWUiOiAiYkBh LmNvbSIsICJkaXNwbGF5X25hbWUiOiAiUmVzaWxpZW50IFN5c2FkbWluIn0sICJsYXN0X21vZGlm aWVkX3RpbWUiOiAxNTM3MjA4Mjk5OTgxLCAidmlld19pdGVtcyI6IFt7InN0ZXBfbGFiZWwiOiBu dWxsLCAic2hvd19pZiI6IG51bGwsICJlbGVtZW50IjogImZpZWxkX3V1aWQiLCAiZmllbGRfdHlw ZSI6ICJfX2Z1bmN0aW9uIiwgImNvbnRlbnQiOiAiOWQwZTI4ODctOTFiYy00NWVjLTgzMWYtYjUx OTk2ZTAxZmE2IiwgInNob3dfbGlua19oZWFkZXIiOiBmYWxzZX0sIHsic3RlcF9sYWJlbCI6IG51 bGwsICJzaG93X2lmIjogbnVsbCwgImVsZW1lbnQiOiAiZmllbGRfdXVpZCIsICJmaWVsZF90eXBl IjogIl9fZnVuY3Rpb24iLCAiY29udGVudCI6ICIyMWFjMmFjMC1hYmM5LTQ4NWEtYTY2ZS01YWI2 ODA0MTViNDAiLCAic2hvd19saW5rX2hlYWRlciI6IGZhbHNlfSwgeyJzdGVwX2xhYmVsIjogbnVs bCwgInNob3dfaWYiOiBudWxsLCAiZWxlbWVudCI6ICJmaWVsZF91dWlkIiwgImZpZWxkX3R5cGUi OiAiX19mdW5jdGlvbiIsICJjb250ZW50IjogIjNiMDFkNjFmLWNkOTMtNDdkNy1hYjRhLWIzMmMy YjhlMWJmYSIsICJzaG93X2xpbmtfaGVhZGVyIjogZmFsc2V9XSwgIndvcmtmbG93cyI6IFt7Indv cmtmbG93X2lkIjogMjIsICJuYW1lIjogIkV4YW1wbGU6IEhUTUwyUERGIiwgInByb2dyYW1tYXRp Y19uYW1lIjogImV4YW1wbGVfaHRtbDJwZGYiLCAib2JqZWN0X3R5cGUiOiAiYXJ0aWZhY3QiLCAi ZGVzY3JpcHRpb24iOiBudWxsLCAidXVpZCI6IG51bGwsICJhY3Rpb25zIjogW119XX1dfQ== """ )
68.948837
87
0.968025
284
14,824
50.478873
0.915493
0.001395
0
0
0
0
0
0
0
0
0
0.122664
0.025499
14,824
214
88
69.271028
0.869722
0.031503
0
0.010582
1
0
0.98373
0.970882
0
1
0
0
0
1
0.005291
false
0
0.015873
0
0.021164
0.005291
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
null
1
0
0
0
0
0
0
0
0
0
0
0
0
5
a208c1ab81f06a501fc4be4cc5236ea278f84a39
29
py
Python
base/__init__.py
MattTitmas/AdventOfCode
36be4f6bf973f77ff93b08dc69c977bb11951f27
[ "MIT" ]
null
null
null
base/__init__.py
MattTitmas/AdventOfCode
36be4f6bf973f77ff93b08dc69c977bb11951f27
[ "MIT" ]
null
null
null
base/__init__.py
MattTitmas/AdventOfCode
36be4f6bf973f77ff93b08dc69c977bb11951f27
[ "MIT" ]
null
null
null
from .base_day import BaseDay
29
29
0.862069
5
29
4.8
1
0
0
0
0
0
0
0
0
0
0
0
0.103448
29
1
29
29
0.923077
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
bf5bf15a25e816b94cdfbee417e58c162f8ae277
1,071
py
Python
test/test_variables_group_update_dto.py
OpenSILEX/opensilexClientToolsPython
41b1e7e707670ecf1b2c06d79bdd9749945788cb
[ "RSA-MD" ]
null
null
null
test/test_variables_group_update_dto.py
OpenSILEX/opensilexClientToolsPython
41b1e7e707670ecf1b2c06d79bdd9749945788cb
[ "RSA-MD" ]
7
2021-05-25T14:06:04.000Z
2021-11-05T15:42:14.000Z
test/test_variables_group_update_dto.py
OpenSILEX/opensilexClientToolsPython
41b1e7e707670ecf1b2c06d79bdd9749945788cb
[ "RSA-MD" ]
null
null
null
# coding: utf-8 """ OpenSilex API No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: INSTANCE-SNAPSHOT Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import opensilexClientToolsPython from opensilexClientToolsPython.models.variables_group_update_dto import VariablesGroupUpdateDTO # noqa: E501 from opensilexClientToolsPython.rest import ApiException class TestVariablesGroupUpdateDTO(unittest.TestCase): """VariablesGroupUpdateDTO unit test stubs""" def setUp(self): pass def tearDown(self): pass def testVariablesGroupUpdateDTO(self): """Test VariablesGroupUpdateDTO""" # FIXME: construct object with mandatory attributes with example values # model = opensilexClientToolsPython.models.variables_group_update_dto.VariablesGroupUpdateDTO() # noqa: E501 pass if __name__ == '__main__': unittest.main()
26.121951
119
0.746965
107
1,071
7.299065
0.560748
0.053777
0.035851
0.053777
0.238156
0.238156
0.097311
0
0
0
0
0.011338
0.176471
1,071
40
120
26.775
0.87415
0.47619
0
0.214286
1
0
0.015414
0
0
0
0
0.025
0
1
0.214286
false
0.214286
0.357143
0
0.642857
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
1
0
0
1
0
1
1
0
0
0
0
5
bf60f2f62b106d13b769bcab71f6c572f479fb8d
152
py
Python
ex13a.py
arunkumarang/python
1960e285dfe2ef54d2e3ab37584bfef8b24ecca9
[ "Apache-2.0" ]
null
null
null
ex13a.py
arunkumarang/python
1960e285dfe2ef54d2e3ab37584bfef8b24ecca9
[ "Apache-2.0" ]
null
null
null
ex13a.py
arunkumarang/python
1960e285dfe2ef54d2e3ab37584bfef8b24ecca9
[ "Apache-2.0" ]
null
null
null
from sys import argv script, name, dob = argv #print "Your Application:", script print "Your Name: Mr/Mrs/Ms.", name print "Your Date of birth:", dob
19
35
0.703947
25
152
4.28
0.64
0.252336
0
0
0
0
0
0
0
0
0
0
0.171053
152
7
36
21.714286
0.849206
0.217105
0
0
0
0
0.338983
0
0
0
0
0
0
0
null
null
0
0.25
null
null
0.5
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
5
bf6f3f148cd5b4889df77edf5f1ed4d374a73fa7
139
py
Python
groklog/filter_manager/__init__.py
apockill/groklog
3d7de51086851fc68dba6ae77aafd3e5274549c7
[ "MIT" ]
2
2021-07-15T02:18:56.000Z
2022-02-01T19:33:34.000Z
groklog/filter_manager/__init__.py
apockill/groklog
3d7de51086851fc68dba6ae77aafd3e5274549c7
[ "MIT" ]
1
2022-03-08T23:24:00.000Z
2022-03-08T23:24:00.000Z
groklog/filter_manager/__init__.py
apockill/groklog
3d7de51086851fc68dba6ae77aafd3e5274549c7
[ "MIT" ]
null
null
null
from .exceptions import DuplicateFilterError, FilterError, FilterNotFoundError from .filter_manager import ROOT_FILTER_NAME, FilterManager
46.333333
78
0.884892
14
139
8.571429
0.785714
0
0
0
0
0
0
0
0
0
0
0
0.079137
139
2
79
69.5
0.9375
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
bfb93391c82389262270b8d04437ed7202d0f0bd
4,045
py
Python
posts/api/views.py
nishant-sachdeva/pause
4d149922816413fa5c06e2afe6bd7000aff110b8
[ "MIT" ]
null
null
null
posts/api/views.py
nishant-sachdeva/pause
4d149922816413fa5c06e2afe6bd7000aff110b8
[ "MIT" ]
null
null
null
posts/api/views.py
nishant-sachdeva/pause
4d149922816413fa5c06e2afe6bd7000aff110b8
[ "MIT" ]
1
2021-05-26T14:19:26.000Z
2021-05-26T14:19:26.000Z
from rest_framework.response import Response from login.api.serializers import RegistrationSerializer from rest_framework.authtoken.models import Token from rest_framework import status from login import models from rest_framework.views import APIView from django.contrib.auth.models import User from posts.models import Post from posts.api.serializers import PostSerializer from posts.api.permissions import PostWriterOrAdminOrReadOnly class CreatPostAV(APIView): permission_classes = [PostWriterOrAdminOrReadOnly] def post(self, request): # here we have to make a new post for the user username = request.data.get('username') try: user_object = User.objects.get(username=username) except: return Response({"detail" : "User does not exists"}, status=status.HTTP_400_BAD_REQUEST) data = request.data.copy() data['username'] = user_object.pk serializer = PostSerializer(data = data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_200_OK) else: return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) class PostListAV(APIView): permission_classes = [PostWriterOrAdminOrReadOnly] def post(self, request): username = request.data.get('username') try: user_object = User.objects.get(username=username) except: return Response({"detail" : "User does not exists"}, status=status.HTTP_400_BAD_REQUEST) # so we have the user, so, get all posts for the username try: post_list = Post.objects.filter(username=user_object.pk) serializer = PostSerializer(post_list, many=True) return Response(serializer.data, status=status.HTTP_200_OK) except: return Response({"detail" : "Post not found"}, status=status.HTTP_400_BAD_REQUEST) class PostDetailAV(APIView): permission_classes = [PostWriterOrAdminOrReadOnly] def post(self,request): username = request.data.get('username') post_id = request.data.get('post_id') try: user_object = User.objects.get(username=username) except: return Response({"detail" : "User does not exists"}, status=status.HTTP_400_BAD_REQUEST) try: post_object = Post.objects.get(post_id=post_id) except: return Response({"detail" : "Post does not exist"}, status=status.HTTP_400_BAD_REQUEST) self.check_object_permissions(request, post_object) try: serializer = PostSerializer(post_object) return Response(serializer.data, status=status.HTTP_200_OK) except: return Response(serializer.error, status=status.HTTP_400_BAD_REQUEST) def put(self, request): username = request.data.get('username') post_id = request.data.get('post_id') try: user_object = User.objects.get(username=username) except: return Response({"detail" : "User does not exists"}, status=status.HTTP_400_BAD_REQUEST) try: post_object = Post.objects.get(post_id=post_id) except: return Response({"detail" : "Post does not exist"}, status=status.HTTP_400_BAD_REQUEST) self.check_object_permissions(request, post_object) data = request.data.copy() data['username'] = user_object.pk serializer = PostSerializer(post_object, data=data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_200_OK) else: return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) def delete(self, request): username = request.data.get('username') post_id = request.data.get('post_id') try: user_object = User.objects.get(username=username) except: return Response({"detail" : "User does not exists"}, status=status.HTTP_400_BAD_REQUEST) try: post_object = Post.objects.get(post_id=post_id) except: return Response({"detail" : "Post does not exist"}, status=status.HTTP_400_BAD_REQUEST) self.check_object_permissions(request, post_object) try: post_object.delete() return Response({"detail" : "post deleted"}, status=status.HTTP_200_OK) except: return Response({"detail" : "Could not delete"}, status=status.HTTP_400_BAD_REQUEST)
28.687943
91
0.753523
538
4,045
5.488848
0.154275
0.085337
0.097528
0.083644
0.774467
0.773112
0.763292
0.720623
0.697257
0.679309
0
0.015513
0.139431
4,045
141
92
28.687943
0.832807
0.024969
0
0.739583
0
0
0.086758
0
0
0
0
0
0
1
0.052083
false
0
0.104167
0
0.40625
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
44d1a825d597266e76dce8f2ca15cac08f5bcb7c
74
py
Python
pyrigate/utils/__init__.py
pyrigate/pyrigate
366e33ef46ebc7928cf35f2d51ed0855c59d1a68
[ "MIT" ]
1
2018-02-03T23:22:20.000Z
2018-02-03T23:22:20.000Z
pyrigate/utils/__init__.py
pyrigate/pyrigate
366e33ef46ebc7928cf35f2d51ed0855c59d1a68
[ "MIT" ]
1
2018-05-12T13:55:01.000Z
2018-05-13T00:16:23.000Z
pyrigate/utils/__init__.py
pyrigate/pyrigate
366e33ef46ebc7928cf35f2d51ed0855c59d1a68
[ "MIT" ]
1
2019-10-18T12:23:02.000Z
2019-10-18T12:23:02.000Z
from .printing import print_dict, print_list, print_columns # noqa: F401
37
73
0.797297
11
74
5.090909
0.818182
0
0
0
0
0
0
0
0
0
0
0.046875
0.135135
74
1
74
74
0.828125
0.135135
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
1
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
1
0
5
44e6a269ad74f7d54605ec4a03f0ddf99db408c8
45
py
Python
info/modules/__init__.py
m17630030204/flask_project
b3810a8ba56781061e91a61422581c48aaebf57e
[ "MIT" ]
null
null
null
info/modules/__init__.py
m17630030204/flask_project
b3810a8ba56781061e91a61422581c48aaebf57e
[ "MIT" ]
4
2021-03-18T21:48:16.000Z
2022-03-11T23:37:14.000Z
info/modules/__init__.py
m17630030204/flask_project
b3810a8ba56781061e91a61422581c48aaebf57e
[ "MIT" ]
null
null
null
# 该模块是用于保存当前项目所有的业务逻辑模块,比如首页,新闻详情页,个人中心,后天管理q
45
45
0.866667
5
45
7.8
1
0
0
0
0
0
0
0
0
0
0
0
0.022222
45
1
45
45
0.886364
0.955556
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
781a63ff3f57acfbbb5a48bb5bd453d08a83e3d9
2,811
py
Python
ch20/EmulateZipMap.py
eroicaleo/LearningPython
297d46eddce6e43ce0c160d2660dff5f5d616800
[ "MIT" ]
1
2020-10-12T13:33:29.000Z
2020-10-12T13:33:29.000Z
ch20/EmulateZipMap.py
eroicaleo/LearningPython
297d46eddce6e43ce0c160d2660dff5f5d616800
[ "MIT" ]
null
null
null
ch20/EmulateZipMap.py
eroicaleo/LearningPython
297d46eddce6e43ce0c160d2660dff5f5d616800
[ "MIT" ]
1
2016-11-09T07:28:45.000Z
2016-11-09T07:28:45.000Z
#!/usr/bin/python3.3 S1 = 'abc' S2 = 'xyz123' z = zip(S1, S2) print(list(z)) print(list(zip([1, 2, 3], [2, 3, 4, 5]))) print(list(map(abs, [-2, -1, 0, 1, 2]))) print(list(map(pow, [1, 2, 3], [2, 3, 4, 5]))) print(list(map(lambda x, y: x+y, open('script2.py'), open('script2.py')))) print([x+y for (x, y) in zip(open('script2.py'), open('script2.py'))]) def mymap(func, *seqs): res = [] for x in zip(*seqs): res.append(func(*x)) return res print(list(mymap(abs, [-2, -1, 0, 1, 2]))) print(list(mymap(pow, [1, 2, 3], [2, 3, 4, 5]))) def mymap(func, *seqs): return [func(*x) for x in zip(*seqs)] print(list(mymap(abs, [-2, -1, 0, 1, 2]))) print(list(mymap(pow, [1, 2, 3], [2, 3, 4, 5]))) def mymap(func, *seqs): return (func(*x) for x in zip(*seqs)) print(list(mymap(abs, [-2, -1, 0, 1, 2]))) print(list(mymap(pow, [1, 2, 3], [2, 3, 4, 5]))) def mymap(func, *seqs): for x in zip(*seqs): yield func(*x) print(list(mymap(abs, [-2, -1, 0, 1, 2]))) print(list(mymap(pow, [1, 2, 3], [2, 3, 4, 5]))) def myzip(*seq): res = [] seqs = [list(S) for S in seq] while all(seqs): res.append(tuple(S.pop(0) for S in seqs)) return res print(list(myzip([1, 2, 3], [2, 3, 4, 5]))) print([x+y for (x, y) in zip(open('script2.py'), open('script2.py'))]) def mymappad(*seq, pad=None): res = [] seqs = [list(S) for S in seq] while any(seqs): res.append(tuple((S.pop(0) if S else pad) for S in seqs)) return res print(mymappad(S1, S2, pad=99)) print(mymappad(S1, S2)) def myzip(*seq): seqs = [list(S) for S in seq] while all(seqs): yield tuple(S.pop(0) for S in seqs) print(list(myzip([1, 2, 3], [2, 3, 4, 5]))) print([x+y for (x, y) in myzip(open('script2.py'), open('script2.py'))]) def mymappad(*seq, pad=None): seqs = [list(S) for S in seq] while any(seqs): yield tuple((S.pop(0) if S else pad) for S in seqs) print(list(mymappad(S1, S2, pad=99))) print(list(mymappad(S1, S2))) def myzip(*seq): minlen = min(len(S) for S in seq) return [tuple(S[i] for S in seq) for i in range(minlen)] print(list(myzip([1, 2, 3], [2, 3, 4, 5]))) def mymappad(*seq, pad=None): maxlen = max(len(S) for S in seq) return [tuple(S[i] if i < len(S) else pad for S in seq) for i in range(maxlen)] print(list(mymappad(S1, S2, pad=99))) print(list(mymappad(S1, S2))) def myzip(*seq): minlen = min(len(S) for S in seq) return (tuple(S[i] for S in seq) for i in range(minlen)) print(list(myzip([1, 2, 3], [2, 3, 4, 5]))) def myzip(*seq): iters = list(map(iter, seq)) i = 0 while iters: i = i+1 print(i) res = [next(i) for i in iters] print(bool(iters)) yield tuple(res) print('lala') print(list(myzip([1, 2, 3], [2, 3, 4, 5])))
23.822034
83
0.55603
537
2,811
2.910615
0.115456
0.126679
0.053743
0.028151
0.846449
0.818298
0.761356
0.735125
0.683941
0.680102
0
0.065059
0.218072
2,811
117
84
24.025641
0.646042
0.006759
0
0.604938
0
0
0.033333
0
0
0
0
0
0
1
0.148148
false
0
0
0.024691
0.246914
0.37037
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
781c48daadaa4ebc55dbe1ed19ed692f0e6746a9
94
py
Python
certidude/api/utils/__init__.py
Korving-F/certidude
6e50c85c8587d3e800d01ce1d1588965c29b2c46
[ "MIT" ]
119
2015-07-12T20:04:30.000Z
2021-11-24T17:25:33.000Z
certidude/api/utils/__init__.py
Korving-F/certidude
6e50c85c8587d3e800d01ce1d1588965c29b2c46
[ "MIT" ]
60
2015-07-27T06:43:08.000Z
2021-02-03T04:13:05.000Z
certidude/api/utils/__init__.py
Korving-F/certidude
6e50c85c8587d3e800d01ce1d1588965c29b2c46
[ "MIT" ]
36
2015-07-30T00:09:02.000Z
2022-01-27T18:00:07.000Z
class AuthorityHandler: def __init__(self, authority): self.authority = authority
23.5
34
0.712766
9
94
7
0.666667
0.412698
0
0
0
0
0
0
0
0
0
0
0.212766
94
3
35
31.333333
0.851351
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
5
784b36fe0394d9acc970d2ceb450b722ba5aed5a
280
py
Python
ETCetera/exceptions/nonlinear_systems_exceptions/LP_exceptions.py
ggleizer/ETCetera
8fa9f3c82fd1944507a0c02d52a236244821f3ca
[ "MIT" ]
null
null
null
ETCetera/exceptions/nonlinear_systems_exceptions/LP_exceptions.py
ggleizer/ETCetera
8fa9f3c82fd1944507a0c02d52a236244821f3ca
[ "MIT" ]
null
null
null
ETCetera/exceptions/nonlinear_systems_exceptions/LP_exceptions.py
ggleizer/ETCetera
8fa9f3c82fd1944507a0c02d52a236244821f3ca
[ "MIT" ]
1
2022-03-11T11:15:20.000Z
2022-03-11T11:15:20.000Z
class LPGeneralException(Exception): """Raised when generic exceptions when using 'LPData' class""" def __init__(self, msg): self.msg = msg class LPOptimizationFailedException(Exception): """Raised when optimization fails when using LPData class""" pass
28
66
0.717857
30
280
6.566667
0.566667
0.152284
0.192893
0.203046
0
0
0
0
0
0
0
0
0.189286
280
9
67
31.111111
0.867841
0.396429
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0.2
0
0
0.6
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
5
784bbfde5525fb086fe7287922a911fb4e29f4c3
235
py
Python
rexfw/test/cases/proposers/params.py
simeoncarstens/rexfw
b31e17a77767cd1357407a0343fb74d9c3247b16
[ "Unlicense", "MIT" ]
null
null
null
rexfw/test/cases/proposers/params.py
simeoncarstens/rexfw
b31e17a77767cd1357407a0343fb74d9c3247b16
[ "Unlicense", "MIT" ]
7
2021-01-22T13:37:49.000Z
2021-03-05T15:27:44.000Z
rexfw/test/cases/proposers/params.py
tweag/rexfw
b31e17a77767cd1357407a0343fb74d9c3247b16
[ "Unlicense", "MIT" ]
1
2021-01-07T14:37:22.000Z
2021-01-07T14:37:22.000Z
''' ''' from rexfw.proposers.params import AbstractProposerParams class MockProposerParams(AbstractProposerParams): def __init__(self): self.reverse_events = 0 def reverse(self): self.reverse_events += 1
14.6875
57
0.697872
23
235
6.869565
0.652174
0.101266
0.189873
0.265823
0
0
0
0
0
0
0
0.010753
0.208511
235
15
58
15.666667
0.83871
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.166667
0
0.666667
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
5
78a564ce5a42df6154fe0bb1b2c9bf6485415b96
18,204
py
Python
models/develset/src/utils/levelset_utils.py
phdyang007/pytorch-CycleGAN-and-pix2pix
8057392a37d47a17ac0e8f7cc4642bec86bf2e43
[ "BSD-3-Clause" ]
1
2022-01-26T00:45:06.000Z
2022-01-26T00:45:06.000Z
models/develset/src/utils/levelset_utils.py
phdyang007/pytorch-CycleGAN-and-pix2pix
8057392a37d47a17ac0e8f7cc4642bec86bf2e43
[ "BSD-3-Clause" ]
null
null
null
models/develset/src/utils/levelset_utils.py
phdyang007/pytorch-CycleGAN-and-pix2pix
8057392a37d47a17ac0e8f7cc4642bec86bf2e43
[ "BSD-3-Clause" ]
null
null
null
''' Author: Guojin Chen @ CUHK-CSE Homepage: https://dekura.github.io/ Date: 2020-12-25 17:52:17 LastEditTime: 2021-04-16 13:14:40 Contact: cgjhaha@qq.com Description: the utils to calculate levelset parameters Input: target Output: levelset params ''' import os import sys sys.path.append('/home/guojin/projects/develset_opc/levelset_net') import time import torch import numpy as np from PIL import Image import torch.nn as nn import torch.nn.functional as F from src.models.const import * from src.utils.unit_tests.test_case1 import * import torchvision.transforms as transforms ''' t2boudry_lines: use only cpu, because cpu is fast enough ''' def t2boudry_lines(target, device): target = target.to(device) boundary = torch.zeros(target.shape).to(device) corner = torch.zeros(target.shape).to(device) vertical = torch.zeros(target.shape).to(device) horizontal = torch.zeros(target.shape).to(device) site_bool1 = target[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X]==1 site_bool2 = [ target[:, :, LITHOSIM_OFFSET-1:MASK_TILE_END_Y-1, LITHOSIM_OFFSET:MASK_TILE_END_X] == 1, target[:, :, LITHOSIM_OFFSET+1:MASK_TILE_END_Y+1, LITHOSIM_OFFSET:MASK_TILE_END_X] == 1, target[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET-1:MASK_TILE_END_X-1] == 1, target[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET+1:MASK_TILE_END_X+1] == 1, target[:, :, LITHOSIM_OFFSET-1:MASK_TILE_END_Y-1, LITHOSIM_OFFSET-1:MASK_TILE_END_X-1] ==1, target[:, :, LITHOSIM_OFFSET-1:MASK_TILE_END_Y-1, LITHOSIM_OFFSET+1:MASK_TILE_END_X+1] ==1, target[:, :, LITHOSIM_OFFSET+1:MASK_TILE_END_Y+1, LITHOSIM_OFFSET-1:MASK_TILE_END_X-1] ==1, target[:, :, LITHOSIM_OFFSET+1:MASK_TILE_END_Y+1, LITHOSIM_OFFSET+1:MASK_TILE_END_X+1] ==1, ] site_0 = torch.stack(site_bool2,axis = 4).all(axis=4) site_bool1[site_0] = 0 boundary[:,:,LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X] = site_bool1 b_c = boundary[:,:,LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X]==1 b_d = boundary[:, :, LITHOSIM_OFFSET-1:MASK_TILE_END_Y-1, LITHOSIM_OFFSET:MASK_TILE_END_X] == 1 b_u = boundary[:, :, LITHOSIM_OFFSET+1:MASK_TILE_END_Y+1, LITHOSIM_OFFSET:MASK_TILE_END_X] == 1 b_l = boundary[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET-1:MASK_TILE_END_X-1] == 1 b_r = boundary[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET+1:MASK_TILE_END_X+1] == 1 #vertical vertical[:,:,LITHOSIM_OFFSET:MASK_TILE_END_Y,LITHOSIM_OFFSET:MASK_TILE_END_X] = b_c vertical[:,:,LITHOSIM_OFFSET:MASK_TILE_END_Y,LITHOSIM_OFFSET:MASK_TILE_END_X][b_l & b_r]=0 v_site = vertical.nonzero() if torch.cuda.is_available(): ind_tmp_v = np.lexsort((v_site[:,2].cpu().numpy(), v_site[:,3].cpu().numpy())) ind_tmp_v = torch.from_numpy(ind_tmp_v).to(device) else: ind_tmp_v = np.lexsort((v_site[:,2].numpy(), v_site[:,3].numpy())) v_site = v_site[ind_tmp_v] tmp_v_start = torch.cat((torch.tensor([True]).to(device), v_site[:,2][1:]!=v_site[:,2][:-1]+1)) tmp_v_end = torch.cat((v_site[:,2][1:]!=v_site[:,2][:-1]+1, torch.tensor([True]).to(device))) start_p_v = v_site[(tmp_v_start==True).nonzero()[:,0],:] end_p_v = v_site[(tmp_v_end==True).nonzero()[:,0],:] p_v = torch.stack((v_site[(tmp_v_start==True).nonzero()[:,0],:], v_site[(tmp_v_end==True).nonzero()[:,0],:]), axis = 2) #horizontal horizontal[:,:,LITHOSIM_OFFSET:MASK_TILE_END_Y,LITHOSIM_OFFSET:MASK_TILE_END_X] = b_c horizontal[:,:,LITHOSIM_OFFSET:MASK_TILE_END_Y,LITHOSIM_OFFSET:MASK_TILE_END_X][b_u&b_d]=0 h_site = horizontal.nonzero() if torch.cuda.is_available(): ind_tmp_h = np.lexsort((h_site[:,3].cpu().numpy(), h_site[:,2].cpu().numpy())) ind_tmp_h = torch.from_numpy(ind_tmp_h).to(device) else: ind_tmp_h = np.lexsort((h_site[:,3].numpy(), h_site[:,2].numpy())) h_site = h_site[ind_tmp_h] tmp_h_start = torch.cat((torch.tensor([True]).to(device), h_site[:,3][1:]!=h_site[:,3][:-1]+1)) tmp_h_end = torch.cat((h_site[:,3][1:]!=h_site[:,3][:-1]+1, torch.tensor([True]).to(device))) start_p_h = h_site[(tmp_h_start==True).nonzero()[:,0],:] end_p_h = h_site[(tmp_h_end==True).nonzero()[:,0],:] p_h = torch.stack((h_site[(tmp_h_start==True).nonzero()[:,0],:], h_site[(tmp_h_end==True).nonzero()[:,0],:]), axis = 2) return p_v.float(), p_h.float() ''' t2boudry_lines: use only cpu, because cpu is fast enough ''' def t2boudry_lines_cpu(target, device): device = torch.device('cpu') target = target.to(device) boundary = torch.zeros(target.shape).to(device) corner = torch.zeros(target.shape).to(device) vertical = torch.zeros(target.shape).to(device) horizontal = torch.zeros(target.shape).to(device) site_bool1 = target[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X]==1 site_bool2 = [ target[:, :, LITHOSIM_OFFSET-1:MASK_TILE_END_Y-1, LITHOSIM_OFFSET:MASK_TILE_END_X] == 1, target[:, :, LITHOSIM_OFFSET+1:MASK_TILE_END_Y+1, LITHOSIM_OFFSET:MASK_TILE_END_X] == 1, target[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET-1:MASK_TILE_END_X-1] == 1, target[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET+1:MASK_TILE_END_X+1] == 1, target[:, :, LITHOSIM_OFFSET-1:MASK_TILE_END_Y-1, LITHOSIM_OFFSET-1:MASK_TILE_END_X-1] ==1, target[:, :, LITHOSIM_OFFSET-1:MASK_TILE_END_Y-1, LITHOSIM_OFFSET+1:MASK_TILE_END_X+1] ==1, target[:, :, LITHOSIM_OFFSET+1:MASK_TILE_END_Y+1, LITHOSIM_OFFSET-1:MASK_TILE_END_X-1] ==1, target[:, :, LITHOSIM_OFFSET+1:MASK_TILE_END_Y+1, LITHOSIM_OFFSET+1:MASK_TILE_END_X+1] ==1, ] site_0 = torch.stack(site_bool2,axis = 4).all(axis=4) site_bool1[site_0] = 0 boundary[:,:,LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X] = site_bool1 b_c = boundary[:,:,LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X]==1 b_d = boundary[:, :, LITHOSIM_OFFSET-1:MASK_TILE_END_Y-1, LITHOSIM_OFFSET:MASK_TILE_END_X] == 1 b_u = boundary[:, :, LITHOSIM_OFFSET+1:MASK_TILE_END_Y+1, LITHOSIM_OFFSET:MASK_TILE_END_X] == 1 b_l = boundary[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET-1:MASK_TILE_END_X-1] == 1 b_r = boundary[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET+1:MASK_TILE_END_X+1] == 1 #vertical vertical[:,:,LITHOSIM_OFFSET:MASK_TILE_END_Y,LITHOSIM_OFFSET:MASK_TILE_END_X] = b_c vertical[:,:,LITHOSIM_OFFSET:MASK_TILE_END_Y,LITHOSIM_OFFSET:MASK_TILE_END_X][b_l & b_r]=0 v_site = vertical.nonzero() # if torch.cuda.is_available(): # ind_tmp_v = np.lexsort((v_site[:,2].cpu().numpy(), v_site[:,3].cpu().numpy())) # ind_tmp_v = torch.from_numpy(ind_tmp_v).to(device) # else: ind_tmp_v = np.lexsort((v_site[:,2].numpy(), v_site[:,3].numpy())) v_site = v_site[ind_tmp_v] tmp_v_start = torch.cat((torch.tensor([True]).to(device), v_site[:,2][1:]!=v_site[:,2][:-1]+1)) tmp_v_end = torch.cat((v_site[:,2][1:]!=v_site[:,2][:-1]+1, torch.tensor([True]).to(device))) start_p_v = v_site[(tmp_v_start==True).nonzero()[:,0],:] end_p_v = v_site[(tmp_v_end==True).nonzero()[:,0],:] p_v = torch.stack((v_site[(tmp_v_start==True).nonzero()[:,0],:], v_site[(tmp_v_end==True).nonzero()[:,0],:]), axis = 2) #horizontal horizontal[:,:,LITHOSIM_OFFSET:MASK_TILE_END_Y,LITHOSIM_OFFSET:MASK_TILE_END_X] = b_c horizontal[:,:,LITHOSIM_OFFSET:MASK_TILE_END_Y,LITHOSIM_OFFSET:MASK_TILE_END_X][b_u&b_d]=0 h_site = horizontal.nonzero() # if torch.cuda.is_available(): # ind_tmp_h = np.lexsort((h_site[:,3].cpu().numpy(), h_site[:,2].cpu().numpy())) # ind_tmp_h = torch.from_numpy(ind_tmp_h).to(device) # else: ind_tmp_h = np.lexsort((h_site[:,3].numpy(), h_site[:,2].numpy())) h_site = h_site[ind_tmp_h] tmp_h_start = torch.cat((torch.tensor([True]).to(device), h_site[:,3][1:]!=h_site[:,3][:-1]+1)) tmp_h_end = torch.cat((h_site[:,3][1:]!=h_site[:,3][:-1]+1, torch.tensor([True]).to(device))) start_p_h = h_site[(tmp_h_start==True).nonzero()[:,0],:] end_p_h = h_site[(tmp_h_end==True).nonzero()[:,0],:] p_h = torch.stack((h_site[(tmp_h_start==True).nonzero()[:,0],:], h_site[(tmp_h_end==True).nonzero()[:,0],:]), axis = 2) return p_v.float(), p_h.float() ''' target: torch.tensor ''' def t2lsparams(p_v, p_h, target, device): # def __initlevelset_lines(p_v, p_h, target): p_v = p_v.to(device) p_h = p_h.to(device) target = target.to(device) levelset = torch.zeros(target.shape).to(device) levelset = levelset + 2048 x,y = torch.meshgrid(torch.arange(target.shape[2]).to(device),torch.arange(target.shape[3]).to(device)) coord_2d = torch.stack((x,y), axis = 2) # (2048, 2048, 2) part_2d = coord_2d[LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X, :].flatten(start_dim=0,end_dim=1).float() #(1280*1280,2)(y,x) #vertical distance_v = torch.zeros(part_2d.shape[0], p_v.shape[0]).to(device) #(1280*1280,N_v) for i in range(p_v.shape[0]): #start_p = p_v[i,[2,3],0], end_p =p_v[i,[2,3],1] ind0 = (part_2d[:,1] != p_v[i,3,0]) & ((part_2d[:,0] < p_v[i,2,0]) | (part_2d[:,0] > p_v[i,2,1])) distance_v[ind0,i] = torch.min(torch.sqrt((p_v[i,2,0] - part_2d[ind0,0]) **2+(p_v[i,3,0] - part_2d[ind0,1]) **2), torch.sqrt((p_v[i,2,1] - part_2d[ind0,0]) **2+(p_v[i,3,1] - part_2d[ind0,1]) **2)) ind1 = (part_2d[:,1] == p_v[i,3,0]) & (part_2d[:,0] >= p_v[i,2,0]) & (part_2d[:,0] <= p_v[i,2,1]) distance_v[ind1,i] = 0 ind2 = (part_2d[:,1] == p_v[i,3,0]) & ((part_2d[:,0] < p_v[i,2,0]) | (part_2d[:,0] > p_v[i,2,1])) distance_v[ind2,i] = torch.min( torch.abs(part_2d[ind2,0] - p_v[i,2,0]) , torch.abs(part_2d[ind2,0] - p_v[i,2,1]) ) ind3 = (part_2d[:,1] != p_v[i,3,0]) & (part_2d[:,0] >= p_v[i,2,0]) & (part_2d[:,0] <= p_v[i,2,1]) distance_v[ind3,i] = torch.abs(part_2d[ind3,1]-p_v[i,3,0]) #horizontal distance_h = torch.zeros(part_2d.shape[0], p_h.shape[0]).to(device)#(14*14,N_h) for i in range(p_h.shape[0]): ind0 = (part_2d[:,0] != p_h[i,2,0]) & ((part_2d[:,1] < p_h[i,3,0]) | (part_2d[:,1] > p_h[i,3,1])) distance_h[ind0,i] = torch.min(torch.sqrt((p_h[i,2,0] - part_2d[ind0,0]) **2 + (p_h[i,3,0] - part_2d[ind0,1]) **2), torch.sqrt((p_h[i,2,1] - part_2d[ind0,0]) **2+(p_h[i,3,1] - part_2d[ind0,1]) **2)) ind1 = (part_2d[:,0] == p_h[i,2,0]) & (part_2d[:,1] >= p_h[i,3,0]) & (part_2d[:,1] <= p_h[i,3,1]) distance_h[ind1,i] = 0 ind2 = (part_2d[:,0] == p_h[i,2,0]) & ((part_2d[:,1] < p_h[i,3,0]) | (part_2d[:,1] > p_h[i,3,1])) distance_h[ind2,i] = torch.min( torch.abs(part_2d[ind2,1] - p_h[i,3,0]), torch.abs(part_2d[ind2,1] - p_h[i,3,1]) ) ind3 = (part_2d[:,0] != p_h[i,2,0]) & (part_2d[:,1] >= p_h[i,3,0]) & (part_2d[:,1] <= p_h[i,3,1]) distance_h[ind3,i] = torch.abs(part_2d[ind3,0] - p_h[i,2,0]) #the following procedure only satisfies: batch = channel =1! distance = torch.min(distance_v.min(axis =1)[0], distance_h.min(axis=1)[0]).reshape(MASK_TILE_END_Y-LITHOSIM_OFFSET, MASK_TILE_END_X-LITHOSIM_OFFSET) levelset[0,0,LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X] = distance ind_inner = target==1 levelset[ind_inner] = -levelset[ind_inner] # use truncated signed distance function. levelset[torch.where(levelset > UP_TRUNCATED_D)] = UP_TRUNCATED_D levelset[torch.where(levelset < DOWN_TRUNCATED_D)] = DOWN_TRUNCATED_D return levelset def truncated_ls(levelset): levelset[torch.where(levelset > UP_TRUNCATED_D)] = UP_TRUNCATED_D levelset[torch.where(levelset < DOWN_TRUNCATED_D)] = DOWN_TRUNCATED_D return levelset def ls2npy(ls): ls = ls[:, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X] ls_npy = ls.cpu().detach().numpy() return ls_npy # ls_npz = np.savez_compressed() def ls2gray(ls): a = 1 / (UP_TRUNCATED_D - DOWN_TRUNCATED_D) b = DOWN_TRUNCATED_D / (DOWN_TRUNCATED_D - UP_TRUNCATED_D) gray = a * ls + b return gray def gray2ls(gray): a = 1 / (UP_TRUNCATED_D - DOWN_TRUNCATED_D) b = DOWN_TRUNCATED_D / (DOWN_TRUNCATED_D - UP_TRUNCATED_D) ls = (gray - b)/a return ls def gradient_geo(levelset): # print('ls is nan: ', torch.isnan(levelset).any()) gradient_geo = torch.zeros(levelset.shape).cuda() centor = levelset[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X] # print('centor is nan: ', torch.isnan(centor).any()) left = levelset[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET-1:MASK_TILE_END_X-1] # print('left is nan: ', torch.isnan(left).any()) right = levelset[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET+1:MASK_TILE_END_X+1] up = levelset[:, :, LITHOSIM_OFFSET+1:MASK_TILE_END_Y+1, LITHOSIM_OFFSET:MASK_TILE_END_X] low = levelset[:, :, LITHOSIM_OFFSET-1:MASK_TILE_END_Y-1, LITHOSIM_OFFSET:MASK_TILE_END_X] grad_x = (right-left) / 2 # print('grad_x is nan: ', torch.isnan(grad_x).any()) grad_x[:,:,:,0] = centor[:,:,:,1] - centor[:,:,:,0] #left boundary grad_x[:,:,:,-1] = centor[:,:,:,-1] - centor[:,:,:,-2] #right boundary # print('grad_x boundry is nan: ', torch.isnan(grad_x).any()) grad_y = (up - low) / 2 grad_y[:,:,0,:] = centor[:,:,1,:] - centor[:,:,0,:] # upper boundary grad_y[:,:,-1,:] = centor[:,:,-1,:] - centor[:,:,-2,:] # lower boundary gradient_geo[:,:, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X] = (grad_x.pow(2) + grad_y.pow(2)).sqrt() return gradient_geo def gradient_geo_part(levelset): ''' input: (b,c,x,y) leveset tensor return grad_x, grad_y: (b,c,LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X) central tensor return grad_xx, grad_yy, grad_xy: (b,c,LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X) central tensor ''' centor = levelset[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X] left = levelset[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET-1:MASK_TILE_END_X-1] right = levelset[:, :, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET+1:MASK_TILE_END_X+1] up = levelset[:, :, LITHOSIM_OFFSET+1:MASK_TILE_END_Y+1, LITHOSIM_OFFSET:MASK_TILE_END_X] low = levelset[:, :, LITHOSIM_OFFSET-1:MASK_TILE_END_Y-1, LITHOSIM_OFFSET:MASK_TILE_END_X] ll = levelset[:, :, LITHOSIM_OFFSET-1:MASK_TILE_END_Y-1, LITHOSIM_OFFSET-1:MASK_TILE_END_X-1] lr = levelset[:,:, LITHOSIM_OFFSET-1:MASK_TILE_END_Y-1, LITHOSIM_OFFSET+1:MASK_TILE_END_X+1] ul = levelset[:,:, LITHOSIM_OFFSET+1:MASK_TILE_END_Y+1, LITHOSIM_OFFSET-1:MASK_TILE_END_X-1] ur = levelset[:,:, LITHOSIM_OFFSET+1:MASK_TILE_END_Y+1, LITHOSIM_OFFSET+1:MASK_TILE_END_X+1] # 1st order grad_x = (right-left) / 2 grad_x[:,:,:,0] = centor[:,:,:,1] - centor[:,:,:,0] #left boundary grad_x[:,:,:,-1] = centor[:,:,:,-1] - centor[:,:,:,-2] #right boundary grad_y = (up - low) / 2 grad_y[:,:,0,:] = centor[:,:,1,:] - centor[:,:,0,:] # upper boundary grad_y[:,:,-1,:] = centor[:,:,-1,:] - centor[:,:,-2,:] # lower boundary # 2nd order grad_xx = right + left - 2 * centor grad_xx[:,:,:,0] = centor[:,:,:,1] - centor[:,:,:,0] grad_xx[:,:,:,-1] = - (centor[:,:,:,-1] - centor[:,:,:,-2]) grad_yy = up + low - 2 * centor grad_yy[:,:,0,:] = centor[:,:,1,:] - centor[:,:,0,:] grad_yy[:,:,-1,:] = -(centor[:,:,-1,:] - centor[:,:,-2,:]) grad_xy = 0.25 * ((ur - ul) - (lr - ll)) grad_xy[:,:,:,0] = 0.5 * (ur - up - lr + low)[:,:,:,0] grad_xy[:,:,:,-1] = 0.5 * (up - ul - low + ll)[:,:,:,-1] grad_xy[:,:,0,:] = 0.5 * (ur -ul - right + left)[:,:,0,:] grad_xy[:,:,-1,:] = 0.5 * (right - left - lr + ll)[:,:,-1,:] grad_xy[:,:,0,0] = 0.25 * centor[:,:,1,1] grad_xy[:,:,-1,0] = -0.25 * centor[:,:,-2,1] grad_xy[:,:,0,-1] = -0.25 * centor[:,:,1, -2] grad_xy[:,:,-1,-1] = 0.25 * centor[:,:,-2,-2] return grad_x, grad_y, grad_xx, grad_yy, grad_xy def calculate_k(grad_x, grad_y, grad_xx, grad_yy, grad_xy, levelset): k = torch.zeros(levelset.shape) num = torch.mul(grad_xx, grad_y.pow(2)) - 2 * torch.mul(torch.mul(grad_y, grad_x), grad_xy) + torch.mul(grad_yy, grad_x.pow(2)) denom = (grad_x.pow(2) + grad_y.pow(2)).pow(1.5) k[:,:, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X ] = torch.mul(num, denom.reciprocal()) return k def curvature_term(levelset): grad_part = gradient_geo_part(levelset) grad_x, grad_y, grad_xx, grad_yy, grad_xy = grad_part curv = torch.zeros(levelset.shape).cuda() num = torch.mul(grad_xx, grad_y.pow(2)) - 2 * torch.mul(torch.mul(grad_y, grad_x), grad_xy) + torch.mul(grad_yy, grad_x.pow(2)) denom = (grad_x.pow(2) + grad_y.pow(2)).pow(1.5) + EPSILON curv[:,:, LITHOSIM_OFFSET:MASK_TILE_END_Y, LITHOSIM_OFFSET:MASK_TILE_END_X ] = torch.div(num, denom) return curv if __name__ == '__main__': if torch.cuda.is_available(): device = torch.device('cuda') else: device = torch.device('cpu') test1 = Image.open('/home/guojin/projects/develset_opc/levelset_net/binary_images/M1_test1/M1_test1.png').convert('L') transform = transforms.Compose([ transforms.ToTensor() ]) test1 = transform(test1) test1 = test1.unsqueeze(1) #(1,2048,2048) to (1,1,2048,2048) start = time.time() # p_v,p_h = t2boudry_lines(test1, device) p_v,p_h = t2boudry_lines_cpu(test1, device) b_end = time.time() print('init boundary time: ',b_end-start,' s') LS1 = t2lsparams(p_v,p_h, test1, device) l_end = time.time() print('init levelset function time: ',l_end-b_end,' s') torch.save(LS1, 'LS1.pt') test_corner(216, 80, 'll', test1, LS1) test_corner(744, 776, 'ur', test1, LS1) test_convex(304, 140, 'lr', test1, LS1) test_convex(680, 708, 'ul', test1, LS1) test_convex(680, 148, 'ul', test1, LS1) test_outer(-100, -100, test1, LS1) print(torch.min(LS1))
52.918605
208
0.652769
3,135
18,204
3.474641
0.077193
0.156798
0.123198
0.147434
0.791793
0.763793
0.739649
0.719453
0.713119
0.704489
0
0.046016
0.150022
18,204
344
209
52.918605
0.657985
0.091903
0
0.515748
0
0
0.013369
0.007973
0
0
0
0
0
1
0.043307
false
0
0.043307
0
0.129921
0.011811
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
15477fe6c4b1e15106526403b212e4c52a8629ce
80
py
Python
kqueen/storages/exceptions.py
LaudateCorpus1/kqueen
8841c069bb5a53ae18affc0222356956220bbd47
[ "MIT" ]
140
2017-09-28T06:07:40.000Z
2022-01-17T09:10:39.000Z
kqueen/storages/exceptions.py
LaudateCorpus1/kqueen
8841c069bb5a53ae18affc0222356956220bbd47
[ "MIT" ]
128
2017-09-26T06:51:30.000Z
2018-10-11T13:15:13.000Z
kqueen/storages/exceptions.py
LaudateCorpus1/kqueen
8841c069bb5a53ae18affc0222356956220bbd47
[ "MIT" ]
39
2017-10-02T13:57:19.000Z
2021-11-30T05:30:52.000Z
class BackendError(Exception): pass class FieldError(Exception): pass
11.428571
30
0.725
8
80
7.25
0.625
0.448276
0
0
0
0
0
0
0
0
0
0
0.2
80
6
31
13.333333
0.90625
0
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
1552d6f949aa86b82ed0d04812ecbee141ac3c77
1,339
py
Python
src/jk_pathpatternmatcher2/ILocalDiskIOAdapter.py
jkpubsrc/python-module-jk-pathpatternmatcher2
a46535bfb3ecb1ffac7ee1c7a71d275e76bf83de
[ "Apache-1.1" ]
null
null
null
src/jk_pathpatternmatcher2/ILocalDiskIOAdapter.py
jkpubsrc/python-module-jk-pathpatternmatcher2
a46535bfb3ecb1ffac7ee1c7a71d275e76bf83de
[ "Apache-1.1" ]
null
null
null
src/jk_pathpatternmatcher2/ILocalDiskIOAdapter.py
jkpubsrc/python-module-jk-pathpatternmatcher2
a46535bfb3ecb1ffac7ee1c7a71d275e76bf83de
[ "Apache-1.1" ]
null
null
null
import os from .IWalkIOAdapter import IWalkIOAdapter class ILocalDiskIOAdapter(IWalkIOAdapter): ################################################################################################################################ ## Constructor ################################################################################################################################ ################################################################################################################################ ## Public Properties ################################################################################################################################ ################################################################################################################################ ## Helper Methods ################################################################################################################################ ################################################################################################################################ ## Public Methods ################################################################################################################################ def listdirCallback(self): return os.listdir # def lstatCallback(self): return os.lstat # #
26.78
129
0.154593
28
1,339
7.392857
0.642857
0.096618
0.115942
0
0
0
0
0
0
0
0
0
0.06348
1,339
49
130
27.326531
0.165072
0.044063
0
0
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0.285714
0.285714
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
155eda9348c40df42ab83b3ab628d6e0c9801f79
2,603
py
Python
openpose/core/backbone.py
calmisential/Pose_Estimation
f3546fcfdc81ef60708fbda5fc1eb499679fff2f
[ "MIT" ]
null
null
null
openpose/core/backbone.py
calmisential/Pose_Estimation
f3546fcfdc81ef60708fbda5fc1eb499679fff2f
[ "MIT" ]
null
null
null
openpose/core/backbone.py
calmisential/Pose_Estimation
f3546fcfdc81ef60708fbda5fc1eb499679fff2f
[ "MIT" ]
null
null
null
import tensorflow as tf class VGG(tf.keras.layers.Layer): def __init__(self): super(VGG, self).__init__() self.conv1 = tf.keras.layers.Conv2D(filters=64, kernel_size=3, strides=1, padding="same", activation=tf.keras.activations.relu) self.conv2 = tf.keras.layers.Conv2D(filters=64, kernel_size=3, strides=1, padding="same", activation=tf.keras.activations.relu) self.pool1 = tf.keras.layers.MaxPool2D(pool_size=(2, 2), strides=2) self.conv3 = tf.keras.layers.Conv2D(filters=128, kernel_size=3, strides=1, padding="same", activation=tf.keras.activations.relu) self.conv4 = tf.keras.layers.Conv2D(filters=128, kernel_size=3, strides=1, padding="same", activation=tf.keras.activations.relu) self.pool2 = tf.keras.layers.MaxPool2D(pool_size=(2, 2), strides=2) self.conv5 = tf.keras.layers.Conv2D(filters=256, kernel_size=3, strides=1, padding="same", activation=tf.keras.activations.relu) self.conv6 = tf.keras.layers.Conv2D(filters=256, kernel_size=3, strides=1, padding="same", activation=tf.keras.activations.relu) self.conv7 = tf.keras.layers.Conv2D(filters=256, kernel_size=3, strides=1, padding="same", activation=tf.keras.activations.relu) self.conv8 = tf.keras.layers.Conv2D(filters=256, kernel_size=3, strides=1, padding="same", activation=tf.keras.activations.relu) self.pool3 = tf.keras.layers.MaxPool2D(pool_size=(2, 2), strides=2) self.conv9 = tf.keras.layers.Conv2D(filters=512, kernel_size=3, strides=1, padding="same", activation=tf.keras.activations.relu) self.conv10 = tf.keras.layers.Conv2D(filters=512, kernel_size=3, strides=1, padding="same", activation=tf.keras.activations.relu) def call(self, inputs, **kwargs): x = self.conv1(inputs) x = self.conv2(x) x = self.pool1(x) x = self.conv3(x) x = self.conv4(x) x = self.pool2(x) x = self.conv5(x) x = self.conv6(x) x = self.conv7(x) x = self.conv8(x) x = self.pool3(x) x = self.conv9(x) x = self.conv10(x) return x def get_backbone(): return VGG()
45.666667
99
0.55436
317
2,603
4.48265
0.164038
0.118227
0.128079
0.133709
0.757213
0.757213
0.757213
0.757213
0.757213
0.757213
0
0.055336
0.319631
2,603
57
100
45.666667
0.747036
0
0
0.227273
0
0
0.015361
0
0
0
0
0
0
1
0.068182
false
0
0.022727
0.022727
0.159091
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
1570e63329ffc460ae60eecbacf580882e034c34
96
py
Python
marcotti/etl/base/__init__.py
soccermetrics/marcotti
eda2f19bd6cbc6f9c7482e8fe31b2233b33aacfd
[ "MIT" ]
30
2015-11-23T07:51:54.000Z
2020-06-29T16:11:55.000Z
marcotti/etl/base/__init__.py
soccermetrics/marcotti
eda2f19bd6cbc6f9c7482e8fe31b2233b33aacfd
[ "MIT" ]
1
2016-06-26T18:44:47.000Z
2016-06-29T03:02:40.000Z
marcotti/etl/base/__init__.py
soccermetrics/marcotti
eda2f19bd6cbc6f9c7482e8fe31b2233b33aacfd
[ "MIT" ]
8
2016-01-13T12:23:16.000Z
2021-10-11T07:39:33.000Z
from workflows import ETL from transform import MarcottiTransform from load import MarcottiLoad
24
39
0.875
12
96
7
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.125
96
3
40
32
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
1581f9ed41496472ad5cffe420879b2dcae70db7
1,368
py
Python
moonrock/sites/localhost/helper.py
ToyokoLabs/moonrock
abd5de575713796d9b19a48fa447cdd7cef520cc
[ "BSD-2-Clause" ]
null
null
null
moonrock/sites/localhost/helper.py
ToyokoLabs/moonrock
abd5de575713796d9b19a48fa447cdd7cef520cc
[ "BSD-2-Clause" ]
null
null
null
moonrock/sites/localhost/helper.py
ToyokoLabs/moonrock
abd5de575713796d9b19a48fa447cdd7cef520cc
[ "BSD-2-Clause" ]
null
null
null
""" Constants and methods used in testing """ class Colors(): WHITE = 'rgba(255, 255, 255, 1)' RED_ERROR = 'rgba(220, 53, 69, 1)' users = { 'valid_user': {'first_name':'Shinji', 'last_name': 'Ikari', 'user_name': 'sikari', 'address1': '123 Main St.', 'country': 'United States', 'state': 'California', 'zip': '12345', 'name_on_card': 'John Galt', 'number_on_card': '1111111111111', 'cvv': '111'}, 'user_wo_username':{ 'first_name':'Shinji', 'last_name': 'Ikari', 'address1': '123 Main St.', 'country': 'United States', 'state': 'California', 'zip': '12345', 'name_on_card': 'John Galt', 'number_on_card': '1111111111111', 'cvv': '111' }, 'user_invalid_cc':{ 'first_name':'Shinji', 'last_name': 'Ikari', 'user_name': 'sikari', 'address1': '123 Main St.', 'country': 'United States', 'state': 'California', 'zip': '12345', 'name_on_card': 'John Galt', 'number_on_card': '4671100111123', 'cvv': '111' }, }
30.4
50
0.427632
120
1,368
4.658333
0.416667
0.064401
0.080501
0.101968
0.760286
0.760286
0.710197
0.710197
0.710197
0.710197
0
0.115528
0.41155
1,368
44
51
31.090909
0.578882
0.027047
0
0.684211
0
0
0.418745
0
0
0
0
0
0
1
0
false
0
0
0
0.078947
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
159bdc25900365d40e806718a99eecde1d03e191
39
py
Python
asynchronous_qiwi/models/QIWIWallet/restrictions_m/__init__.py
LexLuthorReal/asynchronous_qiwi
5847a8d4008493656e973e5283888a4e57234962
[ "MIT" ]
3
2021-05-20T02:36:30.000Z
2021-11-28T16:00:15.000Z
asynchronous_qiwi/models/QIWIWallet/restrictions_m/__init__.py
LexLuthorReal/asynchronous_qiwi
5847a8d4008493656e973e5283888a4e57234962
[ "MIT" ]
null
null
null
asynchronous_qiwi/models/QIWIWallet/restrictions_m/__init__.py
LexLuthorReal/asynchronous_qiwi
5847a8d4008493656e973e5283888a4e57234962
[ "MIT" ]
1
2021-11-28T16:00:20.000Z
2021-11-28T16:00:20.000Z
from .restrictions import Restrictions
19.5
38
0.871795
4
39
8.5
0.75
0
0
0
0
0
0
0
0
0
0
0
0.102564
39
1
39
39
0.971429
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
15a81d5059cb095d0ec8a330a0f78c0469ad23ba
60
py
Python
PDA/extra_assignments/5.7. Strings_ Remove fragment/main.py
EMbeDS-education/StatsAndComputing20212022
971e418882b206a1b5606d15d222cef1a5a04834
[ "MIT" ]
2
2022-02-24T09:35:15.000Z
2022-03-14T20:34:33.000Z
PDA/extra_assignments/5.C. Strings_ Delete every third character/main.py
GeorgiosArg/StatsAndComputing20212022
798d39af6aa5ef5eef49d5d6f43191351e8a49f3
[ "MIT" ]
null
null
null
PDA/extra_assignments/5.C. Strings_ Delete every third character/main.py
GeorgiosArg/StatsAndComputing20212022
798d39af6aa5ef5eef49d5d6f43191351e8a49f3
[ "MIT" ]
2
2022-03-15T21:40:35.000Z
2022-03-26T14:51:31.000Z
# Read a string: # s = input() # Print a string: # print(s)
12
17
0.583333
10
60
3.5
0.6
0.4
0
0
0
0
0
0
0
0
0
0
0.233333
60
4
18
15
0.76087
0.85
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
ec8f49d9a95b272bcd346b5f8a741100008e6e82
25,492
py
Python
xintesis/template/project.py
J41R0/Xintesis
022f23d0e54f1566de5114d9b142ef99e4f903a0
[ "MIT" ]
1
2020-10-12T01:08:40.000Z
2020-10-12T01:08:40.000Z
xintesis/template/project.py
J41R0/Xintesis
022f23d0e54f1566de5114d9b142ef99e4f903a0
[ "MIT" ]
null
null
null
xintesis/template/project.py
J41R0/Xintesis
022f23d0e54f1566de5114d9b142ef99e4f903a0
[ "MIT" ]
null
null
null
__author__ = 'J41R0' from jinja2 import Environment project_template = """ # default imports from flask import Blueprint, request, send_file, jsonify from flask_restplus import Api, Resource, reqparse from flask_jwt_extended import jwt_optional, jwt_required, decode_token, create_access_token, create_refresh_token from jwt.exceptions import DecodeError as JWTDecodeError, ExpiredSignatureError from xintesis import Project, ServicePack, manager # const definition SUCC = 0 DATA = 1 TYPE = 2 ACCESS_TOKEN = "access" REFRESH_TOKEN = "refresh" project = Project("{{name}}") # header authorizations = {'api_key': {'type': 'apiKey', 'in': 'header', 'name': 'XSA-API-KEY'}} project_api = Blueprint('{{name}}', __name__, url_prefix='/{{name}}/api') {{name}}_api = Api(project_api, title='{{show_name}} Project', description='{{description}}', authorizations=authorizations) {% if security %} jwt = manager.get_singleton('xts_jwt') logged_active_tokens = {} def get_identity(): current_request_data = { "Host": request.headers['Host'] if 'Host' in request.headers else None, "User-Agent": request.headers['User-Agent'] if 'User-Agent' in request.headers else None, "Accept": request.headers['Accept'] if 'Accept' in request.headers else None, # "Accept-Language": request.headers[ # 'Accept-Language'] if 'Accept-Language' in request.headers else None, # "Accept-Encoding": request.headers[ # 'Accept-Encoding'] if 'Accept-Encoding' in request.headers else None, # "Referer": request.headers['Referer'] if 'Referer' in request.headers else None, # "Origin": request.headers['Origin'] if 'Origin' in request.headers else None, # "Connection": request.headers['Connection'] if 'Connection' in request.headers else None } tk_header = request.headers.get('XSA-API-KEY') if tk_header is None: return {"success": False, "message": "Access token required"}, 401 try: identity_data = decode_token(tk_header).get('identity') except JWTDecodeError: return {"success": False, "message": "Incorrect access token"}, 401 except ExpiredSignatureError: return {"success": False, "message": "Expired access token"}, 401 if not identity_data: return {"success": False, "message": "Access token required"}, 401 coincidences = set(identity_data.keys()).intersection(set(current_request_data.keys())) autentication_data_ok = True for curr_key in coincidences: if identity_data[curr_key] != current_request_data[curr_key]: autentication_data_ok = False break if not autentication_data_ok: return {"success": False, "message": "Unauthorized"}, 401 return {"success": True, "identity": identity_data, "token": tk_header}, 200 def add_user_token(username, token, type): if type == ACCESS_TOKEN: if username in logged_active_tokens: logged_active_tokens[username].add(token) else: logged_active_tokens[username] = set() logged_active_tokens[username].add(token) def remove_user_token(username, token): if username in logged_active_tokens and token in logged_active_tokens[username]: logged_active_tokens[username].remove(token) if len(logged_active_tokens[username]) == 0: del logged_active_tokens[username] def is_valid_token(username, token): # first verify access if username in logged_active_tokens and token in logged_active_tokens[username]: return True @jwt.expired_token_loader def my_expired_token_callback(expired_token): token_type = expired_token['type'] identity = decode_token(expired_token).get('identity') username = identity["username"] remove_user_token(username, expired_token) return jsonify({ 'status': 401, 'msg': 'The {} token has expired'.format(token_type) }), 401 def login_expect(): data = reqparse.RequestParser() data.add_argument('username', required=True, type=str, location='form', help='User id') data.add_argument('password', required=True, type=str, location='form', help='Current password') return data{% endif %} {% if security %}{% if hide_api %} @{{name}}_api.default_namespace.hide{% endif %} @{{name}}_api.default_namespace.route('/login') class Login(Resource): expect = login_expect() @{{name}}_api.expect(expect) def post(self): \"\"\"Login user\"\"\" my_input = self.expect.parse_args() identity_data = dict(request.headers) identity_data["username"] = my_input['username'] password = my_input['password'] if project.login(identity_data["username"], password): ac_token = create_access_token(identity=identity_data) add_user_token(my_input['username'], ac_token, type=ACCESS_TOKEN) response = {"access_token":ac_token} return response, 200 else: return {"success": False, "message": "Incorrect credentials"}, 401 {% if hide_api %} @{{name}}_api.default_namespace.hide{% endif %} @{{name}}_api.default_namespace.route('/refresh') class Refresh(Resource): @jwt_optional @{{name}}_api.doc(security='api_key') @{{name}}_api.response(200, 'Success') @{{name}}_api.response(401, 'Unauthorized') @{{name}}_api.response(403, 'Forbidden') def get(self): \"\"\"Refresh user token\"\"\" response, code = get_identity() if code != 200: return response, code identity_data = response["identity"] token = response["token"] if is_valid_token(identity_data['username'], token): remove_user_token(identity_data['username'], token) new_token = create_access_token(identity=identity_data) add_user_token(identity_data['username'], new_token, type=ACCESS_TOKEN) response = {"access_token":new_token} return response, 200 else: return {"success": False, "message": "Invalid access token"}, 401 {% if hide_api %} @{{name}}_api.default_namespace.hide{% endif %} @{{name}}_api.default_namespace.route('/logout') class Logout(Resource): @jwt_optional @{{name}}_api.doc(security='api_key') @{{name}}_api.response(200, 'Success') @{{name}}_api.response(401, 'Unauthorized') @{{name}}_api.response(403, 'Forbidden') def get(self): \"\"\"Logout user\"\"\" response, code = get_identity() if code != 200: return response, code identity_data = response["identity"] token = response["token"] if is_valid_token(identity_data['username'], token): remove_user_token(identity_data['username'], token) return {"success": True}, 200 else: return {"success": False, "message": "Invalid access token"}, 401{% endif %}{% for current_component in components %} # Package {{current_component.name}} {% if current_component.is_service %} from projects.{{current_component.name}}.controller import service_pack as {{current_component.name}}{% else %} from packages.{{current_component.name}}.controller import service_pack as {{current_component.name}} {% endif %} {{current_component.name}}_ns = {{name}}_api.namespace('{{current_component.name}}', description='{{current_component.desc}}') class {{current_component.name.upper()}}_SERVICES:{% for curr_serv_pack in current_component.my_services.keys() %}{% if hide_api %} @{{current_component.name}}_ns.hide{% endif %} @{{current_component.name}}_ns.route('/{{curr_serv_pack}}') @{{current_component.name}}_ns.header('XSA-API-KEY', 'JWT TOKEN', required=True) class {{curr_serv_pack}}(Resource): {% if current_component.my_services[curr_serv_pack].get["active"] %}{% if current_component.my_services[curr_serv_pack].get["expect"] and not current_component.my_services[curr_serv_pack].get["parser"] %} get_model = {{name}}_api.model('{{curr_serv_pack}} Get Model', {{current_component.name}}.my_services["{{curr_serv_pack}}"].get["expect"]){% endif %}{% if current_component.my_services[curr_serv_pack].get["marshall"] %} get_marshall = {{name}}_api.model('{{curr_serv_pack}} Get Response', {{current_component.name}}.my_services["{{curr_serv_pack}}"].get["marshall"]){% endif %} @jwt_optional {% if security and current_component.my_services[curr_serv_pack].get["security"] %}@{{name}}_api.doc(security='api_key') {% endif %}{% if current_component.my_services[curr_serv_pack].get["expect"] %}{% if current_component.my_services[curr_serv_pack].get["parser"] %}@{{name}}_api.expect({{current_component.name}}.my_services["{{curr_serv_pack}}"].get["expect"]){% else %}@{{name}}_api.expect(get_model){% endif %} {% endif %}{% if current_component.my_services[curr_serv_pack].get["marshall"] %}@{{name}}_api.marshal_with(get_marshall, code=200) {% endif %}@{{name}}_api.response(200, 'Success') @{{name}}_api.response(418, 'Process error'){% if security and current_component.my_services[curr_serv_pack].get["security"] %} @{{name}}_api.response(401, 'Unauthorized') @{{name}}_api.response(403, 'Forbidden'){% endif %} def get(self): \"\"\"{{current_component.my_services[curr_serv_pack].get["doc"]}}\"\"\" {% if security and current_component.my_services[curr_serv_pack].get["security"] %} response, code = get_identity() if code != 200: return response, code identity = response["identity"] identity["token"] = response["token"] username = identity["username"] uri = "{{name}}/api/{{current_component.name}}/{{curr_serv_pack}}/GET" authorized = project.auth(username, uri) if not authorized: return {"success": False, "message": "You have not access to this resource"}, 401 identity['uri'] = uri {% endif %}{% if current_component.my_services[curr_serv_pack].get["parser"] %} input = {{current_component.name}}.my_services["{{curr_serv_pack}}"].get["expect"].parse_args() {% else %}input = {{name}}_api.payload{% endif %} response = {"success": False, "data": "", "message": ""} try: obj_dict = project.get_object('{{current_component.name}}'){% if security and current_component.my_services[curr_serv_pack].get["security"] %} call = {{current_component.name}}.my_services["{{curr_serv_pack}}"].get_call(file_handler=project.file_handler, input=input, obj_dict=obj_dict, identity=identity){% else %} call = {{current_component.name}}.my_services["{{curr_serv_pack}}"].get_call(file_handler=project.file_handler, input=input, obj_dict=obj_dict){% endif %} code = 200 succ = call[SUCC] data = call[DATA] res_type = None if len(call) > 2: res_type = call[TYPE] response["success"] = succ # processing files if succ and res_type == "file": name = str(data).split("/")[-1] return send_file(data, as_attachment=True, attachment_filename=name) if succ: response["data"] = data else: response["message"] = data{% if security and current_component.my_services[curr_serv_pack].get["security"] %} code = res_type if res_type in (401, 403) else 418{% else %} code = 418{% endif %} return response, code except ServicePack.XtsServiceException as err: return err.response, err.resp_code except Exception as err: return {"success": False, "message": str(err)}, 418{% endif %} {% if current_component.my_services[curr_serv_pack].post["active"] %}{% if current_component.my_services[curr_serv_pack].post["expect"] and not current_component.my_services[curr_serv_pack].post["parser"] %} post_model = {{name}}_api.model('{{curr_serv_pack}} Post Model', {{current_component.name}}.my_services["{{curr_serv_pack}}"].post["expect"]){% endif %}{% if current_component.my_services[curr_serv_pack].post["marshall"] %} post_marshall = {{name}}_api.model('{{curr_serv_pack}} Post Response', {{current_component.name}}.my_services["{{curr_serv_pack}}"].post["marshall"]){% endif %} @jwt_optional {% if security and current_component.my_services[curr_serv_pack].post["security"] %}@{{name}}_api.doc(security='api_key') {% endif %}{% if current_component.my_services[curr_serv_pack].post["expect"] %}{% if current_component.my_services[curr_serv_pack].post["parser"] %}@{{name}}_api.expect({{current_component.name}}.my_services["{{curr_serv_pack}}"].post["expect"]){% else %}@{{name}}_api.expect(post_model){% endif %} {% endif %}{% if current_component.my_services[curr_serv_pack].post["marshall"] %}@{{name}}_api.marshal_with(post_marshall, code=201) {% endif %}@{{name}}_api.response(201, 'Success') @{{name}}_api.response(418, 'Process error'){% if security and current_component.my_services[curr_serv_pack].post["security"] %} @{{name}}_api.response(401, 'Unauthorized') @{{name}}_api.response(403, 'Forbidden'){% endif %} def post(self): \"\"\"{{current_component.my_services[curr_serv_pack].post["doc"]}}\"\"\" {% if security and current_component.my_services[curr_serv_pack].post["security"] %} response, code = get_identity() if code != 200: return response, code identity = response["identity"] identity["token"] = response["token"] username = identity["username"] uri = "{{name}}/api/{{current_component.name}}/{{curr_serv_pack}}/POST" authorized = project.auth(username, uri) if not authorized: return {"success": False, "message": "You have not access to this resource"}, 401 identity['uri'] = uri {% endif %}{% if current_component.my_services[curr_serv_pack].post["parser"] %} input = {{current_component.name}}.my_services["{{curr_serv_pack}}"].post["expect"].parse_args() {% else %}input = {{name}}_api.payload{% endif %} response = {"success": False, "data": "", "message": ""} try: obj_dict = project.get_object('{{current_component.name}}'){% if security and current_component.my_services[curr_serv_pack].post["security"] %} call = {{current_component.name}}.my_services["{{curr_serv_pack}}"].post_call(file_handler=project.file_handler, input=input, obj_dict=obj_dict, identity=identity){% else %} call = {{current_component.name}}.my_services["{{curr_serv_pack}}"].post_call(file_handler=project.file_handler, input=input, obj_dict=obj_dict){% endif %} code = 201 succ = call[SUCC] data = call[DATA] res_type = None if len(call) > 2: res_type = call[TYPE] response["success"] = succ # processing files if succ and res_type == "file": name = str(data).split("/")[-1] return send_file(data, as_attachment=True, attachment_filename=name) if succ: response["data"] = data else: response["message"] = data{% if security and current_component.my_services[curr_serv_pack].get["security"] %} code = res_type if res_type in (401, 403) else 418{% else %} code = 418{% endif %} return response, code except ServicePack.XtsServiceException as err: return err.response, err.resp_code except Exception as err: return {"success": False, "message": str(err)}, 418{% endif %} {% if current_component.my_services[curr_serv_pack].put["active"] %}{% if current_component.my_services[curr_serv_pack].put["expect"] and not current_component.my_services[curr_serv_pack].put["parser"] %} put_model = {{name}}_api.model('{{curr_serv_pack}} Put Model', {{current_component.name}}.my_services["{{curr_serv_pack}}"].put["expect"]){% endif %}{% if current_component.my_services[curr_serv_pack].put["marshall"] %} put_marshall = {{name}}_api.model('{{curr_serv_pack}} Put Response', {{current_component.name}}.my_services["{{curr_serv_pack}}"].put["marshall"]){% endif %} @jwt_optional {% if security and current_component.my_services[curr_serv_pack].put["security"] %}@{{name}}_api.doc(security='api_key') {% endif %}{% if current_component.my_services[curr_serv_pack].put["expect"] %}{% if current_component.my_services[curr_serv_pack].put["parser"] %}@{{name}}_api.expect({{current_component.name}}.my_services["{{curr_serv_pack}}"].put["expect"]){% else %}@{{name}}_api.expect(put_model){% endif %} {% endif %}{% if current_component.my_services[curr_serv_pack].put["marshall"] %}@{{name}}_api.marshal_with(put_marshall, code=201) {% endif %}@{{name}}_api.response(201, 'Success') @{{name}}_api.response(418, 'Process error'){% if security and current_component.my_services[curr_serv_pack].put["security"] %} @{{name}}_api.response(401, 'Unauthorized') @{{name}}_api.response(403, 'Forbidden'){% endif %} def put(self): \"\"\"{{current_component.my_services[curr_serv_pack].put["doc"]}}\"\"\" {% if security and current_component.my_services[curr_serv_pack].put["security"] %} response, code = get_identity() if code != 200: return response, code identity = response["identity"] identity["token"] = response["token"] username = identity["username"] uri = "{{name}}/api/{{current_component.name}}/{{curr_serv_pack}}/PUT" authorized = project.auth(username, uri) if not authorized: return {"success": False, "message": "You have not access to this resource"}, 401 identity['uri'] = uri {% endif %}{% if current_component.my_services[curr_serv_pack].put["parser"] %} input = {{current_component.name}}.my_services["{{curr_serv_pack}}"].put["expect"].parse_args() {% else %}input = {{name}}_api.payload{% endif %} response = {"success": False, "data": "", "message": ""} try: obj_dict = project.get_object('{{current_component.name}}'){% if security and current_component.my_services[curr_serv_pack].put["security"] %} call = {{current_component.name}}.my_services["{{curr_serv_pack}}"].put_call(file_handler=project.file_handler, input=input, obj_dict=obj_dict, identity=identity){% else %} call = {{current_component.name}}.my_services["{{curr_serv_pack}}"].put_call(file_handler=project.file_handler, input=input, obj_dict=obj_dict){% endif %} code = 201 succ = call[SUCC] data = call[DATA] res_type = None if len(call) > 2: res_type = call[TYPE] response["success"] = succ # processing files if succ and res_type == "file": name = str(data).split("/")[-1] return send_file(data, as_attachment=True, attachment_filename=name) if succ: response["data"] = data else: response["message"] = data{% if security and current_component.my_services[curr_serv_pack].get["security"] %} code = res_type if res_type in (401, 403) else 418{% else %} code = 418{% endif %} return response, code except ServicePack.XtsServiceException as err: return err.response, err.resp_code except Exception as err: return {"success": False, "message": str(err)}, 418{% endif %} {% if current_component.my_services[curr_serv_pack].delete["active"] %}{% if current_component.my_services[curr_serv_pack].delete["expect"] and not current_component.my_services[curr_serv_pack].delete["parser"] %} delete_model = {{name}}_api.model('{{curr_serv_pack}} Delete Model', {{current_component.name}}.my_services["{{curr_serv_pack}}"].delete["expect"]){% endif %}{% if current_component.my_services[curr_serv_pack].delete["marshall"] %} delete_marshall = {{name}}_api.model('{{curr_serv_pack}} Delete Response', {{current_component.name}}.my_services["{{curr_serv_pack}}"].delete["marshall"]){% endif %} @jwt_optional {% if security and current_component.my_services[curr_serv_pack].delete["security"] %}@{{name}}_api.doc(security='api_key') {% endif %}{% if current_component.my_services[curr_serv_pack].delete["expect"] %}{% if current_component.my_services[curr_serv_pack].delete["parser"] %}@{{name}}_api.expect({{current_component.name}}.my_services["{{curr_serv_pack}}"].delete["expect"]){% else %}@{{name}}_api.expect(delete_model){% endif %} {% endif %}{% if current_component.my_services[curr_serv_pack].delete["marshall"] %}@{{name}}_api.marshal_with(delete_marshall, code=204) {% endif %}@{{name}}_api.response(204, 'Success') @{{name}}_api.response(418, 'Process error'){% if security and current_component.my_services[curr_serv_pack].delete["security"] %} @{{name}}_api.response(401, 'Unauthorized') @{{name}}_api.response(403, 'Forbidden'){% endif %} def delete(self): \"\"\"{{current_component.my_services[curr_serv_pack].delete["doc"]}}\"\"\" {% if security and current_component.my_services[curr_serv_pack].delete["security"] %} response, code = get_identity() if code != 200: return response, code identity = response["identity"] identity["token"] = response["token"] username = identity["username"] uri = "{{name}}/api/{{current_component.name}}/{{curr_serv_pack}}/DELETE" authorized = project.auth(username, uri) if not authorized: return {"success": False, "message": "You have not access to this resource"}, 401 identity['uri'] = uri {% endif %}{% if current_component.my_services[curr_serv_pack].delete["parser"] %} input = {{current_component.name}}.my_services["{{curr_serv_pack}}"].delete["expect"].parse_args() {% else %}input = {{name}}_api.payload{% endif %} response = {"success": False, "data": "", "message": ""} try: obj_dict = project.get_object('{{current_component.name}}') obj_dict = project.get_object('{{current_component.name}}'){% if security and current_component.my_services[curr_serv_pack].delete["security"] %} call = {{current_component.name}}.my_services["{{curr_serv_pack}}"].delete_call(file_handler=project.file_handler, input=input, obj_dict=obj_dict, identity=identity){% else %} call = {{current_component.name}}.my_services["{{curr_serv_pack}}"].delete_call(file_handler=project.file_handler, input=input, obj_dict=obj_dict){% endif %} code = 204 succ = call[SUCC] data = call[DATA] res_type = None if len(call) > 2: res_type = call[TYPE] response["success"] = succ if succ: response["data"] = data else: response["message"] = data{% if security and current_component.my_services[curr_serv_pack].get["security"] %} code = res_type if res_type in (401, 403) else 418{% else %} code = 418{% endif %} return response, code except ServicePack.XtsServiceException as err: return err.response, err.resp_code except Exception as err: return {"success": False, "message": str(err)}, 418{% endif %}{% endfor %}{% endfor %} """ def gen_project_src(name, id, hide_api, use_security, components_data_list, description=""): kwargs = dict() kwargs["show_name"] = name kwargs["name"] = id kwargs["hide_api"] = hide_api # define condition to activate security kwargs["security"] = use_security # each component is a controller kwargs["components"] = components_data_list kwargs["description"] = description # print("----------------Generated-------------------") # __location__ = os.path.dirname(__file__) # project_template = open(os.path.join(__location__, "project.pyt")) source = Environment().from_string(project_template).render(**kwargs) # print(source) return source
57.544018
315
0.621999
2,932
25,492
5.151432
0.075375
0.110169
0.075477
0.095339
0.763506
0.738546
0.728085
0.697365
0.677767
0.650424
0
0.012006
0.225639
25,492
442
316
57.674208
0.753141
0.009572
0
0.506297
0
0.13602
0.981102
0.42423
0
0
0
0
0
1
0.002519
false
0.010076
0.02267
0
0.128463
0.005038
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
eca32162796912b661ede687c7e4a88256a4bbcb
302
py
Python
tests/test_code/py/chained/chained.py
FreddyZeng/code2flow
37e45ca4340289f8ceec79b3fe5131c401387c58
[ "MIT" ]
2,248
2015-01-13T21:44:22.000Z
2022-03-31T07:55:22.000Z
tests/test_code/py/chained/chained.py
FreddyZeng/code2flow
37e45ca4340289f8ceec79b3fe5131c401387c58
[ "MIT" ]
44
2015-04-09T18:37:01.000Z
2022-03-25T19:56:11.000Z
tests/test_code/py/chained/chained.py
FreddyZeng/code2flow
37e45ca4340289f8ceec79b3fe5131c401387c58
[ "MIT" ]
220
2015-02-02T06:35:09.000Z
2022-03-31T09:21:09.000Z
class Chain(): def __init__(self, val): self.val = val def add(self, b): self.val += b return self def sub(self, b): self.val -= b return self def mul(self, b): self.val *= b return self print(Chain(5).add(5).sub(2).mul(10))
15.894737
37
0.493377
45
302
3.222222
0.333333
0.241379
0.186207
0.248276
0.517241
0.517241
0.517241
0.358621
0
0
0
0.026042
0.364238
302
18
38
16.777778
0.729167
0
0
0.230769
0
0
0
0
0
0
0
0
0
1
0.307692
false
0
0
0
0.615385
0.076923
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
01b2e89093dbbe3af6dd3eb3df94f1758a68e244
85
py
Python
recipe-bot.py
omedjaouri/recipe-bot
6fb1766153dd9060ad99ecdee4a7f1754dacfec1
[ "MIT" ]
null
null
null
recipe-bot.py
omedjaouri/recipe-bot
6fb1766153dd9060ad99ecdee4a7f1754dacfec1
[ "MIT" ]
null
null
null
recipe-bot.py
omedjaouri/recipe-bot
6fb1766153dd9060ad99ecdee4a7f1754dacfec1
[ "MIT" ]
null
null
null
import os from app import app #Run the app if __name__ == "__main__": app.run()
12.142857
26
0.670588
14
85
3.5
0.642857
0.244898
0
0
0
0
0
0
0
0
0
0
0.223529
85
6
27
14.166667
0.742424
0.129412
0
0
0
0
0.109589
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
01b60af23f996aebd1236e194d6033949c5c6849
79
py
Python
django-rgd-3d/rgd_3d/models/__init__.py
ResonantGeoData/ResonantGeoData
72b3d4085cc5700d0ad5556f31b7eb96ed2d3b8a
[ "Apache-2.0" ]
40
2020-05-07T17:15:26.000Z
2022-02-27T14:45:04.000Z
django-rgd-3d/rgd_3d/models/__init__.py
ResonantGeoData/ResonantGeoData
72b3d4085cc5700d0ad5556f31b7eb96ed2d3b8a
[ "Apache-2.0" ]
408
2020-05-07T15:10:35.000Z
2022-03-30T03:08:47.000Z
django-rgd-3d/rgd_3d/models/__init__.py
ResonantGeoData/ResonantGeoData
72b3d4085cc5700d0ad5556f31b7eb96ed2d3b8a
[ "Apache-2.0" ]
3
2021-04-12T20:16:22.000Z
2021-06-22T14:03:46.000Z
from .point_cloud import PointCloud, PointCloudMeta, PointCloudSpatial # noqa
39.5
78
0.835443
8
79
8.125
1
0
0
0
0
0
0
0
0
0
0
0
0.113924
79
1
79
79
0.928571
0.050633
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
bf01fc495168a8a03c3dc566600255af2fdad270
261
py
Python
code/plots/config.py
geovanecomp/Masters-Degree
6e816431f76abe576e75013e40fccf8928804a15
[ "MIT" ]
null
null
null
code/plots/config.py
geovanecomp/Masters-Degree
6e816431f76abe576e75013e40fccf8928804a15
[ "MIT" ]
null
null
null
code/plots/config.py
geovanecomp/Masters-Degree
6e816431f76abe576e75013e40fccf8928804a15
[ "MIT" ]
null
null
null
"""Common configs for plots""" class Base(): font = { 'family': 'Times New Roman', 'size': 16, } class Legend(Base): font = {**Base.font, 'weight': 'bold'} class Tick(Base): font = {**Base.font, 'size': 12}
15.352941
42
0.48659
29
261
4.37931
0.62069
0.314961
0.188976
0.251969
0
0
0
0
0
0
0
0.022599
0.321839
261
16
43
16.3125
0.694915
0.091954
0
0
0
0
0.168831
0
0
0
0
0
0
1
0
false
0
0
0
0.666667
0
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
1
0
0
5
bf0e635706dc0f0d8f5bd4a7ee53fda9aa672b95
205
py
Python
jolla/__init__.py
Agent-Hellboy/jolla
4aab9850c4ad88e23b7815cdf52c9ce149d299b9
[ "Apache-2.0" ]
null
null
null
jolla/__init__.py
Agent-Hellboy/jolla
4aab9850c4ad88e23b7815cdf52c9ce149d299b9
[ "Apache-2.0" ]
null
null
null
jolla/__init__.py
Agent-Hellboy/jolla
4aab9850c4ad88e23b7815cdf52c9ce149d299b9
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- from .server import WebApp, jolla_server, RouteError, RequestError, RequestValueError from .plugins import * from .HTTPerror import * from .session import *
22.777778
85
0.736585
25
205
6
0.72
0.133333
0
0
0
0
0
0
0
0
0
0.005682
0.141463
205
8
86
25.625
0.846591
0.204878
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
bf25dfd3268314acafa1238c2895d9310571440f
151
py
Python
spaced_repetition/gateways/django_gateway/django_project/apps/problem/admin.py
MBlistein/spaced-repetition
c10281d43e928f8d1799076190f962f8e49a405b
[ "MIT" ]
null
null
null
spaced_repetition/gateways/django_gateway/django_project/apps/problem/admin.py
MBlistein/spaced-repetition
c10281d43e928f8d1799076190f962f8e49a405b
[ "MIT" ]
null
null
null
spaced_repetition/gateways/django_gateway/django_project/apps/problem/admin.py
MBlistein/spaced-repetition
c10281d43e928f8d1799076190f962f8e49a405b
[ "MIT" ]
null
null
null
""" Register models here for visibility in admin view""" from django.contrib import admin from .models import Problem admin.site.register(Problem)
16.777778
56
0.774834
21
151
5.571429
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.145695
151
8
57
18.875
0.906977
0.324503
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
1766f3ab568db1f5ec6c13355edf72fef8172976
2,690
py
Python
tests/request_sender_test.py
duongntbk/urchintai_client
3a99db9348e970be28301f154fe67d724a6557f9
[ "MIT" ]
null
null
null
tests/request_sender_test.py
duongntbk/urchintai_client
3a99db9348e970be28301f154fe67d724a6557f9
[ "MIT" ]
null
null
null
tests/request_sender_test.py
duongntbk/urchintai_client
3a99db9348e970be28301f154fe67d724a6557f9
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from unittest.mock import Mock import pytest from urchintai_client.request_sender import RequestSender @pytest.mark.asyncio async def test_should_return_content_if_post_ok(): ''' Test sending HTTP request using POST without error ''' # Arrange url = 'http://example.com' data = { 'content': 'dummy' } response_text = 'dummy response text' resp = MockResponse(response_text, 200) session = Mock() session.post.return_value = resp request_sender = RequestSender(session) # Act actual_response_text = await request_sender.post(url, data) # Assert assert actual_response_text == response_text @pytest.mark.asyncio async def test_should_throw_exception_if_post_not_ok(): ''' Test sending HTTP request using POST with error ''' # Arrange url = 'http://example.com' data = { 'content': 'dummy' } response_error = 'Server error' resp = MockResponse(response_error, 500) session = Mock() session.post.return_value = resp request_sender = RequestSender(session) # Act with pytest.raises(ConnectionError) as e: await request_sender.post(url, data) # Assert assert str(e.value) == f'An error occurred while sending request to {url}: {response_error}' @pytest.mark.asyncio async def test_should_return_content_if_get_ok(mocker): ''' Test sending HTTP request using GET without error ''' # Arrange url = 'http://example.com' response_text = 'dummy response text' resp = MockResponse(response_text, 200) session = Mock() session.get.return_value = resp request_sender = RequestSender(session) # Act actual_response_text = await request_sender.get(url) # Assert assert actual_response_text == response_text @pytest.mark.asyncio async def test_should_throw_exception_if_get_not_ok(mocker): ''' Test sending HTTP request using GET with error ''' # Arrange url = 'http://example.com' response_error = 'Server error' resp = MockResponse(response_error, 500) session = Mock() session.get.return_value = resp request_sender = RequestSender(session) # Act with pytest.raises(ConnectionError) as e: await request_sender.get(url) # Assert assert str(e.value) == f'An error occurred while sending request to {url}: {response_error}' class MockResponse: def __init__(self, text, status): self._text = text self.status = status async def text(self): return self._text async def __aexit__(self, exc_type, exc, tb): pass async def __aenter__(self): return self
23.596491
96
0.679926
334
2,690
5.251497
0.221557
0.082098
0.038769
0.050171
0.842645
0.842645
0.842645
0.752566
0.696693
0.696693
0
0.006241
0.225651
2,690
113
97
23.80531
0.835814
0.036059
0
0.631579
0
0
0.124839
0
0
0
0
0
0.070175
1
0.017544
false
0.017544
0.052632
0
0.122807
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
179d63c31db3d56282949d21ed51d7be954d76bc
38
py
Python
crawlib/tests/dummy_site/config.py
MacHu-GWU/crawlib-project
b2963b7f6a36ee7f1ef95a6bf9d8cb746d9da991
[ "MIT" ]
1
2020-06-19T09:45:20.000Z
2020-06-19T09:45:20.000Z
crawlib/tests/dummy_site/config.py
MacHu-GWU/crawlib-project
b2963b7f6a36ee7f1ef95a6bf9d8cb746d9da991
[ "MIT" ]
1
2019-12-27T18:41:21.000Z
2019-12-27T18:41:21.000Z
crawlib/tests/dummy_site/config.py
MacHu-GWU/crawlib-project
b2963b7f6a36ee7f1ef95a6bf9d8cb746d9da991
[ "MIT" ]
1
2018-08-22T01:27:32.000Z
2018-08-22T01:27:32.000Z
# -*- coding: utf-8 -*- PORT = 58461
9.5
23
0.5
5
38
3.8
1
0
0
0
0
0
0
0
0
0
0
0.206897
0.236842
38
3
24
12.666667
0.448276
0.552632
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
179e1ac32a8b8a2457afbd20b8a1c0c00b09e0d3
262
py
Python
delete_db.py
revalo/hush.mit.edu
e47c28c934dcfb94c52f6e12367869389e8ed7a8
[ "MIT" ]
21
2017-10-30T20:55:48.000Z
2021-09-03T14:06:58.000Z
delete_db.py
revalo/hush.mit.edu
e47c28c934dcfb94c52f6e12367869389e8ed7a8
[ "MIT" ]
1
2021-11-08T02:05:34.000Z
2021-11-08T06:54:41.000Z
delete_db.py
revalo/hush.mit.edu
e47c28c934dcfb94c52f6e12367869389e8ed7a8
[ "MIT" ]
3
2017-11-15T23:18:00.000Z
2018-01-01T06:44:03.000Z
if __name__ == '__main__': from confess.models import db from confess.models.post import Post from confess.models.vote import Vote if raw_input('r u sure? ') == 'y': Vote.query.delete() Post.query.delete() db.session.commit()
29.111111
40
0.641221
36
262
4.416667
0.555556
0.207547
0.320755
0
0
0
0
0
0
0
0
0
0.236641
262
9
41
29.111111
0.795
0
0
0
0
0
0.072243
0
0
0
0
0
0
1
0
true
0
0.375
0
0.375
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
bd68b3f696d1db8f0dc01b755678f9dbb03d4767
105
py
Python
qcdb/iface_cfour/__init__.py
vivacebelles/qcdb
5bbdcb5c833277647a36bb0a5982abb56bf29b20
[ "BSD-3-Clause" ]
1
2019-02-20T20:18:02.000Z
2019-02-20T20:18:02.000Z
qcdb/iface_cfour/__init__.py
vivacebelles/qcdb
5bbdcb5c833277647a36bb0a5982abb56bf29b20
[ "BSD-3-Clause" ]
null
null
null
qcdb/iface_cfour/__init__.py
vivacebelles/qcdb
5bbdcb5c833277647a36bb0a5982abb56bf29b20
[ "BSD-3-Clause" ]
null
null
null
from .runner import run_cfour from .harvester import cfour_list, cfour_gradient_list, cfour_hessian_list
35
74
0.866667
16
105
5.3125
0.5625
0.211765
0
0
0
0
0
0
0
0
0
0
0.095238
105
2
75
52.5
0.894737
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
bd789b124be99ba7ae57e62a45507ab9c1c207e8
150
py
Python
penin/bootstrap.py
fabaff/penin
6a93984357b4478907746225bfadea0bfc8b681c
[ "Apache-2.0" ]
4
2019-06-04T04:14:42.000Z
2021-04-02T17:25:28.000Z
penin/bootstrap.py
fabaff/penin
6a93984357b4478907746225bfadea0bfc8b681c
[ "Apache-2.0" ]
null
null
null
penin/bootstrap.py
fabaff/penin
6a93984357b4478907746225bfadea0bfc8b681c
[ "Apache-2.0" ]
null
null
null
"""Load the PenIn framework.""" from penin.controllers.base import Base def load(app): """Load the framework.""" app.handler.register(Base)
18.75
39
0.686667
20
150
5.15
0.6
0.135922
0
0
0
0
0
0
0
0
0
0
0.16
150
7
40
21.428571
0.81746
0.3
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
5
bdcf493d16d58f4853727bf971409fe31f18bc7b
113
py
Python
filmoteca_api/admin.py
NelsonPenagos/filmoteca-app-api
01d18a13fdb5a703c1fa07305df147668cead4c0
[ "MIT" ]
null
null
null
filmoteca_api/admin.py
NelsonPenagos/filmoteca-app-api
01d18a13fdb5a703c1fa07305df147668cead4c0
[ "MIT" ]
null
null
null
filmoteca_api/admin.py
NelsonPenagos/filmoteca-app-api
01d18a13fdb5a703c1fa07305df147668cead4c0
[ "MIT" ]
null
null
null
from django.contrib import admin from filmoteca_api.models.movie_models import Movie admin.site.register(Movie)
22.6
51
0.849558
17
113
5.529412
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.088496
113
4
52
28.25
0.912621
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
bdda93b1bada4f564c2d0870ea9c181124897cea
119
py
Python
00_Introduction/hello.py
sreecodeslayer/python3-tutorial
399489ebe28a59bb9c10ac2cce7c64604d77c635
[ "MIT" ]
null
null
null
00_Introduction/hello.py
sreecodeslayer/python3-tutorial
399489ebe28a59bb9c10ac2cce7c64604d77c635
[ "MIT" ]
null
null
null
00_Introduction/hello.py
sreecodeslayer/python3-tutorial
399489ebe28a59bb9c10ac2cce7c64604d77c635
[ "MIT" ]
null
null
null
# Hello world ''' We will use this file to write our first statement in Python Pretty simple: print('Hello world') '''
17
60
0.722689
19
119
4.526316
0.894737
0.232558
0
0
0
0
0
0
0
0
0
0
0.176471
119
7
61
17
0.877551
0.92437
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
bdef729803104fa8b18ef4112d2e114eddc8a0c0
723
py
Python
tests/luna_pathology/cli/test_collect_tile_segment.py
msk-mind-apps/luna-pathology
f0e17ccfeb3dc93de150aed5bbef9fcd7443d6d0
[ "Apache-2.0" ]
null
null
null
tests/luna_pathology/cli/test_collect_tile_segment.py
msk-mind-apps/luna-pathology
f0e17ccfeb3dc93de150aed5bbef9fcd7443d6d0
[ "Apache-2.0" ]
3
2021-07-21T20:28:37.000Z
2021-08-02T18:52:32.000Z
tests/luna_pathology/cli/test_collect_tile_segment.py
msk-mind-apps/luna-pathology
f0e17ccfeb3dc93de150aed5bbef9fcd7443d6d0
[ "Apache-2.0" ]
null
null
null
from click.testing import CliRunner from luna_pathology.cli.collect_tile_segment import cli import shutil, os # @todo FIX: https://github.com/msk-mind-apps/luna-core/blob/main/luna_core/common/DataStore.py#L17 # def test_cli(): # # runner = CliRunner() # result = runner.invoke(cli, [ # '-a', 'tests/luna_pathology/cli/testdata/test_config.yaml', # '-s', '123', # '-m', 'tests/luna_pathology/cli/testdata/collect_tile_results.json']) # # assert result.exit_code == 0 # assert os.path.exists('tests/luna_pathology/cli/testdata/data/test/slides/ovarian_clf_v1/123.parquet') # # # cleanup # shutil.rmtree('tests/luna_pathology/cli/testdata/data/test/slides/ovarian_clf_v1/')
34.428571
108
0.704011
101
723
4.871287
0.564356
0.132114
0.162602
0.170732
0.341463
0.223577
0.223577
0.223577
0.223577
0.223577
0
0.017742
0.142462
723
20
109
36.15
0.775806
0.80083
0
0
0
0
0
0
0
0
0
0.05
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
1
0
0
0
1
0
1
0
0
0
0
5
da296efeece27ac6de4735fd08c828e286a248b0
29
py
Python
src/GameTools/Tools/__init__.py
spidertyler2005/GameTools
f64a8ec0ebb4a357e04b90317136853d831d3553
[ "MIT" ]
1
2021-06-07T18:33:09.000Z
2021-06-07T18:33:09.000Z
src/GameTools/Tools/__init__.py
spidertyler2005/GameTools
f64a8ec0ebb4a357e04b90317136853d831d3553
[ "MIT" ]
null
null
null
src/GameTools/Tools/__init__.py
spidertyler2005/GameTools
f64a8ec0ebb4a357e04b90317136853d831d3553
[ "MIT" ]
null
null
null
from . import Messaging,Math
29
29
0.793103
4
29
5.75
1
0
0
0
0
0
0
0
0
0
0
0
0.137931
29
1
29
29
0.92
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
da612f7db7fc0a0c1df66ca00f63f5eb10fd53ec
10,389
py
Python
tests/test_element_input.py
mate-code/alfred
e687e9318ecefe3a49565027841ca8d910647978
[ "MIT" ]
9
2020-05-11T08:13:12.000Z
2022-01-20T11:35:14.000Z
tests/test_element_input.py
mate-code/alfred
e687e9318ecefe3a49565027841ca8d910647978
[ "MIT" ]
77
2019-02-22T07:34:58.000Z
2022-02-23T15:32:34.000Z
tests/test_element_input.py
mate-code/alfred
e687e9318ecefe3a49565027841ca8d910647978
[ "MIT" ]
6
2020-11-11T16:51:04.000Z
2022-02-21T10:29:02.000Z
import pytest import alfred3 as al import alfred3.element.input as inp from alfred3.exceptions import AlfredError from alfred3.testutil import get_exp_session, clear_db @pytest.fixture def exp(tmp_path): script = "tests/res/script-hello_world.py" secrets = "tests/res/secrets-default.conf" exp = get_exp_session(tmp_path, script_path=script, secrets_path=secrets) exp += al.Page(title="Testpage", name="testpage") yield exp clear_db() class TestPasswordEntry: def test_nomatch(self, exp): exp.testpage += inp.PasswordEntry("rightpass", name="pentry") exp.testpage._set_data({"pentry": "wrongpass"}) assert not exp.testpage.pentry.validate_data() def test_match(self, exp): exp.testpage += inp.PasswordEntry("rightpass", name="pentry") exp.testpage._set_data({"pentry": "rightpass"}) assert exp.testpage.pentry.validate_data() def test_list_of_passwords(self, exp): with pytest.raises(ValueError) as excinfo: inp.PasswordEntry(["rightpass1", "rightpass2"], name="pentry") assert "must be a string" in str(excinfo.value) and "pentry" in str(excinfo.value) class TestMultiplePasswordEntry: def test_singlepass(self, exp): with pytest.raises(ValueError) as excinfo: inp.MultiplePasswordEntry("rightpass", name="pentry") exp.testpage._set_data({"pentry": "wrongpass"}) assert "must be a list or a tuple" in str(excinfo.value) and "pentry" in str(excinfo.value) def test_match1(self, exp): exp.testpage += inp.MultiplePasswordEntry(["rightpass1", "rightpass2"], name="pentry") exp.testpage._set_data({"pentry": "rightpass1"}) assert exp.testpage.pentry.validate_data() def test_match2(self, exp): exp.testpage += inp.MultiplePasswordEntry(["rightpass1", "rightpass2"], name="pentry") exp.testpage._set_data({"pentry": "rightpass2"}) assert exp.testpage.pentry.validate_data() class TestSingleChoiceElement: def test_data(self, exp): exp.testpage += al.SingleChoice("a", "b", name="test") exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"test": 2}) assert exp.values["test"] == 2 assert exp.testpage.test.choice_labels[2-1] == "b" class TestSingleChoiceButtons: def test_data(self, exp): exp.testpage += al.SingleChoiceButtons("a", "b", name="test") exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"test": 2}) assert exp.values["test"] == 2 class TestSubmittingButtons: def test_data(self, exp): exp.testpage += al.SubmittingButtons("a", "b", name="test") exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"test": 2}) assert exp.values["test"] == 2 class TestSingleChoiceBar: def test_data(self, exp): exp.testpage += al.SingleChoiceBar("a", "b", name="test") exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"test": 2}) assert exp.values["test"] == 2 class TestSingleChoiceList: def test_data(self, exp): exp.testpage += al.SingleChoiceList("a", "b", name="test") exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"test": "a"}) assert exp.values["test"] == "a" class TestMultipleChoiceElement: def test_data(self, exp): exp.testpage += al.MultipleChoice("a", "b", name="test") exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({f"test_choice1": "1"}) assert exp.values["test"]["choice1"] == True class TestMultipleButtons: def test_data(self, exp): exp.testpage += al.MultipleChoiceButtons("a", "b", name="test") exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"test_choice1": "1"}) assert exp.values["test"]["choice1"] == True class TestMultipleChoiceBar: def test_data(self, exp): exp.testpage += al.MultipleChoiceBar("a", "b", name="test") exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({f"test_choice1": "1"}) assert exp.values["test"]["choice1"] == True class TestEmailEntry: def test_correct_email(self, exp): exp.testpage += al.EmailEntry(name="email") exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"email": "abc@test.de"}) assert exp.testpage.email.validate_data() def test_incorrect_email(self, exp): exp.testpage += al.EmailEntry(name="email") exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"email": "abctest.de"}) assert not exp.testpage.email.validate_data() class TestMatchEntry: def test_match(self, exp): exp.testpage += al.MatchEntry(pattern="this", name="match") exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"match": "this"}) assert exp.testpage.match.validate_data() def test_no_match(self, exp): exp.testpage += al.MatchEntry(pattern="this", name="match") exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"match": "not this"}) assert not exp.testpage.match.validate_data() class TestNumberEntry: def test_integer(self, exp): exp.testpage += al.NumberEntry(name="number") exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"number": "1"}) assert exp.testpage.number.validate_data() assert exp.testpage.number.input == 1 assert exp.values.get("number") == 1 def test_decimal_point(self, exp): exp.testpage += al.NumberEntry(name="number", ndecimals=1) exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"number": "1.1"}) assert exp.testpage.number.validate_data() assert exp.testpage.number.input == 1.1 assert exp.values.get("number") == 1.1 def test_decimal_comma(self, exp): exp.testpage += al.NumberEntry(name="number", ndecimals=1) exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"number": "1,1"}) assert exp.testpage.number.validate_data() assert exp.testpage.number.input == 1.1 assert exp.values.get("number") == 1.1 def test_string(self, exp): exp.testpage += al.NumberEntry(name="number", ndecimals=1) exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"number": "test"}) assert not exp.testpage.number.validate_data() def test_min(self, exp): exp.testpage += al.NumberEntry(name="number", min=2) exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"number": "1"}) assert not exp.testpage.number.validate_data() def test_max(self, exp): exp.testpage += al.NumberEntry(name="number", max=2) exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"number": "3"}) assert not exp.testpage.number.validate_data() def test_ndecimals(self, exp): exp.testpage += al.NumberEntry(name="number", ndecimals=2) exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"number": "1,12"}) assert exp.testpage.number.validate_data() assert exp.testpage.number.input == 1.12 assert exp.values.get("number") == 1.12 def test_ndecimals_fail(self, exp): exp.testpage += al.NumberEntry(name="number", ndecimals=2) exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"number": "1,123"}) assert not exp.testpage.number.validate_data() def test_decimal_sign_fail(self, exp): exp.testpage += al.NumberEntry(name="number", decimal_signs=";") exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"number": "1,12"}) assert not exp.testpage.number.validate_data() def test_decimal_sign_semicolon_fail(self, exp): # validation fails, because ndecimals=0 default exp.testpage += al.NumberEntry(name="number", decimal_signs=";") exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"number": "1;12"}) assert not exp.testpage.number.validate_data() def test_decimal_sign_semicolon(self, exp): # validation fails, because ndecimals=0 default exp.testpage += al.NumberEntry(name="number", decimal_signs=";", ndecimals=1) exp.start() exp.forward() exp.testpage.prepare_web_widget() exp.testpage._set_data({"number": "1;1"}) assert exp.testpage.number.validate_data() assert exp.testpage.number.input == 1.1 assert exp.values.get("number") == 1.1 # class TestMultipleChoiceList: # def test_data_select_one(self, exp): # exp.testpage += al.MultipleChoiceList("a", "b", name="test") # exp.start() # exp.forward() # exp.testpage.prepare_web_widget() # exp.testpage._set_data({f"test": ["1"]}) # assert exp.values["test"]["choice1"] == True # def test_data_select_multiple(self, exp): # exp.testpage += al.MultipleChoiceList("a", "b", name="test") # exp.start() # exp.forward() # exp.testpage.prepare_web_widget() # exp.testpage._set_data({f"test": ["1", "2"]}) # assert exp.values["test"]["choice1"] == True # assert exp.values["test"]["choice2"] == True
29.019553
99
0.620753
1,249
10,389
5.005604
0.115292
0.191779
0.067179
0.086372
0.788708
0.770633
0.756238
0.739763
0.666987
0.629559
0
0.011436
0.234094
10,389
358
100
29.019553
0.774287
0.074694
0
0.605381
0
0
0.080467
0.006358
0
0
0
0
0.179372
1
0.134529
false
0.067265
0.022422
0
0.215247
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
5
da645a8124fa6fdddb3cff05ed8dca35314eb6e0
68
py
Python
src/hommmer/features/lag.py
hammer-mt/hommmer
a02cb87841395f30911242a019f28f6ac15f27ec
[ "MIT" ]
4
2021-11-09T21:27:30.000Z
2021-11-23T00:38:20.000Z
src/hommmer/features/lag.py
hammer-mt/hommmer
a02cb87841395f30911242a019f28f6ac15f27ec
[ "MIT" ]
null
null
null
src/hommmer/features/lag.py
hammer-mt/hommmer
a02cb87841395f30911242a019f28f6ac15f27ec
[ "MIT" ]
null
null
null
def lag(series, periods): return series.shift(periods).fillna(0)
34
42
0.735294
10
68
5
0.8
0
0
0
0
0
0
0
0
0
0
0.016667
0.117647
68
2
42
34
0.816667
0
0
0
0
0
0
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
da7b4ec5e8fd5c5a3badd06f5f15138375590cb7
38
py
Python
napari/layers/_labels_layer/view/__init__.py
donovanr/napari
580b5eab8cc40af53aef780a65adb9216d968a32
[ "BSD-3-Clause" ]
null
null
null
napari/layers/_labels_layer/view/__init__.py
donovanr/napari
580b5eab8cc40af53aef780a65adb9216d968a32
[ "BSD-3-Clause" ]
null
null
null
napari/layers/_labels_layer/view/__init__.py
donovanr/napari
580b5eab8cc40af53aef780a65adb9216d968a32
[ "BSD-3-Clause" ]
null
null
null
from .properties import QtLabelsLayer
19
37
0.868421
4
38
8.25
1
0
0
0
0
0
0
0
0
0
0
0
0.105263
38
1
38
38
0.970588
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
da8802574c1434018bce5d57980a18f8fec7437e
118
py
Python
backend/db_update.py
VidithM/goto-music
5e0901f46d0e82a6ca01025b766f87fe88e857d5
[ "MIT" ]
null
null
null
backend/db_update.py
VidithM/goto-music
5e0901f46d0e82a6ca01025b766f87fe88e857d5
[ "MIT" ]
null
null
null
backend/db_update.py
VidithM/goto-music
5e0901f46d0e82a6ca01025b766f87fe88e857d5
[ "MIT" ]
null
null
null
def push(db, id, start): curr = db.child('songs').get().val() curr[id] = start db.child('songs').set(curr)
29.5
40
0.576271
19
118
3.578947
0.578947
0.205882
0.352941
0
0
0
0
0
0
0
0
0
0.186441
118
4
41
29.5
0.708333
0
0
0
0
0
0.084034
0
0
0
0
0
0
1
0.25
false
0
0
0
0.25
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
5
16f1a4618ff34f7853cbcf600950459863f51d24
130
py
Python
codes/Ex021.py
BelfortJoao/Curso-phyton01
79376233be228f39bf548f90b8d9bd5419ac067a
[ "MIT" ]
3
2021-08-17T14:02:14.000Z
2021-08-19T02:37:30.000Z
codes/Ex021.py
BelfortJoao/Curso-phyton01
79376233be228f39bf548f90b8d9bd5419ac067a
[ "MIT" ]
null
null
null
codes/Ex021.py
BelfortJoao/Curso-phyton01
79376233be228f39bf548f90b8d9bd5419ac067a
[ "MIT" ]
null
null
null
import pygame pygame.init() pygame.mixer.music.load('E.mp3') pygame.mixer.music.play() pygame.event.wait() print('boa musica ne?')
21.666667
32
0.746154
21
130
4.619048
0.714286
0.226804
0.329897
0
0
0
0
0
0
0
0
0.008197
0.061538
130
6
33
21.666667
0.786885
0
0
0
0
0
0.145038
0
0
0
0
0
0
1
0
true
0
0.166667
0
0.166667
0.166667
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
e503db1a3427c718c7e210a474c59fc244253a9f
140
py
Python
utils/__init__.py
mathandy/handwritten_digit_recognition
37ca5cadfaa0b2554873b2a1bf9fb7b729776eac
[ "MIT" ]
1
2018-06-01T10:51:03.000Z
2018-06-01T10:51:03.000Z
utils/__init__.py
mathandy/handwritten_digit_recognition
37ca5cadfaa0b2554873b2a1bf9fb7b729776eac
[ "MIT" ]
null
null
null
utils/__init__.py
mathandy/handwritten_digit_recognition
37ca5cadfaa0b2554873b2a1bf9fb7b729776eac
[ "MIT" ]
2
2018-03-27T13:39:39.000Z
2018-07-16T18:02:51.000Z
from .diagnostic_tools import diagnostic from .display_tools import printmat from .load_data import load_data, k21hot, split_data, parentdir
46.666667
63
0.857143
20
140
5.75
0.55
0.191304
0
0
0
0
0
0
0
0
0
0.015873
0.1
140
3
63
46.666667
0.896825
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
e5353b78a45f55ab034bc26393fbdcc7d2180cd0
96
py
Python
anvil/sub_rig_templates/center_of_mass.py
AndresMWeber/Anvil
9cd202183ac998983c2bf6e55cc46bbc0ca1a78e
[ "Apache-2.0" ]
3
2019-11-22T04:38:06.000Z
2022-01-19T08:27:18.000Z
anvil/sub_rig_templates/center_of_mass.py
AndresMWeber/Anvil
9cd202183ac998983c2bf6e55cc46bbc0ca1a78e
[ "Apache-2.0" ]
28
2018-02-01T20:39:42.000Z
2018-04-26T17:25:23.000Z
anvil/sub_rig_templates/center_of_mass.py
AndresMWeber/Anvil
9cd202183ac998983c2bf6e55cc46bbc0ca1a78e
[ "Apache-2.0" ]
1
2018-03-11T06:47:26.000Z
2018-03-11T06:47:26.000Z
from base_sub_rig_template import SubRigTemplate class CenterOfMass(SubRigTemplate): pass
16
48
0.833333
11
96
7
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.135417
96
5
49
19.2
0.927711
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.333333
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
1
0
0
0
0
5
e54220e947404933da9a18d18cdfce725d2a0ab5
107
py
Python
asyncns/utils/__init__.py
AavHRF/asyncns
5b3e0abf612c034846154241636679c64c7e4bdf
[ "MIT" ]
null
null
null
asyncns/utils/__init__.py
AavHRF/asyncns
5b3e0abf612c034846154241636679c64c7e4bdf
[ "MIT" ]
null
null
null
asyncns/utils/__init__.py
AavHRF/asyncns
5b3e0abf612c034846154241636679c64c7e4bdf
[ "MIT" ]
null
null
null
from xml_parser import ShardParser from ratelimit import Limiter from param_generator import ParamGenerator
35.666667
42
0.897196
14
107
6.714286
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.102804
107
3
42
35.666667
0.979167
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
e585a5fd495c33ec8080e2fd4d14f0bf659cd270
45
py
Python
AsyncParse/exceptions.py
B0R0koko/asyncparse0.1.2
58a98aba9e3b21dd7e30ad2d3f5581a50c4fcf26
[ "MIT" ]
null
null
null
AsyncParse/exceptions.py
B0R0koko/asyncparse0.1.2
58a98aba9e3b21dd7e30ad2d3f5581a50c4fcf26
[ "MIT" ]
null
null
null
AsyncParse/exceptions.py
B0R0koko/asyncparse0.1.2
58a98aba9e3b21dd7e30ad2d3f5581a50c4fcf26
[ "MIT" ]
null
null
null
class BadStatusException(Exception): pass
22.5
36
0.8
4
45
9
1
0
0
0
0
0
0
0
0
0
0
0
0.133333
45
2
37
22.5
0.923077
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
e5c04f4e35aa52d6a841a375bed2f1fe893c279b
8,850
py
Python
Protheus_WebApp/Modules/SIGAAGR/OGA250TestCase.py
98llm/tir-script-samples
0bff8393b79356aa562e9e6512c11ee6e039b177
[ "MIT" ]
17
2018-09-24T17:27:08.000Z
2021-09-16T19:09:46.000Z
Protheus_WebApp/Modules/SIGAAGR/OGA250TestCase.py
98llm/tir-script-samples
0bff8393b79356aa562e9e6512c11ee6e039b177
[ "MIT" ]
4
2018-09-24T17:30:32.000Z
2022-01-03T11:39:30.000Z
Protheus_WebApp/Modules/SIGAAGR/OGA250TestCase.py
98llm/tir-script-samples
0bff8393b79356aa562e9e6512c11ee6e039b177
[ "MIT" ]
18
2019-06-07T17:41:34.000Z
2022-01-31T18:17:31.000Z
from tir import Webapp import unittest class OGA250(unittest.TestCase): @classmethod def setUpClass(inst): from datetime import datetime DateSystem = datetime.today().strftime('%d/%m/%Y') inst.oHelper = Webapp() inst.oHelper.Setup('SIGAAGR',DateSystem,'T1','D MG 01 ') def test_OGA250_CT001(self): #Cenário 001: Entrada por produção - nova comercialização self.oHelper.Program('OGA250') self.oHelper.AddParameter("MV_AGRA001", "", ".T.", ".T.", ".T.") self.oHelper.AddParameter("MV_AGRO002", "", ".T.", ".T.", ".T.") self.oHelper.AddParameter("MV_SIGAAGR","",".T.",".T.",".T.") self.oHelper.AddParameter("MV_ARM251A", "", "001", "001", "001") self.oHelper.AddParameter("MV_AGRTMPR", "", "010", "010", "010") self.oHelper.AddParameter("MV_AGRTMPS", "", "001", "001", "001") self.oHelper.AddParameter("MV_AGRTMRQ", "", "501", "501", "501") self.oHelper.SetParameters() self.oHelper.WaitShow("Romaneios com Pesagem") self.oHelper.SetKey("F12") self.oHelper.SetValue("MV_PAR01", "000001", name_attr=True) self.oHelper.SetButton("Ok") self.oHelper.SetButton("Incluir") self.oHelper.SetButton("Ok") self.oHelper.SetValue("Tipo", "1") self.oHelper.SetValue("Cod.Entidade", "000001") self.oHelper.SetValue("Loj.Entidade", "01") self.oHelper.ClickFolder("Analise") self.oHelper.SetValue("Cod. Safra", "1920") self.oHelper.SetValue("Cod. Produto", "AGR-FARDAO-ALGODAO") self.oHelper.SetValue("Local", "01") self.oHelper.SetValue("Fazenda", "01") self.oHelper.SetValue("Un. Benef.", "01") self.oHelper.SetButton("Outras Ações", "Vincular Fardões") self.oHelper.ClickBox("Código","000033", grid_number=1) self.oHelper.SetButton(">>") self.oHelper.SetButton("Salvar") self.oHelper.SetButton("Outras Ações", "Pesagem") self.oHelper.SetValue("nPeso", "1000", name_attr=True) self.oHelper.SetButton("Confirmar") self.oHelper.SetButton("Outras Ações", "Pesagem") self.oHelper.SetValue("nPeso", "101000", name_attr=True) self.oHelper.SetButton("Confirmar") self.oHelper.SetButton("Confirmar") self.oHelper.SetButton("Fechar") self.oHelper.SetButton("Outras Ações", "Atualizar") self.oHelper.SetButton("Sim") self.oHelper.SetButton("Outras Ações", "Confirmar") self.oHelper.WaitHide("Aguarde") self.oHelper.SetButton("Visualizar") self.oHelper.ClickFolder("Pesagem") self.oHelper.CheckResult("NJJ_PSSUBT", "100.000,00") self.oHelper.ClickFolder("Controle") self.oHelper.CheckResult("NJJ_STATUS", "3 - Confirmado") self.oHelper.AssertTrue() self.oHelper.SetButton("Fechar") self.oHelper.SetButton("x") def test_OGA250_CT002(self): #Cenário 002: Exclusão documento de saída e reabertura do romaneio (atualizado) self.oHelper.SetLateralMenu("Atualizações > Gestão Agrícola > Faturamento > Exclus. Doc. Saída") ###self.oHelper.Program("MATA521A") self.oHelper.AddParameter("MV_SIGAAGR","",".T.",".T.",".T.") self.oHelper.SetParameters() self.oHelper.SetValue("Modelo de Interface ?" ,"Marcacao") self.oHelper.SetValue("Selecionar itens ?" ,"Nao") self.oHelper.SetValue("Dt.Emissao de ?" ,"01/01/2000") self.oHelper.SetValue("Dt.Emissao ate ?" ,"31/12/2045") self.oHelper.SetValue("Serie de ?" ,"001") self.oHelper.SetValue("Serie ate ?" ,"001") self.oHelper.SetValue("Documento de ?" ,"T2501K") self.oHelper.SetValue("Documento ate ?" ,"T2501K") self.oHelper.SetButton("OK") self.oHelper.ClickBox("Numero","T2501K") self.oHelper.SetButton("Outras Ações","Excluir") self.oHelper.SetButton("Sim") self.oHelper.WaitProcessing("Estorno dos documentos de saida") self.oHelper.SetButton("x") self.oHelper.Program('OGA250') self.oHelper.SearchBrowse("D MG 01 0000000135", "Filial+cod.romaneio") self.oHelper.SetButton("Visualizar") self.oHelper.ClickFolder("Controle") self.oHelper.CheckResult("NJJ_STATUS", "2 - Atualizado") self.oHelper.AssertTrue() self.oHelper.SetButton("Fechar") self.oHelper.SetButton("x") def test_OGA250_CT003(self): #Cenário 003: Exclusão documento de saída e reabertura do romaneio (atualizado) self.oHelper.SetLateralMenu("Atualizações > Gestão Agrícola > Faturamento > Exclus. Doc. Saída") #self.oHelper.Program("MATA521A") self.oHelper.AddParameter("MV_SIGAAGR","",".T.",".T.",".T.") self.oHelper.SetParameters() self.oHelper.SetValue("Modelo de Interface ?" ,"Marcacao") self.oHelper.SetValue("Selecionar itens ?" ,"Nao") self.oHelper.SetValue("Dt.Emissao de ?" ,"01/01/2000") self.oHelper.SetValue("Dt.Emissao ate ?" ,"31/12/2045") self.oHelper.SetValue("Serie de ?" ,"001") self.oHelper.SetValue("Serie ate ?" ,"001") self.oHelper.SetValue("Documento de ?" ,"T2501L") self.oHelper.SetValue("Documento ate ?" ,"T2501L") self.oHelper.SetButton("OK") self.oHelper.ClickBox("Numero","T2501L") self.oHelper.SetButton("Outras Ações","Excluir") self.oHelper.SetButton("Sim") self.oHelper.WaitProcessing("Estorno dos documentos de saida") self.oHelper.SetButton("x") self.oHelper.Program('OGA250') self.oHelper.SearchBrowse("D MG 01 0000000136", "Filial+cod.romaneio") self.oHelper.SetButton("Visualizar") self.oHelper.ClickFolder("Controle") self.oHelper.CheckResult("NJJ_STATUS", "2 - Atualizado") self.oHelper.AssertTrue() self.oHelper.SetButton("Fechar") self.oHelper.SetButton("x") def test_OGA250_CT004(self): #cenario exclusão doc entrada #Cenário 004: Exclusão documento de entrada e reabertura do romaneio (atualizado) self.oHelper.Program('MATA103') self.oHelper.AddParameter("MV_SIGAAGR","",".T.",".T.",".T.") self.oHelper.SetParameters() self.oHelper.SearchBrowse("D MG 01 T25023", "Filial+numero") self.oHelper.SetButton('Outras Ações', "Excluir") self.oHelper.SetButton("Confirmar") self.oHelper.SetButton("x") self.oHelper.Program('OGA250') self.oHelper.SearchBrowse("D MG 01 0000000147", "Filial+cod.romaneio") self.oHelper.SetButton("Visualizar") self.oHelper.ClickFolder("Controle") self.oHelper.CheckResult("NJJ_STATUS", "2 - Atualizado") self.oHelper.AssertTrue() self.oHelper.SetButton("Fechar") self.oHelper.SetButton("x") def test_OGA250_CT005(self): #Cenário 005: Expedição Algodão sem IE - Novo Negócio if self.oHelper.GetRelease() >= "12.1.028": self.oHelper.Program('OGA250') self.oHelper.AddParameter("MV_AGRA001", "", ".T.", ".T.", ".T.") self.oHelper.AddParameter("MV_AGRO002", "", ".T.", ".T.", ".T.") self.oHelper.AddParameter("MV_SIGAAGR", "", ".T.", ".T.", ".T.") self.oHelper.AddParameter("MV_OGDECPS", "", "2", "2", "2") self.oHelper.AddParameter("MV_AGRTMPP", "", "501", "501", "501") self.oHelper.SetParameters() self.oHelper.WaitShow("Romaneios com Pesagem") self.oHelper.SearchBrowse("D MG 01 0000000154", "Filial+cod.romaneio") self.oHelper.SetButton("Alterar") self.oHelper.ClickFolder("Comercialização") self.oHelper.SetValue("Intervalo", "001", grid=True) self.oHelper.SetValue("Id Regra", "002", grid=True) self.oHelper.LoadGrid() self.oHelper.SetButton("Confirmar") self.oHelper.SetButton("Fechar") self.oHelper.SetButton("Outras Ações","Vincular Fardos") self.oHelper.ClickBox("Filial",select_all=True, grid_number=1) self.oHelper.SetButton(">>") self.oHelper.SetButton("Salvar") self.oHelper.SetButton("Outras Ações","Atualizar") self.oHelper.SetButton("Sim") self.oHelper.SetButton("Outras Ações","Confirmar") self.oHelper.WaitShow("Serie / Notas") self.oHelper.SetButton("Ok") self.oHelper.SetButton("Ok") self.oHelper.SetButton("Cancelar") self.oHelper.SetButton("Visualizar") self.oHelper.ClickFolder("Controle") self.oHelper.CheckResult("NJJ_STATUS", "3 - Confirmado") self.oHelper.AssertTrue() self.oHelper.SetButton("Fechar") self.oHelper.SetButton("x") @classmethod def tearDownClass(inst): inst.oHelper.TearDown() if __name__ == '__main__': unittest.main()
46.09375
112
0.633333
962
8,850
5.778586
0.201663
0.294837
0.190682
0.067458
0.751754
0.740601
0.711279
0.66145
0.64454
0.634107
0
0.047207
0.202938
8,850
191
113
46.335079
0.740856
0.058983
0
0.608434
0
0
0.238668
0
0
0
0
0
0.03012
1
0.042169
false
0
0.018072
0
0.066265
0
0
0
0
null
1
1
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
e5d524e9b2f6d925c686fc24e026a46906755d04
3,125
py
Python
lifts/migrations/0002_cardio_cardioinstance_liftinstance_workout_workoutinstance.py
davishayden/gains
8a9855537e8dd1a3cd5b938fa71bef79c40af1a2
[ "MIT" ]
null
null
null
lifts/migrations/0002_cardio_cardioinstance_liftinstance_workout_workoutinstance.py
davishayden/gains
8a9855537e8dd1a3cd5b938fa71bef79c40af1a2
[ "MIT" ]
null
null
null
lifts/migrations/0002_cardio_cardioinstance_liftinstance_workout_workoutinstance.py
davishayden/gains
8a9855537e8dd1a3cd5b938fa71bef79c40af1a2
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-10-19 14:00 from __future__ import unicode_literals import django.contrib.postgres.fields from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('lifts', '0001_initial'), ] operations = [ migrations.CreateModel( name='Cardio', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=200)), ('created_at', models.DateTimeField(verbose_name='created at')), ], ), migrations.CreateModel( name='CardioInstance', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=200)), ('type', models.IntegerField()), ('created_at', models.DateTimeField(verbose_name='created at')), ('duration', models.FloatField()), ('distance', models.FloatField()), ], ), migrations.CreateModel( name='LiftInstance', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created_at', models.DateTimeField(verbose_name='created at')), ('type', models.IntegerField()), ('reps', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), size=None)), ('sets', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), size=None)), ('weight', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), size=None)), ], ), migrations.CreateModel( name='Workout', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=200)), ('created_at', models.DateTimeField(verbose_name='created at')), ('cardio_plan', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), size=None)), ('lift_plan', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), size=None)), ], ), migrations.CreateModel( name='WorkoutInstance', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=200)), ('created_at', models.DateTimeField(verbose_name='created at')), ('cardio_events', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), size=None)), ('lift_events', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), size=None)), ], ), ]
46.641791
122
0.59136
299
3,125
6.026756
0.234114
0.061043
0.09323
0.119867
0.750832
0.750832
0.750832
0.750832
0.697558
0.697558
0
0.01436
0.26464
3,125
66
123
47.348485
0.7698
0.02176
0
0.610169
1
0
0.09463
0
0
0
0
0
0
1
0
false
0
0.050847
0
0.101695
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
e5d6e134dd5e4e2d4291439689de364fc229eafd
800
py
Python
python/api/models.py
kellenschmidt/yelp-for-hair-stylists
778cc39715cfd6eb7801925858a2c581fb492198
[ "Apache-2.0" ]
null
null
null
python/api/models.py
kellenschmidt/yelp-for-hair-stylists
778cc39715cfd6eb7801925858a2c581fb492198
[ "Apache-2.0" ]
null
null
null
python/api/models.py
kellenschmidt/yelp-for-hair-stylists
778cc39715cfd6eb7801925858a2c581fb492198
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models class Review(models.Model): comment = models.CharField(max_length=1000) conversation = models.IntegerField() title = models.CharField(max_length=100) style = models.IntegerField() satisfaction = models.IntegerField() worker_id = models.IntegerField() age = models.IntegerField() gender = models.IntegerField() price = models.IntegerField() def __str__(self): return self.id class Worker(models.Model): store_id = models.CharField(max_length=200) name = models.CharField(max_length=200) def __str__(self): return self.id class Store(models.Model): store_id = models.CharField(max_length=200) phone_number = models.CharField(max_length=200) def __str__(self): return self.store_id
25
48
0.7625
105
800
5.542857
0.371429
0.216495
0.185567
0.247423
0.37457
0.37457
0.37457
0.316151
0.316151
0.161512
0
0.02849
0.1225
800
32
49
25
0.80057
0.02625
0
0.291667
0
0
0
0
0
0
0
0
0
1
0.125
false
0
0.083333
0.125
1
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
5
f908dc5c5ead63cef0667ae548d2127d2a4bf82a
46
py
Python
smart_imports/__init__.py
Tiendil/smart-imports
c0d4b17394d3250520f0554c1f0164487a0a7971
[ "BSD-3-Clause" ]
32
2019-07-15T19:50:38.000Z
2021-09-04T07:56:19.000Z
smart_imports/__init__.py
Tiendil/smart-imports
c0d4b17394d3250520f0554c1f0164487a0a7971
[ "BSD-3-Clause" ]
18
2018-06-12T17:41:08.000Z
2021-11-08T21:42:48.000Z
smart_imports/__init__.py
Tiendil/smart-imports
c0d4b17394d3250520f0554c1f0164487a0a7971
[ "BSD-3-Clause" ]
8
2019-03-18T16:51:24.000Z
2021-02-24T00:44:04.000Z
from .importer import all __all__ = (all,)
7.666667
25
0.673913
6
46
4.5
0.666667
0.444444
0
0
0
0
0
0
0
0
0
0
0.217391
46
5
26
9.2
0.75
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
f920bb4f02f694adcd18c42cae5c7b8f8131802e
24
py
Python
Counting/__init__.py
Kthyeon/micronet_neurips_challenge
9f71fb752e8fbd5abca07be530f7fb19e164125c
[ "MIT" ]
19
2019-11-27T07:18:35.000Z
2021-08-20T14:16:17.000Z
Counting/__init__.py
3outeille/KAIST-AI-NeurIPS2019-MicroNet-2nd-place-solution
9f71fb752e8fbd5abca07be530f7fb19e164125c
[ "MIT" ]
null
null
null
Counting/__init__.py
3outeille/KAIST-AI-NeurIPS2019-MicroNet-2nd-place-solution
9f71fb752e8fbd5abca07be530f7fb19e164125c
[ "MIT" ]
6
2019-12-18T02:09:54.000Z
2021-06-21T11:34:36.000Z
from .count import count
24
24
0.833333
4
24
5
0.75
0
0
0
0
0
0
0
0
0
0
0
0.125
24
1
24
24
0.952381
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
009b4cb40614c096d8704ba5aa66e4f8007bc605
23,374
py
Python
struct2tensor/expression_impl/promote_test.py
jay90099/struct2tensor
47d651757efa27586bf75f991b2174d8173a750b
[ "Apache-2.0" ]
30
2019-10-07T21:31:44.000Z
2022-03-30T17:11:44.000Z
struct2tensor/expression_impl/promote_test.py
jay90099/struct2tensor
47d651757efa27586bf75f991b2174d8173a750b
[ "Apache-2.0" ]
2
2020-03-23T20:48:14.000Z
2021-04-16T15:05:33.000Z
struct2tensor/expression_impl/promote_test.py
jay90099/struct2tensor
47d651757efa27586bf75f991b2174d8173a750b
[ "Apache-2.0" ]
30
2019-07-16T13:01:53.000Z
2022-03-01T22:04:36.000Z
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Tests for struct2tensor.promote.""" from struct2tensor import create_expression from struct2tensor import path from struct2tensor.expression_impl import promote from struct2tensor.test import expression_test_util from struct2tensor.test import prensor_test_util import tensorflow as tf from absl.testing import absltest from tensorflow.python.framework import test_util # pylint: disable=g-direct-tensorflow-import from tensorflow_metadata.proto.v0 import schema_pb2 class PromoteTest(absltest.TestCase): def assertLen(self, arr, expected_len): self.assertEqual(len(arr), expected_len) # pylint:disable=g-generic-assert def test_promote_anonymous(self): expr = create_expression.create_expression_from_prensor( prensor_test_util.create_nested_prensor()) new_root, new_field = promote.promote_anonymous( expr, path.Path(["user", "friends"])) new_field = new_root.get_descendant_or_error(new_field) self.assertTrue(new_field.is_repeated) self.assertEqual(new_field.type, tf.string) self.assertTrue(new_field.is_leaf) self.assertFalse(new_field.calculation_is_identity()) self.assertTrue(new_field.calculation_equal(new_field)) self.assertFalse(new_field.calculation_equal(expr)) leaf_node = expression_test_util.calculate_value_slowly(new_field) self.assertEqual(leaf_node.values.dtype, tf.string) self.assertEqual(new_field.known_field_names(), frozenset()) sources = new_field.get_source_expressions() self.assertLen(sources, 2) self.assertIs( expr.get_descendant_or_error(path.Path(["user", "friends"])), sources[0]) self.assertIs(expr.get_child_or_error("user"), sources[1]) def test_promote_with_schema(self): expr = create_expression.create_expression_from_prensor( prensor_test_util.create_big_prensor()).apply_schema( prensor_test_util.create_big_prensor_schema()) new_root, new_field = promote.promote_anonymous( expr, path.Path(["user", "friends"])) new_field = new_root.get_descendant_or_error(new_field) new_schema_feature = new_field.schema_feature self.assertIsNotNone(new_schema_feature) self.assertEqual(new_schema_feature.string_domain.value[0], "a") def test_promote_with_schema_dense_parent(self): s = prensor_test_util.create_big_prensor_schema() feature_dict = {feature.name: feature for feature in s.feature} user_feature = feature_dict["user"] user_feature.value_count.min = 3 user_feature.value_count.max = 3 user_feature.presence.min_fraction = 1 user_feature.lifecycle_stage = schema_pb2.LifecycleStage.ALPHA user_dict = { feature.name: feature for feature in user_feature.struct_domain.feature } friends_feature = user_dict["friends"] friends_feature.value_count.min = 2 friends_feature.value_count.max = 2 friends_feature.presence.min_fraction = 1 friends_feature.presence.min_count = 10 friends_feature.lifecycle_stage = schema_pb2.LifecycleStage.BETA friends_feature.distribution_constraints.min_domain_mass = 0.5 expr = create_expression.create_expression_from_prensor( prensor_test_util.create_big_prensor()).apply_schema(s) new_root, new_field = promote.promote_anonymous( expr, path.Path(["user", "friends"])) new_field = new_root.get_descendant_or_error(new_field) new_schema_feature = new_field.schema_feature self.assertIsNotNone(new_schema_feature) self.assertEqual(new_schema_feature.string_domain.value[0], "a") self.assertEqual(new_schema_feature.value_count.max, 6) self.assertEqual(new_schema_feature.value_count.min, 6) self.assertEqual(new_schema_feature.presence.min_fraction, 1) self.assertEqual(new_schema_feature.presence.min_count, 3) self.assertEqual(new_schema_feature.lifecycle_stage, schema_pb2.LifecycleStage.ALPHA) self.assertEqual( new_schema_feature.distribution_constraints.min_domain_mass, 0.5) def test_lifecycle_stage(self): # Stages have the following priority, from lowest to highest: # schema_pb2.LifecycleStage.DEPRECATED # schema_pb2.LifecycleStage.DISABLED # schema_pb2.LifecycleStage.PLANNED, # schema_pb2.LifecycleStage.ALPHA # schema_pb2.LifecycleStage.DEBUG_ONLY, # None # schema_pb2.LifecycleStage.UNKNOWN_STAGE, # schema_pb2.LifecycleStage.BETA # schema_pb2.LifecycleStage.PRODUCTION def _check_lifecycle_stage(a, b): s = prensor_test_util.create_big_prensor_schema() feature_dict = {feature.name: feature for feature in s.feature} user_feature = feature_dict["user"] if a is not None: user_feature.lifecycle_stage = a user_dict = { feature.name: feature for feature in user_feature.struct_domain.feature } friends_feature = user_dict["friends"] if b is not None: friends_feature.lifecycle_stage = b expr = create_expression.create_expression_from_prensor( prensor_test_util.create_big_prensor()).apply_schema(s) new_root, new_field = promote.promote_anonymous( expr, path.Path(["user", "friends"])) new_field = new_root.get_descendant_or_error(new_field) return new_field.schema_feature.lifecycle_stage self.assertEqual( schema_pb2.LifecycleStage.DEPRECATED, _check_lifecycle_stage(schema_pb2.LifecycleStage.DEPRECATED, schema_pb2.LifecycleStage.DISABLED)) self.assertEqual( schema_pb2.LifecycleStage.DEPRECATED, _check_lifecycle_stage(schema_pb2.LifecycleStage.DISABLED, schema_pb2.LifecycleStage.DEPRECATED)) self.assertEqual( schema_pb2.LifecycleStage.DISABLED, _check_lifecycle_stage(schema_pb2.LifecycleStage.PLANNED, schema_pb2.LifecycleStage.DISABLED)) self.assertEqual( schema_pb2.LifecycleStage.DEPRECATED, _check_lifecycle_stage(schema_pb2.LifecycleStage.PLANNED, schema_pb2.LifecycleStage.DEPRECATED)) self.assertEqual( schema_pb2.LifecycleStage.PLANNED, _check_lifecycle_stage(schema_pb2.LifecycleStage.PLANNED, schema_pb2.LifecycleStage.ALPHA)) self.assertEqual( schema_pb2.LifecycleStage.PLANNED, _check_lifecycle_stage(schema_pb2.LifecycleStage.ALPHA, schema_pb2.LifecycleStage.PLANNED)) self.assertEqual( schema_pb2.LifecycleStage.ALPHA, _check_lifecycle_stage(schema_pb2.LifecycleStage.DEBUG_ONLY, schema_pb2.LifecycleStage.ALPHA)) self.assertEqual( schema_pb2.LifecycleStage.ALPHA, _check_lifecycle_stage(schema_pb2.LifecycleStage.ALPHA, schema_pb2.LifecycleStage.DEBUG_ONLY)) self.assertEqual( schema_pb2.LifecycleStage.DEBUG_ONLY, _check_lifecycle_stage(schema_pb2.LifecycleStage.DEBUG_ONLY, None)) self.assertEqual( schema_pb2.LifecycleStage.DEBUG_ONLY, _check_lifecycle_stage(None, schema_pb2.LifecycleStage.DEBUG_ONLY)) # None looks like UNKNOWN_STAGE. self.assertEqual( schema_pb2.LifecycleStage.UNKNOWN_STAGE, _check_lifecycle_stage(None, schema_pb2.LifecycleStage.UNKNOWN_STAGE)) self.assertEqual( schema_pb2.LifecycleStage.UNKNOWN_STAGE, _check_lifecycle_stage(schema_pb2.LifecycleStage.UNKNOWN_STAGE, None)) self.assertEqual( schema_pb2.LifecycleStage.UNKNOWN_STAGE, _check_lifecycle_stage(schema_pb2.LifecycleStage.BETA, schema_pb2.LifecycleStage.UNKNOWN_STAGE)) self.assertEqual( schema_pb2.LifecycleStage.UNKNOWN_STAGE, _check_lifecycle_stage(schema_pb2.LifecycleStage.UNKNOWN_STAGE, schema_pb2.LifecycleStage.BETA)) self.assertEqual( schema_pb2.LifecycleStage.BETA, _check_lifecycle_stage(schema_pb2.LifecycleStage.BETA, schema_pb2.LifecycleStage.PRODUCTION)) self.assertEqual( schema_pb2.LifecycleStage.BETA, _check_lifecycle_stage(schema_pb2.LifecycleStage.PRODUCTION, schema_pb2.LifecycleStage.BETA)) def test_promote_with_schema_dense_fraction(self): """Test when min_fraction is not 1.""" s = prensor_test_util.create_big_prensor_schema() feature_dict = {feature.name: feature for feature in s.feature} user_feature = feature_dict["user"] user_feature.value_count.min = 3 user_feature.value_count.max = 3 user_feature.presence.min_fraction = 1 user_dict = { feature.name: feature for feature in user_feature.struct_domain.feature } friends_feature = user_dict["friends"] friends_feature.presence.min_fraction = 0.9 expr = create_expression.create_expression_from_prensor( prensor_test_util.create_big_prensor()).apply_schema(s) new_root, new_field = promote.promote_anonymous( expr, path.Path(["user", "friends"])) new_field = new_root.get_descendant_or_error(new_field) new_schema_feature = new_field.schema_feature self.assertIsNotNone(new_schema_feature) self.assertEqual(new_schema_feature.presence.min_fraction, 0.3) def test_promote_optional_child_of_repeated(self): expr = create_expression.create_expression_from_prensor( prensor_test_util.create_nested_prensor()) new_root, new_field = promote.promote_anonymous( expr, path.Path(["doc", "keep_me"])) new_expr = new_root.get_descendant_or_error(new_field) self.assertTrue(new_expr.is_repeated) def test_promote(self): """Tests promote.promote(...), and indirectly tests set_path.""" expr = create_expression.create_expression_from_prensor( prensor_test_util.create_nested_prensor()) new_root = promote.promote(expr, path.Path(["user", "friends"]), "new_field") new_field = new_root.get_child_or_error("new_field") self.assertIsNotNone(new_field) self.assertTrue(new_field.is_repeated) self.assertEqual(new_field.type, tf.string) self.assertTrue(new_field.is_leaf) leaf_node = expression_test_util.calculate_value_slowly(new_field) self.assertEqual(leaf_node.values.dtype, tf.string) self.assertEqual(new_field.known_field_names(), frozenset()) def test_promote_substructure(self): """Tests promote.promote(...) of substructure.""" expr = create_expression.create_expression_from_prensor( prensor_test_util.create_deep_prensor()) new_root = promote.promote(expr, path.Path(["event", "doc"]), "new_field") new_field = new_root.get_child_or_error("new_field") self.assertIsNotNone(new_field) self.assertTrue(new_field.is_repeated) self.assertEqual(new_field.known_field_names(), frozenset(["bar", "keep_me"])) bar_expr = new_field.get_child_or_error("bar") self.assertIsNotNone(bar_expr) self.assertTrue(bar_expr.is_repeated) self.assertEqual(bar_expr.type, tf.string) self.assertTrue(bar_expr.is_leaf) keep_me_expr = new_field.get_child_or_error("keep_me") self.assertIsNotNone(keep_me_expr) self.assertFalse(keep_me_expr.is_repeated) self.assertEqual(keep_me_expr.type, tf.bool) self.assertTrue(keep_me_expr.is_leaf) child_node = expression_test_util.calculate_value_slowly(new_field) self.assertEqual(child_node.size, 3) self.assertTrue(child_node.is_repeated) bar_node = expression_test_util.calculate_value_slowly(bar_expr) self.assertEqual(bar_node.values.dtype, tf.string) keep_me_node = expression_test_util.calculate_value_slowly(keep_me_expr) self.assertEqual(keep_me_node.values.dtype, tf.bool) def test_promote_substructure_then_leaf(self): """Tests expr.promote(...) of substructure and then a leaf.""" expr = create_expression.create_expression_from_prensor( prensor_test_util.create_deep_prensor()) new_root = (expr .promote(path.Path(["event", "doc"]), "new_field") .promote(path.Path(["new_field", "bar"]), "new_bar")) new_bar = new_root.get_child_or_error("new_bar") self.assertIsNotNone(new_bar) self.assertTrue(new_bar.is_repeated) self.assertEqual(new_bar.type, tf.string) self.assertTrue(new_bar.is_leaf) new_field_bar = new_root.get_descendant_or_error( path.Path(["new_field", "bar"])) self.assertIsNotNone(new_field_bar) self.assertTrue(new_bar.is_repeated) self.assertEqual(new_bar.type, tf.string) self.assertTrue(new_bar.is_leaf) new_field_keep_me = new_root.get_descendant_or_error( path.Path(["new_field", "keep_me"])) self.assertIsNotNone(new_field_keep_me) self.assertFalse(new_field_keep_me.is_repeated) self.assertEqual(new_field_keep_me.type, tf.bool) self.assertTrue(new_field_keep_me.is_leaf) bar_node = expression_test_util.calculate_value_slowly(new_bar) self.assertEqual(bar_node.values.dtype, tf.string) new_field_bar_node = expression_test_util.calculate_value_slowly( new_field_bar) self.assertEqual(new_field_bar_node.values.dtype, tf.string) new_field_keep_me_node = expression_test_util.calculate_value_slowly( new_field_keep_me) self.assertEqual(new_field_keep_me_node.values.dtype, tf.bool) def test_promote_leaf_then_substructure(self): """Tests expr.promote(...) of leaf and then a substructure.""" expr = create_expression.create_expression_from_prensor( prensor_test_util.create_four_layer_prensor()) new_root = ( expr .promote(path.Path(["event", "doc", "nested_child", "bar"]), "new_bar") .promote(path.Path(["event", "doc"]), "new_doc")) new_doc = new_root.get_child_or_error("new_doc") self.assertIsNotNone(new_doc) self.assertTrue(new_doc.is_repeated) self.assertEqual(new_doc.known_field_names(), frozenset(["nested_child", "new_bar"])) new_bar_expr = new_doc.get_child_or_error("new_bar") self.assertIsNotNone(new_bar_expr) self.assertTrue(new_bar_expr.is_repeated) self.assertEqual(new_bar_expr.type, tf.string) self.assertTrue(new_bar_expr.is_leaf) nested_child_expr = new_doc.get_child_or_error("nested_child") self.assertIsNotNone(nested_child_expr) self.assertTrue(nested_child_expr.is_repeated) self.assertEqual(nested_child_expr.known_field_names(), frozenset(["bar", "keep_me"])) bar_expr = nested_child_expr.get_child_or_error("bar") self.assertIsNotNone(bar_expr) self.assertTrue(bar_expr.is_repeated) self.assertEqual(bar_expr.type, tf.string) self.assertTrue(bar_expr.is_leaf) keep_me_expr = nested_child_expr.get_child_or_error("keep_me") self.assertIsNotNone(keep_me_expr) self.assertFalse(keep_me_expr.is_repeated) self.assertEqual(keep_me_expr.type, tf.bool) self.assertTrue(keep_me_expr.is_leaf) bar_node = expression_test_util.calculate_value_slowly(new_bar_expr) self.assertEqual(bar_node.values.dtype, tf.string) @test_util.run_all_in_graph_and_eager_modes class PromoteValuesTest(tf.test.TestCase): def test_promote_and_calculate(self): """Tests promoting a leaf on a nested tree.""" expr = create_expression.create_expression_from_prensor( prensor_test_util.create_nested_prensor()) new_root, new_path = promote.promote_anonymous( expr, path.Path(["user", "friends"])) new_field = new_root.get_descendant_or_error(new_path) leaf_node = expression_test_util.calculate_value_slowly(new_field) self.assertAllEqual(leaf_node.parent_index, [0, 1, 1, 1, 2]) self.assertAllEqual(leaf_node.values, [b"a", b"b", b"c", b"d", b"e"]) def test_promote_and_calculate_substructure(self): """Tests promoting substructure on a tree with depth of 4.""" expr = create_expression.create_expression_from_prensor( prensor_test_util.create_four_layer_prensor()) new_root, new_path = promote.promote_anonymous( expr, path.Path(["event", "doc", "nested_child"])) new_nested_child = new_root.get_descendant_or_error(new_path) bar_expr = new_root.get_descendant_or_error(new_path.get_child("bar")) keep_me_expr = new_root.get_descendant_or_error( new_path.get_child("keep_me")) # the promoted nested_child's parent index is changed. nested_child_node = expression_test_util.calculate_value_slowly( new_nested_child) self.assertAllEqual(nested_child_node.parent_index, [0, 1, 1, 1]) self.assertTrue(nested_child_node.is_repeated) # bar's parent index should be unchanged. bar_node = expression_test_util.calculate_value_slowly(bar_expr) self.assertAllEqual(bar_node.parent_index, [0, 1, 1, 2]) self.assertAllEqual(bar_node.values, [b"a", b"b", b"c", b"d"]) self.assertTrue(bar_node.is_repeated) # keep_me's parent index should be unchanged. keep_me_node = expression_test_util.calculate_value_slowly(keep_me_expr) self.assertAllEqual(keep_me_node.parent_index, [0, 1]) self.assertAllEqual(keep_me_node.values, [False, True]) self.assertFalse(keep_me_node.is_repeated) def test_promote_and_calculate_substructure_then_leaf(self): """Tests promoting of substructure and then a leaf.""" expr = create_expression.create_expression_from_prensor( prensor_test_util.create_four_layer_prensor()) new_root, new_nested_child_path = promote.promote_anonymous( expr, path.Path(["event", "doc", "nested_child"])) new_root, new_bar_path = promote.promote_anonymous( new_root, new_nested_child_path.get_child("bar")) # the promoted nested_child's parent index is changed. new_nested_child = new_root.get_descendant_or_error(new_nested_child_path) nested_child_node = expression_test_util.calculate_value_slowly( new_nested_child) self.assertAllEqual(nested_child_node.parent_index, [0, 1, 1, 1]) self.assertTrue(nested_child_node.is_repeated) # promoted bar's parent index is changed. new_bar = new_root.get_descendant_or_error(new_bar_path) bar_node = expression_test_util.calculate_value_slowly(new_bar) self.assertAllEqual(bar_node.parent_index, [0, 1, 1, 1]) self.assertAllEqual(bar_node.values, [b"a", b"b", b"c", b"d"]) self.assertTrue(bar_node.is_repeated) # bar's parent index should be unchanged. nested_child_bar = new_root.get_descendant_or_error( new_nested_child_path.get_child("bar")) nested_child_bar_node = expression_test_util.calculate_value_slowly( nested_child_bar) self.assertAllEqual(nested_child_bar_node.parent_index, [0, 1, 1, 2]) self.assertAllEqual(nested_child_bar_node.values, [b"a", b"b", b"c", b"d"]) self.assertTrue(nested_child_bar_node.is_repeated) # keep_me's parent index should be unchanged. nested_child_keep_me = new_root.get_descendant_or_error( new_nested_child_path.get_child("keep_me")) nested_child_keep_me_node = expression_test_util.calculate_value_slowly( nested_child_keep_me) self.assertAllEqual(nested_child_keep_me_node.parent_index, [0, 1]) self.assertAllEqual(nested_child_keep_me_node.values, [False, True]) self.assertFalse(nested_child_keep_me_node.is_repeated) def test_promote_and_calculate_leaf_then_substructure(self): """Tests promoting of leaf and then a substructure.""" expr = create_expression.create_expression_from_prensor( prensor_test_util.create_four_layer_prensor()) new_root, new_bar_path = promote.promote_anonymous( expr, path.Path(["event", "doc", "nested_child", "bar"])) new_root, new_path = promote.promote_anonymous(new_root, path.Path(["event", "doc"])) new_doc = new_root.get_descendant_or_error(new_path) new_bar = new_root.get_descendant_or_error( new_path.concat(new_bar_path.suffix(2))) bar_expr = new_root.get_descendant_or_error( new_path.concat(path.Path(["nested_child", "bar"]))) keep_me_expr = new_root.get_descendant_or_error( new_path.concat(path.Path(["nested_child", "keep_me"]))) new_doc_node = expression_test_util.calculate_value_slowly(new_doc) self.assertAllEqual(new_doc_node.parent_index, [0, 1, 1]) self.assertTrue(new_doc_node.is_repeated) # new_bar's parent index is changed (from the first promote). # The second promote should not change new_bar's parent index. new_bar_node = expression_test_util.calculate_value_slowly(new_bar) self.assertAllEqual(new_bar_node.parent_index, [0, 1, 1, 1]) self.assertAllEqual(new_bar_node.values, [b"a", b"b", b"c", b"d"]) self.assertTrue(new_bar_node.is_repeated) # bar's parent index should be unchanged. bar_node = expression_test_util.calculate_value_slowly(bar_expr) self.assertAllEqual(bar_node.parent_index, [0, 1, 1, 2]) self.assertAllEqual(bar_node.values, [b"a", b"b", b"c", b"d"]) self.assertTrue(bar_node.is_repeated) # keep_me's parent index should be unchanged. keep_me_node = expression_test_util.calculate_value_slowly(keep_me_expr) self.assertAllEqual(keep_me_node.parent_index, [0, 1]) self.assertAllEqual(keep_me_node.values, [False, True]) self.assertFalse(keep_me_node.is_repeated) def test_promote_substructure_with_schema(self): expr = create_expression.create_expression_from_prensor( prensor_test_util.create_deep_prensor()).apply_schema( prensor_test_util.create_deep_prensor_schema()) original_schema = expr.get_descendant_or_error(path.Path(["event", "doc" ])).schema_feature new_root, new_field_path = promote.promote_anonymous( expr, path.Path(["event", "doc"])) new_field = new_root.get_descendant_or_error(new_field_path) new_schema_feature = new_field.schema_feature self.assertIsNotNone(new_schema_feature) # The struct_domain of this feature should not be changed. self.assertProtoEquals(new_schema_feature.struct_domain, original_schema.struct_domain) bar_schema = new_root.get_descendant_or_error( new_field_path.concat(path.Path(["bar"]))).schema_feature self.assertIsNotNone(bar_schema) self.assertEqual(bar_schema.string_domain.value[0], "a") keep_me_schema = new_root.get_descendant_or_error( new_field_path.concat(path.Path(["keep_me"]))).schema_feature self.assertIsNotNone(keep_me_schema) self.assertEqual(keep_me_schema.presence.min_count, 1) if __name__ == "__main__": absltest.main()
44.101887
95
0.73663
3,118
23,374
5.139833
0.074727
0.03694
0.078934
0.031199
0.823537
0.782104
0.751966
0.708848
0.664046
0.605703
0
0.007563
0.168435
23,374
529
96
44.185255
0.816947
0.088902
0
0.516129
0
0
0.026877
0
0
0
0
0
0.334988
1
0.042184
false
0
0.022333
0
0.07196
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
009d821be899514c984e0db4c4c1786ebc36fbf0
181
py
Python
Python/05. Math/01. Polar Coordinates/Solution.py
AdityaSingh17/HackerRank-Solutions
65b7fcd6e82be242fcc7e5b1771941206a8b7940
[ "MIT" ]
null
null
null
Python/05. Math/01. Polar Coordinates/Solution.py
AdityaSingh17/HackerRank-Solutions
65b7fcd6e82be242fcc7e5b1771941206a8b7940
[ "MIT" ]
null
null
null
Python/05. Math/01. Polar Coordinates/Solution.py
AdityaSingh17/HackerRank-Solutions
65b7fcd6e82be242fcc7e5b1771941206a8b7940
[ "MIT" ]
null
null
null
# Polar Coordinates # Problem Link: https://www.hackerrank.com/challenges/polar-coordinates/problem import cmath s = input() print(abs(complex(s))) print(cmath.phase(complex(s)))
20.111111
79
0.756906
25
181
5.48
0.68
0.233577
0.335766
0
0
0
0
0
0
0
0
0
0.088398
181
8
80
22.625
0.830303
0.524862
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0.5
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
5
00a1dc3a5ffffd78e6b379a65c502a3d2b1a62c2
201
py
Python
apps/base/views/other_views.py
picsldev/pyerp
e998e3e99a4e45033d54a6b1df50697f7288f67f
[ "MIT" ]
null
null
null
apps/base/views/other_views.py
picsldev/pyerp
e998e3e99a4e45033d54a6b1df50697f7288f67f
[ "MIT" ]
null
null
null
apps/base/views/other_views.py
picsldev/pyerp
e998e3e99a4e45033d54a6b1df50697f7288f67f
[ "MIT" ]
null
null
null
# Librerias Future from __future__ import unicode_literals # Librerias Django from django.shortcuts import HttpResponse, render def IndexEasy(request): return render(request, 'base/index.html')
20.1
49
0.79602
24
201
6.458333
0.708333
0
0
0
0
0
0
0
0
0
0
0
0.134328
201
9
50
22.333333
0.890805
0.164179
0
0
0
0
0.090909
0
0
0
0
0
0
1
0.25
false
0
0.5
0.25
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
1
0
0
0
5
00a26e3a81a14ddf4bc1c40362accf8ff2c43b65
137
py
Python
qe_tools/parsers/__init__.py
asle85/qe-tools
359579ee4a88fb6920270de39f49524e9365fda2
[ "MIT" ]
17
2017-11-29T01:59:59.000Z
2022-03-03T18:57:21.000Z
qe_tools/parsers/__init__.py
asle85/qe-tools
359579ee4a88fb6920270de39f49524e9365fda2
[ "MIT" ]
36
2017-11-16T11:29:54.000Z
2021-03-12T15:07:39.000Z
qe_tools/parsers/__init__.py
asle85/qe-tools
359579ee4a88fb6920270de39f49524e9365fda2
[ "MIT" ]
7
2017-11-25T09:30:50.000Z
2021-03-08T14:15:09.000Z
# -*- coding: utf-8 -*- from ._pw_input import PwInputFile from ._cp_input import CpInputFile __all__ = ('PwInputFile', 'CpInputFile')
19.571429
40
0.722628
16
137
5.6875
0.6875
0.241758
0
0
0
0
0
0
0
0
0
0.008475
0.138686
137
6
41
22.833333
0.762712
0.153285
0
0
0
0
0.192982
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
00e64a3c24b020a9314db678230d35e6d0736363
151
py
Python
BetterCanvas/__init__.py
Podk88/BetterCanvas
0d61c6a0323e590aa77ead0b0a33493116866605
[ "MIT" ]
null
null
null
BetterCanvas/__init__.py
Podk88/BetterCanvas
0d61c6a0323e590aa77ead0b0a33493116866605
[ "MIT" ]
null
null
null
BetterCanvas/__init__.py
Podk88/BetterCanvas
0d61c6a0323e590aa77ead0b0a33493116866605
[ "MIT" ]
null
null
null
from .bettercanvas import BetterCanvas from .items import (Arc, Bitmap, Image, Item, Line, Oval, Polygon, Rectangle, Text, Window)
37.75
77
0.668874
17
151
5.941176
0.823529
0
0
0
0
0
0
0
0
0
0
0
0.245033
151
3
78
50.333333
0.885965
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
daa642f1607b25043a962c53d482702208bc07a4
43
py
Python
setup-database.py
TheBrokenEstate/dbcoursework
0016f820ca8b0ea862e929337d8f7ad0fbfcf863
[ "MIT" ]
null
null
null
setup-database.py
TheBrokenEstate/dbcoursework
0016f820ca8b0ea862e929337d8f7ad0fbfcf863
[ "MIT" ]
null
null
null
setup-database.py
TheBrokenEstate/dbcoursework
0016f820ca8b0ea862e929337d8f7ad0fbfcf863
[ "MIT" ]
null
null
null
from projectCode import db db.create_all()
14.333333
26
0.813953
7
43
4.857143
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.116279
43
2
27
21.5
0.894737
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
dab6faf19efdff0c5cad267382dffd28873da216
625
py
Python
src/mathlib.py
nhrade/Ispy
5e014d8493c04a30a978d03f4b5943e349e6db1f
[ "WTFPL" ]
null
null
null
src/mathlib.py
nhrade/Ispy
5e014d8493c04a30a978d03f4b5943e349e6db1f
[ "WTFPL" ]
null
null
null
src/mathlib.py
nhrade/Ispy
5e014d8493c04a30a978d03f4b5943e349e6db1f
[ "WTFPL" ]
null
null
null
''' Created on Jul 18, 2013 @author: noah ''' import math import main as m def pi(args): return math.pi def sqrt_(args): return math.sqrt(m.eval_(args[0])) def sq(args): return m.eval_(args[0])**2 def abs_(args): return abs(m.eval_(args[0])) def even(args): return m.eval_(args[0]) % 2 == 0 def odd(args): return m.eval_(args[0]) % 2 != 0 def is_prime(args): for i in range(2, m.eval_(args[0])): if m.eval_(args[0]) % i == 0: return False return True
18.382353
50
0.48
91
625
3.186813
0.362637
0.12069
0.217241
0.241379
0.334483
0.244828
0.244828
0.172414
0.172414
0
0
0.05168
0.3808
625
33
51
18.939394
0.697674
0.0608
0
0
0
0
0
0
0
0
0
0
0
1
0.388889
false
0
0.111111
0.333333
0.888889
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
daf0804763d4422976cfddfa4a587c8beb04cd34
12,369
py
Python
tecmov-cartopy.py
mrinalghosh/gpstec
db6747844641a994d78740140da2138f71b75725
[ "MIT" ]
1
2020-12-09T05:39:26.000Z
2020-12-09T05:39:26.000Z
tecmov-cartopy.py
mrinalghosh/gpstec
db6747844641a994d78740140da2138f71b75725
[ "MIT" ]
null
null
null
tecmov-cartopy.py
mrinalghosh/gpstec
db6747844641a994d78740140da2138f71b75725
[ "MIT" ]
null
null
null
#!/usr/bin/env python # Cartopy implementation of TEC plotting in polar coordinates # author: @mrinalghosh import matplotlib.pyplot as plt import matplotlib.path as mpath import numpy as np import cartopy.feature as cfeature import cartopy.crs as ccrs import h5py from argparse import ArgumentParser from datetime import datetime import os from glob import glob from sys import platform months = {1: 'jan', 2: 'feb', 3: 'mar', 4: 'apr', 5: 'may', 6: 'jun', 7: 'jul', 8: 'aug', 9: 'sep', 10: 'oct', 11: 'nov', 12: 'dec'} projections = {'plate': [ccrs.PlateCarree(), 'Plate Carree'], 'near': [ccrs.NearsidePerspective(), 'Nearside Perspective'], 'polar': [ccrs.NorthPolarStereo(), 'Polar Stereo'], 'mercator': [ccrs.Mercator(), 'Mercator'], 'geostat': [ccrs.Geostationary(), 'Geostationary']} cmaps = plt.colormaps() def save(root: str = None, n: int = None, overlap: bool = False, slide: str = None, proj: str = None, lim: float = None, cmap: str = None): f = h5py.File(root, 'r') lat = f['GPSTEC']['lat'] lon = f['GPSTEC']['lon'] t = f['GPSTEC']['time'] if cmap not in cmaps: cmap = 'gist_ncar' if slide is not None: slide = int(slide) if slide+n-1 <= len(t): im = np.nanmean(f['GPSTEC']['im'][0:][0:][slide:slide+n+1], axis=0) im = np.transpose(im) time = datetime.fromtimestamp(t[slide]) # scale cmap cmax = np.max(list(filter(lambda x: ~np.isnan(x), np.reshape(im, 64800)))) cmin = np.min(list(filter(lambda x: ~np.isnan(x), np.reshape(im, 64800)))) minoff = 0 # offset maxoff = 0 if proj == 'polar': fig = plt.figure() theta = np.linspace(0, 2 * np.pi, 100) center, radius = [0.5, 0.5], 0.5 verts = np.vstack([np.sin(theta), np.cos(theta)]).T circle = mpath.Path(verts * radius + center) ax1 = plt.subplot(1, 2, 1, projection=ccrs.SouthPolarStereo()) ax1.set_extent([-180, 180, -90, 0], ccrs.PlateCarree()) ax1.title.set_text('South Polar Stereographic') ax1.add_feature(cfeature.OCEAN, zorder=1) ax1.add_feature(cfeature.LAKES, zorder=1) ax1.add_feature(cfeature.RIVERS, zorder=1) ax1.add_feature(cfeature.LAND, zorder=1) ax1.add_feature(cfeature.BORDERS, zorder=3) ax1.add_feature(cfeature.COASTLINE, zorder=3) ax1.gridlines() ax1.set_boundary(circle, transform=ax1.transAxes) im1 = ax1.pcolormesh(lon, lat, im, transform=ccrs.PlateCarree(), vmin=cmin + minoff, vmax=cmax - maxoff, cmap=cmap, zorder=2) ax2 = plt.subplot(1, 2, 2, projection=ccrs.NorthPolarStereo()) ax2.set_extent([-180, 180, 90, 0], ccrs.PlateCarree()) ax2.title.set_text('North Polar Stereographic') ax2.add_feature(cfeature.OCEAN, zorder=1) ax2.add_feature(cfeature.LAKES, zorder=1) ax2.add_feature(cfeature.RIVERS, zorder=1) ax2.add_feature(cfeature.LAND, zorder=1) ax2.add_feature(cfeature.BORDERS, zorder=3) ax2.add_feature(cfeature.COASTLINE, zorder=3) ax2.gridlines() ax2.set_boundary(circle, transform=ax2.transAxes) im2 = ax2.pcolormesh(lon, lat, im, transform=ccrs.PlateCarree(), vmin=cmin + minoff, vmax=cmax - maxoff, cmap=cmap, zorder=2) fig.subplots_adjust(right=0.8) cbar_ax = fig.add_axes([0.85, 0.15, 0.02, 0.7]) fig.colorbar(im2, cax=cbar_ax, label='Total Electron Concentration [TECu]') elif proj is not 'polar': fig = plt.figure('TEC ({})'.format(datetime.fromtimestamp(t[slide]))) ax = plt.subplot(1, 1, 1, projection=projections[proj][0]) ax.title.set_text(projections[proj][1]) ax.add_feature(cfeature.OCEAN, zorder=1) ax.add_feature(cfeature.LAKES, zorder=1) ax.add_feature(cfeature.RIVERS, zorder=1) ax.add_feature(cfeature.LAND, zorder=1) ax.add_feature(cfeature.BORDERS, zorder=3) ax.add_feature(cfeature.COASTLINE, zorder=3) ax.gridlines() imcm = ax.pcolormesh(lon, lat, im, transform=ccrs.PlateCarree(), vmin=cmin + minoff, vmax=cmax - maxoff, cmap=cmap, zorder=2) cb = fig.colorbar(imcm, shrink=0.5) cb.set_label('Total Electron Content [TECu]') print('Saving slide {}'.format(slide)) if platform == 'win32': os.mkdir(os.path.split(root)[0] + '\\{}{}'.format(months[time.month], time.day)) elif platform in ['linux', 'linux2']: os.mkdir(os.path.split(root)[0] + '/{}{}'.format(months[time.month], time.day)) folder = os.path.join(os.path.split(root)[0], '{}{}'.format(months[time.month], time.day)) print(folder) # plt.savefig(os.path.join(folder, '{}.png'.format(slide))) figsav = plt.gcf() figsav.suptitle('{}'.format(time)) figsav.set_size_inches((10, 5), forward=False) figsav.savefig(os.path.join(folder, '{}.png'.format(str(slide).zfill(3))), dpi=200) plt.close(fig) plt.close(figsav) else: t0 = datetime.fromtimestamp(t[0]) if platform == 'win32': os.mkdir(os.path.split(root)[0] + '\\{}{}'.format(months[t0.month], t0.day)) elif platform in ['linux', 'linux2']: os.mkdir(os.path.split(root)[0] + '/{}{}'.format(months[t0.month], t0.day)) folder = os.path.join(os.path.split(root)[0], '{}{}'.format(months[t0.month], t0.day)) if proj == 'polar': theta = np.linspace(0, 2 * np.pi, 100) center, radius = [0.5, 0.5], 0.5 verts = np.vstack([np.sin(theta), np.cos(theta)]).T circle = mpath.Path(verts * radius + center) if not overlap: slides = list(map(lambda x: x*n, list(range(int(len(t)/n)-1)))) else: slides = list(range(len(t)-n+1)) for slide in slides: time = datetime.fromtimestamp(t[slide]) if lim is not 0: cmax = lim cmin = 0.0 else: cmax = np.max(list(filter(lambda x: ~np.isnan(x), np.reshape(im, 64800)))) cmin = np.min(list(filter(lambda x: ~np.isnan(x), np.reshape(im, 64800)))) fig = plt.figure() im = np.nanmean(f['GPSTEC']['im'][0:][0:][slide:slide+n+1], axis=0) im = np.transpose(im) ax1 = plt.subplot(1, 2, 1, projection=ccrs.SouthPolarStereo()) ax1.set_extent([-180, 180, -90, 0], ccrs.PlateCarree()) ax1.title.set_text('South Polar Stereographic') ax1.add_feature(cfeature.OCEAN, zorder=1) ax1.add_feature(cfeature.LAKES, zorder=1) ax1.add_feature(cfeature.RIVERS, zorder=1) ax1.add_feature(cfeature.LAND, zorder=1) ax1.add_feature(cfeature.BORDERS, zorder=3) ax1.add_feature(cfeature.COASTLINE, zorder=3) ax1.gridlines() ax1.set_boundary(circle, transform=ax1.transAxes) ax1.pcolormesh(lon, lat, im, transform=ccrs.PlateCarree(), vmin=cmin, vmax=cmax, cmap=cmap, zorder=2) ax2 = plt.subplot(1, 2, 2, projection=ccrs.NorthPolarStereo()) ax2.set_extent([-180, 180, 90, 0], ccrs.PlateCarree()) ax2.title.set_text('North Polar Stereographic') ax2.add_feature(cfeature.OCEAN, zorder=1) ax2.add_feature(cfeature.LAKES, zorder=1) ax2.add_feature(cfeature.RIVERS, zorder=1) ax2.add_feature(cfeature.LAND, zorder=1) ax2.add_feature(cfeature.BORDERS, zorder=3) ax2.add_feature(cfeature.COASTLINE, zorder=3) ax2.gridlines() ax2.set_boundary(circle, transform=ax2.transAxes) imcm = ax2.pcolormesh(lon, lat, im, transform=ccrs.PlateCarree(), vmin=cmin, vmax=cmax, cmap=cmap, zorder=2) fig.subplots_adjust(right=0.8) cbar_ax = fig.add_axes([0.85, 0.15, 0.02, 0.7]) fig.colorbar(imcm, cax=cbar_ax, label='Total Electron Concentration [TECu]') print('Saving slide {}/{}...'.format(slide+1, len(t))) figsav = plt.gcf() figsav.suptitle('{}'.format(time)) figsav.set_size_inches((10, 5), forward=False) figsav.savefig(os.path.join(folder, '{}.png'.format(str(slide).zfill(3))), dpi=200) plt.close(fig) plt.close(figsav) print(folder) else: if not overlap: slides = list(map(lambda x: x*n, list(range(int(len(t)/n)-1)))) else: slides = list(range(len(t)-n+1)) for slide in slides: fig = plt.figure() im = np.nanmean(f['GPSTEC']['im'][0:][0:][slide:slide+n+1], axis=0) im = np.transpose(im) if lim is not 0: cmax = lim cmin = 0.0 else: cmax = np.max(list(filter(lambda x: ~np.isnan(x), np.reshape(im, 64800)))) cmin = np.min(list(filter(lambda x: ~np.isnan(x), np.reshape(im, 64800)))) ax = plt.subplot(1, 1, 1, projection=projections[proj][0]) ax.title.set_text(projections[proj][1]) ax.add_feature(cfeature.OCEAN, zorder=1) ax.add_feature(cfeature.LAKES, zorder=1) ax.add_feature(cfeature.RIVERS, zorder=1) ax.add_feature(cfeature.LAND, zorder=1) ax.add_feature(cfeature.BORDERS, zorder=3) ax.add_feature(cfeature.COASTLINE, zorder=3) ax.gridlines() im = ax.pcolormesh(lon, lat, im, transform=ccrs.PlateCarree(), vmin=cmin, vmax=cmax, cmap=cmap, zorder=2) cb = fig.colorbar(im, shrink=0.5) cb.set_label('Total Electron Content [TECu]') # fig.tight_layout() print('Saving slide {}/{}...'.format(slide+1, len(t))) # plt.savefig(os.path.join(folder, '{}.png'.format(slide))) figsav = plt.gcf() figsav.set_size_inches((10, 5), forward=False) figsav.savefig(os.path.join(folder, '{}.png'.format(slide)), dpi=200) plt.close(fig) plt.close(figsav) print(folder) if __name__ == '__main__': p = ArgumentParser() p.add_argument('root', type=str, help='local address') p.add_argument('-n', '--naverage', type=int, help='number of slides to include in average', default=1) p.add_argument('--overlap', help='allow overlap of slides', action='store_true') p.add_argument('-s', '--slide', type=str, help='slide number [0,239]') # p.add_argument('-o', '--odir', type=str, help='directory to save images') p.add_argument('-p', '--proj', type=str, help='map projection - plate or polar', default='polar') p.add_argument('-l', '--lim', type=float, help='absolute limit of colorbar - 0 for no absolute', default=70) p.add_argument('-c', '--cmap', type=str, help='colormap', default=None) P = p.parse_args() root = P.root if os.path.splitext(root)[1] in ['.h5', '.hdf5']: save(root=P.root, n=P.naverage, overlap=P.overlap, slide=P.slide, proj=P.proj, lim=P.lim, cmap=P.cmap) else: if platform == 'win32': flist = sorted(glob(os.path.split(root)[0] + '\\conv*.h5')) elif platform in ['linux', 'linux2']: flist = sorted(glob(os.path.split(root)[0] + '/conv*.h5')) if len(flist) > 0: for file in flist: save(file, n=P.naverage, overlap=P.overlap, slide=P.slide, proj=P.proj, lim=P.lim, cmap=P.cmap)
44.492806
116
0.549842
1,578
12,369
4.255387
0.166667
0.053611
0.0965
0.037528
0.762174
0.749218
0.745197
0.741325
0.717945
0.717945
0
0.039027
0.295659
12,369
277
117
44.65343
0.731749
0.026518
0
0.662222
0
0
0.073643
0
0
0
0
0
0
1
0.004444
false
0
0.048889
0
0.053333
0.026667
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
972018a5056e1481b0059db638df50323b1cfffe
17,960
py
Python
extgen/capi.py
maedoc/inducer-f2py
fce51e6603f7474632d452437dbb8b194d6c879d
[ "BSD-3-Clause" ]
57
2015-10-20T15:58:29.000Z
2022-03-19T08:52:04.000Z
extgen/capi.py
maedoc/inducer-f2py
fce51e6603f7474632d452437dbb8b194d6c879d
[ "BSD-3-Clause" ]
12
2016-03-14T16:02:42.000Z
2022-03-23T11:15:50.000Z
extgen/capi.py
maedoc/inducer-f2py
fce51e6603f7474632d452437dbb8b194d6c879d
[ "BSD-3-Clause" ]
12
2015-12-30T15:41:23.000Z
2022-03-01T17:14:42.000Z
from __future__ import absolute_import import numpy implementation = dict() typedefs = dict() macros = dict() typedefs['npy_unicode'] = dict(\ code = 'typedef struct { Py_UNICODE* data; Py_ssize_t size; } npy_unicode;') typedefs['npy_string'] = dict(\ code = 'typedef struct { char* data; Py_ssize_t size; } npy_string;') macros['IS_VALID_INIT'] = dict(\ code = '''\ #define IS_VALID_INIT(pyctype, name, name_str) \\ (name != NULL) {\\ if ((PyObject_IsInstance(name, (PyObject*)pyctype)==1) \\ && (!PyDict_SetItemString(capi_locals, name_str, name)))''' ) macros['SET_EXCEPTION_INIT'] = dict(\ code = '''\ #define SET_EXCEPTION_INIT(pyctype, name, name_str, init_str) \\ if (!PyErr_Occurred()) { \\ PyObject* r = PyString_FromString("expected "); \\ PyString_ConcatAndDel(&r, PyObject_Repr((PyObject*)pyctype)); \\ PyString_ConcatAndDel(&r, PyString_FromString(" object while initializing " name_str ", got ")); \\ PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(name))); \\ PyString_ConcatAndDel(&r, PyString_FromString(" object from `" init_str "`")); \\ PyErr_SetObject(PyExc_TypeError,r);\\ } \\ Py_DECREF(name); \\ }''' ) sctypebits = dict( Int = [8, 16, 32, 64, 128, 256], UInt = [8, 16, 32, 64, 128, 256], Float = [16, 32, 64, 80, 96, 128, 256], Complex = [32, 64, 128, 160, 192, 256, 512], ) template_to_npy_scalar = ''' static int pyobj_to_%(ctype)s(PyObject* obj, %(ctype)s* ptr) { int return_value = 0; if (PyArray_IsScalar(obj, %(Cls)s)) { *ptr = (%(ctype)s)PyArrayScalar_VAL(obj,%(Cls)s); return_value = 1; } else if (PySequence_Check(obj)) { if (PySequence_Size(obj)==1) return_value = pyobj_to_%(ctype)s(PySequence_GetItem(obj,0), ptr); } else { PyObject* sc = Py%(Cls)sArrType_Type.tp_new( &Py%(Cls)sArrType_Type,Py_BuildValue("(O)",obj),NULL); if (sc==NULL) ; else if (PyArray_IsScalar(sc, Generic)) return_value = pyobj_to_%(ctype)s(sc, ptr); else return_value = pyobj_to_%(ctype)s(PyArray_ScalarFromObject(sc), ptr); } if (!return_value && !PyErr_Occurred()) { PyObject* r = PyString_FromString("Failed to convert "); PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj))); PyString_ConcatAndDel(&r, PyString_FromString(" to C %(ctype)s")); PyErr_SetObject(PyExc_TypeError,r); } return return_value; } ''' template_from_npy_scalar = ''' static PyObject* pyobj_from_%(ctype)s(%(ctype)s* value) { PyObject* obj = PyArrayScalar_New(%(Cls)s); if (obj==NULL) /* TODO: set exception */ return NULL; PyArrayScalar_ASSIGN(obj,%(Cls)s,*value); return obj; } ''' template_to_npy_complex_scalar = ''' static int pyobj_to_%(ctype)s(PyObject* obj, %(ctype)s* ptr) { int return_value = 0; if (obj==NULL) ; else if (PyArray_IsScalar(obj,%(Cls)s)) { ptr->real = PyArrayScalar_VAL(obj,%(Cls)s).real; ptr->imag = PyArrayScalar_VAL(obj,%(Cls)s).imag; return_value = 1; } else if (PySequence_Check(obj)) { if (PySequence_Size(obj)==1) return_value = pyobj_to_%(ctype)s(PySequence_GetItem(obj,0),ptr); else if (PySequence_Size(obj)==2) { return_value = pyobj_to_%(fctype)s(PySequence_GetItem(obj,0),&(ptr->real)) && pyobj_to_%(fctype)s(PySequence_GetItem(obj,1),&(ptr->imag)); } } else { PyObject* sc = Py%(Cls)sArrType_Type.tp_new( &Py%(Cls)sArrType_Type,Py_BuildValue("(O)",obj),NULL); if (sc==NULL) ; else if (PyArray_IsScalar(sc, Generic)) return_value = pyobj_to_%(ctype)s(sc, ptr); else return_value = pyobj_to_%(ctype)s(PyArray_ScalarFromObject(sc), ptr); } if (!return_value && !PyErr_Occurred()) { PyObject* r = PyString_FromString("Failed to convert "); PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj))); PyString_ConcatAndDel(&r, PyString_FromString(" to C %(ctype)s")); PyErr_SetObject(PyExc_TypeError,r); } return return_value; } ''' template_from_npy_complex_scalar = ''' static PyObject* pyobj_from_%(ctype)s(%(ctype)s* value) { PyObject* obj = PyArrayScalar_New(%(Cls)s); if (obj==NULL) /* TODO: set exception */ return NULL; PyArrayScalar_ASSIGN(obj,%(Cls)s,*value); return obj; } ''' template_to_numpy_scalar = ''' static int pyobj_to_%(ctype_name)s(PyObject* obj, %(ctype)s* ptr) { int return_value = 0; if (PyArray_IsScalar(obj, %(Cls)s)) { *ptr = (%(ctype)s)obj; return_value = 1; } else if (PySequence_Check(obj)) { if (PySequence_Size(obj)==1) return_value = pyobj_to_%(ctype_name)s(PySequence_GetItem(obj,0), ptr); } else { PyObject* sc = Py%(Cls)sArrType_Type.tp_new( &Py%(Cls)sArrType_Type,Py_BuildValue("(O)",obj),NULL); if (sc==NULL) ; else if (PyArray_IsScalar(sc, Generic)) return_value = pyobj_to_%(ctype_name)s(sc, ptr); else return_value = pyobj_to_%(ctype_name)s(PyArray_ScalarFromObject(sc), ptr); } if (!return_value && !PyErr_Occurred()) { PyObject* r = PyString_FromString("Failed to convert "); PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj))); PyString_ConcatAndDel(&r, PyString_FromString(" to C %(ctype)s")); PyErr_SetObject(PyExc_TypeError,r); } return return_value; } ''' template_to_numpy_complex_scalar = ''' static int pyobj_to_%(ctype_name)s(PyObject* obj, %(ctype)s* ptr) { int return_value = 0; if (obj==NULL) ; else if (PyArray_IsScalar(obj,%(Cls)s)) { *ptr = (%(ctype)s)obj; return_value = 1; } else if (PySequence_Check(obj)) { if (PySequence_Size(obj)==1) return_value = pyobj_to_%(ctype_name)s(PySequence_GetItem(obj,0),ptr); else if (PySequence_Size(obj)==2) { %(fctype)s r = (%(fctype)s)PyArrayScalar_New(%(FCls)s); if (r!=NULL) { %(fctype)s i = (%(fctype)s)PyArrayScalar_New(%(FCls)s); if (i!=NULL) { return_value = pyobj_to_%(fctype_name)s(PySequence_GetItem(obj,0),&r) && pyobj_to_%(fctype_name)s(PySequence_GetItem(obj,1),&i); if (return_value) { *ptr = (%(ctype)s)PyArrayScalar_New(%(Cls)s); if (*ptr!=NULL) { PyArrayScalar_VAL(*ptr, %(Cls)s).real = PyArrayScalar_VAL(r, %(FCls)s); PyArrayScalar_VAL(*ptr, %(Cls)s).imag = PyArrayScalar_VAL(i, %(FCls)s); } else { return_value = 0; } } Py_DECREF(i); } Py_DECREF(r); } } } else { PyObject* sc = Py%(Cls)sArrType_Type.tp_new( &Py%(Cls)sArrType_Type,Py_BuildValue("(O)",obj),NULL); if (sc==NULL) ; else if (PyArray_IsScalar(sc, Generic)) return_value = pyobj_to_%(ctype_name)s(sc, ptr); else return_value = pyobj_to_%(ctype_name)s(PyArray_ScalarFromObject(sc), ptr); } if (!return_value && !PyErr_Occurred()) { PyObject* r = PyString_FromString("Failed to convert "); PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj))); PyString_ConcatAndDel(&r, PyString_FromString(" to C %(ctype)s")); PyErr_SetObject(PyExc_TypeError,r); } return return_value; } ''' for Cls_name, bits_list in list(sctypebits.items()): for bits in bits_list: n = Cls_name.lower() + str(bits) Cls = Cls_name + str(bits) ctype = 'npy_' + n fn = 'float' + str(bits/2) FCls = 'Float' + str(bits/2) fctype = 'npy_' + fn m = dict(ctype=ctype, Cls=Cls, fctype=fctype) for k in ['to', 'from']: depends = [] if Cls_name=='Complex': code = eval('template_'+k+'_npy_complex_scalar') % m if k=='to': depends = ['pyobj_'+k+'_npy_'+fn] else: code = eval('template_'+k+'_npy_scalar') % m implementation['pyobj_'+k+'_'+ctype] = dict( code = code, depends = depends, ) ctype = 'Py%sScalarObject*' % (Cls) ctype_name = 'numpy_' + n fn = 'float' + str(bits/2) FCls = 'Float' + str(bits/2) fctype = 'Py%sScalarObject*' % (FCls) fctype_name = 'numpy_' + fn m = dict(ctype=ctype, ctype_name=ctype_name, Cls=Cls, fctype=fctype, FCls=FCls, fctype_name=fctype_name) if Cls_name=='Complex': code = template_to_numpy_complex_scalar % m depends = ['pyobj_to_'+fctype_name] else: code = template_to_numpy_scalar % m depends = [] implementation['pyobj_to_'+ctype_name] = dict( code = code, depends = depends, ) implementation['pyobj_to_npy_bool'] = dict(\ code = '''\ static int pyobj_to_npy_bool(PyObject *obj, npy_bool* ptr) { int return_value = 0; if (obj==NULL) ; else if (PyArray_IsScalar(obj, Bool)) { *ptr = PyArrayScalar_VAL(obj, Bool); return_value = 1; } else { switch (PyObject_IsTrue(obj)) { case 0: *ptr = 0; return_value = 1; break; case -1: break; default: *ptr = 1; return_value = 1; } } if (!return_value && !PyErr_Occurred()) { PyObject* r = PyString_FromString("Failed to convert "); PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj))); PyString_ConcatAndDel(&r, PyString_FromString(" to C npy_bool")); PyErr_SetObject(PyExc_TypeError,r); } return return_value; }''') implementation['pyobj_from_npy_bool'] = dict(\ code = '''\ static PyObject* pyobj_from_npy_bool(npy_bool* ptr) { if (*ptr) { PyArrayScalar_RETURN_TRUE; } else { PyArrayScalar_RETURN_FALSE; } }''') implementation['pyobj_to_numpy_bool'] = dict(\ code = '''\ static int pyobj_to_numpy_bool(PyObject *obj, PyBoolScalarObject** ptr) { int return_value = 0; if (obj==NULL) ; else if (PyArray_IsScalar(obj, Bool)) { *ptr = (PyBoolScalarObject*)obj; return_value = 1; } else { switch (PyObject_IsTrue(obj)) { case 0: *ptr = (PyBoolScalarObject*)PyArrayScalar_False; return_value = 1; break; case -1: break; default: *ptr = (PyBoolScalarObject*)PyArrayScalar_True; return_value = 1; } } if (!return_value && !PyErr_Occurred()) { PyObject* r = PyString_FromString("Failed to convert "); PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj))); PyString_ConcatAndDel(&r, PyString_FromString(" to C PyBoolScalarObject*")); PyErr_SetObject(PyExc_TypeError,r); } return return_value; }''') implementation['pyobj_to_char_ptr'] = dict(\ code = '''\ static int pyobj_to_char_ptr(PyObject *obj, char* * ptr) { int return_value = 0; if (obj==NULL) ; else if (PyString_Check(obj)) { Py_ssize_t l = 1+PyString_GET_SIZE(obj); *ptr = malloc(l*sizeof(char)); return_value = !! strncpy(*ptr,PyString_AS_STRING(obj),l); } else { return_value = pyobj_to_char_ptr(PyObject_Str(obj), ptr); } if (!return_value && !PyErr_Occurred()) { PyObject* r = PyString_FromString("Failed to convert "); PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj))); PyString_ConcatAndDel(&r, PyString_FromString(" to C char*")); PyErr_SetObject(PyExc_TypeError,r); } return return_value; }''') implementation['clean_pyobj_to_char_ptr'] = dict(\ code = '''\ static void clean_pyobj_to_char_ptr(char* * ptr) { if ((*ptr) != NULL) { free(*ptr); } }''') implementation['pyobj_to_npy_string'] = dict(\ code = '''\ static int pyobj_to_npy_string(PyObject *obj, npy_string *ptr) { int return_value = 0; if (obj==NULL) ; else if (PyArray_IsScalar(obj, String)) { Py_ssize_t l = 1+PyString_GET_SIZE(obj); ptr->data = malloc(l*sizeof(char)); ptr->size = l-1; return_value = !! strncpy(ptr->data,PyString_AS_STRING(obj),l); } else { PyObject* sc = PyStringArrType_Type.tp_new( &PyStringArrType_Type,Py_BuildValue("(O)",obj),NULL); if (sc==NULL) ; else if (PyArray_IsScalar(sc, Generic)) return_value = pyobj_to_npy_string(sc, ptr); else return_value = pyobj_to_npy_string(PyArray_ScalarFromObject(sc), ptr); } if (!return_value && !PyErr_Occurred()) { PyObject* r = PyString_FromString("Failed to convert "); PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj))); PyString_ConcatAndDel(&r, PyString_FromString(" to C char*")); PyErr_SetObject(PyExc_TypeError,r); } return return_value; }''') implementation['clean_pyobj_to_npy_string'] = dict(\ code = '''\ static void clean_pyobj_to_npy_string(npy_string *ptr) { if ((ptr->data) != NULL) { free(ptr->data); ptr->size = 0; } } ''') implementation['pyobj_from_npy_string'] = dict(\ code = '''\ static PyObject* pyobj_from_npy_string(npy_string *ptr) { PyObject* sc = PyStringArrType_Type.tp_new( &PyStringArrType_Type,Py_BuildValue("(O)", PyString_FromStringAndSize(ptr->data, ptr->size)),NULL); return sc; }''') implementation['pyobj_to_numpy_string'] = dict(\ code = '''\ static int pyobj_to_numpy_string(PyObject *obj, PyStringScalarObject** ptr) { int return_value = 0; if (PyArray_IsScalar(obj, String)) { *ptr = (PyStringScalarObject*)obj; return_value = 1; } else { PyObject* sc = PyStringArrType_Type.tp_new( &PyStringArrType_Type,Py_BuildValue("(O)",obj),NULL); if (sc==NULL) ; else if (PyArray_IsScalar(sc, Generic)) return_value = pyobj_to_numpy_string(sc, ptr); else return_value = pyobj_to_numpy_string(PyArray_ScalarFromObject(sc), ptr); } if (!return_value && !PyErr_Occurred()) { PyObject* r = PyString_FromString("Failed to convert "); PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj))); PyString_ConcatAndDel(&r, PyString_FromString(" to C PyStringScalarObject*")); PyErr_SetObject(PyExc_TypeError,r); } return return_value; } ''') implementation['pyobj_to_numpy_unicode'] = dict(\ code = '''\ static int pyobj_to_numpy_unicode(PyObject *obj, PyUnicodeScalarObject** ptr) { int return_value = 0; if (PyArray_IsScalar(obj, Unicode)) { *ptr = (PyUnicodeScalarObject*)obj; return_value = 1; } else { PyObject* sc = PyUnicodeArrType_Type.tp_new( &PyUnicodeArrType_Type,Py_BuildValue("(O)",obj),NULL); if (sc==NULL) ; else if (PyArray_IsScalar(sc, Generic)) return_value = pyobj_to_numpy_unicode(sc, ptr); else return_value = pyobj_to_numpy_unicode(PyArray_ScalarFromObject(sc), ptr); } if (!return_value && !PyErr_Occurred()) { PyObject* r = PyString_FromString("Failed to convert "); PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj))); PyString_ConcatAndDel(&r, PyString_FromString(" to C PyUnicodeScalarObject*")); PyErr_SetObject(PyExc_TypeError,r); } return return_value; } ''') implementation['pyobj_to_npy_unicode'] = dict(\ code = '''\ static int pyobj_to_npy_unicode(PyObject *obj, npy_unicode * ptr) { int return_value = 0; if (obj==NULL) ; else if (PyArray_IsScalar(obj, Unicode)) { Py_ssize_t l = PyUnicode_GET_DATA_SIZE(obj); ptr->data = malloc(l); ptr->size = PyUnicode_GET_SIZE(obj); return_value = !! memcpy(ptr->data,PyUnicode_AS_UNICODE(obj),l); } else { PyObject* sc = PyUnicodeArrType_Type.tp_new( &PyUnicodeArrType_Type,Py_BuildValue("(O)",obj),NULL); if (sc==NULL) ; else if (PyArray_IsScalar(sc, Generic)) return_value = pyobj_to_npy_unicode(sc, ptr); else return_value = pyobj_to_npy_unicode(PyArray_ScalarFromObject(sc), ptr); } if (!return_value && !PyErr_Occurred()) { PyObject* r = PyString_FromString("Failed to convert "); PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj))); PyString_ConcatAndDel(&r, PyString_FromString(" to C Py_UNICODE*")); PyErr_SetObject(PyExc_TypeError,r); } return return_value; }''') implementation['clean_pyobj_to_npy_unicode'] = dict(\ code = '''\ static void clean_pyobj_to_npy_unicode(npy_unicode * ptr) { if ((ptr->data) != NULL) { free(ptr->data); ptr->size = 0; } } ''') implementation['pyobj_from_npy_unicode'] = dict(\ code = '''\ static PyObject* pyobj_from_npy_unicode(npy_unicode *ptr) { PyObject* sc = PyUnicodeArrType_Type.tp_new( &PyUnicodeArrType_Type,Py_BuildValue("(O)",PyUnicode_FromUnicode(ptr->data, ptr->size)),NULL); return sc; }''') implementation['pyobj_to_numpy_void'] = dict(\ code = '''\ static int pyobj_to_numpy_void(PyObject *obj, PyVoidScalarObject** ptr) { int return_value = 0; if (PyArray_IsScalar(obj, Void)) { *ptr = (PyVoidScalarObject*)obj; return_value = 1; } else { PyObject* sc = PyVoidArrType_Type.tp_new( &PyVoidArrType_Type,Py_BuildValue("(O)",obj),NULL); if (sc==NULL) ; else if (PyArray_IsScalar(sc, Generic)) return_value = pyobj_to_numpy_void(sc, ptr); else return_value = pyobj_to_numpy_void(PyArray_ScalarFromObject(sc), ptr); } if (!return_value && !PyErr_Occurred()) { PyObject* r = PyString_FromString("Failed to convert "); PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj))); PyString_ConcatAndDel(&r, PyString_FromString(" to C PyVoidScalarObject*")); PyErr_SetObject(PyExc_TypeError,r); } return return_value; } ''') implementation['pyobj_to_numpy_array_int64'] = dict(\ code = '''\ static int pyobj_to_numpy_array_int64(PyObject *obj, PyArrayObject** ptr) { int return_value = 0; if (PyArray_Check(obj)) { if (PyArray_TYPE(obj)==PyArray_INT64) { *ptr = (PyArrayObject*)obj; return_value = 1; } } else { PyObject* arr = PyArray_FROM_OT(obj, PyArray_INT64); return_value = pyobj_to_numpy_array_int64(arr, ptr); } if (!return_value && !PyErr_Occurred()) { PyObject* r = PyString_FromString("Failed to convert "); PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj))); PyString_ConcatAndDel(&r, PyString_FromString(" to C ")); PyErr_SetObject(PyExc_TypeError,r); } return return_value; } ''' )
33.822976
103
0.652673
2,286
17,960
4.841207
0.069116
0.083491
0.056926
0.042288
0.801301
0.741213
0.708593
0.643625
0.610192
0.593205
0
0.008929
0.195546
17,960
530
104
33.886792
0.75706
0
0
0.545272
0
0
0.845267
0.413586
0
0
0
0
0
1
0
false
0
0.004024
0
0.038229
0
0
0
0
null
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
97350c90bae5d218c1ffc8633d7a1605cbb3170c
94
py
Python
requests_base/__init__.py
michaeltinsley/requests-base
ecd5de7aa808f0f1c18de6968cc1e9d264cda4f6
[ "MIT" ]
null
null
null
requests_base/__init__.py
michaeltinsley/requests-base
ecd5de7aa808f0f1c18de6968cc1e9d264cda4f6
[ "MIT" ]
1
2021-08-30T09:29:49.000Z
2021-08-30T09:44:32.000Z
requests_base/__init__.py
michaeltinsley/requests-base
ecd5de7aa808f0f1c18de6968cc1e9d264cda4f6
[ "MIT" ]
null
null
null
""" A Requests Session with a base URL. """ from .requests_base import BaseUrlSession # noqa
18.8
49
0.734043
13
94
5.230769
0.769231
0
0
0
0
0
0
0
0
0
0
0
0.170213
94
4
50
23.5
0.871795
0.43617
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
973f98d98e3f41d8c4a8efbe15fd96195a1b5032
191
py
Python
myawwards/admin.py
Bridgit-wairimu/Awwards
285551161a3bf8ae06ad731c2b9feafae27b00e3
[ "MIT" ]
null
null
null
myawwards/admin.py
Bridgit-wairimu/Awwards
285551161a3bf8ae06ad731c2b9feafae27b00e3
[ "MIT" ]
null
null
null
myawwards/admin.py
Bridgit-wairimu/Awwards
285551161a3bf8ae06ad731c2b9feafae27b00e3
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import Profile,Post,Rating # Register your models here. admin.site.register(Profile) admin.site.register(Post) admin.site.register(Rating)
27.285714
40
0.790576
27
191
5.592593
0.481481
0.178808
0.337748
0
0
0
0
0
0
0
0
0
0.115183
191
7
41
27.285714
0.893491
0.136126
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.4
0
0.4
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5